5851974b20
Release fork infrastructure: - REDBEAR_RELEASE=0.1.1 with offline enforcement (fetch/distclean/unfetch blocked) - 195 BLAKE3-verified source archives in standard format - Atomic provisioning via provision-release.sh (staging + .complete sentry) - 5-phase improvement plan: restore format auto-detection, source tree validation (validate-source-trees.py), archive-map.json, REPO_BINARY fallback Archive normalization: - Removed 87 duplicate/unversioned archives from shared pool - Regenerated all archives in consistent format with source/ + recipe.toml - BLAKE3SUMS and manifest.json generated from stable tarball set Patch management: - verify-patches.sh: pre-sync dry-run report (OK/REVERSED/CONFLICT) - 121 upstream-absorbed patches moved to absorbed/ directories - 43 active patches verified clean against rebased sources - Stress test: base updated to upstream HEAD, relibc reset and patched Compilation fixes: - relibc: Vec imports in redox-rt (proc.rs, lib.rs, sys.rs) - relibc: unsafe from_raw_parts in mod.rs (2024 edition) - fetch.rs: rev comparison handles short/full hash prefixes - kibi recipe: corrected rev mismatch New scripts: restore-sources.sh, provision-release.sh, verify-sources-archived.sh, check-upstream-releases.sh, validate-source-trees.py, verify-patches.sh, repair-archive-format.sh, generate-manifest.py Documentation: AGENTS.md, README.md, local/AGENTS.md updated for release fork model
96 lines
2.9 KiB
Diff
96 lines
2.9 KiB
Diff
diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs
|
|
--- a/src/header/signal/mod.rs
|
|
+++ b/src/header/signal/mod.rs
|
|
@@ -2,7 +2,10 @@
|
|
//!
|
|
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>.
|
|
|
|
-use core::{mem, ptr};
|
|
+use core::{
|
|
+ mem, ptr,
|
|
+ sync::atomic::Ordering,
|
|
+};
|
|
|
|
use cbitset::BitSet;
|
|
|
|
@@ -157,10 +160,17 @@
|
|
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_kill.html>.
|
|
#[unsafe(no_mangle)]
|
|
pub unsafe extern "C" fn pthread_kill(thread: pthread_t, sig: c_int) -> c_int {
|
|
- let os_tid = {
|
|
- let pthread = unsafe { &*(thread as *const crate::pthread::Pthread) };
|
|
- unsafe { pthread.os_tid.get().read() }
|
|
- };
|
|
+ let pthread = unsafe { &*(thread as *const crate::pthread::Pthread) };
|
|
+ let os_tid = unsafe { pthread.os_tid.get().read() };
|
|
+ let flags = crate::pthread::PthreadFlags::from_bits_retain(
|
|
+ pthread.flags.load(Ordering::Acquire),
|
|
+ );
|
|
+ if flags.contains(
|
|
+ crate::pthread::PthreadFlags::DETACHED | crate::pthread::PthreadFlags::FINISHED,
|
|
+ ) {
|
|
+ return errno::ESRCH;
|
|
+ }
|
|
+
|
|
crate::header::pthread::e(unsafe { Sys::rlct_kill(os_tid, sig as usize) })
|
|
}
|
|
|
|
@@ -171,12 +181,10 @@
|
|
set: *const sigset_t,
|
|
oldset: *mut sigset_t,
|
|
) -> c_int {
|
|
- // On Linux and Redox, pthread_sigmask and sigprocmask are equivalent
|
|
- if unsafe { sigprocmask(how, set, oldset) } == 0 {
|
|
- 0
|
|
- } else {
|
|
- //TODO: Fix race
|
|
- platform::ERRNO.get()
|
|
+ let result = unsafe { Sys::sigprocmask(how, set.as_ref(), oldset.as_mut()) };
|
|
+ match result {
|
|
+ Ok(()) => 0,
|
|
+ Err(errno) => errno.0,
|
|
}
|
|
}
|
|
|
|
diff --git a/src/pthread/mod.rs b/src/pthread/mod.rs
|
|
--- a/src/pthread/mod.rs
|
|
+++ b/src/pthread/mod.rs
|
|
@@ -31,6 +31,7 @@
|
|
stack_size: 0,
|
|
|
|
os_tid: UnsafeCell::new(Sys::current_os_tid()),
|
|
+ robust_list_head: UnsafeCell::new(ptr::null_mut()),
|
|
};
|
|
|
|
#[cfg(target_os = "redox")]
|
|
@@ -60,6 +61,7 @@
|
|
bitflags::bitflags! {
|
|
pub struct PthreadFlags: usize {
|
|
const DETACHED = 1;
|
|
+ const FINISHED = 1 << 1;
|
|
}
|
|
}
|
|
|
|
@@ -306,7 +308,9 @@
|
|
|
|
unsafe { crate::sync::pthread_mutex::mark_robust_mutexes_dead(this) };
|
|
|
|
- if this.flags.load(Ordering::Acquire) & PthreadFlags::DETACHED.bits() != 0 {
|
|
+ let flags = this.flags.fetch_or(PthreadFlags::FINISHED.bits(), Ordering::AcqRel);
|
|
+
|
|
+ if flags & PthreadFlags::DETACHED.bits() != 0 {
|
|
unsafe { dealloc_thread(this) };
|
|
} else {
|
|
unsafe { this.waitval.post(retval) };
|
|
diff --git a/src/ld_so/tcb.rs b/src/ld_so/tcb.rs
|
|
--- a/src/ld_so/tcb.rs
|
|
+++ b/src/ld_so/tcb.rs
|
|
@@ -107,6 +107,7 @@
|
|
stack_base: core::ptr::null_mut(),
|
|
stack_size: 0,
|
|
os_tid: UnsafeCell::new(OsTid::default()),
|
|
+ robust_list_head: UnsafeCell::new(ptr::null_mut()),
|
|
},
|
|
|
|
dtv_ptr: ptr::null_mut(),
|