This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #13724] Do not segfault in pthread_setname_np (x, NULL)


On Wed, Oct 09, 2013 at 01:15:53PM -0600, Jeff Law wrote:
> On 10/09/13 12:02, Carlos O'Donell wrote:
> >On 10/09/2013 01:57 PM, Jeff Law wrote:
> >>On 10/09/13 11:53, Carlos O'Donell wrote:
> >>>Right, you could wrap everything up and check all inputs against
> >>>non-NULL where the headers say __attribute__ ((__nonnull__
> >>>params)) or __nonnull(params) (short-hand in glibc).
> >>But using the attributes are compile-time checks only.  Using an
> >>LD_PRELOAD provides runtime checking
> >
> >I agree, what I want to say was that to automatically generate the
> >wrappers and check against null parameters you can parse the public
> >headers and look for glibc's __nonnull markups?
> Oh, yea, I guess that could be done.  Never thought of that.
> 
> jeff

I realized that for this case should be handled at gcc part. A
preloading could find all nonnull violations for glibc functions but
if gcc automatically adds null check when compiled with FORTIFY_SOURCE 
(or -fcheck-nonnull) then we could check violations everywhere.

Second benefit is that gcc will optimize checks that are not needed.

Is there PR for it or should I file one?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]