syscalls/clone301: Fix race between parent and child
PATCH 1/1 syscalls/clone301: Fix race between parent and child
The signal handler has to be set up before we clone() the child, otherwise the signal may be lost if the child manages to call exit() before parent is able to continue.
Reported-by Richard Palethorpe <[email protected]>
Signed-off-by Cyril Hrubis <[email protected]>
--- testcases/kernel/syscalls/clone3/clone301.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/clone3/clone301.c +3 -3
@@ -103,12 +103,12 @@ static void run(unsigned int n)return ; } -if (!pid) -do_child (clone_pidfd, n); - parent_received_signal =0 ;SAFE_SIGACTION (tc->exit_signal, &psig_action,NULL ); +if (!pid) +do_child (clone_pidfd, n); +/* Need to send signal to child process */ if (clone_pidfd) {TST_CHECKPOINT_WAIT (0 );
Signature · 1 line
2.24.1
PATCH 1/1 syscalls/clone301: Fix race between parent and child
Hello,
Quoted 20 lines · Cyril Hrubis
The signal handler has to be set up before we
clone()the child, otherwise the signal may be lost if the child manages to callexit()before parent is able to continue.Reported-by Richard Palethorpe <[email protected]>Signed-off-by Cyril Hrubis <[email protected]>--- testcases/kernel/syscalls/clone3/clone301.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)testcases/kernel/syscalls/clone3/clone301.c +0
-2@@ -103,12 +103,12 @@ static void run(unsigned int n)return ; } -if (!pid) -do_child (clone_pidfd, n);
testcases/kernel/syscalls/clone3/clone301.c static void run(unsigned int n) · line 114
Quoted 10 lines
testcases/kernel/syscalls/clone3/clone301.c +3
-1- parent_received_signal =0 ;SAFE_SIGACTION (tc->exit_signal, &psig_action,NULL ); +if (!pid) +do_child (clone_pidfd, n); +/* Need to send signal to child process */ if (clone_pidfd) {TST_CHECKPOINT_WAIT (0 );
LGTM
Signature · 2 lines
Thank you, Richard.