[moderation] [cgroups?] [mm?] KCSAN: data-race in drain_all_stock / try_charge_memcg (2)

3 views
Skip to first unread message

syzbot

unread,
Dec 7, 2023, 7:06:26 PM12/7/23
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: bee0e7762ad2 Merge tag 'for-linus-iommufd' of git://git.ke..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=109feb54e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=ac34c1f29a8029df
dashboard link: https://syzkaller.appspot.com/bug?extid=b09c782ee8ecf3b7ce5a
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
CC: [ak...@linux-foundation.org cgr...@vger.kernel.org han...@cmpxchg.org linux-...@vger.kernel.org linu...@kvack.org mho...@kernel.org muchu...@linux.dev roman.g...@linux.dev shak...@google.com]

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/233be5f65dd2/disk-bee0e776.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/94423738a289/vmlinux-bee0e776.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0b977463fa9a/bzImage-bee0e776.xz

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

==================================================================
BUG: KCSAN: data-race in drain_all_stock / try_charge_memcg

write to 0xffff888237c2a3c0 of 4 bytes by task 6405 on cpu 0:
consume_stock mm/memcontrol.c:2297 [inline]
try_charge_memcg+0xb49/0xd30 mm/memcontrol.c:2703
try_charge mm/memcontrol.c:2884 [inline]
charge_memcg mm/memcontrol.c:7210 [inline]
__mem_cgroup_charge+0x63/0xf0 mm/memcontrol.c:7225
mem_cgroup_charge include/linux/memcontrol.h:684 [inline]
__filemap_add_folio+0x135/0x730 mm/filemap.c:854
filemap_add_folio+0x70/0x160 mm/filemap.c:937
__filemap_get_folio+0x2f1/0x5a0 mm/filemap.c:1926
ext4_da_write_begin+0x2eb/0x550 fs/ext4/inode.c:2891
generic_perform_write+0x1c9/0x410 mm/filemap.c:3918
ext4_buffered_write_iter+0x1f6/0x370 fs/ext4/file.c:299
ext4_file_write_iter+0x297/0xe10
call_write_iter include/linux/fs.h:2020 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x48a/0x790 fs/read_write.c:584
ksys_write+0xeb/0x1a0 fs/read_write.c:637
__do_sys_write fs/read_write.c:649 [inline]
__se_sys_write fs/read_write.c:646 [inline]
__x64_sys_write+0x42/0x50 fs/read_write.c:646
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x63/0x6b

read to 0xffff888237c2a3c0 of 4 bytes by task 6400 on cpu 1:
drain_all_stock+0xd3/0x2d0 mm/memcontrol.c:2405
try_charge_memcg+0x6c5/0xd30 mm/memcontrol.c:2750
obj_cgroup_charge_pages+0xab/0x130 mm/memcontrol.c:3255
__memcg_kmem_charge_page+0x9c/0x170 mm/memcontrol.c:3281
__alloc_pages+0x1bb/0x340 mm/page_alloc.c:4585
alloc_pages_mpol+0xb1/0x1d0 mm/mempolicy.c:2133
alloc_pages+0xe0/0x100 mm/mempolicy.c:2204
vm_area_alloc_pages mm/vmalloc.c:3063 [inline]
__vmalloc_area_node mm/vmalloc.c:3139 [inline]
__vmalloc_node_range+0x6d2/0xea0 mm/vmalloc.c:3320
kvmalloc_node+0x121/0x160 mm/util.c:642
kvmalloc include/linux/slab.h:738 [inline]
xt_alloc_table_info+0x3d/0x80 net/netfilter/x_tables.c:1192
do_replace net/ipv4/netfilter/arp_tables.c:970 [inline]
do_arpt_set_ctl+0x634/0x13b0 net/ipv4/netfilter/arp_tables.c:1421
nf_setsockopt+0x18d/0x1b0 net/netfilter/nf_sockopt.c:101
ip_setsockopt+0xe6/0x100 net/ipv4/ip_sockglue.c:1426
tcp_setsockopt+0x90/0xa0 net/ipv4/tcp.c:3704
sock_common_setsockopt+0x61/0x70 net/core/sock.c:3711
do_sock_setsockopt net/socket.c:2311 [inline]
__sys_setsockopt+0x1d4/0x240 net/socket.c:2334
__do_sys_setsockopt net/socket.c:2343 [inline]
__se_sys_setsockopt net/socket.c:2340 [inline]
__x64_sys_setsockopt+0x66/0x80 net/socket.c:2340
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x63/0x6b

value changed: 0x00000020 -> 0x0000001f

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 6400 Comm: syz-executor.1 Not tainted 6.7.0-rc4-syzkaller-00009-gbee0e7762ad2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
==================================================================


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