]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
um: Prohibit the VM_CLONE flag in run_helper_thread()
authorTiwei Bie <tiwei.btw@antgroup.com>
Wed, 19 Mar 2025 13:55:23 +0000 (21:55 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 20 Mar 2025 08:26:38 +0000 (09:26 +0100)
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>
arch/um/os-Linux/helper.c

index df22cba24d82ee705ca37873412c53e9a8215e6a..89c2ad2a4e3acb3c86b885e77f932d9ff46898f7 100644 (file)
@@ -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;