Commit 08b393d0 authored by Committed by Ingo Molnar
objtool: Support GCC 8 '-fnoreorder-functions'
Since the following commit: cd77849a ("objtool: Fix GCC 8 cold subfunction detection for aliased functions") ... if the kernel is built with EXTRA_CFLAGS='-fno-reorder-functions', objtool can get stuck in an infinite loop. That flag causes the new GCC 8 cold subfunctions to be placed in .text instead of .text.unlikely. But it also has an unfortunate quirk: in the symbol table, the subfunction (e.g., nmi_panic.cold.7) is nested inside the parent (nmi_panic). That function overlap confuses objtool, and causes it to get into an infinite loop in next_insn_same_func(). Here's Allan's description of the loop: "Objtool iterates through the instructions in nmi_panic using next_insn_same_func. Once it reaches the end of nmi_panic at 0x534 it jumps to 0x528 as that's the start of nmi_panic.cold.7. However, since the instructions starting at 0x528 are still associated with nmi_panic objtool will get stuck in a loop, continually jumping back to 0x528 after reaching 0x534." Fix it by shortening the length of the parent function so that the functions no longer overlap. Reported-and-analyzed-by: Allan Xavier <firstname.lastname@example.org> Signed-off-by: Josh Poimboeuf <email@example.com> Cc: Allan Xavier <firstname.lastname@example.org> Cc: Andy Lutomirski <email@example.com> Cc: Borislav Petkov <firstname.lastname@example.org> Cc: Brian Gerst <email@example.com> Cc: Denys Vlasenko <firstname.lastname@example.org> Cc: H. Peter Anvin <email@example.com> Cc: Linus Torvalds <firstname.lastname@example.org> Cc: Peter Zijlstra <email@example.com> Cc: Thomas Gleixner <firstname.lastname@example.org> Link: http://email@example.comSigned-off-by: Ingo Molnar <firstname.lastname@example.org>
Showing with 28 additions and 13 deletions