We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fork
描述错误/Describe the bug There is a deadlock and several reachable panic when program calls syscall fork multiple times.
Deadlock at src/libs/rwlock.rs:260-262.
DragonOS/kernel/src/libs/rwlock.rs
Lines 260 to 262 in 72423f9
Panic at src/mm/allocator/slab.rs:44
DragonOS/kernel/src/mm/allocator/slab.rs
Lines 42 to 45 in 72423f9
and src/namespaces/pid_namespace.rs:113
DragonOS/kernel/src/namespaces/pid_namespace.rs
Lines 108 to 113 in 72423f9
请填写您的电脑的信息/Environment
重现步骤/To Reproduce
#include <unistd.h> int main() { for (int i = 0; i < 1000; i++) fork(); }
期望行为/Expected behavior DragonOS should not panic or fall into deadlock.
屏幕截图/Log Scree log:
root@DragonOS:/$ /bin/deadlock [ ERROR ] (src/debug/panic/mod.rs:15) Kernel Panic Occurred. Location: File: src/mm/allocator/slab.rs Line: 44, Column: 22 Message: Should succeed after refill: OutOfMemory Rust Panic Backtrace: Current PCB: ProcessControlBlock { pid: Pid(9), tgid: Pid(9), thread_pid: RwLock { lock: 0, data: UnsafeCell { .. } }, basic: RwLock { lock: 0, data: U} /bin/deadlock: Process terminated root@DragonOS:/$ [ ERROR ] (src/debug/panic/mod.rs:15) Kernel Panic Occurred. Location: File: src/mm/allocator/slab.rs Line: 44, Column: 22 Message: Should succeed aft[ ERROR ] (src/debug/panic/mod.rs:15) Kernel Panic Occurred. Location: File: src/mm/allocator/slab.rs Line: 4[ ERROR ] (src/debug/panic/mod.rs:15) Kernel Panic Occur[ ERROR ] (src/debug/panic/mod.rs:15) Kernel Panic Occurred. Location: File: src/namespaces/pid_namespace.rs Line: 113, Column: 22 Message: PID allocation failed. Rust Panic Backtrace: Current PCB: ProcessControlBlock { pid: Pid(4724), tgid: Pid(4724), thread_pid: RwLock { lock: 0, data: UnsafeCell { .. } }, basic: RwLock { lock: 0, d}
The GDB log:
(gdb) bt #0 core::sync::atomic::AtomicUsize::fetch_update<fn(usize) -> core::option::Option<usize>> (self=0xffff800018a62800, set_order=core::sync::atomic::Ordering::Acquire, fetch_order=core::sync::atomic::Ordering::Relaxed, f=<optimized out>) at /root/.rustup/toolchains/nightly-2024-11-05-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2908 #1 alloc::sync::Weak<dragonos_kernel::process::ProcessControlBlock, alloc::alloc::Global>::upgrade<dragonos_kernel::process::ProcessControlBlock, alloc::alloc::Global> (self=<optimized out>) at /root/.rustup/toolchains/nightly-2024-11-05-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:3001 #2 dragonos_kernel::process::ProcessControlBlock::arch_current_pcb () at src/arch/x86_64/process/mod.rs:286 #3 dragonos_kernel::process::ProcessManager::current_pcb () at src/process/mod.rs:166 #4 0x0000000200000000 in ?? () #5 0x0000000000000000 in ?? () (gdb) n dragonos_kernel::process::ProcessManager::current_pcb () at src/process/mod.rs:167 167 } (gdb) dragonos_kernel::libs::rwlock::RwLock<ida::IdAllocator>::try_write<ida::IdAllocator> (self=0xffff80001eb35910) at src/libs/rwlock.rs:211 211 let r = self.inner_try_write(); (gdb) 213 ProcessManager::preempt_enable(); (gdb) 216 return r; (gdb) dragonos_kernel::libs::rwlock::RwLock<ida::IdAllocator>::write<ida::IdAllocator> (self=0xffff80001eb35910) at src/libs/rwlock.rs:260 260 match self.try_write() { (gdb) 262 None => spin_loop(), (gdb) 260 match self.try_write() { (gdb) 262 None => spin_loop(), (gdb) bt #0 dragonos_kernel::libs::rwlock::RwLock<ida::IdAllocator>::write<ida::IdAllocator> (self=0xffff80001eb35910) at src/libs/rwlock.rs:262 #1 dragonos_kernel::namespaces::pid_namespace::PidStrcut::alloc_pid (ns=..., set_tid=...) at src/namespaces/pid_namespace.rs:111 #2 0x0000000000000000 in ?? ()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
描述错误/Describe the bug
There is a deadlock and several reachable panic when program calls syscall
fork
multiple times.Deadlock at src/libs/rwlock.rs:260-262.
DragonOS/kernel/src/libs/rwlock.rs
Lines 260 to 262 in 72423f9
Panic at src/mm/allocator/slab.rs:44
DragonOS/kernel/src/mm/allocator/slab.rs
Lines 42 to 45 in 72423f9
and src/namespaces/pid_namespace.rs:113
DragonOS/kernel/src/namespaces/pid_namespace.rs
Lines 108 to 113 in 72423f9
请填写您的电脑的信息/Environment
重现步骤/To Reproduce
fork
multiple times期望行为/Expected behavior
DragonOS should not panic or fall into deadlock.
屏幕截图/Log
Scree log:
The GDB log:
The text was updated successfully, but these errors were encountered: