aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/ttyname.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
commitbea2ad022dadae46059de681d902129e56653c85 (patch)
tree22701b2972cfbe357cd3da1c58d8f29a0a664897 /sysdeps/unix/sysv/linux/ttyname.c
parent934ba77add195dde2c922b4ae809968cde62a1ff (diff)
downloadglibc-master.zip
glibc-master.tar.gz
glibc-master.tar.bz2
nptl: Fix stray process left by tst-cancel7 blocking testingHEADmaster
Fix an issue with commit b74121ae4bc5 ("Update.") and prevent a stray process from being left behind by tst-cancel7 (and also tst-cancelx7, which is the same test built with '-fexceptions' additionally supplied to the compiler), which then blocks remote testing until the process has been killed by hand. This test case creates a thread that runs an extra copy of the test via system(3) and using the '--direct' option so that the test wrapper does not interfere with this instance. This extra copy executes its business and calls sigsuspend(2) and then never terminates by itself. Instead it relies on being killed by the main test process directly via a thread cancellation request or, should that fail, by issuing SIGKILL either at the conclusion of 'do_test' or by the test driver via 'do_cleanup' where the test timeout has been hit or the test driver interrupted. However if the main test process has been instead killed by a signal, such as due to incorrect execution, before it had a chance to kill the extra copy of the test case, then the test wrapper will terminate without running 'do_cleanup' and consequently the extra copy of the test case will remain forever in its suspended state, and in the remote case in particular it means that the remote test wrapper will wait forever for the SSH command to complete. This has been observed with the 'alpha-linux-gnu' target, where the main test process triggers SIGSEGV and the test wrapper correctly records: Didn't expect signal from child: got `Segmentation fault' in nptl/tst-cancel7.out and terminates, but then the calling SSH command continues waiting for the remaining process started in the same session on the remote target to complete. Address this problem by also registering 'do_cleanup' via atexit(3), observing that 'support_delete_temp_files' is registered by the test wrapper before the test initializing function 'do_prepare' is called and that we call all the functions registered in the reverse of the order in which they were registered, so it is safe to refer to 'pidfilename' in 'do_cleanup' invoked by exit(3) because by that time temporary files have not yet been deleted. A minor inconvenience is that if 'signal_handler' is invoked in the test wrapper as a result of SIGALRM rather than SIGINT, then 'do_cleanup' will be called twice, once as a cleanup handler and again by exit(3). In reality it is harmless though, because issuing SIGKILL is guarded by a record lock, so if the first call has succeeded in killing the extra copy of the test case, then the subsequent call will do nothing. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix/sysv/linux/ttyname.c')
0 files changed, 0 insertions, 0 deletions