Protect fork() and clone() behind a rwlock.
rlct_clone will acquire a read lock, whereas fork will acquire a write lock. The write lock is necessary because the fork will clone the file table, which would result in other threads' fork/clone file descriptors not being closed. If an address space switch fd never gets closed, fork child processes and new threads, may never switch address spaces before they are started, which has resulted in hard-to-debug RIP=0 instr fetch page faults.
Loading
Please register or sign in to comment