Skip to content

Commit

Permalink
kern_start: Add Big Sur+ support for Install.app usage
Browse files Browse the repository at this point in the history
  • Loading branch information
khronokernel committed Oct 24, 2022
1 parent 3d94105 commit cf3a1e4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 21 additions & 17 deletions CryptexFixup/kern_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -143,7 +147,7 @@ PluginConfiguration ADDPR(config) {
arrsize(bootargDebug),
bootargBeta,
arrsize(bootargBeta),
KernelVersion::Ventura,
KernelVersion::BigSur,
KernelVersion::Ventura,
pluginStart
};

0 comments on commit cf3a1e4

Please sign in to comment.