Skip to content
  • Josh Poimboeuf's avatar
    scripts/faddr2line: Fix "size mismatch" error · efdb4167
    Josh Poimboeuf authored
    
    
    I'm not sure how we missed this problem before.  When I take a function
    address and size from an oops and give it to faddr2line, it usually
    complains about a size mismatch:
    
      $ scripts/faddr2line ~/k/vmlinux write_sysrq_trigger+0x51/0x60
      skipping write_sysrq_trigger address at 0xffffffff815731a1 due to size mismatch (0x60 != 83)
      no match for write_sysrq_trigger+0x51/0x60
    
    The problem is caused by differences in how kallsyms and faddr2line
    determine a function's size.
    
    kallsyms calculates a function's size by parsing the output of 'nm -n'
    and subtracting the next function's address from the current function's
    address.  This means that nop instructions after the end of the function
    are included in the size.
    
    In contrast, faddr2line reads the size from the symbol table, which does
    *not* include the ending nops in the function's size.
    
    Change faddr2line to calculate the size from the output of 'nm -n' to be
    consistent with kallsyms and oops outputs.
    
    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: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/bd313ed7c4003f6b1fda63e825325c44a9d837de.1477405374.git.jpoimboe@redhat.com
    
    
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    efdb4167