From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3] bpf: crypto: snapshot params before string validation
Date: Thu, 30 Apr 2026 16:48:54 +0100 [thread overview]
Message-ID: <c92e701f-33b5-4f93-8e09-86e36e0dba60@linux.dev> (raw)
In-Reply-To: <20260430043404.58221-1-pengpeng@iscas.ac.cn>
On 30/04/2026 05:34, Pengpeng Hou wrote:
> bpf_crypto_ctx_create() receives a BPF-supplied params pointer. The
> current selftests use static initializers, but BPF programs can also
> build the struct in writable BPF memory before calling the kfunc. The
> verifier checks that the memory is accessible; it does not prove that
> the fixed type[] and algo[] fields are NUL-terminated strings.
>
> Copy the params once into a local snapshot, validate the reserved fields
> and fixed-width strings there, and then use the same snapshot for all
> later checks and crypto API calls. This also keeps key_len and authsize
> stable across validation and use if params points at mutable BPF memory.
You didn't answer the question why copying params will somehow help?
>
> Add a selftest that fills algo[] completely and expects -EINVAL.
What happens without the fix?
BPF Crypto follows in-kernel Crypto API as all other in-kernel users.
If there is a problem in crypto - we have to fix it in crypto subsystem.
NAck.
prev parent reply other threads:[~2026-04-30 15:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 4:34 [PATCH v3] bpf: crypto: snapshot params before string validation Pengpeng Hou
2026-04-30 15:48 ` Vadim Fedorenko [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=c92e701f-33b5-4f93-8e09-86e36e0dba60@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=pengpeng@iscas.ac.cn \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=stable@vger.kernel.org \
--cc=yonghong.song@linux.dev \
/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