aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/exceptions_assert.c
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2023-09-13 01:32:05 +0200
committerAlexei Starovoitov <ast@kernel.org>2023-09-16 09:34:21 -0700
commita923819fb2c5be029a69c0ca53239865c9bc05dd (patch)
treed4400ec8da0ad6f62693d291cf55759445515b59 /tools/testing/selftests/bpf/progs/exceptions_assert.c
parentb62bf8a5e9110922f58f6ea8fe747e1759f49e61 (diff)
bpf: Treat first argument as return value for bpf_throw
In case of the default exception callback, change the behavior of bpf_throw, where the passed cookie value is no longer ignored, but is instead the return value of the default exception callback. As such, we need to place restrictions on the value being passed into bpf_throw in such a case, only allowing those permitted by the check_return_code function. Thus, bpf_throw can now control the return value of the program from each call site without having the user install a custom exception callback just to override the return value when an exception is thrown. We also modify the hidden subprog instructions to now move BPF_REG_1 to BPF_REG_0, so as to set the return value before exit in the default callback. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20230912233214.1518551-9-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/exceptions_assert.c')
0 files changed, 0 insertions, 0 deletions