[moderation] [ext4?] KCSAN: data-race in mpage_end_io / shrink_folio_list

0 views
Skip to first unread message

syzbot

unread,
7:06 PM (1 hour ago) 7:06 PM
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 20eef29b7c84 Merge tag 'arc-fixes-7.4' of git://git.kernel..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1637c5be580000
kernel config: https://syzkaller.appspot.com/x/.config?x=1c70adb69e647dcc
dashboard link: https://syzkaller.appspot.com/bug?extid=067a2cea20a0c61c3d05
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [adilger...@dilger.ca ja...@suse.cz liba...@linux.alibaba.com linux...@vger.kernel.org linux-...@vger.kernel.org oja...@linux.ibm.com rites...@gmail.com ty...@mit.edu yi.z...@huawei.com]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/322d6104232e/disk-20eef29b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6355393bc114/vmlinux-20eef29b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2d4bcbb4bcc7/bzImage-20eef29b.xz

AI-generated root cause summary:
`shrink_folio_list()` in `mm/vmscan.c` removes a folio from its isolated local
list via `list_del(&folio->lru)` before attempting `folio_trylock(folio)`,
writing `LIST_POISON1` to `folio->lru.next` with a plain store even when the
folio is still locked for ongoing read I/O. Concurrently, `mpage_end_io()` ->
`__read_end_io()` iterates the bio's folios via `bio_for_each_folio_all()` and
calls `bvec_folio()` -> `page_folio()` -> `_compound_head()`, which reads
`page->compound_info` via `READ_ONCE()`. Because `page->compound_info` and
`folio->lru.next` share the same 8-byte union slot at offset 8 of `struct page`
/ `struct folio`, KCSAN reports a data race, though it is benign because bit 0
(`PageTail()`) remains 0 across all `list_head` and `LIST_POISON1` values.

full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=067a2cea20a0c61c3d05

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+067a2c...@syzkaller.appspotmail.com

==================================================================
BUG: KCSAN: data-race in mpage_end_io / shrink_folio_list

read (marked) to 0xffffea00041fe048 of 8 bytes by interrupt on cpu 1:
_compound_head include/linux/page-flags.h:221 [inline]
bvec_folio include/linux/bvec.h:89 [inline]
bio_first_folio include/linux/bio.h:291 [inline]
bio_next_folio include/linux/bio.h:309 [inline]
__read_end_io fs/ext4/readpage.c:65 [inline]
mpage_end_io+0x262/0x4a0 fs/ext4/readpage.c:113
bio_endio+0x3ef/0x5e0 block/bio.c:1908
blk_update_request+0x365/0x780 block/blk-mq.c:1036
scsi_end_request+0x48/0x3a0 drivers/scsi/scsi_lib.c:671
scsi_io_completion+0x7f/0x1d0 drivers/scsi/scsi_lib.c:1125
scsi_finish_command+0x233/0x250 drivers/scsi/scsi.c:198
scsi_complete+0x165/0x660 drivers/scsi/scsi_lib.c:1604
blk_complete_reqs block/blk-mq.c:1242 [inline]
blk_done_softirq+0x8d/0xc0 block/blk-mq.c:1247
handle_softirqs+0x109/0x310 kernel/softirq.c:669
__do_softirq kernel/softirq.c:703 [inline]
invoke_softirq kernel/softirq.c:542 [inline]
__irq_exit_rcu+0x40/0xf0 kernel/softirq.c:786
common_interrupt+0x83/0x90 arch/x86/kernel/irq.c:273
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:665
__preempt_count_dec_and_test arch/x86/include/asm/preempt.h:123 [inline]
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline]
_raw_spin_unlock_irqrestore+0x1a/0x30 kernel/locking/spinlock.c:221
__unix_dgram_recvmsg+0x39c/0x920 net/unix/af_unix.c:2620
unix_dgram_recvmsg+0x7e/0x90 net/unix/af_unix.c:2694
sock_recvmsg_nosec+0xc2/0xf0 net/socket.c:1154
____sys_recvmsg+0x23f/0x250 net/socket.c:2931
___sys_recvmsg+0x156/0x3a0 net/socket.c:2978
do_recvmmsg+0x1e4/0x550 net/socket.c:3073
__sys_recvmmsg net/socket.c:3147 [inline]
__do_sys_recvmmsg net/socket.c:3170 [inline]
__se_sys_recvmmsg net/socket.c:3163 [inline]
__x64_sys_recvmmsg+0xe5/0x170 net/socket.c:3163
x64_sys_call+0x77f/0x2550 arch/x86/include/generated/asm/syscalls_64.h:300
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f

write to 0xffffea00041fe048 of 8 bytes by task 19307 on cpu 0:
list_del include/linux/list.h:276 [inline]
shrink_folio_list+0x3cc/0x2d70 mm/vmscan.c:1190
evict_folios+0x1fa4/0x2990 mm/vmscan.c:5097
try_to_shrink_lruvec+0x9fb/0xd60 mm/vmscan.c:5271
shrink_one+0x1b4/0x940 mm/vmscan.c:5318
shrink_many mm/vmscan.c:5381 [inline]
lru_gen_shrink_node mm/vmscan.c:5459 [inline]
shrink_node+0x4034/0x4600 mm/vmscan.c:6465
__node_reclaim+0xf0/0x3e0 mm/vmscan.c:8012
user_proactive_reclaim+0x595/0x700 mm/vmscan.c:8202
reclaim_store+0x4a/0x70 mm/vmscan.c:8268
dev_attr_store+0x4a/0x70 drivers/base/core.c:2509
sysfs_kf_write+0xfe/0x120 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x1d2/0x2e0 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:575 [inline]
vfs_write+0x57a/0x9b0 fs/read_write.c:667
ksys_write+0xdc/0x1a0 fs/read_write.c:719
__do_sys_write fs/read_write.c:730 [inline]
__se_sys_write fs/read_write.c:727 [inline]
__x64_sys_write+0x40/0x50 fs/read_write.c:727
x64_sys_call+0x154e/0x2550 arch/x86/include/generated/asm/syscalls_64.h:2
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 19307 Comm: syz.3.4152 Not tainted syzkaller #0 PREEMPT(lazy)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages