Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104384
b: refs/heads/master
c: 380fdd7
h: refs/heads/master
v: v3
  • Loading branch information
Roland McGrath committed Jul 16, 2008
1 parent 9eb4f0f commit ba222d2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4d67150165df8bf1cc05e532f6efca96f907cab
refs/heads/master: 380fdd7585a4c2f41b48925eba85c0654b7b858b
10 changes: 10 additions & 0 deletions trunk/arch/x86/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,16 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs)
{
long ret = 0;

/*
* If we stepped into a sysenter/syscall insn, it trapped in
* kernel mode; do_debug() cleared TF and set TIF_SINGLESTEP.
* If user-mode had set TF itself, then it's still clear from
* do_debug() and we need to set it again to restore the user
* state. If we entered on the slow path, TF was already set.
*/
if (test_thread_flag(TIF_SINGLESTEP))
regs->flags |= X86_EFLAGS_TF;

/* do the secure computing check first */
secure_computing(regs->orig_ax);

Expand Down
13 changes: 13 additions & 0 deletions trunk/arch/x86/kernel/step.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ static int enable_single_step(struct task_struct *child)
struct pt_regs *regs = task_pt_regs(child);
unsigned long oflags;

/*
* If we stepped into a sysenter/syscall insn, it trapped in
* kernel mode; do_debug() cleared TF and set TIF_SINGLESTEP.
* If user-mode had set TF itself, then it's still clear from
* do_debug() and we need to set it again to restore the user
* state so we don't wrongly set TIF_FORCED_TF below.
* If enable_single_step() was used last and that is what
* set TIF_SINGLESTEP, then both TF and TIF_FORCED_TF are
* already set and our bookkeeping is fine.
*/
if (unlikely(test_tsk_thread_flag(child, TIF_SINGLESTEP)))
regs->flags |= X86_EFLAGS_TF;

/*
* Always set TIF_SINGLESTEP - this guarantees that
* we single-step system calls etc.. This will also
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-x86/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct thread_info {
/* work to do in syscall_trace_enter() */
#define _TIF_WORK_SYSCALL_ENTRY \
(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \
_TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
_TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)

/* work to do in syscall_trace_leave() */
#define _TIF_WORK_SYSCALL_EXIT \
Expand Down

0 comments on commit ba222d2

Please sign in to comment.