[llvm-bugs] [Bug 44298] New: ELF symbol size for CFI vtable seems incorrect.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 13 13:41:56 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44298

            Bug ID: 44298
           Summary: ELF symbol size for CFI vtable seems incorrect.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: netforce00 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Hello,

It seems the symbols for CFI vtables could get incorrect sizes. For each vtable
entries, instead of the actual size of the stub, it seems the total size of the
vtable is being used. 

We could reproduce it with simple example.

$ cd `mktemp -d`
$ git clone https://github.com/trailofbits/clang-cfi-showcase
$ cd clang-cfi-showcase/
$ clang -g -flto -fsanitize=cfi -fvisibility=default cfi_icall.c

$ objdump -dS a.out
...
0000000000401478 <int_arg>:
  401478:       e9 83 fe ff ff          jmpq   401300 <int_arg.cfi>
  40147d:       cc                      int3  
  40147e:       cc                      int3  
  40147f:       cc                      int3  

0000000000401480 <bad_int_arg>:
  401480:       e9 bb fe ff ff          jmpq   401340 <bad_int_arg.cfi>
  401485:       cc                      int3  
  401486:       cc                      int3  
  401487:       cc                      int3  

0000000000401488 <not_entry_point>:
  401488:       e9 53 ff ff ff          jmpq   4013e0 <not_entry_point.cfi>
  40148d:       cc                      int3  
  40148e:       cc                      int3  
  40148f:       cc                      int3  
...

$ readelf -sW a.out
   Num:    Value          Size Type    Bind   Vis      Ndx Name
...
    43: 0000000000401480    24 FUNC    LOCAL  DEFAULT   13 bad_int_arg
...
    47: 0000000000401478    24 FUNC    LOCAL  DEFAULT   13 int_arg
...
    49: 0000000000401488    24 FUNC    LOCAL  DEFAULT   13 not_entry_point
...


This makes the symbols in the vtable overlap. To generate AutoFDO profile, we
have some tool list all symbols for a list of addresses, and this many
overlapping symbols cause our tool OOM. 

We believe the same issue was noticed by Chrome folks too:
https://bugs.chromium.org/p/chromium/issues/detail?id=947114

Could you take a look if more accurate symbol sizes can be given?

Thank you in advance,
HK

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191213/8fd8b46a/attachment.html>


More information about the llvm-bugs mailing list