From: Christian Brauner <christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
To: Hagen Paul Pfeifer <hagen-GvnIQ6b/HdU@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Florian Weimer <fweimer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
Christian Brauner
<christian-STijNZzMWpgWenYVfaLwtA@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Brian Gerst <brgerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Sami Tolvanen
<samitolvanen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Aleksa Sarai <cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>,
Andy Lutomirski <luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Eric W . Biederman"
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>,
Arnaldo Carvalho de Melo
<acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Sargun Dhillon <sargun-GaZTRHToo+CzQB+pC5nmwQ@public.gmane.org>,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC v2] ptrace, pidfd: add pidfd_ptrace syscall
Date: Mon, 27 Apr 2020 19:08:26 +0200 [thread overview]
Message-ID: <20200427170826.mdklazcrn4xaeafm@wittgenstein> (raw)
In-Reply-To: <20200426163430.22743-1-hagen-GvnIQ6b/HdU@public.gmane.org>
On Sun, Apr 26, 2020 at 06:34:30PM +0200, Hagen Paul Pfeifer wrote:
> Working on a safety-critical stress testing tool, using ptrace in an
> rather uncommon way (stop, peeking memory, ...) for a bunch of
> applications in an automated way I realized that once opened processes
> where restarted and PIDs recycled. Resulting in monitoring and
> manipulating the wrong processes.
>
> With the advent of pidfd we are now able to stick with one stable handle
> to identifying processes exactly. We now have the ability to get this
> race free. Sending signals now works like a charm, next step is to
> extend the functionality also for ptrace.
>
> API:
> long pidfd_ptrace(int pidfd, enum __ptrace_request request,
> void *addr, void *data, unsigned flags);
I'm in general not opposed to this if there's a clear need for this and
users that are interested. But I think if people really prefer having
this a new syscall then we should probably try to improve on the old
one. Things that come to mind right away without doing a deep review are
replacing the void *addr pointer with a dedicated struct ptract_args or
union ptrace_args and a size argument. If we're not doing something
like this or something more fundamental we can equally well either just
duplicate all enums in the old ptrace syscall and append a _PIDFD to it
where it makes sense.
Christian
WARNING: multiple messages have this Message-ID (diff)
From: Christian Brauner <christian.brauner@ubuntu.com>
To: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: 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>, Arnd Bergmann <arnd@arndb.de>,
Brian Gerst <brgerst@gmail.com>,
Sami Tolvanen <samitolvanen@google.com>,
David Howells <dhowells@redhat.com>,
Aleksa Sarai <cyphar@cyphar.com>,
Andy Lutomirski <luto@kernel.org>,
Oleg Nesterov <oleg@redhat.com>,
"Eric W . Biederman" <ebiederm@xmission.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Sargun Dhillon <sargun@sargun.me>,
linux-api@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [RFC v2] ptrace, pidfd: add pidfd_ptrace syscall
Date: Mon, 27 Apr 2020 19:08:26 +0200 [thread overview]
Message-ID: <20200427170826.mdklazcrn4xaeafm@wittgenstein> (raw)
Message-ID: <20200427170826.IOPIV6yMNc1CBUScu_Y5vYHObxDlOGEBqDvWbvqzL98@z> (raw)
In-Reply-To: <20200426163430.22743-1-hagen@jauu.net>
On Sun, Apr 26, 2020 at 06:34:30PM +0200, Hagen Paul Pfeifer wrote:
> Working on a safety-critical stress testing tool, using ptrace in an
> rather uncommon way (stop, peeking memory, ...) for a bunch of
> applications in an automated way I realized that once opened processes
> where restarted and PIDs recycled. Resulting in monitoring and
> manipulating the wrong processes.
>
> With the advent of pidfd we are now able to stick with one stable handle
> to identifying processes exactly. We now have the ability to get this
> race free. Sending signals now works like a charm, next step is to
> extend the functionality also for ptrace.
>
> API:
> long pidfd_ptrace(int pidfd, enum __ptrace_request request,
> void *addr, void *data, unsigned flags);
I'm in general not opposed to this if there's a clear need for this and
users that are interested. But I think if people really prefer having
this a new syscall then we should probably try to improve on the old
one. Things that come to mind right away without doing a deep review are
replacing the void *addr pointer with a dedicated struct ptract_args or
union ptrace_args and a size argument. If we're not doing something
like this or something more fundamental we can equally well either just
duplicate all enums in the old ptrace syscall and append a _PIDFD to it
where it makes sense.
Christian
next prev parent reply other threads:[~2020-04-27 17:08 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 [this message]
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
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=20200427170826.mdklazcrn4xaeafm@wittgenstein \
--to=christian.brauner-gewih/nmzzlqt0dzr+alfa@public.gmane.org \
--cc=acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
--cc=brgerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=christian-STijNZzMWpgWenYVfaLwtA@public.gmane.org \
--cc=cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org \
--cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=fweimer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hagen-GvnIQ6b/HdU@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=samitolvanen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=sargun-GaZTRHToo+CzQB+pC5nmwQ@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.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