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>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH v7 1/3] Add an internal wrapper for clone, clone2 and clone3
Date: Mon, 31 May 2021 09:00:52 -0700	[thread overview]
Message-ID: <CAMe9rOpj+ryaFA2m2QPDrwD0KbD_CeYJCvrDjxo9LyY79DmoGw@mail.gmail.com> (raw)
In-Reply-To: <cb8d8b83-9430-e28f-f41e-4324f691f10e@linaro.org>

On Mon, May 31, 2021 at 8:57 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 31/05/2021 11:01, H.J. Lu wrote:
> > On Mon, May 31, 2021 at 6:53 AM Adhemerval Zanella
> > <adhemerval.zanella@linaro.org> wrote:
> >>
> >>
> >>
> >> On 31/05/2021 10:16, H.J. Lu wrote:
> >>> On Mon, May 31, 2021 at 6:01 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>>>
> >>>> * H. J. Lu:
> >>>>
> >>>>> In the kernel, clone3 and clone go to the same piece of code.  clone won't
> >>>>> fail just because of CET.
> >>>>
> >>>> But clone won't have access to the stack boundaries.  Won't this create
> >>>> issues for setting up the shadow stack?
> >>>>
> >>>
> >>> No.  There are:
> >>>
> >>>         /* Cap shadow stack size to 4 GB */
> >>>         size = min_t(unsigned long long, rlimit(RLIMIT_STACK), SZ_4G);
> >>>         size = min(size, stack_size);
> >>>
> >>> where stack_size is passed in clone3.
> >>
> >> Right, so CET support does not really require clone3 to be used internally
> >> then? Or am I missing something?
> >
> > Shadow stack size shouldn't be more than normal stack size.  The current
> > CET kernel shadow stack size may not be optimal.  My original code did
> >
> > if (stack_size != 0)
> >   size = stack_size;
> > else
> >   size = min_t(unsigned long long, rlimit(RLIMIT_STACK), SZ_4G);
> >
> > But
> >
> > 1. I don't want to disturb it before CET changes are upstreamed.
> > 2. It can be updated AFTER it has been upstreamed.
>
> Right, so I take this is just an optimization assuming that the extra
> size would unused, right? I still failing to see why clone3 is an

Correct.

> requirement for CET enablement (if I understood this correctly).

It isn't a MUST have.  It is an improvement for CET.

> I still think supporting clone3 is a nice thing to have, specially
> for possible newer architectures and to support newer flags and
> functionalities.



-- 
H.J.

  reply	other threads:[~2021-05-31 16:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 12:39 [PATCH v7 0/3] " H.J. Lu
2021-05-26 12:39 ` [PATCH v7 1/3] " H.J. Lu
2021-05-26 13:05   ` Florian Weimer
2021-05-26 13:08     ` Adhemerval Zanella
2021-05-26 13:19     ` H.J. Lu
2021-05-26 13:42       ` Florian Weimer
2021-05-26 13:58         ` H.J. Lu
2021-05-26 14:09         ` Adhemerval Zanella
2021-05-31 12:14           ` H.J. Lu
2021-05-31 12:16             ` Florian Weimer
2021-05-31 12:23               ` H.J. Lu
2021-05-31 12:28                 ` Florian Weimer
2021-05-31 12:40                   ` H.J. Lu
2021-05-31 13:01                     ` Florian Weimer
2021-05-31 13:16                       ` H.J. Lu
2021-05-31 13:53                         ` Adhemerval Zanella
2021-05-31 14:01                           ` H.J. Lu
2021-05-31 15:57                             ` Adhemerval Zanella
2021-05-31 16:00                               ` H.J. Lu [this message]
2021-05-26 12:39 ` [PATCH v7 2/3] x86-64: Add the clone3 wrapper H.J. Lu
2021-05-26 12:39 ` [PATCH v7 3/3] Add static tests for __clone_internal H.J. Lu
2021-06-01  8:03   ` Szabolcs Nagy
2021-06-01  8:07     ` Florian Weimer

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=CAMe9rOpj+ryaFA2m2QPDrwD0KbD_CeYJCvrDjxo9LyY79DmoGw@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).