KASAN: use-after-free Read in tipc_subscrb_rcv_cb

8 views
Skip to first unread message

syzbot

unread,
Apr 11, 2019, 8:32:12 AM4/11/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 1ec8f1f0 Linux 4.14.111
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=121ffb4b200000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdadf290ea9fc6f9
dashboard link: https://syzkaller.appspot.com/bug?extid=44d93ae06088828f8f21
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+44d93a...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x303c/0x45e0
kernel/locking/lockdep.c:3365
Read of size 8 at addr ffff888083510920 by task kworker/u4:6/26781

CPU: 1 PID: 26781 Comm: kworker/u4:6 Not tainted 4.14.111 #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: tipc_rcv tipc_recv_work
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc 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+0xaf/0x2b5 mm/kasan/report.c:393
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
__lock_acquire+0x303c/0x45e0 kernel/locking/lockdep.c:3365
lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
_raw_spin_lock_bh+0x33/0x50 kernel/locking/spinlock.c:176
spin_lock_bh include/linux/spinlock.h:322 [inline]
tipc_subscrp_subscribe net/tipc/subscr.c:299 [inline]
tipc_subscrb_rcv_cb+0x505/0xa80 net/tipc/subscr.c:338
tipc_receive_from_sock+0x28a/0x4e0 net/tipc/server.c:273
tipc_recv_work+0x8b/0xf0 net/tipc/server.c:547
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

Allocated by task 7478:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
tipc_subscrb_create net/tipc/subscr.c:223 [inline]
tipc_subscrb_connect_cb+0x46/0x160 net/tipc/subscr.c:344
tipc_accept_from_sock+0x280/0x470 net/tipc/server.c:313
tipc_recv_work+0x8b/0xf0 net/tipc/server.c:547
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

Freed by task 5:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 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+0xcc/0x270 mm/slab.c:3815
tipc_subscrb_kref_release net/tipc/subscr.c:155 [inline]
kref_put include/linux/kref.h:70 [inline]
tipc_subscrb_put+0x27/0x30 net/tipc/subscr.c:160
tipc_subscrb_delete net/tipc/subscr.c:239 [inline]
tipc_subscrb_release_cb+0x20/0x30 net/tipc/subscr.c:316
tipc_close_conn+0x179/0x210 net/tipc/server.c:203
tipc_send_to_sock net/tipc/server.c:538 [inline]
tipc_send_work+0x470/0x5a0 net/tipc/server.c:564
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
kobject: 'loop1' (ffff8880a49be6e0): kobject_uevent_env
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

The buggy address belongs to the object at ffff888083510900
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 32 bytes inside of
96-byte region [ffff888083510900, ffff888083510960)
The buggy address belongs to the page:
page:ffffea00020d4400 count:1 mapcount:0 mapping:ffff888083510000 index:0x0
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff888083510000 0000000000000000 0000000100000020
raw: ffffea00025d90e0 ffffea000259f120 ffff8880aa8004c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888083510800: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff888083510880: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
kobject: 'loop1' (ffff8880a49be6e0): fill_kobj_path: path
= '/devices/virtual/block/loop1'
> ffff888083510900: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff888083510980: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff888083510a00: 00 00 00 00 00 00 00 00 00 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,
Apr 11, 2019, 2:08:11 PM4/11/19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 1ec8f1f0 Linux 4.14.111
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17779cd3200000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdadf290ea9fc6f9
dashboard link: https://syzkaller.appspot.com/bug?extid=44d93ae06088828f8f21
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1384c1af200000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1479d5bb200000

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

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x303c/0x45e0
kernel/locking/lockdep.c:3365
Read of size 8 at addr ffff88808eada620 by task kworker/u4:3/2237

CPU: 1 PID: 2237 Comm: kworker/u4:3 Not tainted 4.14.111 #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: tipc_rcv tipc_recv_work
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc 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+0xaf/0x2b5 mm/kasan/report.c:393
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
__lock_acquire+0x303c/0x45e0 kernel/locking/lockdep.c:3365
lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
_raw_spin_lock_bh+0x33/0x50 kernel/locking/spinlock.c:176
spin_lock_bh include/linux/spinlock.h:322 [inline]
tipc_subscrp_subscribe net/tipc/subscr.c:299 [inline]
tipc_subscrb_rcv_cb+0x505/0xa80 net/tipc/subscr.c:338
tipc_receive_from_sock+0x28a/0x4e0 net/tipc/server.c:273
tipc_recv_work+0x8b/0xf0 net/tipc/server.c:547
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

Allocated by task 75:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
tipc_subscrb_create net/tipc/subscr.c:223 [inline]
tipc_subscrb_connect_cb+0x46/0x160 net/tipc/subscr.c:344
tipc_accept_from_sock+0x280/0x470 net/tipc/server.c:313
tipc_recv_work+0x8b/0xf0 net/tipc/server.c:547
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

Freed by task 75:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 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+0xcc/0x270 mm/slab.c:3815
tipc_subscrb_kref_release net/tipc/subscr.c:155 [inline]
kref_put include/linux/kref.h:70 [inline]
tipc_subscrb_put+0x27/0x30 net/tipc/subscr.c:160
tipc_subscrb_delete net/tipc/subscr.c:239 [inline]
tipc_subscrb_release_cb+0x20/0x30 net/tipc/subscr.c:316
tipc_close_conn+0x179/0x210 net/tipc/server.c:203
tipc_send_to_sock net/tipc/server.c:538 [inline]
tipc_send_work+0x470/0x5a0 net/tipc/server.c:564
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

The buggy address belongs to the object at ffff88808eada600
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 32 bytes inside of
96-byte region [ffff88808eada600, ffff88808eada660)
The buggy address belongs to the page:
page:ffffea00023ab680 count:1 mapcount:0 mapping:ffff88808eada000
index:0xffff88808eada580
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff88808eada000 ffff88808eada580 000000010000001f
raw: ffffea00024de920 ffffea00025ceea0 ffff8880aa8004c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808eada500: 00 00 00 00 00 00 00 00 05 fc fc fc fc fc fc fc
ffff88808eada580: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
> ffff88808eada600: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff88808eada680: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff88808eada700: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages