From 517226c2b1bfb00c93e14f7a597a63d3817ce3aa Mon Sep 17 00:00:00 2001 From: Frances Wingerter Date: Thu, 3 Oct 2024 14:05:10 -0400 Subject: [PATCH] runtime: tag pointers to newly-allocated stacks --- runtime/libia2/init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/libia2/init.c b/runtime/libia2/init.c index 707efa649..db891d6b6 100644 --- a/runtime/libia2/init.c +++ b/runtime/libia2/init.c @@ -26,6 +26,10 @@ char *allocate_stack(int i) { exit(-1); } } +#ifdef __aarch64__ + /* Tag the allocated stack pointer so it is accessed with the right pkey */ + stack = (char *)((uint64_t)stack | (uint64_t)i << 56); +#endif /* Each stack frame start + 8 is initially 16-byte aligned. */ return stack + STACK_SIZE - 8; }