]> git.baikalelectronics.ru Git - kernel.git/commit
ptrace,x86: force IRET path after a ptrace_stop()
authorTejun Heo <tj@kernel.org>
Thu, 3 Jul 2014 19:43:15 +0000 (15:43 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 4 Jul 2014 00:27:23 +0000 (17:27 -0700)
commit78319c6ecb3ae72020ed1c9bfa0462a89c99991d
treee8bee2447217ee19371f86e7b24e6d12ecb58234
parent207bf3ebb918668fda88f849a03dfcd0764a842e
ptrace,x86: force IRET path after a ptrace_stop()

The 'sysret' fastpath does not correctly restore even all regular
registers, much less any segment registers or reflags values.  That is
very much part of why it's faster than 'iret'.

Normally that isn't a problem, because the normal ptrace() interface
catches the process using the signal handler infrastructure, which
always returns with an iret.

However, some paths can get caught using ptrace_event() instead of the
signal path, and for those we need to make sure that we aren't going to
return to user space using 'sysret'.  Otherwise the modifications that
may have been done to the register set by the tracer wouldn't
necessarily take effect.

Fix it by forcing IRET path by setting TIF_NOTIFY_RESUME from
arch_ptrace_stop_needed() which is invoked from ptrace_stop().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Andy Lutomirski <luto@amacapital.net>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86/include/asm/ptrace.h
include/linux/ptrace.h