Commit 69042bf2 authored by Jiri Slaby's avatar Jiri Slaby Committed by Ingo Molnar

objtool: Fix bytes check of lea's rex_prefix

For the "lea %(rsp), %rbp" case, we check if there is a rex_prefix.
But we check 'bytes' which is insn_byte_t[4] in rex_prefix (insn_field
structure). Therefore, the check is always true.

Instead, check 'nbytes' which is the right one.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20161205105551.25917-1-jslaby@suse.czSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent d9d04527
...@@ -99,7 +99,7 @@ int arch_decode_instruction(struct elf *elf, struct section *sec, ...@@ -99,7 +99,7 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
break; break;
case 0x8d: case 0x8d:
if (insn.rex_prefix.bytes && if (insn.rex_prefix.nbytes &&
insn.rex_prefix.bytes[0] == 0x48 && insn.rex_prefix.bytes[0] == 0x48 &&
insn.modrm.nbytes && insn.modrm.bytes[0] == 0x2c && insn.modrm.nbytes && insn.modrm.bytes[0] == 0x2c &&
insn.sib.nbytes && insn.sib.bytes[0] == 0x24) insn.sib.nbytes && insn.sib.bytes[0] == 0x24)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment