Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323852
b: refs/heads/master
c: 3a4664a
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov committed Sep 15, 2012
1 parent 02a08ce commit 87019f4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 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: 9bd1190a11c9d2c59d35cb999b8d170ad52aab5f
refs/heads/master: 3a4664aa8362d9fa9110828f55afa9f9fcd7e484
3 changes: 1 addition & 2 deletions trunk/arch/x86/include/asm/uprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ struct arch_uprobe_task {
#ifdef CONFIG_X86_64
unsigned long saved_scratch_register;
#endif
#define UPROBE_CLEAR_TF (1 << 0)
unsigned int restore_flags;
unsigned int saved_tf;
};

extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
Expand Down
19 changes: 13 additions & 6 deletions trunk/arch/x86/kernel/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
* Skip these instructions as per the currently known x86 ISA.
* 0x66* { 0x90 | 0x0f 0x1f | 0x0f 0x19 | 0x87 0xc0 }
*/
bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
static bool __skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
{
int i;

Expand Down Expand Up @@ -681,16 +681,21 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
return false;
}

bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
{
bool ret = __skip_sstep(auprobe, regs);
if (ret && (regs->flags & X86_EFLAGS_TF))
send_sig(SIGTRAP, current, 0);
return ret;
}

void arch_uprobe_enable_step(struct arch_uprobe *auprobe)
{
struct task_struct *task = current;
struct arch_uprobe_task *autask = &task->utask->autask;
struct pt_regs *regs = task_pt_regs(task);

autask->restore_flags = 0;
if (!(regs->flags & X86_EFLAGS_TF) &&
!(auprobe->fixups & UPROBE_FIX_SETF))
autask->restore_flags |= UPROBE_CLEAR_TF;
autask->saved_tf = !!(regs->flags & X86_EFLAGS_TF);

regs->flags |= X86_EFLAGS_TF;
if (test_tsk_thread_flag(task, TIF_BLOCKSTEP))
Expand All @@ -707,6 +712,8 @@ void arch_uprobe_disable_step(struct arch_uprobe *auprobe)
* SIGTRAP if we do not clear TF. We need to examine the opcode to
* make it right.
*/
if (autask->restore_flags & UPROBE_CLEAR_TF)
if (autask->saved_tf)
send_sig(SIGTRAP, task, 0);
else if (!(auprobe->fixups & UPROBE_FIX_SETF))
regs->flags &= ~X86_EFLAGS_TF;
}

0 comments on commit 87019f4

Please sign in to comment.