diff options
-rw-r--r-- | arch/x86/kernel/kprobes.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index b1804e40235d..80bcb7635465 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c | |||
@@ -263,15 +263,16 @@ static int __kprobes is_IF_modifier(kprobe_opcode_t *insn) | |||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | #ifdef CONFIG_X86_64 | ||
267 | /* | 266 | /* |
268 | * Adjust the displacement if the instruction uses the %rip-relative | 267 | * Adjust the displacement if the instruction uses the %rip-relative |
269 | * addressing mode. | 268 | * addressing mode. |
270 | * If it does, Return the address of the 32-bit displacement word. | 269 | * If it does, Return the address of the 32-bit displacement word. |
271 | * If not, return null. | 270 | * If not, return null. |
271 | * Only applicable to 64-bit x86. | ||
272 | */ | 272 | */ |
273 | static void __kprobes fix_riprel(struct kprobe *p) | 273 | static void __kprobes fix_riprel(struct kprobe *p) |
274 | { | 274 | { |
275 | #ifdef CONFIG_X86_64 | ||
275 | u8 *insn = p->ainsn.insn; | 276 | u8 *insn = p->ainsn.insn; |
276 | s64 disp; | 277 | s64 disp; |
277 | int need_modrm; | 278 | int need_modrm; |
@@ -335,15 +336,15 @@ static void __kprobes fix_riprel(struct kprobe *p) | |||
335 | *(s32 *)insn = (s32) disp; | 336 | *(s32 *)insn = (s32) disp; |
336 | } | 337 | } |
337 | } | 338 | } |
338 | } | ||
339 | #endif | 339 | #endif |
340 | } | ||
340 | 341 | ||
341 | static void __kprobes arch_copy_kprobe(struct kprobe *p) | 342 | static void __kprobes arch_copy_kprobe(struct kprobe *p) |
342 | { | 343 | { |
343 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 344 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
344 | #ifdef CONFIG_X86_64 | 345 | |
345 | fix_riprel(p); | 346 | fix_riprel(p); |
346 | #endif | 347 | |
347 | if (can_boost(p->addr)) | 348 | if (can_boost(p->addr)) |
348 | p->ainsn.boostable = 0; | 349 | p->ainsn.boostable = 0; |
349 | else | 350 | else |