[lkml]   [2019]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v2 3/5] signal: use fdget() since we don't allow O_PATH
As stated in the original commit for pidfd_send_signal() we don't allow to
signal processes through O_PATH file descriptors since it is semantically
equivalent to a write on the pidfd. We already correctly error out right
now and return EBADF if an O_PATH fd is passed. This is because we use
file->f_op to detect whether a pidfd is passed and O_PATH fds have their
file->f_op set to empty_fops in do_dentry_open() and thus fail the test.
Thus, there is no regression. It's just semantically correct to use fdget()
and return an error right from there instead of taking a reference and
returning an error later.

Signed-off-by: Christian Brauner <>
Cc: Arnd Bergmann <>
Cc: "Eric W. Biederman" <>
Cc: Kees Cook <>
Cc: Thomas Gleixner <>
Cc: Jann Horn <>
Cc: David Howells <>
Cc: "Michael Kerrisk (man-pages)" <>
Cc: Andy Lutomirsky <>
Cc: Andrew Morton <>
Cc: Oleg Nesterov <>
Cc: Aleksa Sarai <>
Cc: Linus Torvalds <>
Cc: Al Viro <>
/* changelog */
v1: patch not present
- Oleg Nesterov <>:
- split out from following patch since the s/fdget_raw()/fdget()/
replacement is a fix unrelated to the theme of the following patch
kernel/signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index f98448cf2def..227ba170298e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3581,7 +3581,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig,
if (flags)
return -EINVAL;

- f = fdget_raw(pidfd);
+ f = fdget(pidfd);
if (!f.file)
return -EBADF;

 \ /
  Last update: 2019-04-18 12:20    [W:0.104 / U:1.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site