diff --git a/kernel/signal.c b/kernel/signal.c index 88541e315e38..ab12c0c12244 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3045,7 +3045,6 @@ SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) return kill_something_info(sig, &info, pid); } -#ifdef CONFIG_PROC_FS /* * Verify that the signaler and signalee either are in the same pid namespace * or that the signaler's pid namespace is an ancestor of the signalee's pid @@ -3067,6 +3066,14 @@ static bool access_pidfd_pidns(struct pid *pid) return true; } +static struct pid *pidfd_to_pid(const struct file *file) +{ + if (file->f_op == &pidfd_fops) + return file->private_data; + + return tgid_pidfd_to_pid(file); +} + static int copy_siginfo_from_user_any(siginfo_t *kinfo, siginfo_t __user *info) { #ifdef CONFIG_COMPAT @@ -3118,7 +3125,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, return -EBADF; /* Is this a pidfd? */ - pid = tgid_pidfd_to_pid(f.file); + pid = pidfd_to_pid(f.file); if (IS_ERR(pid)) { ret = PTR_ERR(pid); goto err; @@ -3152,7 +3159,6 @@ err: fdput(f); return ret; } -#endif /* CONFIG_PROC_FS */ static int do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info) diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index e91b8a5bebf0..b5189762d275 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -156,7 +156,6 @@ cond_syscall(compat_sys_io_submit); cond_syscall(compat_sys_io_getevents); cond_syscall(sys_sysfs); cond_syscall(sys_syslog); -cond_syscall(sys_pidfd_send_signal); cond_syscall(sys_process_vm_readv); cond_syscall(sys_process_vm_writev); cond_syscall(compat_sys_process_vm_readv);