syzbot


KASAN: use-after-free Read in rose_transmit_link

Status: upstream: reported on 2025/05/03 13:00
Reported-by: syzbot+84ac815d6e53a68f443f@syzkaller.appspotmail.com
First crash: 6d13h, last: 3d04h
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in rose_transmit_link 1 1d22h 1d22h 0/3 upstream: reported on 2025/05/08 04:31
upstream general protection fault in rose_transmit_link (3) hams 27 417d 1044d 0/28 auto-obsoleted due to no activity on 2024/06/26 03:46
upstream general protection fault in rose_transmit_link (2) hams 3 1174d 1192d 0/28 auto-closed as invalid on 2022/05/21 05:59
linux-4.19 general protection fault in rose_transmit_link 1 1196d 1196d 0/1 auto-closed as invalid on 2022/05/29 13:41
upstream general protection fault in rose_transmit_link hams 1 2104d 2100d 0/28 auto-closed as invalid on 2019/11/03 18:16

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in rose_transmit_link+0x5b0/0x730 net/rose/rose_link.c:266
Read of size 1 at addr ffff888022073032 by task syz.4.120/4694

CPU: 1 PID: 4694 Comm: syz.4.120 Not tainted 5.15.181-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 rose_transmit_link+0x5b0/0x730 net/rose/rose_link.c:266
 rose_write_internal+0x673/0x1e80 net/rose/rose_subr.c:198
 rose_release+0x22a/0x4e0 net/rose/af_rose.c:670
 __sock_release net/socket.c:649 [inline]
 sock_close+0xd5/0x240 net/socket.c:1336
 __fput+0x234/0x930 fs/file_table.c:311
 task_work_run+0x125/0x1a0 kernel/task_work.c:188
 get_signal+0x1222/0x12c0 kernel/signal.c:2672
 arch_do_signal_or_restart+0xc1/0x1300 arch/x86/kernel/signal.c:867
 handle_signal_work kernel/entry/common.c:154 [inline]
 exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7efdb910d969
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007efdb6b10038 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: fffffffffffffe00 RBX: 00007efdb9335240 RCX: 00007efdb910d969
RDX: 000000000000001c RSI: 0000200000000240 RDI: 0000000000000009
RBP: 00007efdb918fab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007efdb9335240 R15: 00007fff5c6b3348
 </TASK>

Allocated by task 4455:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:604 [inline]
 rose_add_node+0x227/0xdb0 net/rose/rose_route.c:85
 rose_rt_ioctl+0x9db/0xe20 net/rose/rose_route.c:745
 rose_ioctl+0x27a/0x790 net/rose/af_rose.c:1372
 sock_do_ioctl+0xd3/0x2f0 net/socket.c:1140
 sock_ioctl+0x4ed/0x6e0 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 4693:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xea/0x170 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4559
 rose_rt_device_down+0x3e5/0x430 net/rose/rose_route.c:522
 rose_device_event+0x5ec/0x680 net/rose/af_rose.c:247
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:391
 call_netdevice_notifiers_extack net/core/dev.c:2061 [inline]
 call_netdevice_notifiers net/core/dev.c:2075 [inline]
 __dev_notify_flags+0x178/0x2d0 net/core/dev.c:-1
 dev_change_flags+0xe3/0x1a0 net/core/dev.c:8929
 dev_ifsioc+0x147/0xe70 net/core/dev_ioctl.c:324
 dev_ioctl+0x55f/0xe50 net/core/dev_ioctl.c:587
 sock_do_ioctl+0x222/0x2f0 net/socket.c:1154
 sock_ioctl+0x4ed/0x6e0 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888022073000
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 50 bytes inside of
 512-byte region [ffff888022073000, ffff888022073200)
The buggy address belongs to the page:
page:ffffea0000881c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22070
head:ffffea0000881c00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000924300 0000000300000003 ffff888016841c80
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1247, ts 12848760698, free_ts 0
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5466
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc_trace+0x1a5/0x2a0 mm/slub.c:3245
 kmalloc include/linux/slab.h:604 [inline]
 kzalloc include/linux/slab.h:735 [inline]
 alloc_bprm+0x56/0x6a0 fs/exec.c:1516
 kernel_execve+0x49/0x900 fs/exec.c:1978
 call_usermodehelper_exec_async+0x207/0x350 kernel/umh.c:112
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888022072f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888022072f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888022073000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff888022073080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888022073100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/03 16:04 linux-5.15.y 16fdf2c7111b b0714e37 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_transmit_link
2025/05/03 13:00 linux-5.15.y 16fdf2c7111b b0714e37 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_transmit_link
2025/05/06 09:23 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_transmit_link
2025/05/06 09:23 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_transmit_link
2025/05/06 08:10 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_transmit_link
2025/05/06 22:04 linux-5.15.y 16fdf2c7111b 350f4ffc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan general protection fault in rose_transmit_link
* Struck through repros no longer work on HEAD.