BPF Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH bpf-next v2 0/2] BPF Ringbuffer + Sleepable Programs
@ 2021-02-04 19:36 KP Singh
  2021-02-04 19:36 ` [PATCH bpf-next v2 1/2] bpf: Allow usage of BPF ringbuffer in sleepable programs KP Singh
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: KP Singh @ 2021-02-04 19:36 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Florent Revest, Brendan Jackman

# v1 -> v2

- Use ring_buffer__consume without BPF_RB_FORCE_WAKEUP as suggested by
  Andrii
- Use ASSERT_OK_PTR macro

Sleepable programs currently do not have access to any ringbuffer and
since the perf ring buffer is a per-cpu map, it would not be trivial to
enable for sleepable programs. Our specific use-case is to use the
bpf_ima_inode_hash helper and write the hash to a ring buffer from a
sleepable LSM hook.

This series allows the BPF ringbuffer to be used in sleepable programs
(tracing and lsm). Since the helper prototypes were already exposed
the only change required was have the verifier allow
BPF_MAP_TYPE_RINGBUF for sleepable programs. The ima test is also
modified to use the ringbuffer instead of global variables.

Based on dicussions we had over the BPF office hours and enabling all
the possible debug options, I could not find any issues or warnings when
using the ring buffer from sleepable programs.



KP Singh (2):
  bpf: Allow usage of BPF ringbuffer in sleepable programs
  bpf/selftests: Update the IMA test to use BPF ring buffer

 kernel/bpf/verifier.c                         |  2 ++
 .../selftests/bpf/prog_tests/test_ima.c       | 23 ++++++++++---
 tools/testing/selftests/bpf/progs/ima.c       | 33 ++++++++++++++-----
 3 files changed, 45 insertions(+), 13 deletions(-)

-- 
2.30.0.365.g02bc693789-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 19:36 [PATCH bpf-next v2 0/2] BPF Ringbuffer + Sleepable Programs KP Singh
2021-02-04 19:36 ` [PATCH bpf-next v2 1/2] bpf: Allow usage of BPF ringbuffer in sleepable programs KP Singh
2021-02-04 20:57   ` Song Liu
2021-02-05  1:15     ` Andrii Nakryiko
2021-02-04 19:36 ` [PATCH bpf-next v2 2/2] bpf/selftests: Update the IMA test to use BPF ring buffer KP Singh
2021-02-05  7:06 ` [PATCH bpf-next v2 0/2] BPF Ringbuffer + Sleepable Programs Andrii Nakryiko

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git