App terminal exit hard-resets LineageOS 24 (hummer) even with a fully green kernel-module setup
App terminal exit / tab close hard-resets the phone (LineageOS 24, hummer)
Device: OnePlus Ace 5 Pro (hummer)
ROM: LineageOS 24.0
Kernel: 6.6.144-4k-g01ee97578159 (stock LineageOS, no custom kernel)
App: Droidspaces v7.2.0
Symptom
In the App terminal (any container), typing exit or pressing the tab × hard-freezes the whole phone and the PMIC resets it. No kernel panic, no pstore entry.
What reproduces it
Only the App's terminal close:
| path | result |
|---|---|
App terminal exit |
hard reset, 100% |
| App terminal tab × | hard reset, 100% |
adb: droidspaces enter <name> then exit |
survives |
adb pty + unshare -m + concurrent --json show/pid/run polling |
survives |
It is not the LKM
We built two independent kernel-module implementations against the exact kernel source/config:
- phDroid (
Dere3046/_patchHarmonyfork), withpid_impl=mainandnative, text and kprobe routes, with and without user namespaces and the extra modules - misaka5202/droidspaces-lkm, built against the same exact KDIR, kprobe default
droidspaces check is fully green on both (all MUST / RECOMMENDED / OPTIONAL items, including Sandboxing (user namespaces)), and both still hard-reset on App terminal close.
dontaudit for the permissive droidspacesd domain was installed as well; no change. The signal in the hang path is SEND_SIG_PRIV, which skips audit_signal_info() anyway.
Trace
ftrace on the exit path shows the container namespaces are released completely:
zsh-8791 exit_task_namespaces
zsh-8791 free_nsproxy -> put_mnt_ns -> droid_lkm_nsproxy_drop
zsh-8791 droid_lkm_ipcns_put
zsh-8791 release_task -> dnotify -> complete_signal (returned)
Then the pty is closed and the trace stops in:
tty_release -> __tty_hangup -> tty_signal_session_leader
read_lock(&tasklist_lock)
do_each_pid_task(tty->ctrl.session, PIDTYPE_SID, p)
spin_lock_irq(&p->sighand->siglock)
or at the next release_task() (write_lock_irq(&tasklist_lock)). That is the signature of a qrwlock writer-pending deadlock: one task hangs holding the read side, the next release_task queues as a writer, all new readers block, every CPU stops.
Why this may be App-side
The container runs with an emulated PID namespace (the vendor kernel has CONFIG_PID_NS=n; the LKM provides it). tty->ctrl.session is set by __proc_set_tty() from whoever called setsid() + TIOCSCTTY on the slave side. The App's terminal creates a different session/tty state than the adb/CLI path, and that is the only path that hangs.
Could you share how the App sets up the terminal? Specifically:
- Does the child process call
setsid()andTIOCSCTTYon the pty slave, or is the controlling tty inherited? - Which process owns the master after the container shell starts, and in what order are master and slave closed?
- Is the terminal process itself inside the container's PID namespace, or a host process that only
setnses for the shell?
If the App could avoid making the container shell a session leader with a controlling tty (or close the slave before the master), that may be enough to bypass tty_signal_session_leader() entirely.
Related upstream LKM discussion with the full traces: https://github.com/Dere3046/_patchHarmony/issues/15
Happy to test any patch or provide more traces.
Duplicate of #390. The PID namespace here is emulated by an LKM (CONFIG_PID_NS=n), and the LKM's maintainer already considers this an LKM problem: https://github.com/Dere3046/_patchHarmony/issues/15
We don't accept bug reports from setups that use these modules, and we won't fix or change Droidspaces to support them. That's entirely up to the developers of the modules. If it also happens on a kernel with CONFIG_PID_NS and CONFIG_IPC_NS compiled in and no namespace LKM loaded, let us know.