[PATCH][BZ #13724] Do not segfault in pthread_setname_np (x, NULL)
Carlos O'Donell
carlos@redhat.com
Tue Oct 8 15:58:00 GMT 2013
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.
Roland, Rich,
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:
https://sourceware.org/glibc/wiki/Style_and_Conventions#Invalid_pointers
Please review.
Ondrej,
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?
Cheers,
Carlos.
More information about the Libc-alpha
mailing list