Advertisement
Guest User

Old

a guest
May 7th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. // GuardedPagePool != 0 if GWP-ASan is enabled.
  14. if (UNLIKELY(GuardedPagePool == 0))
  15. return false;
  16. NextSampleCounter =
  17. (random::getRandomUnsigned64() % AdjustedSampleRate) + 1;
  18. }
  19.  
  20. return UNLIKELY(NextSampleCounter-- == 1);
  21. }
  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.  
  28. gwp_asan::GuardedPoolAllocator GPA;
  29. extern "C" bool AsmDumpHelperFunc() {
  30. 0: 41 56 push %r14
  31. 2: 53 push %rbx
  32. 3: 50 push %rax
  33. /usr/local/google/home/mitchp/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. 4: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # c <AsmDumpHelperFunc+0xc>
  41. b: 00
  42. c: 74 05 je 13 <AsmDumpHelperFunc+0x13>
  43. e: e8 00 00 00 00 callq 13 <AsmDumpHelperFunc+0x13>
  44. 13: 4c 8b 35 00 00 00 00 mov 0x0(%rip),%r14 # 1a <AsmDumpHelperFunc+0x1a>
  45. 1a: 64 49 8b 1e mov %fs:(%r14),%rbx
  46. 1e: 48 85 db test %rbx,%rbx
  47. 21: 74 2a je 4d <AsmDumpHelperFunc+0x4d>
  48. /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:108
  49. return false;
  50. NextSampleCounter =
  51. (random::getRandomUnsigned64() % AdjustedSampleRate) + 1;
  52. }
  53.  
  54. return UNLIKELY(NextSampleCounter-- == 1);
  55. 23: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 2b <AsmDumpHelperFunc+0x2b>
  56. 2a: 00
  57. 2b: 74 09 je 36 <AsmDumpHelperFunc+0x36>
  58. 2d: e8 00 00 00 00 callq 32 <AsmDumpHelperFunc+0x32>
  59. 32: 64 49 8b 1e mov %fs:(%r14),%rbx
  60. 36: 48 8d 43 ff lea -0x1(%rbx),%rax
  61. 3a: 64 49 89 06 mov %rax,%fs:(%r14)
  62. 3e: 48 83 fb 01 cmp $0x1,%rbx
  63. 42: 0f 94 c0 sete %al
  64. /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/shouldsample_donotsubmit.cpp:5
  65. return GPA.shouldSample();
  66. 45: 48 83 c4 08 add $0x8,%rsp
  67. 49: 5b pop %rbx
  68. 4a: 41 5e pop %r14
  69. 4c: c3 retq
  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. 4d: 48 8b 1d 00 00 00 00 mov 0x0(%rip),%rbx # 54 <AsmDumpHelperFunc+0x54>
  73. 54: 48 83 7b 20 00 cmpq $0x0,0x20(%rbx)
  74. 59: 74 31 je 8c <AsmDumpHelperFunc+0x8c>
  75. /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:105
  76. (random::getRandomUnsigned64() % AdjustedSampleRate) + 1;
  77. 5b: e8 00 00 00 00 callq 60 <AsmDumpHelperFunc+0x60>
  78. 60: 31 d2 xor %edx,%edx
  79. 62: 48 f7 73 58 divq 0x58(%rbx)
  80. 66: 48 89 d3 mov %rdx,%rbx
  81. 69: 48 83 c3 01 add $0x1,%rbx
  82. /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:104
  83. NextSampleCounter =
  84. 6d: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 75 <AsmDumpHelperFunc+0x75>
  85. 74: 00
  86. 75: 74 05 je 7c <AsmDumpHelperFunc+0x7c>
  87. 77: e8 00 00 00 00 callq 7c <AsmDumpHelperFunc+0x7c>
  88. 7c: 64 49 89 1e mov %rbx,%fs:(%r14)
  89. /usr/local/google/home/mitchp/llvm/compiler-rt/lib/gwp_asan/../gwp_asan/guarded_pool_allocator.h:108
  90. return UNLIKELY(NextSampleCounter-- == 1);
  91. 80: 48 83 3d 00 00 00 00 cmpq $0x0,0x0(%rip) # 88 <AsmDumpHelperFunc+0x88>
  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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement