Skip to content

Patch reference ​

Patches apply in name order from patches/xnu/*.patch and kits/NativePrelink/patches/*.patch. The late patches zzy-* and zzz-* apply last.

Build and toolchain ​

PatchPurpose
apple-only-cpu-tunablesApplies Apple CPU tunables only on APPLE_ARM64_ARCH_FAMILY
cxx-flag-dependenciesPasses CFLAGS to C++ object builds in the Makefile templates
external-archive-dependenciesMakes external archives relink dependencies of the kernel
kernel-sdk-rootSeparates KERNEL_SDKROOT from SDKROOT and adds include paths
local-availabilityAllows XNU_AVAILABILITY_PL to point at a local availability.pl
public-entitlements-headerAdds the web browser entitlement names and uses CoreEntitlements
source-machine-layerAdds CONFIG_APPLE_AMCC and adjusts the BCM2837 config and file list
disabled-deferred-reclaimRemoves an unused parameter that breaks the build
published-freezer-conditionFixes the preprocessor condition for the freezer default

Platform and CPU ​

PatchPurpose
architectural-timer-entrySkips the BCM2837 timer routing when the native architectural timer is enabled
armvirt-platform-personalityAdds ArmCpu, ArmVirtPlatform and ArmDTPlatform personalities
native-smp-secondaryRaises MAX_CPUS to 8 and uses MPIDR Affinity1 for BCM2837 secondary CPUs
native-arm-panEnables ARMv8.1 PAN when XNU_NATIVE_PAN is set
native-dt-panic-regionReads the panic log region from the device tree and validates it

Four-kilobyte pages ​

PatchPurpose
native-4k-bootstrap-capacitySizes the bootstrap page table pool for 4 KiB mappings and stops before overflow
native-4k-user-abiSets the 4 KiB page shift for user maps, commpage and shared region
native-4k-signature-hash-cacheDerives 4 KiB code signing hashes from verified 16 KiB blocks
pgz-aligned-validationDecodes the PGZ address before the alignment check
zzx-pmap-sync-64bit-paUses ptoa() to keep physical addresses above 4 GiB
non-apple-pmap-fieldMatches the non-PAC pmap field layout
non-apple-iommu-bootstrapGuards UAT and SART bootstrap and PPL code
non-apple-cache-monitorGuards the monitor enable and exports the cache clean symbol

Security and owner root ​

PatchPurpose
native-trust-cache-runtimeInitializes the trust cache runtime on BCM2837
source-corecrypto14-bootstrapRegisters the source corecrypto provider at early boot
source-pthread-bootstrapRegisters the source pthread component at early boot
native-aes-personalityAdds the AES, VirtIO block, VirtIO console, RAM block and UFS personalities
offline-owner-root-crypto-probeStarts the verified root probe when offline-owner-root-check is set
offline-owner-root-binding-auditCompares the mounted root device with the verified root device
offline-owner-boot-manifestPublishes the owner boot manifest hash from the root and cache devices
offline-owner-cache-carrierSelects the owner dyld cache carrier and validates its device and path
offline-owner-systemos-mountMounts the SystemOS cryptex and composes the root with the owner cache
offline-owner-z-air-initInitializes the Z air path for the owner root
offline-legacy-startStarts the legacy display probe after IOKitBSDInit
offline-component-load-probesLoads APFS, IOGPU and mobile graphics components with checkpoints
offline-native-gpu-brokerPublishes the offline GPU broker after DTrace initialization
sheng-platform-powerRuns the board PMGR integration before the calendar initialization

Graphics and display ​

PatchPurpose
offline-native-gpu-brokerStarts the offline GPU broker
zzy-native-gpu-addon-mountMounts read-only union views for GPU addon content and launch jobs
native-aes-personalityRegisters the storage and console personalities

Diagnostics ​

PatchPurpose
offline-pgz-alignment-probeAdds the PGZ allocation probe and checkpoints
native-work-interval-traceRecords the last work interval results for the boot progress page
zzz-boot-progressAdds boot progress checkpoints across the kernel startup path

Behavior fixes ​

PatchPurpose
native-priv-work-intervalGrants PRIV_WORK_INTERVAL before policy evaluation
native-work-interval-soft-failSoft-fails a refused CA client work interval
native-union-getattrlistbulkContinues a bulk directory read in the lower union directory
null-root-mediaHandles a null root in IOService::setRootMedia
published-freezer-conditionFixes the freezer default condition

Mockfs ​

PatchPurpose
mockfs-intermediate-lookupAllows lookups that are not the last component
mockfs-memory-device-widthUses the device path when the legacy ioctl cannot express a 64-bit address
mockfs-statfsImplements vfs_getattr
mockfs-typed-allocationUses the struct type for kalloc_type and kfree_type
mockfs-test-fileAdds launchd and probe.bin to the test file system

kits/NativePrelink/patches/:

PatchPurpose
xnu-10063.141.1-security-init.patchAdds the early security initializer entry point
xnu-10063.141.1-sparse-index.patchAdds the sparse prelink index ABI

Add a patch ​

  1. Edit .cache/xnu-work.
  2. Generate the diff with git diff.
  3. Place it in patches/xnu/ with a name that orders it correctly.
  4. Rebuild the kernel.

A patch that depends on another patch applies after it. A patch that changes a region touched by zzy or zzz applies before them.

Next steps ​

Released under the BSD-2-Clause-Patent License.