about summary refs log tree commit diff
path: root/nss/getservent_r.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@redhat.com>2024-08-07 19:46:21 +0100
committerMaciej W. Rozycki <macro@redhat.com>2024-08-07 19:46:21 +0100
commit934ba77add195dde2c922b4ae809968cde62a1ff (patch)
tree6b29c7438854800057aac2ee84628a77f654e53e /nss/getservent_r.c
parent6396e10b200f3d7ec5b40df56d9e0cc892163817 (diff)
downloadglibc-934ba77add195dde2c922b4ae809968cde62a1ff.tar.gz
glibc-934ba77add195dde2c922b4ae809968cde62a1ff.tar.xz
glibc-934ba77add195dde2c922b4ae809968cde62a1ff.zip
nptl: Reorder semaphore release in tst-cancel7
Move the release of the semaphore used to synchronize between an extra
copy of the test run as a separate process and the main test process
until after the PID file has been locked.  It is so that if the cleanup
function gets called by the test driver due to premature termination of
the main test process, then the function does not get at the PID file
before it has been locked and conclude that the extra copy of the test
has already terminated.  This won't usually happen due to a relatively
high amount of time required to elapse before timeout triggers in the
test driver, but it will change with the next change.

There is still a small time window remaining with this change in place
where the main test process gets killed for some reason between the
extra copy of the test has been already started by pthread_create(3) and
a successful return from the call to sem_wait(3), in which case the
cleanup function can be reached before PID has been written to the PID
file and the file locked.  It seems that with the test case structured
as it is now and PID-based process management we have no means to avoid
it.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nss/getservent_r.c')
0 files changed, 0 insertions, 0 deletions