-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[compiler-rt] fix BSD procmaps stack size limit on build due to the k… #82887
[compiler-rt] fix BSD procmaps stack size limit on build due to the k… #82887
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: David CARLIER (devnexen) Changes…info_proc type. Full diff: https://github.com/llvm/llvm-project/pull/82887.diff 1 Files Affected:
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp
index dcfd94fe3225cd..3649bfd1b25b12 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp
@@ -37,10 +37,13 @@ void GetMemoryProfile(fill_profile_f cb, uptr *stats) {
getpid()
};
- struct kinfo_proc InfoProc;
- uptr Len = sizeof(InfoProc);
- CHECK_EQ(internal_sysctl(Mib, ARRAY_SIZE(Mib), nullptr, (uptr *)&InfoProc, &Len, 0), 0);
- cb(0, InfoProc.ki_rssize * GetPageSizeCached(), false, stats);
+ struct kinfo_proc *InfoProc;
+ uptr Len = sizeof(*InfoProc);
+ uptr Size = Len;
+ InfoProc = (struct kinfo_proc *)MmapOrDie(Size, "GetMemoryProfile()");
+ CHECK_EQ(internal_sysctl(Mib, ARRAY_SIZE(Mib), nullptr, (uptr *)InfoProc, &Len, 0), 0);
+ cb(0, InfoProc->ki_rssize * GetPageSizeCached(), false, stats);
+ UnmapOrDie(InfoProc, Size, true);
}
#endif
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
eb459b6
to
c0f2c50
Compare
@@ -30,17 +30,17 @@ namespace __sanitizer { | |||
|
|||
#if SANITIZER_FREEBSD | |||
void GetMemoryProfile(fill_profile_f cb, uptr *stats) { |
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.
stack size of stack frame size limit?
if the latter, maybe noinline on the function is better fix?
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.
if you meant adding NOINLINE
it fixes nothing.
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.
would it be possible fixup title to avoid line break?
How bit this struct? Or what is error message?
I would prefer RAII with InternalScopedVector<kinfo_proc> of size 1
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.
would it be possible fixup title to avoid line break?
How bit this struct? Or what is error message?
1088 :)
c0f2c50
to
31119c3
Compare
…info_proc type.