Skip to content
Commit 7284dab0 authored by Naveen N Rao's avatar Naveen N Rao Committed by Greg Kroah-Hartman
Browse files

powerpc/bpf: Fix detecting BPF atomic instructions

[ Upstream commit 419ac821 ]

Commit 91c960b0 ("bpf: Rename BPF_XADD and prepare to encode other
atomics in .imm") converted BPF_XADD to BPF_ATOMIC and added a way to
distinguish instructions based on the immediate field. Existing JIT
implementations were updated to check for the immediate field and to
reject programs utilizing anything more than BPF_ADD (such as BPF_FETCH)
in the immediate field.

However, the check added to powerpc64 JIT did not look at the correct
BPF instruction. Due to this, such programs would be accepted and
incorrectly JIT'ed resulting in soft lockups, as seen with the atomic
bounds test. Fix this by looking at the correct immediate value.

Fixes: 91c960b0

 ("bpf: Rename BPF_XADD and prepare to encode other atomics in .imm")
Reported-by: default avatarJiri Olsa <jolsa@redhat.com>
Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/4117b430ffaa8cd7af042496f87fd7539e4f17fd.1625145429.git.naveen.n.rao@linux.vnet.ibm.com
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 7de053c6
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment