From: Michalis Pappas Date: Mon, 14 Apr 2025 19:47:15 +0000 (+0200) Subject: lib/posix-process: Restrict pthread creation to clone() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=22c673b10f05ce1d87e0ce8a5ecfb79c25c8fd7b;p=unikraft%2Funikraft.git lib/posix-process: Restrict pthread creation to clone() 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 Approved-by: Andrei Tatar Reviewed-by: Sergiu Moga Reviewed-by: Andrei Tatar GitHub-Closes: #1627 --- diff --git a/lib/posix-process/process.c b/lib/posix-process/process.c index e03d4ab30..ecb9e4deb 100644 --- a/lib/posix-process/process.c +++ b/lib/posix-process/process.c @@ -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) {