kernel panic: corrupted stack end in sys_ppoll

Status: closed as invalid on 2026/11/08 10:18
Subsystems: fs
Labels: prio:normal
[Documentation on labels]
First crash: 4d01h, last: 4d01h
✨ AI-generated root cause summary:

A root user can mmap an active PCI device's BAR MMIO memory through sysfs (/sys/bus/pci/devices/0000:00:02.0/resource0) via pci_mmap_resource(). Because CONFIG_IO_STRICT_DEVMEM is not enabled, iomem_is_exclusive() permits mapping busy MMIO regions that lack the explicit IORESOURCE_EXCLUSIVE flag. Writing arbitrary fuzzed data into the device's live MMIO space causes hardware aborts (triggering an ARM64 Synchronous External Abort in do_sea() and setting TAINT_MACHINE_CHECK) and corrupts active device/DMA state, leading to rogue memory writes that overwrite STACK_END_MAGIC on a background thread's stack and triggering a panic in schedule_debug().

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 58c1eb84e977:

Root Cause Analysis

1. Functions, Structs, and Files Involved


2. Trigger Mechanism and Lifecycle / Invariant Violation

  1. Unrestricted MMIO Resource Mapping (drivers/pci/pci-sysfs.c, kernel/resource.c):

    • The test program (running as root, UID: 0) mounts sysfs and opens /sys/bus/pci/devices/0000:00:02.0/resource0 (mode 0600), representing BAR 0 MMIO space of PCI device 0000:00:02.0.
    • The program invokes mmap(0x20001000, 0x2000, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_SHARED, fd, 0), which enters pci_mmap_resource().
    • pci_mmap_resource() calls iomem_is_exclusive(pci_resource_start(pdev, bar)) to verify if userspace is permitted to map this physical I/O memory range.
    • In kernel/resource.c:
      if (IS_ENABLED(CONFIG_IO_STRICT_DEVMEM) || p->flags & IORESOURCE_EXCLUSIVE) {
          err = true;
          break;
      }
      
      Because CONFIG_IO_STRICT_DEVMEM is disabled in this kernel build and device drivers typically do not explicitly set IORESOURCE_EXCLUSIVE when requesting regions, resource_is_exclusive() returns false despite the resource being active and marked IORESOURCE_BUSY. As a result, userspace successfully establishes a direct, writable mapping to the live hardware MMIO registers.
  2. MMIO Overwrite & Hardware Abort (arch/arm64/mm/fault.c):

    • The reproducer writes fuzzed data into the range 0x20001b00–0x200023f8, which falls directly within the 0x20001000–0x20003000 mmapped MMIO page.
    • Accessing undefined/unimplemented register offsets in the device's MMIO aperture causes the bus interconnect to return an error response, triggering an ARM64 Synchronous External Abort (SEA).
    • This abort is processed by do_sea() in arch/arm64/mm/fault.c, which calls add_taint(TAINT_MACHINE_CHECK, LOCKDEP_STILL_OK), explaining the Tainted: [M]=MACHINE_CHECK taint flag on the system.
  3. Rogue DMA and Kernel Stack Corruption (kernel/sched/core.c):

    • Writing garbage to control, queue descriptor, or doorbell registers of an active PCI device (a bus-mastering network controller servicing network traffic on the VM) corrupts the device's internal state machine and DMA descriptor rings.
    • As the device attempts to process receive or transmit traffic (such as DHCP packets handled by dhcpcd), it initiates rogue DMA transfers into arbitrary physical memory addresses.
    • One or more writes land on the physical page hosting the bottom of the kernel stack for PID 4402 (dhcpcd), corrupting the STACK_END_MAGIC canary (0x57AC6E9D) stored at end_of_stack(task).
    • When dhcpcd subsequently blocks during ppoll (poll_schedule_timeout -> schedule -> __schedule), schedule_debug() evaluates task_stack_end_corrupted(prev), detects that *end_of_stack(prev) != STACK_END_MAGIC, and triggers the kernel panic: "Kernel panic - not syncing: corrupted stack end detected inside scheduler".
▶ ▼ ✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision
c5e93a85 assessment-security DenialOfService: ✅ Exploitable: ✅ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ✅ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ kernel panic: corrupted stack end in sys_ppoll 2026/11/07 21:17 2026/11/07 21:18 2026/11/07 21:56 5cecaf1f

Sample crash report:
Kernel panic - not syncing: corrupted stack end detected inside scheduler
CPU: 0 UID: 0 PID: 4402 Comm: dhcpcd Tainted: G   M                syzkaller #0 PREEMPT 
Tainted: [M]=MACHINE_CHECK
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/23/2026
Call trace:
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:499 (C)
 __dump_stack+0x30/0x40 lib/dump_stack.c:94
 dump_stack_lvl+0x30/0x12c lib/dump_stack.c:120
 dump_stack+0x1c/0x28 lib/dump_stack.c:129
 vpanic+0x314/0x7d4 kernel/panic.c:661
 oops_exit+0x0/0x40 kernel/panic.c:787
 schedule_debug kernel/sched/core.c:6153 [inline]
 __schedule+0x18c8/0x2b50 kernel/sched/core.c:7229
 __schedule_loop kernel/sched/core.c:7459 [inline]
 schedule+0x13c/0x20c kernel/sched/core.c:7474
 schedule_hrtimeout_range_clock+0x1a0/0x2b8 kernel/time/sleep_timeout.c:207
 schedule_hrtimeout_range+0x38/0x4c kernel/time/sleep_timeout.c:263
 poll_schedule_timeout+0xc8/0x1bc fs/select.c:241
 do_poll fs/select.c:965 [inline]
 do_sys_poll+0x938/0xcd8 fs/select.c:1015
 __do_sys_ppoll fs/select.c:1112 [inline]
 __se_sys_ppoll fs/select.c:1092 [inline]
 __arm64_sys_ppoll+0x1f0/0x270 fs/select.c:1092
 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
 invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49
 el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121
 do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140
 el0_svc+0x60/0x1d8 arch/arm64/kernel/entry-common.c:797
 el0t_64_sync_handler+0x44/0x104 arch/arm64/kernel/entry-common.c:816
 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:606
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x0,a0000000,00f00020,9c080a02,a84ff6a7
Memory Limit: none
Rebooting in 86400 seconds..

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/07 21:17 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 58c1eb84e977 5cecaf1f .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 kernel panic: corrupted stack end in sys_ppoll
* Struck through repros no longer work on HEAD.