public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [ssdd] add ptrace tierdown for the tests
@ 2026-01-16  8:37 Attila Fazekas
  2026-01-16 15:32 ` Derek Barbosa
  0 siblings, 1 reply; 2+ messages in thread
From: Attila Fazekas @ 2026-01-16  8:37 UTC (permalink / raw)
  To: williams, jkacur, debarbos; +Cc: linux-rt-users, Attila Fazekas

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

Signed-off-by: Attila Fazekas <afazekas@redhat.com>
---
 src/ssdd/ssdd.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index 63130cd..61aab84 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -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);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [ssdd] add ptrace tierdown for the tests
  2026-01-16  8:37 [PATCH] [ssdd] add ptrace tierdown for the tests Attila Fazekas
@ 2026-01-16 15:32 ` Derek Barbosa
  0 siblings, 0 replies; 2+ messages in thread
From: Derek Barbosa @ 2026-01-16 15:32 UTC (permalink / raw)
  To: Attila Fazekas; +Cc: williams, jkacur, linux-rt-users, lgoncalv

On Fri, Jan 16, 2026 at 03:37:36AM -0500, Attila Fazekas wrote:
> 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
> 
> Signed-off-by: Attila Fazekas <afazekas@redhat.com>
> ---
>  src/ssdd/ssdd.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
> index 63130cd..61aab84 100644
> --- a/src/ssdd/ssdd.c
> +++ b/src/ssdd/ssdd.c
> @@ -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);
> -- 
> 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

> 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?

-- 
Derek <debarbos@redhat.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-16 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-16  8:37 [PATCH] [ssdd] add ptrace tierdown for the tests Attila Fazekas
2026-01-16 15:32 ` Derek Barbosa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox