diff options
author | 2025-03-19 21:55:23 +0800 | |
---|---|---|
committer | 2025-03-20 09:26:38 +0100 | |
commit | 69f52573c24de9d2919f83e3b3b396a09118b7c4 (patch) | |
tree | cda5cd3e4ba7728c9d95e48c8f615640100e7e96 | |
parent | um: Switch to the pthread-based helper in sigio workaround (diff) | |
download | wireguard-linux-69f52573c24de9d2919f83e3b3b396a09118b7c4.tar.xz wireguard-linux-69f52573c24de9d2919f83e3b3b396a09118b7c4.zip |
um: Prohibit the VM_CLONE flag in run_helper_thread()
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@antgroup.com>
Link: https://patch.msgid.link/20250319135523.97050-5-tiwei.btw@antgroup.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | arch/um/os-Linux/helper.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index df22cba24d82..89c2ad2a4e3a 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 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; |