lang/rust: regen bootstrap + MAP_STACK

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

lang/rust: regen bootstrap + MAP_STACK

Sebastien Marie-3
Hi,

Here a diff for lang/rust:
- regen amd64 bootstrap (I will do i386 a bit later, and it is BROKEN
  for now)

- added MAP_STACK flag for use with sigaltstack() (only used for signal
  handler used for stack overflow detection)

- change a bit the way stack overflow is detected

The testsuite on amd64 still pass.
--
Sebastien Marie


Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/rust/Makefile,v
retrieving revision 1.61
diff -u -p -r1.61 Makefile
--- Makefile 24 Feb 2018 18:04:08 -0000 1.61
+++ Makefile 12 Mar 2018 15:16:10 -0000
@@ -16,9 +16,10 @@ COMMENT-doc = html documentation for ru
 V = 1.24.0
 CARGO_V = 0.25.0
 DISTNAME = rustc-${V}-src
+REVISION = 0
 
 # rustc bootstrap version
-BV-amd64 = 1.24.0-20180213
+BV-amd64 = 1.24.0-20180308
 BV-i386 = 1.24.0-20180213
 BV = ${BV-${MACHINE_ARCH}}
 
Index: distinfo
===================================================================
RCS file: /cvs/ports/lang/rust/distinfo,v
retrieving revision 1.31
diff -u -p -r1.31 distinfo
--- distinfo 23 Feb 2018 16:38:16 -0000 1.31
+++ distinfo 12 Mar 2018 15:16:10 -0000
@@ -1,6 +1,6 @@
 SHA256 (rust/rustc-1.24.0-src.tar.gz) = u4J29gROh35Efyn1ZuS7+CD6Uf6i+RLVm3MjP/2VY58=
-SHA256 (rust/rustc-bootstrap-amd64-1.24.0-20180213.tar.gz) = HF/ZvsS/EMaGM4GaiZa2/worbtYxwpwreU2p8Bhw3fE=
+SHA256 (rust/rustc-bootstrap-amd64-1.24.0-20180308.tar.gz) = qC6MXaM7/DQVJ7Z0xDkY8EphBjdMgyiQPdFfQecy7J4=
 SHA256 (rust/rustc-bootstrap-i386-1.24.0-20180213.tar.gz) = nQRwYdT3n9jjmoUt8IdqrJXvhKwq6PMMCAe+49JeivQ=
 SIZE (rust/rustc-1.24.0-src.tar.gz) = 67506894
-SIZE (rust/rustc-bootstrap-amd64-1.24.0-20180213.tar.gz) = 85135015
+SIZE (rust/rustc-bootstrap-amd64-1.24.0-20180308.tar.gz) = 85090848
 SIZE (rust/rustc-bootstrap-i386-1.24.0-20180213.tar.gz) = 86217512
Index: patches/patch-src_liblibc_src_unix_bsd_netbsdlike_openbsdlike_openbsd_mod_rs
===================================================================
RCS file: patches/patch-src_liblibc_src_unix_bsd_netbsdlike_openbsdlike_openbsd_mod_rs
diff -N patches/patch-src_liblibc_src_unix_bsd_netbsdlike_openbsdlike_openbsd_mod_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_liblibc_src_unix_bsd_netbsdlike_openbsdlike_openbsd_mod_rs 12 Mar 2018 15:16:10 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+Add MAP_STACK flag.
+Index: src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
+--- src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs.orig
++++ src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
+@@ -1,3 +1,5 @@
++pub const MAP_STACK : ::c_int = 0x4000;
++
+ s! {
+     pub struct lconv {
+         pub decimal_point: *mut ::c_char,
Index: patches/patch-src_libstd_sys_unix_stack_overflow_rs
===================================================================
RCS file: patches/patch-src_libstd_sys_unix_stack_overflow_rs
diff -N patches/patch-src_libstd_sys_unix_stack_overflow_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_libstd_sys_unix_stack_overflow_rs 12 Mar 2018 15:16:10 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+Use MAP_STACK for stack allocation.
+Index: src/libstd/sys/unix/stack_overflow.rs
+--- src/libstd/sys/unix/stack_overflow.rs.orig
++++ src/libstd/sys/unix/stack_overflow.rs
+@@ -144,7 +144,7 @@ mod imp {
+         let stackp = mmap(ptr::null_mut(),
+                           SIGSTKSZ,
+                           PROT_READ | PROT_WRITE,
+-                          MAP_PRIVATE | MAP_ANON,
++                          MAP_PRIVATE | MAP_ANON | libc::MAP_STACK,
+                           -1,
+                           0);
+         if stackp == MAP_FAILED {
Index: patches/patch-src_libstd_sys_unix_thread_rs
===================================================================
RCS file: patches/patch-src_libstd_sys_unix_thread_rs
diff -N patches/patch-src_libstd_sys_unix_thread_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_libstd_sys_unix_thread_rs 12 Mar 2018 15:16:10 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+Don't change permission on stack for creating a stack_guard page: we already have such thing.
+Index: src/libstd/sys/unix/thread.rs
+--- src/libstd/sys/unix/thread.rs.orig
++++ src/libstd/sys/unix/thread.rs
+@@ -269,7 +269,7 @@ pub mod guard {
+                 as *mut libc::c_void;
+         }
+
+-        if cfg!(target_os = "linux") {
++        if cfg!(target_os = "linux") || cfg!(target_os = "openbsd") {
+             // Linux doesn't allocate the whole stack right away, and
+             // the kernel has its own stack-guard mechanism to fault
+             // when growing too close to an existing mapping.  If we map