Commit Graph
2845 Commits
Author SHA1 Message Date
The412Banner 2b9ebd8aee feat(bionic): hand the bionic runtime's Wine programs to the app's workers
The glibc session's hook never sees DroidDeck-Bionic's processes (Wine on
Android's libc), so a bionic game's Wine programs all stayed counted under the
worker running the tool's launch.sh. The handoff is now built into the
runtime's exec shim (tools/bionic-runtime/handoff.c, part of libexecshim.so):

- hook/handoff.c and hook/kept.c with what the native hook's other parts do
  around them: fork(), close(), close_range(), dup2(), dup3(), and exit() for
  the on_exit() bionic lacks
- bionic's execv(), execvp(), execl*() reach the execve system call inside
  libc, past execshim's execve(); Wine starts its preloader with execv(), so
  the shim defines them on top of its execve()
- a linker64 start is listed by its program
- the app starts a handed-off program from the glibc root's bash, which cannot
  load the runtime's LD_PRELOAD/LD_LIBRARY_PATH: they go as arguments of
  /system/bin/env, which puts them back for the program
- launch.sh keeps DD_SPAWN, DD_SPAWN_SESSION, DD_HANDOFF*, DDH_* and
  DDNATV_ROOT, and its /proc/N/environ reads no longer print "Permission
  denied" for idle workers (2>/dev/null before the redirect)

Pocket FIT, DroidDeck-Bionic 14.1-r67 with this shim and launcher, handoff on:
counted during Brawlhalla 25 -> 17, DiRT Showdown 24-27 -> 16, whole run
28 -> 19-20; with Android's limit on no DroidDeck process and no other app's
process was killed (before: Discord, BatteryLog helpers); DiRT 75 fps either
way. docs/phantom-processes.md: "The bionic runtime".
2026-11-30 17:28:29 -05:00
The412Banner 0ef9c7924a refactor(hook): kept descriptors in their own part, a handoff matched by another program
The descriptors close(), close_range() and closefrom() leave open move from
privileged.c to hook/kept.c (unchanged), so the bionic runtime's exec shim can
build the handoff with them. ddh_try_as() matches DD_HANDOFF against one
program and sends another: the bionic shim sends "/system/bin/linker64 PROGRAM
ARGS" and lists it by PROGRAM. ddh_try() is ddh_try_as() with both the same.
2026-11-30 17:28:27 -05:00
Kurt Himebauch afbd1f2bba fix(handoff): a listed program a shell runs as a job-control job stays counted 2026-11-28 15:58:22 -05:00
Kurt Himebauch f89326c709 docs(phantom): job-control jobs stay counted; listed programs report no stops 2026-11-28 15:46:35 -05:00
Kurt Himebauch d7f0ce82d8 fix(handoff): job-control jobs stay counted; unnamed requests refused; cancel-safe setup 2026-11-28 15:43:59 -05:00
Kurt Himebauch 80ec4d7517 fix(handoff): table setup not cancellable; test spawner never runs what it cannot end 2026-11-28 15:23:15 -05:00
Kurt Himebauch d2f270d93c fix(handoff): requests name their session; stops of handed-off programs reported; cancellable look 2026-11-28 15:13:39 -05:00
Kurt Himebauch be7f59d983 fix(handoff): one given-up table at most, whole stop codes and rusage, WNOWAIT exits rechecked 2026-11-28 15:01:12 -05:00
Kurt Himebauch 081e4e1223 fix(handoff): generation-checked reap marks, stops taken as stops, close counts reset in a fork 2026-11-28 14:36:29 -05:00
Kurt Himebauch dfcd07c24d fix(hook): settle waits out earlier epochs; unknown-start fork records kept for any handoff under way 2026-11-28 13:29:11 -05:00
Kurt Himebauch 1c888d88e9 fix(handoff): waits look before they reap, so a handed-off fork's child is never reported 2026-11-28 13:17:36 -05:00
Kurt Himebauch 5b07d85296 fix(hook): a table made at runtime outlives closes begun before it; unknown-start fork records kept 2026-11-28 13:04:06 -05:00
Kurt Himebauch 5eea46b9c6 fix(handoff): one report per handed-off child; stops keep a claim; nested waits keep their selector 2026-11-28 12:42:37 -05:00
Kurt Himebauch 1b3c2a77d9 fix(hook): change the kept fd list under a sequence lock; readers take a copy 2026-11-28 12:16:42 -05:00
Kurt Himebauch 8c9904d016 test(handoff): require ENOEXEC for an ELF stub; skip the namespace run without binfmt 2026-11-28 12:04:38 -05:00
Kurt Himebauch ab3d7d96fe Merge remote-tracking branch 'origin/main' into research/phantom-process-limit
# Conflicts:
#	tools/tests/test_native_hook_named_semaphores.py
2026-11-28 12:02:53 -05:00
Kurt Himebauch 0859268591 test(semaphores): tell a child hung in qemu-user from a guest deadlock (#3375)
* test(semaphores): tell a child hung in qemu-user from a guest deadlock

* test(semaphores): calibrate qemu's guest base and end a stuck child on timeout
2026-11-28 12:02:37 -05:00
Kurt Himebauch 441773012f fix(handoff): a spare parent pidfd made at start, so a dup2 onto it makes no fd 2026-11-28 12:02:16 -05:00
Kurt Himebauch b1dbfb54da test(handoff): find the module in the namespace run under discover too 2026-11-28 11:49:19 -05:00
Kurt Himebauch 61bc8e03b2 fix(handoff): self-recorded forks, ELF and wait option checks, both nofile limits 2026-11-28 11:46:29 -05:00
Kurt Himebauch de573892f2 fix(handoff): an unknown-start fork record never replaces a pending one 2026-11-28 11:20:27 -05:00
Kurt Himebauch 68706c544a fix(handoff): keep a pending child's fork record when an older fork records late 2026-11-28 11:01:11 -05:00
Kurt Himebauch 13a327cfa7 Merge remote-tracking branch 'origin/main' into research/phantom-process-limit
# Conflicts:
#	app/src/main/java/com/droiddeck/launcher/session/SessionService.kt
2026-11-28 11:01:11 -05:00
Kurt Himebauch 20b0358162 fix(session): kill a PRoot session's guests once proot is gone (#3376) 2026-11-28 10:45:29 -05:00
MaxsTechReview 65ebefc38f fix(desktop): Help Center, Software Sources and the driver manager open (#3371)
* fix(desktop): apps built on Qt's web engine start in the desktop and from AppImages

The desktop runs as root, and Qt WebEngine refuses to start as root with its
sandbox on, so Help Center and any other QtWebEngine app exited at once. Flatpaks
already had the sandbox off; the desktop and the AppImage runner now set it the
same way they turn off Firefox's sandboxes.

* fix(desktop): Software Sources and the driver manager open

software-properties-qt imports PyQt6.uic and UbuntuDrivers but does not depend
on the packages that ship them, so both tools died with an ImportError on the
installed-without-recommends desktop. The desktop package list now carries
pyqt6-dev-tools and ubuntu-drivers-common.
2026-11-28 10:24:50 -05:00
Kurt Himebauch 8fa2e65a42 fix(handoff): a fork record stays only for the pid's current process 2026-11-28 10:00:42 -05:00
Kurt Himebauch c16515fc49 fix(handoff): dup bookkeeping before the pidfd lock, newer fork records kept 2026-11-28 09:51:07 -05:00
Kurt Himebauch adb0a27a68 fix(handoff): a known-start bit in fork records 2026-11-28 09:37:18 -05:00
Kurt Himebauch 056be5f3a1 test(semaphores): count only reaped children, only futex waits as emulator stalls 2026-11-28 09:29:27 -05:00
Kurt Himebauch 63f5ac5b5e fix(handoff): fork records matched by the child's start time, never removed 2026-11-28 09:16:28 -05:00
Kurt Himebauch 7221782940 test(semaphores): tell a child hung in qemu-user from a guest deadlock 2026-11-28 09:00:40 -05:00
Kurt Himebauch 4c90e9175d fix(handoff): every dup in a pidfd process locks, fork prep blocks signals 2026-11-28 08:31:24 -05:00
Kurt Himebauch b65af1fa9f fix(handoff): fork record generations, no pidfd restore after a failed move 2026-11-28 08:10:02 -05:00
Kurt Himebauch f7a90151ec fix(handoff): lock only dups onto the pidfd, with signals blocked 2026-11-28 07:56:31 -05:00
Kurt Himebauch 2748ae9f5a fix(handoff): liveness check under the pidfd lock, forget only a reaped pid's record 2026-11-28 07:41:36 -05:00
Kurt Himebauch 784df6260a fix(handoff): one lock over a pidfd move, its dup and the undo 2026-11-28 07:27:31 -05:00
Kurt Himebauch 87fbe91940 fix(handoff): fresh fork records in a forked child, heir is the first live thread 2026-11-28 07:13:56 -05:00
Kurt Himebauch b47a2c9c0e fix(handoff): undo a pidfd move when dup fails, recheck it after the poll 2026-11-28 07:01:20 -05:00
Kurt Himebauch 597f083ab9 fix(handoff): no handoff without fork records, unknown thread state keeps the owner 2026-11-28 06:52:17 -05:00
Kurt Himebauch 4475a122bf fix(handoff): keep the parent pidfd through dup2 and check it before use 2026-11-28 06:41:00 -05:00
Kurt Himebauch 68a3fa1d52 fix(handoff): fork records by pid, a gone thread's children go to the main one 2026-11-28 06:29:59 -05:00
Kurt Himebauch f1dd51f0aa fix(handoff): watch the forking parent through a pidfd opened at start 2026-11-28 06:20:33 -05:00
Kurt Himebauch 1b8187c94a fix(handoff): one-word fork records, changed only by compare-and-swap 2026-11-28 05:29:43 -05:00
Kurt Himebauch 60175ec3ec fix(handoff): a parent /proc cannot read is checked with kill(), then given up 2026-11-28 05:20:49 -05:00
Kurt Himebauch 9463765104 fix(handoff): a child whose forking thread ended is any thread's 2026-11-28 05:17:49 -05:00
Kurt Himebauch a77abf3293 fix(handoff): controlling-terminal check via /dev/tty, owned records only 2026-11-28 05:13:51 -05:00
Kurt Himebauch 3e0e13468e fix(handoff): the thread selector applies to claims in progress too 2026-11-28 04:56:43 -05:00
Kurt Himebauch 3754f505f4 fix(handoff): keep a child's forking thread until its end is taken 2026-11-28 04:54:21 -05:00
Kurt Himebauch 98663031ca fix(handoff): a wait that finds no child rechecks live handoffs 2026-11-28 04:45:49 -05:00
Kurt Himebauch b581fc8bdc fix(handoff): keep the forking thread of each child in the parent 2026-11-28 04:19:08 -05:00