[PATCH] D62875: [GWP-ASan] Add public-facing documentation [6].

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 14:48:03 PDT 2019


kcc added a comment.

Maybe add an example? 
something like my favorite

  #include <iostream>
  #include <string>
  #include <string_view>
  
  int main() {
    std::string s = "Hellooooooooooooooo ";
    std::string_view sv = s + "World\n";
    std::cout << sv;
  }
  
  
  for((i=0;i<10000; i++)); do GWP_ASAN_OPTIONS=Enabled=1:SampleRate=500  ./a.out > /dev/null; done
  
  Segmentation fault
  *** GWP-ASan detected a memory error ***
  Use after free at 0x7f43300df000 (0 bytes into a 41-byte allocation at 0x7f43300df000) by thread 26228 here:
  #0 ./a.out(_ZN8gwp_asan20GuardedPoolAllocator19reportErrorInternalEmNS0_5ErrorE+0x25a) [0x56454249ecea]
  #1 ./a.out(+0x1bede) [0x56454249dede]
  #2 /lib/x86_64-linux-gnu/libpthread.so.0(+0x123a0) [0x7ffbb526f3a0]
  #3 /lib/x86_64-linux-gnu/libc.so.6(+0x15c27e) [0x7ffbb49d627e]
  #4 /lib/x86_64-linux-gnu/libc.so.6(_IO_default_xsputn+0xa8) [0x7ffbb48f7058]
  #5 /lib/x86_64-linux-gnu/libc.so.6(_IO_file_xsputn+0x151) [0x7ffbb48f52b1]
  #6 /lib/x86_64-linux-gnu/libc.so.6(fwrite+0xd8) [0x7ffbb48ea1f8]
  #7 /lib/x86_64-linux-gnu/libstdc++.so.6(_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l+0x124) [0x7ffbb590d3a4]
  #8 ./a.out(_ZStlsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_St17basic_string_viewIS3_S4_E+0x45) [0x5645424b3bc5]
  #9 ./a.out(main+0x9f) [0x5645424b393f]

Also, please provide some guidance about symbolizing the reports.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62875/new/

https://reviews.llvm.org/D62875





More information about the llvm-commits mailing list