-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[scudo] Fix the logic of MaxAllowedFragmentedPages #107927
Conversation
MTE doesn't support MaxReleasedCachePages which may break the assumption that only the first 4 pages will have memory tagged.
@llvm/pr-subscribers-compiler-rt-sanitizer Author: None (ChiaHungDuan) ChangesMTE doesn't support MaxReleasedCachePages which may break the assumption that only the first 4 pages will have memory tagged. Full diff: https://github.com/llvm/llvm-project/pull/107927.diff 1 Files Affected:
diff --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index 1a232b9b9fb2d7..7d85832d7fe714 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -725,7 +725,7 @@ MapAllocator<Config>::tryAllocateFromCache(const Options &Options, uptr Size,
uptr EntryHeaderPos;
uptr MaxAllowedFragmentedPages = MaxUnreleasedCachePages;
- if (UNLIKELY(useMemoryTagging<Config>(Options)))
+ if (LIKELY(!useMemoryTagging<Config>(Options)))
MaxAllowedFragmentedPages += CachedBlock::MaxReleasedCachePages;
Entry = Cache.retrieve(MaxAllowedFragmentedPages, Size, Alignment,
|
I'm running some tests to confirm the issue has been fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
5f6a5b3
to
6e3a54a
Compare
I updated the CL with some comments about how it causes problem for MTE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supremely minor nit.
// is dependent on the platform. | ||
// We allow a certain amount of fragmentation and part of the fragmented bytes | ||
// will be released by `releaseAndZeroPagesToOS()`. This increases the chance | ||
// of cache hit rate and reduce the overhead to the RSS at the same time. See |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reduces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/139/builds/3565 Here is the relevant piece of the build log for the reference
|
This reverts commit 6e854a6.
Reverts #107927 We are supposed to check the MaxAllowedFragmentedPages instead.
Reverts llvm/llvm-project#107927 We are supposed to check the MaxAllowedFragmentedPages instead. GitOrigin-RevId: 76151c449080b7239c8b442291514a4300d51cba Change-Id: I16cbbbb22576eb47bf2b7aa30156ac17425308da
MTE doesn't support MaxReleasedCachePages which may break the assumption that only the first 4 pages will have memory tagged.
) Reverts llvm#107927 We are supposed to check the MaxAllowedFragmentedPages instead.
…FragmentedPages" (#108130) Reverts llvm/llvm-project#107927 We are supposed to check the MaxAllowedFragmentedPages instead. GitOrigin-RevId: 8c10827543c8e11689cef95c6e3d3378482887c2 Original-Revision: c682eaae1d2ca9d8e00604ee2712da6d01ff821d Roller-URL: https://ci.chromium.org/b/8737117427431755313 CQ-Do-Not-Cancel-Tryjobs: true Change-Id: I4bcb52dffad477f6cdc1415fa658da6646b673be Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1116349
…edPages" (#108130) Reverts llvm/llvm-project#107927 We are supposed to check the MaxAllowedFragmentedPages instead. GitOrigin-RevId: 8c10827543c8e11689cef95c6e3d3378482887c2 Original-Revision: c682eaae1d2ca9d8e00604ee2712da6d01ff821d Change-Id: I3edf550c4622ad9aabd159ab9e032d12f3052bf4
… logic of MaxAllowedFragmentedPages" (#108130) Reverts llvm/llvm-project#107927 We are supposed to check the MaxAllowedFragmentedPages instead. GitOrigin-RevId: 4f5f037eb0225da54cb4de75e1382a653e9d1c54 Original-Revision: c682eaae1d2ca9d8e00604ee2712da6d01ff821d Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1116349 Original-Revision: b1e8b615193f7d7a91e62963dc7a31128a10b103 Change-Id: Iffd2ddb6324b23914467ab1e2564b3e8ffd1effe
MTE doesn't support MaxReleasedCachePages which may break the assumption that only the first 4 pages will have memory tagged.