Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312210
b: refs/heads/master
c: 3a9ea05
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and Ingo Molnar committed Jun 6, 2012
1 parent ac25f5c commit 93a2931
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 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: a3d7bb47937b3a40b9f0c75655e97b3bb6407cbe
refs/heads/master: 3a9ea0520f38def4a3915b91f82455b749f07d88
47 changes: 28 additions & 19 deletions trunk/kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,38 +1489,47 @@ static bool can_skip_sstep(struct uprobe *uprobe, struct pt_regs *regs)
return false;
}

/*
* Run handler and ask thread to singlestep.
* Ensure all non-fatal signals cannot interrupt thread while it singlesteps.
*/
static void handle_swbp(struct pt_regs *regs)
static struct uprobe *find_active_uprobe(unsigned long bp_vaddr)
{
struct mm_struct *mm = current->mm;
struct uprobe *uprobe = NULL;
struct vm_area_struct *vma;
struct uprobe_task *utask;
struct uprobe *uprobe;
struct mm_struct *mm;
unsigned long bp_vaddr;

uprobe = NULL;
bp_vaddr = uprobe_get_swbp_addr(regs);
mm = current->mm;
down_read(&mm->mmap_sem);
vma = find_vma(mm, bp_vaddr);

if (vma && vma->vm_start <= bp_vaddr && valid_vma(vma, false)) {
struct inode *inode;
loff_t offset;
if (vma && vma->vm_start <= bp_vaddr) {
if (valid_vma(vma, false)) {
struct inode *inode;
loff_t offset;

inode = vma->vm_file->f_mapping->host;
offset = bp_vaddr - vma->vm_start;
offset += (vma->vm_pgoff << PAGE_SHIFT);
uprobe = find_uprobe(inode, offset);
inode = vma->vm_file->f_mapping->host;
offset = bp_vaddr - vma->vm_start;
offset += (vma->vm_pgoff << PAGE_SHIFT);
uprobe = find_uprobe(inode, offset);
}
}

srcu_read_unlock_raw(&uprobes_srcu, current->uprobe_srcu_id);
current->uprobe_srcu_id = -1;
up_read(&mm->mmap_sem);

return uprobe;
}

/*
* Run handler and ask thread to singlestep.
* Ensure all non-fatal signals cannot interrupt thread while it singlesteps.
*/
static void handle_swbp(struct pt_regs *regs)
{
struct uprobe_task *utask;
struct uprobe *uprobe;
unsigned long bp_vaddr;

bp_vaddr = uprobe_get_swbp_addr(regs);
uprobe = find_active_uprobe(bp_vaddr);

if (!uprobe) {
/* No matching uprobe; signal SIGTRAP. */
send_sig(SIGTRAP, current, 0);
Expand Down

0 comments on commit 93a2931

Please sign in to comment.