[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ5hZ+ca-S3cBWmkEtsB4nvQhzR5EA5+Q6En0m+N8um4w@mail.gmail.com>
Date: Tue, 30 Mar 2021 23:58:16 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Pedro Tammela <pctammela@...il.com>
Cc: Pedro Tammela <pctammela@...atatu.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Shuah Khan <shuah@...nel.org>,
Joe Stringer <joe@...ium.io>,
Quentin Monnet <quentin@...valent.com>,
Yang Li <yang.lee@...ux.alibaba.com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'
On Sun, Mar 28, 2021 at 9:12 AM Pedro Tammela <pctammela@...il.com> wrote:
>
> The current code only checks flags in 'bpf_ringbuf_output()'.
>
> Signed-off-by: Pedro Tammela <pctammela@...atatu.com>
> ---
> include/uapi/linux/bpf.h | 8 ++++----
> kernel/bpf/ringbuf.c | 13 +++++++++++--
> tools/include/uapi/linux/bpf.h | 8 ++++----
> 3 files changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 100cb2e4c104..232b5e5dd045 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -4073,7 +4073,7 @@ union bpf_attr {
> * Valid pointer with *size* bytes of memory available; NULL,
> * otherwise.
> *
> - * void bpf_ringbuf_submit(void *data, u64 flags)
> + * int bpf_ringbuf_submit(void *data, u64 flags)
> * Description
> * Submit reserved ring buffer sample, pointed to by *data*.
> * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification
> @@ -4083,9 +4083,9 @@ union bpf_attr {
> * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
> * of new data availability is sent unconditionally.
> * Return
> - * Nothing. Always succeeds.
bpf_ringbuf_submit/bpf_ringbuf_commit has to alway succeed. That's an
explicit and strict rule, which BPF verifier relies on. We cannot bail
out due to unknown flags, because then ringbuf sample won't ever be
submitted and will block all the subsequent samples.
> + * 0 on success, or a negative error in case of failure.
> *
[...]
Powered by blists - more mailing lists