From: Eric Biggers <ebiggers@kernel.org>
To: Song Liu <song@kernel.org>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
linux-crypto@vger.kernel.org,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>,
Yonghong Song <yonghong.song@linux.dev>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH bpf-next] bpf: Use sha1() instead of sha1_transform() in bpf_prog_calc_tag()
Date: Mon, 11 Aug 2025 21:15:45 -0700 [thread overview]
Message-ID: <20250812041545.GH1268@sol> (raw)
In-Reply-To: <CAPhsuW7shC-cN7nGLiaVcAAtxbmet45R0XZ8zRS2P2H5Bom+dw@mail.gmail.com>
On Mon, Aug 11, 2025 at 05:57:58PM -0700, Song Liu wrote:
> On Mon, Aug 11, 2025 at 1:17 PM Eric Biggers <ebiggers@kernel.org> wrote:
> >
> > Now that there's a proper SHA-1 library API, just use that instead of
> > the low-level SHA-1 compression function. This eliminates the need for
> > bpf_prog_calc_tag() to implement the SHA-1 padding itself. No
> > functional change; the computed tags remain the same.
> >
> > Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> > ---
> > include/linux/filter.h | 6 -----
> > kernel/bpf/core.c | 50 ++++++++----------------------------------
> > 2 files changed, 9 insertions(+), 47 deletions(-)
>
> Nice clean up!
>
> It appears this patch changes the sha1 of some programs, but not
> some other programs. For example, sha1 of program
> test_task_kfunc_flavor_relo_not_found from task_kfunc_success.bpf.o
> stays the same before and after the patch, while other programs from
> task_kfunc_success.bpf.o have different sha1 after the patch.
>
> Is this expected?
I don't see how the behavior could have changed. The previous code
calculated the SHA-1 value correctly, just in a hard-to-read way. Is it
possible that those BPF programs changed between your two tests? Did
you recompile them?
- Eric
next prev parent reply other threads:[~2025-08-12 4:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 20:16 [PATCH bpf-next] bpf: Use sha1() instead of sha1_transform() in bpf_prog_calc_tag() Eric Biggers
2025-08-11 22:16 ` Eduard Zingerman
2025-08-12 0:57 ` Song Liu
2025-08-12 4:15 ` Eric Biggers [this message]
2025-08-22 18:40 ` 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=20250812041545.GH1268@sol \
--to=ebiggers@kernel.org \
--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-crypto@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@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