KASAN: use-after-free Read in netdevice_event_work_handler

9 views
Skip to first unread message

syzbot

unread,
Sep 5, 2020, 10:15:24 AM9/5/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: c37da90e Linux 4.19.143
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15b13b71900000
kernel config: https://syzkaller.appspot.com/x/.config?x=d162ec57805c4e4d
dashboard link: https://syzkaller.appspot.com/bug?extid=f65ada862fcd638b0ca5
compiler: gcc (GCC) 10.1.0-syz 20200507

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

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

==================================================================
BUG: KASAN: use-after-free in dev_put include/linux/netdevice.h:3662 [inline]
BUG: KASAN: use-after-free in netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:626
Read of size 8 at addr ffff88804ae19380 by task kworker/u4:5/7798
ebt_among: src integrity fail: 300

CPU: 0 PID: 7798 Comm: kworker/u4:5 Not tainted 4.19.143-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: gid-cache-wq netdevice_event_work_handler
Call Trace:
ebt_among: src integrity fail: 300
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
dev_put include/linux/netdevice.h:3662 [inline]
netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:626
process_one_work+0x864/0x1570 kernel/workqueue.c:2155
worker_thread+0x64c/0x1130 kernel/workqueue.c:2298
ebt_among: src integrity fail: 300
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 31811:
__do_kmalloc_node mm/slab.c:3689 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3696
kmalloc_node include/linux/slab.h:557 [inline]
kvmalloc_node+0x61/0xf0 mm/util.c:423
kvmalloc include/linux/mm.h:577 [inline]
kvzalloc include/linux/mm.h:585 [inline]
alloc_netdev_mqs+0x97/0xd50 net/core/dev.c:9138
rtnl_create_link+0x1d4/0xa40 net/core/rtnetlink.c:2869
rtnl_newlink+0xf3c/0x15b0 net/core/rtnetlink.c:3131
ebt_among: src integrity fail: 300
rtnetlink_rcv_msg+0x453/0xb80 net/core/rtnetlink.c:4778
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2455
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x6bb/0xc40 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:622 [inline]
sock_sendmsg+0xc3/0x120 net/socket.c:632
___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2115
__sys_sendmsg net/socket.c:2153 [inline]
__do_sys_sendmsg net/socket.c:2162 [inline]
__se_sys_sendmsg net/socket.c:2160 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2160
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 31811:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
kvfree+0x59/0x60 mm/util.c:452
device_release+0x76/0x210 drivers/base/core.c:1061
kobject_cleanup lib/kobject.c:662 [inline]
kobject_release lib/kobject.c:691 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x22d/0x350 lib/kobject.c:708
put_device+0x1c/0x30 drivers/base/core.c:2251
free_netdev+0x309/0x410 net/core/dev.c:9251
rtnl_newlink+0x139a/0x15b0 net/core/rtnetlink.c:3157
rtnetlink_rcv_msg+0x453/0xb80 net/core/rtnetlink.c:4778
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2455
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x6bb/0xc40 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:622 [inline]
sock_sendmsg+0xc3/0x120 net/socket.c:632
___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2115
__sys_sendmsg net/socket.c:2153 [inline]
__do_sys_sendmsg net/socket.c:2162 [inline]
__se_sys_sendmsg net/socket.c:2160 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2160
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88804ae18e40
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 1344 bytes inside of
4096-byte region [ffff88804ae18e40, ffff88804ae19e40)
The buggy address belongs to the page:
page:ffffea00012b8600 count:1 mapcount:0 mapping:ffff88812c39cdc0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea00024f1888 ffffea0001231108 ffff88812c39cdc0
raw: 0000000000000000 ffff88804ae18e40 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.3'.
ffff88804ae19280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88804ae19300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804ae19380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88804ae19400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88804ae19480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


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

syzbot

unread,
Feb 28, 2022, 4:02:20 PM2/28/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12680076700000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=f65ada862fcd638b0ca5
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=152e2a01700000

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

EXT4-fs (loop4): VFS: Can't find ext4 filesystem
EXT4-fs (loop3): VFS: Can't find ext4 filesystem
EXT4-fs (loop2): VFS: Can't find ext4 filesystem
EXT4-fs (loop0): VFS: Can't find ext4 filesystem
==================================================================
BUG: KASAN: use-after-free in dev_put include/linux/netdevice.h:3676 [inline]
BUG: KASAN: use-after-free in netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:626
Read of size 8 at addr ffff8880afd572c0 by task kworker/u4:3/100

CPU: 0 PID: 100 Comm: kworker/u4:3 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: gid-cache-wq netdevice_event_work_handler
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
dev_put include/linux/netdevice.h:3676 [inline]
netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:626
process_one_work+0x864/0x1570 kernel/workqueue.c:2153
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 31058:
__do_kmalloc_node mm/slab.c:3689 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3696
kmalloc_node include/linux/slab.h:557 [inline]
kvmalloc_node+0x61/0xf0 mm/util.c:423
kvmalloc include/linux/mm.h:577 [inline]
kvzalloc include/linux/mm.h:585 [inline]
alloc_netdev_mqs+0x97/0xd50 net/core/dev.c:9152
rtnl_create_link+0x1d4/0xa40 net/core/rtnetlink.c:2869
rtnl_newlink+0xf45/0x15c0 net/core/rtnetlink.c:3131
rtnetlink_rcv_msg+0x453/0xb80 net/core/rtnetlink.c:4782
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2463
netlink_unicast_kernel net/netlink/af_netlink.c:1325 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1351
netlink_sendmsg+0x6c3/0xc50 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg+0xc3/0x120 net/socket.c:661
___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227
__sys_sendmsg net/socket.c:2265 [inline]
__do_sys_sendmsg net/socket.c:2274 [inline]
__se_sys_sendmsg net/socket.c:2272 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 31058:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
kvfree+0x59/0x60 mm/util.c:452
device_release+0x76/0x210 drivers/base/core.c:1076
kobject_cleanup lib/kobject.c:662 [inline]
kobject_release lib/kobject.c:691 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x28b/0x5d0 lib/kobject.c:708
put_device+0x1c/0x30 drivers/base/core.c:2267
free_netdev+0x309/0x410 net/core/dev.c:9265
rtnl_newlink+0x13a3/0x15c0 net/core/rtnetlink.c:3157
rtnetlink_rcv_msg+0x453/0xb80 net/core/rtnetlink.c:4782
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2463
netlink_unicast_kernel net/netlink/af_netlink.c:1325 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1351
netlink_sendmsg+0x6c3/0xc50 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg+0xc3/0x120 net/socket.c:661
___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227
__sys_sendmsg net/socket.c:2265 [inline]
__do_sys_sendmsg net/socket.c:2274 [inline]
__se_sys_sendmsg net/socket.c:2272 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880afd56d80
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 1344 bytes inside of
4096-byte region [ffff8880afd56d80, ffff8880afd57d80)
The buggy address belongs to the page:
page:ffffea0002bf5580 count:1 mapcount:0 mapping:ffff88813bff0dc0 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002be4a88 ffffea000226ec08 ffff88813bff0dc0
raw: 0000000000000000 ffff8880afd56d80 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880afd57180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880afd57200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880afd57280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880afd57300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880afd57380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

syzbot

unread,
Aug 30, 2022, 9:04:35 PM8/30/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1668771d080000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=f65ada862fcd638b0ca5
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17bd7f95080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1020a8ab080000

Downloadable assets:
disk image: https://storage.googleapis.com/98c0bdb4abb3/disk-3f8a27f9.raw.xz
vmlinux: https://storage.googleapis.com/ea228ff02669/vmlinux-3f8a27f9.xz

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

==================================================================
BUG: KASAN: use-after-free in dev_put include/linux/netdevice.h:3676 [inline]
BUG: KASAN: use-after-free in netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:626
Read of size 8 at addr ffff8880aa18a640 by task kworker/u4:6/9459

CPU: 1 PID: 9459 Comm: kworker/u4:6 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Workqueue: gid-cache-wq netdevice_event_work_handler
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
dev_put include/linux/netdevice.h:3676 [inline]
netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:626
process_one_work+0x864/0x1570 kernel/workqueue.c:2153
worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 10662:
__do_kmalloc_node mm/slab.c:3689 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3696
kmalloc_node include/linux/slab.h:557 [inline]
kvmalloc_node+0x61/0xf0 mm/util.c:423
kvmalloc include/linux/mm.h:577 [inline]
kvzalloc include/linux/mm.h:585 [inline]
alloc_netdev_mqs+0x97/0xd50 net/core/dev.c:9152
rtnl_create_link+0x1d4/0xa40 net/core/rtnetlink.c:2869
rtnl_newlink+0xf45/0x15c0 net/core/rtnetlink.c:3131
rtnetlink_rcv_msg+0x453/0xb80 net/core/rtnetlink.c:4782
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2463
netlink_unicast_kernel net/netlink/af_netlink.c:1325 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1351
netlink_sendmsg+0x6c3/0xc50 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg+0xc3/0x120 net/socket.c:661
___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227
__sys_sendmsg net/socket.c:2265 [inline]
__do_sys_sendmsg net/socket.c:2274 [inline]
__se_sys_sendmsg net/socket.c:2272 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 10662:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
kvfree+0x59/0x60 mm/util.c:452
device_release+0x76/0x210 drivers/base/core.c:1076
kobject_cleanup lib/kobject.c:662 [inline]
kobject_release lib/kobject.c:691 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x28b/0x5d0 lib/kobject.c:708
put_device+0x1c/0x30 drivers/base/core.c:2267
free_netdev+0x309/0x410 net/core/dev.c:9265
rtnl_newlink+0x13a3/0x15c0 net/core/rtnetlink.c:3157
rtnetlink_rcv_msg+0x453/0xb80 net/core/rtnetlink.c:4782
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2463
netlink_unicast_kernel net/netlink/af_netlink.c:1325 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1351
netlink_sendmsg+0x6c3/0xc50 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg+0xc3/0x120 net/socket.c:661
___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227
__sys_sendmsg net/socket.c:2265 [inline]
__do_sys_sendmsg net/socket.c:2274 [inline]
__se_sys_sendmsg net/socket.c:2272 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880aa18a100
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 1344 bytes inside of
4096-byte region [ffff8880aa18a100, ffff8880aa18b100)
The buggy address belongs to the page:
page:ffffea0002a86280 count:1 mapcount:0 mapping:ffff88813bff0dc0 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002a99808 ffffea0002aaa808 ffff88813bff0dc0
raw: 0000000000000000 ffff8880aa18a100 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880aa18a500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880aa18a580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880aa18a600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880aa18a680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880aa18a700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages