Make "disable memory mitigations" and "set heap tagging level" more available.
These were only available internally via android_mallopt(), but they're
likely to be needed by more code in future, so move them into mallopt().
This change leaves the android_mallopt() options for now, but I plan on
coming back to remove them after I've switched the handful of callers
over to mallopt() instead.
Bug: http://b/135772972
Test: treehugger
Change-Id: Ia154614069a7623c6aca85975a91e6a156f04759
diff --git a/libc/platform/bionic/malloc.h b/libc/platform/bionic/malloc.h
index 56badf0..313cbdf 100644
--- a/libc/platform/bionic/malloc.h
+++ b/libc/platform/bionic/malloc.h
@@ -28,6 +28,7 @@
#pragma once
+#include <malloc.h>
#include <stdbool.h>
#include <stdint.h>
@@ -114,21 +115,6 @@
#define M_DISABLE_MEMORY_MITIGATIONS M_DISABLE_MEMORY_MITIGATIONS
};
-enum HeapTaggingLevel {
- // Disable heap tagging and memory tag checks if supported. Heap tagging may not be re-enabled
- // after being disabled.
- M_HEAP_TAGGING_LEVEL_NONE = 0,
- // Address-only tagging. Heap pointers have a non-zero tag in the most significant byte which is
- // checked in free(). Memory accesses ignore the tag.
- M_HEAP_TAGGING_LEVEL_TBI = 1,
- // Enable heap tagging and asynchronous memory tag checks if supported. Disable stack trace
- // collection.
- M_HEAP_TAGGING_LEVEL_ASYNC = 2,
- // Enable heap tagging and synchronous memory tag checks if supported. Enable stack trace
- // collection.
- M_HEAP_TAGGING_LEVEL_SYNC = 3,
-};
-
// Manipulates bionic-specific handling of memory allocation APIs such as
// malloc. Only for use by the Android platform itself.
//