Commit 6e44b9f3 authored by David Vernet's avatar David Vernet Committed by Andrii Nakryiko

selftests/bpf: Make bpf_user_ringbuf_drain() selftest callback return 1

In commit 1bfe26fb ("bpf: Add verifier support for custom callback
return range"), the verifier was updated to require callbacks to BPF
helpers to explicitly specify the range of values that can be returned.
bpf_user_ringbuf_drain() was merged after this in commit 20571567
("bpf: Add bpf_user_ringbuf_drain() helper"), and this change in default
behavior was missed. This patch updates the BPF_MAP_TYPE_USER_RINGBUF
selftests to also return 1 from a bpf_user_ringbuf_drain() callback so
as to properly test this going forward.
Signed-off-by: default avatarDavid Vernet <void@manifault.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221012232015.1510043-3-void@manifault.com
parent c92a7a52
...@@ -47,14 +47,14 @@ record_sample(struct bpf_dynptr *dynptr, void *context) ...@@ -47,14 +47,14 @@ record_sample(struct bpf_dynptr *dynptr, void *context)
if (status) { if (status) {
bpf_printk("bpf_dynptr_read() failed: %d\n", status); bpf_printk("bpf_dynptr_read() failed: %d\n", status);
err = 1; err = 1;
return 0; return 1;
} }
} else { } else {
sample = bpf_dynptr_data(dynptr, 0, sizeof(*sample)); sample = bpf_dynptr_data(dynptr, 0, sizeof(*sample));
if (!sample) { if (!sample) {
bpf_printk("Unexpectedly failed to get sample\n"); bpf_printk("Unexpectedly failed to get sample\n");
err = 2; err = 2;
return 0; return 1;
} }
stack_sample = *sample; stack_sample = *sample;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment