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

16 views
Skip to first unread message

syzbot

unread,
Mar 6, 2021, 4:55:15 PM3/6/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 397a88b2 Linux 4.14.223
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1036e02ad00000
kernel config: https://syzkaller.appspot.com/x/.config?x=104119cfe8dba6b3
dashboard link: https://syzkaller.appspot.com/bug?extid=df3eebe91337a761db0f

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

netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
==================================================================
BUG: KASAN: use-after-free in rhashtable_rehash_one lib/rhashtable.c:276 [inline]
BUG: KASAN: use-after-free in rhashtable_rehash_chain lib/rhashtable.c:316 [inline]
BUG: KASAN: use-after-free in rhashtable_rehash_table lib/rhashtable.c:364 [inline]
BUG: KASAN: use-after-free in rht_deferred_worker+0x1366/0x1890 lib/rhashtable.c:465
Read of size 8 at addr ffff8880b038ec80 by task kworker/1:4/10508

CPU: 1 PID: 10508 Comm: kworker/1:4 Not tainted 4.14.223-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events rht_deferred_worker
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
rhashtable_rehash_one lib/rhashtable.c:276 [inline]
rhashtable_rehash_chain lib/rhashtable.c:316 [inline]
rhashtable_rehash_table lib/rhashtable.c:364 [inline]
rht_deferred_worker+0x1366/0x1890 lib/rhashtable.c:465
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 25928:
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]
fl_change+0x27e/0x4830 net/sched/cls_flower.c:919
tc_ctl_tfilter+0xb54/0x1c10 net/sched/cls_api.c:738
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 9274:
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
fl_destroy_filter_work+0x1a/0x20 net/sched/cls_flower.c:234
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 ffff8880b038ec80
which belongs to the cache kmalloc-512 of size 512
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
The buggy address is located 0 bytes inside of
512-byte region [ffff8880b038ec80, ffff8880b038ee80)
The buggy address belongs to the page:
page:ffffea0002c0e380 count:1 mapcount:0 mapping:ffff8880b038e000 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880b038e000 0000000000000000 0000000100000006
raw: ffffea0002baa7e0 ffffea0002d18f20 ffff88813fe80940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b038eb80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
ffff8880b038ec00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880b038ec80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880b038ed00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880b038ed80: 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,
Mar 6, 2021, 6:52:13 PM3/6/21
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 397a88b2 Linux 4.14.223
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1221022cd00000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=150f52aed00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=167dd656d00000

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

netlink: 24 bytes leftover after parsing attributes in process `syz-executor432'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor432'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor432'.
==================================================================
BUG: KASAN: use-after-free in rhashtable_rehash_one lib/rhashtable.c:276 [inline]
BUG: KASAN: use-after-free in rhashtable_rehash_chain lib/rhashtable.c:316 [inline]
BUG: KASAN: use-after-free in rhashtable_rehash_table lib/rhashtable.c:364 [inline]
BUG: KASAN: use-after-free in rht_deferred_worker+0x1366/0x1890 lib/rhashtable.c:465
Read of size 8 at addr ffff8880a9470340 by task kworker/0:0/3

CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.14.223-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events rht_deferred_worker
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
rhashtable_rehash_one lib/rhashtable.c:276 [inline]
rhashtable_rehash_chain lib/rhashtable.c:316 [inline]
rhashtable_rehash_table lib/rhashtable.c:364 [inline]
rht_deferred_worker+0x1366/0x1890 lib/rhashtable.c:465
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 9731:
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]
fl_change+0x27e/0x4830 net/sched/cls_flower.c:919
tc_ctl_tfilter+0xb54/0x1c10 net/sched/cls_api.c:738
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 22:
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
fl_destroy_filter_work+0x1a/0x20 net/sched/cls_flower.c:234
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 ffff8880a9470340
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 0 bytes inside of
512-byte region [ffff8880a9470340, ffff8880a9470540)
The buggy address belongs to the page:
page:ffffea0002a51c00 count:1 mapcount:0 mapping:ffff8880a94700c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880a94700c0 0000000000000000 0000000100000006
raw: ffffea00029557a0 ffffea00028c02a0 ffff88813fe80940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a9470200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a9470280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880a9470300: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff8880a9470380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a9470400: 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