From cf3a1e4794daf9db8045003c893540c7af8180a1 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sun, 23 Oct 2022 19:55:45 -0600 Subject: [PATCH] kern_start: Add Big Sur+ support for Install.app usage --- Changelog.md | 3 +++ CryptexFixup/kern_start.cpp | 38 ++++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Changelog.md b/Changelog.md index 588555d..c15bdb5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,3 +2,6 @@ CryptexFixup Changelog ====================== #### v1.0.0 - Initial release + +#### v1.0.1 +- Allow in-OS Install macOS.app usage on Big Sur and newer diff --git a/CryptexFixup/kern_start.cpp b/CryptexFixup/kern_start.cpp index 3c422d1..1106b72 100644 --- a/CryptexFixup/kern_start.cpp +++ b/CryptexFixup/kern_start.cpp @@ -102,23 +102,27 @@ static void pluginStart() { } } - // Userspace Patcher (ramrod) - lilu.onPatcherLoadForce([](void *user, KernelPatcher &patcher) { - KernelPatcher::RouteRequest csRoute = KernelPatcher::RouteRequest("_cs_validate_page", patched_cs_validate_page, orig_cs_validate); - if (!patcher.routeMultipleLong(KernelPatcher::KernelID, &csRoute, 1)) - SYSLOG(MODULE_SHORT, "failed to route cs validation pages"); - }); - + // Userspace Patcher (ramrod) + // Support Big Sur and newer for in-place Install macOS.app usage + if (getKernelVersion() >= KernelVersion::BigSur) { + lilu.onPatcherLoadForce([](void *user, KernelPatcher &patcher) { + KernelPatcher::RouteRequest csRoute = KernelPatcher::RouteRequest("_cs_validate_page", patched_cs_validate_page, orig_cs_validate); + if (!patcher.routeMultipleLong(KernelPatcher::KernelID, &csRoute, 1)) + SYSLOG(MODULE_SHORT, "failed to route cs validation pages"); + }); + } + // Kernel Space Patcher (APFS.kext) - if (checkKernelArgument("-crypt_allow_hash_validation")) { - SYSLOG(MODULE_SHORT, "disabling APFS.kext patching upon user request"); - } else { - lilu.onKextLoadForce(kextList, arrsize(kextList), - [](void *user, KernelPatcher &patcher, size_t index, mach_vm_address_t address, size_t size) { - processKext(patcher, index, address, size); - }, nullptr); - } - + if (getKernelVersion() >= KernelVersion::Ventura) { + if (checkKernelArgument("-crypt_allow_hash_validation")) { + SYSLOG(MODULE_SHORT, "disabling APFS.kext patching upon user request"); + } else { + lilu.onKextLoadForce(kextList, arrsize(kextList), + [](void *user, KernelPatcher &patcher, size_t index, mach_vm_address_t address, size_t size) { + processKext(patcher, index, address, size); + }, nullptr); + } + } } // Boot args. @@ -143,7 +147,7 @@ PluginConfiguration ADDPR(config) { arrsize(bootargDebug), bootargBeta, arrsize(bootargBeta), - KernelVersion::Ventura, + KernelVersion::BigSur, KernelVersion::Ventura, pluginStart };