[PATCH] getXXent_r and getXXbyYY_r not really thread safe
Thorsten Kukuk
kukuk@suse.de
Mon Sep 13 18:13:00 GMT 2004
On Mon, Sep 13, Ulrich Drepper wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> That is by design. Different threads can use the getXXent functions
> together. Since these functions are not to be used anyway there is not
> need to make this more complicated.
>
> And now it is completely out of question to change this anyway, it
> breaks the ABI which exists for more than 8 years now. There might as
> well be code depending on this behavior.
But this behavior is contrary to the behavior of commercial Unix
systems.
And there are two other problems:
1. We use the getXXent functions internal from getXXbyYY_r functions
in all NSS modules, even the nss_files module does so. This means,
if two threads calls a getXXbyYY_r function, it can happen that one
function returns wrong a "not found" error. I got more than one
report for the servent functions, which make heavyly use of this.
The netgroup functions have a similar problem, as result, if you
use netgroups in /etc/passwd, an account is suddenly no longer allowed
to login or, for /etc/exports, a client is suddenly no longer allowed
to mount a share.
2. Calling getXXbyYY_r() from concurrent threads could mean, that
the service pointer in libc could be changed at a time in such a
way, that the second thread will never get the data from one
service.
Both failures will happen more often as more programs will use
threads.
Thorsten
--
Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de
SuSE Linux AG Maxfeldstr. 5 D-90409 Nuernberg
--------------------------------------------------------------------
Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B
More information about the Libc-alpha
mailing list