diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-16 18:28:19 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-16 18:28:19 +0200 |
commit | c17112a5c413f20188da276c138484e7127cdc84 (patch) | |
tree | 9fb0607a64e4dd49bbf405ed456221640fa972d8 /kernel/signal.c | |
parent | Linux 5.3 (diff) | |
parent | waitid: Add support for waiting for the current process group (diff) | |
download | linux-c17112a5c413f20188da276c138484e7127cdc84.tar.xz linux-c17112a5c413f20188da276c138484e7127cdc84.zip |
Merge tag 'core-process-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux
Pull pidfd/waitid updates from Christian Brauner:
"This contains two features and various tests.
First, it adds support for waiting on process through pidfds by adding
the P_PIDFD type to the waitid() syscall. This completes the basic
functionality of the pidfd api (cf. [1]). In the meantime we also have
a new adition to the userspace projects that make use of the pidfd
api. The qt project was nice enough to send a mail pointing out that
they have a pr up to switch to the pidfd api (cf. [2]).
Second, this tag contains an extension to the waitid() syscall to make
it possible to wait on the current process group in a race free manner
(even though the actual problem is very unlikely) by specifing 0
together with the P_PGID type. This extension traces back to a
discussion on the glibc development mailing list.
There are also a range of tests for the features above. Additionally,
the test-suite which detected the pidfd-polling race we fixed in [3]
is included in this tag"
[1] https://lwn.net/Articles/794707/
[2] https://codereview.qt-project.org/c/qt/qtbase/+/108456
[3] commit b191d6491be6 ("pidfd: fix a poll race when setting exit_state")
* tag 'core-process-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
waitid: Add support for waiting for the current process group
tests: add pidfd poll tests
tests: move common definitions and functions into pidfd.h
pidfd: add pidfd_wait tests
pidfd: add P_PIDFD to waitid()
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 534fec266a33..c4da1ef56fdf 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3678,8 +3678,11 @@ static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, siginfo_t *info) static struct pid *pidfd_to_pid(const struct file *file) { - if (file->f_op == &pidfd_fops) - return file->private_data; + struct pid *pid; + + pid = pidfd_pid(file); + if (!IS_ERR(pid)) + return pid; return tgid_pidfd_to_pid(file); } |