aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/bpf_helpers.h
diff options
context:
space:
mode:
authorJoe Stringer <joe@wand.net.nz>2018-10-02 13:35:35 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2018-10-03 02:53:47 +0200
commitfd978bf7fd312581a7ca454a991f0ffb34c4204b (patch)
tree5f5cd39c65ff6f3839c78ce39684da93e1252cf3 /tools/testing/selftests/bpf/bpf_helpers.h
parentbpf: Macrofy stack state copy (diff)
downloadlinux-dev-fd978bf7fd312581a7ca454a991f0ffb34c4204b.tar.xz
linux-dev-fd978bf7fd312581a7ca454a991f0ffb34c4204b.zip
bpf: Add reference tracking to verifier
Allow helper functions to acquire a reference and return it into a register. Specific pointer types such as the PTR_TO_SOCKET will implicitly represent such a reference. The verifier must ensure that these references are released exactly once in each path through the program. To achieve this, this commit assigns an id to the pointer and tracks it in the 'bpf_func_state', then when the function or program exits, verifies that all of the acquired references have been freed. When the pointer is passed to a function that frees the reference, it is removed from the 'bpf_func_state` and all existing copies of the pointer in registers are marked invalid. Signed-off-by: Joe Stringer <joe@wand.net.nz> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_helpers.h')
0 files changed, 0 insertions, 0 deletions