mbox series

[meta-oe,00/10] android-tools: adbd fixes and opt-in access control for Linux systems

Message ID 20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com
Headers show
Series android-tools: adbd fixes and opt-in access control for Linux systems | expand

Message

Alex Kiernan Nov. 10, 2026, 5:35 p.m. UTC
adbd built from this recipe runs on Linux devices rather than Android, and
several things that Android's init or property service would normally
provide are missing. This series fixes the bugs that follow from that, and
adds opt-in controls for who may use adbd.

The first five patches are fixes and change behaviour without any opt-in:

 - `adb reboot recovery` / `bootloader` pass their target to RESTART2
   instead of a fixed "adb", so kernels whose reboot-mode driver picks the
   boot mode from the reason string reboot into the requested mode.
 - `adb shell` starts in the user's home directory and no longer gets
   Android's TMPDIR=/data/local/tmp.
 - On glibc, UsbFfsConnection::StopWorker() no longer spins for ever
   after a cable pull: it relied on bionic's pthread_kill() behaviour, and
   the host saw the device as offline until adbd was restarted.
 - adbd exits after `adb root` / `adb unroot` so the service manager
   restarts it with the new privilege state; the unit becomes
   Restart=always.
 - Readiness is signalled once functionfs is being serviced, not
   immediately after the USB thread starts. sd_notify(READY=1) raced
   open_functionfs(), and 10-adbd-configfs.conf binds the UDC on READY=1
   with no delay, so the bind could be dropped and the host never reached
   CONFIGURED. Builds without systemd can get the same signal through a
   FIFO named in $ADBD_READY_FIFO.

The next four are opt-in, and change nothing unless enabled:

 - PACKAGECONFIG[debuggable-prop]: liblog reads ro.debuggable from the
   build.prop-style files in ADB_DEBUGGABLE_PROP_FILES rather than
   reporting every build as debuggable, so `adb root` can be refused on a
   production image.
 - PACKAGECONFIG[auth-unless-debuggable]: hosts must authenticate unless
   the build is debuggable, decided per connection. Today the Debian patch
   lets every host in without a key.
 - ADBD_AUTH_KEY_PATHS: where adbd reads trusted host keys, in place of
   Android's /adb_keys and /data/misc/adb/adb_keys.
 - adbd keeps root across a restart only while the build is debuggable,
   so a root state written while it was does not outlive it. Without
   debuggable-prop every Linux build is debuggable, so this is a no-op.

The last patch drops `killall adbd` from android-gadget-cleanup, which
runs after adbd has already exited.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
Alex Kiernan (10):
      android-tools: adbd: forward the reboot target to RESTART2
      android-tools: adbd: start adb shell in $HOME, without Android's TMPDIR
      android-tools: adbd: fix the USB worker hanging on glibc after a cable pull
      android-tools: adbd: restart after adb root/unroot
      android-tools: adbd: signal readiness once functionfs is serviced
      android-tools: add PACKAGECONFIG debuggable-prop
      android-tools: add PACKAGECONFIG auth-unless-debuggable
      android-tools: add ADBD_AUTH_KEY_PATHS
      android-tools: adbd: keep root only while the build is debuggable
      android-tools-conf: android-gadget-cleanup: don't killall adbd

 .../android-tools-conf/android-gadget-cleanup      |   4 +-
 ...dbd-forward-the-reboot-target-to-RESTART2.patch |  42 +++++++
 ...start-in-HOME-and-drop-the-Android-only-T.patch |  45 +++++++
 ...-use-pthread_kill-as-a-thread-liveness-pr.patch | 118 ++++++++++++++++++
 ...exit-after-adb-root-unroot-so-an-init-sup.patch |  60 +++++++++
 ...nal-readiness-once-functionfs-is-serviced.patch | 117 +++++++++++++++++
 ...onally-read-ro.debuggable-from-build.prop.patch | 117 +++++++++++++++++
 ...ally-require-authorization-unless-the-bui.patch | 138 +++++++++++++++++++++
 ...h-optionally-take-the-trusted-key-paths-a.patch |  72 +++++++++++
 ...oot-on-Linux-only-while-the-build-is-debu.patch |  51 ++++++++
 .../android-tools/android-tools-adbd.service       |   2 +-
 .../android-tools/android-tools_35.0.2.bb          |  28 ++++-
 12 files changed, 788 insertions(+), 6 deletions(-)
---
base-commit: 33db795031ddef81949db64aedf33070e1330fdd
change-id: 20261106-android-tools-adbd-1c8f4decb0de

Best regards,
--  
Alex Kiernan <alex.kiernan@gmail.com>