[syzbot] [mm?] kernel panic: corrupted stack end in userfaultfd_ioctl

8 views
Skip to first unread message

syzbot

unread,
Jun 3, 2024, 9:05:34 AMJun 3
to ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4a4be1ad3a6e Revert "vfs: Delete the associated dentry whe..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=104284f2980000
kernel config: https://syzkaller.appspot.com/x/.config?x=bd6024aedb15e15c
dashboard link: https://syzkaller.appspot.com/bug?extid=5a1cb2c00e895afca87e
compiler: aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=124e1664980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15683162980000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/384ffdcca292/non_bootable_disk-4a4be1ad.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/75957361122b/vmlinux-4a4be1ad.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6c766b0ec377/Image-4a4be1ad.gz.xz

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

Kernel panic - not syncing: corrupted stack end detected inside scheduler
CPU: 1 PID: 3188 Comm: syz-executor396 Not tainted 6.10.0-rc1-syzkaller-00027-g4a4be1ad3a6e #0
Hardware name: linux,dummy-virt (DT)
Call trace:
dump_backtrace+0x94/0xec arch/arm64/kernel/stacktrace.c:317
show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:324
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x38/0x90 lib/dump_stack.c:114
dump_stack+0x18/0x24 lib/dump_stack.c:123
panic+0x39c/0x3d0 kernel/panic.c:347
schedule_debug kernel/sched/core.c:5962 [inline]
schedule+0x0/0x104 kernel/sched/core.c:6628
preempt_schedule_irq+0x3c/0x80 kernel/sched/core.c:7067
arm64_preempt_schedule_irq arch/arm64/kernel/entry-common.c:301 [inline]
__el1_irq arch/arm64/kernel/entry-common.c:539 [inline]
el1_interrupt+0x4c/0x64 arch/arm64/kernel/entry-common.c:551
el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:556
el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:594
__rcu_read_lock+0x0/0x14 kernel/rcu/tree_stall.h:125
pte_offset_map_nolock+0x38/0xb0 mm/pgtable-generic.c:314
move_pages_pte mm/userfaultfd.c:1160 [inline]
move_pages+0x330/0x13a4 mm/userfaultfd.c:1733
userfaultfd_move fs/userfaultfd.c:2016 [inline]
userfaultfd_ioctl+0x6f4/0x1ed8 fs/userfaultfd.c:2134
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl fs/ioctl.c:893 [inline]
__arm64_sys_ioctl+0xac/0xf0 fs/ioctl.c:893
__invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
invoke_syscall+0x48/0x118 arch/arm64/kernel/syscall.c:48
el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:133
do_el0_svc+0x1c/0x28 arch/arm64/kernel/syscall.c:152
el0_svc+0x34/0xf8 arch/arm64/kernel/entry-common.c:712
el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:730
el0t_64_sync+0x19c/0x1a0 arch/arm64/kernel/entry.S:598
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x00,00000006,8f17bd7c,1767f6bf
Memory Limit: none
Rebooting in 86400 seconds..


---
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 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.

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

Hillf Danton

unread,
Jun 4, 2024, 8:37:15 AMJun 4
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Mon, 03 Jun 2024 06:05:33 -0700
> syzbot found the following issue on:
>
> HEAD commit: 4a4be1ad3a6e Revert "vfs: Delete the associated dentry whe..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15683162980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

--- a/arch/arm64/mm/contpte.c
+++ b/arch/arm64/mm/contpte.c
@@ -376,7 +376,7 @@ void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,
* clearing access/dirty for the whole block.
*/
unsigned long start = addr;
- unsigned long end = start + nr;
+ unsigned long end = start + nr * PAGE_SIZE;

if (pte_cont(__ptep_get(ptep + nr - 1)))
end = ALIGN(end, CONT_PTE_SIZE);
@@ -386,7 +386,7 @@ void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,
ptep = contpte_align_down(ptep);
}

- __clear_young_dirty_ptes(vma, start, ptep, end - start, flags);
+ __clear_young_dirty_ptes(vma, start, ptep, (end - start) / PAGE_SIZE, flags);
}
EXPORT_SYMBOL_GPL(contpte_clear_young_dirty_ptes);

--

syzbot

unread,
Jun 4, 2024, 9:04:07 AMJun 4
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+5a1cb2...@syzkaller.appspotmail.com

Tested on:

commit: 2ab79514 Merge tag 'cxl-fixes-6.10-rc3' of git://git.k..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=108249bc980000
kernel config: https://syzkaller.appspot.com/x/.config?x=48aeb395bedeb71f
dashboard link: https://syzkaller.appspot.com/bug?extid=5a1cb2c00e895afca87e
compiler: aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=14d60c26980000

Note: testing is done by a robot and is best-effort only.

Andrew Morton

unread,
Jun 4, 2024, 11:23:33 PMJun 4
to syzbot, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com, Lance Yang, Hillf Danton

For some reason this thread doesn't appear in my linux-mm archive.
Lance, please take a look?

Lance Yang

unread,
Jun 9, 2024, 7:52:40 PMJun 9
to Andrew Morton, syzbot, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com, Hillf Danton
On Wed, Jun 5, 2024 at 11:23 AM Andrew Morton <ak...@linux-foundation.org> wrote:
>
>
> For some reason this thread doesn't appear in my linux-mm archive.
> Lance, please take a look?

Hi Andrew, thanks for pointing this out!

Hi Hillf, thanks a lot for helping to test the patch[1] with syzbot!

I noticed that syzbot has confirmed the patch and that the reproducer
did not trigger any issues[2].

Hopefully, the patch[3] will land in -rc3 to make the testing bots happy.

[1] https://lore.kernel.org/all/20240604123656...@sina.com/
[2] https://lore.kernel.org/all/000000000000a3...@google.com/
[3] https://lore.kernel.org/linux-mm/20240524005444....@gmail.com/

Thanks,
Lance
Reply all
Reply to author
Forward
0 new messages