]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
riscv, bpf: use lw when reading int cpu in BPF_MOV64_PERCPU_REG
authorRadim Krčmář <rkrcmar@ventanamicro.com>
Tue, 12 Aug 2025 09:02:55 +0000 (11:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 17:02:40 +0000 (19:02 +0200)
commitfc11ff5cad08efeb813fec46f72ae3ed74fd6204
treeced7db13c23f70f4713d9ffa35612884538d065a
parentb5176a7d4593b0e96e82b502510e7dde60535a6d
riscv, bpf: use lw when reading int cpu in BPF_MOV64_PERCPU_REG

commit ad5348c765914766a98ad26cf7a8c28d51a16bdd upstream.

emit_ld is wrong, because thread_info.cpu is 32-bit, not xlen-bit wide.
The struct currently has a hole after cpu, so little endian accesses
seemed fine.

Fixes: 19c56d4e5be1 ("riscv, bpf: add internal-only MOV instruction to resolve per-CPU addrs")
Cc: stable@vger.kernel.org
Signed-off-by: Radim Krčmář <rkrcmar@ventanamicro.com>
Reviewed-by: Pu Lehui <pulehui@huawei.com>
Acked-by: Björn Töpel <bjorn@kernel.org>
Tested-by: Björn Töpel <bjorn@rivosinc.com> # QEMU
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20250812090256.757273-3-rkrcmar@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/riscv/net/bpf_jit_comp64.c