Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323851
b: refs/heads/master
c: 9bd1190
h: refs/heads/master
i:
  323849: 465a862
  323847: 5715599
v: v3
  • Loading branch information
Oleg Nesterov committed Sep 15, 2012
1 parent a7fa559 commit 02a08ce
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 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: 95cf00fa5d5e2a200a2c044c84bde8389a237e02
refs/heads/master: 9bd1190a11c9d2c59d35cb999b8d170ad52aab5f
2 changes: 2 additions & 0 deletions trunk/arch/x86/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,8 @@ static inline void update_debugctlmsr(unsigned long debugctlmsr)
wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr);
}

extern void set_task_blockstep(struct task_struct *task, bool on);

/*
* from system description table in BIOS. Mostly for MCA use, but
* others may find it useful:
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/step.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int enable_single_step(struct task_struct *child)
return 1;
}

static void set_task_blockstep(struct task_struct *task, bool on)
void set_task_blockstep(struct task_struct *task, bool on)
{
unsigned long debugctl;

Expand Down
32 changes: 18 additions & 14 deletions trunk/arch/x86/kernel/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,26 +683,30 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)

void arch_uprobe_enable_step(struct arch_uprobe *auprobe)
{
struct uprobe_task *utask = current->utask;
struct arch_uprobe_task *autask = &utask->autask;
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 (!test_tsk_thread_flag(current, TIF_SINGLESTEP) &&
!(auprobe->fixups & UPROBE_FIX_SETF))
if (!(regs->flags & X86_EFLAGS_TF) &&
!(auprobe->fixups & UPROBE_FIX_SETF))
autask->restore_flags |= UPROBE_CLEAR_TF;
/*
* The state of TIF_BLOCKSTEP is not saved. With the TF flag set we
* would to examine the opcode and the flags to make it right. Without
* TF block stepping makes no sense.
*/
user_enable_single_step(current);

regs->flags |= X86_EFLAGS_TF;
if (test_tsk_thread_flag(task, TIF_BLOCKSTEP))
set_task_blockstep(task, false);
}

void arch_uprobe_disable_step(struct arch_uprobe *auprobe)
{
struct uprobe_task *utask = current->utask;
struct arch_uprobe_task *autask = &utask->autask;

struct task_struct *task = current;
struct arch_uprobe_task *autask = &task->utask->autask;
struct pt_regs *regs = task_pt_regs(task);
/*
* The state of TIF_BLOCKSTEP was not saved so we can get an extra
* SIGTRAP if we do not clear TF. We need to examine the opcode to
* make it right.
*/
if (autask->restore_flags & UPROBE_CLEAR_TF)
user_disable_single_step(current);
regs->flags &= ~X86_EFLAGS_TF;
}

0 comments on commit 02a08ce

Please sign in to comment.