]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fsverity: Fix silent truncation in bpf_get_fsverity_digest()
authorEric Biggers <ebiggers@kernel.org>
Mon, 3 Aug 2026 18:12:32 +0000 (11:12 -0700)
committerKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 4 Aug 2026 07:24:23 +0000 (09:24 +0200)
commit7c68ed5c5ad4c185ea9654f5d8ee36560277b7dd
treeda04d64e72a3032b5e25b45f57b984d8057ba858
parent3e8ec7c0387273329374f5c7bd61f5f38af71fe1
fsverity: Fix silent truncation in bpf_get_fsverity_digest()

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")
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/bpf/20260803181232.14743-3-ebiggers@kernel.org
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
fs/verity/measure.c