aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/uprobes.h4
-rw-r--r--include/linux/uprobes.h4
-rw-r--r--kernel/events/uprobes.c34
3 files changed, 21 insertions, 21 deletions
diff --git a/arch/x86/include/asm/uprobes.h b/arch/x86/include/asm/uprobes.h
index 384f1bebf884..0500391f57d0 100644
--- a/arch/x86/include/asm/uprobes.h
+++ b/arch/x86/include/asm/uprobes.h
@@ -28,8 +28,8 @@ typedef u8 uprobe_opcode_t;
28#define MAX_UINSN_BYTES 16 28#define MAX_UINSN_BYTES 16
29#define UPROBE_XOL_SLOT_BYTES 128 /* to keep it cache aligned */ 29#define UPROBE_XOL_SLOT_BYTES 128 /* to keep it cache aligned */
30 30
31#define UPROBE_BKPT_INSN 0xcc 31#define UPROBE_SWBP_INSN 0xcc
32#define UPROBE_BKPT_INSN_SIZE 1 32#define UPROBE_SWBP_INSN_SIZE 1
33 33
34struct arch_uprobe { 34struct arch_uprobe {
35 u16 fixups; 35 u16 fixups;
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 58699182e9a7..eac525f41b94 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -52,9 +52,9 @@ struct uprobe_consumer {
52}; 52};
53 53
54#ifdef CONFIG_UPROBES 54#ifdef CONFIG_UPROBES
55extern int __weak set_bkpt(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 55extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
56extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr, bool verify); 56extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr, bool verify);
57extern bool __weak is_bkpt_insn(uprobe_opcode_t *insn); 57extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
58extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 58extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
59extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 59extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
60extern int uprobe_mmap(struct vm_area_struct *vma); 60extern int uprobe_mmap(struct vm_area_struct *vma);
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 9c5ddff1c8da..e56e56aa7535 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -170,14 +170,14 @@ out:
170} 170}
171 171
172/** 172/**
173 * is_bkpt_insn - check if instruction is breakpoint instruction. 173 * is_swbp_insn - check if instruction is breakpoint instruction.
174 * @insn: instruction to be checked. 174 * @insn: instruction to be checked.
175 * Default implementation of is_bkpt_insn 175 * Default implementation of is_swbp_insn
176 * Returns true if @insn is a breakpoint instruction. 176 * Returns true if @insn is a breakpoint instruction.
177 */ 177 */
178bool __weak is_bkpt_insn(uprobe_opcode_t *insn) 178bool __weak is_swbp_insn(uprobe_opcode_t *insn)
179{ 179{
180 return *insn == UPROBE_BKPT_INSN; 180 return *insn == UPROBE_SWBP_INSN;
181} 181}
182 182
183/* 183/*
@@ -227,7 +227,7 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
227 * adding probes in write mapped pages since the breakpoints 227 * adding probes in write mapped pages since the breakpoints
228 * might end up in the file copy. 228 * might end up in the file copy.
229 */ 229 */
230 if (!valid_vma(vma, is_bkpt_insn(&opcode))) 230 if (!valid_vma(vma, is_swbp_insn(&opcode)))
231 goto put_out; 231 goto put_out;
232 232
233 uprobe = container_of(auprobe, struct uprobe, arch); 233 uprobe = container_of(auprobe, struct uprobe, arch);
@@ -259,8 +259,8 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
259 259
260 /* poke the new insn in, ASSUMES we don't cross page boundary */ 260 /* poke the new insn in, ASSUMES we don't cross page boundary */
261 vaddr &= ~PAGE_MASK; 261 vaddr &= ~PAGE_MASK;
262 BUG_ON(vaddr + UPROBE_BKPT_INSN_SIZE > PAGE_SIZE); 262 BUG_ON(vaddr + UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);
263 memcpy(vaddr_new + vaddr, &opcode, UPROBE_BKPT_INSN_SIZE); 263 memcpy(vaddr_new + vaddr, &opcode, UPROBE_SWBP_INSN_SIZE);
264 264
265 kunmap_atomic(vaddr_new); 265 kunmap_atomic(vaddr_new);
266 kunmap_atomic(vaddr_old); 266 kunmap_atomic(vaddr_old);
@@ -308,7 +308,7 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_
308 lock_page(page); 308 lock_page(page);
309 vaddr_new = kmap_atomic(page); 309 vaddr_new = kmap_atomic(page);
310 vaddr &= ~PAGE_MASK; 310 vaddr &= ~PAGE_MASK;
311 memcpy(opcode, vaddr_new + vaddr, UPROBE_BKPT_INSN_SIZE); 311 memcpy(opcode, vaddr_new + vaddr, UPROBE_SWBP_INSN_SIZE);
312 kunmap_atomic(vaddr_new); 312 kunmap_atomic(vaddr_new);
313 unlock_page(page); 313 unlock_page(page);
314 314
@@ -317,7 +317,7 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_
317 return 0; 317 return 0;
318} 318}
319 319
320static int is_bkpt_at_addr(struct mm_struct *mm, unsigned long vaddr) 320static int is_swbp_at_addr(struct mm_struct *mm, unsigned long vaddr)
321{ 321{
322 uprobe_opcode_t opcode; 322 uprobe_opcode_t opcode;
323 int result; 323 int result;
@@ -326,14 +326,14 @@ static int is_bkpt_at_addr(struct mm_struct *mm, unsigned long vaddr)
326 if (result) 326 if (result)
327 return result; 327 return result;
328 328
329 if (is_bkpt_insn(&opcode)) 329 if (is_swbp_insn(&opcode))
330 return 1; 330 return 1;
331 331
332 return 0; 332 return 0;
333} 333}
334 334
335/** 335/**
336 * set_bkpt - store breakpoint at a given address. 336 * set_swbp - store breakpoint at a given address.
337 * @auprobe: arch specific probepoint information. 337 * @auprobe: arch specific probepoint information.
338 * @mm: the probed process address space. 338 * @mm: the probed process address space.
339 * @vaddr: the virtual address to insert the opcode. 339 * @vaddr: the virtual address to insert the opcode.
@@ -341,18 +341,18 @@ static int is_bkpt_at_addr(struct mm_struct *mm, unsigned long vaddr)
341 * For mm @mm, store the breakpoint instruction at @vaddr. 341 * For mm @mm, store the breakpoint instruction at @vaddr.
342 * Return 0 (success) or a negative errno. 342 * Return 0 (success) or a negative errno.
343 */ 343 */
344int __weak set_bkpt(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) 344int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr)
345{ 345{
346 int result; 346 int result;
347 347
348 result = is_bkpt_at_addr(mm, vaddr); 348 result = is_swbp_at_addr(mm, vaddr);
349 if (result == 1) 349 if (result == 1)
350 return -EEXIST; 350 return -EEXIST;
351 351
352 if (result) 352 if (result)
353 return result; 353 return result;
354 354
355 return write_opcode(auprobe, mm, vaddr, UPROBE_BKPT_INSN); 355 return write_opcode(auprobe, mm, vaddr, UPROBE_SWBP_INSN);
356} 356}
357 357
358/** 358/**
@@ -371,7 +371,7 @@ set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long v
371 if (verify) { 371 if (verify) {
372 int result; 372 int result;
373 373
374 result = is_bkpt_at_addr(mm, vaddr); 374 result = is_swbp_at_addr(mm, vaddr);
375 if (!result) 375 if (!result)
376 return -EINVAL; 376 return -EINVAL;
377 377
@@ -642,7 +642,7 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm,
642 if (ret) 642 if (ret)
643 return ret; 643 return ret;
644 644
645 if (is_bkpt_insn((uprobe_opcode_t *)uprobe->arch.insn)) 645 if (is_swbp_insn((uprobe_opcode_t *)uprobe->arch.insn))
646 return -EEXIST; 646 return -EEXIST;
647 647
648 ret = arch_uprobes_analyze_insn(&uprobe->arch, mm); 648 ret = arch_uprobes_analyze_insn(&uprobe->arch, mm);
@@ -651,7 +651,7 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm,
651 651
652 uprobe->flags |= UPROBE_COPY_INSN; 652 uprobe->flags |= UPROBE_COPY_INSN;
653 } 653 }
654 ret = set_bkpt(&uprobe->arch, mm, addr); 654 ret = set_swbp(&uprobe->arch, mm, addr);
655 655
656 return ret; 656 return ret;
657} 657}