add ptrace tierdown for the tests
PATCH 1/1 add ptrace tierdown for the tests
Without tierdown the tracee can receive SIGTRAP leading to multiple core dumps being created. At higher concurrency you may also see
coredump: 11747(ssdd): over core_pipe_limit, skipping core dump
in the dmesg with
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %d %F kernel.core_pipe_limit = 16
--- src/ssdd/ssdd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
src/ssdd/ssdd.c +16 -2
@@ -312,9 +312,23 @@ static int forktests(int testid) got_sigchld =0 ; } -/* There is no need for the tracer to kill the tracee. It will -* automatically exit when its owner, ie, us, exits. +/* The tracee can receive SIGTRAP(dump) without detaching. */ + pstatus =ptrace (PTRACE_DETACH , child,NULL ,NULL ); +if (pstatus == ~0l ) { +printf ("forktest#%d/%d: EXITING, ERROR: " +"detach failed. errno %d\n" , + testid,getpid (), errno); +exit (1 ); + } + pstatus =kill (child,SIGKILL ); +if (pstatus !=0 ) { +printf ("forktest#%d/%d: EXITING, ERROR: " +"kill failed. errno %d\n" , + testid,getpid (), errno); +exit (1 ); + } +if (!quiet)printf ("forktest#%d/%d: EXITING, no error\n" , testid, parent);exit (0 );
Signature · 1 line
2.52.0
Quoted 48 lines · Attila Fazekas
Without tierdown the tracee can receive SIGTRAP
leading to multiple core dumps being created.
At higher concurrency you may also seecoredump: 11747(ssdd): over
core_pipe_limit, skipping core dumpin the dmesg with
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %d %F kernel.core_pipe_limit = 16Signed-off-by Attila Fazekas <[email protected]>--- src/ssdd/ssdd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)src/ssdd/ssdd.c +16
-2@@ -312,9 +312,23 @@ static int forktests(int testid) got_sigchld =0 ; } -/* There is no need for the tracer to kill the tracee. It will -* automatically exit when its owner, ie, us, exits. +/* The tracee can receive SIGTRAP(dump) without detaching. */ + pstatus =ptrace (PTRACE_DETACH , child,NULL ,NULL ); +if (pstatus == ~0l ) { +printf ("forktest#%d/%d: EXITING, ERROR: " +"detach failed. errno %d\n" , + testid,getpid (), errno); +exit (1 ); + } + pstatus =kill (child,SIGKILL ); +if (pstatus !=0 ) { +printf ("forktest#%d/%d: EXITING, ERROR: " +"kill failed. errno %d\n" , + testid,getpid (), errno); +exit (1 ); + } +if (!quiet)printf ("forktest#%d/%d: EXITING, no error\n" , testid, parent);exit (0 );Signature · 1 line
2.52.0
CC-ing lgoncalv from off-list convo.
From man 2 ptrace:
If the tracer dies, all tracees are automatically detached and
restarted, unless they were in group-stop.
From our off-list conversation (and the previous comment in the code itself) it appears to be expected that there is no need for kill() to perform a final cleanup. That doesn't seem to be the case as you noted the process still remains without it.
I'm unsure if this is known behavior or not. Or I could just be misinterpreting it :)
Anyway, Luis, you mentioned
Quoted 3 lines
There are many other places where the results of the ptrace call needs to be checked in order to either repeat the OP or fail the whole process for being in a different state than expected
Should we propose that the added snippet above (detach, kill) be moved into a helper, and called in lieu of exit(1) in the many if-blocks where we check to see if the tracee is being stepped?
John, Clark, any thoughts?
Signature · 1 line
Derek <[email protected]>