aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/kprobes/common.h2
-rw-r--r--arch/x86/kernel/kprobes/core.c6
-rw-r--r--arch/x86/kernel/kprobes/opt.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/kernel/kprobes/common.h b/arch/x86/kernel/kprobes/common.h
index c6ee63f927ab..d688826e5736 100644
--- a/arch/x86/kernel/kprobes/common.h
+++ b/arch/x86/kernel/kprobes/common.h
@@ -67,7 +67,7 @@
67#endif 67#endif
68 68
69/* Ensure if the instruction can be boostable */ 69/* Ensure if the instruction can be boostable */
70extern int can_boost(kprobe_opcode_t *instruction); 70extern int can_boost(kprobe_opcode_t *instruction, void *addr);
71/* Recover instruction if given address is probed */ 71/* Recover instruction if given address is probed */
72extern unsigned long recover_probed_instruction(kprobe_opcode_t *buf, 72extern unsigned long recover_probed_instruction(kprobe_opcode_t *buf,
73 unsigned long addr); 73 unsigned long addr);
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index d9d8d16b69db..b55d07b9d530 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -166,12 +166,12 @@ NOKPROBE_SYMBOL(skip_prefixes);
166 * Returns non-zero if opcode is boostable. 166 * Returns non-zero if opcode is boostable.
167 * RIP relative instructions are adjusted at copying time in 64 bits mode 167 * RIP relative instructions are adjusted at copying time in 64 bits mode
168 */ 168 */
169int can_boost(kprobe_opcode_t *opcodes) 169int can_boost(kprobe_opcode_t *opcodes, void *addr)
170{ 170{
171 kprobe_opcode_t opcode; 171 kprobe_opcode_t opcode;
172 kprobe_opcode_t *orig_opcodes = opcodes; 172 kprobe_opcode_t *orig_opcodes = opcodes;
173 173
174 if (search_exception_tables((unsigned long)opcodes)) 174 if (search_exception_tables((unsigned long)addr))
175 return 0; /* Page fault may occur on this address. */ 175 return 0; /* Page fault may occur on this address. */
176 176
177retry: 177retry:
@@ -416,7 +416,7 @@ static int arch_copy_kprobe(struct kprobe *p)
416 * __copy_instruction can modify the displacement of the instruction, 416 * __copy_instruction can modify the displacement of the instruction,
417 * but it doesn't affect boostable check. 417 * but it doesn't affect boostable check.
418 */ 418 */
419 if (can_boost(p->ainsn.insn)) 419 if (can_boost(p->ainsn.insn, p->addr))
420 p->ainsn.boostable = 0; 420 p->ainsn.boostable = 0;
421 else 421 else
422 p->ainsn.boostable = -1; 422 p->ainsn.boostable = -1;
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 3bb4c5f021f6..4d74f7386a61 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -178,7 +178,7 @@ static int copy_optimized_instructions(u8 *dest, u8 *src)
178 178
179 while (len < RELATIVEJUMP_SIZE) { 179 while (len < RELATIVEJUMP_SIZE) {
180 ret = __copy_instruction(dest + len, src + len); 180 ret = __copy_instruction(dest + len, src + len);
181 if (!ret || !can_boost(dest + len)) 181 if (!ret || !can_boost(dest + len, src + len))
182 return -EINVAL; 182 return -EINVAL;
183 len += ret; 183 len += ret;
184 } 184 }