]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
um: Do not disable kmalloc in initial_thread_cb()
authorTiwei Bie <tiwei.btw@antgroup.com>
Mon, 27 Oct 2025 00:18:08 +0000 (08:18 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 27 Oct 2025 15:41:14 +0000 (16:41 +0100)
Currently, initial_thread_cb() temporarily disables kmalloc when
it invokes the callback, allowing the callback to bypass kmalloc.
This is unnecessary for the current users of initial_thread_cb(),
and we should avoid memory allocations that are not under the
control of the UML kernel. Therefore, let's stop temporarily
disabling kmalloc in initial_thread_cb().

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
Link: https://patch.msgid.link/20251027001815.1666872-2-tiwei.bie@linux.dev
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/kernel/process.c

index 13d461712c997288c8274d3b47a101f7efb20b43..0a9249b2b86b1e6d6ddbccaa5eb992e3f9f54fe8 100644 (file)
@@ -187,11 +187,7 @@ int copy_thread(struct task_struct * p, const struct kernel_clone_args *args)
 
 void initial_thread_cb(void (*proc)(void *), void *arg)
 {
-       int save_kmalloc_ok = kmalloc_ok;
-
-       kmalloc_ok = 0;
        initial_thread_cb_skas(proc, arg);
-       kmalloc_ok = save_kmalloc_ok;
 }
 
 int arch_dup_task_struct(struct task_struct *dst,