From c15e1d333ca9e693d3648e681217d32dfc164aa8 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 20 Jul 2009 16:17:06 -0400 Subject: [PATCH] Tighten x86-64 NOP detection. MOV or LEA on a 32-bit register is not actually a NOP on x86-64. Signed-off-by: Anders Kaseorg --- kmodsrc/x86/ksplice-arch.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kmodsrc/x86/ksplice-arch.c b/kmodsrc/x86/ksplice-arch.c index fdfcd85..f13d288 100644 --- a/kmodsrc/x86/ksplice-arch.c +++ b/kmodsrc/x86/ksplice-arch.c @@ -582,17 +582,15 @@ static bool is_nop(struct ud *ud, const unsigned char *addr) case UD_Inop: return true; case UD_Imov: - return ud->operand[0].type == UD_OP_REG && - ud->operand[1].type == UD_OP_REG && - ud->operand[2].type == UD_NONE && - ud->operand[0].base == ud->operand[1].base; case UD_Ixchg: - return ud->operand[0].type == UD_OP_REG && + return ud->dis_mode == 32 && + ud->operand[0].type == UD_OP_REG && ud->operand[1].type == UD_OP_REG && ud->operand[2].type == UD_NONE && ud->operand[0].base == ud->operand[1].base; case UD_Ilea: - return ud->operand[0].type == UD_OP_REG && + return ud->dis_mode == 32 && + ud->operand[0].type == UD_OP_REG && ud->operand[1].type == UD_OP_MEM && ((ud->operand[1].base == ud->operand[0].base && ud->operand[1].index == UD_NONE) || -- 2.11.4.GIT