KCSAN: data-race in pcpu_alloc / pcpu_block_update_hint_alloc

8 views
Skip to first unread message

syzbot

unread,
Nov 7, 2019, 12:04:09 AM11/7/19
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 05f22368 x86, kcsan: Enable KCSAN for x86
git tree: https://github.com/google/ktsan.git kcsan
console output: https://syzkaller.appspot.com/x/log.txt?x=16996ca7600000
kernel config: https://syzkaller.appspot.com/x/.config?x=87d111955f40591f
dashboard link: https://syzkaller.appspot.com/bug?extid=73de055cce044f25787d
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
CC: [core...@netfilter.org da...@davemloft.net f...@strlen.de
kad...@netfilter.org linux-...@vger.kernel.org net...@vger.kernel.org
netfilt...@vger.kernel.org pa...@netfilter.org el...@google.com]

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

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

==================================================================
BUG: KCSAN: data-race in pcpu_alloc / pcpu_block_update_hint_alloc

write to 0xffffffff86046740 of 4 bytes by task 7225 on cpu 0:
pcpu_update_empty_pages mm/percpu.c:575 [inline]
pcpu_block_update_hint_alloc+0x3f6/0x620 mm/percpu.c:891
pcpu_alloc_area+0x372/0x510 mm/percpu.c:1228
pcpu_alloc+0x5b2/0xcf0 mm/percpu.c:1665
__alloc_percpu+0x2e/0x40 mm/percpu.c:1796
xt_percpu_counter_alloc+0x105/0x130 net/netfilter/x_tables.c:1842
find_check_entry.isra.0+0x64/0x590 net/ipv6/netfilter/ip6_tables.c:546
translate_table+0x7a5/0xcd0 net/ipv6/netfilter/ip6_tables.c:734
do_replace net/ipv6/netfilter/ip6_tables.c:1153 [inline]
do_ip6t_set_ctl+0x219/0x311 net/ipv6/netfilter/ip6_tables.c:1681
nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
nf_setsockopt+0x6e/0xb0 net/netfilter/nf_sockopt.c:115
ipv6_setsockopt net/ipv6/ipv6_sockglue.c:949 [inline]
ipv6_setsockopt+0x119/0x130 net/ipv6/ipv6_sockglue.c:933
tcp_setsockopt net/ipv4/tcp.c:3148 [inline]
tcp_setsockopt+0x7c/0xc0 net/ipv4/tcp.c:3142
sock_common_setsockopt+0x67/0x90 net/core/sock.c:3147
__sys_setsockopt+0x1ce/0x370 net/socket.c:2084
__do_sys_setsockopt net/socket.c:2100 [inline]
__se_sys_setsockopt net/socket.c:2097 [inline]
__x64_sys_setsockopt+0x70/0x90 net/socket.c:2097

read to 0xffffffff86046740 of 4 bytes by task 7240 on cpu 1:
pcpu_alloc+0x3b0/0xcf0 mm/percpu.c:1729
__alloc_percpu+0x2e/0x40 mm/percpu.c:1796
alloc_netdev_mqs+0xff/0x860 net/core/dev.c:9201
rtnl_create_link+0x181/0x4f0 net/core/rtnetlink.c:2931
veth_newlink+0x1be/0x620 drivers/net/veth.c:1286
__rtnl_newlink+0xc89/0x1010 net/core/rtnetlink.c:3196
rtnl_newlink+0x63/0x90 net/core/rtnetlink.c:3254
rtnetlink_rcv_msg+0x1d3/0x500 net/core/rtnetlink.c:5223
netlink_rcv_skb+0xb0/0x260 net/netlink/af_netlink.c:2477
rtnetlink_rcv+0x26/0x30 net/core/rtnetlink.c:5241
netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
netlink_unicast+0x354/0x430 net/netlink/af_netlink.c:1328
netlink_sendmsg+0x456/0x770 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:637 [inline]
sock_sendmsg+0x9f/0xc0 net/socket.c:657

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 7240 Comm: syz-executor.5 Not tainted 5.4.0-rc3+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
==================================================================


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Dec 16, 2022, 4:37:11 AM12/16/22
to syzkaller-upst...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: e2ca6ba6ba01 Merge tag 'mm-stable-2022-12-13' of git://git..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11d5df1f880000
kernel config: https://syzkaller.appspot.com/x/.config?x=841cd743118991fe
dashboard link: https://syzkaller.appspot.com/bug?extid=73de055cce044f25787d
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=147094ed880000
CC: [core...@netfilter.org da...@davemloft.net edum...@google.com f...@strlen.de kad...@netfilter.org ku...@kernel.org linux-...@vger.kernel.org net...@vger.kernel.org netfilt...@vger.kernel.org pab...@redhat.com pa...@netfilter.org]

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9d44cff729ca/disk-e2ca6ba6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/0efc384b9282/vmlinux-e2ca6ba6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3ce600b78ccd/bzImage-e2ca6ba6.xz

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

==================================================================
BUG: KCSAN: data-race in pcpu_alloc / pcpu_block_update_hint_alloc

read-write to 0xffffffff870f1c74 of 4 bytes by task 3170 on cpu 0:
pcpu_update_empty_pages mm/percpu.c:602 [inline]
pcpu_block_update_hint_alloc+0x61a/0x6e0 mm/percpu.c:923
pcpu_alloc_area+0x4c0/0x4f0 mm/percpu.c:1258
pcpu_alloc+0x42e/0xf60 mm/percpu.c:1810
__alloc_percpu+0x20/0x30 mm/percpu.c:1943
xt_percpu_counter_alloc+0x6e/0x110 net/netfilter/x_tables.c:1930
find_check_entry net/ipv4/netfilter/ip_tables.c:528 [inline]
translate_table+0x96c/0xfb0 net/ipv4/netfilter/ip_tables.c:718
do_replace net/ipv4/netfilter/ip_tables.c:1136 [inline]
do_ipt_set_ctl+0x13d7/0x16e0 net/ipv4/netfilter/ip_tables.c:1630
nf_setsockopt+0x1a6/0x1c0 net/netfilter/nf_sockopt.c:101
ip_setsockopt+0xe2/0x100 net/ipv4/ip_sockglue.c:1445
tcp_setsockopt+0x8c/0xa0 net/ipv4/tcp.c:3801
sock_common_setsockopt+0x5d/0x70 net/core/sock.c:3663
__sys_setsockopt+0x1c8/0x230 net/socket.c:2246
__do_sys_setsockopt net/socket.c:2257 [inline]
__se_sys_setsockopt net/socket.c:2254 [inline]
__x64_sys_setsockopt+0x62/0x70 net/socket.c:2254
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

read to 0xffffffff870f1c74 of 4 bytes by task 3194 on cpu 1:
pcpu_alloc+0x91d/0xf60 mm/percpu.c:1870
__alloc_percpu+0x20/0x30 mm/percpu.c:1943
xt_percpu_counter_alloc+0x6e/0x110 net/netfilter/x_tables.c:1930
find_check_entry net/ipv4/netfilter/ip_tables.c:528 [inline]
translate_table+0x96c/0xfb0 net/ipv4/netfilter/ip_tables.c:718
do_replace net/ipv4/netfilter/ip_tables.c:1136 [inline]
do_ipt_set_ctl+0x13d7/0x16e0 net/ipv4/netfilter/ip_tables.c:1630
nf_setsockopt+0x1a6/0x1c0 net/netfilter/nf_sockopt.c:101
ip_setsockopt+0xe2/0x100 net/ipv4/ip_sockglue.c:1445
tcp_setsockopt+0x8c/0xa0 net/ipv4/tcp.c:3801
sock_common_setsockopt+0x5d/0x70 net/core/sock.c:3663
__sys_setsockopt+0x1c8/0x230 net/socket.c:2246
__do_sys_setsockopt net/socket.c:2257 [inline]
__se_sys_setsockopt net/socket.c:2254 [inline]
__x64_sys_setsockopt+0x62/0x70 net/socket.c:2254
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

value changed: 0x00000006 -> 0x00000005

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 3194 Comm: syz-executor.1 Not tainted 6.1.0-syzkaller-09941-ge2ca6ba6ba01-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
==================================================================

Reply all
Reply to author
Forward
0 new messages