Re: [PATCH bpf v2 2/2] fsverity: Fix silent truncation in bpf_get_fsverity_digest()

Song Liu <[email protected]> Mon, 3 Aug 2026 22:41:22 -0700
Newsgroups org.kernel.vger.bpf,dev.linux.lists.fsverity,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CAPhsuW5HJbh0LP3FW6-LjYJHvKXYAYuQsvxAX8VuemXS+CAi6A@mail.gmail.com>
On Mon, Aug 3, 2026 at 11:13=E2=80=AFAM Eric Biggers <[email protected]> =
wrote:
>
> bpf_get_fsverity_digest() silently truncates the digest if the provided
> buffer is too small.  This is a footgun, and it doesn't match the
> semantics of the equivalent UAPI (FS_IOC_MEASURE_VERITY).
>
> Change it to return -EOVERFLOW instead, matching FS_IOC_MEASURE_VERITY.
>
> Fixes: 67814c00de31 ("bpf, fsverity: Add kfunc bpf_get_fsverity_digest")
> Cc: [email protected]
> Signed-off-by: Eric Biggers <[email protected]>

Acked-by: Song Liu <[email protected]>