OSDN Git Service

bpf: pass original insn directly to convert_ctx_access
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 12 Jan 2017 10:51:32 +0000 (11:51 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Jan 2017 15:00:31 +0000 (10:00 -0500)
commit6b8cc1d11ef75c5b9c530b3d0d148f3c2dd25f93
tree36f8bae922c1f926d8b34a489fc7e34064dedd76
parentf811b436522d3b9c05302f1785aba61829938a54
bpf: pass original insn directly to convert_ctx_access

Currently, when calling convert_ctx_access() callback for the various
program types, we pass in insn->dst_reg, insn->src_reg, insn->off from
the original instruction. This information is needed to rewrite the
instruction that is based on the user ctx structure into a kernel
representation for the ctx. As we'd like to allow access size beyond
just BPF_W, we'd need also insn->code for that in order to decode the
original access size. Given that, lets just pass insn directly to the
convert_ctx_access() callback and work on that to not clutter the
callback with even more arguments we need to pass when everything is
already contained in insn. So lets go through that once, no functional
change.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/bpf.h
kernel/bpf/verifier.c
kernel/trace/bpf_trace.c
net/core/filter.c