android_kernel_motorola_sm6225/fs/squashfs
Phillip Lougher e5099c0e85 squashfs: add more sanity checks in id lookup
commit f37aa4c7366e23f91b81d00bafd6a7ab54e4a381 upstream.

Sysbot has reported a number of "slab-out-of-bounds reads" and
"use-after-free read" errors which has been identified as being caused
by a corrupted index value read from the inode.  This could be because
the metadata block is uncompressed, or because the "compression" bit has
been corrupted (turning a compressed block into an uncompressed block).

This patch adds additional sanity checks to detect this, and the
following corruption.

1. It checks against corruption of the ids count.  This can either
   lead to a larger table to be read, or a smaller than expected
   table to be read.

   In the case of a too large ids count, this would often have been
   trapped by the existing sanity checks, but this patch introduces
   a more exact check, which can identify too small values.

2. It checks the contents of the index table for corruption.

Link: https://lkml.kernel.org/r/20210204130249.4495-3-phillip@squashfs.org.uk
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Reported-by: syzbot+b06d57ba83f604522af2@syzkaller.appspotmail.com
Reported-by: syzbot+c021ba012da41ee9807c@syzkaller.appspotmail.com
Reported-by: syzbot+5024636e8b5fd19f0f19@syzkaller.appspotmail.com
Reported-by: syzbot+bcbc661df46657d0fa4f@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-13 13:51:15 +01:00
..
block.c squashfs: more metadata hardening 2018-07-30 17:29:17 -07:00
cache.c squashfs: be more careful about metadata corruption 2018-07-29 12:44:46 -07:00
decompressor.c squashfs: Add zstd support 2017-09-08 19:33:25 -07:00
decompressor.h squashfs: Add zstd support 2017-09-08 19:33:25 -07:00
decompressor_multi.c
decompressor_multi_percpu.c
decompressor_single.c
dir.c romfs, squashfs: switch to ->iterate_shared() 2016-05-09 11:41:15 -04:00
export.c
file.c Squashfs: Compute expected length from inode size rather than block length 2018-08-02 09:34:02 -07:00
file_cache.c Squashfs: Compute expected length from inode size rather than block length 2018-08-02 09:34:02 -07:00
file_direct.c Squashfs: Compute expected length from inode size rather than block length 2018-08-02 09:34:02 -07:00
fragment.c squashfs: more metadata hardening 2018-08-02 09:32:23 -07:00
id.c squashfs: add more sanity checks in id lookup 2021-02-13 13:51:15 +01:00
inode.c vfs: Remove {get,set,remove}xattr inode operations 2016-10-07 21:48:36 -04:00
Kconfig squashfs: Add zstd support 2017-09-08 19:33:25 -07:00
lz4_wrapper.c fs/pstore: fs/squashfs: change usage of LZ4 to work with new LZ4 version 2017-02-24 17:46:57 -08:00
lzo_wrapper.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namei.c vfs: Remove {get,set,remove}xattr inode operations 2016-10-07 21:48:36 -04:00
page_actor.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
page_actor.h mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
squashfs.h Squashfs: Compute expected length from inode size rather than block length 2018-08-02 09:34:02 -07:00
squashfs_fs.h squashfs: be more careful about metadata corruption 2018-07-29 12:44:46 -07:00
squashfs_fs_i.h
squashfs_fs_sb.h squashfs: add more sanity checks in id lookup 2021-02-13 13:51:15 +01:00
super.c squashfs: add more sanity checks in id lookup 2021-02-13 13:51:15 +01:00
symlink.c vfs: remove ".readlink = generic_readlink" assignments 2016-12-09 16:45:04 +01:00
xattr.c xattr_handler: pass dentry and inode as separate arguments of ->get() 2016-04-10 20:48:24 -04:00
xattr.h squashfs: add more sanity checks in id lookup 2021-02-13 13:51:15 +01:00
xattr_id.c
xz_wrapper.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
zlib_wrapper.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
zstd_wrapper.c squashfs: Add zstd support 2017-09-08 19:33:25 -07:00