Skip to content

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

mkjobs: apsd runs -- the push service the whole account stack waits for

vcvkk65fb9c8952aa
diff --git a/README.md b/README.md
index e7bb542..82365d5 100644
--- a/README.md
+++ b/README.md
@@ -1097,6 +1097,27 @@ REST=1 userland/build.sh
список исключений — `DENY` в `userland/mkjobs.py`, пропустить службу из него для опыта: `ALLOW="слово"`.
Остальные переменные (`JOBS`, `OSLOG`, `INJECT`, `RC_JOBS`) описаны в начале `userland/build.sh`.
+**Служба push-уведомлений (`apsd`).** Из всех служб, которых в образе не было, её спрашивали чаще всех:
+29 % всех строк `failed lookup` в журналах запусков — это `com.apple.apsd`, в одном сеансе 250–300 строк
+от 22 разных демонов (securityd, akd, amsaccountsd, imagent, remindd, healthd, fmfd — весь учётный слой
+спрашивает её прежде, чем что-нибудь сделать). В `DENY` она стояла с первого дня, и её ни разу не пробовали.
+Теперь она в образе «по требованию»: демон поднимается за 60 мс, когда его первый раз спрашивают, объявляет
+`com.apple.apsd` и `com.apple.apsd.nsxpc` и остаётся работать; строк `failed lookup` про него в сеансе
+больше нет ни одной, а клиенты получают свои порты (`com.apple.securityd.aps`,
+`com.apple.coreservices.appleid.aps`, `com.apple.icloud.fmfd.aps`, `com.apple.coreduet.knowledge.sync.push`).
+Самих уведомлений от Apple при этом нет и быть не может: курьеру нужен клиентский сертификат устройства,
+который `apsd` берёт из связки ключей, а если его там нет — у `mobileactivationd` («No identity found in
+keychain. Copying activation identity» → «Device is probably unactivated»). И этого сертификата здесь не
+будет: цепочка активации растёт из Secure Enclave — `mobileactivationd` проверяет UCRT против UIK
+устройства по `SEPRootCA.pem`, — а Secure Enclave у этого телефона нет, ключи классов защиты заменяет
+обратимое преобразование в ядре (`MiniAppleKeyStore.cpp`, см. «Связка ключей»). Польза ровно в том, что
+учётный слой получает ответ вместо ошибки и перестаёт переспрашивать.
+
+Следующая по тому же признаку — `com.apple.CommCenter-noncellular` (телефонию SpringBoard спрашивает
+10 тысяч раз за все сеансы). Это тот вариант задания, который iOS держит как раз для устройства без модема
+(`_LimitLoadFromDeviceTree = baseband`, а узла `baseband` в дереве у нас нет), программа у него та же,
+что у сотового, и в образе она есть; `DENY` отсекает оба по слову `CommCenter`.
+
`GL=1 REST=1 userland/build.sh` — образ, в котором оконный сервер рисует через OpenGL ES, а не программным
растеризатором CoreAnimation: за `EAGLContext` встаёт Mesa (прослойка — `userland/src/eagl.c`). На телефоне с
параметром ядра `gpu=1` рисует сам Adreno: драйвер freedreno из Mesa говорит с ядром
diff --git a/userland/mkjobs.py b/userland/mkjobs.py
index fb6f265..98f10c7 100755
--- a/userland/mkjobs.py
+++ b/userland/mkjobs.py
@@ -27,13 +27,19 @@ import plistlib
import sys
# substrings of labels. (mediaserverd is not among them, for all that there is neither sound nor a camera:
-# it is where VideoToolbox decodes for every other process, a HEIC picture included; see src/inject_media.c.)
+# it is where VideoToolbox decodes for every other process, a HEIC picture included; see src/inject_media.c.
+# apsd is not among them either: it was left out from the first day without ever being tried, and it is the
+# service the rest of the system misses most -- near a third of every "failed lookup" line in the run logs is
+# one of 22 daemons asking for com.apple.apsd, and the whole account stack asks before it will do anything.
+# It needs no hardware we have not got, and it serves its clients whether or not it reaches a push courier,
+# which it never will: the courier wants a device identity rooted in the Secure Enclave this phone has not
+# got (apsd -> mobileactivationd, "Device is probably unactivated"), so the push itself stays out of reach.)
DENY = ('watchdog', 'CommCenter', 'wifi', 'WiFi', 'bluetooth', 'BTServer', 'locationd', 'softwareupdate',
'datamigrator', 'backupd', 'thermalmonitord', 'keybagd', 'nfcd', 'biometrickitd', 'pearld',
'obliterat', 'storage_mounter', 'com.apple.fud', 'sepd', 'seputil', 'camera', 'ReportCrash',
'osanalytics', 'lockdown', 'audio', 'jetsamproperties', 'mobileactivationd',
'installcoordinationd', 'purplebuddy', 'restore', 'usb', 'accessoryd',
- 'mobileassetd', 'nsurlsessiond', 'apsd', 'itunesstored', 'appstored', 'cloudd', 'bird',
+ 'mobileassetd', 'nsurlsessiond', 'itunesstored', 'appstored', 'cloudd', 'bird',
# these start, crash and are asked for again, over and over. (aggregated, which was among them, is where
# iOS 16 keeps its power log -- com.apple.powerlog.plxpclogger.xpc and the rest -- that Settings > Battery
# waits for; it now runs through a session.)