Skip to content

[scudo] Fix the calculation of PushedBytesDelta #95177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

ChiaHungDuan
Copy link
Contributor

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.

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.
@llvmbot
Copy link
Member

llvmbot commented Jun 11, 2024

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

Author: None (ChiaHungDuan)

Changes

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 --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

Copy link
Contributor

@cferris1000 cferris1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ChiaHungDuan ChiaHungDuan merged commit cc04bbb into llvm:main Jun 11, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants