Commit a816fd6b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pidfd-fixes-v5.1-rc3' of gitolite.kernel.org:pub/scm/linux/kernel/git/brauner/linux

Pull pidfd fix from Christian Brauner:
 "This should be an uncontroversial fix for pidfd_send_signal() by Jann
  to better align it's behavior with other signal sending functions:

  In one of the early versions of the patchset it was suggested to not
  unconditionally error out when a signal with SI_USER is sent to a
  non-current task (cf. [1]).

  Instead, pidfd_send_signal() currently silently changes this to a
  regular kill signal. While this is technically fine, the semantics are
  weird since the kernel just silently converts a user's request behind
  their back and also no other signal sending function allows to do
  this. It gets more hairy when we introduce sending signals to a
  specific thread soon.

  So let's align pidfd_send_signal() with all the other signal sending
  functions and error out when SI_USER signals are sent to a non-current
  task"

* tag 'pidfd-fixes-v5.1-rc3' of gitolite.kernel.org:pub/scm/linux/kernel/git/brauner/linux:
  signal: don't silently convert SI_USER signals to non-current pidfd
parents 4a3164e3 556a888a
......@@ -3605,16 +3605,11 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig,
if (unlikely(sig != kinfo.si_signo))
goto err;
if ((task_pid(current) != pid) &&
(kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL)) {
/* Only allow sending arbitrary signals to yourself. */
ret = -EPERM;
if (kinfo.si_code != SI_USER)
if ((task_pid(current) != pid) &&
(kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL))
goto err;
/* Turn this into a regular kill signal. */
prepare_kill_siginfo(sig, &kinfo);
}
} else {
prepare_kill_siginfo(sig, &kinfo);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment