Hi,

Currently, when sbcl starts, the console shows a "map stack for pid XXX failed" 
message.

After searching a bit, sbcl is badly using sigaltstack(2) by using a MAP_STACK 
memory with RWX protection. The syscall fails with EINVAL (and a printf(9) 
message is shown).

By reducing the protection to RW (for such stack mmap allocation), sbcl is 
still 
functionning.

Tested on amd64.

Comments or OK ?
-- 
Sebastien Marie


diff /home/semarie/repos/openbsd/ports
commit - c38830f3d3d8d16d5ed9a59ccd73a8c5e3d9a789
path + /home/semarie/repos/openbsd/ports
blob - a42915ef65c21f1226f2f4bc170c9e54e9e5d9e9
file + lang/sbcl/Makefile
--- lang/sbcl/Makefile
+++ lang/sbcl/Makefile
@@ -5,6 +5,7 @@ DISTNAME=               sbcl-${V}-source
 COMMENT=               compiler and runtime system for ANSI Common Lisp
 
 V =                    2.2.5
+REVISION =             0
 DISTNAME=              sbcl-${V}-source
 PKGNAME=               sbcl-${V}
 WRKDIST=               ${WRKDIR}/sbcl-${V}
blob - /dev/null
file + lang/sbcl/patches/patch-src_runtime_bsd-os_c (mode 640)
--- /dev/null
+++ lang/sbcl/patches/patch-src_runtime_bsd-os_c
@@ -0,0 +1,13 @@
+stack should be RW (without X)
+
+Index: src/runtime/bsd-os.c
+--- src/runtime/bsd-os.c.orig
++++ src/runtime/bsd-os.c
+@@ -182,6 +182,7 @@ os_validate(int attributes, os_vm_address_t addr, os_v
+         /* OpenBSD requires MAP_STACK for pages used as stack.
+          * Note that FreeBSD has a MAP_STACK with different behavior. */
+         flags = MAP_STACK;
++        protection = OS_VM_PROT_READ | OS_VM_PROT_WRITE;
+ #endif
+     }
+ #endif

Reply via email to