aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-03-31 11:24:14 -0400
committerOleg Nesterov <oleg@redhat.com>2014-04-17 15:58:20 -0400
commite55848a4f8ee52465771983e144f0c3337776eda (patch)
tree362ada49af831c34eff21354c90eaeb995091477
parent8ad8e9d3fd64f101eed6652964670672d699e563 (diff)
uprobes/x86: Conditionalize the usage of handle_riprel_insn()
arch_uprobe_analyze_insn() calls handle_riprel_insn() at the start, but only "0xff" and "default" cases need the UPROBE_FIX_RIP_ logic. Move the callsite into "default" case and change the "0xff" case to fall-through. We are going to add the various hooks to handle the rip-relative jmp/call instructions (and more), we need this change to enforce the fact that the new code can not conflict with is_riprel_insn() logic which, after this change, can only be used by default_xol_ops. Note: arch_uprobe_abort_xol() still calls handle_riprel_post_xol() directly. This is fine unless another _xol_ops we may add later will need to reuse "UPROBE_FIX_RIP_AX|UPROBE_FIX_RIP_CX" bits in ->fixup. In this case we can add uprobe_xol_ops->abort() hook, which (perhaps) we will need anyway in the long term. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Jim Keniston <jkenisto@us.ibm.com> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
-rw-r--r--arch/x86/kernel/uprobes.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index 13ad8a38c2d9..08cdb82815fe 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -482,8 +482,6 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
482 * and annotate arch_uprobe->fixups accordingly. To start with, ->fixups 482 * and annotate arch_uprobe->fixups accordingly. To start with, ->fixups
483 * is either zero or it reflects rip-related fixups. 483 * is either zero or it reflects rip-related fixups.
484 */ 484 */
485 handle_riprel_insn(auprobe, &insn);
486
487 switch (OPCODE1(&insn)) { 485 switch (OPCODE1(&insn)) {
488 case 0x9d: /* popf */ 486 case 0x9d: /* popf */
489 auprobe->fixups |= UPROBE_FIX_SETF; 487 auprobe->fixups |= UPROBE_FIX_SETF;
@@ -512,9 +510,9 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
512 case 4: case 5: /* jmp or ljmp, indirect */ 510 case 4: case 5: /* jmp or ljmp, indirect */
513 fix_ip = false; 511 fix_ip = false;
514 } 512 }
515 break; 513 /* fall through */
516 default: 514 default:
517 break; 515 handle_riprel_insn(auprobe, &insn);
518 } 516 }
519 517
520 if (fix_ip) 518 if (fix_ip)