Skip to content

Allow bpf_user_ringbuf_drain() callbacks to return 1

David Vernet bpf lkml 1 version Applied

Status from this message: This series was applied to bpf/bpf.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: Allow bpf_user_ringbuf_drain() callbacks to return 1kernel/bpf/verifier.c+1 -00 repliesApplied
2/2selftests/bpf: Make bpf_user_ringbuf_drain() selftest callback return 1tools/testing/selftests/bpf/progs/user_ringbuf_success.c+2 -20 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Allow bpf_user_ringbuf_drain() callbacks to return 1

The bpf_user_ringbuf_drain() helper function allows a BPF program to specify a callback that is invoked when draining entries from a BPF_MAP_TYPE_USER_RINGBUF ring buffer map. The API is meant to allow the callback to return 0 if it wants to continue draining samples, and 1 if it's done draining. Unfortunately, bpf_user_ringbuf_drain() landed shortly after commit 1bfe26fb0827 ("bpf: Add verifier support for custom callback return range"), which changed the default behavior of callbacks to only support returning 0, and the corresponding necessary change to bpf_user_ringbuf_drain() callbacks was missed.

This patch set fixes this oversight, and updates the user_ringbuf selftests to return 1 in a callback to catch future instances of regression.

This patch set should be merged to the bpf tree.

David Vernet (2):
bpf: Allow bpf_user_ringbuf_drain() callbacks to return 1 selftests/bpf: Make bpf_user_ringbuf_drain() selftest callback return

    1
 kernel/bpf/verifier.c                                    | 1 +
 tools/testing/selftests/bpf/progs/user_ringbuf_success.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.38.0