* [syzbot] [mm?] general protection fault in shmem_mapping
@ 2025-02-14 15:48 syzbot
2025-02-14 18:57 ` Zi Yan
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: syzbot @ 2025-02-14 15:48 UTC (permalink / raw)
To: akpm, hughd, linux-kernel, linux-mm, syzkaller-bugs, ziy
Hello,
syzbot found the following issue on:
HEAD commit: df5d6180169a Add linux-next specific files for 20250210
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=16d343f8580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2cd616b6e736ca7
dashboard link: https://syzkaller.appspot.com/bug?extid=012c6245eaea0e23f7f9
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=138972a4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11737b18580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/92495cf20271/disk-df5d6180.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4b3656161842/vmlinux-df5d6180.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7fbc4e7a0f5d/bzImage-df5d6180.xz
The issue was bisected to:
commit 19c067c8a0f18b62d4a4235b0b327624c86f2e40
Author: Zi Yan <ziy@nvidia.com>
Date: Wed Feb 5 03:14:13 2025 +0000
mm/huge_memory: add buddy allocator like folio_split()
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=102f9bdf980000
final oops: https://syzkaller.appspot.com/x/report.txt?x=122f9bdf980000
console output: https://syzkaller.appspot.com/x/log.txt?x=142f9bdf980000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+012c6245eaea0e23f7f9@syzkaller.appspotmail.com
Fixes: 19c067c8a0f1 ("mm/huge_memory: add buddy allocator like folio_split()")
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000024: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000120-0x0000000000000127]
CPU: 1 UID: 0 PID: 5949 Comm: syz-executor163 Not tainted 6.14.0-rc2-next-20250210-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__split_unmapped_folio+0x238a/0x3e50 mm/huge_memory.c:3587
__folio_split+0x1267/0x16d0 mm/huge_memory.c:3871
try_folio_split include/linux/huge_mm.h:374 [inline]
truncate_inode_partial_folio+0x55d/0xdc0 mm/truncate.c:230
shmem_undo_range+0xab7/0x1820 mm/shmem.c:1144
shmem_truncate_range mm/shmem.c:1224 [inline]
shmem_fallocate+0x431/0xf20 mm/shmem.c:3674
vfs_fallocate+0x623/0x7a0 fs/open.c:338
madvise_remove mm/madvise.c:1034 [inline]
madvise_vma_behavior mm/madvise.c:1269 [inline]
madvise_walk_vmas mm/madvise.c:1511 [inline]
madvise_do_behavior+0x1f29/0x3c00 mm/madvise.c:1646
do_madvise mm/madvise.c:1744 [inline]
__do_sys_madvise mm/madvise.c:1752 [inline]
__se_sys_madvise mm/madvise.c:1750 [inline]
__x64_sys_madvise+0x11b/0x140 mm/madvise.c:1750
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5e04576519
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5e04531218 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
RAX: ffffffffffffffda RBX: 00007f5e04600308 RCX: 00007f5e04576519
RDX: 0000000000000009 RSI: 0000000000600003 RDI: 0000400000000000
RBP: 00007f5e04600300 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5e045cd074
R13: 0000400000000000 R14: 0000400000000140 R15: 0000400000000040
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: f3 0f 1e fa endbr64
9: 53 push %rbx
a: 48 89 fb mov %rdi,%rbx
d: e8 c3 3a bd ff call 0xffbd3ad5
12: 48 81 c3 20 01 00 00 add $0x120,%rbx
19: 48 89 d8 mov %rbx,%rax
1c: 48 c1 e8 03 shr $0x3,%rax
20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
27: fc ff df
* 2a: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
2e: 74 08 je 0x38
30: 48 89 df mov %rbx,%rdi
33: e8 dd 35 24 00 call 0x243615
38: 48 c7 c0 80 6c 14 8c mov $0xffffffff8c146c80,%rax
3f: 48 rex.W
---
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 syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [mm?] general protection fault in shmem_mapping
2025-02-14 15:48 [syzbot] [mm?] general protection fault in shmem_mapping syzbot
@ 2025-02-14 18:57 ` Zi Yan
2025-02-14 23:26 ` Zi Yan
2025-02-15 0:48 ` Zi Yan
2 siblings, 0 replies; 8+ messages in thread
From: Zi Yan @ 2025-02-14 18:57 UTC (permalink / raw)
To: syzbot; +Cc: akpm, hughd, linux-kernel, linux-mm, syzkaller-bugs
On 14 Feb 2025, at 10:48, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: df5d6180169a Add linux-next specific files for 20250210
> git tree: linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=16d343f8580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=2cd616b6e736ca7
> dashboard link: https://syzkaller.appspot.com/bug?extid=012c6245eaea0e23f7f9
> 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=138972a4580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11737b18580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/92495cf20271/disk-df5d6180.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/4b3656161842/vmlinux-df5d6180.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/7fbc4e7a0f5d/bzImage-df5d6180.xz
>
> The issue was bisected to:
>
> commit 19c067c8a0f18b62d4a4235b0b327624c86f2e40
> Author: Zi Yan <ziy@nvidia.com>
> Date: Wed Feb 5 03:14:13 2025 +0000
>
> mm/huge_memory: add buddy allocator like folio_split()
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=102f9bdf980000
> final oops: https://syzkaller.appspot.com/x/report.txt?x=122f9bdf980000
> console output: https://syzkaller.appspot.com/x/log.txt?x=142f9bdf980000
I have reproduced it locally and am working on a fix. Thanks for the reporting.
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [mm?] general protection fault in shmem_mapping
2025-02-14 15:48 [syzbot] [mm?] general protection fault in shmem_mapping syzbot
2025-02-14 18:57 ` Zi Yan
@ 2025-02-14 23:26 ` Zi Yan
2025-02-14 23:26 ` syzbot
2025-02-15 0:48 ` Zi Yan
2 siblings, 1 reply; 8+ messages in thread
From: Zi Yan @ 2025-02-14 23:26 UTC (permalink / raw)
To: syzbot; +Cc: akpm, hughd, linux-kernel, linux-mm, syzkaller-bugs
On 14 Feb 2025, at 10:48, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: df5d6180169a Add linux-next specific files for 20250210
> git tree: linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=16d343f8580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=2cd616b6e736ca7
> dashboard link: https://syzkaller.appspot.com/bug?extid=012c6245eaea0e23f7f9
> 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=138972a4580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11737b18580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/92495cf20271/disk-df5d6180.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/4b3656161842/vmlinux-df5d6180.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/7fbc4e7a0f5d/bzImage-df5d6180.xz
>
> The issue was bisected to:
>
> commit 19c067c8a0f18b62d4a4235b0b327624c86f2e40
> Author: Zi Yan <ziy@nvidia.com>
> Date: Wed Feb 5 03:14:13 2025 +0000
>
> mm/huge_memory: add buddy allocator like folio_split()
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=102f9bdf980000
> final oops: https://syzkaller.appspot.com/x/report.txt?x=122f9bdf980000
> console output: https://syzkaller.appspot.com/x/log.txt?x=142f9bdf980000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+012c6245eaea0e23f7f9@syzkaller.appspotmail.com
> Fixes: 19c067c8a0f1 ("mm/huge_memory: add buddy allocator like folio_split()")
>
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000024: 0000 [#1] PREEMPT SMP KASAN PTI
> KASAN: null-ptr-deref in range [0x0000000000000120-0x0000000000000127]
> CPU: 1 UID: 0 PID: 5949 Comm: syz-executor163 Not tainted 6.14.0-rc2-next-20250210-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
> RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
> Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
> RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
> RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
> RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
> RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
> R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
> R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
> FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <TASK>
> __split_unmapped_folio+0x238a/0x3e50 mm/huge_memory.c:3587
> __folio_split+0x1267/0x16d0 mm/huge_memory.c:3871
> try_folio_split include/linux/huge_mm.h:374 [inline]
> truncate_inode_partial_folio+0x55d/0xdc0 mm/truncate.c:230
> shmem_undo_range+0xab7/0x1820 mm/shmem.c:1144
> shmem_truncate_range mm/shmem.c:1224 [inline]
> shmem_fallocate+0x431/0xf20 mm/shmem.c:3674
> vfs_fallocate+0x623/0x7a0 fs/open.c:338
> madvise_remove mm/madvise.c:1034 [inline]
> madvise_vma_behavior mm/madvise.c:1269 [inline]
> madvise_walk_vmas mm/madvise.c:1511 [inline]
> madvise_do_behavior+0x1f29/0x3c00 mm/madvise.c:1646
> do_madvise mm/madvise.c:1744 [inline]
> __do_sys_madvise mm/madvise.c:1752 [inline]
> __se_sys_madvise mm/madvise.c:1750 [inline]
> __x64_sys_madvise+0x11b/0x140 mm/madvise.c:1750
> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f5e04576519
> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 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 b0 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f5e04531218 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
> RAX: ffffffffffffffda RBX: 00007f5e04600308 RCX: 00007f5e04576519
> RDX: 0000000000000009 RSI: 0000000000600003 RDI: 0000400000000000
> RBP: 00007f5e04600300 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5e045cd074
> R13: 0000400000000000 R14: 0000400000000140 R15: 0000400000000040
> </TASK>
> Modules linked in:
> ---[ end trace 0000000000000000 ]---
> RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
> Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
> RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
> RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
> RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
> RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
> R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
> R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
> FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> ----------------
> Code disassembly (best guess):
> 0: 90 nop
> 1: 90 nop
> 2: 90 nop
> 3: 90 nop
> 4: 90 nop
> 5: f3 0f 1e fa endbr64
> 9: 53 push %rbx
> a: 48 89 fb mov %rdi,%rbx
> d: e8 c3 3a bd ff call 0xffbd3ad5
> 12: 48 81 c3 20 01 00 00 add $0x120,%rbx
> 19: 48 89 d8 mov %rbx,%rax
> 1c: 48 c1 e8 03 shr $0x3,%rax
> 20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
> 27: fc ff df
> * 2a: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
> 2e: 74 08 je 0x38
> 30: 48 89 df mov %rbx,%rdi
> 33: e8 dd 35 24 00 call 0x243615
> 38: 48 c7 c0 80 6c 14 8c mov $0xffffffff8c146c80,%rax
> 3f: 48 rex.W
>
#syz test: github.com:x-y-z/linux-1gb-thp.git syzkaller_fix_20250114
origin_folio->mapping becomes NULL, since it was dropped, and the remaining
after-split folios are still trying to use origin_folio->mapping. It leads
to the error. And the original __split_huge_page() did not check
origin_folio->index nor dropped it. __split_unmapped_folio() should keep
the original behavior.
Fixed it by not dropping origin_folio.
My local test do not fail and I am triggering syzbot to test the change
to confirm it.
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [mm?] general protection fault in shmem_mapping
2025-02-14 23:26 ` Zi Yan
@ 2025-02-14 23:26 ` syzbot
2025-02-14 23:28 ` Zi Yan
0 siblings, 1 reply; 8+ messages in thread
From: syzbot @ 2025-02-14 23:26 UTC (permalink / raw)
To: ziy; +Cc: akpm, hughd, linux-kernel, linux-mm, syzkaller-bugs, ziy
> On 14 Feb 2025, at 10:48, syzbot wrote:
>
>> Hello,
>>
>> syzbot found the following issue on:
>>
>> HEAD commit: df5d6180169a Add linux-next specific files for 20250210
>> git tree: linux-next
>> console+strace: https://syzkaller.appspot.com/x/log.txt?x=16d343f8580000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=2cd616b6e736ca7
>> dashboard link: https://syzkaller.appspot.com/bug?extid=012c6245eaea0e23f7f9
>> 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=138972a4580000
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11737b18580000
>>
>> Downloadable assets:
>> disk image: https://storage.googleapis.com/syzbot-assets/92495cf20271/disk-df5d6180.raw.xz
>> vmlinux: https://storage.googleapis.com/syzbot-assets/4b3656161842/vmlinux-df5d6180.xz
>> kernel image: https://storage.googleapis.com/syzbot-assets/7fbc4e7a0f5d/bzImage-df5d6180.xz
>>
>> The issue was bisected to:
>>
>> commit 19c067c8a0f18b62d4a4235b0b327624c86f2e40
>> Author: Zi Yan <ziy@nvidia.com>
>> Date: Wed Feb 5 03:14:13 2025 +0000
>>
>> mm/huge_memory: add buddy allocator like folio_split()
>>
>> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=102f9bdf980000
>> final oops: https://syzkaller.appspot.com/x/report.txt?x=122f9bdf980000
>> console output: https://syzkaller.appspot.com/x/log.txt?x=142f9bdf980000
>>
>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>> Reported-by: syzbot+012c6245eaea0e23f7f9@syzkaller.appspotmail.com
>> Fixes: 19c067c8a0f1 ("mm/huge_memory: add buddy allocator like folio_split()")
>>
>> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000024: 0000 [#1] PREEMPT SMP KASAN PTI
>> KASAN: null-ptr-deref in range [0x0000000000000120-0x0000000000000127]
>> CPU: 1 UID: 0 PID: 5949 Comm: syz-executor163 Not tainted 6.14.0-rc2-next-20250210-syzkaller #0
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
>> RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
>> Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
>> RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
>> RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
>> RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
>> RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
>> R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
>> R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
>> FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>> Call Trace:
>> <TASK>
>> __split_unmapped_folio+0x238a/0x3e50 mm/huge_memory.c:3587
>> __folio_split+0x1267/0x16d0 mm/huge_memory.c:3871
>> try_folio_split include/linux/huge_mm.h:374 [inline]
>> truncate_inode_partial_folio+0x55d/0xdc0 mm/truncate.c:230
>> shmem_undo_range+0xab7/0x1820 mm/shmem.c:1144
>> shmem_truncate_range mm/shmem.c:1224 [inline]
>> shmem_fallocate+0x431/0xf20 mm/shmem.c:3674
>> vfs_fallocate+0x623/0x7a0 fs/open.c:338
>> madvise_remove mm/madvise.c:1034 [inline]
>> madvise_vma_behavior mm/madvise.c:1269 [inline]
>> madvise_walk_vmas mm/madvise.c:1511 [inline]
>> madvise_do_behavior+0x1f29/0x3c00 mm/madvise.c:1646
>> do_madvise mm/madvise.c:1744 [inline]
>> __do_sys_madvise mm/madvise.c:1752 [inline]
>> __se_sys_madvise mm/madvise.c:1750 [inline]
>> __x64_sys_madvise+0x11b/0x140 mm/madvise.c:1750
>> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>> do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
>> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>> RIP: 0033:0x7f5e04576519
>> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 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 b0 ff ff ff f7 d8 64 89 01 48
>> RSP: 002b:00007f5e04531218 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
>> RAX: ffffffffffffffda RBX: 00007f5e04600308 RCX: 00007f5e04576519
>> RDX: 0000000000000009 RSI: 0000000000600003 RDI: 0000400000000000
>> RBP: 00007f5e04600300 R08: 0000000000000000 R09: 0000000000000000
>> R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5e045cd074
>> R13: 0000400000000000 R14: 0000400000000140 R15: 0000400000000040
>> </TASK>
>> Modules linked in:
>> ---[ end trace 0000000000000000 ]---
>> RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
>> Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
>> RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
>> RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
>> RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
>> RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
>> R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
>> R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
>> FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>> ----------------
>> Code disassembly (best guess):
>> 0: 90 nop
>> 1: 90 nop
>> 2: 90 nop
>> 3: 90 nop
>> 4: 90 nop
>> 5: f3 0f 1e fa endbr64
>> 9: 53 push %rbx
>> a: 48 89 fb mov %rdi,%rbx
>> d: e8 c3 3a bd ff call 0xffbd3ad5
>> 12: 48 81 c3 20 01 00 00 add $0x120,%rbx
>> 19: 48 89 d8 mov %rbx,%rax
>> 1c: 48 c1 e8 03 shr $0x3,%rax
>> 20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
>> 27: fc ff df
>> * 2a: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
>> 2e: 74 08 je 0x38
>> 30: 48 89 df mov %rbx,%rdi
>> 33: e8 dd 35 24 00 call 0x243615
>> 38: 48 c7 c0 80 6c 14 8c mov $0xffffffff8c146c80,%rax
>> 3f: 48 rex.W
>>
>
>
> #syz test: github.com:x-y-z/linux-1gb-thp.git syzkaller_fix_20250114
"github.com:x-y-z/linux-1gb-thp.git" does not look like a valid git repo address.
>
> origin_folio->mapping becomes NULL, since it was dropped, and the remaining
> after-split folios are still trying to use origin_folio->mapping. It leads
> to the error. And the original __split_huge_page() did not check
> origin_folio->index nor dropped it. __split_unmapped_folio() should keep
> the original behavior.
>
> Fixed it by not dropping origin_folio.
>
> My local test do not fail and I am triggering syzbot to test the change
> to confirm it.
>
> Best Regards,
> Yan, Zi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [mm?] general protection fault in shmem_mapping
2025-02-14 23:26 ` syzbot
@ 2025-02-14 23:28 ` Zi Yan
2025-02-14 23:45 ` syzbot
0 siblings, 1 reply; 8+ messages in thread
From: Zi Yan @ 2025-02-14 23:28 UTC (permalink / raw)
To: syzbot; +Cc: akpm, hughd, linux-kernel, linux-mm, syzkaller-bugs
On 14 Feb 2025, at 18:26, syzbot wrote:
>> On 14 Feb 2025, at 10:48, syzbot wrote:
>>
>>> Hello,
>>>
>>> syzbot found the following issue on:
>>>
>>> HEAD commit: df5d6180169a Add linux-next specific files for 20250210
>>> git tree: linux-next
>>> console+strace: https://syzkaller.appspot.com/x/log.txt?x=16d343f8580000
>>> kernel config: https://syzkaller.appspot.com/x/.config?x=2cd616b6e736ca7
>>> dashboard link: https://syzkaller.appspot.com/bug?extid=012c6245eaea0e23f7f9
>>> 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=138972a4580000
>>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11737b18580000
>>>
>>> Downloadable assets:
>>> disk image: https://storage.googleapis.com/syzbot-assets/92495cf20271/disk-df5d6180.raw.xz
>>> vmlinux: https://storage.googleapis.com/syzbot-assets/4b3656161842/vmlinux-df5d6180.xz
>>> kernel image: https://storage.googleapis.com/syzbot-assets/7fbc4e7a0f5d/bzImage-df5d6180.xz
>>>
>>> The issue was bisected to:
>>>
>>> commit 19c067c8a0f18b62d4a4235b0b327624c86f2e40
>>> Author: Zi Yan <ziy@nvidia.com>
>>> Date: Wed Feb 5 03:14:13 2025 +0000
>>>
>>> mm/huge_memory: add buddy allocator like folio_split()
>>>
>>> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=102f9bdf980000
>>> final oops: https://syzkaller.appspot.com/x/report.txt?x=122f9bdf980000
>>> console output: https://syzkaller.appspot.com/x/log.txt?x=142f9bdf980000
>>>
>>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>>> Reported-by: syzbot+012c6245eaea0e23f7f9@syzkaller.appspotmail.com
>>> Fixes: 19c067c8a0f1 ("mm/huge_memory: add buddy allocator like folio_split()")
>>>
>>> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000024: 0000 [#1] PREEMPT SMP KASAN PTI
>>> KASAN: null-ptr-deref in range [0x0000000000000120-0x0000000000000127]
>>> CPU: 1 UID: 0 PID: 5949 Comm: syz-executor163 Not tainted 6.14.0-rc2-next-20250210-syzkaller #0
>>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
>>> RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
>>> Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
>>> RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
>>> RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
>>> RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
>>> RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
>>> R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
>>> R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
>>> FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
>>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>> CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
>>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>>> Call Trace:
>>> <TASK>
>>> __split_unmapped_folio+0x238a/0x3e50 mm/huge_memory.c:3587
>>> __folio_split+0x1267/0x16d0 mm/huge_memory.c:3871
>>> try_folio_split include/linux/huge_mm.h:374 [inline]
>>> truncate_inode_partial_folio+0x55d/0xdc0 mm/truncate.c:230
>>> shmem_undo_range+0xab7/0x1820 mm/shmem.c:1144
>>> shmem_truncate_range mm/shmem.c:1224 [inline]
>>> shmem_fallocate+0x431/0xf20 mm/shmem.c:3674
>>> vfs_fallocate+0x623/0x7a0 fs/open.c:338
>>> madvise_remove mm/madvise.c:1034 [inline]
>>> madvise_vma_behavior mm/madvise.c:1269 [inline]
>>> madvise_walk_vmas mm/madvise.c:1511 [inline]
>>> madvise_do_behavior+0x1f29/0x3c00 mm/madvise.c:1646
>>> do_madvise mm/madvise.c:1744 [inline]
>>> __do_sys_madvise mm/madvise.c:1752 [inline]
>>> __se_sys_madvise mm/madvise.c:1750 [inline]
>>> __x64_sys_madvise+0x11b/0x140 mm/madvise.c:1750
>>> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>>> do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
>>> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>>> RIP: 0033:0x7f5e04576519
>>> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 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 b0 ff ff ff f7 d8 64 89 01 48
>>> RSP: 002b:00007f5e04531218 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
>>> RAX: ffffffffffffffda RBX: 00007f5e04600308 RCX: 00007f5e04576519
>>> RDX: 0000000000000009 RSI: 0000000000600003 RDI: 0000400000000000
>>> RBP: 00007f5e04600300 R08: 0000000000000000 R09: 0000000000000000
>>> R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5e045cd074
>>> R13: 0000400000000000 R14: 0000400000000140 R15: 0000400000000040
>>> </TASK>
>>> Modules linked in:
>>> ---[ end trace 0000000000000000 ]---
>>> RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
>>> Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
>>> RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
>>> RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
>>> RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
>>> RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
>>> R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
>>> R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
>>> FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
>>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>> CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
>>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>>> ----------------
>>> Code disassembly (best guess):
>>> 0: 90 nop
>>> 1: 90 nop
>>> 2: 90 nop
>>> 3: 90 nop
>>> 4: 90 nop
>>> 5: f3 0f 1e fa endbr64
>>> 9: 53 push %rbx
>>> a: 48 89 fb mov %rdi,%rbx
>>> d: e8 c3 3a bd ff call 0xffbd3ad5
>>> 12: 48 81 c3 20 01 00 00 add $0x120,%rbx
>>> 19: 48 89 d8 mov %rbx,%rax
>>> 1c: 48 c1 e8 03 shr $0x3,%rax
>>> 20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
>>> 27: fc ff df
>>> * 2a: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
>>> 2e: 74 08 je 0x38
>>> 30: 48 89 df mov %rbx,%rdi
>>> 33: e8 dd 35 24 00 call 0x243615
>>> 38: 48 c7 c0 80 6c 14 8c mov $0xffffffff8c146c80,%rax
>>> 3f: 48 rex.W
>>>
>>
>>
>> #syz test: github.com:x-y-z/linux-1gb-thp.git syzkaller_fix_20250114
>
> "github.com:x-y-z/linux-1gb-thp.git" does not look like a valid git repo address.
#syz test: git@github.com:x-y-z/linux-1gb-thp.git syzkaller_fix_20250114
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [mm?] general protection fault in shmem_mapping
2025-02-14 23:28 ` Zi Yan
@ 2025-02-14 23:45 ` syzbot
0 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2025-02-14 23:45 UTC (permalink / raw)
To: akpm, hughd, linux-kernel, linux-mm, syzkaller-bugs, ziy
Hello,
syzbot tried to test the proposed patch but the build/boot failed:
failed to checkout kernel repo git@github.com:x-y-z/linux-1gb-thp.git/syzkaller_fix_20250114: failed to run ["git" "fetch" "--force" "21c4e043f63ee530c32221be8efae42773de1c65" "syzkaller_fix_20250114"]: exit status 128
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Tested on:
commit: [unknown
git tree: git@github.com:x-y-z/linux-1gb-thp.git syzkaller_fix_20250114
kernel config: https://syzkaller.appspot.com/x/.config?x=2cd616b6e736ca7
dashboard link: https://syzkaller.appspot.com/bug?extid=012c6245eaea0e23f7f9
compiler:
Note: no patches were applied.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [mm?] general protection fault in shmem_mapping
2025-02-14 15:48 [syzbot] [mm?] general protection fault in shmem_mapping syzbot
2025-02-14 18:57 ` Zi Yan
2025-02-14 23:26 ` Zi Yan
@ 2025-02-15 0:48 ` Zi Yan
2025-02-15 1:15 ` syzbot
2 siblings, 1 reply; 8+ messages in thread
From: Zi Yan @ 2025-02-15 0:48 UTC (permalink / raw)
To: syzbot; +Cc: akpm, hughd, linux-kernel, linux-mm, syzkaller-bugs
[-- Attachment #1: Type: text/plain, Size: 7190 bytes --]
On 14 Feb 2025, at 10:48, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: df5d6180169a Add linux-next specific files for 20250210
> git tree: linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=16d343f8580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=2cd616b6e736ca7
> dashboard link: https://syzkaller.appspot.com/bug?extid=012c6245eaea0e23f7f9
> 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=138972a4580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11737b18580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/92495cf20271/disk-df5d6180.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/4b3656161842/vmlinux-df5d6180.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/7fbc4e7a0f5d/bzImage-df5d6180.xz
>
> The issue was bisected to:
>
> commit 19c067c8a0f18b62d4a4235b0b327624c86f2e40
> Author: Zi Yan <ziy@nvidia.com>
> Date: Wed Feb 5 03:14:13 2025 +0000
>
> mm/huge_memory: add buddy allocator like folio_split()
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=102f9bdf980000
> final oops: https://syzkaller.appspot.com/x/report.txt?x=122f9bdf980000
> console output: https://syzkaller.appspot.com/x/log.txt?x=142f9bdf980000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+012c6245eaea0e23f7f9@syzkaller.appspotmail.com
> Fixes: 19c067c8a0f1 ("mm/huge_memory: add buddy allocator like folio_split()")
>
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000024: 0000 [#1] PREEMPT SMP KASAN PTI
> KASAN: null-ptr-deref in range [0x0000000000000120-0x0000000000000127]
> CPU: 1 UID: 0 PID: 5949 Comm: syz-executor163 Not tainted 6.14.0-rc2-next-20250210-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
> RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
> Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
> RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
> RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
> RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
> RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
> R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
> R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
> FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <TASK>
> __split_unmapped_folio+0x238a/0x3e50 mm/huge_memory.c:3587
> __folio_split+0x1267/0x16d0 mm/huge_memory.c:3871
> try_folio_split include/linux/huge_mm.h:374 [inline]
> truncate_inode_partial_folio+0x55d/0xdc0 mm/truncate.c:230
> shmem_undo_range+0xab7/0x1820 mm/shmem.c:1144
> shmem_truncate_range mm/shmem.c:1224 [inline]
> shmem_fallocate+0x431/0xf20 mm/shmem.c:3674
> vfs_fallocate+0x623/0x7a0 fs/open.c:338
> madvise_remove mm/madvise.c:1034 [inline]
> madvise_vma_behavior mm/madvise.c:1269 [inline]
> madvise_walk_vmas mm/madvise.c:1511 [inline]
> madvise_do_behavior+0x1f29/0x3c00 mm/madvise.c:1646
> do_madvise mm/madvise.c:1744 [inline]
> __do_sys_madvise mm/madvise.c:1752 [inline]
> __se_sys_madvise mm/madvise.c:1750 [inline]
> __x64_sys_madvise+0x11b/0x140 mm/madvise.c:1750
> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f5e04576519
> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 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 b0 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f5e04531218 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
> RAX: ffffffffffffffda RBX: 00007f5e04600308 RCX: 00007f5e04576519
> RDX: 0000000000000009 RSI: 0000000000600003 RDI: 0000400000000000
> RBP: 00007f5e04600300 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5e045cd074
> R13: 0000400000000000 R14: 0000400000000140 R15: 0000400000000040
> </TASK>
> Modules linked in:
> ---[ end trace 0000000000000000 ]---
> RIP: 0010:shmem_mapping+0x25/0x50 mm/shmem.c:281
> Code: 90 90 90 90 90 f3 0f 1e fa 53 48 89 fb e8 c3 3a bd ff 48 81 c3 20 01 00 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 dd 35 24 00 48 c7 c0 80 6c 14 8c 48
> RSP: 0018:ffffc90004036dd8 EFLAGS: 00010006
> RAX: 0000000000000024 RBX: 0000000000000120 RCX: dffffc0000000000
> RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000000000000
> RBP: 0000000000000600 R08: ffffffff822bcf18 R09: 1ffffd4000331008
> R10: dffffc0000000000 R11: fffff94000331009 R12: ffffea0001988018
> R13: ffffea0001988080 R14: ffffea0001988018 R15: ffffea0001988000
> FS: 00007f5e045316c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f5e0458dae0 CR3: 0000000023c78000 CR4: 00000000003526f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> ----------------
> Code disassembly (best guess):
> 0: 90 nop
> 1: 90 nop
> 2: 90 nop
> 3: 90 nop
> 4: 90 nop
> 5: f3 0f 1e fa endbr64
> 9: 53 push %rbx
> a: 48 89 fb mov %rdi,%rbx
> d: e8 c3 3a bd ff call 0xffbd3ad5
> 12: 48 81 c3 20 01 00 00 add $0x120,%rbx
> 19: 48 89 d8 mov %rbx,%rax
> 1c: 48 c1 e8 03 shr $0x3,%rax
> 20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
> 27: fc ff df
> * 2a: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
> 2e: 74 08 je 0x38
> 30: 48 89 df mov %rbx,%rdi
> 33: e8 dd 35 24 00 call 0x243615
> 38: 48 c7 c0 80 6c 14 8c mov $0xffffffff8c146c80,%rax
> 3f: 48 rex.W
OK, I figured out how to trigger syzkaller to do the test. The attached
patch includes both the fix and the __split_folio_to_order() change
discussed at https://lore.kernel.org/linux-mm/d989ef66-4a4b-4679-b2e9-f05916ca3672@redhat.com/. I will paste the patch to my original patch
email once syzkaller confirms it fixes the issue.
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git df5d6180169a
Best Regards,
Yan, Zi
[-- Attachment #2: 0001-mm-huge_memory-do-not-drop-the-original-folio-during.patch --]
[-- Type: text/plain, Size: 2764 bytes --]
From a6bd83dfbb1143f1614ede4817cccb1e8cc6290d Mon Sep 17 00:00:00 2001
From: Zi Yan <ziy@nvidia.com>
Date: Fri, 14 Feb 2025 16:18:24 -0500
Subject: [PATCH] mm/huge_memory: do not drop the original folio during
truncate.
The caller expects to handle the original folio itself.
also make __split_unmapped_folio() never fail, per discussion with David
Hildenbrand.
Signed-off-by: Zi Yan <ziy@nvidia.com>
---
mm/huge_memory.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 2eda2a9ec8fc..87cb62c81bf3 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3292,16 +3292,12 @@ bool can_split_folio(struct folio *folio, int caller_pins, int *pextra_pins)
* It splits @folio into @new_order folios and copies the @folio metadata to
* all the resulting folios.
*/
-static int __split_folio_to_order(struct folio *folio, int new_order)
+static void __split_folio_to_order(struct folio *folio, int new_order)
{
- int curr_order = folio_order(folio);
long nr_pages = folio_nr_pages(folio);
long new_nr_pages = 1 << new_order;
long index;
- if (curr_order <= new_order)
- return -EINVAL;
-
/*
* Skip the first new_nr_pages, since the new folio from them have all
* the flags from the original folio.
@@ -3396,8 +3392,6 @@ static int __split_folio_to_order(struct folio *folio, int new_order)
if (!new_order)
ClearPageCompound(&folio->page);
-
- return 0;
}
/*
@@ -3491,7 +3485,6 @@ static int __split_unmapped_folio(struct folio *folio, int new_order,
int old_order = folio_order(folio);
struct folio *release;
struct folio *end_folio = folio_next(folio);
- int status;
/* order-1 anonymous folio is not supported */
if (folio_test_anon(folio) && split_order == 1)
@@ -3524,12 +3517,7 @@ static int __split_unmapped_folio(struct folio *folio, int new_order,
split_page_owner(&folio->page, old_order, split_order);
pgalloc_tag_split(folio, old_order, split_order);
- status = __split_folio_to_order(folio, split_order);
-
- if (status < 0) {
- stop_split = true;
- ret = -EINVAL;
- }
+ __split_folio_to_order(folio, split_order);
after_split:
/*
@@ -3567,8 +3555,10 @@ static int __split_unmapped_folio(struct folio *folio, int new_order,
folio_test_swapcache(origin_folio)) ?
folio_nr_pages(release) : 0));
- if (release != origin_folio)
- lru_add_page_tail(origin_folio, &release->page,
+ if (release == origin_folio)
+ continue;
+
+ lru_add_page_tail(origin_folio, &release->page,
lruvec, list);
/* Some pages can be beyond EOF: drop them from page cache */
--
2.47.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [mm?] general protection fault in shmem_mapping
2025-02-15 0:48 ` Zi Yan
@ 2025-02-15 1:15 ` syzbot
0 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2025-02-15 1:15 UTC (permalink / raw)
To: akpm, hughd, linux-kernel, linux-mm, syzkaller-bugs, ziy
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+012c6245eaea0e23f7f9@syzkaller.appspotmail.com
Tested-by: syzbot+012c6245eaea0e23f7f9@syzkaller.appspotmail.com
Tested on:
commit: df5d6180 Add linux-next specific files for 20250210
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=13bd19a4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2cd616b6e736ca7
dashboard link: https://syzkaller.appspot.com/bug?extid=012c6245eaea0e23f7f9
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=11a7a098580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-02-15 1:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-14 15:48 [syzbot] [mm?] general protection fault in shmem_mapping syzbot
2025-02-14 18:57 ` Zi Yan
2025-02-14 23:26 ` Zi Yan
2025-02-14 23:26 ` syzbot
2025-02-14 23:28 ` Zi Yan
2025-02-14 23:45 ` syzbot
2025-02-15 0:48 ` Zi Yan
2025-02-15 1:15 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox