KASAN: use-after-free Read in u32_clear_hnode

7 views
Skip to first unread message

syzbot

unread,
Mar 1, 2020, 2:53:13 PM3/1/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 78d697fc Linux 4.14.172
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12301e65e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=31ad682bcda9b93f
dashboard link: https://syzkaller.appspot.com/bug?extid=4447d810a162677c0f57
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

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+4447d8...@syzkaller.appspotmail.com

batman_adv: batadv0: Removing interface: batadv_slave_0
batman_adv: batadv0: Removing interface: batadv_slave_1
bridge0: port 2(bridge_slave_1) entered disabled state
bridge0: port 1(bridge_slave_0) entered disabled state
==================================================================
BUG: KASAN: use-after-free in u32_clear_hnode+0x386/0x420 net/sched/cls_u32.c:590
Read of size 8 at addr ffff8880a878d730 by task kworker/u4:5/7626

CPU: 1 PID: 7626 Comm: kworker/u4:5 Not tainted 4.14.172-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x13e/0x194 lib/dump_stack.c:58
print_address_description.cold+0x7c/0x1e2 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2ae mm/kasan/report.c:393
u32_clear_hnode+0x386/0x420 net/sched/cls_u32.c:590
u32_destroy+0x228/0x460 net/sched/cls_u32.c:655
tcf_proto_destroy+0x4f/0xd0 net/sched/cls_api.c:180
tcf_chain_flush+0x120/0x270 net/sched/cls_api.c:208
tcf_block_put+0xd0/0x2b0 net/sched/cls_api.c:302
hfsc_destroy_qdisc+0xd7/0x260 net/sched/sch_hfsc.c:1504
qdisc_destroy+0x13c/0x310 net/sched/sch_generic.c:725
dev_shutdown+0x27d/0x42d net/sched/sch_generic.c:1000
rollback_registered_many+0x684/0xa70 net/core/dev.c:7199
unregister_netdevice_many.part.0+0x16/0x1d0 net/core/dev.c:8278
unregister_netdevice_many net/core/dev.c:8277 [inline]
default_device_exit_batch+0x2dd/0x380 net/core/dev.c:8739
ops_exit_list.isra.0+0xef/0x140 net/core/net_namespace.c:145
cleanup_net+0x3bb/0x820 net/core/net_namespace.c:484
process_one_work+0x813/0x1540 kernel/workqueue.c:2114
worker_thread+0x5d1/0x1070 kernel/workqueue.c:2248
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 15186:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529
kmem_cache_alloc_trace+0x14d/0x7b0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
u32_init+0x3e9/0x910 net/sched/cls_u32.c:367
tcf_proto_create net/sched/cls_api.c:166 [inline]
tc_ctl_tfilter+0xa68/0x18e6 net/sched/cls_api.c:677
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2432
netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline]
netlink_unicast+0x437/0x620 net/netlink/af_netlink.c:1312
netlink_sendmsg+0x733/0xbe0 net/netlink/af_netlink.c:1877
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xc5/0x100 net/socket.c:656
___sys_sendmsg+0x70a/0x840 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+0x42/0xb7

Freed by task 7626:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcb/0x260 mm/slab.c:3815
u32_destroy_key.constprop.0+0xfd/0x1e0 net/sched/cls_u32.c:406
u32_clear_hnode+0x2e7/0x420 net/sched/cls_u32.c:598
u32_destroy+0x228/0x460 net/sched/cls_u32.c:655
tcf_proto_destroy+0x4f/0xd0 net/sched/cls_api.c:180
tcf_chain_flush+0x120/0x270 net/sched/cls_api.c:208
tcf_block_put+0xd0/0x2b0 net/sched/cls_api.c:302
hfsc_destroy_qdisc+0xd7/0x260 net/sched/sch_hfsc.c:1504
qdisc_destroy+0x13c/0x310 net/sched/sch_generic.c:725
dev_shutdown+0x27d/0x42d net/sched/sch_generic.c:1000
rollback_registered_many+0x684/0xa70 net/core/dev.c:7199
unregister_netdevice_many.part.0+0x16/0x1d0 net/core/dev.c:8278
unregister_netdevice_many net/core/dev.c:8277 [inline]
default_device_exit_batch+0x2dd/0x380 net/core/dev.c:8739
ops_exit_list.isra.0+0xef/0x140 net/core/net_namespace.c:145
cleanup_net+0x3bb/0x820 net/core/net_namespace.c:484
process_one_work+0x813/0x1540 kernel/workqueue.c:2114
worker_thread+0x5d1/0x1070 kernel/workqueue.c:2248
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff8880a878d700
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 48 bytes inside of
64-byte region [ffff8880a878d700, ffff8880a878d740)
The buggy address belongs to the page:
page:ffffea0002a1e340 count:1 mapcount:0 mapping:ffff8880a878d000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff8880a878d000 0000000000000000 0000000100000020
raw: ffffea00022c0220 ffffea0002a41360 ffff88812fe56340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a878d600: 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc fc
ffff8880a878d680: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff8880a878d700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff8880a878d780: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8880a878d800: 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc fc
==================================================================


---
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,
Aug 31, 2020, 10:38:17 PM8/31/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: d7e78d08 Linux 4.14.195
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11a56a25900000
kernel config: https://syzkaller.appspot.com/x/.config?x=6608b656f49b4e8c
dashboard link: https://syzkaller.appspot.com/bug?extid=4447d810a162677c0f57
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=176cf9fe900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=134fc115900000

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

IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: use-after-free in u32_clear_hnode+0x37d/0x410 net/sched/cls_u32.c:590
Read of size 8 at addr ffff88808c1756b0 by task kworker/u4:5/4257

CPU: 1 PID: 4257 Comm: kworker/u4:5 Not tainted 4.14.195-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
u32_clear_hnode+0x37d/0x410 net/sched/cls_u32.c:590
u32_destroy+0x1e7/0x3f0 net/sched/cls_u32.c:655
tcf_proto_destroy net/sched/cls_api.c:180 [inline]
tcf_chain_flush+0x147/0x2b0 net/sched/cls_api.c:208
tcf_block_put+0xd0/0x220 net/sched/cls_api.c:302
hfsc_destroy_qdisc+0xd8/0x350 net/sched/sch_hfsc.c:1504
qdisc_destroy+0x13c/0x310 net/sched/sch_generic.c:726
dev_shutdown+0x27a/0x43e net/sched/sch_generic.c:1001
rollback_registered_many+0x6e0/0xb30 net/core/dev.c:7196
unregister_netdevice_many.part.0+0x18/0x2e0 net/core/dev.c:8284
unregister_netdevice_many+0x36/0x50 net/core/dev.c:8283
ip_tunnel_delete_net+0x274/0x320 net/ipv4/ip_tunnel.c:1083
ops_exit_list+0xa5/0x150 net/core/net_namespace.c:142
cleanup_net+0x3b3/0x840 net/core/net_namespace.c:484
process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 6386:
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
kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
u32_init+0x3e4/0x884 net/sched/cls_u32.c:367
tcf_proto_create net/sched/cls_api.c:166 [inline]
tc_ctl_tfilter+0xde3/0x1c01 net/sched/cls_api.c:677
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4316
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x326/0x800 net/socket.c:2062
__sys_sendmmsg+0x129/0x330 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 4257:
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
u32_destroy_key.constprop.0.isra.0+0x105/0x1d0 net/sched/cls_u32.c:406
u32_clear_hnode+0x2de/0x410 net/sched/cls_u32.c:598
u32_destroy+0x1e7/0x3f0 net/sched/cls_u32.c:655
tcf_proto_destroy net/sched/cls_api.c:180 [inline]
tcf_chain_flush+0x147/0x2b0 net/sched/cls_api.c:208
tcf_block_put+0xd0/0x220 net/sched/cls_api.c:302
hfsc_destroy_qdisc+0xd8/0x350 net/sched/sch_hfsc.c:1504
qdisc_destroy+0x13c/0x310 net/sched/sch_generic.c:726
dev_shutdown+0x27a/0x43e net/sched/sch_generic.c:1001
rollback_registered_many+0x6e0/0xb30 net/core/dev.c:7196
unregister_netdevice_many.part.0+0x18/0x2e0 net/core/dev.c:8284
unregister_netdevice_many+0x36/0x50 net/core/dev.c:8283
ip_tunnel_delete_net+0x274/0x320 net/ipv4/ip_tunnel.c:1083
ops_exit_list+0xa5/0x150 net/core/net_namespace.c:142
cleanup_net+0x3b3/0x840 net/core/net_namespace.c:484
process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff88808c175680
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 48 bytes inside of
64-byte region [ffff88808c175680, ffff88808c1756c0)
The buggy address belongs to the page:
page:ffffea0002305d40 count:1 mapcount:0 mapping:ffff88808c175000 index:0xffff88808c175f80
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88808c175000 ffff88808c175f80 000000010000001e
raw: ffffea0002703120 ffffea00021e5520 ffff88812fe52340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808c175580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88808c175600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88808c175680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88808c175700: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
ffff88808c175780: 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages