diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2018-07-19 18:18:35 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-07-19 16:08:06 -0700 |
commit | b9c1e60e7bf4e64ac1b4f4d6d593f0bb57886973 (patch) | |
tree | 9ef2403b732894cecd3bc6c8242af1a7ea15fdaa /fs/adfs | |
parent | f39f28ff82c14b4f628973d9bba835195a71d437 (diff) | |
download | linux-b9c1e60e7bf4e64ac1b4f4d6d593f0bb57886973.tar.gz linux-b9c1e60e7bf4e64ac1b4f4d6d593f0bb57886973.tar.bz2 linux-b9c1e60e7bf4e64ac1b4f4d6d593f0bb57886973.zip |
bpf, ppc64: fix unexpected r0=0 exit path inside bpf_xadd
None of the JITs is allowed to implement exit paths from the BPF
insn mappings other than BPF_JMP | BPF_EXIT. In the BPF core code
we have a couple of rewrites in eBPF (e.g. LD_ABS / LD_IND) and
in eBPF to cBPF translation to retain old existing behavior where
exceptions may occur; they are also tightly controlled by the
verifier where it disallows some of the features such as BPF to
BPF calls when legacy LD_ABS / LD_IND ops are present in the BPF
program. During recent review of all BPF_XADD JIT implementations
I noticed that the ppc64 one is buggy in that it contains two
jumps to exit paths. This is problematic as this can bypass verifier
expectations e.g. pointed out in commit f6b1b3bf0d5f ("bpf: fix
subprog verifier bypass by div/mod by 0 exception"). The first
exit path is obsoleted by the fix in ca36960211eb ("bpf: allow xadd
only on aligned memory") anyway, and for the second one we need to
do a fetch, add and store loop if the reservation from lwarx/ldarx
was lost in the meantime.
Fixes: 156d0e290e96 ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF")
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
Tested-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'fs/adfs')
0 files changed, 0 insertions, 0 deletions