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 + malloc/arena.c | 59 ++++++- malloc/hooks.c | 79 ++++++--- malloc/malloc.c | 336 +++++++++++++++++++++++++++++------- sysdeps/generic/libc-mtag.h | 52 ++++++ 5 files changed, 437 insertions(+), 97 deletions(-) create mode 100644 sysdeps/generic/libc-mtag.h