Skip to content

Commit

Permalink
Various improvements, fix arm64 iOS 16.x
Browse files Browse the repository at this point in the history
  • Loading branch information
opa334 committed Apr 21, 2024
1 parent b301095 commit db615ad
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
5 changes: 2 additions & 3 deletions Application/Dopamine/Jailbreak/DOJailbreaker.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ - (NSError *)doExploitation
if ([pplBypass run] != 0) {[pacBypass cleanup]; [kernelExploit cleanup]; return [NSError errorWithDomain:JBErrorDomain code:JBErrorCodeFailedExploitation userInfo:@{NSLocalizedDescriptionKey:@"Failed to bypass PPL"}];}
// At this point we presume the PPL bypass gave us unrestricted phys write primitives
}

if (@available(iOS 16.0, *)) {
// IOSurface kallocs don't work on iOS 16+, use these instead
if (!gPrimitives.kalloc_global) {
// IOSurface kallocs don't work on iOS 16+, use leaked page tables as allocations instead
libjailbreak_kalloc_pt_init();
}

Expand Down
2 changes: 1 addition & 1 deletion BaseBin/boomerang/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int main(int argc, char* argv[])
libjailbreak_translation_init();

libjailbreak_IOSurface_primitives_init();
if (__builtin_available(iOS 16.0, *)) {
if (!gPrimitives.kalloc_global) {
libjailbreak_kalloc_pt_init();
}

Expand Down
2 changes: 1 addition & 1 deletion BaseBin/launchdhook/src/boomerang.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int boomerang_recoverPrimitives(bool firstRetrieval, bool shouldEndBoomerang)
libjailbreak_translation_init();

libjailbreak_IOSurface_primitives_init();
if (__builtin_available(iOS 16.0, *)) {
if (!gPrimitives.kalloc_global) {
libjailbreak_kalloc_pt_init();
}

Expand Down
5 changes: 3 additions & 2 deletions BaseBin/libjailbreak/src/kcall_Fugu14.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,10 @@ void fugu14_kexec(kRegisterState *state)
fugu14_kexec_on_thread(&gFugu14KcallThread, state);
}

void jbclient_get_fugu14_kcall(void)
int jbclient_get_fugu14_kcall(void)
{
fugu14_kcall_init(^int(mach_port_t threadToSign) {
if (!gPrimitives.kalloc_local) return -1;
return fugu14_kcall_init(^int(mach_port_t threadToSign) {
return jbclient_root_sign_thread(threadToSign);
});
}
2 changes: 1 addition & 1 deletion BaseBin/libjailbreak/src/kcall_Fugu14.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ typedef struct {
} Fugu14KcallThread;

int fugu14_kcall_init(int (^threadSigner)(mach_port_t threadPort));
void jbclient_get_fugu14_kcall(void);
int jbclient_get_fugu14_kcall(void);


#endif
4 changes: 1 addition & 3 deletions BaseBin/libjailbreak/src/kcall_arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ uint64_t arm64_kcall(uint64_t func, int argc, const uint64_t *argv)

int arm64_kcall_init(void)
{
if (!gPrimitives.kalloc_local) {
return -1;
}
if (!gPrimitives.kalloc_local) return -1;

pthread_mutex_init(&gArm64KcallThead.lock, NULL);

Expand Down
7 changes: 5 additions & 2 deletions BaseBin/libjailbreak/src/primitives_IOSurface.m
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ void libjailbreak_IOSurface_primitives_init(void)
}
CFRelease(surfaceRef);

gPrimitives.kalloc_global = IOSurface_kalloc_global;
gPrimitives.kalloc_local = IOSurface_kalloc_local;
gPrimitives.kmap = IOSurface_map;
if (@available(iOS 16.0, *)) {}
else {
gPrimitives.kalloc_global = IOSurface_kalloc_global;
gPrimitives.kalloc_local = IOSurface_kalloc_local;
}
}

0 comments on commit db615ad

Please sign in to comment.