linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@ubuntu.com>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Cc: Aleksa Sarai <cyphar@cyphar.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Florian Weimer <fweimer@redhat.com>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Shuah Khan <shuah@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	Elena Reshetova <elena.reshetova@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Roman Gushchin <guro@fb.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"Dmitry V. Levin" <ldv@altlinux.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND
Date: Mon, 14 Oct 2019 12:08:26 +0200	[thread overview]
Message-ID: <20191014100824.sc4aqfktbn6go736@wittgenstein> (raw)
In-Reply-To: <b3fce4a4-10a8-befe-a438-f16dfa0cdb6b@gmail.com>

On Sat, Oct 12, 2019 at 01:46:54PM +0200, Michael Kerrisk (man-pages) wrote:
> On 10/12/19 9:48 AM, Christian Brauner wrote:
> > On Sat, Oct 12, 2019 at 08:53:34AM +0200, Michael Kerrisk (man-pages) wrote:
> >> Hello Aleksa,
> >>
> >> On Sat, 12 Oct 2019 at 00:12, Aleksa Sarai <cyphar@cyphar.com> wrote:
> >>>
> >>> On 2019-10-11, Michael Kerrisk <mtk.manpages@gmail.com> wrote:
> >>>> Why CLONE3_CLEAR_SIGHAND rather than just CLONE_CLEAR_SIGHAND?
> > 
> > I don't care much how we name this apart from the "_CLEAR_SIGHAND"
> > suffix. But see for a little rationale below.
> > 
> >>>
> >>> There are no more flag bits left for the classic clone()/clone2() (the
> >>> last one was used up by CLONE_PIDFD) -- thus this flag is clone3()-only.
> >>
> >> Yes, I understand that. But, I'm not sure that the "3" in the prefix
> >> is necessary. "CLONE_" still seems better to me.
> >>
> >> Consider this: sometime in the near future we will probably have time
> >> namespaces. The new flag for those namespaces will only be usable with
> >> clone3(). It should NOT be called CLONE3_NEWTIME, but rather
> >> CLONE_NEWTIME (or similar), because that same flag will presumably
> >> also be used in other APIs such as unshare() and setns(). (Hmm -- I
> > 
> > There are some noteable differences though. CLONE_NEWTIME takes the
> > CSIGNAL bit which is in the range of a 32bit integer and thus useable by
> > unshare() too. The same does not hold for CLONE{3}_CLEAR_SIGHAND. You
> > can't pass it to unshare(). unshare() also just deals with
> > namespace-relevant stuff so CLONE{3}_CLEAR_SIGHAND doesn't make much
> > sense there.
> 
> Sure, but going forward there's very likely to be more CLONE flags
> for whatever reason, and some will be usable just in clone3()
> while others will be more widely used (in other APIs such as
> unshare() and setns()). Using two different prefixes for these
> flags (CLONE_/CLONE3_) would be just confusing. AFAICS, the CLONE3_

I do agree with that part. And as I said in my previous mail, I don't
care about the prefix.

> prefix really provides no advantage, but does have the potential to
> cause confusion down the track for the aforementioned reasons.
> (Furthermore... Shudder! What if there's a clone4() one day. I
> know you might say: "won't happen, we got things right this time",
> but API history suggests that "right" now not infrequently becomes
> "oops" later.) I do recommend CLONE_ for all the flags...

I do love your trust in our ability to design syscalls (//Cc Aleksa ;)). :)

> 
> >> wonder if we are going to need a new unshare2() or some such...)
> > 
> > We still have one 32bit bit left (CLONE_DETACHED) which we can't reuse
> > with clone()/clone2() but we can reuse with clone3(). We can simply
> > earmark it for namespace-related stuff and thus still have one bit left
> > for unshare() before we have to go for unshare2() (If we have to go
> > there at all since I'm not sure how much more namespaces we can come up
> > with.).
> 
> I'm sure there'll be more namespaces...

Let's hope not. :) Anyway, no real reason to do unshare2() any time
soon. :)

Christian

      reply	other threads:[~2019-10-14 10:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 13:35 [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND Christian Brauner
2019-10-10 13:35 ` [PATCH 2/2] tests: test CLONE3_CLEAR_SIGHAND Christian Brauner
2019-10-10 14:19 ` [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND Florian Weimer
2019-10-10 15:21   ` Christian Brauner
2019-10-10 15:22     ` Florian Weimer
2019-10-11  8:21 ` Michal Hocko
2019-10-11  9:40   ` Christian Brauner
2019-10-11 21:38 ` Michael Kerrisk
2019-10-11 22:12   ` Aleksa Sarai
2019-10-12  6:53     ` Michael Kerrisk (man-pages)
2019-10-12  7:48       ` Christian Brauner
2019-10-12 11:46         ` Michael Kerrisk (man-pages)
2019-10-14 10:08           ` Christian Brauner [this message]

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=20191014100824.sc4aqfktbn6go736@wittgenstein \
    --to=christian.brauner@ubuntu.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bsegall@google.com \
    --cc=cyphar@cyphar.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=elena.reshetova@intel.com \
    --cc=fweimer@redhat.com \
    --cc=guro@fb.com \
    --cc=juri.lelli@redhat.com \
    --cc=ldv@altlinux.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=mtk.manpages@gmail.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).