]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
objtool: Fix segfault in ignore_unreachable_insn()
authorJosh Poimboeuf <jpoimboe@redhat.com>
Thu, 8 Feb 2018 23:09:25 +0000 (17:09 -0600)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 23 Feb 2018 14:27:03 +0000 (08:27 -0600)
commit7c64b1f9f0ddbe497aaa25561497196fac8e510e
tree0dfd303f0260a8fae5efa772cb4000694cd7cc0a
parent5a7f2198cb7c373cf67648baee6e11f5e6b90422
objtool: Fix segfault in ignore_unreachable_insn()

BugLink: http://bugs.launchpad.net/bugs/1751131
commit fe24e27128252c230a34a6c628da2bf1676781ea 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>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
tools/objtool/check.c