Kernel Panic when under load, [SPTM] VIOLATION_ILLEGAL_PERMS #83
Unanswered
Twister915
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi!
I was getting this kernel panic:
I removed some stuff from here that I thought would not be relevant, but you can find it here.
Anyhow, I pointed my agent at it, and here's what I got (I will try to open a PR tomorrow, the diff it proposed is a few lines)
AI text below (gpt5.5, xhigh, June 14th) ⬇️
Environment
Mac15,14(20 performance / 8 efficiency)arm64/ Apple Silicon26.5.1build25F8025.5.0xnu-12377.121.6~2/RELEASE_ARM64_T603118000.120.3618000.120.36zfs-2.3.1-1zfs-kmod-2.3.1-1zfs.kext_version: 2.3.1-1org.openzfsonosx.zfs (2.3.1)06D2D3A1-C9F7-3653-BAF1-F281AB0EF1F0/usr/local/zfs/bin/zpool,/usr/local/zfs/bin/zfscom.apple.sptm(25.5)with[SPTM] VIOLATION_ILLEGAL_PERMSWorkload correlation
This happened twice under heavy metadata churn:
mds/mdworkerSuspected cause
The macOS vnode/UBC code still has paths that call
ubc_upl_map()or request writable UPL mappings where read-only mappings should be enough. On Apple Silicon, SPTM appears to reject a writable kernel mapping of a file-backed/protected/non-default page frame.Most suspicious paths:
update_pages()inmodule/os/macos/zfs/zfs_vnops_os.cmappedread()inmodule/os/macos/zfs/zfs_vnops_os.czfs_vnop_pagein()inmodule/os/macos/zfs/zfs_vnops_osx.czfs_pageout()inmodule/os/macos/zfs/zfs_vnops_osx.czfs_vnop_pageoutv2()already has a partial SPTM-relatedubc_upl_map_range(... VM_PROT_READ ...)workaround, but the other paths still look unsafe.Proposed direction
For macOS 12+ / Apple Silicon:
ubc_upl_map_range()with explicit protectionsVM_PROT_READfor pageout/mapped-read pathsVM_PROT_READ | VM_PROT_WRITEonly where ZFS actually fills pagesUPL_FILE_IOinupdate_pages()when ZFS intends to CPU-write into UPL pages; useUPL_WILL_MODIFYAll reactions