Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions Natives/dyld_bypass_validation.m
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,21 @@ void init_bypassDyldLibValidation() {

NSDebugLog(@"[DyldLVBypass] init");

switch ((int)DeviceGetJITFlags(YES)) {
case JIT_FLAG_FORCE_MIRRORED | JIT_FLAG_HAS_TXM:
if (@available(iOS 26.0, *)) {
if (DeviceHasJITFlags(JIT_FLAG_FORCE_MIRRORED | JIT_FLAG_HAS_TXM)) {
NSDebugLog(@"[DyldLVBypass] Using redirectFunctionMirrored");
redirectFunction = redirectFunctionMirrored;
break;
case JIT_FLAG_FORCE_MIRRORED:
// Special special case for non-TXM iOS 26+
// We can JIT without script, but we cannot modify existing code in dsc without it.
// Therefore, we choose a hook method that avoids patching code in dsc completely, using hardware breakpoint.
// The function only stashes the original function pointers, and the breakpoint handler will redirect to our hook
} else if (DeviceHasJITFlags(JIT_FLAG_FORCE_MIRRORED)) {
// Non-TXM iOS 26+: avoid patching code in dsc, use hardware breakpoint instead
NSDebugLog(@"[DyldLVBypass] Using redirectFunctionHWBreakpoint");
redirectFunction = redirectFunctionHWBreakpoint;
break;
default:
} else {
NSDebugLog(@"[DyldLVBypass] Using redirectFunctionDirect");
redirectFunction = redirectFunctionDirect;
break;
}
} else {
NSDebugLog(@"[DyldLVBypass] Using redirectFunctionDirect");
redirectFunction = redirectFunctionDirect;
}

// Modifying exec page during execution may cause SIGBUS, so ignore it now
Expand Down