This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Change secondary StatsAllocated update
ClosedPublic

Authored by cferris on May 8 2023, 7:14 PM.

Details

Summary

In the secondary allocation routine, the StatsAllocated stat is
increased by BlockSize. However, in the deallocate routine, the
stat subtract uses CommitSize. CommitSize can be bigger than BlockSize
so this can lead to a negative calculated stat. Since the stats
are not guaranteed to be completely accurate, just add CommitSize
during allocation.

Diff Detail

Event Timeline

cferris created this revision.May 8 2023, 7:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2023, 7:14 PM
Herald added subscribers: yaneury, Enna1. · View Herald Transcript
cferris requested review of this revision.May 8 2023, 7:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2023, 7:14 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
Chia-hungDuan added inline comments.May 9 2023, 10:29 AM
compiler-rt/lib/scudo/standalone/secondary.h
528

Nice catch! I think we may also want to update this to H->CommitSize.

cferris updated this revision to Diff 520841.May 9 2023, 3:18 PM

Removed the BlockSize parameter and change all references to it
to H->CommitSize.

cferris marked an inline comment as done.May 9 2023, 3:19 PM
cferris added inline comments.
compiler-rt/lib/scudo/standalone/secondary.h
528

Did this and removed the comment since it doesn't make sense any more.

Chia-hungDuan accepted this revision.May 9 2023, 3:19 PM
This revision is now accepted and ready to land.May 9 2023, 3:19 PM
This revision was automatically updated to reflect the committed changes.
cferris marked an inline comment as done.