public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: "H.J. Lu" <hjl.tools@gmail.com>, libc-alpha@sourceware.org
Cc: Florian Weimer <fweimer@redhat.com>,
	Noah Goldstein <goldstein.w.n@gmail.com>
Subject: Re: [PATCH v8 1/3] Add an internal wrapper for clone, clone2 and clone3
Date: Tue, 13 Jul 2021 16:06:09 -0300	[thread overview]
Message-ID: <e7f42d84-49a0-583e-5793-57e974efa902@linaro.org> (raw)
In-Reply-To: <19675287-dc96-6aed-392d-b9aab1504c49@linaro.org>



On 13/07/2021 15:54, Adhemerval Zanella wrote:
> 
> 
> On 01/06/2021 11:55, H.J. Lu wrote:
>> The clone3 system call provides a superset of the functionality of clone
>> and clone2.  It also provides a number of API improvements, 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,
>> 			     int (*__func) (void *__arg), void *__arg);
>>
>> to provide an abstract interface for clone, clone2 and clone3.
>>
>> 1. Simplify stack management for thread creation by passing both stack
>> base and size to create_thread.
>> 2. Consolidate clone vs clone2 differences into a single file.
>> 3. Call __clone3 if HAVE_CLONE3_WAPPER is defined.  If __clone3 returns
>> -1 with ENOSYS, fall back to clone or clone2.
>> 4. Use only __clone_internal to clone a thread.  Since the stack size
>> argument for create_thread is now unconditional, always pass stack size
>> to create_thread.
>> 5. Enable the public clone3 wrapper in the future after it has been
>> added to all targets.
>>
>> NB: Sandbox should return ENOSYS on clone3 if it is rejected:
>>
>> https://bugs.chromium.org/p/chromium/issues/detail?id=1213452#c5
> 
> LGTM with just an suggestion below.  Also chromium also has fixed it,
> so although it wouldn't be able to fully handled clone3, at least
> it won't brick a 2.34 glibc.
> 
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

I forgot to add that I think it would be useful to reference the kernel
version and commit which actually added the clone3 syscall on the
commit log.

  reply	other threads:[~2021-07-13 19:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 14:55 [PATCH v8 0/3] " H.J. Lu
2021-06-01 14:55 ` [PATCH v8 1/3] " H.J. Lu
2021-06-04 12:20   ` H.J. Lu
2021-06-18 18:20     ` PING^1 " H.J. Lu
2021-07-13 18:54   ` Adhemerval Zanella
2021-07-13 19:06     ` Adhemerval Zanella [this message]
2021-07-13 19:49     ` [PATCH v9] " H.J. Lu
2021-07-14 13:17       ` Adhemerval Zanella
2021-06-01 14:55 ` [PATCH v8 2/3] x86-64: Add the clone3 wrapper H.J. Lu
2021-07-13 19:12   ` Adhemerval Zanella
2021-06-01 14:55 ` [PATCH v8 3/3] Add static tests for __clone_internal H.J. Lu
2021-07-13 19:32   ` Adhemerval Zanella
2021-07-13 21:12     ` [PATCH v9] " H.J. Lu
2021-07-14 13:18       ` Adhemerval Zanella
2021-07-14 13:32         ` H.J. Lu
2021-07-14 13:42           ` Adhemerval Zanella

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=e7f42d84-49a0-583e-5793-57e974efa902@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=goldstein.w.n@gmail.com \
    --cc=hjl.tools@gmail.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).