RISC-V: hwprobe: Fix vDSO SIGSEGV
authorAndrew Jones <ajones@ventanamicro.com>
Tue, 10 Oct 2023 16:51:02 +0000 (18:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:19:49 +0000 (17:19 +0000)
commit81e25896ccf56f89be0a0e83a5f5def6873a014b
tree6a3b2af5430eea0e7f5965f6c55aa18bf276a185
parentcc2e7ebbeb1d0601f7f3c8d93b78fcc03a95e44a
RISC-V: hwprobe: Fix vDSO SIGSEGV

[ Upstream commit e1c05b3bf80f829ced464bdca90f1dfa96e8d251 ]

A hwprobe pair key is signed, but the hwprobe vDSO function was
only checking that the upper bound was valid. In order to help
avoid this type of problem in the future, and in anticipation of
this check becoming more complicated with sparse keys, introduce
and use a "key is valid" predicate function for the check.

Fixes: aa5af0aa90ba ("RISC-V: Add hwprobe vDSO function and data")
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Evan Green <evan@rivosinc.com>
Link: https://lore.kernel.org/r/20231010165101.14942-2-ajones@ventanamicro.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/include/asm/hwprobe.h
arch/riscv/kernel/vdso/hwprobe.c