dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/arch
Oleg Nesterov 9899d11f65 ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL
putreg() assumes that the tracee is not running and pt_regs_access() can
safely play with its stack.  However a killed tracee can return from
ptrace_stop() to the low-level asm code and do RESTORE_REST, this means
that debugger can actually read/modify the kernel stack until the tracee
does SAVE_REST again.

set_task_blockstep() can race with SIGKILL too and in some sense this
race is even worse, the very fact the tracee can be woken up breaks the
logic.

As Linus suggested we can clear TASK_WAKEKILL around the arch_ptrace()
call, this ensures that nobody can ever wakeup the tracee while the
debugger looks at it.  Not only this fixes the mentioned problems, we
can do some cleanups/simplifications in arch_ptrace() paths.

Probably ptrace_unfreeze_traced() needs more callers, for example it
makes sense to make the tracee killable for oom-killer before
access_process_vm().

While at it, add the comment into may_ptrace_stop() to explain why
ptrace_stop() still can't rely on SIGKILL and signal_pending_state().

Reported-by: Salman Qazi <sqazi@google.com>
Reported-by: Suleiman Souhlal <suleiman@google.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-01-22 10:08:00 -08:00
..
alpha ALPHA: drivers: remove __dev* attributes. 2013-01-03 15:57:13 -08:00
arm Sound fixes #2 for 3.8-rc4 2013-01-16 11:33:52 -08:00
arm64 - Page protection fixes, including proper PAGE_NONE handling 2013-01-16 09:44:40 -08:00
avr32 ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
blackfin ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
c6x These are a few cleanups for asm-generic: 2012-12-21 16:39:08 -08:00
cris ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
frv ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
h8300 These are a few cleanups for asm-generic: 2012-12-21 16:39:08 -08:00
hexagon Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-12-20 18:05:28 -08:00
ia64 ia64: kill thread_matches(), unexport ptrace_check_attach() 2013-01-20 12:26:05 -08:00
m32r ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
m68k Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2013-01-18 11:58:10 -08:00
microblaze Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze 2013-01-07 07:39:32 -08:00
mips Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-01-07 07:50:41 -08:00
mn10300 arch/mn10300/Kconfig: select CONFIG_GENERIC_ATOMIC64 2013-01-11 14:54:55 -08:00
openrisc ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
parisc ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
powerpc Merge git://git.kernel.org/pub/scm/virt/kvm/kvm 2013-01-10 09:05:18 -08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-01-17 08:56:30 -08:00
score ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
sh sh: ecovec: add sample amixer settings 2013-01-16 18:30:44 +09:00
sparc sparc: remove __devinit, __devexit annotations 2013-01-12 15:28:45 -08:00
tile ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
um Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-12-20 18:05:28 -08:00
unicore32 ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
x86 ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL 2013-01-22 10:08:00 -08:00
xtensa These are a few cleanups for asm-generic: 2012-12-21 16:39:08 -08:00
.gitignore
Kconfig Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-12-20 18:05:28 -08:00