This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH][BZ #13724] Do not segfault in pthread_setname_np (x, NULL)
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Rich Felker <dalias at aerifal dot cx>, OndÅej BÃlka <neleai at seznam dot cz>, libc-alpha at sourceware dot org
- Date: Wed, 09 Oct 2013 14:02:22 -0400
- Subject: Re: [PATCH][BZ #13724] Do not segfault in pthread_setname_np (x, NULL)
- Authentication-results: sourceware.org; auth=none
- References: <20131003122009 dot GA8891 at domone dot podge> <524DCA52 dot 2030609 at redhat dot com> <20131007141928 dot GV20515 at brightrain dot aerifal dot cx> <52542C63 dot 10305 at redhat dot com> <20131008162738 dot GG20515 at brightrain dot aerifal dot cx> <52545389 dot 6000901 at redhat dot com> <52545730 dot 6090306 at redhat dot com> <52559822 dot 2010802 at redhat dot com> <525598F6 dot 3000907 at redhat dot com>
On 10/09/2013 01:57 PM, Jeff Law wrote:
> On 10/09/13 11:53, Carlos O'Donell wrote:
>> On 10/08/2013 03:04 PM, Jeff Law wrote:
>>>> It seems incredibly useful to enable the asserts and trigger
>>>> these violations as early as possible. If you don't care you
>>>> can disable the asserts?
>>> Another approach would be similar to what we're doing with
>>> memstomp. ie, build a set of wrappers which check for these
>>> argument goofs and allow users to dl-preload DSOs with the
>>> When I first proposed the idea for these sanity checking
>>> dl-preload libraries for Fedora I envisioned that we could go
>>> beyond just checking for overlapping memory areas in the mem* and
>>> str* functions. There could be a set of pthread wrapper functions
>>> that check for whatever invariants we can in the pthread*
>>> functions without a huge performance hit.
>> 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?