pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mrust-libs: add a patch that was omitted by mistake
Module Name: pkgsrc-wip
Committed By: Dave Berger <pkgsrc-mrust%web5by5.com@localhost>
Pushed By: dave
Date: Tue Mar 28 01:03:47 2023 -0400
Changeset: 59b0ce82c1ebfec938eb11ba72d849c55a3331b5
Added Files:
mrust-libs/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs
Log Message:
mrust-libs: add a patch that was omitted by mistake
Aug 18 09:58:52 2022 EDT: patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=59b0ce82c1ebfec938eb11ba72d849c55a3331b5
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
...c-1.54.0-src_library_std_src_sys_unix_thread.rs | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
diffs:
diff --git a/mrust-libs/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs b/mrust-libs/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs
new file mode 100644
index 0000000000..84663ada52
--- /dev/null
+++ b/mrust-libs/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs
@@ -0,0 +1,43 @@
+$NetBSD$
+
+--- ../rustc-1.54.0-src/library/std/src/sys/unix/thread.rs.orig 2021-07-26 14:43:02.000000000 +0000
++++ ../rustc-1.54.0-src/library/std/src/sys/unix/thread.rs
+@@ -357,6 +357,21 @@ pub mod guard {
+ const GUARD_PAGES: usize = 1;
+ let guard = guardaddr..guardaddr + GUARD_PAGES * page_size;
+ Some(guard)
++ } else if cfg!(target_os = "netbsd") {
++ // [The following should be reviewed/confirmed, -DLB]:
++ // Using the default else clause below, sporadic guard page
++ // errors were occurring during builds of rustc & cargo with
++ // mrustc on NetBSD; however, NetBSD has a kernel-based
++ // guard area mechanism too. Therefore, try relying on that
++ // instead of the default mmap/mprotect solution; but note:
++ // if userland code changes the stack address, the NetBSD
++ // kernel-based guard mechanism is deactivated (see
++ // pthread_attr_getstack(3)) and the userland code must
++ // manage a guard area itself. Fortunately, the stack
++ // appears to be unchanged by this version of thread.rs
++ let stackaddr = get_stack_start_aligned()?;
++ let stackaddr = stackaddr as usize;
++ Some(stackaddr - page_size..stackaddr)
+ } else {
+ // Reallocate the last page of the stack.
+ // This ensures SIGBUS will be raised on
+@@ -376,11 +391,16 @@ pub mod guard {
+ 0,
+ );
+ if result != stackaddr || result == MAP_FAILED {
++ println!( "stackaddr = {}", stackaddr as u64 );
++ println!( "mmap() -> result {}", result as u64 );
++ println!( "mmap() -> ERRNO {}", os::errno() as u64 );
+ panic!("failed to allocate a guard page: {}", io::Error::last_os_error());
+ }
+
+ let result = mprotect(stackaddr, page_size, PROT_NONE);
+ if result != 0 {
++ println!( "stackaddr = {}", stackaddr as u64 );
++ println!( "mprotect() -> ERRNO {}", os::errno() as u64 );
+ panic!("failed to protect the guard page: {}", io::Error::last_os_error());
+ }
+
Home |
Main Index |
Thread Index |
Old Index