kernel_optimize_test/fs
Phillip Lougher bddcce15cd squashfs: add more sanity checks in xattr id lookup
commit 506220d2ba21791314af569211ffd8870b8208fa upstream.

Sysbot has reported a warning where a kmalloc() attempt exceeds the
maximum limit.  This has been identified as corruption of the xattr_ids
count when reading the xattr id lookup table.

This patch adds a number of additional sanity checks to detect this
corruption and others.

1. It checks for a corrupted xattr index 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 would cause an out of bounds read.

2. It checks against corruption of the xattr_ids count.  This can either
   lead to the above kmalloc failure, or a smaller than expected
   table to be read.

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

[phillip@squashfs.org.uk: fix checkpatch issue]
  Link: https://lkml.kernel.org/r/270245655.754655.1612770082682@webmail.123-reg.co.uk

Link: https://lkml.kernel.org/r/20210204130249.4495-5-phillip@squashfs.org.uk
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Reported-by: syzbot+2ccea6339d368360800d@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:55:19 +01:00
..
9p fs: 9p: add generic splice_write file operation 2020-12-01 21:40:47 +01:00
adfs
affs
afs rxrpc: Fix deadlock around release of dst cached on udp tunnel 2021-02-10 09:29:13 +01:00
autofs
befs
bfs bfs: don't use WARNING: string when it's just info. 2021-01-06 14:56:52 +01:00
btrfs btrfs: fix possible free space tree corruption with online conversion 2021-02-03 23:28:40 +01:00
cachefiles cachefiles: Drop superfluous readpages aops NULL check 2021-01-27 11:55:22 +01:00
ceph ceph: fix inode refcount leak when ceph_fill_inode on non-I_NEW inode fails 2021-01-06 14:56:55 +01:00
cifs smb3: fix crediting for compounding when only one request in flight 2021-02-10 09:29:18 +01:00
coda
configfs
cramfs
crypto fscrypt: add fscrypt_is_nokey_name() 2020-12-26 16:02:43 +01:00
debugfs
devpts
dlm
ecryptfs
efivarfs efivarfs: revert "fix memory leak in efivarfs_create()" 2020-11-25 16:55:02 +01:00
efs
erofs erofs: avoid using generic_block_bmap 2020-12-30 11:53:46 +01:00
exfat exfat: Avoid allocating upcase table using kcalloc() 2020-12-26 16:02:38 +01:00
exportfs
ext2
ext4 ext4: fix superblock checksum failure when setting password salt 2021-01-19 18:27:31 +01:00
f2fs f2fs: fix race of pending_pages in decompression 2021-01-06 14:56:54 +01:00
fat
freevxfs
fscache
fuse fuse: fix bad inode 2021-01-09 13:46:24 +01:00
gfs2 gfs2: Fix deadlock between gfs2_{create_inode,inode_lookup} and delete_work_func 2020-12-01 00:21:10 +01:00
hfs
hfsplus
hostfs
hpfs
hugetlbfs mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page 2021-02-10 09:29:20 +01:00
iomap
isofs
jbd2 jbd2: fix kernel-doc markups 2020-11-19 22:38:29 -05:00
jffs2 jffs2: Fix NULL pointer dereference in rp_size fs option parsing 2021-01-06 14:56:49 +01:00
jfs jfs: Fix array index bounds check in dbAdjTree 2020-12-30 11:54:18 +01:00
kernfs kernfs: wire up ->splice_read and ->splice_write 2021-01-27 11:55:29 +01:00
lockd lockd: don't use interval-based rebinding over TCP 2020-12-30 11:53:30 +01:00
minix
nfs pNFS/NFSv4: Improve rejection of out-of-order layouts 2021-02-13 13:55:06 +01:00
nfs_common nfs_common: need lock during iterate through the list 2020-12-30 11:53:45 +01:00
nfsd nfsd: Don't set eof on a truncated READ_PLUS 2021-01-27 11:55:05 +01:00
nilfs2 nilfs2: make splice write available again 2021-02-13 13:55:16 +01:00
nls
notify fanotify: Fix sys_fanotify_mark() on native x86-32 2021-01-17 14:16:59 +01:00
ntfs
ocfs2
omfs
openpromfs
orangefs
overlayfs ovl: implement volatile-specific fsync error behaviour 2021-02-10 09:29:16 +01:00
proc proc_sysctl: fix oops caused by incorrect command parameters 2021-01-27 11:55:14 +01:00
pstore
qnx4
qnx6
quota quota: Don't overflow quota file offsets 2021-01-06 14:56:53 +01:00
ramfs
reiserfs reiserfs: add check for an invalid ih_entry_count 2021-01-06 14:56:52 +01:00
romfs
squashfs squashfs: add more sanity checks in xattr id lookup 2021-02-13 13:55:19 +01:00
sysfs
sysv
tracefs
ubifs ubifs: wbuf: Don't leak kernel memory to flash 2020-12-30 11:54:17 +01:00
udf udf: fix the problem that the disc content is not displayed 2021-02-07 15:37:15 +01:00
ufs
unicode
vboxsf
verity
xfs
zonefs zonefs: select CONFIG_CRC32 2021-01-17 14:17:03 +01:00
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
block_dev.c Revert "block: simplify set_init_blocksize" to regain lost performance 2021-02-03 23:28:45 +01:00
buffer.c
char_dev.c
compat_binfmt_elf.c
coredump.c coredump: fix core_pattern parse error 2020-12-06 10:19:07 -08:00
d_path.c
dax.c
dcache.c
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c epoll: check for events when removing a timed out thread from the wait queue 2020-12-30 11:54:00 +01:00
exec.c exec: Transform exec_update_mutex into a rw_semaphore 2021-01-09 13:46:24 +01:00
fcntl.c fcntl: Fix potential deadlock in send_sig{io, urg}() 2021-01-06 14:56:53 +01:00
fhandle.c
file_table.c
file.c kernel/io_uring: cancel io_uring before task works 2021-01-30 13:55:18 +01:00
filesystems.c
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fs-writeback.c fs: fix lazytime expiration handling in __writeback_single_inode() 2021-01-27 11:54:53 +01:00
fsopen.c
init.c
inode.c fs: Handle I_DONTCACHE in iput_final() instead of generic_drop_inode() 2020-12-30 11:53:49 +01:00
internal.h
io_uring.c io_uring: drop mm/files between task_work_submit 2021-02-13 13:55:01 +01:00
io-wq.c io_uring: always batch cancel in *cancel_files() 2021-02-13 13:54:56 +01:00
io-wq.h io_uring: always batch cancel in *cancel_files() 2021-02-13 13:54:56 +01:00
ioctl.c
Kconfig
Kconfig.binfmt
kernel_read_file.c
libfs.c libfs: fix error cast of negative value in simple_attr_write() 2020-11-22 10:48:22 -08:00
locks.c
Makefile
mbcache.c
mount.h
mpage.c
namei.c
namespace.c umount(2): move the flag validity checks first 2021-01-19 18:27:32 +01:00
no-block.c
nsfs.c
open.c openat2: reject RESOLVE_BENEATH|RESOLVE_IN_ROOT 2020-12-30 11:54:24 +01:00
pipe.c fs/pipe: allow sendfile() to pipe again 2021-01-27 11:55:29 +01:00
pnode.c
pnode.h fs/namespace.c: WARN if mnt_count has become negative 2021-01-06 14:56:54 +01:00
posix_acl.c
proc_namespace.c proc mountinfo: make splice available again 2020-12-30 11:54:02 +01:00
read_write.c
readdir.c
remap_range.c
select.c poll: fix performance regression due to out-of-line __put_user() 2021-01-19 18:27:27 +01:00
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c
sync.c
timerfd.c
userfaultfd.c
utimes.c
xattr.c