merge: refresh PRoot removal

This commit is contained in:
Kurt Himebauch committed 2026-12-05 16:30:33 -05:00
commit d949407c5c
406 files changed
+41180 -3048

No files matched your search

+53 -3
View File
@@ -171,7 +171,7 @@ there.
### B. Exec-in-place workers for long-lived processes
Declare a pool of `android:process` services (`:g0`…`:g95`). Each long-lived program runs as the
Declare a pool of `android:process` services (`:g0`…`:g127`). Each long-lived program runs as the
main process of one worker (Gap 2): full app privileges, direct GPU, normal signals and `/proc`
(same uid and SELinux domain), and the app hears its exit through binder death. Costs and limits:
@@ -261,8 +261,29 @@ vfork-safe (Python's subprocess execs under `vfork`). Details that mattered:
session (KDE Plasma, 17–19 counted at rest), a Konsole running 40 `sleep 600 &` jobs peaked at
61 counted and lost 27 processes to Android's limit (Konsole, D-Bus, the portal) before this, and
at 20 with no kills after. Still counted, and not handed off: a terminal's foreground jobs (a
`make -j` and its compilers), the D-Bus daemon's activation helpers (forks that never exec) and
the desktop's own programs started by KDE's launchers.
`make -j` and its compilers) and the D-Bus daemon's activation helpers (forks that never exec).
- **The desktop.** Plasma's own programs are listed (`startplasma-wayland`, `plasma_session`,
KWin, `kded6`, `ksmserver`, `plasmashell`, PowerDevil, KDE Connect, the KIO workers, the D-Bus
activated portal, dconf and activity manager) along with DroidDeck's desktop helpers. Discover's
update notifier, GeoClue's demo agent and the global-menu proxy are off in the user's Autostart.
A program a desktop launcher starts (`DD_HANDOFF_LAUNCHERS`: Plasma's shell, KRunner, Dolphin)
goes to a worker when it is a plain fork and exec: in the launcher's process group and session,
with no controlling terminal. Those launchers are Qt programs, which wait with `waitpid()` once
the hook has taken their pidfds away. A terminal's shell (its own session and terminal) stays.
Firefox runs with fission off, at most two web content processes and no crash helper. The
desktop and its apps use about 80 workers with Steam and a game running, hence 128.
Counted children on the Thor (main: the session as #3338 and #3594 left it):
| | main | this |
|---|---|---|
| desktop at rest | 30 | 0 |
| Dolphin, Konsole, Firefox, Kate and System Settings open | not measured (49 on a Pocket FIT without Firefox, the terminal running 40 jobs) | 7 |
| those, the desktop's Steam client and Bully running | not measured | 20 (30 with 64 workers: Wine's services were refused one) |
With Bully running, six scans forced with the stock limit of 32 killed nothing. What stays
counted then: Steam's client and launch chain (10), Firefox's helpers (6), Konsole's shell,
Proton's script and `wineserver`.
Default list: the portals, at-spi, `python3`, PipeWire, WirePlumber, Decky's PluginLoader, the log's
`gnudd`, `xprop -spy`, the web helper's renderers, `wine`, `wine-preloader`, `wineserver`.
@@ -509,6 +530,35 @@ the old behavior and the old requirement.
7. A (the isolated tier) only if B stops working on a future Android; it needs a file and socket
broker and keeps the GPU outside.
## Zombies
Every session process is a child subreaper (`tools/linuxfs/preload/subreaper.c`, so that a
double-forked Xwayland is not left to init, which some vendor kernels kill), and most programs
never wait for a child they did not fork. What they adopted stayed a zombie: the grandchildren of
Qt's `startDetached()` under Plasma's shell, KWin and kaccess, Wine's double-forked processes,
wlroots' Xwayland under gamescope. A parent that never waits at all (Plasma's shell, for what it
launches) also kept the forked child of each program it handed off. On the Thor, main had 4
zombies in Steam mode at rest and 19 in Bully, and the desktop gained one per app closed.
The hook now reaps them from SIGCHLD (`ddh_reap_unclaimed()`):
- **Adopted:** each process records, at its pid, the parent that started it and its own start
time, in one file for the session (`DD_PARENTS`). A fork's child does it at the fork, any other
program at its start. A zombie child whose record names another parent was adopted. An own child
(recorded with this parent, or with no record, such as a static program a `vfork()` started) is
left for its program's wait.
- **A handed-off program's forked child,** as a wait's look reaps it: the program's exit stays in
the table for the parent's wait.
The program's SIGCHLD action runs first, and `sigaction()` shows it as the program set it.
`SIG_IGN` and `SA_NOCLDWAIT` stay the kernel's. A program that leaves SIGCHLD alone gets the
handler only when `DD_REAP_ADOPTED` names it (Plasma's programs, D-Bus, gamescope, Wine's
launchers, Decky's loader): with a handler, `poll()`, `sleep()` and the like return `EINTR` when a
child exits. With these changes there are no zombies left in either mode, Bully included.
qemu-user has no `PR_SET_CHILD_SUBREAPER`, so the adoption tests skip under it (CI) and were run on
the Thor's kernel.
## Robustness
- Gap 1's path mismatch is a bug that could be fixed; the app-zygote skip is deliberate. Use app