diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-04-19 08:15:27 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2014-04-30 13:10:34 -0400 |
commit | ff261964cfcfe49d73690ca29b0ba2853d9497e3 (patch) | |
tree | 72af80a1fb4083f362796411858800fe44152c6f /arch/x86/kernel/uprobes.c | |
parent | 2ae1f49ae1978fedb6ad607e1f8b084aa9752f95 (diff) |
uprobes/x86: Shift "insn_complete" from branch_setup_xol_ops() to uprobe_init_insn()
Change uprobe_init_insn() to make insn_complete() == T, this makes
other insn_get_*() calls unnecessary.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Jim Keniston <jkenisto@us.ibm.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'arch/x86/kernel/uprobes.c')
-rw-r--r-- | arch/x86/kernel/uprobes.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index b3b25ddc04fb..98d7db50f425 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c | |||
@@ -209,8 +209,11 @@ static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool | |||
209 | u32 volatile *good_insns; | 209 | u32 volatile *good_insns; |
210 | 210 | ||
211 | insn_init(insn, auprobe->insn, x86_64); | 211 | insn_init(insn, auprobe->insn, x86_64); |
212 | /* has the side-effect of processing the entire instruction */ | ||
213 | insn_get_length(insn); | ||
214 | if (WARN_ON_ONCE(!insn_complete(insn))) | ||
215 | return -ENOEXEC; | ||
212 | 216 | ||
213 | insn_get_opcode(insn); | ||
214 | if (is_prefix_bad(insn)) | 217 | if (is_prefix_bad(insn)) |
215 | return -ENOTSUPP; | 218 | return -ENOTSUPP; |
216 | 219 | ||
@@ -283,8 +286,6 @@ handle_riprel_insn(struct arch_uprobe *auprobe, struct insn *insn) | |||
283 | * is the immediate operand. | 286 | * is the immediate operand. |
284 | */ | 287 | */ |
285 | cursor = auprobe->insn + insn_offset_modrm(insn); | 288 | cursor = auprobe->insn + insn_offset_modrm(insn); |
286 | insn_get_length(insn); | ||
287 | |||
288 | /* | 289 | /* |
289 | * Convert from rip-relative addressing to indirect addressing | 290 | * Convert from rip-relative addressing to indirect addressing |
290 | * via a scratch register. Change the r/m field from 0x5 (%rip) | 291 | * via a scratch register. Change the r/m field from 0x5 (%rip) |
@@ -564,11 +565,6 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) | |||
564 | u8 opc1 = OPCODE1(insn); | 565 | u8 opc1 = OPCODE1(insn); |
565 | int i; | 566 | int i; |
566 | 567 | ||
567 | /* has the side-effect of processing the entire instruction */ | ||
568 | insn_get_length(insn); | ||
569 | if (WARN_ON_ONCE(!insn_complete(insn))) | ||
570 | return -ENOEXEC; | ||
571 | |||
572 | switch (opc1) { | 568 | switch (opc1) { |
573 | case 0xeb: /* jmp 8 */ | 569 | case 0xeb: /* jmp 8 */ |
574 | case 0xe9: /* jmp 32 */ | 570 | case 0xe9: /* jmp 32 */ |
@@ -654,7 +650,6 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, | |||
654 | fix_ip = false; | 650 | fix_ip = false; |
655 | break; | 651 | break; |
656 | case 0xff: | 652 | case 0xff: |
657 | insn_get_modrm(&insn); | ||
658 | switch (MODRM_REG(&insn)) { | 653 | switch (MODRM_REG(&insn)) { |
659 | case 2: case 3: /* call or lcall, indirect */ | 654 | case 2: case 3: /* call or lcall, indirect */ |
660 | fix_call = true; | 655 | fix_call = true; |