syzbot


KASAN: use-after-free Read in bcm_can_tx

Status: auto-closed as invalid on 2020/11/22 07:42
Reported-by: syzbot+e87ddf50a7dc76266af1@syzkaller.appspotmail.com
First crash: 1368d, last: 1368d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in bcm_can_tx C 2 833d 1289d 1/1 fixed on 2022/01/29 10:00
linux-4.19 KASAN: use-after-free Read in bcm_can_tx (2) C error 94 413d 977d 0/1 upstream: reported C repro on 2021/08/20 03:44

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:373 [inline]
BUG: KASAN: use-after-free in skb_put_data include/linux/skbuff.h:2113 [inline]
BUG: KASAN: use-after-free in bcm_can_tx+0x34f/0x610 net/can/bcm.c:291
Read of size 72 at addr ffff88804985c520 by task kworker/u4:1/23

CPU: 1 PID: 23 Comm: kworker/u4:1 Not tainted 4.19.134-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: bat_events batadv_nc_worker
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report+0x8f/0x96 mm/kasan/report.c:412
 memcpy+0x20/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:373 [inline]
 skb_put_data include/linux/skbuff.h:2113 [inline]
 bcm_can_tx+0x34f/0x610 net/can/bcm.c:291
 bcm_tx_timeout_tsklet+0x1ef/0x320 net/can/bcm.c:409
 tasklet_action_common.constprop.0+0x265/0x360 kernel/softirq.c:522
 __do_softirq+0x26c/0x9a0 kernel/softirq.c:292
 do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1092
 </IRQ>
 do_softirq.part.0+0x160/0x1c0 kernel/softirq.c:336
 do_softirq kernel/softirq.c:328 [inline]
 __local_bh_enable_ip+0x20e/0x270 kernel/softirq.c:189
 spin_unlock_bh include/linux/spinlock.h:374 [inline]
 batadv_nc_purge_paths+0x22d/0x310 net/batman-adv/network-coding.c:482
 batadv_nc_worker+0x6fa/0xd50 net/batman-adv/network-coding.c:731
 process_one_work+0x864/0x1570 kernel/workqueue.c:2155
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2298
 kthread+0x30b/0x410 kernel/kthread.c:246
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 13942:
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15a/0x3c0 mm/slab.c:3736
 kmalloc_array include/linux/slab.h:637 [inline]
 bcm_tx_setup net/can/bcm.c:949 [inline]
 bcm_sendmsg+0x3071/0x3fb0 net/can/bcm.c:1378
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:632
 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2115
 __sys_sendmsg net/socket.c:2153 [inline]
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2160
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 13939:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 bcm_remove_op+0x213/0x2c0 net/can/bcm.c:763
 bcm_release+0xff/0x700 net/can/bcm.c:1530
 __sock_release+0xcd/0x2a0 net/socket.c:579
 sock_close+0x15/0x20 net/socket.c:1140
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88804985a480
 which belongs to the cache kmalloc-16384 of size 16384
The buggy address is located 8352 bytes inside of
 16384-byte region [ffff88804985a480, ffff88804985e480)
The buggy address belongs to the page:
page:ffffea0001261600 count:1 mapcount:0 mapping:ffff88812c395200 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0001268c08 ffffea00027e5e08 ffff88812c395200
raw: 0000000000000000 ffff88804985a480 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88804985c400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804985c480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804985c500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff88804985c580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804985c600: 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/07/25 07:41 linux-4.19.y 20b3a3dfdf6c 0a13649c .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.