Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306646
b: refs/heads/master
c: cbc91f7
h: refs/heads/master
v: v3
  • Loading branch information
Srikar Dronamraju authored and Ingo Molnar committed Apr 14, 2012
1 parent 5d63e25 commit 1d7a0b2
Show file tree
Hide file tree
Showing 5 changed files with 13 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: 7396fa818d6278694a44840f389ddc40a3269a9a
refs/heads/master: cbc91f71b51b8335f1fc7ccfca8011f31a717367
5 changes: 3 additions & 2 deletions trunk/include/linux/uprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
extern int uprobe_mmap(struct vm_area_struct *vma);
extern void uprobe_munmap(struct vm_area_struct *vma);
extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end);
extern void uprobe_free_utask(struct task_struct *t);
extern void uprobe_copy_process(struct task_struct *t);
extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
Expand All @@ -134,7 +134,8 @@ static inline int uprobe_mmap(struct vm_area_struct *vma)
{
return 0;
}
static inline void uprobe_munmap(struct vm_area_struct *vma)
static inline void
uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
{
}
static inline void uprobe_notify_resume(struct pt_regs *regs)
Expand Down
4 changes: 2 additions & 2 deletions trunk/kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ int uprobe_mmap(struct vm_area_struct *vma)
/*
* Called in context of a munmap of a vma.
*/
void uprobe_munmap(struct vm_area_struct *vma)
void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
{
struct list_head tmp_list;
struct uprobe *uprobe, *u;
Expand All @@ -1138,7 +1138,7 @@ void uprobe_munmap(struct vm_area_struct *vma)
list_del(&uprobe->pending_list);
vaddr = vma_address(vma, uprobe->offset);

if (vaddr >= vma->vm_start && vaddr < vma->vm_end) {
if (vaddr >= start && vaddr < end) {
/*
* An unregister could have removed the probe before
* unmap. So check before we decrement the count.
Expand Down
3 changes: 3 additions & 0 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,9 @@ static void unmap_single_vma(struct mmu_gather *tlb,
if (end <= vma->vm_start)
return;

if (vma->vm_file)
uprobe_munmap(vma, start, end);

if (vma->vm_flags & VM_ACCOUNT)
*nr_accounted += (end - start) >> PAGE_SHIFT;

Expand Down
8 changes: 4 additions & 4 deletions trunk/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ void unlink_file_vma(struct vm_area_struct *vma)
mutex_lock(&mapping->i_mmap_mutex);
__remove_shared_vm_struct(vma, file, mapping);
mutex_unlock(&mapping->i_mmap_mutex);
uprobe_munmap(vma);
}
}

Expand Down Expand Up @@ -548,10 +547,11 @@ again: remove_next = 1 + (end > next->vm_end);
mapping = file->f_mapping;
if (!(vma->vm_flags & VM_NONLINEAR)) {
root = &mapping->i_mmap;
uprobe_munmap(vma);
uprobe_munmap(vma, vma->vm_start, vma->vm_end);

if (adjust_next)
uprobe_munmap(next);
uprobe_munmap(next, next->vm_start,
next->vm_end);
}

mutex_lock(&mapping->i_mmap_mutex);
Expand Down Expand Up @@ -632,7 +632,7 @@ again: remove_next = 1 + (end > next->vm_end);

if (remove_next) {
if (file) {
uprobe_munmap(next);
uprobe_munmap(next, next->vm_start, next->vm_end);
fput(file);
if (next->vm_flags & VM_EXECUTABLE)
removed_exe_file_vma(mm);
Expand Down

0 comments on commit 1d7a0b2

Please sign in to comment.