Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "gwp_asan/guarded_pool_allocator.h"
- gwp_asan::GuardedPoolAllocator *GPA;
- extern "C" bool AsmDumpHelperFunc() {
- return GPA->shouldSample();
- }
- =======================================================================================
- // 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)) {
- // GuardedPagePool != 0 if GWP-ASan is enabled.
- if (UNLIKELY(GuardedPagePool == 0))
- return false;
- NextSampleCounter =
- (random::getRandomUnsigned64() % AdjustedSampleRate) + 1;
- }
- return UNLIKELY(NextSampleCounter-- == 1);
- }
- =======================================================================================
- 0000000000000000 <AsmDumpHelperFunc>:
- AsmDumpHelperFunc():
- /usr/local/google/home/mitchp/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 56 push %r14
- 2: 53 push %rbx
- 3: 50 push %rax
- /usr/local/google/home/mitchp/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)) {
- 4: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # c <AsmDumpHelperFunc+0xc>
- b: 00
- c: 74 05 je 13 <AsmDumpHelperFunc+0x13>
- e: e8 00 00 00 00 callq 13 <AsmDumpHelperFunc+0x13>
- 13: 4c 8b 35 00 00 00 00 mov 0x0(%rip),%r14 # 1a <AsmDumpHelperFunc+0x1a>
- 1a: 64 49 8b 1e mov %fs:(%r14),%rbx
- 1e: 48 85 db test %rbx,%rbx
- 21: 74 2a je 4d <AsmDumpHelperFunc+0x4d>
- /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:108
- return false;
- NextSampleCounter =
- (random::getRandomUnsigned64() % AdjustedSampleRate) + 1;
- }
- return UNLIKELY(NextSampleCounter-- == 1);
- 23: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 2b <AsmDumpHelperFunc+0x2b>
- 2a: 00
- 2b: 74 09 je 36 <AsmDumpHelperFunc+0x36>
- 2d: e8 00 00 00 00 callq 32 <AsmDumpHelperFunc+0x32>
- 32: 64 49 8b 1e mov %fs:(%r14),%rbx
- 36: 48 8d 43 ff lea -0x1(%rbx),%rax
- 3a: 64 49 89 06 mov %rax,%fs:(%r14)
- 3e: 48 83 fb 01 cmp $0x1,%rbx
- 42: 0f 94 c0 sete %al
- /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/shouldsample_donotsubmit.cpp:5
- return GPA.shouldSample();
- 45: 48 83 c4 08 add $0x8,%rsp
- 49: 5b pop %rbx
- 4a: 41 5e pop %r14
- 4c: c3 retq
- /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:102
- if (UNLIKELY(GuardedPagePool == 0))
- 4d: 48 8b 1d 00 00 00 00 mov 0x0(%rip),%rbx # 54 <AsmDumpHelperFunc+0x54>
- 54: 48 83 7b 20 00 cmpq $0x0,0x20(%rbx)
- 59: 74 31 je 8c <AsmDumpHelperFunc+0x8c>
- /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:105
- (random::getRandomUnsigned64() % AdjustedSampleRate) + 1;
- 5b: e8 00 00 00 00 callq 60 <AsmDumpHelperFunc+0x60>
- 60: 31 d2 xor %edx,%edx
- 62: 48 f7 73 58 divq 0x58(%rbx)
- 66: 48 89 d3 mov %rdx,%rbx
- 69: 48 83 c3 01 add $0x1,%rbx
- /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:104
- NextSampleCounter =
- 6d: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 75 <AsmDumpHelperFunc+0x75>
- 74: 00
- 75: 74 05 je 7c <AsmDumpHelperFunc+0x7c>
- 77: e8 00 00 00 00 callq 7c <AsmDumpHelperFunc+0x7c>
- 7c: 64 49 89 1e mov %rbx,%fs:(%r14)
- /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:108
- return UNLIKELY(NextSampleCounter-- == 1);
- 80: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 88 <AsmDumpHelperFunc+0x88>
- 87: 00
- 88: 75 a3 jne 2d <AsmDumpHelperFunc+0x2d>
- 8a: eb aa jmp 36 <AsmDumpHelperFunc+0x36>
- 8c: 31 c0 xor %eax,%eax
- 8e: eb b5 jmp 45 <AsmDumpHelperFunc+0x45>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement