diff options
author | Xi Wang <xi.wang@gmail.com> | 2015-06-25 05:47:39 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-08-03 09:29:18 -0700 |
commit | 83893dd22e36d0da4b27ed7d8930669d84044d23 (patch) | |
tree | d5398c9aa519dee316886b535657d42b30853307 /drivers/mtd/nand/ndfc.c | |
parent | 2dd7172e36d015013859e5afd3abaeffa92e9397 (diff) |
arm64: bpf: fix out-of-bounds read in bpf2a64_offset()
commit 8eee539ddea09bccae2426f09b0ba6a18b72b691 upstream.
Problems occur when bpf_to or bpf_from has value prog->len - 1 (e.g.,
"Very long jump backwards" in test_bpf where the last instruction is a
jump): since ctx->offset has length prog->len, ctx->offset[bpf_to + 1]
or ctx->offset[bpf_from + 1] will cause an out-of-bounds read, leading
to a bogus jump offset and kernel panic.
This patch moves updating ctx->offset to after calling build_insn(),
and changes indexing to use bpf_to and bpf_from without + 1.
Fixes: e54bcde3d69d ("arm64: eBPF JIT compiler")
Cc: Zi Shen Lim <zlim.lnx@gmail.com>
Cc: Will Deacon <will.deacon@arm.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mtd/nand/ndfc.c')
0 files changed, 0 insertions, 0 deletions