From: Yonghong Song <yhs@fb.com>
To: Dave Marchevsky <davemarchevsky@fb.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Kernel Team <kernel-team@fb.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>
Subject: Re: [PATCH v2 bpf-next 1/2] bpf: Allow ringbuf memory to be used as map key
Date: Wed, 14 Sep 2022 18:21:26 +0100 [thread overview]
Message-ID: <11249f5c-2179-27c2-6595-59afe88a8bf2@fb.com> (raw)
In-Reply-To: <20220914123600.927632-1-davemarchevsky@fb.com>
On 9/14/22 1:35 PM, Dave Marchevsky wrote:
> This patch adds support for the following pattern:
>
> struct some_data *data = bpf_ringbuf_reserve(&ringbuf, sizeof(struct some_data, 0));
> if (!data)
> return;
> bpf_map_lookup_elem(&another_map, &data->some_field);
> bpf_ringbuf_submit(data);
>
> Currently the verifier does not consider bpf_ringbuf_reserve's
> PTR_TO_MEM | MEM_ALLOC ret type a valid key input to bpf_map_lookup_elem.
> Since PTR_TO_MEM is by definition a valid region of memory, it is safe
> to use it as a key for lookups.
>
> Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
prev parent reply other threads:[~2022-09-14 17:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 12:35 [PATCH v2 bpf-next 1/2] bpf: Allow ringbuf memory to be used as map key Dave Marchevsky
2022-09-14 12:36 ` [PATCH v2 bpf-next 2/2] selftests/bpf: Add test verifying bpf_ringbuf_reserve retval use in map ops Dave Marchevsky
2022-09-15 10:24 ` Alexei Starovoitov
2022-09-19 22:53 ` Yonghong Song
2022-09-19 23:22 ` Kumar Kartikeya Dwivedi
2022-09-20 5:50 ` Yonghong Song
2022-09-22 14:27 ` Dave Marchevsky
2022-09-22 16:59 ` Yonghong Song
2022-09-14 17:21 ` Yonghong Song [this message]
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=11249f5c-2179-27c2-6595-59afe88a8bf2@fb.com \
--to=yhs@fb.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davemarchevsky@fb.com \
--cc=kernel-team@fb.com \
--cc=memxor@gmail.com \
/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