In the Linux kernel, the following vulnerability has been resolved:
f2fs: split initial and dynamic conditions for extent_cache
Let's allocate the extent_cache tree without dynamic conditions to avoid a
missing condition causing a panic as below.
# create a file w/ a compressed flag
# disable the compression
# panic while updating extent_cache
F2FS-fs (dm-64): Swapfile: last extent is not aligned to section
F2FS-fs (dm-64): Swapfile (3) is not align to section: 1) creat(), 2) ioctl(F2FS_IOC_SET_PIN_FILE), 3) fallocate(2097152 * N)
Adding 124996k swap on ./swap-file. Priority:0 extents:2 across:17179494468k
==================================================================BUG: KASAN: null-ptr-deref in instrument_atomic_read_write out/common/include/linux/instrumented.h:101[inline]BUG: KASAN: null-ptr-deref in atomic_try_cmpxchg_acquire out/common/include/asm-generic/atomic-instrumented.h:705[inline]BUG: KASAN: null-ptr-deref in queued_write_lock out/common/include/asm-generic/qrwlock.h:92[inline]BUG: KASAN: null-ptr-deref in __raw_write_lock out/common/include/linux/rwlock_api_smp.h:211[inline]BUG: KASAN: null-ptr-deref in _raw_write_lock+0x5a/0x110out/common/kernel/locking/spinlock.c:295Write of size 4 at addr 0000000000000030 by task syz-executor154/3327
CPU: 0 PID: 3327 Comm: syz-executor154 Tainted: G O 5.10.185 #1
Hardware name: emulation qemu-x86/qemu-x86, BIOS 2023.01-21885-gb3cc1cd24d 01/01/2023
Call Trace:__dump_stackout/common/lib/dump_stack.c:77[inline]dump_stack_lvl+0x17e/0x1c4out/common/lib/dump_stack.c:118__kasan_report+0x16c/0x260out/common/mm/kasan/report.c:415kasan_report+0x51/0x70out/common/mm/kasan/report.c:428kasan_check_range+0x2f3/0x340out/common/mm/kasan/generic.c:186__kasan_check_write+0x14/0x20out/common/mm/kasan/shadow.c:37instrument_atomic_read_writeout/common/include/linux/instrumented.h:101[inline]atomic_try_cmpxchg_acquireout/common/include/asm-generic/atomic-instrumented.h:705[inline]queued_write_lockout/common/include/asm-generic/qrwlock.h:92[inline]__raw_write_lockout/common/include/linux/rwlock_api_smp.h:211[inline]_raw_write_lock+0x5a/0x110out/common/kernel/locking/spinlock.c:295__drop_extent_tree+0xdf/0x2f0out/common/fs/f2fs/extent_cache.c:1155f2fs_drop_extent_tree+0x17/0x30out/common/fs/f2fs/extent_cache.c:1172f2fs_insert_rangeout/common/fs/f2fs/file.c:1600[inline]f2fs_fallocate+0x19fd/0x1f40out/common/fs/f2fs/file.c:1764vfs_fallocate+0x514/0x9b0out/common/fs/open.c:310ksys_fallocateout/common/fs/open.c:333[inline]__do_sys_fallocateout/common/fs/open.c:341[inline]__se_sys_fallocateout/common/fs/open.c:339[inline]__x64_sys_fallocate+0xb8/0x100out/common/fs/open.c:339do_syscall_64+0x35/0x50out/common/arch/x86/entry/common.c:46