summaryrefslogtreecommitdiffstats
path: root/libmemunreachable
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-08-22 12:06:20 -0700
committerElliott Hughes <enh@google.com>2018-08-22 12:06:20 -0700
commit95c34a72af2c34c75710f6d109d006ad19603e39 (patch)
treecd0d4673e1ebd2e39fddb02fe904c816d408e707 /libmemunreachable
parent56d079b40a4978c3bc929c9d9513119c62d0de1c (diff)
downloadsystem_core-95c34a72af2c34c75710f6d109d006ad19603e39.tar.gz
system_core-95c34a72af2c34c75710f6d109d006ad19603e39.tar.bz2
system_core-95c34a72af2c34c75710f6d109d006ad19603e39.zip
bionic supplies PR_SET_VMA now.
Bug: N/A Test: builds Change-Id: I8254711543cbf11bdf905ea441655ca1c1e82aac
Diffstat (limited to 'libmemunreachable')
-rw-r--r--libmemunreachable/Allocator.cpp6
-rw-r--r--libmemunreachable/PtracerThread.cpp2
-rw-r--r--libmemunreachable/anon_vma_naming.h25
3 files changed, 4 insertions, 29 deletions
diff --git a/libmemunreachable/Allocator.cpp b/libmemunreachable/Allocator.cpp
index 213be1733..1eb7e98c5 100644
--- a/libmemunreachable/Allocator.cpp
+++ b/libmemunreachable/Allocator.cpp
@@ -24,6 +24,7 @@
#include <sys/cdefs.h>
#include <sys/mman.h>
+#include <sys/prctl.h>
#include <cmath>
#include <cstddef>
@@ -35,7 +36,6 @@
#include "Allocator.h"
#include "LinkedList.h"
-#include "anon_vma_naming.h"
namespace android {
@@ -153,10 +153,10 @@ static void* MapAligned(size_t size, size_t align) {
munmap(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(ptr) + size), map_size - size);
}
-#define PR_SET_VMA 0x53564d41
-#define PR_SET_VMA_ANON_NAME 0
+#if defined(PR_SET_VMA)
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, reinterpret_cast<uintptr_t>(ptr), size,
"leak_detector_malloc");
+#endif
return ptr;
}
diff --git a/libmemunreachable/PtracerThread.cpp b/libmemunreachable/PtracerThread.cpp
index 61a1d240c..d2fca49f2 100644
--- a/libmemunreachable/PtracerThread.cpp
+++ b/libmemunreachable/PtracerThread.cpp
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
+#include <sys/prctl.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -32,7 +33,6 @@
#include "android-base/macros.h"
#include "PtracerThread.h"
-#include "anon_vma_naming.h"
#include "log.h"
namespace android {
diff --git a/libmemunreachable/anon_vma_naming.h b/libmemunreachable/anon_vma_naming.h
deleted file mode 100644
index fb31e4175..000000000
--- a/libmemunreachable/anon_vma_naming.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_
-#define LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_
-
-#include <sys/prctl.h>
-
-#define PR_SET_VMA 0x53564d41
-#define PR_SET_VMA_ANON_NAME 0
-
-#endif // LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_