update patches
This commit is contained in:
parent
9f8aa3b200
commit
0e0e5eedcd
|
@ -1,80 +0,0 @@
|
|||
From 1d5e3cd80b66a3abd274107e75854476c603617d Mon Sep 17 00:00:00 2001
|
||||
From: Josh Stone <jistone@redhat.com>
|
||||
Date: Wed, 5 Jul 2017 12:03:17 -0700
|
||||
Subject: [PATCH] Skip the main thread's manual stack guard on Linux
|
||||
|
||||
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 our own guard, then the kernel starts
|
||||
enforcing a rather large gap above that, rendering much of the possible
|
||||
stack space useless.
|
||||
|
||||
Instead, we'll just note where we expect rlimit to start faulting, so
|
||||
our handler can report "stack overflow", and trust that the kernel's own
|
||||
stack guard will work.
|
||||
|
||||
Fixes #43052.
|
||||
---
|
||||
src/libstd/sys/unix/thread.rs | 44 ++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 29 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs
|
||||
index 1642baa34d63..15747746611c 100644
|
||||
--- a/src/libstd/sys/unix/thread.rs
|
||||
+++ b/src/libstd/sys/unix/thread.rs
|
||||
@@ -264,23 +264,37 @@ pub mod guard {
|
||||
as *mut libc::c_void;
|
||||
}
|
||||
|
||||
- // Rellocate the last page of the stack.
|
||||
- // This ensures SIGBUS will be raised on
|
||||
- // stack overflow.
|
||||
- let result = mmap(stackaddr, psize, PROT_NONE,
|
||||
- MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
|
||||
-
|
||||
- if result != stackaddr || result == MAP_FAILED {
|
||||
- panic!("failed to allocate a guard page");
|
||||
- }
|
||||
-
|
||||
- let offset = if cfg!(any(target_os = "linux", target_os = "freebsd")) {
|
||||
- 2
|
||||
+ if cfg!(target_os = "linux") {
|
||||
+ // 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
|
||||
+ // our own guard, then the kernel starts enforcing a rather
|
||||
+ // large gap above that, rendering much of the possible
|
||||
+ // stack space useless. See #43052.
|
||||
+ //
|
||||
+ // Instead, we'll just note where we expect rlimit to start
|
||||
+ // faulting, so our handler can report "stack overflow", and
|
||||
+ // trust that the kernel's own stack guard will work.
|
||||
+ Some(stackaddr as usize)
|
||||
} else {
|
||||
- 1
|
||||
- };
|
||||
+ // Reallocate the last page of the stack.
|
||||
+ // This ensures SIGBUS will be raised on
|
||||
+ // stack overflow.
|
||||
+ let result = mmap(stackaddr, psize, PROT_NONE,
|
||||
+ MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
|
||||
+
|
||||
+ if result != stackaddr || result == MAP_FAILED {
|
||||
+ panic!("failed to allocate a guard page");
|
||||
+ }
|
||||
|
||||
- Some(stackaddr as usize + offset * psize)
|
||||
+ let offset = if cfg!(target_os = "freebsd") {
|
||||
+ 2
|
||||
+ } else {
|
||||
+ 1
|
||||
+ };
|
||||
+
|
||||
+ Some(stackaddr as usize + offset * psize)
|
||||
+ }
|
||||
}
|
||||
|
||||
#[cfg(target_os = "solaris")]
|
||||
--
|
||||
2.13.3
|
||||
|
13
rust.spec
13
rust.spec
|
@ -62,8 +62,7 @@ ExclusiveArch: %{rust_arches}
|
|||
%endif
|
||||
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
|
||||
|
||||
Patch1: rust-1.19.0-43072-stack-guard.patch
|
||||
Patch2: rust-1.19.0-43297-configure-debuginfo.patch
|
||||
Patch1: rust-1.19.0-43297-configure-debuginfo.patch
|
||||
|
||||
# Get the Rust triple for any arch.
|
||||
%{lua: function rust_triple(arch)
|
||||
|
@ -281,13 +280,6 @@ cp src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown
|
|||
sed -e '/*\//q' src/libbacktrace/backtrace.h \
|
||||
>src/libbacktrace/LICENSE-libbacktrace
|
||||
|
||||
# These tests assume that alloc_jemalloc is present
|
||||
# https://github.com/rust-lang/rust/issues/35017
|
||||
sed -i.jemalloc -e '1i // ignore-test jemalloc is disabled' \
|
||||
src/test/compile-fail/allocator-dylib-is-system.rs \
|
||||
src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \
|
||||
src/test/run-pass/allocator-default.rs
|
||||
|
||||
# This tests a problem of exponential growth, which seems to be less-reliably
|
||||
# fixed when running on older LLVM and/or some arches. Just skip it for now.
|
||||
sed -i.ignore -e '1i // ignore-test may still be exponential...' \
|
||||
|
@ -306,8 +298,7 @@ sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
|
|||
src/librustc_llvm/lib.rs
|
||||
%endif
|
||||
|
||||
%patch1 -p1 -b .stack-guard
|
||||
%patch2 -p1 -b .debuginfo
|
||||
%patch1 -p1 -b .debuginfo
|
||||
|
||||
# The configure macro will modify some autoconf-related files, which upsets
|
||||
# cargo when it tries to verify checksums in those files. If we just truncate
|
||||
|
|
Loading…
Reference in New Issue