Skip to content

Commit

Permalink
Fix spinlock panics (frfrfr)
Browse files Browse the repository at this point in the history
  • Loading branch information
opa334 committed Sep 21, 2023
1 parent e404b78 commit fa7ddd9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions BaseBin/launchdhook/src/dsc_hook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void initDSCHooks(void);
17 changes: 17 additions & 0 deletions BaseBin/launchdhook/src/dsc_hook.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#import <Foundation/Foundation.h>
#import <sys/sysctl.h>
#import "substrate.h"

int (*sysctlbyname_orig)(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int sysctlbyname_hook(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
{
if (!strcmp(name, "vm.shared_region_pivot")) {
return 0;
}
return sysctlbyname_orig(name, oldp, oldlenp, newp, newlen);
}

void initDSCHooks(void)
{
MSHookFunction(sysctlbyname, (void *)sysctlbyname_hook, (void **)&sysctlbyname_orig);
}
2 changes: 2 additions & 0 deletions BaseBin/launchdhook/src/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "xpc_hook.h"
#import "daemon_hook.h"
#import "ipc_hook.h"
#import "dsc_hook.h"
#import "crashreporter.h"
#import "../systemhook/src/common.h"

Expand Down Expand Up @@ -104,6 +105,7 @@
initDaemonHooks();
initSpawnHooks();
initIPCHooks();
initDSCHooks();

// This will ensure launchdhook is always reinjected after userspace reboots
// As this launchd will pass environ to the next launchd...
Expand Down

2 comments on commit fa7ddd9

@HuChundong
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this commit be used as a plugin for Xina?

@opa334
Copy link
Owner Author

@opa334 opa334 commented on fa7ddd9 Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, xina doesn't do any userspace reboots to begin with

Please sign in to comment.