syzbot


general protection fault in shmem_mapping

Status: upstream: reported C repro on 2025/02/14 15:48
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+012c6245eaea0e23f7f9@syzkaller.appspotmail.com
Fix commit: mm/huge_memory: do not drop the original folio during truncate
Patched on: [ci-upstream-linux-next-kasan-gce-root], missing on: [ci-qemu-gce-upstream-auto ci-qemu-native-arm64-kvm ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-qemu2-riscv64 ci-snapshot-upstream-root ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci-upstream-rust-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb]
First crash: 471d, last: 464d
Cause bisection: introduced by (bisect log) :
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()

Crash: BUG: unable to handle kernel NULL pointer dereference in shmem_mapping (log)
Repro: C syz .config
  
✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision Error
f780e022-f2d6-48b5-8aaf-51f6c13faa6b assessment-security 💥 general protection fault in shmem_mapping 2026/05/19 23:18 2026/05/19 23:18 2026/05/19 23:52 1d9407ad5a662c921fc0d659cf022b438c0bde91 failed to run ["make" "KERNELVERSION=syzkaller" "KERNELRELEASE=syzkaller" "LOCALVERSION=-syzkaller" "-j" "32" "ARCH=x86_64" "CC=ccache clang" "LD=ld.lld" "O=/app/workdir/cache/build/c3d0a4670d3ea4d35d5cf156a64b95e108a9a4e9" "-s" "bzImage" "compile_commands.json"]: exit status 2 Root cause: ld.lld: error: undefined symbol: wcslen * * Restart config... * * * General setup * Compile also drivers which will not load (COMPILE_TEST) [N/y/?] n Compile the kernel with warnings as errors (WERROR) [N/y/?] n Local version - append to kernel release (LOCALVERSION) [] Automatically append version information to the version string (LOCALVERSION_AUTO) [Y/n/?] y Build ID Salt (BUILD_SALT) [] Kernel compression mode > 1. Gzip (KERNEL_GZIP) 2. Bzip2 (KERNEL_BZIP2) 3. LZMA (KERNEL_LZMA) 4. XZ (KERNEL_XZ) 5. LZO (KERNEL_LZO) 6. LZ4 (KERNEL_LZ4) 7. ZSTD (KERNEL_ZSTD) choice[1-7?]: 1 Default init path (DEFAULT_INIT) [] Default hostname (DEFAULT_HOSTNAME) [(none)] (none) System V IPC (SYSVIPC) [Y/n/?] y POSIX Message Queues (POSIX_MQUEUE) [Y/n/?] y General notification queue (WATCH_QUEUE) [Y/n/?] y Enable process_vm_readv/writev syscalls (CROSS_MEMORY_ATTACH) [Y/n/?] y uselib syscall (for libc5 and earlier) (USELIB) [N/y/?] n Auditing support (AUDIT) [Y/?] y Preemption Model 1. No Forced Preemption (Server) (PREEMPT_NONE) 2. Voluntary Kernel Preemption (Desktop) (PREEMPT_VOLUNTARY) > 3. Preemptible Kernel (Low-Latency Desktop) (PREEMPT) 4. Scheduler controlled preemption model (PREEMPT_LAZY) choice[1-4?]: 3 Fully Preemptible Kernel (Real-Time) (PREEMPT_RT) [N/y/?] n Preemption behaviour defined on boot (PREEMPT_DYNAMIC) [Y/n/?] y Core Scheduling for SMT (SCHED_CORE) [Y/n/?] y CPU isolation (CPU_ISOLATION) [Y/n/?] y Kernel .config support (IKCONFIG) [Y/n/m/?] y Enable access to .config through /proc/config.gz (IKCONFIG_PROC) [Y/n/?] y Enable kernel headers through /sys/kernel/kheaders.tar.xz (IKHEADERS) [N/m/y/?] n Kernel log buffer size (16 => 64KB, 17 => 128KB) (LOG_BUF_SHIFT) [18] 18 CPU kernel log buffer size contribution (13 => 8 KB, 17 => 128KB) (LOG_CPU_MAX_BUF_SHIFT) [12] 12 Printk indexing debugfs interface (PRINTK_INDEX) [N/y/?] n Memory placement aware NUMA scheduler (NUMA_BALANCING) [Y/n/?] y Automatically enable NUMA aware memory/task placement (NUMA_BALANCING_DEFAULT_ENABLED) [Y/n/?] y Checkpoint/restore support (CHECKPOINT_RESTORE) [Y/n/?] y Automatic process group scheduling (SCHED_AUTOGROUP) [N/y/?] n Kernel->user space relay support (formerly relayfs) (RELAY) [Y/?] y Initial RAM filesystem and RAM disk (initramfs/initrd) support (BLK_DEV_INITRD) [Y/n/?] y Initramfs source file(s) (INITRAMFS_SOURCE) [] Support initial ramdisk/ramfs compressed using gzip (RD_GZIP) [Y/n/?] y Support initial ramdisk/ramfs compressed using bzip2 (RD_BZIP2) [Y/n/?] y Support initial ramdisk/ramfs compressed using LZMA (RD_LZMA) [Y/n/?] y Support initial ramdisk/ramfs compressed using XZ (RD_XZ) [Y/n/?] y Support initial ramdisk/ramfs compressed using LZO (RD_LZO) [Y/n/?] y Support initial ramdisk/ramfs compressed using LZ4 (RD_LZ4) [Y/n/?] y Support initial ramdisk/ramfs compressed using ZSTD (RD_ZSTD) [Y/n/?] y Boot config support (BOOT_CONFIG) [N/y/?] n Preserve cpio archive mtimes in initramfs (INITRAMFS_PRESERVE_MTIME) [Y/n/?] y Compiler optimization level > 1. Optimize for performance (-O2) (CC_OPTIMIZE_FOR_PERFORMANCE) 2. Optimize for size (-Os) (CC_OPTIMIZE_FOR_SIZE) choice[1-2?]: 1 Enable madvise/fadvise syscalls (ADVISE_SYSCALLS) [Y/n/?] y Enable membarrier() system call (MEMBARRIER) [Y/?] y Enable kcmp() system call (KCMP) [Y/?] y Enable rseq() system call (RSEQ) [Y/n/?] y Enable debugging of rseq() system call (DEBUG_RSEQ) [N/y/?] n Enable cachestat() system call (CACHESTAT_SYSCALL) [Y/n/?] y PC/104 support (PC104) [N/y/?] n Load all symbols for debugging/ksymoops (KALLSYMS) [Y/?] y Test the basic functions and performance of kallsyms (KALLSYMS_SELFTEST) [N/y/?] n Include all symbols in kallsyms (KALLSYMS_ALL) [Y/?] y Profiling support (PROFILING) [Y/n/?] y Rust support (RUST) [N/y/?] (NE
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [mm?] general protection fault in shmem_mapping 4 (9) 2025/02/15 01:15
Last patch testing requests (3)
Created Duration User Patch Repo Result
2025/02/15 00:48 26m ziy@nvidia.com patch git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git df5d6180169a OK log
2025/02/15 00:13 27m ziy@nvidia.com patch git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git df5d6180169a OK log
2025/02/14 23:28 0m ziy@nvidia.com git@github.com:x-y-z/linux-1gb-thp.git syzkaller_fix_20250114 error

Sample crash report:
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

Crashes (17):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/10 23:27 linux-next df5d6180169a 43f51a00 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/10 22:33 linux-next df5d6180169a 43f51a00 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/10 21:43 linux-next df5d6180169a 43f51a00 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/10 20:20 linux-next df5d6180169a 43f51a00 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/17 00:43 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/17 00:43 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/17 00:43 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/16 20:48 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/16 16:05 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/16 12:47 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/15 11:49 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/15 11:48 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/14 22:54 linux-next 0ae0fa3bf0b4 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/11 17:30 linux-next df5d6180169a f2baddf5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/10 17:08 linux-next df5d6180169a 43f51a00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/10 15:45 linux-next df5d6180169a 43f51a00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
2025/02/10 15:45 linux-next df5d6180169a 43f51a00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in shmem_mapping
* Struck through repros no longer work on HEAD.