android-tools: adbd fixes and opt-in access control for Linux systems
Get series with b4
b4 am [email protected] change-id 20261106-android-tools-adbd-1c8f4decb0deVersions newest first
- v1 Latest10 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | android-tools: adbd: forward the reboot target to RESTART2meta-oe/ meta-oe/ | +43 | 0 replies | |
| 2/10 | android-tools: adbd: start adb shell in $HOME, without Android's TMPDIRmeta-oe/ meta-oe/ | +46 | 0 replies | |
| 3/10 | android-tools: adbd: fix the USB worker hanging on glibc after a cable pullmeta-oe/ meta-oe/ | +119 | 0 replies | |
| 4/10 | android-tools: adbd: restart after adb root/unrootmeta-oe/ meta-oe/ meta-oe/ | +62 | 0 replies | |
| 5/10 | android-tools: adbd: signal readiness once functionfs is servicedmeta-oe/ meta-oe/ | +118 | 0 replies | |
| 6/10 | android-tools: add PACKAGECONFIG debuggable-propmeta-oe/ meta-oe/ | +125 | 0 replies | |
| 7/10 | android-tools: add PACKAGECONFIG auth-unless-debuggablemeta-oe/ meta-oe/ | +145 | 0 replies | |
| 8/10 | android-tools: add ADBD_AUTH_KEY_PATHSmeta-oe/ meta-oe/ | +78 | 0 replies | |
| 9/10 | android-tools: adbd: keep root only while the build is debuggablemeta-oe/ meta-oe/ | +52 | 0 replies | |
| 10/10 | android-tools-conf: android-gadget-cleanup: don't killall adbdmeta-oe/ | +1 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH meta-oe 00/10] android-tools: adbd fixes and opt-in access control for Linux systems
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.
---
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,
Signature · 1 line
Alex Kiernan <[email protected]>