diff --git a/docs/palera1n.1 b/docs/palera1n.1 index abe015a..ee3ffb6 100644 --- a/docs/palera1n.1 +++ b/docs/palera1n.1 @@ -96,11 +96,11 @@ Remove the jailbreak while keeping user data. Some jailbreak files may remain after running this command. Additionally, jailbreak apps will remain on the home screen on for a while even when the files are deleted as the icon cache still has their icons. When used with -.Fl f , -fakefs , +.Fl f , -rootful , this will actually boot the device in rootless mode then delete the jailbreak files. As a result, using the loader app to install the jailbreak environment is not supported when this option is used together with -.Fl f , -fakefs +.Fl f , -rootful \[char46] .It Fl B , -setup-fakefs-partial Like @@ -111,8 +111,8 @@ when setting up fakefs for rootful, as they do not have enough storage for full This option currently does not work on iOS 16. .It Fl c , -setup-fakefs When used with -.Fl f , -fakefs , -creates the new APFS volume required for rootful. Will fail if one already exists. +.Fl f , -rootful , +creates the new APFS volume required for rootful on iOS/iPadOS. Will fail if one already exists. .It Fl d , -demote Set the effective production fuse to 0, so as to enable hardware debugging features. .It Fl D , -dfuhelper @@ -128,7 +128,7 @@ and cannot be overriden. Additionally, the argument is used during fakefs setup. .It Fl E , -enter-recovery Exit after entering recovery mode. -.It Fl f , -fakefs +.It Fl f , -rootful Proceed in rootful mode. This applies to both full fakefs and partial fakefs. .It Fl h , -help Prints help text. @@ -149,7 +149,7 @@ iOS15 branch or your own fork of it. Proceed in rootless mode, this is the default when neither .Fl l , -rootless and -.Fl f , -fakefs +.Fl f , -rootful is specified. .Fl L , -jbinit-log-to-file Makes jbinit log to @@ -259,7 +259,7 @@ before they can be ran on a device jailbroken with \[char46] .Pp When using rootful mode, the -.Fl f , -fakefs +.Fl f , -rootful flag must be specified at all times. It does not matter whether you want to create fakefs, create partial fakefs, rejailbreak or remove jailbreak. .Sh POST INSTALLATION @@ -311,9 +311,6 @@ may crash if the machine it is running on: .Pp The exploit may also work less reliably on some hosts, like AMD desktops, or some MediaTek devices. .Pp -.Fl B , -setup-fakefs-partial -does not work on iOS 16. -.Pp The device may randomly crash and reboot due to launchd receiving signal 7 (SIGEMT). .Sh NOTES .Nm diff --git a/include/kerninfo.h b/include/kerninfo.h index 2df1407..9dcbd63 100644 --- a/include/kerninfo.h +++ b/include/kerninfo.h @@ -61,6 +61,9 @@ #define palerain_option_setup_partial_root (1 << 4) /* fakefs creating should be partial */ #define palerain_option_checkrain_is_clone (1 << 5) /* supplied checkra1n is checkra1n clone */ #define palerain_option_rootless_livefs (1 << 6) /* mount root livefs on rootless */ +#define palerain_option_no_ssv (1 << 7) /* no signed system volume */ +#define palerain_option_force_fakefs (1 << 8) /* force fakefs, even without SSV */ +#define palerain_option_rootless (1 << 9) /* rootless jailbreak */ #ifdef DEV_BUILD #define palerain_option_test1 (1 << 29) diff --git a/include/palerain.h b/include/palerain.h index 17527df..92d044c 100644 --- a/include/palerain.h +++ b/include/palerain.h @@ -22,8 +22,14 @@ #define CMD_LEN_MAX 512 #define OVERRIDE_MAGIC 0xd803b376 -#define palerain_option_case_version palerain_option_case(0) -#define palerain_option_case_force_revert palerain_option_case(1) +#define palerain_option_case_version palerain_option_case(0) +#define palerain_option_case_force_revert palerain_option_case(1) +#ifdef DEV_BUILD +#define palerain_option_case_ignore_ssv palerain_option_case(2) +#define palerain_option_case_force_fakefs palerain_option_case(3) +#define palerain_option_case_rootless_livefs palerain_option_case(4) +#endif + #ifdef USE_LIBUSB #include diff --git a/src/optparse.c b/src/optparse.c index ce0c333..008d25e 100644 --- a/src/optparse.c +++ b/src/optparse.c @@ -52,6 +52,9 @@ static struct option longopts[] = { #ifdef DEV_BUILD {"test1", no_argument, NULL, '1'}, {"test2", no_argument, NULL, '2'}, + {"ignore-ssv", no_argument, NULL, palerain_option_case_ignore_ssv}, + {"rootless-livefs", no_argument, NULL, palerain_option_case_rootless_livefs}, + {"force-fakefs", no_argument, NULL, palerain_option_case_force_fakefs}, #endif #ifdef TUI {"tui", no_argument, NULL, 't'}, @@ -79,6 +82,9 @@ static int usage(int e, char* prog_name) "\t--version\t\t\t\tPrint version\n" "\t--force-revert\t\t\t\tRemove jailbreak\n" #ifdef DEV_BUILD + "\t--ignore-ssv\t\t\t\tAssume the platform has no SSV\n" + "\t--force-fakefs\t\t\t\tAllow fakefs to be created and used even on platforms without SSV\n" + "\t--rootless-livefs\t\t\t\tMount the root livefs on rootless\n" "\t-1, --test1\t\t\t\tSet palerain_option_test1\n" "\t-2, --test2\t\t\t\tSet palerain_option_test2\n" #endif @@ -91,13 +97,13 @@ static int usage(int e, char* prog_name) "\t-e, --boot-args \tXNU boot arguments\n" "\t-E, --enter-recovery\t\t\tEnter recovery mode\n" #ifdef ROOTFUL - "\t-f, --fakefs \t\t\t\tBoots fakefs\n" + "\t-f, --rootful \t\t\t\tSet jailbreak mode to rootful.\n" #endif "\t-h, --help\t\t\t\tShow this help\n" "\t-i, --override-checkra1n \t\tOverride checkra1n\n" "\t-k, --override-pongo \t\tOverride Pongo image\n" "\t-K, --override-kpf \t\tOverride kernel patchfinder\n" - "\t-l, --rootless\t\t\t\tBoots rootless. This is the default\n" + "\t-l, --rootless\t\t\t\tSet jailbreak mode to rootless.\n" "\t-L, --jbinit-log-to-file\t\tMake jbinit log to /cores/jbinit.log (can be read from sandbox while jailbroken)\n" "\t-n, --exit-recovery\t\t\tExit recovery mode\n" "\t-I, --device-info\t\t\tPrint info about the connected device\n" @@ -185,7 +191,7 @@ int optparse(int argc, char* argv[]) { #endif case 'l': #ifdef ROOTFUL - palerain_flags &= ~palerain_option_rootful; + palerain_flags |= palerain_option_rootless; #endif break; case 'L': @@ -296,6 +302,15 @@ int optparse(int argc, char* argv[]) { case '2': palerain_flags |= palerain_option_test2; break; + case palerain_option_case_force_fakefs: + palerain_flags |= palerain_option_case_force_fakefs; + break; + case palerain_option_case_rootless_livefs: + palerain_flags |= palerain_option_case_rootless_livefs; + break; + case palerain_option_case_ignore_ssv: + palerain_flags |= palerain_option_no_ssv; + break; #endif case palerain_option_case_force_revert: checkrain_flags |= checkrain_option_force_revert; @@ -350,6 +365,17 @@ int optparse(int argc, char* argv[]) { LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload); } + if (checkrain_option_enabled(palerain_flags, palerain_option_rootful) && checkrain_option_enabled(palerain_flags, palerain_option_rootless)) { + LOG(LOG_FATAL, "cannot have rootful and rootless at the same time"); + return -1; + } + + if (!checkrain_option_enabled(palerain_flags, palerain_option_rootful) && !checkrain_option_enabled(palerain_flags, palerain_option_rootless)) { + LOG(LOG_FATAL, "must have either rootful or rootless, use --help for help"); + return -1; + } + + if (!checkrain_option_enabled(palerain_flags, palerain_option_rootful)) { if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful) || checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful_forced)) { LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");