plooshInit may be booted in one of the follow modes: ramdisk root or md0 on /cores. palera1n uses md0 on cores.
Order of execution: fakedyld -> payload_dylib constructor -> /cores/payload prelaunchd stage -> payload_dylib constructor -> /sbin/launchd -> payload_dylib boot-task hook -> /cores/payload sysstatuscheck stage -> /usr/libexec/sysstatuscheck -> /sbin/launchd -> payload_dylib daemon hook -> jaibreakd, /cores/payload launch daemons stage -> uicache palera1n loader, spawn dropbear -> SpringBoard/PineBoard
When kernel loads the init program, it will invoke dyld, this will be /cores/usr/lib/dyld
,
which is the fakedyld, via a kernel patch. On ramdisk root the fakedyld is also accessible
at /usr/lib/dyld
, the normal dyld location at this stage. Should fakedyld encounter an
error, it will crash with a custom reason string.
fakedyld will carry out the following tasks:
- open
/dev/console
for logging - Parse argc, argv, envp, apple, from
KernelArgs
- Load and check boot-args and paleinfo appended to end of
/dev/md0
- Check for boot mode: ramdisk root or md0 on /cores
- (ramdisk root) read ramdisk files into memory as those will not be accessible after mounting root filesystem.
- (ramdisk root) clean fakefs if requested
- (ramdisk root) mount root filesystem, using information supplied in paleinfo.
- Prepare the root filesystem, such as binding filesystems on a partial fakefs, or mounting devfs in case of ramdisk root.
- Make /cores writable, on ramdisk root, mount tmpfs onto /cores, on md0 on /cores remount /cores.
- (ramdisk root) write the read files into
/cores
- (md0 on /cores) Delete the fakedyld file so the kernel will use the real dyld.
- Patch dyld so that we can use the same set of bianries for iOS, iPadOS, tvOS,
HomePod software and bridgeOS. The patched dyld goes to
/cores/usr/lib/dyld
- Execute the real launchd. Environment variables is used to make
the next stage,
payload_dylib
run before any launchd code can execute.
This stage is a dylib inserted into /sbin/launchd
with DYLD_INSERT_LIBRARIES
.
It is used to persist the jailbreak's code execution during boot or userspace reboots.
payload_dylib provides the following services:
When first loaded, it performs the following task:
- open
/dev/console
for logging - Load launchd crash reporter, palera1n flags
- Spawns
/cores/payload
to carry out extra things which may require entitlements - Stop and reboot here if we are trying to setup fakefs
- Draw something cool onto the device framebuffer, if one exists.
- Use
ellekit
orDobby
to hook functions in launchd to provide services.
These hooks are installed:
- A xpc handler running in launchd to set certain environment variables system-wide
- Loads additional LaunchDaemons for jailbreak.
- posix_spawn hooks to inject
systemhook.dylib
system-wide
This file is part of payload
, a multi-call binary.
This section only concerns when its name is payload
.
It performs the following tasks:
- Mount varies disk images such as the binpack and loader.
- Delete the fakefs if we are force reverting on rootful
- Use a bind mount to use
Dobby
overellekit
whenellekit
cannot be used. - Setup fakefs if requested
At this point, all file systems has been mounted. The following tasks are performed:
- Remount filesystems
- Generate the SSH host keys for dropbear
- Write to preferences plists for palera1n loader
- Delete files if we are trying to force revert
- Revert the snapshot if we are trying to force revert rootful realfs.
- Remove
/var/jb
symlink on rootful, or make it again on rootless if preboot path exists. - Execute most (with some exceptions) files in the
/etc/rc.d
or/var/jb/etc/rc.d
directory.
XPC services may be used at this stage. The following tasks are performed:
- uicache the palera1n loader and jailbreak apps
- show the safe mode alert if we are in safe mode
This file is part of payload
, a multi-call binary.
This section only concerns when its name is jailbreakd
.
jailbreakd has the following uses:
- Act as the root helper for
p1ctl
and palera1n loader - Handles userspace reboot requests because stock userspace reboots breaks Xcode debugging.
- Holds various information in memory such that they stay consistent system-wide.
This file is part of payload
, a multi-call binary.
This section only concerns when its name is p1ctl
.
p1ctl is the command line access to palera1n loader, see p1ctl(8)
for details.
systemhook.dylib is a dylib which is inserted into most processes. It is responsible for:
- Loading tweaks
- Re-inject itself when the process it is injected into spawns another process.
- Make sure
dlopen("@rpath/usr/lib/libroot.dylib")
works correctly - Loading
universalhooks
- Redirect userspace reboot requests to
jailbreakd
- Fix up
__builtin_available
,@available
etc for binaries made to run with the dyld patch.
universalhooks is injected into various daemons. It is used to alter the behaviour of daemons in a way that is suitable for the jailbreak.
Examples:
- rootless path redirection
- Force enable apps on tvOS
- watchdogd hook to prevent watchdog timeout from panicking the system (perform userspace reboot instead)