[PATCH] D144830: [asan darwin] Allow clients to implement `__sanitizer_report_error_summary`

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 11:19:52 PST 2023


yln added a comment.

Taking a step back, please check my understanding:

In `VerifyInterceptorsWorking()` we want to check that interceptors are setup correctly by making sure that the `dlsym("puts")+dladdr()` lookup for a function that we know is intercepted actually returns it's interceptor (`wrap_puts()`).
For the second part, we don't actually check the exact interceptor function but rather that the interceptor is defined in our own sanitizer runtime image.  We lookup our own image by using `dladdr()` on a function that we define, but can't be overridden by the user (current bug that we are fixing here didn't consider this and we chose a function that actually can be overridden by the user program).

So if we keep using this approach, we want to find a function that is:

- Defined in the sanitizer runtime
- Not overridable
- Can be looked up via `dladdr()` (Can you find out and explain here what exactly the rules around this are? Does the function need to be exported?)

It sounds like an easy, stable solution would be to define a dummy function like `__sanitizer_common_module_lookup_dummy()` that fulfills all the requirements and just use that instead of picking a "random", already existing function.

Also, I am not sure why we do the detour to go to the image and then compare image names.  Maybe it's worth exploring if we can do something more direct, e.g., something in the spirit of `dlsym("puts") == &wrap_puts`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144830



More information about the llvm-commits mailing list