From: KP Singh <kpsingh@kernel.org>
To: bpf@vger.kernel.org
Cc: Andrii Nakryiko <andrii@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Florent Revest <revest@chromium.org>,
Brendan Jackman <jackmanb@chromium.org>
Subject: [PATCH bpf-next v2 1/2] bpf: Allow usage of BPF ringbuffer in sleepable programs
Date: Thu, 4 Feb 2021 19:36:21 +0000 [thread overview]
Message-ID: <20210204193622.3367275-2-kpsingh@kernel.org> (raw)
In-Reply-To: <20210204193622.3367275-1-kpsingh@kernel.org>
The BPF ringbuffer map is pre-allocated and the implementation logic
does not rely on disabling preemption or per-cpu data structures. Using
the BPF ringbuffer sleepable LSM and tracing programs does not trigger
any warnings with DEBUG_ATOMIC_SLEEP, DEBUG_PREEMPT,
PROVE_RCU and PROVE_LOCKING and LOCKDEP enabled.
This allows helpers like bpf_copy_from_user and bpf_ima_inode_hash to
write to the BPF ring buffer from sleepable BPF programs.
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: KP Singh <kpsingh@kernel.org>
---
kernel/bpf/verifier.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 5e09632efddb..4c33b4840438 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -10024,6 +10024,8 @@ static int check_map_prog_compatibility(struct bpf_verifier_env *env,
return -EINVAL;
}
break;
+ case BPF_MAP_TYPE_RINGBUF:
+ break;
default:
verbose(env,
"Sleepable programs can only use array and hash maps\n");
--
2.30.0.365.g02bc693789-goog
next prev parent reply other threads:[~2021-02-04 19:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-04 19:36 [PATCH bpf-next v2 0/2] BPF Ringbuffer + Sleepable Programs KP Singh
2021-02-04 19:36 ` KP Singh [this message]
2021-02-04 20:57 ` [PATCH bpf-next v2 1/2] bpf: Allow usage of BPF ringbuffer in sleepable programs 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210204193622.3367275-2-kpsingh@kernel.org \
--to=kpsingh@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jackmanb@chromium.org \
--cc=revest@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).