Summary: | pthread_setname_np segfault | ||
---|---|---|---|
Product: | glibc | Reporter: | law |
Component: | nptl | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | CC: | drepper.fsp, jakub, neleai, yselkowi |
Priority: | P2 | Flags: | fweimer:
security-
|
Version: | 2.15 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
law
2012-02-22 19:05:25 UTC
Since pthread_setname_np is undocumented, I'm not sure what the desired solution is in this case: 1) Return EFAULT, just as pthread_getname_np (thr, NULL, 16). 2) Leave the nonnull attribute but treat NULL as "" just in case. 3) Remove the nonnull attribute and allow NULL as synonym for "". When it isn't documented in man pages or info pages, the headers are the only documentation. And the headers clearly document that you must not call it with NULL: /* Get thread name visible in the kernel and its interfaces. */ extern int pthread_getname_np (pthread_t __target_thread, char *__buf, size_t __buflen) __THROW __nonnull ((2)); /* Set thread name visible in the kernel and its interfaces. */ extern int pthread_setname_np (pthread_t __target_thread, __const char *__name) __THROW __nonnull ((2)); (In reply to comment #2) > When it isn't documented in man pages or info pages, the headers are the only > documentation. And the headers clearly document that you must not call it with > NULL: I understand that, but that doesn't necessarily mean it should segfault if NULL is passed anyway. pthread_getname_np(thr, NULL, 16) returns EFAULT, but pthread_setname_np(thr, NULL) segfaults. That inconsistency in a corresponding pair of functions seems odd to me, hence the question if this is the intended result. It's consistently undefined behaviour. In discussion at http://www.sourceware.org/ml/libc-alpha/2013-10/msg00111.html we decided that crashing is better as error code will likely be ignored. |