• Josh Poimboeuf's avatar
    objtool: Support new GCC 6 switch jump table pattern · 6d01f28b
    Josh Poimboeuf authored
    This fixes some false positive objtool warnings seen with gcc 6.1.1:
    
      kernel/trace/ring_buffer.o: warning: objtool: ring_buffer_read_page()+0x36c: sibling call from callable instruction with changed frame pointer
      arch/x86/kernel/reboot.o: warning: objtool: native_machine_emergency_restart()+0x139: sibling call from callable instruction with changed frame pointer
      lib/xz/xz_dec_stream.o: warning: objtool: xz_dec_run()+0xc2: sibling call from callable instruction with changed frame pointer
    
    With GCC 6, a new code pattern is sometimes used to access a switch
    statement jump table in .rodata, which objtool doesn't yet recognize:
    
      mov [rodata addr],%reg1
      ... some instructions ...
      jmpq *(%reg1,%reg2,8)
    
    Add support for detecting that pattern.  The detection code is rather
    crude, but it's still effective at weeding out false positives and
    catching real warnings.  It can be refined later once objtool starts
    reading DWARF CFI.
    Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-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: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/b8c9503b4ad8c8a827cc5400db4c1b40a3ea07bc.1469751119.git.jpoimboe@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    6d01f28b
builtin-check.c 29.7 KB