Skip to content
  • Josh Poimboeuf's avatar
    objtool: Improve retpoline alternative handling · a845c7cf
    Josh Poimboeuf authored
    
    
    Currently objtool requires all retpolines to be:
    
      a) patched in with alternatives; and
    
      b) annotated with ANNOTATE_NOSPEC_ALTERNATIVE.
    
    If you forget to do both of the above, objtool segfaults trying to
    dereference a NULL 'insn->call_dest' pointer.
    
    Avoid that situation and print a more helpful error message:
    
      quirks.o: warning: objtool: efi_delete_dummy_variable()+0x99: unsupported intra-function call
      quirks.o: warning: objtool: If this is a retpoline, please patch it in with alternatives and annotate it with ANNOTATE_NOSPEC_ALTERNATIVE.
    
    Future improvements can be made to make objtool smarter with respect to
    retpolines, but this is a good incremental improvement for now.
    
    Reported-and-tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Juergen Gross <jgross@suse.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/819e50b6d9c2e1a22e34c1a636c0b2057cc8c6e5.1517284349.git.jpoimboe@redhat.com
    
    
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    a845c7cf