[compiler-rt] 6194992 - [Scudo] enabling anonymous named pages on Linux 5.17 and onwards.
David Carlier via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 01:47:14 PDT 2022
Author: David Carlier
Date: 2022-04-05T09:46:02+01:00
New Revision: 619499252307c520fd840a5f3c79ffa00eaf2264
URL: https://github.com/llvm/llvm-project/commit/619499252307c520fd840a5f3c79ffa00eaf2264
DIFF: https://github.com/llvm/llvm-project/commit/619499252307c520fd840a5f3c79ffa00eaf2264.diff
LOG: [Scudo] enabling anonymous named pages on Linux 5.17 and onwards.
Reviewers: vitalybuka
Reviewed-By: vitalybuka
Differential Revision: https://reviews.llvm.org/D122962
Added:
Modified:
compiler-rt/lib/scudo/standalone/linux.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/linux.cpp b/compiler-rt/lib/scudo/standalone/linux.cpp
index c77c1bb600d93..88875c54a3495 100644
--- a/compiler-rt/lib/scudo/standalone/linux.cpp
+++ b/compiler-rt/lib/scudo/standalone/linux.cpp
@@ -28,11 +28,11 @@
#include <time.h>
#include <unistd.h>
-#if SCUDO_ANDROID
#include <sys/prctl.h>
-// Definitions of prctl arguments to set a vma name in Android kernels.
-#define ANDROID_PR_SET_VMA 0x53564d41
-#define ANDROID_PR_SET_VMA_ANON_NAME 0
+// Definitions of prctl arguments to set a vma name in kernels (Linux from 5.17).
+#ifndef PR_SET_VMA
+#define PR_SET_VMA 0x53564d41
+#define PR_SET_VMA_ANON_NAME 0
#endif
namespace scudo {
@@ -66,10 +66,8 @@ void *map(void *Addr, uptr Size, UNUSED const char *Name, uptr Flags,
dieOnMapUnmapError(errno == ENOMEM ? Size : 0);
return nullptr;
}
-#if SCUDO_ANDROID
if (Name)
- prctl(ANDROID_PR_SET_VMA, ANDROID_PR_SET_VMA_ANON_NAME, P, Size, Name);
-#endif
+ prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, P, Size, Name);
return P;
}
More information about the llvm-commits
mailing list