]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-process: Restrict pthread creation to clone()
authorMichalis Pappas <michalis@unikraft.io>
Mon, 14 Apr 2025 19:47:15 +0000 (21:47 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Wed, 30 Apr 2025 09:42:51 +0000 (09:42 +0000)
The current implementation incorrectly creates a pthread in the current
process, for every new uk_thread created. This behavior is problematic
because during a syscall, libraries may create uk_threads that are
intended to act as kernel threads. Decouple pthread initializaiton from
uk_thread and limit it to clone().

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1627

lib/posix-process/process.c

index e03d4ab30b8fa241489af290bf70ecddeb71aa15..ecb9e4debbae33c7505d72e125131af4907e2782 100644 (file)
@@ -530,7 +530,7 @@ static void posix_thread_fini(struct uk_thread *child)
                pprocess_release(pprocess);
 }
 
-UK_THREAD_INIT_PRIO(posix_thread_init, posix_thread_fini, UK_PRIO_EARLIEST);
+UK_THREAD_INIT_PRIO(0, posix_thread_fini, UK_PRIO_EARLIEST);
 
 struct posix_process *pid2pprocess(pid_t pid)
 {