From bcf8fd63d4f2586c2638c8dfee825a62f8de2602 Mon Sep 17 00:00:00 2001 From: Michalis Pappas Date: Mon, 7 Apr 2025 11:10:22 +0200 Subject: [PATCH] lib/posix-process: Ignore CLONE_VM when assigning tls parameter 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 Approved-by: Andrei Tatar Reviewed-by: Sergiu Moga Reviewed-by: Andrei Tatar GitHub-Closes: #1627 --- lib/posix-process/clone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/posix-process/clone.c b/lib/posix-process/clone.c index 29138fef5..de9a5388f 100644 --- a/lib/posix-process/clone.c +++ b/lib/posix-process/clone.c @@ -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; -- 2.39.5