]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-process: Ignore CLONE_VM when assigning tls parameter
authorMichalis Pappas <michalis@unikraft.io>
Mon, 7 Apr 2025 09:10:22 +0000 (11:10 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Wed, 30 Apr 2025 09:42:51 +0000 (09:42 +0000)
The interpretation of the tls parameter of clone() is conditional to
passing CLONE_SETTLS in flags. Fix a bug where CLONE_VM would result
into assigning the tls parameter to child. Assigning the parent's tls
when CLONE_VFORK is set, is performed in clone_setup_child_ctx(),
conditionally that the child's tls is not already set, presumably due
to CLONE_SETTLS.

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/clone.c

index 29138fef569b8ec0c53d4af224d1967a04716a49..de9a5388fe1b44eaa97c3d9ec3c1d0898cb55211 100644 (file)
@@ -512,7 +512,7 @@ int uk_clone(struct clone_args *cl_args, size_t cl_args_len,
                 * NOTE: If SETTLS is not set, we do not activate any TLS
                 * although a Unikraft TLS was allocated.
                 */
-               if ((flags & CLONE_SETTLS) || (flags & CLONE_VM))
+               if ((flags & CLONE_SETTLS))
                        child->tlsp = tls;
                else
                        child->tlsp = 0;