Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.
C
Widgets draw and the wallpaper has its gradient: extensions are found
vcvkk68d9d3232fcf
diff --git a/prebuilt/SHA256SUMS b/prebuilt/SHA256SUMSindex df03d02..eccd693 100644--- a/prebuilt/SHA256SUMS+++ b/prebuilt/SHA256SUMS@@ -1,6 +1,6 @@-Built 2026-10-13 09:25 from this tree.+Built 2026-10-13 09:50 from this tree.-63bfdfee38e0be3852abaca4297deff69d109348da62f887459dbc52c70d5c2d prebuilt/mach.development.bcm2837+0ee5322ec0a92212de451434a271a781f1d6feffe7982cfe5f5a47765d53a40a prebuilt/mach.development.bcm28371332a598d2dec00a1d8e930044e4f00a12ad44c6e5e50eecf4b7fe7fae803bf2 prebuilt/loader.efid2a35a4a1d6658ffb3696914f727661b52c9333de8a3af8a31642b8023ce03ac prebuilt/userland/child1a413befd511384052e1962c1394adce20f718e1f2657ce63ab09828ebc4bd1b prebuilt/userland/cpu_testdiff --git a/prebuilt/mach.development.bcm2837 b/prebuilt/mach.development.bcm2837index 9cdb857..b006b7f 100755Binary files a/prebuilt/mach.development.bcm2837 and b/prebuilt/mach.development.bcm2837 differdiff --git a/xnu/files/bsd/kern/kern_minimac.c b/xnu/files/bsd/kern/kern_minimac.cindex eb6ef5c..d1b2868 100644--- a/xnu/files/bsd/kern/kern_minimac.c+++ b/xnu/files/bsd/kern/kern_minimac.c@@ -17,7 +17,8 @@** Sandbox Every query (may this process look up that service?) is* answered "allowed", and every request to apply a profile- * succeeds without applying anything.+ * succeeds without applying anything. The one question with+ * an answer of its own is which container a process is in.*/#include <sys/param.h>@@ -31,6 +32,10 @@#include <sys/ubc_internal.h>#include <sys/vnode_internal.h>#include <libkern/libkern.h>+#include <kern/task.h>+#include <mach/vm_param.h>+#include <vm/vm_kern.h>+#include <vm/vm_map.h>#include <security/mac_framework.h>#include <security/mac_policy.h>@@ -116,15 +121,121 @@ SECURITY_READ_ONLY_LATE(static struct mac_policy_conf) miniamfi_conf = {};SECURITY_READ_ONLY_LATE(static mac_policy_handle_t) miniamfi_handle;+/*+ * Request 4, "container path of a process": sandbox_container_path_for_pid() and+ * sandbox_container_path_for_audit_token() of libsystem_sandbox. The argument is+ * { pid, version of the pid, buffer, its size, whether the version is to be compared }.+ *+ * On a device the Sandbox learns the container when the program is executed (it asks+ * containermanagerd) and confines the process to it. Nothing is confined here, but the question+ * is still asked and the answer matters: an application extension hosted by PlugInKit does not+ * run without a container. It gives the buffer a "?" to start with and wants a longer string+ * back, else "plugin has invalid sandbox or container" (-[PKService checkEnvironment:]) -- the+ * end of every Intents extension while this request "succeeded" without writing anything.+ *+ * Whoever starts a program that lives in a container -- RunningBoard an application, pkd an+ * extension -- has had the path from containermanagerd and passes it in the environment as+ * CFFIXED_USER_HOME, which is where Foundation takes the home directory from. So that is the+ * answer: it is looked up among the strings exec left at the top of the stack of the process.+ * A process without the variable has no container, and gets what every process got before:+ * success and an untouched buffer.+ */+#define SANDBOX_SYSCALL_CONTAINER_PATH 4+#define SANDBOX_CONTAINER_VARIABLE "CFFIXED_USER_HOME="++static int+minisandbox_container_path(user_addr_t arg)+{+ struct {+ int64_t pid;+ uint64_t pidversion;+ user_addr_t buffer;+ user_size_t size;+ uint64_t check_pidversion;+ } args;+ const size_t prefix_len = sizeof(SANDBOX_CONTAINER_VARIABLE) - 1;+ proc_t p;+ task_t task;+ vm_map_t map;+ vm_map_copy_t copy = NULL;+ vm_offset_t strings = 0;+ vm_size_t strings_size;+ user_addr_t user_stack;+ size_t argslen, len;+ const char *s, *end;+ int error;++ error = copyin(arg, &args, sizeof(args));+ if (error) {+ return error;+ }+ p = proc_find((int)args.pid);+ if (p == PROC_NULL) {+ return ESRCH;+ }+ if (args.check_pidversion && (uint64_t)proc_pidversion(p) != args.pidversion) {+ proc_rele(p);+ return ESRCH;+ }+ user_stack = p->user_stack;+ argslen = p->p_argslen;+ task = proc_task(p);+ if (user_stack == 0 || argslen == 0 || task == TASK_NULL) {+ proc_rele(p);+ return 0;+ }+ /* the same way as sysctl_procargsx(): the task keeps the map alive once the process is let go */+ task_reference(task);+ proc_rele(p);+ map = get_task_map_reference(task);+ task_deallocate(task);+ if (map == VM_MAP_NULL) {+ return 0;+ }+ strings_size = vm_map_round_page(argslen, vm_map_page_mask(map));+ if (kmem_alloc(kernel_map, &strings, strings_size, KMA_DATA | KMA_ZERO, VM_KERN_MEMORY_BSD) != KERN_SUCCESS) {+ vm_map_deallocate(map);+ return ENOMEM;+ }+ if (vm_map_copyin(map, (vm_map_address_t)(user_stack - strings_size), strings_size, FALSE, ©) != KERN_SUCCESS) {+ copy = NULL;+ }+ vm_map_deallocate(map);+ if (copy == NULL || vm_map_copy_overwrite(kernel_map, strings, copy, strings_size, FALSE) != KERN_SUCCESS) {+ if (copy != NULL) {+ vm_map_copy_discard(copy);+ }+ kmem_free(kernel_map, strings, strings_size);+ return 0; /* the process is on its way out, or has unmapped its own stack */+ }++ end = (const char *)(strings + strings_size);+ for (s = end - argslen; s < end; s += len + 1) {+ len = strnlen(s, end - s);+ if (len > prefix_len && s + len < end && strncmp(s, SANDBOX_CONTAINER_VARIABLE, prefix_len) == 0) {+ s += prefix_len;+ len -= prefix_len;+ error = len < args.size ? copyout(s, args.buffer, len + 1) : ENAMETOOLONG;+ break;+ }+ }+ kmem_free(kernel_map, strings, strings_size);+ return error;+}+/* Which request numbers have been seen: one log line each, to learn what user space asks for. */static uint64_t minisandbox_seen;static int-minisandbox_policy_syscall(struct proc *p, int call, __unused user_addr_t arg)+minisandbox_policy_syscall(struct proc *p, int call, user_addr_t arg){if (call >= 0 && call < 64 && (minisandbox_seen & (1ULL << call)) == 0) {minisandbox_seen |= 1ULL << call;- printf("minisandbox: request %d (first seen from %s[%d]): allowed\n", call, p->p_comm, proc_getpid(p));+ printf("minisandbox: request %d (first seen from %s[%d]): %s\n", call, p->p_comm, proc_getpid(p),+ call == SANDBOX_SYSCALL_CONTAINER_PATH ? "answered" : "allowed");+ }+ if (call == SANDBOX_SYSCALL_CONTAINER_PATH) {+ return minisandbox_container_path(arg);}return 0;}diff --git a/xnu/files/bsd/miscfs/packfs/packfs_vfsops.c b/xnu/files/bsd/miscfs/packfs/packfs_vfsops.cindex 604e50a..db78cf6 100644--- a/xnu/files/bsd/miscfs/packfs/packfs_vfsops.c+++ b/xnu/files/bsd/miscfs/packfs/packfs_vfsops.c@@ -344,13 +344,26 @@ packfs_vfs_getattr(mount_t mp, struct vfs_attr *fsap, __unused vfs_context_t ctxvol_capabilities_attr_t *cap = &fsap->f_capabilities;bzero(cap, sizeof(*cap));+ /*+ * A node's number is its place in the image and never changes, and packfs_vget()+ * finds a node by it, with its name and parent: that is "persistent object IDs"+ * and "path from ID". The second is not a nicety. It is what makes the VFS layer+ * answer fsgetpath(2) and /.vol paths for this volume, and without it+ * CoreFoundation has no file ID to give for any file here (_NSURLFileIDKey).+ * LaunchServices takes a file without one for unreachable: it then never reads+ * a program to see which platform it is built for, registers every application+ * and extension as of platform 0, and no extension belongs to an extension point+ * any more (pkd: "Candidate plugin count from LaunchServices: 0").+ */cap->capabilities[VOL_CAPABILITIES_FORMAT] =+ VOL_CAP_FMT_PERSISTENTOBJECTIDS |VOL_CAP_FMT_SYMBOLICLINKS |VOL_CAP_FMT_NO_ROOT_TIMES |VOL_CAP_FMT_CASE_SENSITIVE |VOL_CAP_FMT_CASE_PRESERVING |VOL_CAP_FMT_FAST_STATFS |- VOL_CAP_FMT_2TB_FILESIZE;+ VOL_CAP_FMT_2TB_FILESIZE |+ VOL_CAP_FMT_PATH_FROM_ID;cap->capabilities[VOL_CAPABILITIES_INTERFACES] =VOL_CAP_INT_ADVLOCK |VOL_CAP_INT_FLOCK;diff --git a/xnu/redwood.patch b/xnu/redwood.patchindex c63247f..d6a8036 100644--- a/xnu/redwood.patch+++ b/xnu/redwood.patch@@ -315,7 +315,7 @@ index 95192dd62449..b00da803b5b4 100644/*diff --git a/bsd/kern/kern_exec.c b/bsd/kern/kern_exec.c-index 1d71c66629fb..57cd16eed941 100644+index 1d71c66629fb..024ead8a529a 100644--- a/bsd/kern/kern_exec.c+++ b/bsd/kern/kern_exec.c@@ -1157,6 +1157,9 @@ SYSCTL_PROC(_vm, OID_AUTO, shared_region_control,@@ -348,7 +348,7 @@ index 1d71c66629fb..57cd16eed941 100644if (error) {goto bad;}-@@ -2640,6 +2649,25 @@ done:+@@ -2640,6 +2649,57 @@ done:return ret;}@@ -358,9 +358,41 @@ index 1d71c66629fb..57cd16eed941 100644+ * /dev/null, go to the console instead (that shows NSLog and the "Terminating app due to+ * uncaught exception" kind of message). With applog=2 every program also gets+ * OS_ACTIVITY_DT_MODE in its environment, which makes os_log write to standard error as well:-+ * everything any program logs, and a much slower system.++ * everything any program logs, and a much slower system. applog_name=NAME[,NAME...] with++ * applog=1 does that for the programs whose file names begin with one of the NAMEs only,++ * which is how to read what one application extension has to say (launchd starts those for++ * whoever asks, so there is no job description of ours to put the variable in).+ */+static TUNABLE(uint32_t, exec_applog, "applog", 0);++static TUNABLE_STR(exec_applog_name, 128, "applog_name", "");++++static bool++exec_applog_oslog(struct image_params *imgp)++{++ const char *name, *p = exec_applog_name;++++ if (exec_applog >= 2) {++ return true;++ }++ if (exec_applog == 0 || *p == 0 || imgp->ip_ndp == NULL) {++ return false;++ }++ name = imgp->ip_ndp->ni_cnd.cn_nameptr;++ while (*p != 0) {++ const char *word = p;++++ while (*p != 0 && *p != ',') {++ p++;++ }++ if (p != word && (size_t)(p - word) <= imgp->ip_ndp->ni_cnd.cn_namelen && strncmp(word, name, (size_t)(p - word)) == 0) {++ return true;++ }++ if (*p == ',') {++ p++;++ }++ }++ return false;++}++static const char *+exec_applog_path(int fd, const char *path)@@ -374,7 +406,7 @@ index 1d71c66629fb..57cd16eed941 100644/** exec_handle_file_actions*-@@ -2709,7 +2737,7 @@ exec_handle_file_actions(struct image_params *imgp, short psa_flags)+@@ -2709,7 +2769,7 @@ exec_handle_file_actions(struct image_params *imgp, short psa_flags)AUDIT_SUBCALL_ENTER(OPEN, p, uthread);NDINIT(ndp, LOOKUP, OP_OPEN, FOLLOW | AUDITVNPATH1, UIO_SYSSPACE,@@ -383,7 +415,7 @@ index 1d71c66629fb..57cd16eed941 100644imgp->ip_vfs_context);error = open1(imgp->ip_vfs_context, ndp,-@@ -5586,10 +5614,61 @@ bad:+@@ -5586,10 +5646,61 @@ bad:* Note: The argument and environment vectors are user space pointers* to arrays of user space pointers.*/@@ -445,7 +477,7 @@ index 1d71c66629fb..57cd16eed941 100644int error = 0;int ptr_size = (imgp->ip_flags & IMGPF_WAS_64BIT_ADDR) ? 8 : 4;int new_ptr_size = (imgp->ip_flags & IMGPF_IS_64BIT_ADDR) ? 8 : 4;-@@ -5759,6 +5838,33 @@ exec_extract_strings(struct image_params *imgp)+@@ -5759,6 +5870,33 @@ exec_extract_strings(struct image_params *imgp)imgp->ip_envc++;}@@ -463,7 +495,7 @@ index 1d71c66629fb..57cd16eed941 100644+ imgp->ip_envc++;+ }+ /* ... and one for everybody when the logs are wanted on the console (see exec_applog_path) */-+ if (exec_applog >= 2) {++ if (exec_applog_oslog(imgp)) {+ error = exec_add_user_string(imgp, CAST_USER_ADDR_T("OS_ACTIVITY_DT_MODE=YES"), UIO_SYSSPACE, TRUE);+ if (error) {+ goto bad;@@ -479,7 +511,7 @@ index 1d71c66629fb..57cd16eed941 100644/* Save space for envv[] NULL terminator */if (imgp->ip_argspace < new_ptr_size) {error = E2BIG;-@@ -7538,6 +7644,11 @@ process_signature(proc_t p, struct image_params *imgp)+@@ -7538,6 +7676,11 @@ process_signature(proc_t p, struct image_params *imgp)}done: