OSDN Git Service

signal: Correct namespace fixups of si_pid and si_uid
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 16 May 2019 03:54:56 +0000 (22:54 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 22 May 2019 22:02:16 +0000 (17:02 -0500)
commit7a0cf094944e2540758b7f957eb6846d5126f535
tree7bf6f9b6aed7c10d437f7de78b49090b72c7e7a4
parent70f1b0d34bdf03065fe869e93cc17cad1ea20c4a
signal: Correct namespace fixups of si_pid and si_uid

The function send_signal was split from __send_signal so that it would
be possible to bypass the namespace logic based upon current[1].  As it
turns out the si_pid and the si_uid fixup are both inappropriate in
the case of kill_pid_usb_asyncio so move that logic into send_signal.

It is difficult to arrange but possible for a signal with an si_code
of SI_TIMER or SI_SIGIO to be sent across namespace boundaries.  In
which case tests for when it is ok to change si_pid and si_uid based
on SI_FROMUSER are incorrect.  Replace the use of SI_FROMUSER with a
new test has_si_pid_and_used based on siginfo_layout.

Now that the uid fixup is no longer present after expanding
SEND_SIG_NOINFO properly calculate the si_uid that the target
task needs to read.

[1] 7978b567d315 ("signals: add from_ancestor_ns parameter to send_signal()")
Cc: stable@vger.kernel.org
Fixes: 6588c1e3ff01 ("signals: SI_USER: Masquerade si_pid when crossing pid ns boundary")
Fixes: 6b550f949594 ("user namespace: make signal.c respect user namespaces")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
kernel/signal.c