Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312237
b: refs/heads/master
c: d9c4a30
h: refs/heads/master
i:
  312235: 1023a7c
v: v3
  • Loading branch information
Oleg Nesterov authored and Ingo Molnar committed Jun 16, 2012
1 parent 010672a commit 81cd628
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 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: eb2bf57bee42c7565032f93adaa211e2c9fcc52c
refs/heads/master: d9c4a30e82614d43b55893a73f31e7284007ce82
11 changes: 5 additions & 6 deletions trunk/kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
void *vaddr_old, *vaddr_new;
struct vm_area_struct *vma;
struct uprobe *uprobe;
unsigned long pgoff;
int ret;
retry:
/* Read the page with vaddr into memory */
Expand Down Expand Up @@ -251,11 +250,7 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
vaddr_new = kmap_atomic(new_page);

memcpy(vaddr_new, vaddr_old, PAGE_SIZE);

/* poke the new insn in, ASSUMES we don't cross page boundary */
pgoff = (vaddr & ~PAGE_MASK);
BUG_ON(pgoff + UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);
memcpy(vaddr_new + pgoff, &opcode, UPROBE_SWBP_INSN_SIZE);
memcpy(vaddr_new + (vaddr & ~PAGE_MASK), &opcode, UPROBE_SWBP_INSN_SIZE);

kunmap_atomic(vaddr_new);
kunmap_atomic(vaddr_old);
Expand Down Expand Up @@ -699,6 +694,10 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm,
if (ret)
return ret;

/* write_opcode() assumes we don't cross page boundary */
BUG_ON((uprobe->offset & ~PAGE_MASK) +
UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);

uprobe->flags |= UPROBE_COPY_INSN;
}

Expand Down

0 comments on commit 81cd628

Please sign in to comment.