Patch "riscv: process: fix kernel info leakage" has been added to the 6.0-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

    riscv: process: fix kernel info leakage

to the 6.0-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:
     riscv-process-fix-kernel-info-leakage.patch
and it can be found in the queue-6.0 subdirectory.

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



commit b43aecc82138eb721c1aae2d7211db3e48f83dad
Author: Jisheng Zhang <jszhang@xxxxxxxxxx>
Date:   Sat Oct 29 19:34:50 2022 +0800

    riscv: process: fix kernel info leakage
    
    [ Upstream commit 6510c78490c490a6636e48b61eeaa6fb65981f4b ]
    
    thread_struct's s[12] may contain random kernel memory content, which
    may be finally leaked to userspace. This is a security hole. Fix it
    by clearing the s[12] array in thread_struct when fork.
    
    As for kthread case, it's better to clear the s[12] array as well.
    
    Fixes: 7db91e57a0ac ("RISC-V: Task implementation")
    Signed-off-by: Jisheng Zhang <jszhang@xxxxxxxxxx>
    Tested-by: Guo Ren <guoren@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221029113450.4027-1-jszhang@xxxxxxxxxx
    Reviewed-by: Guo Ren <guoren@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/CAJF2gTSdVyAaM12T%2B7kXAdRPGS4VyuO08X1c7paE-n4Fr8OtRA@xxxxxxxxxxxxxx/
    Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c
index ceb9ebab6558..52002d54b163 100644
--- a/arch/riscv/kernel/process.c
+++ b/arch/riscv/kernel/process.c
@@ -164,6 +164,8 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 	unsigned long tls = args->tls;
 	struct pt_regs *childregs = task_pt_regs(p);
 
+	memset(&p->thread.s, 0, sizeof(p->thread.s));
+
 	/* p->thread holds context to be restored by __switch_to() */
 	if (unlikely(args->fn)) {
 		/* Kernel thread */



[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