mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 00:48:50 +00:00
810ee43d9c
Syzkiller reports a "KMSAN: uninit-value in pick_link" bug. This is caused by an uninitialised page, which is ultimately caused by a corrupted symbolic link size read from disk. The reason why the corrupted symlink size causes an uninitialised page is due to the following sequence of events: 1. squashfs_read_inode() is called to read the symbolic link from disk. This assigns the corrupted value 3875536935 to inode->i_size. 2. Later squashfs_symlink_read_folio() is called, which assigns this corrupted value to the length variable, which being a signed int, overflows producing a negative number. 3. The following loop that fills in the page contents checks that the copied bytes is less than length, which being negative means the loop is skipped, producing an uninitialised page. This patch adds a sanity check which checks that the symbolic link size is not larger than expected. -- Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk> Link: https://lore.kernel.org/r/20240811232821.13903-1-phillip@squashfs.org.uk Reported-by: Lizhi Xu <lizhi.xu@windriver.com> Reported-by: syzbot+24ac24ff58dc5b0d26b9@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/000000000000a90e8c061e86a76b@google.com/ V2: fix spelling mistake. Signed-off-by: Christian Brauner <brauner@kernel.org> |
||
---|---|---|
.. | ||
block.c | ||
cache.c | ||
decompressor.c | ||
decompressor.h | ||
decompressor_multi.c | ||
decompressor_multi_percpu.c | ||
decompressor_single.c | ||
dir.c | ||
export.c | ||
file.c | ||
file_cache.c | ||
file_direct.c | ||
fragment.c | ||
id.c | ||
inode.c | ||
Kconfig | ||
lz4_wrapper.c | ||
lzo_wrapper.c | ||
Makefile | ||
namei.c | ||
page_actor.c | ||
page_actor.h | ||
squashfs.h | ||
squashfs_fs.h | ||
squashfs_fs_i.h | ||
squashfs_fs_sb.h | ||
super.c | ||
symlink.c | ||
xattr.c | ||
xattr.h | ||
xattr_id.c | ||
xz_wrapper.c | ||
zlib_wrapper.c | ||
zstd_wrapper.c |