In the Linux kernel, the following vulnerability has been resolved:
lib/iov_iter: fix to increase non slab folio refcount
When testing EROFS file-backed mount over v9fs on qemu, I encountered a folio UAF issue. The page sanity check reports the following call trace. The root cause is that pages in bvec are coalesced across a folio bounary. The refcount of all non-slab folios should be increased to ensure p9releaspages can put them correctly.
BUG: Bad page state in process md5sum pfn:18300 page: refcount:0 mapcount:0 mapping:00000000d5ad8e4e index:0x60 pfn:0x18300 head: order:0 mapcount:0 entiremapcount:0 nrpagesmapped:0 pincount:0 aops:zerofsaops ino:30b0f dentry name(?):"GoogleExtServicesCn.apk" flags: 0x100000000000041(locked|head|node=0|zone=1) raw: 0100000000000041 dead000000000100 dead000000000122 ffff888014b13bd0 raw: 0000000000000060 0000000000000020 00000000ffffffff 0000000000000000 head: 0100000000000041 dead000000000100 dead000000000122 ffff888014b13bd0 head: 0000000000000060 0000000000000020 00000000ffffffff 0000000000000000 head: 0100000000000000 0000000000000000 ffffffffffffffff 0000000000000000 head: 0000000000000010 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: PAGEFLAGSCHECKATFREE flag(s) set Call Trace: dumpstacklvl+0x53/0x70 badpage+0xd4/0x220 _freepagesok+0x76d/0xf30 _folioput+0x230/0x320 p9releasepages+0x179/0x1f0 p9virtiozcrequest+0xa2a/0x1230 p9clientzcrpc.constprop.0+0x247/0x700 p9clientreadonce+0x34d/0x810 p9clientread+0xf3/0x150 v9fsissueread+0x111/0x360 netfsunbufferedreaditerlocked+0x927/0x1390 netfsunbufferedreaditer+0xa2/0xe0 vfsiocbiterread+0x2c7/0x460 erofsfileiorqsubmit+0x46b/0x5b0 zerofsrunqueue+0x1203/0x21e0 zerofsreadahead+0x579/0x8b0 readpages+0x19f/0xa70 pagecacheraorder+0x4ad/0xb80 filemapreadahead.isra.0+0xe7/0x150 filemapgetpages+0x7aa/0x1890 filemapread+0x320/0xc80 vfsread+0x6c6/0xa30 ksysread+0xf9/0x1c0 dosyscall64+0x9e/0x1a0 entrySYSCALL64after_hwframe+0x71/0x79