[v5.15] KASAN: use-after-free Read in sk_psock_verdict_data_ready

8 views
Skip to first unread message

syzbot

unread,
Aug 18, 2024, 12:55:25 AM8/18/24
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 7e89efd3ae1c Linux 5.15.164
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1092acfd980000
kernel config: https://syzkaller.appspot.com/x/.config?x=ef3d6716c47442fa
dashboard link: https://syzkaller.appspot.com/bug?extid=adeaaeac87c027191309
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/39cf3e32ff98/disk-7e89efd3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5832802d8e4b/vmlinux-7e89efd3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/fe6dc074e0ff/bzImage-7e89efd3.xz

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

==================================================================
BUG: KASAN: use-after-free in sk_psock_verdict_data_ready+0xc2/0x1a0 net/core/skmsg.c:1212
Read of size 8 at addr ffff888076bfe620 by task syz.3.119/4031

CPU: 0 PID: 4031 Comm: syz.3.119 Not tainted 5.15.164-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/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
sk_psock_verdict_data_ready+0xc2/0x1a0 net/core/skmsg.c:1212
unix_stream_sendmsg+0x8fd/0x1070 net/unix/af_unix.c:2106
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431
___sys_sendmsg+0x252/0x2e0 net/socket.c:2485
__sys_sendmsg net/socket.c:2514 [inline]
__do_sys_sendmsg net/socket.c:2523 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2521
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:0x7f6118853e79
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:00007f6116c8e038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f61189f0130 RCX: 00007f6118853e79
RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000007
RBP: 00007f61188c1916 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f61189f0130 R15: 00007ffdcf109678
</TASK>

Allocated by task 4031:
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_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/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:937
sock_alloc net/socket.c:626 [inline]
__sock_create+0x11f/0x8d0 net/socket.c:1450
sock_create net/socket.c:1537 [inline]
__sys_socketpair+0x2c1/0x700 net/socket.c:1637
__do_sys_socketpair net/socket.c:1690 [inline]
__se_sys_socketpair net/socket.c:1687 [inline]
__x64_sys_socketpair+0x97/0xb0 net/socket.c:1687
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 20:
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]
kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
rcu_do_batch kernel/rcu/tree.c:2523 [inline]
rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2763
handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925
smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:3007 [inline]
call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
__dentry_kill+0x436/0x650 fs/dcache.c:586
dentry_kill+0xbb/0x290
dput+0xd8/0x1a0 fs/dcache.c:893
__fput+0x636/0x8e0 fs/file_table.c:288
task_work_run+0x129/0x1a0 kernel/task_work.c:164
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

Second to last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:3007 [inline]
call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
__dentry_kill+0x436/0x650 fs/dcache.c:586
dentry_kill+0xbb/0x290
dput+0xd8/0x1a0 fs/dcache.c:893
__fput+0x636/0x8e0 fs/file_table.c:288
task_work_run+0x129/0x1a0 kernel/task_work.c:164
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 ffff888076bfe600
which belongs to the cache sock_inode_cache of size 1408
The buggy address is located 32 bytes inside of
1408-byte region [ffff888076bfe600, ffff888076bfeb80)
The buggy address belongs to the page:
page:ffffea0001dafe00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888076bfc800 pfn:0x76bf8
head:ffffea0001dafe00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888023578901
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001891200 0000000500000005 ffff888016be4500
raw: ffff888076bfc800 0000000080150013 00000001ffffffff ffff888023578901
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 3241, ts 24480113734, free_ts 10607067521
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5423
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+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:937
sock_alloc net/socket.c:626 [inline]
__sock_create+0x11f/0x8d0 net/socket.c:1450
sock_create net/socket.c:1537 [inline]
__sys_socketpair+0x335/0x700 net/socket.c:1641
__do_sys_socketpair net/socket.c:1690 [inline]
__se_sys_socketpair net/socket.c:1687 [inline]
__x64_sys_socketpair+0x97/0xb0 net/socket.c:1687
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+0x95/0x2d0 mm/page_alloc.c:3396
free_contig_range+0x95/0xf0 mm/page_alloc.c:9342
destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018
debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331
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
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
ffff888076bfe500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888076bfe580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888076bfe600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888076bfe680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888076bfe700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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,
Nov 25, 2024, 11:55:16 PM11/25/24
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages