* [musl] pthread_getspecific(3) with negative key
@ 2020-07-08 8:59 Alexander Scherbatiy
2020-07-08 10:40 ` Florian Weimer
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Scherbatiy @ 2020-07-08 8:59 UTC (permalink / raw)
To: musl
Hello,
The pthread_getspecific(3) specification describes:
"The pthread_getspecific() function shall return the thread-specific
data value associated with the given key. If no thread-specific data
value is associated with key, then the value NULL shall be returned. "
The glibc version pthread_getspecific(3) returns NULL for the negative
key value.
The musl version does not check key bounds [1].
Is it intentional behavior?
[1]
https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_getspecific.c#n7
Thanks,
Alexander.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [musl] pthread_getspecific(3) with negative key
2020-07-08 8:59 [musl] pthread_getspecific(3) with negative key Alexander Scherbatiy
@ 2020-07-08 10:40 ` Florian Weimer
0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2020-07-08 10:40 UTC (permalink / raw)
To: Alexander Scherbatiy; +Cc: musl
* Alexander Scherbatiy:
> The pthread_getspecific(3) specification describes:
> "The pthread_getspecific() function shall return the thread-specific
> data value associated with the given key. If no thread-specific data
> value is associated with key, then the value NULL shall be returned. "
POSIX says this:
| The effect of calling pthread_getspecific() or pthread_setspecific()
| with a key value not obtained from pthread_key_create() or after key
| has been deleted with pthread_key_delete() is undefined.
So no check for a valid key is required.
Thanks,
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-08 10:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 8:59 [musl] pthread_getspecific(3) with negative key Alexander Scherbatiy
2020-07-08 10:40 ` Florian Weimer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).