From 3784dfc0985fc0185cdc79428f624cdd1e03eabf Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Mon, 21 Dec 2020 15:03:03 +0000 Subject: malloc: Basic support for memory tagging in the malloc() family This patch adds the basic support for memory tagging. Various flavours are supported, particularly being able to turn on tagged memory at run-time: this allows the same code to be used on systems where memory tagging support is not present without neededing a separate build of glibc. Also, depending on whether the kernel supports it, the code will use mmap for the default arena if morecore does not, or cannot support tagged memory (on AArch64 it is not available). All the hooks use function pointers to allow this to work without needing ifuncs. Reviewed-by: DJ Delorie --- include/malloc.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/malloc.h b/include/malloc.h index 0765482c51..7ae08d53d3 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -15,4 +15,12 @@ struct malloc_state; typedef struct malloc_state *mstate; # endif /* !_ISOMAC */ + +#ifdef USE_MTAG +extern int __mtag_mmap_flags; +#define MTAG_MMAP_FLAGS __mtag_mmap_flags +#else +#define MTAG_MMAP_FLAGS 0 +#endif + #endif -- cgit 1.4.1