Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
asdfugil committed Dec 20, 2023
1 parent c34ad3a commit 3370ea5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions checkra1n/kpf/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,10 @@ static void kpf_cmd(const char *cmd, char *args)
if((livefs_string_match != NULL) != (gKernelVersion.darwinMajor >= 21 && xnu_platform() == PLATFORM_IOS)) panic("livefs panic doesn't match expected Darwin version");
#endif

if (!rootvp_string_match) {
strncat((char*)((int64_t)gBootArgs->iOS13.CommandLine - 0x800000000 + kCacheableView), " rootdev=md0", 0x270);
}

for(size_t i = 0; i < sizeof(kpf_components)/sizeof(kpf_components[0]); ++i)
{
kpf_component_t *component = kpf_components[i];
Expand Down
7 changes: 4 additions & 3 deletions checkra1n/kpf/ramdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static void kpf_ramdisk_init(struct mach_header_64 *hdr, xnu_pf_range_t *cstring
{
rootdev_bootarg = NULL;
}

const char constraints_string[] = "mac_proc_check_launch_constraints";
const char *constraints_string_match = memmem(cstring->cacheable_base, cstring->size, constraints_string, sizeof(constraints_string));
gHasConstriants = (constraints_string_match != NULL);
Expand All @@ -124,6 +124,7 @@ static void kpf_ramdisk_init(struct mach_header_64 *hdr, xnu_pf_range_t *cstring

static void kpf_ramdisk_bootprep(struct mach_header_64 *hdr, palerain_option_t palera1n_flags)
{

if(rootdev_bootarg)
{
memcpy(rootdev_bootarg, "spartan", 7); // rootdev -> spartan
Expand Down Expand Up @@ -153,12 +154,12 @@ static void kpf_ramdisk_bootprep(struct mach_header_64 *hdr, palerain_option_t p
char* root_matching = dt_prop(chosen, "root-matching", &root_matching_len);
if (!root_matching) panic("invalid devicetree: no prop!");
snprintf(BSDName, 16, "%s%" PRIu32, gHasConstriants ? "disk1s" : "disk0s1s", partid);
if ((palera1n_flags & palerain_option_setup_rootful) == 0)
if ((palera1n_flags & (palerain_option_setup_rootful | palerain_option_force_revert)) == 0)
snprintf(root_matching, root_matching_len,
"<dict ID=\"0\"><key>IOProviderClass</key><string ID=\"1\">IOService</string><key>BSD Name</key><string ID=\"2\">%s</string></dict>",
BSDName);
else
printf("KPF: rooting from original rootfs for fakefs setup\n");
printf("KPF: rooting from original rootfs for fakefs setup or force revert\n");
printf("KPF: root BSD Name: %s\n", BSDName);
printf("KPF: root_matching (raw): %s\n", root_matching);
} else {
Expand Down
4 changes: 1 addition & 3 deletions checkra1n/kpf/shellcode.S
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ L_dyld_shc_epilog:
ldp x29, x30, [sp], 0x20
ret
L_alt_dyld_path:
.asciz "/cores/dyld"
.asciz "/cores/usr/lib/dyld"
L_dyld_path:
.asciz "/usr/lib/dyld"
.align 2
Expand Down Expand Up @@ -482,8 +482,6 @@ L_kdi_shc_ramfile:
.align 2
_kdi_shc_end:



.globl _fsctl_shc
.globl _fsctl_shc_vnode_open
.globl _fsctl_shc_stolen_slowpath
Expand Down

0 comments on commit 3370ea5

Please sign in to comment.