Skip to content

Commit

Permalink
Workaround symbol conflict with some buggy plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Jul 1, 2018
1 parent 23ab886 commit a4fb820
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Lilu/PrivateHeaders/kern_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ class Configuration {
Configuration() : policy(xStringify(PRODUCT_NAME), fullName, &policyOps) {}
};

extern Configuration config;
extern Configuration ADDPR(config);

#endif /* kern_config_private_h */
10 changes: 5 additions & 5 deletions Lilu/Sources/kern_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ LiluAPI lilu;
void LiluAPI::init() {
access = IOLockAlloc();

if (config.installOrRecovery)
if (ADDPR(config).installOrRecovery)
currentRunMode |= AllowInstallerRecovery;
else if (config.safeMode)
else if (ADDPR(config).safeMode)
currentRunMode |= AllowSafeMode;
else
currentRunMode |= AllowNormal;
Expand All @@ -33,7 +33,7 @@ void LiluAPI::deinit() {
}

LiluAPI::Error LiluAPI::requestAccess(size_t version, bool check) {
if (!config.startSuccess)
if (!ADDPR(config).startSuccess)
return Error::Offline;

constexpr size_t currversion = parseModuleVersion(xStringify(MODULE_VERSION));
Expand Down Expand Up @@ -78,7 +78,7 @@ LiluAPI::Error LiluAPI::shouldLoad(const char *product, size_t version, uint32_t
}

if (!KernelPatcher::compatibleKernel(min, max)) {
bool beta = config.betaForAll;
bool beta = ADDPR(config).betaForAll;

for (size_t i = 0; i < betaArgNum && !beta; i++) {
if (PE_parse_boot_argn(betaArg[i], tmp, sizeof(tmp)))
Expand All @@ -93,7 +93,7 @@ LiluAPI::Error LiluAPI::shouldLoad(const char *product, size_t version, uint32_t
}
}

if (config.debugForAll) {
if (ADDPR(config).debugForAll) {
printDebug = true;
} else {
for (size_t i = 0; i < debugArgNum; i++) {
Expand Down
2 changes: 1 addition & 1 deletion Lilu/Sources/kern_mach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
kern_return_t MachInfo::init(const char * const paths[], size_t num, MachInfo *prelink, bool fsfallback) {
kern_return_t error = KERN_FAILURE;

allow_decompress = config.allowDecompress;
allow_decompress = ADDPR(config).allowDecompress;

// Check if we have a proper credential, prevents a race-condition panic on 10.11.4 Beta
// When calling kauth_cred_get() for the current_thread.
Expand Down
22 changes: 11 additions & 11 deletions Lilu/Sources/kern_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static const char kextVersion[] {
IOService *PRODUCT_NAME::probe(IOService *provider, SInt32 *score) {
setProperty("VersionInfo", kextVersion);
auto service = IOService::probe(provider, score);
return config.startSuccess ? service : nullptr;
return ADDPR(config).startSuccess ? service : nullptr;
}

bool PRODUCT_NAME::start(IOService *provider) {
Expand All @@ -42,14 +42,14 @@ bool PRODUCT_NAME::start(IOService *provider) {
return false;
}

return config.startSuccess;
return ADDPR(config).startSuccess;
}

void PRODUCT_NAME::stop(IOService *provider) {
IOService::stop(provider);
}

Configuration config;
Configuration ADDPR(config);

bool Configuration::performInit() {
kernelPatcher.init();
Expand Down Expand Up @@ -80,18 +80,18 @@ bool Configuration::performInit() {
}

int Configuration::policyCheckRemount(kauth_cred_t cred, mount *mp, label *mlabel) {
if (!config.initialised) {
if (!ADDPR(config).initialised) {
DBGLOG("config", "init via mac_mount_check_remount");
config.performInit();
ADDPR(config).performInit();
}

return 0;
}

int Configuration::policyCredCheckLabelUpdateExecve(kauth_cred_t auth, vnode_t vp, ...) {
if (!config.initialised) {
if (!ADDPR(config).initialised) {
DBGLOG("config", "init via mac_cred_check_label_update_execve");
config.performInit();
ADDPR(config).performInit();
}

return 0;
Expand Down Expand Up @@ -179,13 +179,13 @@ extern "C" kern_return_t kern_start(kmod_info_t * ki, void *d) {
// Make EFI runtime services available now, since they are standalone.
EfiRuntimeServices::activate();

if (config.getBootArguments()) {
if (ADDPR(config).getBootArguments()) {
DBGLOG("init", "initialising policy");

lilu.init();

if (config.policy.registerPolicy())
config.startSuccess = true;
if (ADDPR(config).policy.registerPolicy())
ADDPR(config).startSuccess = true;
else
SYSLOG("init", "failed to register the policy");
}
Expand All @@ -194,5 +194,5 @@ extern "C" kern_return_t kern_start(kmod_info_t * ki, void *d) {
}

extern "C" kern_return_t kern_stop(kmod_info_t *ki, void *d) {
return config.startSuccess ? KERN_FAILURE : KERN_SUCCESS;
return ADDPR(config).startSuccess ? KERN_FAILURE : KERN_SUCCESS;
}

0 comments on commit a4fb820

Please sign in to comment.