linux-stable/tools/objtool
Josh Poimboeuf 842a0d95ef objtool: Fix segfault in ignore_unreachable_insn()
commit fe24e27128 upstream.

Peter Zijlstra's patch for converting WARN() to use UD2 triggered a
bunch of false "unreachable instruction" warnings, which then triggered
a seg fault in ignore_unreachable_insn().

The seg fault happened when it tried to dereference a NULL 'insn->func'
pointer.  Thanks to static_cpu_has(), some functions can jump to a
non-function area in the .altinstr_aux section.  That breaks
ignore_unreachable_insn()'s assumption that it's always inside the
original function.

Make sure ignore_unreachable_insn() only follows jumps within the
current function.

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
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>
Cc: kbuild test robot <fengguang.wu@intel.com>
Link: http://lkml.kernel.org/r/bace77a60d5af9b45eddb8f8fb9c776c8de657ef.1518130694.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:42:22 +01:00
..
arch/x86 objtool: Fix Clang enum conversion warning 2018-01-23 19:58:09 +01:00
Documentation x86/asm: Fix inline asm call constraints for Clang 2017-09-23 15:06:20 +02:00
.gitignore objtool: Move synced files to their original relative locations 2017-12-29 17:53:41 +01:00
arch.h objtool: Assume unannotated UD2 instructions are dead ends 2017-07-28 08:33:32 +02:00
Build objtool: Add ORC unwind table generation 2017-07-18 10:57:43 +02:00
builtin-check.c objtool: Fix gcov check for older versions of GCC 2017-07-25 11:12:45 +02:00
builtin-orc.c objtool: Fix seg fault caused by missing parameter 2018-01-23 19:58:09 +01:00
builtin.h objtool: Add ORC unwind table generation 2017-07-18 10:57:43 +02:00
cfi.h objtool: Handle GCC stack pointer adjustment bug 2017-08-30 10:48:41 +02:00
check.c objtool: Fix segfault in ignore_unreachable_insn() 2018-02-22 15:42:22 +01:00
check.h objtool: Fix switch-table detection 2018-02-16 20:23:09 +01:00
elf.c objtool: Improve error message for bad file argument 2018-01-23 19:58:13 +01:00
elf.h objtool: Add ORC unwind table generation 2017-07-18 10:57:43 +02:00
Makefile tools/objtool/Makefile: don't assume sync-check.sh is executable 2018-01-23 19:58:09 +01:00
objtool.c objtool: Print top level commands on incorrect usage 2017-12-25 14:26:14 +01:00
orc.h objtool: Move synced files to their original relative locations 2017-12-29 17:53:41 +01:00
orc_dump.c objtool: Fix 64-bit build on 32-bit host 2017-12-29 17:53:42 +01:00
orc_gen.c objtool: Warn on stripped section symbol 2018-02-07 11:12:21 -08:00
special.c objtool: Implement stack validation 2.0 2017-06-30 10:19:19 +02:00
special.h
sync-check.sh objtool: Move kernel headers/code sync check to a script 2017-12-29 17:53:42 +01:00
warn.h objtool: Implement stack validation 2.0 2017-06-30 10:19:19 +02:00