SHOW:
|
|
- or go back to the newest paste.
| 1 | #include "gwp_asan/guarded_pool_allocator.h" | |
| 2 | ||
| 3 | gwp_asan::GuardedPoolAllocator *GPA; | |
| 4 | extern "C" bool AsmDumpHelperFunc() {
| |
| 5 | return GPA->shouldSample(); | |
| 6 | } | |
| 7 | ======================================================================================= | |
| 8 | // Return whether the allocation should be randomly chosen for sampling. | |
| 9 | ALWAYS_INLINE bool shouldSample() {
| |
| 10 | // NextSampleCounter == 0 means we "should regenerate the counter". | |
| 11 | // == 1 means we "should sample this allocation". | |
| 12 | if (UNLIKELY(NextSampleCounter == 0)) | |
| 13 | NextSampleCounter = | |
| 14 | (random::getRandomUnsigned64() % AdjustedSampleRate) + 1; | |
| 15 | ||
| 16 | // GuardedPagePool != 0 if GWP-ASan is enabled. | |
| 17 | return UNLIKELY(NextSampleCounter-- == 1) && LIKELY(GuardedPagePool != 0); | |
| 18 | } | |
| 19 | ======================================================================================= | |
| 20 | 0000000000000000 <AsmDumpHelperFunc>: | |
| 21 | AsmDumpHelperFunc(): | |
| 22 | //llvm/compiler-rt/lib/gwp_asan/shouldsample_donotsubmit.cpp:4 | |
| 23 | #include "gwp_asan/guarded_pool_allocator.h" | |
| 24 | ||
| 25 | gwp_asan::GuardedPoolAllocator *GPA; | |
| 26 | extern "C" bool AsmDumpHelperFunc() {
| |
| 27 | 0: 41 57 push %r15 | |
| 28 | 2: 41 56 push %r14 | |
| 29 | 4: 53 push %rbx | |
| 30 | //llvm/compiler-rt/lib/gwp_asan/shouldsample_donotsubmit.cpp:5 | |
| 31 | return GPA->shouldSample(); | |
| 32 | 5: 48 8b 05 00 00 00 00 mov 0x0(%rip),%rax # c <AsmDumpHelperFunc+0xc> | |
| 33 | c: 4c 8b 30 mov (%rax),%r14 | |
| 34 | //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:100 | |
| 35 | ||
| 36 | // Return whether the allocation should be randomly chosen for sampling. | |
| 37 | ALWAYS_INLINE bool shouldSample() {
| |
| 38 | // NextSampleCounter == 0 means we "should regenerate the counter". | |
| 39 | // == 1 means we "should sample this allocation". | |
| 40 | if (UNLIKELY(NextSampleCounter == 0)) | |
| 41 | f: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 17 <AsmDumpHelperFunc+0x17> | |
| 42 | 16: 00 | |
| 43 | 17: 74 05 je 1e <AsmDumpHelperFunc+0x1e> | |
| 44 | 19: e8 00 00 00 00 callq 1e <AsmDumpHelperFunc+0x1e> | |
| 45 | 1e: 4c 8b 3d 00 00 00 00 mov 0x0(%rip),%r15 # 25 <AsmDumpHelperFunc+0x25> | |
| 46 | 25: 64 49 8b 1f mov %fs:(%r15),%rbx | |
| 47 | 29: 48 85 db test %rbx,%rbx | |
| 48 | 2c: 74 29 je 57 <AsmDumpHelperFunc+0x57> | |
| 49 | //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:105 | |
| 50 | NextSampleCounter = | |
| 51 | (random::getRandomUnsigned64() % AdjustedSampleRate) + 1; | |
| 52 | ||
| 53 | // GuardedPagePool != 0 if GWP-ASan is enabled. | |
| 54 | return UNLIKELY(NextSampleCounter-- == 1) && LIKELY(GuardedPagePool != 0); | |
| 55 | 2e: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 36 <AsmDumpHelperFunc+0x36> | |
| 56 | 35: 00 | |
| 57 | 36: 74 09 je 41 <AsmDumpHelperFunc+0x41> | |
| 58 | 38: e8 00 00 00 00 callq 3d <AsmDumpHelperFunc+0x3d> | |
| 59 | 3d: 64 49 8b 1f mov %fs:(%r15),%rbx | |
| 60 | 41: 48 8d 43 ff lea -0x1(%rbx),%rax | |
| 61 | 45: 64 49 89 07 mov %rax,%fs:(%r15) | |
| 62 | 49: 48 83 fb 01 cmp $0x1,%rbx | |
| 63 | 4d: 74 39 je 88 <AsmDumpHelperFunc+0x88> | |
| 64 | 4f: 31 c0 xor %eax,%eax | |
| 65 | //llvm/compiler-rt/lib/gwp_asan/shouldsample_donotsubmit.cpp:5 | |
| 66 | 51: 5b pop %rbx | |
| 67 | 52: 41 5e pop %r14 | |
| 68 | 54: 41 5f pop %r15 | |
| 69 | 56: c3 retq | |
| 70 | //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:102 | |
| 71 | (random::getRandomUnsigned64() % AdjustedSampleRate) + 1; | |
| 72 | 57: e8 00 00 00 00 callq 5c <AsmDumpHelperFunc+0x5c> | |
| 73 | 5c: 31 d2 xor %edx,%edx | |
| 74 | 5e: 49 f7 76 58 divq 0x58(%r14) | |
| 75 | 62: 48 89 d3 mov %rdx,%rbx | |
| 76 | 65: 48 83 c3 01 add $0x1,%rbx | |
| 77 | //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:101 | |
| 78 | NextSampleCounter = | |
| 79 | 69: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 71 <AsmDumpHelperFunc+0x71> | |
| 80 | 70: 00 | |
| 81 | 71: 74 05 je 78 <AsmDumpHelperFunc+0x78> | |
| 82 | 73: e8 00 00 00 00 callq 78 <AsmDumpHelperFunc+0x78> | |
| 83 | 78: 64 49 89 1f mov %rbx,%fs:(%r15) | |
| 84 | //llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:105 | |
| 85 | return UNLIKELY(NextSampleCounter-- == 1) && LIKELY(GuardedPagePool != 0); | |
| 86 | 7c: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 84 <AsmDumpHelperFunc+0x84> | |
| 87 | 83: 00 | |
| 88 | 84: 75 b2 jne 38 <AsmDumpHelperFunc+0x38> | |
| 89 | 86: eb b9 jmp 41 <AsmDumpHelperFunc+0x41> | |
| 90 | 88: 49 83 7e 20 00 cmpq $0x0,0x20(%r14) | |
| 91 | 8d: 0f 95 c0 setne %al | |
| 92 | 90: eb bf jmp 51 <AsmDumpHelperFunc+0x51> |