[PATCH] [PowerPC]Adapt fast stack unwinding to work for Power.

Bill Seurer seurer at linux.vnet.ibm.com
Mon May 18 16:18:19 PDT 2015


Interesting.  I tried this on an x86 box and it removed "main" from the stack for my little test (same one I ran on Power) for new and delete.

On x86 with the stack popping (the code as-is):

==10965==ERROR: AddressSanitizer: heap-use-after-free on address 0x60200000eff0 at pc 0x0000004dd5b8 bp 0x7fff42515970 sp 0x7fff42515968
WRITE of size 4 at 0x60200000eff0 thread T0

  #0 0x4dd5b7 in Func6(int, int*) /home/seurer/test/stack/crash.cpp:19:7
  #1 0x4dd6d6 in Func5(int, int*) /home/seurer/test/stack/crash.cpp:27:10
  #2 0x4dd886 in Func4(int, int*) /home/seurer/test/stack/crash.cpp:34:10
  #3 0x4dda36 in Func3(int, int*) /home/seurer/test/stack/crash.cpp:41:10
  #4 0x4ddbe6 in Func2(int, int*) /home/seurer/test/stack/crash.cpp:48:10
  #5 0x4ddd96 in Func1(int, int*) /home/seurer/test/stack/crash.cpp:55:10
  #6 0x4ddf63 in main /home/seurer/test/stack/crash.cpp:64:10
  #7 0x3af5a1ed5c in __libc_start_main (/lib64/libc.so.6+0x3af5a1ed5c)
  #8 0x41b324 in _start (/home/seurer/test/stack/crash-test+0x41b324)

0x60200000eff0 is located 0 bytes inside of 4-byte region [0x60200000eff0,0x60200000eff4)
freed by thread T0 here:

  #0 0x4db0d0 in operator delete(void*) /home/seurer/llvm/llvm-test/projects/compiler-rt/lib/asan/asan_new_delete.cc:94
  #1 0x3af5a1ed5c in __libc_start_main (/lib64/libc.so.6+0x3af5a1ed5c)

previously allocated by thread T0 here:

  #0 0x4daad0 in operator new(unsigned long) /home/seurer/llvm/llvm-test/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
  #1 0x3af5a1ed5c in __libc_start_main (/lib64/libc.so.6+0x3af5a1ed5c)

With the stack popping removed:

==14038==ERROR: AddressSanitizer: heap-use-after-free on address 0x60200000eff0 at pc 0x0000004dd398 bp 0x7fffa7320310 sp 0x7fffa7320308
WRITE of size 4 at 0x60200000eff0 thread T0

  #0 0x4dd397 in Func6(int, int*) /home/seurer/test/stack/crash.cpp:19:7
  #1 0x4dd4b6 in Func5(int, int*) /home/seurer/test/stack/crash.cpp:27:10
  #2 0x4dd666 in Func4(int, int*) /home/seurer/test/stack/crash.cpp:34:10
  #3 0x4dd816 in Func3(int, int*) /home/seurer/test/stack/crash.cpp:41:10
  #4 0x4dd9c6 in Func2(int, int*) /home/seurer/test/stack/crash.cpp:48:10
  #5 0x4ddb76 in Func1(int, int*) /home/seurer/test/stack/crash.cpp:55:10
  #6 0x4ddd43 in main /home/seurer/test/stack/crash.cpp:64:10
  #7 0x3af5a1ed5c in __libc_start_main (/lib64/libc.so.6+0x3af5a1ed5c)
  #8 0x41b324 in _start (/home/seurer/test/stack/crash-test+0x41b324)

0x60200000eff0 is located 0 bytes inside of 4-byte region [0x60200000eff0,0x60200000eff4)
freed by thread T0 here:

  #0 0x4daeb0 in operator delete(void*) /home/seurer/llvm/llvm-test/projects/compiler-rt/lib/asan/asan_new_delete.cc:94
  #1 0x4ddd07 in main /home/seurer/test/stack/crash.cpp:62:3
  #2 0x3af5a1ed5c in __libc_start_main (/lib64/libc.so.6+0x3af5a1ed5c)

previously allocated by thread T0 here:

  #0 0x4da8b0 in operator new(unsigned long) /home/seurer/llvm/llvm-test/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
  #1 0x4ddcd4 in main /home/seurer/test/stack/crash.cpp:60:8
  #2 0x3af5a1ed5c in __libc_start_main (/lib64/libc.so.6+0x3af5a1ed5c)


http://reviews.llvm.org/D9259

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list