Skip to content

Commit

Permalink
Disable for installers
Browse files Browse the repository at this point in the history
  • Loading branch information
plooshi committed Dec 6, 2024
1 parent 0e5847f commit 6325cc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
8 changes: 4 additions & 4 deletions RealRoot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
"MODULE_VERSION=$(MODULE_VERSION)",
"PRODUCT_NAME=$(PRODUCT_NAME)",
LILU_CUSTOM_IOKIT_INIT,
"$(inherited)",
);
HEADER_SEARCH_PATHS = "${PROJECT_DIR}/Lilu.kext/Contents/Resources";
Expand All @@ -362,7 +363,7 @@
MODULE_NAME = dev.ploosh.RealRoot;
MODULE_START = "$(PRODUCT_NAME)_kern_start";
MODULE_STOP = "$(PRODUCT_NAME)_kern_stop";
MODULE_VERSION = 1.0.8;
MODULE_VERSION = 1.1.0;
OTHER_CFLAGS = (
"-mmmx",
"-msse",
Expand All @@ -378,7 +379,6 @@
"-Wno-ossharedptr-misuse",
"-Wno-vla",
"-masm=intel",
"-DLILU_CUSTOM_IOKIT_INIT",
);
OTHER_LDFLAGS = "-static";
PRODUCT_BUNDLE_IDENTIFIER = dev.ploosh.RealRoot;
Expand All @@ -400,6 +400,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
"MODULE_VERSION=$(MODULE_VERSION)",
"PRODUCT_NAME=$(PRODUCT_NAME)",
LILU_CUSTOM_IOKIT_INIT,
);
HEADER_SEARCH_PATHS = "${PROJECT_DIR}/Lilu.kext/Contents/Resources";
INFOPLIST_FILE = RealRoot/Info.plist;
Expand All @@ -412,7 +413,7 @@
MODULE_NAME = dev.ploosh.RealRoot;
MODULE_START = "$(PRODUCT_NAME)_kern_start";
MODULE_STOP = "$(PRODUCT_NAME)_kern_stop";
MODULE_VERSION = 1.0.8;
MODULE_VERSION = 1.1.0;
OTHER_CFLAGS = (
"-mmmx",
"-msse",
Expand All @@ -428,7 +429,6 @@
"-Wno-ossharedptr-misuse",
"-Wno-vla",
"-masm=intel",
"-DLILU_CUSTOM_IOKIT_INIT",
);
OTHER_LDFLAGS = "-static";
PRODUCT_BUNDLE_IDENTIFIER = dev.ploosh.RealRoot;
Expand Down
20 changes: 2 additions & 18 deletions RealRoot/kern_realroot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,33 +163,16 @@ void PatchSandbox(void *_user, KernelPatcher &patcher, size_t index, mach_vm_add
}

mach_vm_address_t getKernelBase() {
#ifdef LILU_COMPRESSION_SUPPORT
static constexpr const char *prelinkKernelPaths[7] {
// This is the usual kernel cache place, which often the best thing to use
"/System/Library/Caches/com.apple.kext.caches/Startup/kernelcache",
// Otherwise fallback to one of the prelinked kernels
// Since we always verify the LC_UUID value, trying the kernels could be done in any order.
"/System/Library/PrelinkedKernels/prelinkedkernel", // normal
"/macOS Install Data/Locked Files/Boot Files/prelinkedkernel", // 10.13 installer
"/com.apple.boot.R/prelinkedkernel", // 10.12+ fusion drive installer
"/com.apple.boot.S/System/Library/PrelinkedKernels/prelinkedkernel", // 10.11 fusion drive installer
"/com.apple.recovery.boot/prelinkedkernel", // recovery
"/kernelcache" // 10.7 installer
};
#endif

static constexpr const char *kernelPaths[2] {
"/System/Library/Kernels/kernel",
"/mach_kernel"
};
static mach_vm_address_t kbase = 0;
if (!kbase) {
bool usePrelinkedCache = LILU_COMPRESSION_SUPPORT && WIOKit::usingPrelinkedCache();

auto info = MachInfo::create(true, "kernel");
if (!info) {
return 0;
} else if ((info->init(usePrelinkedCache ? prelinkKernelPaths : kernelPaths, usePrelinkedCache ? arrsize(prelinkKernelPaths) : arrsize(kernelPaths), 0, false)) != KERN_SUCCESS) {
} else if ((info->init(kernelPaths, arrsize(kernelPaths), 0, false)) != KERN_SUCCESS) {
return 0;
}

Expand Down Expand Up @@ -219,6 +202,7 @@ void PatchKernel(void *_user, KernelPatcher &patcher) {
}

void InitRealRoot() {
if (WIOKit::usingPrelinkedCache()) return; // disable in installer/update
lilu.onPatcherLoadForce(PatchKernel);
lilu.onKextLoadForce(&kextAPFS, 1, PatchAPFS);
lilu.onKextLoadForce(&kextSandbox, 1, PatchSandbox);
Expand Down

0 comments on commit 6325cc8

Please sign in to comment.