#include "gwp_asan/guarded_pool_allocator.h" gwp_asan::GuardedPoolAllocator *GPA; extern "C" bool AsmDumpHelperFunc() { return GPA->shouldSample(); } ======================================================================================= ======================================================================================= 0000000000000000 : AsmDumpHelperFunc(): //llvm/compiler-rt/lib/gwp_asan/shouldsample_donotsubmit.cpp:4 #include "gwp_asan/guarded_pool_allocator.h" gwp_asan::GuardedPoolAllocator *GPA; extern "C" bool AsmDumpHelperFunc() { 0: 41 57 push %r15 2: 41 56 push %r14 4: 53 push %rbx //llvm/compiler-rt/lib/gwp_asan/shouldsample_donotsubmit.cpp:5 return GPA->shouldSample(); 5: 48 8b 05 00 00 00 00 mov 0x0(%rip),%rax # c c: 4c 8b 30 mov (%rax),%r14 //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:100 // Return whether the allocation should be randomly chosen for sampling. ALWAYS_INLINE bool shouldSample() { // NextSampleCounter == 0 means we "should regenerate the counter". // == 1 means we "should sample this allocation". if (UNLIKELY(NextSampleCounter == 0)) f: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 17 16: 00 17: 74 05 je 1e 19: e8 00 00 00 00 callq 1e 1e: 4c 8b 3d 00 00 00 00 mov 0x0(%rip),%r15 # 25 25: 64 49 8b 1f mov %fs:(%r15),%rbx 29: 48 85 db test %rbx,%rbx 2c: 74 29 je 57 //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:105 NextSampleCounter = (random::getRandomUnsigned64() % AdjustedSampleRate) + 1; // GuardedPagePool != 0 if GWP-ASan is enabled. return UNLIKELY(NextSampleCounter-- == 1) && LIKELY(GuardedPagePool != 0); 2e: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 36 35: 00 36: 74 09 je 41 38: e8 00 00 00 00 callq 3d 3d: 64 49 8b 1f mov %fs:(%r15),%rbx 41: 48 8d 43 ff lea -0x1(%rbx),%rax 45: 64 49 89 07 mov %rax,%fs:(%r15) 49: 48 83 fb 01 cmp $0x1,%rbx 4d: 74 39 je 88 4f: 31 c0 xor %eax,%eax //llvm/compiler-rt/lib/gwp_asan/shouldsample_donotsubmit.cpp:5 51: 5b pop %rbx 52: 41 5e pop %r14 54: 41 5f pop %r15 56: c3 retq //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:102 (random::getRandomUnsigned64() % AdjustedSampleRate) + 1; 57: e8 00 00 00 00 callq 5c 5c: 31 d2 xor %edx,%edx 5e: 49 f7 76 58 divq 0x58(%r14) 62: 48 89 d3 mov %rdx,%rbx 65: 48 83 c3 01 add $0x1,%rbx //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:101 NextSampleCounter = 69: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 71 70: 00 71: 74 05 je 78 73: e8 00 00 00 00 callq 78 78: 64 49 89 1f mov %rbx,%fs:(%r15) //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:105 return UNLIKELY(NextSampleCounter-- == 1) && LIKELY(GuardedPagePool != 0); 7c: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 84 83: 00 84: 75 b2 jne 38 86: eb b9 jmp 41 88: 49 83 7e 20 00 cmpq $0x0,0x20(%r14) 8d: 0f 95 c0 setne %al 90: eb bf jmp 51