From 57b8630098e12e281ecf5d791437dea1a6a1d2b3 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 20 Jul 2009 16:55:22 -0400 Subject: [PATCH] Only allow paravirt-inserted jumps that go outside the current section. Signed-off-by: Anders Kaseorg --- kmodsrc/x86/ksplice-arch.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kmodsrc/x86/ksplice-arch.c b/kmodsrc/x86/ksplice-arch.c index 319e121..4ba55e6 100644 --- a/kmodsrc/x86/ksplice-arch.c +++ b/kmodsrc/x86/ksplice-arch.c @@ -515,11 +515,8 @@ static abort_t compare_operands(struct ksplice_mod_change *change, ud_operand_lval(pre_op); const unsigned char *run_target = run + ud_insn_len(run_ud) + ud_operand_lval(run_op); - if (pre_target == run_target) { - /* Paravirt-inserted pcrel jump; OK! */ - return OK; - } else if (pre_target >= pre_start && - pre_target < pre_start + sect->size) { + if (pre_target >= pre_start && + pre_target < pre_start + sect->size) { /* Jump within the current function. Check it's to a corresponding place */ unsigned long new_pre_offset = pre_target - pre_start; @@ -539,6 +536,9 @@ static abort_t compare_operands(struct ksplice_mod_change *change, sect->unmatched++; } return OK; + } else if (pre_target == run_target) { + /* Paravirt-inserted pcrel jump; OK! */ + return OK; } else { if (mode == RUN_PRE_DEBUG) { ksdebug(change, "<--Different operands!\n"); -- 2.11.4.GIT