[PATCH] D45838: [sanitizer] More dead code removal

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 20 09:10:51 PDT 2018


cryptoad added a comment.

In https://reviews.llvm.org/D45838#1073197, @dvyukov wrote:

> I am not following. Isn't it a test for prctl interceptor? Why are we removing useful tests?
>  Perhaps it's not the most critical functionality. And perhaps SanitizerSetThreadName needs to be moved to the test itself. But still it's a test.


Here is my understanding, please let me know if I am wrong:

- Unless mistaken, sanitizer_common_test.cc doesn't involve interceptors, just the tests for the common functions.
- Sanitizer{S,G}etThreadName use prctl and not internal_prctl which might cause problems if they were to be used with interceptors.
- The test removed only tests that actual prctl PR_{G,S}ET_NAME behaves somewhat appropriately, which is probably not that useful.

I tried to verify all this and ran the test manually with a breakpoint on libc's prctl:

  [ RUN      ] SanitizerCommon.SanitizerSetThreadName
  
  Breakpoint 1, 0x00007ffff6c592c0 in prctl () from /lib/x86_64-linux-gnu/libc.so.6
  (gdb) bt
  #0  0x00007ffff6c592c0 in prctl () from /lib/x86_64-linux-gnu/libc.so.6
  #1  0x000000000054fbd7 in __sanitizer::SanitizerSetThreadName(char const*) () at sanitizer_linux_libcdep.cc:167
  #2  0x0000000000495db4 in TestBody () at sanitizer_common_test.cc:100

I think TryToSetThreadName in asan_test.cc leverages an intercepted prctl for this purpose.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D45838





More information about the llvm-commits mailing list