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: Roland McGrath <roland at hack dot frob dot com>
- Cc: OndÅej BÃlka <neleai at seznam dot cz>, libc-alpha at sourceware dot org
- Date: Tue, 08 Oct 2013 11:58:30 -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> <20131007224055 dot 53DB12C058 at topped-with-meat dot com>
On 10/07/2013 06:40 PM, Roland McGrath wrote:
>> I agree with Jeff Law on this one, this is not a performance
>> critical routine and checking arguments and returning EFAULT
>> is good for QoI.
> Historically we've considered it a QoI feature not to mask user bugs in
> this way. If passing a bad pointer has undefined behavior, it is far more
> useful in the long run if it crashes quickly rather than diagnosing an
> error that is probably ignored by the flaky caller.
Two against one here, and I trust your judgement and Rich's judgement,
having seen much more crappy code than I will ever imagine.
I've added a section to our "Style and Conventions" guide about invalid pointers:
Would you still be interested in adding a small entry to the manual to
say that NULL pointers are not accepted, and that if you want to remove
the program name for the thread to call pthread_setname_np (th, "");
instead of pthread_setname_np (th, NULL); which would just have failed
with -EFAULT when the kernel prctrl call was made.
Is everyone in agreement here?