Skip to content

Commit

Permalink
Fix slow physrw handoff when it doesn't use kcall
Browse files Browse the repository at this point in the history
  • Loading branch information
opa334 committed Apr 21, 2024
1 parent d67b4da commit 6afbf56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 0 additions & 3 deletions Application/Dopamine/Jailbreak/DOJailbreaker.m
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,9 @@ - (NSError *)injectLaunchdHook
dispatch_source_set_event_handler(serverSource, ^{
xpc_object_t xdict = nil;
if (!xpc_pipe_receive(serverPort, &xdict)) {
// For some reason this server is pretty slow so we need to caffeinate threads to speed it up
thread_caffeinate_start();
if (jbserver_received_boomerang_xpc_message(&gBoomerangServer, xdict) == JBS_BOOMERANG_DONE) {
dispatch_semaphore_signal(boomerangDone);
}
thread_caffeinate_stop();
}
});
dispatch_resume(serverSource);
Expand Down
10 changes: 8 additions & 2 deletions BaseBin/libjailbreak/src/jbserver_boomerang.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ static bool boomerang_domain_allowed(audit_token_t clientToken)

int boomerang_get_physrw(audit_token_t *clientToken, bool singlePTE, uint64_t *singlePTEAsidPtr)
{
int r = -1;
pid_t pid = audit_token_to_pid(*clientToken);

thread_caffeinate_start();
if (singlePTE) {
return physrw_pte_handoff(pid, singlePTEAsidPtr);
r = physrw_pte_handoff(pid, singlePTEAsidPtr);
}
else {
return physrw_handoff(pid);
r = physrw_handoff(pid);
}
thread_caffeinate_stop();

return r;
}

int boomerang_sign_thread(audit_token_t *clientToken, mach_port_t threadPort)
Expand Down

0 comments on commit 6afbf56

Please sign in to comment.