[PATCH 4/4] um: Prohibit the VM_CLONE flag in run_helper_thread()
Tiwei Bie
tiwei.btw at antgroup.com
Fri Feb 21 00:40:49 PST 2025
Directly creating helper threads with VM_CLONE using clone can
compromise the thread safety of errno. Since all these helper
threads have been converted to use os_run_helper_thread(), let's
prevent using this flag in run_helper_thread().
Signed-off-by: Tiwei Bie <tiwei.btw at antgroup.com>
---
arch/um/os-Linux/helper.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index c6a0ef8beb29..5c157f2f75e1 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -122,6 +122,10 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
unsigned long stack, sp;
int pid, status, err;
+ /* To share memory address space, use os_run_helper_thread() instead. */
+ if (flags & CLONE_VM)
+ return -EINVAL;
+
stack = alloc_stack(0, __uml_cant_sleep());
if (stack == 0)
return -ENOMEM;
--
2.34.1
More information about the linux-um
mailing list