[PATCH] D59504: [NFC][Sanitizer] Clean up GetRealFunctionAddress
    Julian Lettner via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Apr 24 19:09:28 PDT 2019
    
    
  
yln added a comment.
>   #define ASAN_INTERCEPT_FUNC(name)                                        \
>     do {                                                                   \
>       if ((!INTERCEPT_FUNCTION(name) || !REAL(name)))                      \
>         VReport(1, "AddressSanitizer: failed to intercept '" #name "'\n"); \
>     } while (0)
> 
> 
> I understand that as weird protection against double intercept
Very weird indeed.
  // returns true if a function with the given name was found.
  bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, uptr real, uptr wrapper) {
    // ...
    return real == wrapper;
  }
Usage:
  #define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)                          \
    ::__interception::GetRealFunctionAddress(                                \
        #func, (::__interception::uptr *)&__interception::PTR_TO_REAL(func), \
        (::__interception::uptr) & (func),                                   \
        (::__interception::uptr) & WRAP(func))
That it means it evaluates to  `& (func) == & WRAP(func)`.
I will do what you suggested and break it down into smaller parts.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59504/new/
https://reviews.llvm.org/D59504
    
    
More information about the llvm-commits
mailing list