[v5.15] KASAN: use-after-free Read in ax25_fillin_cb (2)

4 views
Skip to first unread message

syzbot

unread,
Dec 29, 2024, 3:09:26 AM12/29/24
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 91786f140358 Linux 5.15.175
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13f42818580000
kernel config: https://syzkaller.appspot.com/x/.config?x=1fc30776feb70ea7
dashboard link: https://syzkaller.appspot.com/bug?extid=cb55d909987f69524941
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/210b1e4b59b1/disk-91786f14.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1cf8391059a0/vmlinux-91786f14.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1d9077a44b1c/bzImage-91786f14.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+cb55d9...@syzkaller.appspotmail.com

loop8: detected capacity change from 0 to 1024
==================================================================
BUG: KASAN: use-after-free in ax25_fillin_cb_from_dev net/ax25/af_ax25.c:468 [inline]
BUG: KASAN: use-after-free in ax25_fillin_cb+0x460/0x660 net/ax25/af_ax25.c:495
Read of size 4 at addr ffff88807a4b1138 by task syz.8.745/8335

CPU: 0 PID: 8335 Comm: syz.8.745 Not tainted 5.15.175-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
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
ax25_fillin_cb_from_dev net/ax25/af_ax25.c:468 [inline]
ax25_fillin_cb+0x460/0x660 net/ax25/af_ax25.c:495
ax25_setsockopt+0xab7/0xe70 net/ax25/af_ax25.c:690
__sys_setsockopt+0x57e/0x990 net/socket.c:2203
__do_sys_setsockopt net/socket.c:2214 [inline]
__se_sys_setsockopt net/socket.c:2211 [inline]
__x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2211
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:0x7f75e4180d29
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:00007f75e1ff1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007f75e4370fa0 RCX: 00007f75e4180d29
RDX: 0000000000000019 RSI: 0000000000000101 RDI: 0000000000000005
RBP: 00007f75e41fcb08 R08: 0000000000000010 R09: 0000000000000000
R10: 0000000020000280 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f75e4370fa0 R15: 00007fff371316c8
</TASK>

Allocated by task 6410:
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]
kzalloc include/linux/slab.h:721 [inline]
ax25_dev_device_up+0x51/0x5a0 net/ax25/ax25_dev.c:55
ax25_device_event+0x49b/0x500 net/ax25/af_ax25.c:139
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
__dev_notify_flags+0x304/0x610
dev_change_flags+0xe7/0x190 net/core/dev.c:8897
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+0x47f/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 8161:
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
ax25_dev_put include/net/ax25.h:302 [inline]
ax25_release+0x3b3/0x840 net/ax25/af_ax25.c:1062
__sock_release net/socket.c:649 [inline]
sock_close+0xcd/0x230 net/socket.c:1336
__fput+0x3fe/0x8e0 fs/file_table.c:280
task_work_run+0x129/0x1a0 kernel/task_work.c:188
get_signal+0x143a/0x14e0 kernel/signal.c:2672
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

The buggy address belongs to the object at ffff88807a4b1100
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 56 bytes inside of
192-byte region [ffff88807a4b1100, ffff88807a4b11c0)
The buggy address belongs to the page:
page:ffffea0001e92c40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7a4b1
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 0000000600000001 ffff888017441a00
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 5906, ts 208706617137, free_ts 206434394241
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
__alloc_pages+0x272/0x700 mm/page_alloc.c:5465
__alloc_pages_node include/linux/gfp.h:570 [inline]
alloc_slab_page mm/slub.c:1777 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xb1/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
__kmalloc_node+0x1fa/0x390 mm/slub.c:4451
kmalloc_array_node include/linux/slab.h:684 [inline]
kcalloc_node include/linux/slab.h:689 [inline]
memcg_alloc_page_obj_cgroups+0x7e/0x120 mm/memcontrol.c:2836
account_slab_page mm/slab.h:424 [inline]
allocate_slab mm/slub.c:1928 [inline]
new_slab+0xfb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 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+0x18e/0x280 mm/slub.c:3233
sock_alloc_inode+0x17/0xb0 net/socket.c:303
alloc_inode fs/inode.c:236 [inline]
new_inode_pseudo+0x60/0x210 fs/inode.c:976
sock_alloc net/socket.c:626 [inline]
__sock_create+0x11f/0x8f0 net/socket.c:1450
sock_create net/socket.c:1542 [inline]
__sys_socket+0x132/0x370 net/socket.c:1584
__do_sys_socket net/socket.c:1593 [inline]
__se_sys_socket net/socket.c:1591 [inline]
__x64_sys_socket+0x76/0x80 net/socket.c:1591
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
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_list+0x1f7/0x8e0 mm/page_alloc.c:3433
release_pages+0x1bb9/0x1f40 mm/swap.c:963
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
tlb_flush_mmu mm/mmu_gather.c:247 [inline]
tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:338
exit_mmap+0x3cd/0x620 mm/mmap.c:3206
__mmput+0x112/0x3b0 kernel/fork.c:1127
exit_mm+0x688/0x7f0 kernel/exit.c:550
do_exit+0x626/0x2480 kernel/exit.c:861
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
irqentry_exit_to_user_mode+0x5/0x30 kernel/entry/common.c:320
exc_page_fault+0x342/0x700 arch/x86/mm/fault.c:1504
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606

Memory state around the buggy address:
ffff88807a4b1000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807a4b1080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88807a4b1100: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807a4b1180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88807a4b1200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Feb 26, 2025, 1:45:19 PM2/26/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: c16c81c81336 Linux 5.15.178
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11cef7a4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d302c69e93fb6774
dashboard link: https://syzkaller.appspot.com/bug?extid=cb55d909987f69524941
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16545fa4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=143f0ff8580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/267e46ee7273/disk-c16c81c8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/944e289206cf/vmlinux-c16c81c8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f8cadf62458e/bzImage-c16c81c8.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+cb55d9...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in ax25_fillin_cb_from_dev net/ax25/af_ax25.c:468 [inline]
BUG: KASAN: use-after-free in ax25_fillin_cb+0x460/0x660 net/ax25/af_ax25.c:495
Read of size 4 at addr ffff88801a398538 by task syz-executor373/4174

CPU: 1 PID: 4174 Comm: syz-executor373 Not tainted 5.15.178-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
ax25_fillin_cb_from_dev net/ax25/af_ax25.c:468 [inline]
ax25_fillin_cb+0x460/0x660 net/ax25/af_ax25.c:495
ax25_setsockopt+0xab7/0xe70 net/ax25/af_ax25.c:690
__sys_setsockopt+0x57e/0x990 net/socket.c:2203
__do_sys_setsockopt net/socket.c:2214 [inline]
__se_sys_setsockopt net/socket.c:2211 [inline]
__x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2211
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:0x7fcecb315619
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 31 1a 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffa6ffab58 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fcecb315619
RDX: 0000000000000019 RSI: 0000000000000101 RDI: 0000000000000007
RBP: 00007fffa6ffab90 R08: 0000000000000010 R09: 0000000000000001
R10: 00004000000000c0 R11: 0000000000000246 R12: 00000000000f4240
R13: 000000000000e4aa R14: 00007fffa6ffab74 R15: 00007fffa6ffab80
</TASK>

Allocated by task 4172:
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]
kzalloc include/linux/slab.h:721 [inline]
ax25_dev_device_up+0x51/0x5a0 net/ax25/ax25_dev.c:55
ax25_device_event+0x49b/0x500 net/ax25/af_ax25.c:139
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
__dev_notify_flags+0x304/0x610
dev_change_flags+0xe7/0x190 net/core/dev.c:8897
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+0x47f/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 4173:
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
ax25_dev_put include/net/ax25.h:302 [inline]
ax25_release+0x3b3/0x840 net/ax25/af_ax25.c:1062
__sock_release net/socket.c:649 [inline]
sock_close+0xcd/0x230 net/socket.c:1336
__fput+0x3fe/0x8e0 fs/file_table.c:280
task_work_run+0x129/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
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

The buggy address belongs to the object at ffff88801a398500
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 56 bytes inside of
192-byte region [ffff88801a398500, ffff88801a3985c0)
The buggy address belongs to the page:
page:ffffea000068e600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1a398
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888017441a00
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 2261896935, free_ts 0
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
__alloc_pages+0x272/0x700 mm/page_alloc.c:5465
alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 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+0x1a0/0x290 mm/slub.c:3245
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
call_usermodehelper_setup+0x8a/0x260 kernel/umh.c:365
kobject_uevent_env+0x681/0x8d0 lib/kobject_uevent.c:629
kernel_add_sysfs_param+0x106/0x130 kernel/params.c:816
param_sysfs_builtin+0x16a/0x1f0 kernel/params.c:851
param_sysfs_init+0x66/0x70 kernel/params.c:970
do_one_initcall+0x22b/0x7a0 init/main.c:1302
do_initcall_level+0x157/0x210 init/main.c:1375
do_initcalls+0x49/0x90 init/main.c:1391
kernel_init_freeable+0x425/0x5c0 init/main.c:1615
kernel_init+0x19/0x290 init/main.c:1506
page_owner free stack trace missing

Memory state around the buggy address:
ffff88801a398400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801a398480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88801a398500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801a398580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88801a398600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages