Patch "um: avoid copying FP state from init_task" has been added to the 6.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    um: avoid copying FP state from init_task

to the 6.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     um-avoid-copying-fp-state-from-init_task.patch
and it can be found in the queue-6.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 520ce91efd95eabe8095a07931862b81f6891d26
Author: Benjamin Berg <benjamin.berg@xxxxxxxxx>
Date:   Tue Dec 17 21:27:44 2024 +0100

    um: avoid copying FP state from init_task
    
    [ Upstream commit 8891b176d350ec5ea9a39c6ef4c99bd63d68e64c ]
    
    The init_task instance of struct task_struct is statically allocated and
    does not contain the dynamic area for the userspace FP registers. As
    such, limit the copy to the valid area of init_task and fill the rest
    with zero.
    
    Note that the FP state is only needed for userspace, and as such it is
    entirely reasonable for init_task to not contain it.
    
    Reported-by: Brian Norris <briannorris@xxxxxxxxxxxx>
    Closes: https://lore.kernel.org/Z1ySXmjZm-xOqk90@xxxxxxxxxx
    Fixes: 3f17fed21491 ("um: switch to regset API and depend on XSTATE")
    Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx>
    Link: https://patch.msgid.link/20241217202745.1402932-3-benjamin@xxxxxxxxxxxxxxxx
    Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
    Signed-off-by: Richard Weinberger <richard@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 30bdc0a87dc85..3a67ba8aa62dc 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -191,7 +191,15 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
 int arch_dup_task_struct(struct task_struct *dst,
 			 struct task_struct *src)
 {
-	memcpy(dst, src, arch_task_struct_size);
+	/* init_task is not dynamically sized (missing FPU state) */
+	if (unlikely(src == &init_task)) {
+		memcpy(dst, src, sizeof(init_task));
+		memset((void *)dst + sizeof(init_task), 0,
+		       arch_task_struct_size - sizeof(init_task));
+	} else {
+		memcpy(dst, src, arch_task_struct_size);
+	}
+
 	return 0;
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux