syzbot


KASAN: use-after-free Write in init_timer_key

Status: upstream: reported C repro on 2020/08/07 15:50
Reported-by: syzbot+500364b9d722d013542f@syzkaller.appspotmail.com
First crash: 1602d, last: 667d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in init_timer_key batman 1 897d 897d 0/28 auto-obsoleted due to no activity on 2022/10/11 08:45
Fix bisection attempts (25)
Created Duration User Patch Repo Result
2023/02/28 18:50 30m bisect fix linux-4.14.y OK (0) job log log
2023/01/27 13:29 34m bisect fix linux-4.14.y OK (0) job log log
2022/11/19 07:19 26m bisect fix linux-4.14.y OK (0) job log log
2022/10/20 06:44 34m bisect fix linux-4.14.y OK (0) job log log
2022/09/15 15:44 31m bisect fix linux-4.14.y OK (0) job log log
2022/08/16 15:11 30m bisect fix linux-4.14.y OK (0) job log log
2022/07/17 13:46 28m bisect fix linux-4.14.y OK (0) job log log
2022/06/17 13:03 42m bisect fix linux-4.14.y OK (0) job log log
2022/05/18 12:29 34m bisect fix linux-4.14.y OK (0) job log log
2022/04/18 11:58 29m bisect fix linux-4.14.y OK (0) job log log
2022/03/19 11:20 37m bisect fix linux-4.14.y OK (0) job log log
2022/02/16 11:39 38m bisect fix linux-4.14.y OK (0) job log log
2022/01/17 11:09 29m bisect fix linux-4.14.y OK (0) job log log
2021/12/18 10:05 29m bisect fix linux-4.14.y OK (0) job log log
2021/11/18 09:30 34m bisect fix linux-4.14.y OK (0) job log log
2021/10/19 08:58 32m bisect fix linux-4.14.y OK (0) job log log
2021/09/19 08:21 36m bisect fix linux-4.14.y OK (0) job log log
2021/08/20 07:00 40m bisect fix linux-4.14.y OK (0) job log log
2021/07/21 06:29 30m bisect fix linux-4.14.y OK (0) job log log
2021/06/21 05:51 30m bisect fix linux-4.14.y OK (0) job log log
2021/05/21 18:34 39m bisect fix linux-4.14.y OK (0) job log log
2021/04/21 17:59 35m bisect fix linux-4.14.y OK (0) job log log
2021/03/22 17:21 34m bisect fix linux-4.14.y OK (0) job log log
2021/02/20 16:05 35m bisect fix linux-4.14.y OK (0) job log log
2021/02/17 21:54 18m bisect fix linux-4.14.y error job log

Sample crash report:
Bluetooth: hci4 command 0x040f tx timeout
==================================================================
BUG: KASAN: use-after-free in do_init_timer kernel/time/timer.c:762 [inline]
BUG: KASAN: use-after-free in init_timer_key+0x2e0/0x300 kernel/time/timer.c:782
Write of size 8 at addr ffff88809addaa58 by task syz-executor222/9275

CPU: 0 PID: 9275 Comm: syz-executor222 Not tainted 4.14.193-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
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_store8_noabort+0x68/0x70 mm/kasan/report.c:435
 do_init_timer kernel/time/timer.c:762 [inline]
 init_timer_key+0x2e0/0x300 kernel/time/timer.c:782
 l2cap_chan_create+0x26a/0x3c0 net/bluetooth/l2cap_core.c:454
 l2cap_sock_alloc.constprop.0+0x16c/0x210 net/bluetooth/l2cap_sock.c:1606
 l2cap_sock_create+0xdd/0x170 net/bluetooth/l2cap_sock.c:1637
 bt_sock_create+0x13b/0x280 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x303/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd1/0x1b0 net/socket.c:1325
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x446eb9
RSP: 002b:00007ffe91244118 EFLAGS: 00000246 ORIG_RAX: 0000000000000029
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000446eb9
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000000000000001f
RBP: 0000000000000003 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000407b10 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 9275:
 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]
 l2cap_chan_create+0x3e/0x3c0 net/bluetooth/l2cap_core.c:441
 l2cap_sock_alloc.constprop.0+0x16c/0x210 net/bluetooth/l2cap_sock.c:1606
 l2cap_sock_create+0xdd/0x170 net/bluetooth/l2cap_sock.c:1637
 bt_sock_create+0x13b/0x280 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x303/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd1/0x1b0 net/socket.c:1325
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6491:
 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
 l2cap_chan_destroy net/bluetooth/l2cap_core.c:479 [inline]
 kref_put include/linux/kref.h:70 [inline]
 l2cap_chan_put+0x152/0x1b0 net/bluetooth/l2cap_core.c:493
 l2cap_conless_channel net/bluetooth/l2cap_core.c:6976 [inline]
 l2cap_recv_frame+0xb9a/0x95c0 net/bluetooth/l2cap_core.c:7023
 l2cap_recv_acldata+0x7a6/0x8b0 net/bluetooth/l2cap_core.c:7588
 hci_acldata_packet net/bluetooth/hci_core.c:4066 [inline]
 hci_rx_work+0x3d1/0x970 net/bluetooth/hci_core.c:4249
 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 ffff88809adda900
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 344 bytes inside of
 2048-byte region [ffff88809adda900, ffff88809addb100)
The buggy address belongs to the page:
page:ffffea00026b7680 count:1 mapcount:0 mapping:ffff88809adda080 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff88809adda080 0000000000000000 0000000100000003
raw: ffffea0002672920 ffffea00027943a0 ffff88812fe52c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809adda900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809adda980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809addaa00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff88809addaa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809addab00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/08/07 15:49 linux-4.14.y 14b58326976d 28ac5c9e .config console log report syz C ci2-linux-4-14
* Struck through repros no longer work on HEAD.