[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW7n2aZQ6ORA60xQd91rieXtbLbheBzKAhfLiwkRCHBzqA@mail.gmail.com>
Date: Wed, 17 Dec 2025 06:58:43 +0900
From: Song Liu <song@...nel.org>
To: Daniel Hodges <git@...ielhodges.dev>
Cc: bpf@...r.kernel.org, ast@...nel.org, andrii@...nel.org,
daniel@...earbox.net, vadim.fedorenko@...ux.dev, yatsenko@...a.com,
martin.lau@...ux.dev, eddyz87@...il.com, haoluo@...gle.com, jolsa@...nel.org,
john.fastabend@...il.com, kpsingh@...nel.org, sdf@...ichev.me,
yonghong.song@...ux.dev, herbert@...dor.apana.org.au, davem@...emloft.net,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH bpf-next v3 3/6] bpf: Add SHA hash kfunc for cryptographic hashing
On Sun, Dec 7, 2025 at 7:01 PM Daniel Hodges <git@...ielhodges.dev> wrote:
[...]
> +
> + if (!ctx->type->hash)
> + return -EOPNOTSUPP;
> +
> + data_len = __bpf_dynptr_size(data_kern);
> + out_len = __bpf_dynptr_size(out_kern);
> +
> + if (data_len == 0)
> + return -EINVAL;
> +
> + if (!ctx->type->digestsize)
> + return -EOPNOTSUPP;
> +
> + unsigned int digestsize = ctx->type->digestsize(ctx->tfm);
./scripts/checkpatch.pl will complain about this:
WARNING: Missing a blank line after declarations
#109: FILE: kernel/bpf/crypto.c:387:
+ unsigned int digestsize = ctx->type->digestsize(ctx->tfm);
+ if (out_len < digestsize)
Please run ./scripts/checkpatch.pl on all the patches. It also highlights
some other issues, such as we need to update the MAINTAINERS file.
Also, we don't want variable declaration in the middle of a code
block.
> + if (out_len < digestsize)
> + return -EINVAL;
> +
[...]
> static const struct btf_kfunc_id_set crypt_kfunc_set = {
> @@ -383,6 +442,7 @@ static int __init crypto_kfunc_init(void)
> ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_CLS, &crypt_kfunc_set);
> ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_ACT, &crypt_kfunc_set);
> ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_XDP, &crypt_kfunc_set);
> + ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SYSCALL, &crypt_kfunc_set);
This enables all kfuncs in crypt_kfunc_set for BPF_PROG_TYPE_SYSCALL.
We need a clear explanation why this is needed.
Thanks,
Song
Powered by blists - more mailing lists