In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to do sanity check on iextraisize in is_alive()
syzbot found a f2fs bug:
BUG: KASAN: slab-out-of-bounds in datablkaddr fs/f2fs/f2fs.h:2891 [inline] BUG: KASAN: slab-out-of-bounds in isalive fs/f2fs/gc.c:1117 [inline] BUG: KASAN: slab-out-of-bounds in gcdatasegment fs/f2fs/gc.c:1520 [inline] BUG: KASAN: slab-out-of-bounds in dogarbagecollect+0x386a/0x3df0 fs/f2fs/gc.c:1734 Read of size 4 at addr ffff888076557568 by task kworker/u4:3/52
CPU: 1 PID: 52 Comm: kworker/u4:3 Not tainted 6.1.0-rc4-syzkaller-00362-gfef7fd48922d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: writeback wbworkfn (flush-7:0) Call Trace: <TASK> _dumpstack lib/dumpstack.c:88 [inline] dumpstacklvl+0xcd/0x134 lib/dumpstack.c:106 printaddressdescription mm/kasan/report.c:284 [inline] printreport+0x15e/0x45d mm/kasan/report.c:395 kasanreport+0xbb/0x1f0 mm/kasan/report.c:495 datablkaddr fs/f2fs/f2fs.h:2891 [inline] isalive fs/f2fs/gc.c:1117 [inline] gcdatasegment fs/f2fs/gc.c:1520 [inline] dogarbagecollect+0x386a/0x3df0 fs/f2fs/gc.c:1734 f2fsgc+0x88c/0x20a0 fs/f2fs/gc.c:1831 f2fsbalancefs+0x544/0x6b0 fs/f2fs/segment.c:410 f2fswriteinode+0x57e/0xe20 fs/f2fs/inode.c:753 writeinode fs/fs-writeback.c:1440 [inline] _writebacksingleinode+0xcfc/0x1440 fs/fs-writeback.c:1652 writebacksbinodes+0x54d/0xf90 fs/fs-writeback.c:1870 wbwriteback+0x2c5/0xd70 fs/fs-writeback.c:2044 wbdowriteback fs/fs-writeback.c:2187 [inline] wbworkfn+0x2dc/0x12f0 fs/fs-writeback.c:2227 processonework+0x9bf/0x1710 kernel/workqueue.c:2289 workerthread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 retfromfork+0x1f/0x30 arch/x86/entry/entry64.S:306
The root cause is that we forgot to do sanity check on .iextraisize in below path, result in accessing invalid address later, fix it. - gcdatasegment - isalive - datablkaddr - offsetinaddr