From 74f8c118f8ec804506ee7a7dd12bf65efc6b411e Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 10 Jul 2026 23:28:07 +0300 Subject: [PATCH] kernel: fix compile errors from futex_wake_index and stack mmap - syscall/futex.rs: scope the context write guard so futexes.swap_remove can borrow mutably after the guard drops - syscall/process.rs: add missing 'shared' arg to Grant::zeroed --- src/syscall/futex.rs | 21 ++++++++++++++------- src/syscall/process.rs | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/syscall/futex.rs b/src/syscall/futex.rs index fdfc8cda66..65216532e6 100644 --- a/src/syscall/futex.rs +++ b/src/syscall/futex.rs @@ -201,15 +201,22 @@ pub fn futex( i += 1; continue; } - let mut context = futex.context_lock.write(token.token()); - if let Some(index) = futex.waitv_index { - if context.futex_wake_index.is_none() { - context.futex_wake_index = Some(index); + let should_wake = { + let mut context = futex.context_lock.write(token.token()); + if let Some(index) = futex.waitv_index { + if context.futex_wake_index.is_none() { + context.futex_wake_index = Some(index); + } } + context.unblock(); + true + }; + if should_wake { + futexes.swap_remove(i); + woken += 1; + } else { + i += 1; } - context.unblock(); - futexes.swap_remove(i); - woken += 1; } futexes.is_empty() diff --git a/src/syscall/process.rs b/src/syscall/process.rs index 76b5bbbb1f..bdf2c0eb85 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -332,6 +332,7 @@ pub unsafe fn usermode_bootstrap(bootstrap: &Bootstrap, token: &mut CleanLockTok flags, mapper, flusher, + false, // private mapping for bootstrap stack )?) }, );