Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Anders Roxell <anders.roxell@linaro.org>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] tst_clone: Fix child detection on sparc
Date: Tue, 29 Sep 2026 16:21:56 +0200	[thread overview]
Message-ID: <20260929142156.GB2462033@pevik> (raw)
In-Reply-To: <20260929084253.3093742-1-anders.roxell@linaro.org>

Hi Anders,

> On sparc the clone syscall does not return 0 in the child. It returns
> the parent pid, so the child thinks it is the parent.

So, somebody still test sparc :). Before applying a workaround few questions.

I suppose this is because we did not updated our syscalls numbers.


I send a patch which regenerated syscall numbers to have clone3 on sparc (both
32 and 64 bit) v7.0:

$ include/lapi/syscalls/generate_arch.sh ../linux

Can you please verify it works with clone3()? It was added this year in v7.0 in
2153b2e8917b7 ("sparc: Add architecture support for clone3")

Do we care about the past?

Kind regards,
Petr

> Save the pid before the clone and compare it after.

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  lib/tst_clone.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

> diff --git a/lib/tst_clone.c b/lib/tst_clone.c
> index 296cd40ac0a0..d7f005a2d2a5 100644
> --- a/lib/tst_clone.c
> +++ b/lib/tst_clone.c
> @@ -20,6 +20,9 @@ pid_t tst_clone(const struct tst_clone_args *tst_args)
>  	};
>  	int flags;
>  	pid_t pid = -1;
> +#ifdef __sparc__
> +	pid_t parent_pid = tst_getpid();
> +#endif

>  	tst_flush();

> @@ -44,5 +47,10 @@ pid_t tst_clone(const struct tst_clone_args *tst_args)
>  	if (pid == -1)
>  		return -2;

> +#ifdef __sparc__
> +	if (pid == parent_pid)
> +		pid = 0;
> +#endif
> +
>  	return pid;
>  }

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2026-09-29 14:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  8:42 [LTP] [PATCH v2] tst_clone: Fix child detection on sparc Anders Roxell
2026-09-29 11:16 ` [LTP] " linuxtestproject.agent
2026-09-29 14:21 ` Petr Vorel [this message]
2026-09-30 12:16   ` [LTP] [PATCH v2] " Anders Roxell
2026-09-30 13:53     ` Petr Vorel
2026-09-30 19:42       ` Anders Roxell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260929142156.GB2462033@pevik \
    --to=pvorel@suse.cz \
    --cc=anders.roxell@linaro.org \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox