On 12/25/24 21:11, Waiman Long wrote:
On 12/24/24 7:28 AM, Kun Hu wrote:
Hello,
When using fuzzer tool to fuzz the latest Linux kernel, the following crash
was triggered.
HEAD commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
git tree: upstream
Console output:https://drive.google.com/file/d/11IXj9a4uRbOaqIK90F2px6nLiHhJ04rw/view?usp=sharing
Kernel config: https://drive.google.com/file/d/1RhT5dFTs6Vx1U71PbpenN7TPtnPoa3NI/view?usp=sharing
C reproducer: https://drive.google.com/file/d/1BP2d5rfb4XBuq0njxKnS6d3AoysIiT61/view?usp=sharing
Syzlang reproducer: https://drive.google.com/file/d/1lTQrXRQfndtigBiKBxelQeHszr2dzbLp/view?usp=sharing
Similar report: https://lore.kernel.org/lkml/CALcu4rZOs3sbXBWARhjM6d8UngPUF3bU1CPmSZBugUpgaP_0WA@xxxxxxxxxxxxxx/T/
This bug seems to have been reported and fixed in the old kernel, which seems to be a regression issue? If you fix this issue, please add the following tag to the commit:
Reported-by: Kun Hu <huk23@xxxxxxxxxxxxxx>
==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0x370b/0x4a10 kernel/locking/lockdep.c:5089
Read of size 8 at addr ff1100000289acb8 by task syz.6.1904/11159
CPU: 1 UID: 0 PID: 11159 Comm: syz.6.1904 Not tainted 6.13.0-rc3 #3
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1b0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xcf/0x5f0 mm/kasan/report.c:489
kasan_report+0x93/0xc0 mm/kasan/report.c:602
__lock_acquire+0x370b/0x4a10 kernel/locking/lockdep.c:5089
lock_acquire kernel/locking/lockdep.c:5849 [inline]
lock_acquire+0x1b1/0x580 kernel/locking/lockdep.c:5814
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:551 [inline]
try_to_wake_up+0xb5/0x23c0 kernel/sched/core.c:4205
io_sq_thread_park+0xac/0xe0 io_uring/sqpoll.c:55
io_sq_thread_finish+0x6b/0x310 io_uring/sqpoll.c:96
io_sq_offload_create+0x162/0x11d0 io_uring/sqpoll.c:497
io_uring_create io_uring/io_uring.c:3724 [inline]
io_uring_setup+0x1728/0x3230 io_uring/io_uring.c:3806
__do_sys_io_uring_setup io_uring/io_uring.c:3833 [inline]
__se_sys_io_uring_setup io_uring/io_uring.c:3827 [inline]
__x64_sys_io_uring_setup+0x94/0x140 io_uring/io_uring.c:3827
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xc3/0x1d0 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa4396a071d
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa4382f3ba8 EFLAGS: 00000246 ORIG_RAX: 00000000000001a9
RAX: ffffffffffffffda RBX: 00007fa439862f80 RCX: 00007fa4396a071d
RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000002616
RBP: 00007fa4382f3c00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000015
R13: 00007fa439862f8c R14: 00007fa439863018 R15: 00007fa4382f3d40
</TASK>
This is not caused by a locking bug. The freed structure is a task_struct which is passed by io_sq_thread() to try_to_wake_up(). So the culprit is probably in the io_uring code. cc'ing the io_uring developers for further review.
Thanks for the report, we'll take a look
--
Pavel Begunkov