]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
riscv: process: fix kernel info leakage
authorJisheng Zhang <jszhang@kernel.org>
Sat, 29 Oct 2022 11:34:50 +0000 (19:34 +0800)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 12:59:05 +0000 (13:59 +0100)
commit092482e41acc71d608f9290d9ed5ed89173a04ee
tree122e8086e1461fff8f5c6b3eedca04528f1ec441
parentade49fd7c3ca91dc779cc27390766678fc3904d6
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@kernel.org>
Tested-by: Guo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/20221029113450.4027-1-jszhang@kernel.org
Reviewed-by: Guo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/CAJF2gTSdVyAaM12T%2B7kXAdRPGS4VyuO08X1c7paE-n4Fr8OtRA@mail.gmail.com/
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit cc36c7fa5d9384602529ba3eea8c5daee7be4dbc)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
arch/riscv/kernel/process.c