[moderation] [cgroups?] [mm?] KCSAN: data-race in __mod_memcg_state / mem_cgroup_css_rstat_flush

3 views
Skip to first unread message

syzbot

unread,
Feb 11, 2024, 6:53:16 AMFeb 11
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 7521f258ea30 Merge tag 'mm-hotfixes-stable-2024-02-10-11-1..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1587e442180000
kernel config: https://syzkaller.appspot.com/x/.config?x=3cd0dc1b46a5bc5c
dashboard link: https://syzkaller.appspot.com/bug?extid=d265d3714ae3845b0c0c
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/13bab0f1fd7a/disk-7521f258.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b8ba502ce3fb/vmlinux-7521f258.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1a60cc363ef5/bzImage-7521f258.xz

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

==================================================================
BUG: KCSAN: data-race in __mod_memcg_state / mem_cgroup_css_rstat_flush

write to 0xffffe8ffffd4d480 of 4 bytes by task 10545 on cpu 0:
mem_cgroup_css_rstat_flush+0x4ea/0x540 mm/memcontrol.c:5845
cgroup_rstat_flush_locked+0x86b/0x9a0 kernel/cgroup/rstat.c:245
cgroup_rstat_flush+0x26/0x40 kernel/cgroup/rstat.c:277
do_flush_stats mm/memcontrol.c:744 [inline]
mem_cgroup_flush_stats+0xb2/0xc0 mm/memcontrol.c:765
prepare_scan_control mm/vmscan.c:2226 [inline]
shrink_node+0x314/0x15d0 mm/vmscan.c:5900
shrink_zones mm/vmscan.c:6141 [inline]
do_try_to_free_pages+0x43d/0xce0 mm/vmscan.c:6203
try_to_free_mem_cgroup_pages+0x1e2/0x480 mm/vmscan.c:6518
try_charge_memcg+0x280/0xd20 mm/memcontrol.c:2782
obj_cgroup_charge_pages+0xbd/0x1c0 mm/memcontrol.c:3301
__memcg_kmem_charge_page+0x9c/0x170 mm/memcontrol.c:3327
__alloc_pages+0x1bb/0x340 mm/page_alloc.c:4584
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+0x6ee/0xec0 mm/vmalloc.c:3320
kvmalloc_node+0x121/0x170 mm/util.c:642
kvmalloc include/linux/slab.h:728 [inline]
xt_alloc_table_info+0x3d/0x80 net/netfilter/x_tables.c:1192
do_replace net/ipv6/netfilter/ip6_tables.c:1139 [inline]
do_ip6t_set_ctl+0x633/0x1800 net/ipv6/netfilter/ip6_tables.c:1636
nf_setsockopt+0x18d/0x1b0 net/netfilter/nf_sockopt.c:101
ipv6_setsockopt+0x11c/0x130 net/ipv6/ipv6_sockglue.c:997
sctp_setsockopt+0x13d/0xe90 net/sctp/socket.c:4586
sock_common_setsockopt+0x61/0x70 net/core/sock.c:3716
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:52 [inline]
do_syscall_64+0xcd/0x1d0 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b

read-write to 0xffffe8ffffd4d480 of 4 bytes by task 17350 on cpu 1:
memcg_rstat_updated mm/memcontrol.c:724 [inline]
__mod_memcg_state+0x10f/0x170 mm/memcontrol.c:823
mod_memcg_state include/linux/memcontrol.h:1003 [inline]
memcg_account_kmem mm/memcontrol.c:3257 [inline]
obj_cgroup_uncharge_pages+0xe2/0x200 mm/memcontrol.c:3279
__memcg_kmem_uncharge_page+0x53/0x100 mm/memcontrol.c:3353
free_pages_prepare mm/page_alloc.c:1097 [inline]
free_unref_page_prepare+0x61/0x2c0 mm/page_alloc.c:2346
free_unref_page+0x34/0x170 mm/page_alloc.c:2486
vfree+0x211/0x390 mm/vmalloc.c:2842
kvfree+0x26/0x40 mm/util.c:661
bpf_map_area_free+0x15/0x20 kernel/bpf/syscall.c:323
htab_map_free+0x4ea/0x620 kernel/bpf/hashtab.c:1549
bpf_map_free_deferred+0xaa/0x140 kernel/bpf/syscall.c:700
process_one_work kernel/workqueue.c:2633 [inline]
process_scheduled_works+0x5b8/0xa40 kernel/workqueue.c:2706
worker_thread+0x525/0x730 kernel/workqueue.c:2787
kthread+0x1d7/0x210 kernel/kthread.c:388
ret_from_fork+0x48/0x60 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242

value changed: 0x0000001a -> 0x00000000

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 17350 Comm: kworker/u4:10 Not tainted 6.8.0-rc3-syzkaller-00317-g7521f258ea30 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Workqueue: events_unbound bpf_map_free_deferred

==================================================================


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