aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mem_openbsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mem_openbsd.c')
-rw-r--r--src/runtime/mem_openbsd.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/runtime/mem_openbsd.c b/src/runtime/mem_openbsd.c
index 31820e5170..ac3a2a565a 100644
--- a/src/runtime/mem_openbsd.c
+++ b/src/runtime/mem_openbsd.c
@@ -27,6 +27,29 @@ runtime·sysAlloc(uintptr n, uint64 *stat)
return v;
}
+#pragma textflag NOSPLIT
+void
+runtime·sysMarkStack(void *v, uintptr n)
+{
+ void *p;
+
+ // Stack regions on OpenBSD 6.4+ must be marked with MAP_STACK.
+ p = runtime·mmap(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE|MAP_FIXED|MAP_STACK, -1, 0);
+ if (p == ((void *)-1) || p != v)
+ runtime·throw("runtime: failed to mark stack");
+}
+
+#pragma textflag NOSPLIT
+void
+runtime·sysUnmarkStack(void *v, uintptr n)
+{
+ void *p;
+
+ p = runtime·mmap(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, 0);
+ if (p == ((void *)-1) || p != v)
+ runtime·throw("runtime: failed to unmark stack");
+}
+
void
runtime·SysUnused(void *v, uintptr n)
{