kernel_optimize_test/arch
Eric W. Biederman b49516583f ptrace: Reimplement PTRACE_KILL by always sending SIGKILL
commit 6a2d90ba027adba528509ffa27097cffd3879257 upstream.

The current implementation of PTRACE_KILL is buggy and has been for
many years as it assumes it's target has stopped in ptrace_stop.  At a
quick skim it looks like this assumption has existed since ptrace
support was added in linux v1.0.

While PTRACE_KILL has been deprecated we can not remove it as
a quick search with google code search reveals many existing
programs calling it.

When the ptracee is not stopped at ptrace_stop some fields would be
set that are ignored except in ptrace_stop.  Making the userspace
visible behavior of PTRACE_KILL a noop in those case.

As the usual rules are not obeyed it is not clear what the
consequences are of calling PTRACE_KILL on a running process.
Presumably userspace does not do this as it achieves nothing.

Replace the implementation of PTRACE_KILL with a simple
send_sig_info(SIGKILL) followed by a return 0.  This changes the
observable user space behavior only in that PTRACE_KILL on a process
not stopped in ptrace_stop will also kill it.  As that has always
been the intent of the code this seems like a reasonable change.

Cc: stable@vger.kernel.org
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Link: https://lkml.kernel.org/r/20220505182645.497868-7-ebiederm@xmission.com
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:20:49 +02:00
..
alpha alpha: define get_cycles macro for arch-override 2022-05-30 09:33:40 +02:00
arc ARC: entry: fix syscall_trace_exit argument 2022-04-27 13:53:55 +02:00
arm ARM: dts: s5pv210: Correct interrupt name for bluetooth in Aries 2022-06-06 08:42:43 +02:00
arm64 arm64: Enable repeat tlbi workaround on KRYO4XX gold CPUs 2022-05-25 09:18:01 +02:00
c6x
csky uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:40:35 +02:00
h8300
hexagon
ia64 ia64: define get_cycles macro for arch-override 2022-05-30 09:33:40 +02:00
m68k m68k: use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:41 +02:00
microblaze uaccess: fix nios2 and microblaze get_user_8() 2022-04-08 14:40:08 +02:00
mips mips: use fallback for random_get_entropy() instead of just c0 random 2022-05-30 09:33:41 +02:00
nds32 nds32: fix access_ok() checks in get/put_user 2022-03-28 09:57:10 +02:00
nios2 nios2: use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:41 +02:00
openrisc
parisc parisc/stifb: Implement fb_is_primary_device() 2022-06-09 10:20:47 +02:00
powerpc KVM: PPC: Book3S HV: fix incorrect NULL check on list iterator 2022-06-06 08:42:43 +02:00
riscv riscv: Fix irq_work when SMP is disabled 2022-06-09 10:20:48 +02:00
s390 s390: define get_cycles macro for arch-override 2022-05-30 09:33:40 +02:00
sh
sparc sparc: use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:42 +02:00
um ptrace/um: Replace PT_DTRACE with TIF_SINGLESTEP 2022-06-09 10:20:49 +02:00
x86 ptrace: Reimplement PTRACE_KILL by always sending SIGKILL 2022-06-09 10:20:49 +02:00
xtensa ptrace/xtensa: Replace PT_SINGLESTEP with TIF_SINGLESTEP 2022-06-09 10:20:49 +02:00
.gitignore
Kconfig