diff options
-rw-r--r-- | include/linux/uprobes.h | 1 | ||||
-rw-r--r-- | kernel/events/uprobes.c | 14 |
2 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 28473e3f6068..319eae70fe84 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h | |||
@@ -109,6 +109,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign | |||
109 | extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); | 109 | extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); |
110 | extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); | 110 | extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); |
111 | extern bool __weak is_trap_insn(uprobe_opcode_t *insn); | 111 | extern bool __weak is_trap_insn(uprobe_opcode_t *insn); |
112 | extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); | ||
112 | extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); | 113 | extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); |
113 | extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); | 114 | extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); |
114 | extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); | 115 | extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); |
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index fbcff61b5099..0ac346ae5edb 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -245,12 +245,12 @@ static int verify_opcode(struct page *page, unsigned long vaddr, uprobe_opcode_t | |||
245 | * the architecture. If an arch has variable length instruction and the | 245 | * the architecture. If an arch has variable length instruction and the |
246 | * breakpoint instruction is not of the smallest length instruction | 246 | * breakpoint instruction is not of the smallest length instruction |
247 | * supported by that architecture then we need to modify is_trap_at_addr and | 247 | * supported by that architecture then we need to modify is_trap_at_addr and |
248 | * write_opcode accordingly. This would never be a problem for archs that | 248 | * uprobe_write_opcode accordingly. This would never be a problem for archs |
249 | * have fixed length instructions. | 249 | * that have fixed length instructions. |
250 | */ | 250 | */ |
251 | 251 | ||
252 | /* | 252 | /* |
253 | * write_opcode - write the opcode at a given virtual address. | 253 | * uprobe_write_opcode - write the opcode at a given virtual address. |
254 | * @mm: the probed process address space. | 254 | * @mm: the probed process address space. |
255 | * @vaddr: the virtual address to store the opcode. | 255 | * @vaddr: the virtual address to store the opcode. |
256 | * @opcode: opcode to be written at @vaddr. | 256 | * @opcode: opcode to be written at @vaddr. |
@@ -261,7 +261,7 @@ static int verify_opcode(struct page *page, unsigned long vaddr, uprobe_opcode_t | |||
261 | * For mm @mm, write the opcode at @vaddr. | 261 | * For mm @mm, write the opcode at @vaddr. |
262 | * Return 0 (success) or a negative errno. | 262 | * Return 0 (success) or a negative errno. |
263 | */ | 263 | */ |
264 | static int write_opcode(struct mm_struct *mm, unsigned long vaddr, | 264 | int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, |
265 | uprobe_opcode_t opcode) | 265 | uprobe_opcode_t opcode) |
266 | { | 266 | { |
267 | struct page *old_page, *new_page; | 267 | struct page *old_page, *new_page; |
@@ -315,7 +315,7 @@ put_old: | |||
315 | */ | 315 | */ |
316 | int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) | 316 | int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) |
317 | { | 317 | { |
318 | return write_opcode(mm, vaddr, UPROBE_SWBP_INSN); | 318 | return uprobe_write_opcode(mm, vaddr, UPROBE_SWBP_INSN); |
319 | } | 319 | } |
320 | 320 | ||
321 | /** | 321 | /** |
@@ -330,7 +330,7 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned | |||
330 | int __weak | 330 | int __weak |
331 | set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) | 331 | set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) |
332 | { | 332 | { |
333 | return write_opcode(mm, vaddr, *(uprobe_opcode_t *)auprobe->insn); | 333 | return uprobe_write_opcode(mm, vaddr, *(uprobe_opcode_t *)auprobe->insn); |
334 | } | 334 | } |
335 | 335 | ||
336 | static int match_uprobe(struct uprobe *l, struct uprobe *r) | 336 | static int match_uprobe(struct uprobe *l, struct uprobe *r) |
@@ -577,7 +577,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file, | |||
577 | if (ret) | 577 | if (ret) |
578 | goto out; | 578 | goto out; |
579 | 579 | ||
580 | /* write_opcode() assumes we don't cross page boundary */ | 580 | /* uprobe_write_opcode() assumes we don't cross page boundary */ |
581 | BUG_ON((uprobe->offset & ~PAGE_MASK) + | 581 | BUG_ON((uprobe->offset & ~PAGE_MASK) + |
582 | UPROBE_SWBP_INSN_SIZE > PAGE_SIZE); | 582 | UPROBE_SWBP_INSN_SIZE > PAGE_SIZE); |
583 | 583 | ||