]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: allow b/h/w/dw access for bpf's cb in ctx
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 12 Jan 2017 10:51:33 +0000 (11:51 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Jan 2017 15:00:31 +0000 (10:00 -0500)
commit54c32e81b8e0e99eb3d51753a29e290202510ae3
tree352050f1913fae4683e564607374618338c1c773
parenta2cc7267df0b46d6d89d57e28ba66e8e0babc526
bpf: allow b/h/w/dw access for bpf's cb in ctx

When structs are used to store temporary state in cb[] buffer that is
used with programs and among tail calls, then the generated code will
not always access the buffer in bpf_w chunks. We can ease programming
of it and let this act more natural by allowing for aligned b/h/w/dw
sized access for cb[] ctx member. Various test cases are attached as
well for the selftest suite. Potentially, this can also be reused for
other program types to pass data around.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/verifier.c
net/core/filter.c
tools/testing/selftests/bpf/test_verifier.c