All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [exfat?] KCSAN: data-race in copy_folio_from_iter_atomic / fat12_ent_put (6)
@ 2026-11-23  1:56 syzbot
  2026-11-23  9:02 ` Marco Elver
  0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2026-11-23  1:56 UTC (permalink / raw)
  To: exfat, hirofumi, linkinjeon, linux-kernel, sj1557.seo,
	syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    f802b6558eb8 Merge tag 'xfs-fixes-7.4-rc4' of git://git.ke..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17d97cd5580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
dashboard link: https://syzkaller.appspot.com/bug?extid=c1b4f0f31099fb2324e2
compiler:       Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2b34daaac71e/disk-f802b655.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1e58ec148c51/vmlinux-f802b655.xz
kernel image: https://storage.googleapis.com/syzbot-assets/465e72cdcb06/bzImage-f802b655.xz

AI-generated root cause summary:
fat12_ent_put() in fs/fat/fatent.c modifies FAT table buffer_head data
(fatent->bhs[0]->b_data and, for block-spanning entries, fatent->bhs[1]->b_data)
without acquiring lock_buffer(). Because block device writeback
(blkdev_writepages() -> block_write_full_folio() / write_dirty_buffer()) relies
on lock_buffer() to synchronize buffer modifications against in-flight write
bios, fat12_ent_put() can overwrite bh->b_data concurrently while the block
driver (here loop1 via lo_rw_aio() -> shmem_file_write_iter() ->
copy_folio_from_iter_atomic()) is reading the buffer for an ongoing writeback
I/O.

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

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

==================================================================
BUG: KCSAN: data-race in copy_folio_from_iter_atomic / fat12_ent_put

write to 0xffff8881074bf418 of 1 bytes by task 4984 on cpu 0:
 fat12_ent_put+0x74/0x180 fs/fat/fatent.c:168
 __fat_alloc_clusters+0x571/0xdc0 fs/fat/fatent.c:542
 fat_alloc_chain+0x25/0x30 fs/fat/fatent.c:610
 fat_add_clusters fs/fat/inode.c:109 [inline]
 __fat_get_block fs/fat/inode.c:156 [inline]
 fat_get_block+0x276/0x650 fs/fat/inode.c:191
 __block_write_begin_int+0x459/0x1070 fs/buffer.c:2043
 block_write_begin fs/buffer.c:2157 [inline]
 cont_write_begin+0x4af/0x6c0 fs/buffer.c:2519
 fat_write_begin+0x52/0xf0 fs/fat/inode.c:233
 generic_perform_write+0x198/0x510 mm/filemap.c:4407
 __generic_file_write_iter+0x9e/0x120 mm/filemap.c:4524
 generic_file_write_iter+0x77/0x1f0 mm/filemap.c:4550
 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

read to 0xffff8881074bf400 of 1024 bytes by task 33 on cpu 1:
 memcpy_from_iter lib/iov_iter.c:85 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:306 [inline]
 iterate_and_advance include/linux/iov_iter.h:332 [inline]
 __copy_from_iter lib/iov_iter.c:261 [inline]
 copy_folio_from_iter_atomic+0x73a/0x1050 lib/iov_iter.c:491
 generic_perform_write+0x34b/0x510 mm/filemap.c:4425
 shmem_file_write_iter+0xc5/0xf0 mm/shmem.c:3701
 lo_rw_aio+0x6e9/0x7a0 drivers/block/loop.c:-1
 do_req_filebacked drivers/block/loop.c:-1 [inline]
 loop_handle_cmd drivers/block/loop.c:1847 [inline]
 loop_process_work+0x569/0xb00 drivers/block/loop.c:1882
 loop_workfn+0x31/0x40 drivers/block/loop.c:1906
 process_one_work kernel/workqueue.c:3495 [inline]
 process_scheduled_works+0x582/0xab0 kernel/workqueue.c:3578
 worker_thread+0x56c/0x770 kernel/workqueue.c:3659
 kthread+0x248/0x2a0 kernel/kthread.c:436
 ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 33 Comm: kworker/u8:1 Not tainted syzkaller #0 PREEMPT(lazy) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Workqueue: loop1 loop_workfn
==================================================================
netdevsim netdevsim1 netdevsim3 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim1 netdevsim2 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim1 netdevsim1 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim1 netdevsim0 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
bond0 (unregistering): Released all slaves
hsr_slave_0: left promiscuous mode
hsr_slave_1: left promiscuous mode
veth1_macvtap: left promiscuous mode
veth0_macvtap: left promiscuous mode
veth1_vlan: left promiscuous mode
veth0_vlan: left promiscuous mode
netdevsim netdevsim4 netdevsim3 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim4 netdevsim2 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim4 netdevsim1 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim4 netdevsim0 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
bridge_slave_1: left allmulticast mode
bridge_slave_1: left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
bridge_slave_0: left allmulticast mode
bridge_slave_0: left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
bond0 (unregistering): (slave bond_slave_0): Releasing backup interface
bond_slave_0: left promiscuous mode
bond0 (unregistering): (slave bond_slave_1): Releasing backup interface
bond_slave_1: left promiscuous mode
bond0 (unregistering): Released all slaves
hsr_slave_0: left promiscuous mode
hsr_slave_1: left promiscuous mode
batman_adv: batadv0: Interface deactivated: batadv_slave_0
batman_adv: batadv0: Removing interface: batadv_slave_0
batman_adv: batadv0: Interface deactivated: batadv_slave_1
batman_adv: batadv0: Removing interface: batadv_slave_1
veth1_macvtap: left promiscuous mode
veth0_macvtap: left promiscuous mode
veth1_vlan: left promiscuous mode
veth0_vlan: left promiscuous mode
team0 (unregistering): Port device team_slave_1 removed
team0 (unregistering): Port device team_slave_0 removed


---
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 syzkaller@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [syzbot] [exfat?] KCSAN: data-race in copy_folio_from_iter_atomic / fat12_ent_put (6)
  2026-11-23  1:56 [syzbot] [exfat?] KCSAN: data-race in copy_folio_from_iter_atomic / fat12_ent_put (6) syzbot
@ 2026-11-23  9:02 ` Marco Elver
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Elver @ 2026-11-23  9:02 UTC (permalink / raw)
  To: syzbot
  Cc: exfat, hirofumi, linkinjeon, linux-kernel, sj1557.seo,
	syzkaller-bugs

On Mon, 23 Nov 2026 at 02:56, syzbot
<syzbot+c1b4f0f31099fb2324e2@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    f802b6558eb8 Merge tag 'xfs-fixes-7.4-rc4' of git://git.ke..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=17d97cd5580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
> dashboard link: https://syzkaller.appspot.com/bug?extid=c1b4f0f31099fb2324e2
> compiler:       Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/2b34daaac71e/disk-f802b655.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/1e58ec148c51/vmlinux-f802b655.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/465e72cdcb06/bzImage-f802b655.xz
>
> AI-generated root cause summary:
> fat12_ent_put() in fs/fat/fatent.c modifies FAT table buffer_head data
> (fatent->bhs[0]->b_data and, for block-spanning entries, fatent->bhs[1]->b_data)
> without acquiring lock_buffer(). Because block device writeback
> (blkdev_writepages() -> block_write_full_folio() / write_dirty_buffer()) relies
> on lock_buffer() to synchronize buffer modifications against in-flight write
> bios, fat12_ent_put() can overwrite bh->b_data concurrently while the block
> driver (here loop1 via lo_rw_aio() -> shmem_file_write_iter() ->
> copy_folio_from_iter_atomic()) is reading the buffer for an ongoing writeback
> I/O.

>  CPU 0 (vfs_write -> fat12_ent_put)       CPU 1 (writeback -> loop1 -> shmem)
>
>                                           __block_write_full_folio(folio)
>                                             lock_buffer(bh)
>                                             test_clear_buffer_dirty(bh)
>                                             __bh_submit(bh, REQ_OP_WRITE)
>                                               -> queued to loop1 (BH_Lock held)
>
>  __fat_alloc_clusters()
>    fat_ent_read_block() -> sb_bread()
>      // bh is already uptodate; returns bh without waiting on BH_Lock
>    fat12_ent_put(&fatent, FAT_ENT_EOF)
>      spin_lock(&fat12_entry_lock)
>      // bh->b_data[0x18] = 0xff (low 8 bits of new)
>      *ent12_p[0] = new & 0xff;
>                                           loop_workfn() -> lo_rw_aio()
>                                             shmem_file_write_iter()
>                                               copy_folio_from_iter_atomic()
>                                                 memcpy(dst, bh->b_data, 1024)
>                                                 // reads new ent12_p[0], old ent12_p[1]!
>      // bh->b_data[0x19] = (old & 0xf0) | 0x0f
>      *ent12_p[1] = (*ent12_p[1] & 0xf0) | (new >> 8);
>      spin_unlock(&fat12_entry_lock)
>      mmb_mark_buffer_dirty(bh, ...)
>                                           // Torn 12-bit FAT12 entry written to backing
>                                           // shmem file (or checksum mismatch if
>                                           // BLK_FEAT_STABLE_WRITES is enabled)

> full analysis:  https://syzkaller.appspot.com/x/ai_root_cause?x=c1b4f0f31099fb2324e2
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+c1b4f0f31099fb2324e2@syzkaller.appspotmail.com
>
> ==================================================================
> BUG: KCSAN: data-race in copy_folio_from_iter_atomic / fat12_ent_put
>
> write to 0xffff8881074bf418 of 1 bytes by task 4984 on cpu 0:
>  fat12_ent_put+0x74/0x180 fs/fat/fatent.c:168
>  __fat_alloc_clusters+0x571/0xdc0 fs/fat/fatent.c:542
>  fat_alloc_chain+0x25/0x30 fs/fat/fatent.c:610
>  fat_add_clusters fs/fat/inode.c:109 [inline]
>  __fat_get_block fs/fat/inode.c:156 [inline]
>  fat_get_block+0x276/0x650 fs/fat/inode.c:191
>  __block_write_begin_int+0x459/0x1070 fs/buffer.c:2043
>  block_write_begin fs/buffer.c:2157 [inline]
>  cont_write_begin+0x4af/0x6c0 fs/buffer.c:2519
>  fat_write_begin+0x52/0xf0 fs/fat/inode.c:233
>  generic_perform_write+0x198/0x510 mm/filemap.c:4407
>  __generic_file_write_iter+0x9e/0x120 mm/filemap.c:4524
>  generic_file_write_iter+0x77/0x1f0 mm/filemap.c:4550
>  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
>
> read to 0xffff8881074bf400 of 1024 bytes by task 33 on cpu 1:
>  memcpy_from_iter lib/iov_iter.c:85 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:306 [inline]
>  iterate_and_advance include/linux/iov_iter.h:332 [inline]
>  __copy_from_iter lib/iov_iter.c:261 [inline]
>  copy_folio_from_iter_atomic+0x73a/0x1050 lib/iov_iter.c:491
>  generic_perform_write+0x34b/0x510 mm/filemap.c:4425
>  shmem_file_write_iter+0xc5/0xf0 mm/shmem.c:3701
>  lo_rw_aio+0x6e9/0x7a0 drivers/block/loop.c:-1
>  do_req_filebacked drivers/block/loop.c:-1 [inline]
>  loop_handle_cmd drivers/block/loop.c:1847 [inline]
>  loop_process_work+0x569/0xb00 drivers/block/loop.c:1882
>  loop_workfn+0x31/0x40 drivers/block/loop.c:1906
>  process_one_work kernel/workqueue.c:3495 [inline]
>  process_scheduled_works+0x582/0xab0 kernel/workqueue.c:3578
>  worker_thread+0x56c/0x770 kernel/workqueue.c:3659
>  kthread+0x248/0x2a0 kernel/kthread.c:436
>  ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
>
> Reported by Kernel Concurrency Sanitizer on:
> CPU: 1 UID: 0 PID: 33 Comm: kworker/u8:1 Not tainted syzkaller #0 PREEMPT(lazy)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
> Workqueue: loop1 loop_workfn
> ==================================================================
> netdevsim netdevsim1 netdevsim3 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
> netdevsim netdevsim1 netdevsim2 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
> netdevsim netdevsim1 netdevsim1 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
> netdevsim netdevsim1 netdevsim0 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
> bond0 (unregistering): Released all slaves
> hsr_slave_0: left promiscuous mode
> hsr_slave_1: left promiscuous mode
> veth1_macvtap: left promiscuous mode
> veth0_macvtap: left promiscuous mode
> veth1_vlan: left promiscuous mode
> veth0_vlan: left promiscuous mode
> netdevsim netdevsim4 netdevsim3 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
> netdevsim netdevsim4 netdevsim2 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
> netdevsim netdevsim4 netdevsim1 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
> netdevsim netdevsim4 netdevsim0 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
> bridge_slave_1: left allmulticast mode
> bridge_slave_1: left promiscuous mode
> bridge0: port 2(bridge_slave_1) entered disabled state
> bridge_slave_0: left allmulticast mode
> bridge_slave_0: left promiscuous mode
> bridge0: port 1(bridge_slave_0) entered disabled state
> bond0 (unregistering): (slave bond_slave_0): Releasing backup interface
> bond_slave_0: left promiscuous mode
> bond0 (unregistering): (slave bond_slave_1): Releasing backup interface
> bond_slave_1: left promiscuous mode
> bond0 (unregistering): Released all slaves
> hsr_slave_0: left promiscuous mode
> hsr_slave_1: left promiscuous mode
> batman_adv: batadv0: Interface deactivated: batadv_slave_0
> batman_adv: batadv0: Removing interface: batadv_slave_0
> batman_adv: batadv0: Interface deactivated: batadv_slave_1
> batman_adv: batadv0: Removing interface: batadv_slave_1
> veth1_macvtap: left promiscuous mode
> veth0_macvtap: left promiscuous mode
> veth1_vlan: left promiscuous mode
> veth0_vlan: left promiscuous mode
> team0 (unregistering): Port device team_slave_1 removed
> team0 (unregistering): Port device team_slave_0 removed
>
>
> ---
> 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 syzkaller@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
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/syzkaller-bugs/6b039d4a.a481e175.27cf24.0013.GAE%40google.com.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23  1:56 [syzbot] [exfat?] KCSAN: data-race in copy_folio_from_iter_atomic / fat12_ent_put (6) syzbot
2026-11-23  9:02 ` Marco Elver

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.