[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYtAhch7TrkO6QH6fnQ--9e-U1gRSNw_s_pMG-Jv9PxJw@mail.gmail.com>
Date: Wed, 3 May 2023 11:49:14 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Daniel Rosenberg <drosen@...gle.com>
Cc: bpf@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Jonathan Corbet <corbet@....net>,
Joanne Koong <joannelkoong@...il.com>,
Mykola Lysenko <mykolal@...com>, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v2 1/3] bpf: Allow NULL buffers in bpf_dynptr_slice(_rw)
On Mon, May 1, 2023 at 5:52 PM Daniel Rosenberg <drosen@...gle.com> wrote:
>
> bpf_dynptr_slice(_rw) uses a user provided buffer if it can not provide
> a pointer to a block of contiguous memory. This buffer is unused in the
> case of local dynptrs, and may be unused in other cases as well. There
> is no need to require the buffer, as the kfunc can just return NULL if
> it was needed and not provided.
>
> This adds another kfunc annotation, __opt, which combines with __sz and
> __szk to allow the buffer associated with the size to be NULL. If the
> buffer is NULL, the verifier does not check that the buffer is of
> sufficient size.
>
> Signed-off-by: Daniel Rosenberg <drosen@...gle.com>
> ---
LGTM
Acked-by: Andrii Nakryiko <andrii@...nel.org>
> Documentation/bpf/kfuncs.rst | 23 ++++++++++++++++++++++-
> include/linux/skbuff.h | 2 +-
> kernel/bpf/helpers.c | 30 ++++++++++++++++++------------
> kernel/bpf/verifier.c | 17 +++++++++++++----
> 4 files changed, 54 insertions(+), 18 deletions(-)
>
[...]
Powered by blists - more mailing lists