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