aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/ptrace.c10
-rw-r--r--arch/x86/kernel/step.c13
-rw-r--r--include/asm-x86/thread_info.h2
3 files changed, 24 insertions, 1 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 34e77b16a42a..e37dccce85db 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1416,6 +1416,16 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs)
1416{ 1416{
1417 long ret = 0; 1417 long ret = 0;
1418 1418
1419 /*
1420 * If we stepped into a sysenter/syscall insn, it trapped in
1421 * kernel mode; do_debug() cleared TF and set TIF_SINGLESTEP.
1422 * If user-mode had set TF itself, then it's still clear from
1423 * do_debug() and we need to set it again to restore the user
1424 * state. If we entered on the slow path, TF was already set.
1425 */
1426 if (test_thread_flag(TIF_SINGLESTEP))
1427 regs->flags |= X86_EFLAGS_TF;
1428
1419 /* do the secure computing check first */ 1429 /* do the secure computing check first */
1420 secure_computing(regs->orig_ax); 1430 secure_computing(regs->orig_ax);
1421 1431
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index 0d2cb363ea75..e8b9863ef8c4 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -108,6 +108,19 @@ static int enable_single_step(struct task_struct *child)
108 unsigned long oflags; 108 unsigned long oflags;
109 109
110 /* 110 /*
111 * If we stepped into a sysenter/syscall insn, it trapped in
112 * kernel mode; do_debug() cleared TF and set TIF_SINGLESTEP.
113 * If user-mode had set TF itself, then it's still clear from
114 * do_debug() and we need to set it again to restore the user
115 * state so we don't wrongly set TIF_FORCED_TF below.
116 * If enable_single_step() was used last and that is what
117 * set TIF_SINGLESTEP, then both TF and TIF_FORCED_TF are
118 * already set and our bookkeeping is fine.
119 */
120 if (unlikely(test_tsk_thread_flag(child, TIF_SINGLESTEP)))
121 regs->flags |= X86_EFLAGS_TF;
122
123 /*
111 * Always set TIF_SINGLESTEP - this guarantees that 124 * Always set TIF_SINGLESTEP - this guarantees that
112 * we single-step system calls etc.. This will also 125 * we single-step system calls etc.. This will also
113 * cause us to set TF when returning to user mode. 126 * cause us to set TF when returning to user mode.
diff --git a/include/asm-x86/thread_info.h b/include/asm-x86/thread_info.h
index b2702a1eeac1..0a8f27d31d0d 100644
--- a/include/asm-x86/thread_info.h
+++ b/include/asm-x86/thread_info.h
@@ -118,7 +118,7 @@ struct thread_info {
118/* work to do in syscall_trace_enter() */ 118/* work to do in syscall_trace_enter() */
119#define _TIF_WORK_SYSCALL_ENTRY \ 119#define _TIF_WORK_SYSCALL_ENTRY \
120 (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \ 120 (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \
121 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP) 121 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)
122 122
123/* work to do in syscall_trace_leave() */ 123/* work to do in syscall_trace_leave() */
124#define _TIF_WORK_SYSCALL_EXIT \ 124#define _TIF_WORK_SYSCALL_EXIT \