android_kernel_samsung_sm8650/fs/verity
Eric Biggers d5feaf8163 UPSTREAM: fsverity: explicitly check for buffer overflow in build_merkle_tree()
The new Merkle tree construction algorithm is a bit fragile in that it
may overflow the 'root_hash' array if the tree actually generated does
not match the calculated tree parameters.

This should never happen unless there is a filesystem bug that allows
the file size to change despite deny_write_access(), or a bug in the
Merkle tree logic itself.  Regardless, it's fairly easy to check for
buffer overflow here, so let's do so.

This is a robustness improvement only; this case is not currently known
to be reachable.  I've added a Fixes tag anyway, since I recommend that
this be included in kernels that have the mentioned commit.

Fixes: 56124d6c87fd ("fsverity: support enabling with tree block size < PAGE_SIZE")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230328041505.110162-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
(cherry picked from commit 39049b69ec9fc125fa1f314165dcc86f72cb72ec)
Change-Id: I248fd8686a806f0099bed1ac83d52362af3e194e
2023-07-07 00:48:25 +00:00
..
enable.c UPSTREAM: fsverity: explicitly check for buffer overflow in build_merkle_tree() 2023-07-07 00:48:25 +00:00
fsverity_private.h fsverity: support verification with tree block size < PAGE_SIZE 2023-02-27 19:45:04 -08:00
hash_algs.c fsverity: replace fsverity_hash_page() with fsverity_hash_block() 2023-02-27 19:45:04 -08:00
init.c fsverity: remove debug messages and CONFIG_FS_VERITY_DEBUG 2023-02-27 19:45:03 -08:00
Kconfig fsverity: remove debug messages and CONFIG_FS_VERITY_DEBUG 2023-02-27 19:45:03 -08:00
Makefile fs-verity: add FS_IOC_READ_VERITY_METADATA ioctl 2021-02-07 14:51:11 -08:00
measure.c fsverity: simplify fsverity_get_digest() 2022-12-19 11:07:03 -08:00
open.c fsverity: support verification with tree block size < PAGE_SIZE 2023-02-27 19:45:04 -08:00
read_metadata.c fs-verity: use kmap_local_page() instead of kmap() 2022-08-19 15:19:55 -07:00
signature.c Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-6.1.y' into android14-6.1 2023-03-15 09:35:23 -07:00
verify.c Merge 6.1.22 into android14-6.1 2023-03-31 08:15:39 +00:00