summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2022-04-19 01:56:14 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-19 01:56:14 +0000
commit7b07ca14fd4b2d976962d9086bb3265e673d7db7 (patch)
tree3450454b823d833dbc2cee1cc714a1594300892c
parent26a8c2d3471811d00507f601293956732ab09147 (diff)
parentb7f52c781942b73ac3df3b09dbde919e44cd05ef (diff)
downloadscudo-7b07ca14fd4b2d976962d9086bb3265e673d7db7.tar.gz
[Scudo] enabling anonymous named pages on Linux 5.17 and onwards. am: c99d25c11a am: ba52cb5949 am: 88367a3ef7 am: 3a2b07a7d4 am: b7f52c7819
Original change: https://android-review.googlesource.com/c/platform/external/scudo/+/2063223 Change-Id: I043b133a0f4bd4b55df2d4ce32e2648280a211cc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--standalone/linux.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/standalone/linux.cpp b/standalone/linux.cpp
index c77c1bb600d..88875c54a34 100644
--- a/standalone/linux.cpp
+++ b/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;
}