public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Florian Weimer <fweimer@redhat.com>,
	 "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
Subject: [PATCH v2] Add an internal wrapper for clone, clone2 and clone3
Date: Thu, 4 Mar 2021 10:40:48 -0800	[thread overview]
Message-ID: <CAMe9rOoqKCtCo7b13dsXNgtVLEGW9XshnxfNfnnxuTEqgVWvVg@mail.gmail.com> (raw)
In-Reply-To: <7e132276-269f-b9c6-72fe-9d771e023d29@linaro.org>

On Mon, Feb 15, 2021 at 6:56 AM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
>
>
> On 15/02/2021 07:44, Florian Weimer via Libc-alpha wrote:
> > * H. J. Lu via Libc-alpha:
> >
> >> The clone3 system call provides a superset of the functionality of clone
> >> and clone2.  It also provides a number of API improve ments, including
> >> the ability to specify the size of the child's stack area which can be
> >> used by kernel to compute the shadow stack size when allocating the
> >> shadow stack.  Add:
> >>
> >> extern int __clone_internal (struct clone_args *cl_args, size_t size,
> >>                           int (*__fn) (void *__arg), void *__arg);
> >>
> >> to provide an abstract interface for clone, clone2 and clone3.
> >>
> >> 1. Simplify stack management for clone by passing stack base and size
> >> to __clone_internal.
> >> 2. Consolidate clone vs clone2 differences into a single file.
> >> 3. Use only __clone_internal to clone a thread.  If clone3 returns -1
> >> with ENOSYS, __clone_internal will fall back to clone or clone2.
> >> 4. Add the x86-64 clone3 wrapper.
> >> 5. Enable the public clone3 wrapper in the future after it has been
> >> added to add targets.
> >
> > What do you think about providing a clone wrapper which reuses the
> > caller's stack?  That would be useful for a (v)fork-style clone.  This
> > variant could also be exported because the callback inherits a
> > semi-valid TCB in this case.
> I have this one as a TODO to improve the posix_spawn.

Here is the v2 patch:

1. Update the stack size field, instead of the stack field, passed to
clone3.

OK for master?

Thanks.


-- 
H.J.

  reply	other threads:[~2021-03-04 18:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-14 22:45 [PATCH] " H.J. Lu
2021-02-15 10:44 ` Florian Weimer
2021-02-15 14:17   ` H.J. Lu
2021-02-15 14:27     ` Florian Weimer
2021-02-15 14:44       ` H.J. Lu
2021-02-15 14:39   ` Adhemerval Zanella
2021-03-04 18:40     ` H.J. Lu [this message]
2021-03-04 18:50       ` [PATCH v2] " H.J. Lu
2021-03-05  8:32         ` Christian Brauner
2021-03-05 16:59           ` [PATCH v3] " H.J. Lu
2021-03-18 23:18             ` PING^1 " H.J. Lu
2021-04-19 12:56             ` H.J. Lu
2021-05-10  8:17             ` Florian Weimer
2021-05-10 23:56               ` H.J. Lu

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=CAMe9rOoqKCtCo7b13dsXNgtVLEGW9XshnxfNfnnxuTEqgVWvVg@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).