[compiler-rt] [scudo] Fix the calculation of PushedBytesDelta (PR #95177)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 14:48:53 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: None (ChiaHungDuan)

<details>
<summary>Changes</summary>

BytesInBG is always greater or equal to BG->BytesInBGAtLastCheckpoint.

Note that the bug led to unnecessary attempts of page releasing and doesn't have critical impact on the correctness.

---
Full diff: https://github.com/llvm/llvm-project/pull/95177.diff


1 Files Affected:

- (modified) compiler-rt/lib/scudo/standalone/primary64.h (+1-1) 


``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index bed2ccb8b992a..8a583bacb4a93 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1392,7 +1392,7 @@ template <typename Config> class SizeClassAllocator64 {
         continue;
       }
 
-      const uptr PushedBytesDelta = BG->BytesInBGAtLastCheckpoint - BytesInBG;
+      const uptr PushedBytesDelta = BytesInBG - BG->BytesInBGAtLastCheckpoint;
 
       // Given the randomness property, we try to release the pages only if the
       // bytes used by free blocks exceed certain proportion of group size. Note

``````````

</details>


https://github.com/llvm/llvm-project/pull/95177


More information about the llvm-commits mailing list