Skip to content

Fix double borrow of task when delivering user signals#241

Merged
hexagonal-sun merged 6 commits intohexagonal-sun:masterfrom
TroyNeubauer:handle-sigsev
Mar 2, 2026
Merged

Fix double borrow of task when delivering user signals#241
hexagonal-sun merged 6 commits intohexagonal-sun:masterfrom
TroyNeubauer:handle-sigsev

Conversation

@TroyNeubauer
Copy link
Contributor

While experimenting with #237, I found a double borrow:

moss: Kernel panicked at src/arch/arm64/memory/fault.rs:46:20: Double mutable borrow of current task! Borrowed from: Some(Location { file: "src/arch/arm64/proc/signal.rs", line: 30, column: 16 })

Borrowing current_task over the copy_to_user in do_signal causes a double borrow when run_mem_fault_handler runs (since the user stack is demand-paged)

It would be nice to have the type system help us here, but looks like CurrentTaskGuard is already !Send + !Sync.

Copy link
Owner

@hexagonal-sun hexagonal-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

I presume the segfault tests you've added to usertest tripped the double borrow?

@TroyNeubauer
Copy link
Contributor Author

Yeah - if you comment drop(signal); drop(task); you will trigger the double borrow

@hexagonal-sun
Copy link
Owner

Merged. Thanks for the contribution!

@hexagonal-sun hexagonal-sun merged commit d164e06 into hexagonal-sun:master Mar 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants