From: Peter Maydell <peter.maydell@linaro.org>
To: Andreas Schwab <schwab@suse.de>
Cc: Laurent Vivier <laurent@vivier.eu>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH] linux-user/syscall: add support for CLONE_PIDFD
Date: Mon, 27 Sep 2021 14:42:18 +0100 [thread overview]
Message-ID: <CAFEAcA-Dj2fpB2O50ywBmsxd8Us6gi7umbDxBLmW1=3kFd50uA@mail.gmail.com> (raw)
In-Reply-To: <mvm4kadwyrm.fsf@suse.de>
On Tue, 21 Sept 2021 at 19:50, Andreas Schwab <schwab@suse.de> wrote:
>
> Add basic support for CLONE_PIDFD, only fork-like clone without additional
> flags. This is enough to make Qt/forkfd working.
>
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
> linux-user/syscall.c | 52 ++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 50 insertions(+), 2 deletions(-)
> /* We can't directly call the host clone syscall, because this will
> * badly confuse libc (breaking mutexes, for example). So we must
So, this pre-existing comment says "we can't directly call the
host clone syscall"...
> +#if defined __NR_clone2
> +#define __NR_sys_clone2 __NR_clone2
> +_syscall6(int, sys_clone2, int, flags, void *, child_stack, size_t, stack_size,
> + int *, ptid, int *, ctid, void *, newtls);
> +#else
> +#define __NR_sys_clone __NR_clone
> +#if defined __cris__ || defined __s390x__
> +_syscall5(int, sys_clone, void *, child_stack, int, flags, int *, ptid,
> + void *, newtls, int *, ctid);
> +#elif defined __microblaze__
> +_syscall6(int, sys_clone, int, flags, void *, child_stack, size_t, stack_size,
> + int *, ptid, void *, newtls, int *, ctid);
> +#else
> +/*
> + * Note: ctid and newtls are swapped on some architectures, but both are
> + * passed as NULL only for now.
> + */
> +_syscall5(int, sys_clone, int, flags, void *, child_stack, int *, ptid,
> + int *, ctid, void *, newtls);
> +#endif
> +#endif
> +static int sys_clone_pidfd(int flags, int *pidfd)
> +{
> +#ifdef __NR_clone2
> + return sys_clone2(flags, NULL, 0, pidfd, NULL, NULL);
> +#elif defined __cris__ || defined __s390x__
> + return sys_clone(NULL, flags, pidfd, NULL, NULL);
> +#elif defined __microblaze__
> + return sys_clone(flags, NULL, 0, pidfd, NULL, NULL);
> +#else
> + return sys_clone(flags, NULL, pidfd, NULL, NULL);
> +#endif
> +}
...but this patch introduces code which directly calls the host
clone syscall.
I think this ought to have a bit more explanation and updating
of the existing comments to explain why this is OK.
thanks
-- PMM
next prev parent reply other threads:[~2021-09-27 14:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-21 18:48 [PATCH] linux-user/syscall: add support for CLONE_PIDFD Andreas Schwab
2021-09-27 13:42 ` Peter Maydell [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-08-02 12:55 Andreas Schwab
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='CAFEAcA-Dj2fpB2O50ywBmsxd8Us6gi7umbDxBLmW1=3kFd50uA@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=schwab@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).