syzbot


KASAN: use-after-free Read in handle_tx

Status: upstream: reported on 2024/10/28 09:49
Reported-by: syzbot+334deefbddd12c17d340@syzkaller.appspotmail.com
First crash: 39d, last: 39d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in handle_tx net 15 1029d 1142d 0/28 auto-closed as invalid on 2022/05/12 13:20
upstream KASAN: use-after-free Read in handle_tx (2) net 1 665d 661d 0/28 auto-obsoleted due to no activity on 2023/05/11 18:22
upstream KASAN: slab-use-after-free Read in handle_tx (2) net 66 8h58m 289d 0/28 upstream: reported on 2024/02/21 10:58
upstream KASAN: slab-use-after-free Read in handle_tx net 1 496d 492d 0/28 auto-obsoleted due to no activity on 2023/10/27 13:43

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in handle_tx+0x1ac/0x5f8 drivers/net/caif/caif_serial.c:236
Read of size 8 at addr ffff0000dbc50018 by task aoe_tx0/2059

CPU: 1 PID: 2059 Comm: aoe_tx0 Not tainted 6.1.114-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:395
 kasan_report+0xd4/0x130 mm/kasan/report.c:495
 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
 handle_tx+0x1ac/0x5f8 drivers/net/caif/caif_serial.c:236
 caif_xmit+0x108/0x150 drivers/net/caif/caif_serial.c:282
 __netdev_start_xmit include/linux/netdevice.h:4853 [inline]
 netdev_start_xmit include/linux/netdevice.h:4867 [inline]
 xmit_one net/core/dev.c:3627 [inline]
 dev_hard_start_xmit+0x25c/0x9a4 net/core/dev.c:3643
 __dev_queue_xmit+0x161c/0x34d0 net/core/dev.c:4297
 dev_queue_xmit include/linux/netdevice.h:3021 [inline]
 tx+0x9c/0x1c8 drivers/block/aoe/aoenet.c:63
 kthread+0x1ac/0x374 drivers/block/aoe/aoecmd.c:1237
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Allocated by task 4748:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x7c/0x94 mm/slab_common.c:1031
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:693 [inline]
 alloc_tty_struct+0xb8/0x68c drivers/tty/tty_io.c:3089
 tty_init_dev+0x60/0x3ec drivers/tty/tty_io.c:1408
 tty_open_by_driver drivers/tty/tty_io.c:2081 [inline]
 tty_open+0x804/0xc20 drivers/tty/tty_io.c:2128
 chrdev_open+0x3e8/0x4fc fs/char_dev.c:414
 do_dentry_open+0x734/0xfa0 fs/open.c:882
 vfs_open+0x7c/0x90 fs/open.c:1013
 do_open fs/namei.c:3626 [inline]
 path_openat+0x1e14/0x2548 fs/namei.c:3783
 do_filp_open+0x1bc/0x3cc fs/namei.c:3810
 do_sys_openat2+0x128/0x3e0 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1345
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 3874:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:988
 free_tty_struct drivers/tty/tty_io.c:173 [inline]
 release_one_tty+0x224/0x244 drivers/tty/tty_io.c:1541
 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Last potentially related work creation:
 kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
 insert_work+0x64/0x384 kernel/workqueue.c:1361
 __queue_work+0xd48/0x136c kernel/workqueue.c:1520
 queue_work_on+0xc0/0x16c kernel/workqueue.c:1548
 queue_work include/linux/workqueue.h:512 [inline]
 schedule_work include/linux/workqueue.h:573 [inline]
 queue_release_one_tty drivers/tty/tty_io.c:1552 [inline]
 kref_put include/linux/kref.h:65 [inline]
 tty_kref_put+0x14c/0x1c0 drivers/tty/tty_io.c:1565
 release_tty+0x3f0/0x4ac drivers/tty/tty_io.c:1601
 tty_release_struct+0xb4/0xd4 drivers/tty/tty_io.c:1700
 tty_release+0xb64/0x1014 drivers/tty/tty_io.c:1860
 __fput+0x1c8/0x7c8 fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:203
 exit_task_work include/linux/task_work.h:39 [inline]
 do_exit+0x554/0x1a88 kernel/exit.c:871
 do_group_exit+0x194/0x22c kernel/exit.c:1021
 get_signal+0x14a0/0x158c kernel/signal.c:2870
 do_signal arch/arm64/kernel/signal.c:1076 [inline]
 do_notify_resume+0x3ac/0x3474 arch/arm64/kernel/signal.c:1129
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 asm_exit_to_user_mode+0x70/0x84 arch/arm64/kernel/entry-common.c:149
 ret_from_fork+0x1c/0x20 arch/arm64/kernel/entry.S:867

Second to last potentially related work creation:
 kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
 insert_work+0x64/0x384 kernel/workqueue.c:1361
 __queue_work+0xd48/0x136c kernel/workqueue.c:1520
 queue_work_on+0xc0/0x16c kernel/workqueue.c:1548
 queue_work include/linux/workqueue.h:512 [inline]
 schedule_work include/linux/workqueue.h:573 [inline]
 queue_release_one_tty drivers/tty/tty_io.c:1552 [inline]
 kref_put include/linux/kref.h:65 [inline]
 tty_kref_put+0x14c/0x1c0 drivers/tty/tty_io.c:1565
 release_tty+0x3f0/0x4ac drivers/tty/tty_io.c:1601
 tty_release_struct+0xb4/0xd4 drivers/tty/tty_io.c:1700
 tty_release+0xb64/0x1014 drivers/tty/tty_io.c:1860
 __fput+0x1c8/0x7c8 fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2148/0x3474 arch/arm64/kernel/signal.c:1132
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000dbc50000
 which belongs to the cache kmalloc-cg-2k of size 2048
The buggy address is located 24 bytes inside of
 2048-byte region [ffff0000dbc50000, ffff0000dbc50800)

The buggy address belongs to the physical page:
page:00000000d181af3e refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11bc50
head:00000000d181af3e order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff0000cb511b01
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 dead000000000001 ffff0000c0003380
raw: 0000000000000000 0000000000080008 00000001ffffffff ffff0000cb511b01
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000dbc4ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000dbc4ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000dbc50000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff0000dbc50080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dbc50100: 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
2024/10/28 09:48 linux-6.1.y 7ec6f9fa3d97 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in handle_tx
* Struck through repros no longer work on HEAD.