public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Aleksa Sarai <cyphar@cyphar.com>
To: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Hagen Paul Pfeifer <hagen@jauu.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Jann Horn <jannh@google.com>,
	kernel list <linux-kernel@vger.kernel.org>,
	Florian Weimer <fweimer@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <christian@brauner.io>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Brian Gerst <brgerst@gmail.com>,
	Sami Tolvanen <samitolvanen@google.com>,
	David Howells <dhowells@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Sargun Dhillon <sargun@sargun.me>,
	Linux API <linux-api@vger.kernel.org>,
	linux-arch <linux-arch@vge>
Subject: Re: [RFC v2] ptrace, pidfd: add pidfd_ptrace syscall
Date: Tue, 28 Apr 2020 10:45:46 +1000	[thread overview]
Message-ID: <20200428004546.mlpwixgms2ekpfdm@yavin.dot.cyphar.com> (raw)
In-Reply-To: <20200427201303.tbiipopeapxofn6h@wittgenstein>

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

On 2020-04-27, Christian Brauner <christian.brauner@ubuntu.com> wrote:
> On Mon, Apr 27, 2020 at 10:08:03PM +0200, Arnd Bergmann wrote:
> > The way I understood Jann was that instead of a new syscall that duplicates
> > everything in ptrace(), there would only need to be a new ptrace request
> > such as PTRACE_ATTACH_PIDFD that behaves like PTRACE_ATTACH
> > but takes a pidfd as the second argument, perhaps setting the return value
> > to the pid on success. Same for PTRACE_SEIZE.
> 
> That was my initial suggestion, yes. Any enum that identifies a target
> by a pid will get a new _PIDFD version and the pidfd is passed as pid_t
> argument. That should work and is similar to what I did for waitid()
> P_PIDFD. Realistically, there shouldn't be any system where pid_t is
> smaller than an int that we care about.
> 
> > In effect this is not much different from your a), just a variation on the
> > calling conventions. The main upside is that it avoids adding another
> > ugly interface, the flip side is that it makes the existing one slightly worse
> > by adding complexity.
> 
> Basically, if a new syscall than please a proper re-design with real
> benefits.
> 
> In the meantime we could make due with the _PIDFD variant. And then if
> someone wants to do the nitty gritty work of adding a ptrace variant
> purely based on pidfds and with a better api and features that e.g. Jann
> pointed out then by all means, please do so. I'm sure we would all
> welcome this as well.

I agree. It would be a shame to add a new ptrace syscall and not take
the opportunity to fix the multitude of problems with the existing API.
But that's a Pandora's box which we shouldn't open unless we want to
wait a long time to get an API everyone is okay with -- a pretty high
price to just get pidfds support in ptrace.

-- 
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Aleksa Sarai <cyphar@cyphar.com>
To: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Hagen Paul Pfeifer <hagen@jauu.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Jann Horn <jannh@google.com>,
	kernel list <linux-kernel@vger.kernel.org>,
	Florian Weimer <fweimer@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <christian@brauner.io>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Brian Gerst <brgerst@gmail.com>,
	Sami Tolvanen <samitolvanen@google.com>,
	David Howells <dhowells@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Sargun Dhillon <sargun@sargun.me>,
	Linux API <linux-api@vger.kernel.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [RFC v2] ptrace, pidfd: add pidfd_ptrace syscall
Date: Tue, 28 Apr 2020 10:45:46 +1000	[thread overview]
Message-ID: <20200428004546.mlpwixgms2ekpfdm@yavin.dot.cyphar.com> (raw)
Message-ID: <20200428004546.suhK4WMILras6gI3orel076N6YlxhyiMR_DPo4Ckxl4@z> (raw)
In-Reply-To: <20200427201303.tbiipopeapxofn6h@wittgenstein>

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

On 2020-04-27, Christian Brauner <christian.brauner@ubuntu.com> wrote:
> On Mon, Apr 27, 2020 at 10:08:03PM +0200, Arnd Bergmann wrote:
> > The way I understood Jann was that instead of a new syscall that duplicates
> > everything in ptrace(), there would only need to be a new ptrace request
> > such as PTRACE_ATTACH_PIDFD that behaves like PTRACE_ATTACH
> > but takes a pidfd as the second argument, perhaps setting the return value
> > to the pid on success. Same for PTRACE_SEIZE.
> 
> That was my initial suggestion, yes. Any enum that identifies a target
> by a pid will get a new _PIDFD version and the pidfd is passed as pid_t
> argument. That should work and is similar to what I did for waitid()
> P_PIDFD. Realistically, there shouldn't be any system where pid_t is
> smaller than an int that we care about.
> 
> > In effect this is not much different from your a), just a variation on the
> > calling conventions. The main upside is that it avoids adding another
> > ugly interface, the flip side is that it makes the existing one slightly worse
> > by adding complexity.
> 
> Basically, if a new syscall than please a proper re-design with real
> benefits.
> 
> In the meantime we could make due with the _PIDFD variant. And then if
> someone wants to do the nitty gritty work of adding a ptrace variant
> purely based on pidfds and with a better api and features that e.g. Jann
> pointed out then by all means, please do so. I'm sure we would all
> welcome this as well.

I agree. It would be a shame to add a new ptrace syscall and not take
the opportunity to fix the multitude of problems with the existing API.
But that's a Pandora's box which we shouldn't open unless we want to
wait a long time to get an API everyone is okay with -- a pretty high
price to just get pidfds support in ptrace.

-- 
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2020-04-28  0:45 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 13:01 [RFC] ptrace, pidfd: add pidfd_ptrace syscall Hagen Paul Pfeifer
2020-04-26 13:01 ` Hagen Paul Pfeifer
2020-04-26 16:34 ` [RFC v2] " Hagen Paul Pfeifer
2020-04-27  8:30   ` Arnd Bergmann
     [not found]     ` <CAK8P3a1qdyw+5B-E52O42VEWvpq_6jF74__ptM+q6SoKd3pkuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-04-27  9:00       ` Hagen Paul Pfeifer
2020-04-27  9:00         ` Hagen Paul Pfeifer
     [not found]   ` <20200426163430.22743-1-hagen-GvnIQ6b/HdU@public.gmane.org>
2020-04-27 17:08     ` Christian Brauner
2020-04-27 17:08       ` Christian Brauner
2020-04-27 17:52       ` Jann Horn
2020-04-27 17:52         ` Jann Horn
2020-04-27 18:18         ` Eric W. Biederman
2020-04-27 18:18           ` Eric W. Biederman
     [not found]           ` <87zhawdc6w.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2020-04-27 18:59             ` Hagen Paul Pfeifer
2020-04-27 18:59               ` Hagen Paul Pfeifer
2020-04-27 20:08               ` Arnd Bergmann
2020-04-27 20:08                 ` Arnd Bergmann
2020-04-27 20:13                 ` Christian Brauner
2020-04-27 20:13                   ` Christian Brauner
2020-04-28  0:45                   ` Aleksa Sarai [this message]
2020-04-28  0:45                     ` Aleksa Sarai
2020-04-28  1:36                     ` Linus Torvalds
2020-04-28  1:36                       ` Linus Torvalds
2020-04-28  4:17                       ` Andy Lutomirski
2020-04-28  4:17                         ` Andy Lutomirski
2020-04-28  4:28                         ` Linus Torvalds
2020-04-28  4:28                           ` Linus Torvalds
2020-04-28  6:39                           ` Hagen Paul Pfeifer
2020-04-28  6:39                             ` Hagen Paul Pfeifer
2020-04-28  7:45                             ` Christian Brauner
2020-04-28  7:45                               ` Christian Brauner
     [not found]                           ` <CAHk-=whQzOsh9O2uhUO2VETD+hrzjKMpEJpzoUby5QHMcvgPKg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-04-28  8:21                             ` Christian Brauner
2020-04-28  8:21                               ` Christian Brauner

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=20200428004546.mlpwixgms2ekpfdm@yavin.dot.cyphar.com \
    --to=cyphar@cyphar.com \
    --cc=acme@redhat.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=christian@brauner.io \
    --cc=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=fweimer@redhat.com \
    --cc=hagen@jauu.net \
    --cc=hpa@zytor.com \
    --cc=jannh@google.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vge \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=samitolvanen@google.com \
    --cc=sargun@sargun.me \
    --cc=tglx@linutronix.de \
    --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