syzbot


KASAN: use-after-free Read in rose_get_neigh (2)

Status: upstream: reported syz repro on 2025/04/01 12:19
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+0a936b539797408a9f16@syzkaller.appspotmail.com
First crash: 6d07h, last: now
Bug presence (1)
Date Name Commit Repro Result
2025/04/05 upstream (ToT) a8662bcd2ff1 C [report] KASAN: slab-use-after-free Read in rose_get_neigh
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in rose_get_neigh 1 249d 249d 0/3 auto-obsoleted due to no activity on 2024/11/08 20:40
linux-6.1 KASAN: use-after-free Read in rose_get_neigh origin:upstream syz 10 5m 21d 0/3 upstream: reported syz repro on 2025/03/17 15:45
upstream KASAN: slab-use-after-free Read in rose_get_neigh hams 253 26m 300d 0/28 upstream: reported on 2024/06/11 06:56

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in rose_get_neigh+0x1b2/0x6e0 net/rose/rose_route.c:690
Read of size 1 at addr ffff88805bed0c30 by task syz.4.144/4632

CPU: 0 PID: 4632 Comm: syz.4.144 Not tainted 5.15.179-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 rose_get_neigh+0x1b2/0x6e0 net/rose/rose_route.c:690
 rose_connect+0x456/0x1150 net/rose/af_rose.c:814
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x38b/0x410 net/socket.c:1940
 __do_sys_connect net/socket.c:1950 [inline]
 __se_sys_connect net/socket.c:1947 [inline]
 __x64_sys_connect+0x76/0x80 net/socket.c:1947
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f8e9fe4b169
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:00007f8e9f0bc038 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007f8ea0063fa0 RCX: 00007f8e9fe4b169
RDX: 0000000000000040 RSI: 0000200000000040 RDI: 0000000000000007
RBP: 00007f8e9fecc2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f8ea0063fa0 R15: 00007ffc01cef2b8
 </TASK>

Allocated by task 4319:
 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+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 rose_add_node+0x209/0xda0 net/rose/rose_route.c:85
 rose_rt_ioctl+0xa27/0xe90 net/rose/rose_route.c:745
 rose_ioctl+0x2ca/0x8d0 net/rose/af_rose.c:1372
 sock_do_ioctl+0x11d/0x5a0 net/socket.c:1140
 sock_ioctl+0x484/0x770 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 4640:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 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+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xf1/0x270 mm/slub.c:4559
 rose_rt_device_down+0x6e1/0x730 net/rose/rose_route.c:522
 rose_device_event+0x5e9/0x680 net/rose/af_rose.c:247
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
 __dev_notify_flags+0x1fd/0x3f0 net/core/dev.c:-1
 dev_change_flags+0xe7/0x190 net/core/dev.c:8928
 dev_ifsioc+0x147/0x10c0 net/core/dev_ioctl.c:324
 dev_ioctl+0x504/0xf60 net/core/dev_ioctl.c:587
 sock_do_ioctl+0x34f/0x5a0 net/socket.c:1154
 sock_ioctl+0x484/0x770 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88805bed0c00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 48 bytes inside of
 512-byte region [ffff88805bed0c00, ffff88805bed0e00)
The buggy address belongs to the page:
page:ffffea00016fb400 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805bed3c00 pfn:0x5bed0
head:ffffea00016fb400 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000904d08 ffffea0001671808 ffff888017441c80
raw: ffff88805bed3c00 0000000000100007 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 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4318, ts 74952945401, free_ts 68227904521
 create_dummy_stack mm/page_owner.c:59 [inline]
 register_dummy_stack+0x86/0xe0 mm/page_owner.c:65
 init_page_owner+0x30/0x730 mm/page_owner.c:83
 kernel_init_freeable+0x420/0x5c0 init/main.c:1613
 kernel_init+0x19/0x290 init/main.c:1506
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 __vunmap+0x8b3/0xa50 mm/vmalloc.c:2621
 kcov_put kernel/kcov.c:417 [inline]
 kcov_close+0x27/0x50 kernel/kcov.c:519
 __fput+0x3fe/0x8e0 fs/file_table.c:311
 task_work_run+0x129/0x1a0 kernel/task_work.c:188
 exit_task_work include/linux/task_work.h:33 [inline]
 do_exit+0x6a3/0x2480 kernel/exit.c:874
 do_group_exit+0x144/0x310 kernel/exit.c:996
 get_signal+0xc66/0x14e0 kernel/signal.c:2900
 arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:867
 handle_signal_work kernel/entry/common.c:154 [inline]
 exit_to_user_mode_loop+0x97/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+0x5d/0x240 kernel/entry/common.c:307
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff88805bed0b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805bed0b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88805bed0c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff88805bed0c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805bed0d00: 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/04/01 13:40 linux-5.15.y 0c935c049b5c 36d76a97 .config console log report syz / log [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_get_neigh
2025/04/01 12:57 linux-5.15.y 0c935c049b5c 36d76a97 .config console log report syz / log [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_get_neigh
2025/04/01 12:18 linux-5.15.y 0c935c049b5c 36d76a97 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_get_neigh
2025/04/07 20:14 linux-5.15.y 0c935c049b5c a2ada0e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_get_neigh
2025/04/07 20:13 linux-5.15.y 0c935c049b5c a2ada0e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_get_neigh
2025/04/07 20:12 linux-5.15.y 0c935c049b5c a2ada0e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_get_neigh
* Struck through repros no longer work on HEAD.