KASAN: use-after-free Read in netdevice_event_work_handler (2)

5 views
Skip to first unread message

syzbot

unread,
Jun 13, 2022, 6:07:21 PM6/13/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: b8f3be299d51 Linux 4.14.282
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16976a2ff00000
kernel config: https://syzkaller.appspot.com/x/.config?x=6f19bc3398ea47b8
dashboard link: https://syzkaller.appspot.com/bug?extid=34f858d24a0ff0bb0fe5
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

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+34f858...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in dev_put include/linux/netdevice.h:3382 [inline]
BUG: KASAN: use-after-free in netdevice_event_work_handler+0x1c1/0x1d0 drivers/infiniband/core/roce_gid_mgmt.c:539
Read of size 8 at addr ffff8880552a4bc0 by task kworker/u4:5/3573

CPU: 1 PID: 3573 Comm: kworker/u4:5 Not tainted 4.14.282-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:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
dev_put include/linux/netdevice.h:3382 [inline]
netdevice_event_work_handler+0x1c1/0x1d0 drivers/infiniband/core/roce_gid_mgmt.c:539
process_one_work+0x793/0x14a0 kernel/workqueue.c:2117
worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 9655:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x46/0xd0 mm/util.c:397
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x76/0xb70 net/core/dev.c:8112
rtnl_create_link+0x1ab/0x890 net/core/rtnetlink.c:2460
rtnl_newlink+0xe7a/0x1830 net/core/rtnetlink.c:2720
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4322
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2454
netlink_unicast_kernel net/netlink/af_netlink.c:1296 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1322
netlink_sendmsg+0x648/0xbc0 net/netlink/af_netlink.c:1893
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 9655:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
kvfree+0x45/0x50 mm/util.c:416
device_release+0x15f/0x1a0 drivers/base/core.c:848
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x251/0x550 lib/kobject.c:692
put_device+0x1c/0x30 drivers/base/core.c:2030
free_netdev+0x26f/0x360 net/core/dev.c:8234
rtnl_newlink+0x14cd/0x1830 net/core/rtnetlink.c:2746
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4322
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2454
netlink_unicast_kernel net/netlink/af_netlink.c:1296 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1322
netlink_sendmsg+0x648/0xbc0 net/netlink/af_netlink.c:1893
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

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

Memory state around the buggy address:
ffff8880552a4a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880552a4b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880552a4b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880552a4c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880552a4c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Cannot find add_set index 0 as target


---
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,
Aug 31, 2022, 2:07:43 AM8/31/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: e548869f356f Linux 4.14.291
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14d272e5080000
kernel config: https://syzkaller.appspot.com/x/.config?x=14f65e3c6215eb84
dashboard link: https://syzkaller.appspot.com/bug?extid=34f858d24a0ff0bb0fe5
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=129dc49d080000

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

==================================================================
BUG: KASAN: use-after-free in dev_put include/linux/netdevice.h:3382 [inline]
BUG: KASAN: use-after-free in netdevice_event_work_handler+0x1c1/0x1d0 drivers/infiniband/core/roce_gid_mgmt.c:539
Read of size 8 at addr ffff8880991b30c0 by task kworker/u4:4/2850

CPU: 0 PID: 2850 Comm: kworker/u4:4 Not tainted 4.14.291-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:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
dev_put include/linux/netdevice.h:3382 [inline]
netdevice_event_work_handler+0x1c1/0x1d0 drivers/infiniband/core/roce_gid_mgmt.c:539
process_one_work+0x793/0x14a0 kernel/workqueue.c:2117
worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 22344:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x46/0xd0 mm/util.c:430
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x76/0xb70 net/core/dev.c:8112
rtnl_create_link+0x1ab/0x890 net/core/rtnetlink.c:2460
rtnl_newlink+0xe7a/0x1830 net/core/rtnetlink.c:2720
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4322
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2454
netlink_unicast_kernel net/netlink/af_netlink.c:1296 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1322
netlink_sendmsg+0x648/0xbc0 net/netlink/af_netlink.c:1893
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 22344:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
kvfree+0x45/0x50 mm/util.c:449
device_release+0x15f/0x1a0 drivers/base/core.c:848
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x251/0x550 lib/kobject.c:692
put_device+0x1c/0x30 drivers/base/core.c:2030
free_netdev+0x26f/0x360 net/core/dev.c:8234
rtnl_newlink+0x14cd/0x1830 net/core/rtnetlink.c:2746
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4322
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2454
netlink_unicast_kernel net/netlink/af_netlink.c:1296 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1322
netlink_sendmsg+0x648/0xbc0 net/netlink/af_netlink.c:1893
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

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

Memory state around the buggy address:
ffff8880991b2f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880991b3000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880991b3080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880991b3100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880991b3180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

syzbot

unread,
Nov 13, 2022, 10:07:42 PM11/13/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: e911713e40ca Linux 4.14.299
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12a66ac1880000
kernel config: https://syzkaller.appspot.com/x/.config?x=1d7ed9728cc57838
dashboard link: https://syzkaller.appspot.com/bug?extid=34f858d24a0ff0bb0fe5
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16d51569880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=116b0e35880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c8588259d654/disk-e911713e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/700d08072e5e/vmlinux-e911713e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/844ad5da2ed5/bzImage-e911713e.xz

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

syz-executor200 (8033) used greatest stack depth: 24928 bytes left
==================================================================
BUG: KASAN: use-after-free in dev_put include/linux/netdevice.h:3382 [inline]
BUG: KASAN: use-after-free in netdevice_event_work_handler+0x1c1/0x1d0 drivers/infiniband/core/roce_gid_mgmt.c:539
Read of size 8 at addr ffff8880968e28c0 by task kworker/u4:15/8137

CPU: 0 PID: 8137 Comm: kworker/u4:15 Not tainted 4.14.299-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Workqueue: gid-cache-wq netdevice_event_work_handler
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
dev_put include/linux/netdevice.h:3382 [inline]
netdevice_event_work_handler+0x1c1/0x1d0 drivers/infiniband/core/roce_gid_mgmt.c:539
process_one_work+0x793/0x14a0 kernel/workqueue.c:2117
worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406

Allocated by task 8034:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x46/0xd0 mm/util.c:430
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x76/0xb70 net/core/dev.c:8112
rtnl_create_link+0x1ab/0x890 net/core/rtnetlink.c:2460
rtnl_newlink+0xe7a/0x1830 net/core/rtnetlink.c:2720
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4322
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2454
netlink_unicast_kernel net/netlink/af_netlink.c:1296 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1322
netlink_sendmsg+0x648/0xbc0 net/netlink/af_netlink.c:1893
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 8034:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
kvfree+0x45/0x50 mm/util.c:449
device_release+0x15f/0x1a0 drivers/base/core.c:848
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x251/0x550 lib/kobject.c:692
put_device+0x1c/0x30 drivers/base/core.c:2030
free_netdev+0x26f/0x360 net/core/dev.c:8234
rtnl_newlink+0x14cd/0x1830 net/core/rtnetlink.c:2746
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4322
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2454
netlink_unicast_kernel net/netlink/af_netlink.c:1296 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1322
netlink_sendmsg+0x648/0xbc0 net/netlink/af_netlink.c:1893
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

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

Memory state around the buggy address:
ffff8880968e2780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880968e2800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880968e2880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880968e2900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880968e2980: 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