From patchwork Tue Nov 10 17:35:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103593 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1075.1794332157363949842 for ; Tue, 10 Nov 2026 09:35:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=J5gtYHAd; spf=pass (domain: gmail.com, ip: 209.85.128.53, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4a207b02a2cso16077815e9.1 for ; Tue, 10 Nov 2026 09:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332156; x=1794936956; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AY8BGsv+drZooPn9Jj3FS28OTUn5Jw0AoqsqxFqdGnE=; b=J5gtYHAdxDy/4Sxr3iFUtRnKTn6SY4dYNJmuCLFXeg6pmAgl20Oa88uz+hGeYkHmYC 7EOmS6TddlY48lPSVMFiFRSy5pMwbSWQJar5oh0nwrrwulDcjo5j8IwOKa75GLgelFf8 BRcmZA47HTSJ9br6SJs7b51F6yA5ym/gfs/xLvcjT1RUE8P9SnyEM+2chtLJiOnclelo 7EZM8sRiPc40ywQ/xwgZskTh7SagRz1FJEnljAzyOqOL9fILpRfSJNkA3jnmx1EZBm+R Ds/Z9ePDVQNS9JaxChxSBRPO2Muj2sdjamRt+ynHxmu3vtZBh4PaVNz19kTYlRa5LXCE UImQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332156; x=1794936956; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AY8BGsv+drZooPn9Jj3FS28OTUn5Jw0AoqsqxFqdGnE=; b=JzwzjqHA3sdmXmtvh3NXYGlP2sn1yGpD7HNkXpgzSh3T+og1gUbrQsGGBs/UPYfHRE 20cSch0B28RU0Qo03vx3dIUUNSUCxpLmIx3h/wFQ0Y5qMQ4sgmxDociULHjBhftx8pvQ Pt9TZcgt6mHUiPyyQZYMixEIHY4o+YmfAhXO/X+Jihu54EfAD/wSmzScg7fgv1RtTSm4 6H8Kzi3dNRpW0B/4t6Av+ciVKnGzEZUXte5o09TRbixMCJIIWgDeCpL5SIOaPA6UbGSd +uHx6S9r08p3R8RSXFvjR62PN9pg162pu2lcl2/U9MrpBcgW7odfVqNqazNOA8zDspqf k7tg== X-Gm-Message-State: APuU4Z/K3cZVP8M2vgh6iWFtQqnpP2Wi4Zwek+YxH+WXglBWSn/OvR+1 uKLduHnZ6vICwz/IPsQHRgPJWyJ1h/7p89uvunjonrqY60sojifjpJIeH2nsUA== X-Gm-Gg: AYBFou2xP8hFEon5bD0mO8sSZvrH7a67qsEu665Fhf7HniOgmfzC7lCMYrBEBidO/0i YaFuwgoMhB1ieL6qS6VzmNBzgIJdQyleDoj8itzrlpAXyL2DDU/S8CO5Iz2Has00CvlqYElKjH8 9a61fwyN5FvJSYPtYuQ2s9EeWgsv6NDB2CuAEP+kcXblvmFgA7mMNN8y3u0nG0aA9QsmGeyFjaV vDt1MVUiI2I95aVbO1JZEWNgvsYSaJQC4QX7X9mVBkBdvWJb3qUKOkW3Yv/7Y71erDtB5ktL5G1 YP5VzVSVb71ThaCp58O1IcEWbtS5mEQWHuWvkEpsYQjnGO8gWVHy7qzDpPkZlUQ/TACNP+N9Kkp Y2rHNRFtSvz8j3mXrcU9Sw/qYuaHjWPoI4KWJu6P45H6hZhfQkItFrJYFF0Xgal8/e5wxqq5s7S 9K46W+R94t0EK16yHCbQjVbpi0yojKhATbeTnnJdqIuLfb73V9+a273VsFQaWOIMevzP6gPsMnc 0HtcfcvZ5uLaWodXQwKgtFGHKGH4xhBb3Zq3V9a1jI6FctFsd2pbY0GWOKRw9lIlXIa4NIk9EVY VcO7R/2gP8gujIU4TbPYoqLD3md36ol7MeTl2N6hfWeocfjcW+XaLIDQSO2ajUeGHcEGjOKQSrk nNyw= X-Received: by 2002:a05:600c:4687:b0:4a1:7d9b:d4ae with SMTP id 5b1f17b1804b1-4ba0233e7eamr56577535e9.5.1794332155319; Tue, 10 Nov 2026 09:35:55 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:35:54 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:30 +0000 Subject: [PATCH meta-oe 01/10] android-tools: adbd: forward the reboot target to RESTART2 MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-1-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:06 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132098 reboot_device() hard-codes the RESTART2 reason to "adb" on non-Android builds and drops the requested target, so `adb reboot recovery` and `adb reboot bootloader` are plain reboots on any board whose kernel picks the boot mode from the reboot reason (reboot-mode, as on Rockchip). AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...dbd-forward-the-reboot-target-to-RESTART2.patch | 42 ++++++++++++++++++++++ .../android-tools/android-tools_35.0.2.bb | 1 + 2 files changed, 43 insertions(+) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0016-adbd-forward-the-reboot-target-to-RESTART2.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0016-adbd-forward-the-reboot-target-to-RESTART2.patch new file mode 100644 index 000000000000..02b7a44ed802 --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0016-adbd-forward-the-reboot-target-to-RESTART2.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Mon, 15 Jun 2026 00:00:00 +0000 +Subject: [PATCH] adbd: forward the reboot target to RESTART2 + +On non-Android Linux builds reboot_device() hard-codes the RESTART2 +reboot reason to "adb" and throws away the requested target, so +"adb reboot recovery", "adb reboot bootloader", etc. all collapse to a +plain reboot. + +On Rockchip the reboot reason string is consumed by the kernel +reboot-mode driver (drivers/power/reset/reboot-mode.c), which strcmp()s +it against the device-tree "mode-*" entries (mode-recovery, +mode-bootloader, mode-loader, ...) to pick the boot-mode magic written +to the PMU syscon register that U-Boot reads on the next boot. With the +reason fixed to "adb" nothing matches and it falls back to a normal +boot. + +Pass the real target through instead. An empty target (bare +"adb reboot") becomes "", which the kernel treats as "normal", matching +the previous behaviour for that case. + +Upstream-Status: Pending + +Signed-off-by: Alex Kiernan +--- + packages/modules/adb/daemon/services.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/packages/modules/adb/daemon/services.cpp b/packages/modules/adb/daemon/services.cpp +index 1b2731442a2a..968e9e74ffa4 100644 +--- a/packages/modules/adb/daemon/services.cpp ++++ b/packages/modules/adb/daemon/services.cpp +@@ -219,7 +219,7 @@ static void remount_service(unique_fd fd) { + auto reboot_service = [name](unique_fd fd) { + sync(); + if (syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, +- LINUX_REBOOT_CMD_RESTART2, "adb") != 0) { ++ LINUX_REBOOT_CMD_RESTART2, name.c_str()) != 0) { + WriteFdFmt(fd.get(), "reboot (%s) failed: %s\n", name.c_str(), strerror(errno)); + return; + } diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index e9785ac235de..4961a13963c4 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -60,6 +60,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0013-adb-sysdeps-provide-pread64-pwrite64-lseek64-fallba.patch \ file://0014-daemon-auth-vendor-a-portable-b64_pton-for-non-glib.patch \ file://0015-adbd-make-fs-config-opt-in-on-non-android-builds.patch \ + file://0016-adbd-forward-the-reboot-target-to-RESTART2.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" From patchwork Tue Nov 10 17:35:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103595 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1089.1794332158100706761 for ; Tue, 10 Nov 2026 09:35:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=mzIpHYgU; spf=pass (domain: gmail.com, ip: 209.85.221.48, mailfrom: alex.kiernan@gmail.com) Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-498f5fa4f70so637426f8f.0 for ; Tue, 10 Nov 2026 09:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332156; x=1794936956; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3xXRRykqRrKToxez0VFTiK6p6eky8RT4rH1pd7Lp3y4=; b=mzIpHYgUFAaR3T8v9Bh/fwz6etY60K0OwGuodcDwkPpIVfhgpDgb+jk06Xyz0kW+Wm 8efiZ/0mZUKOFxZA6OjOTlDYej7BEwghfiotI5ZJGdbFfl/+81DwHl5flQIE/tAfZYI2 SMxGG1psNzfnV8y3XsITadVl5sr52qXD35zprqTLLZ/cv7/N8FrMVjwcd0RyJ+e+gSB7 l4GO0wePhkNuhEhxTS2zuiZz0KFdlX65ziuW63ODljVJz7VmnE0nFEOFl6uGsiopByAB B+3M4GAwvMesdi+hQBkLZH4URRGgViQb9EJ4PdBNGHl3oW4MOy6MbXr8TQ+1oXQBftGe la/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332156; x=1794936956; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3xXRRykqRrKToxez0VFTiK6p6eky8RT4rH1pd7Lp3y4=; b=XN2s9BQssVd10KGqLbhAx3H5QvMkeNjtP3tvxXyu7axCAjZY5Evjd95qxCRtPQyV6E d13HqTjFlV3Vm9O3/01AUPJwPwIfiU+P6/bEBsNO2Dt4SWjr2Na8s/8PBhMz0xmXm47M 1faElFzdaRR980Vtk7dvLhkd/iR7dXBrf3XQZE0DM2r0khshbSWn/5mTsgfRLmBgp7D5 asKp+pc3QOkohdh6mnrGT3OJwjtjsTaKvTYaz4SNzUJDQb7KmeR+c1K0dU8/lfd8YFln PGErdWlG3+hW15td5PvlW74irQ52SKuTYr6xO7wDNHPALQMDPBCWLbzdV7TMVszNBiVW uzCQ== X-Gm-Message-State: APuU4Z+6C8nBOYwMYtyw+0E4y2EmQUKWmUyUDFZVRMLu0N9Qs41VhRRp ewY3CMy0KXKhZDyGm+srRF3Jvv2Rz1Bl5+V7hJRfP60PDlh5RjchHbbsD/4VwQ== X-Gm-Gg: AYBFou2nNxBVKAmXcvnVSdvb1eX8nROHKyhFlgPREyE0+vtU/3rXAzuvwuVtcVD11u+ XPgLIXWpAs0XXuSZgCgQ5EdTuGQsoHfTyfrunzTjNlSyAhG2LSlaCDAJU9Sk8Poig9PPaNy6DkH qE7BnyzUovJgDWXHqj6oXREHK+AAilQnlfevtVezSgdpTPTVyu/1Mj1+gbSxJ3Mmd6fdrb9YaDH z/ixHTjBtrMmcKBUUU+QKpxQLixV+5Eiit6xaOrczZnvhQuVxgx84F4xpFljjeTbVUXYFQ/bCYt q2+aigYblnv2gtw7zcaZYe2n9dmYZVazXPrBMO8H8YoYSP3DOmZFk/oQ9krMIp0yfE4NxMVE3jN NP5CnTFvroEML1Tz3RsUxMwkTpbSBfjpIq5Rj9iTlg2wQcP/+W2+vcQnhS7u5QJuQcqE2mqib7E YFwRVOzybLyeAgsqzNdqdnuG1DAOv1yHshAmbX9/AeBjUeJ9XsiJBbZL60/YkS6C1Tr6a4wLu0x uoQAd4wEhv4i5fEB/UD1i4siaBV4GR3A03+HVLXno88HaqwhUZ/UPx+lLcCOq1xCBJIxEtmr2HU WPSFeLuSwNTl6NgOAoQf4vtZNJEXpj8YsX9+xSmdyz3HFJRMXJ6otHGJaLxGwCdEV8rB4d5uEFo xZZDQnqqhoAkEYHUzqXrtrmi5 X-Received: by 2002:a05:600c:a310:b0:4ba:809:5453 with SMTP id 5b1f17b1804b1-4ba0809556amr15680855e9.31.1794332156264; Tue, 10 Nov 2026 09:35:56 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:35:55 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:31 +0000 Subject: [PATCH meta-oe 02/10] android-tools: adbd: start adb shell in $HOME, without Android's TMPDIR MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-2-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132099 adbd execs the login shell itself, so `adb shell` starts in adbd's working directory rather than the user's home, and with TMPDIR=/data/local/tmp, which does not exist on a Linux rootfs. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...start-in-HOME-and-drop-the-Android-only-T.patch | 45 ++++++++++++++++++++++ .../android-tools/android-tools_35.0.2.bb | 1 + 2 files changed, 46 insertions(+) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0017-adbd-shell-start-in-HOME-and-drop-the-Android-only-T.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0017-adbd-shell-start-in-HOME-and-drop-the-Android-only-T.patch new file mode 100644 index 000000000000..d8839d776069 --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0017-adbd-shell-start-in-HOME-and-drop-the-Android-only-T.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Fri, 17 Jul 2026 18:20:41 +0100 +Subject: [PATCH] adbd: shell - start in $HOME and drop the Android-only TMPDIR + +adbd execs the login shell directly (no login(1)), so it never chdir()s and the +shell lands in adbd's cwd (/) instead of the user's home. chdir() to the passwd +home before exec, best-effort. Also drop the hardcoded TMPDIR=/data/local/tmp: +that path only exists on Android and is wrong on a normal Linux rootfs, where an +unset TMPDIR correctly falls back to /tmp. + +Upstream-Status: Pending + +AI-Generated: Claude Opus 4.8 (claude-opus-4-8) +Signed-off-by: Alex Kiernan +--- + packages/modules/adb/daemon/shell_service.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/packages/modules/adb/daemon/shell_service.cpp b/packages/modules/adb/daemon/shell_service.cpp +index dbca4adb61e2..4e9e50edf271 100644 +--- a/packages/modules/adb/daemon/shell_service.cpp ++++ b/packages/modules/adb/daemon/shell_service.cpp +@@ -274,7 +274,6 @@ bool Subprocess::ForkAndExec(std::string* error) { + env["HOSTNAME"] = GetHostName(); + env["LOGNAME"] = pw->pw_name; + env["SHELL"] = pw->pw_shell; +- env["TMPDIR"] = "/data/local/tmp"; + env["USER"] = pw->pw_name; + } + +@@ -386,6 +385,13 @@ bool Subprocess::ForkAndExec(std::string* error) { + } + #endif + ++ // Start the shell in the user's home dir, like login(1) would - adbd ++ // execs the shell directly (no login), so without this it inherits ++ // adbd's cwd (/). Best-effort: if HOME is missing/unset, stay put. ++ if (pw != nullptr && pw->pw_dir && pw->pw_dir[0]) { ++ (void)chdir(pw->pw_dir); ++ } ++ + if (command_.empty()) { + // Spawn a login shell if we don't have a command. + execle(_PATH_BSHELL, "-" _PATH_BSHELL, nullptr, cenv.data()); diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index 4961a13963c4..b1e66198f88c 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -61,6 +61,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0014-daemon-auth-vendor-a-portable-b64_pton-for-non-glib.patch \ file://0015-adbd-make-fs-config-opt-in-on-non-android-builds.patch \ file://0016-adbd-forward-the-reboot-target-to-RESTART2.patch \ + file://0017-adbd-shell-start-in-HOME-and-drop-the-Android-only-T.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" From patchwork Tue Nov 10 17:35:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103596 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1090.1794332159437590724 for ; Tue, 10 Nov 2026 09:35:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=0zmVA+hM; spf=pass (domain: gmail.com, ip: 209.85.128.50, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4a9a8d6cea8so28629255e9.1 for ; Tue, 10 Nov 2026 09:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332157; x=1794936957; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=o6TmDhIQfQMyKfUbNRc764ERoyhuscUbIGTQEB12gk0=; b=0zmVA+hM+bSz3RN6XbSEOGdh+iG/PgmL6qHrNh3Mibl6qAw70fLKdpS/Uw6FwxG5iS SuDVmGbOPKdOX/UIHmwQpx3P/+ApE1/8RnEqb5YYMN6LJgOB0uMBvKNzUlpXdMuo5otr SFNiZ9lHggb79h+Ww3vSla3+Ufk9MbzATs8LsloVASsLyw3jM1qWnKw9HhCplELiw6ZR SPSeyJ8tzWZ3XIvS3jhQrgNRjNFjmtLAxmowMbxwefsE3PNNIgL/dooVuYvfUUihAMLK S8agAFAyZjC3oDfBPHRXGIV/X0/oUOk//vz8k8W2kMSRJBamQinOt1wuuwKQ5DP6BBS1 WaKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332157; x=1794936957; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=o6TmDhIQfQMyKfUbNRc764ERoyhuscUbIGTQEB12gk0=; b=CjVifhkruYpDOv7EtI9PJKk6W4lVwQ1EZzFLKBQ/dz4YEV97c7K8+we0Yhsaqo5Rf1 0eVT1q4AQxijJvsBm8NhSG0bkJ2dAGOkrEagh+KhV/aiMfUVWhHiByH6elY5oskoxFCg Bv2ujfJLqDhnOyN9G56t50mdscpzia4tS122cRY8r+drF3gYaK0PjtHFYOT8WIWebENg RylUoF7ATjMDS+23vGH2mxb3uqm1+PBrXUY2m0+qDOCoocENU9LV9pv/nAOTBPCXCdyc v/hSRHC0qHG5wz+0ll1qyccInV63S1qrZk5/xtTjRTBbTxria+WwWDJ2Cj5DzUcStnxH hI0Q== X-Gm-Message-State: APuU4Z+5TJM8halBDajFGPfu8e47KWKYALIhD91duDb3+34NzXsSDZ+V KHdXtXBfLQIklm5teyf9t5KQkWaHMnsg67lpcnJepzrGVBmjqLxDKGRRXvFf6Q== X-Gm-Gg: AYBFou2Jfmg8wdH0373SHlHXqXBiehbjg4zNBjvoyh7hj9U8R0Aq5qGfBKyDTkZ5mHs ERXtCDoWNKdy+pRX6FMvImm21WVtapPjHkJmPBnb/8QsXHTu3tVPbNtqpTHJzIXLvERqbYdI2Nj BqOvWVwegiZAE7Bzg8yTM1n1YH9LFLyMp9wKyDaVaKvdAAEyfE1ZASjV/H50g2HeH4z91FV//MA LbtlE/SEydDDN24brrUeRPStCrVnu1Zd34B3WQwpXTdenwrxQEVVngxAdWDdTtiOrkjAc/aXj5F EL3lRRvS3t1nB65XOVZgjfVbV+mN5y6ra7QVTsVKkYsYpSUvsjhuvZvsL2//7aUpiwQ6sbUV1a2 AbrT94zRIN4zMASibEDluGi4+92dLH82s+HPa/lcgT46EMdzinvgNp3ZRbppswU6vzxjJ8Ys/Fi GdKLIE+NWlzLPgIE4yXp0ZNX5frwjQy2a3GiJCYEJJ7iMIQRV8nyE+43/xzIznl9TKmC73QyO0f GafhS2jjsmPsbSMb2Eiq6J5pUok/B/zv+NWrrKjfJ8JUdgztD7b/DFZ9zGK1euJaFK92+uuKMDq a+5RCl295W6+lDQx9FmA3Fv2vUsuZYomxFKoC4zRmOHLYNIzHTeEKO4Pnx0A4j5bVUWwBI/YF3y dLQI= X-Received: by 2002:a05:600c:c83:b0:4a2:18c4:61a5 with SMTP id 5b1f17b1804b1-4ba08dc2f77mr1484205e9.6.1794332157281; Tue, 10 Nov 2026 09:35:57 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:35:56 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:32 +0000 Subject: [PATCH meta-oe 03/10] android-tools: adbd: fix the USB worker hanging on glibc after a cable pull MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-3-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132100 UsbFfsConnection::StopWorker() waits for the worker with pthread_kill(handle, 0) == ESRCH, which holds on bionic but not glibc, where an exited, unjoined thread still answers 0. A cable pull ends the worker on its own, StopWorker() then spins for ever, ep0 is never reopened and the host sees the device as offline until adbd is restarted. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...-use-pthread_kill-as-a-thread-liveness-pr.patch | 118 +++++++++++++++++++++ .../android-tools/android-tools_35.0.2.bb | 1 + 2 files changed, 119 insertions(+) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0018-adbd-do-not-use-pthread_kill-as-a-thread-liveness-pr.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0018-adbd-do-not-use-pthread_kill-as-a-thread-liveness-pr.patch new file mode 100644 index 000000000000..0ebe7aba69b5 --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0018-adbd-do-not-use-pthread_kill-as-a-thread-liveness-pr.patch @@ -0,0 +1,118 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Sun, 13 Sep 2026 08:31:56 +0100 +Subject: [PATCH] adbd: do not use pthread_kill as a thread-liveness probe + +UsbFfsConnection::StopWorker() polled `pthread_kill(handle, 0) == ESRCH` to ask +whether the worker had exited. That reads as portable and is not: it relies on +bionic clearing the thread id on exit, so a signal to a dead thread lands on +nothing. glibc keeps the thread descriptor valid until join(), so for an +exited-but-unjoined thread pthread_kill returns 0, the probe answers "still +running" for ever, and the loop never terminates. + +It is not a race on glibc, it is a hang, and the path that reaches it is the +ordinary one: a cable pull kills the worker on its own with "Cannot send after +transport endpoint shutdown", so StopWorker is entered with a corpse. +~UsbFfsConnection then never returns, usb_ffs_open_thread never reopens ep0, +and the kernel gadget re-enumerates perfectly while the host claims the +interface and never receives a CNXN. The device shows as `offline` until +something restarts adbd. On a unit whose only route in is adb, nothing can. + +The worker now reports its own exit through an atomic, which is true on both +libcs. It is set from a scope guard rather than as the lambda's last statement +because the SubmitRead failure path returns early, and that is precisely a case +StopWorker must not wait for ever on. The signal is still sent on every pass, +since interrupting a worker blocked in io_getevents is what the loop is for. + +Diagnosed on two RK3308 units, both wedged the first time either had its cable +pulled since boot: main thread in futex_wait joining the monitor, monitor +thread in hrtimer_nanosleep at the 100ms spin, the open thread waiting on a +connection reset that never comes, and no worker thread at all. strace of the +monitor shows both pthread_kill calls returning success with no tgkill issued. + +Upstream-Status: Pending + +AI-Generated: Claude Opus 5 (Claude Code) +Signed-off-by: Alex Kiernan +--- + packages/modules/adb/daemon/usb.cpp | 38 +++++++++++++++++++++-------- + 1 file changed, 28 insertions(+), 10 deletions(-) + +diff --git a/packages/modules/adb/daemon/usb.cpp b/packages/modules/adb/daemon/usb.cpp +index 1fe2d3aa3215..e44c7b788587 100644 +--- a/packages/modules/adb/daemon/usb.cpp ++++ b/packages/modules/adb/daemon/usb.cpp +@@ -146,6 +146,7 @@ struct UsbFfsConnection : public Connection { + UsbFfsConnection(unique_fd control, unique_fd read, unique_fd write, + std::promise destruction_notifier) + : worker_started_(false), ++ worker_exited_(false), + stopped_(false), + destruction_notifier_(std::move(destruction_notifier)), + control_fd_(std::move(control)), +@@ -406,6 +407,14 @@ struct UsbFfsConnection : public Connection { + adb_thread_setname("UsbFfs-worker"); + LOG(INFO) << "UsbFfs-worker thread spawned"; + ++ // On EVERY exit path, not as a final statement: the SubmitRead ++ // failure below returns early, and that is precisely a case ++ // StopWorker() must not wait forever on. ++ struct ExitReporter { ++ std::atomic* flag; ++ ~ExitReporter() { flag->store(true, std::memory_order_release); } ++ } exit_reporter{&worker_exited_}; ++ + for (size_t i = 0; i < kUsbReadQueueDepth; ++i) { + read_requests_[i] = CreateReadBlock(next_read_id_++); + if (!SubmitRead(&read_requests_[i])) { +@@ -435,8 +444,23 @@ struct UsbFfsConnection : public Connection { + return; + } + ++ // NOT pthread_kill(handle, 0) == ESRCH as a liveness probe. That reads ++ // as portable and is not: it relies on bionic clearing the thread id ++ // when a thread exits, so the signal lands on nothing. glibc keeps the ++ // descriptor valid until join(), so for an exited-but-unjoined thread ++ // pthread_kill returns 0 and the probe says "still running" for ever. ++ // ++ // The loop is reached with a dead worker in the one case that matters: ++ // a cable pull kills the worker on its own (transport endpoint ++ // shutdown), and then ~UsbFfsConnection never returns, the ffs ++ // endpoints are never reopened, and the host sees a device that ++ // enumerates but never sends CNXN - offline until adbd is restarted. ++ // On a unit whose only way in IS adb, that is unrecoverable. ++ // ++ // The signal is still sent on every pass, because that is what the loop ++ // is for: interrupting a worker blocked in io_getevents. + pthread_t worker_thread_handle = worker_thread_.native_handle(); +- while (true) { ++ while (!worker_exited_.load(std::memory_order_acquire)) { + int rc = pthread_kill(worker_thread_handle, kInterruptionSignal); + if (rc != 0) { + LOG(ERROR) << "failed to send interruption signal to worker: " << strerror(rc); +@@ -444,15 +468,6 @@ struct UsbFfsConnection : public Connection { + } + + std::this_thread::sleep_for(100ms); +- +- rc = pthread_kill(worker_thread_handle, 0); +- if (rc == 0) { +- continue; +- } else if (rc == ESRCH) { +- break; +- } else { +- LOG(ERROR) << "failed to send interruption signal to worker: " << strerror(rc); +- } + } + + worker_thread_.join(); +@@ -709,6 +724,9 @@ struct UsbFfsConnection : public Connection { + + bool worker_started_; + std::thread worker_thread_; ++ // Set by the worker itself on the way out. StopWorker() waits on this ++ // rather than probing the thread handle - see the comment there. ++ std::atomic worker_exited_; + + std::atomic stopped_; + std::promise destruction_notifier_; diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index b1e66198f88c..9a0bae98dd19 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -62,6 +62,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0015-adbd-make-fs-config-opt-in-on-non-android-builds.patch \ file://0016-adbd-forward-the-reboot-target-to-RESTART2.patch \ file://0017-adbd-shell-start-in-HOME-and-drop-the-Android-only-T.patch \ + file://0018-adbd-do-not-use-pthread_kill-as-a-thread-liveness-pr.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" From patchwork Tue Nov 10 17:35:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103597 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1077.1794332160270640571 for ; Tue, 10 Nov 2026 09:36:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=Tm402ELv; spf=pass (domain: gmail.com, ip: 209.85.128.43, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4a3517554f7so24355975e9.2 for ; Tue, 10 Nov 2026 09:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332158; x=1794936958; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VCoIVxUN7/HNcrZJQNRrtt1h0uxfOvtG2T4z2RkCTCE=; b=Tm402ELvGxgxOIUi5oulmDAxRDfb/3pRv0guVRkq8S9NCxcrhPrnzH1MbV9t8VOtu7 bwNf/TfxoqqGnDLjmwK4Kebq6fBJzanb4OUyPzKxWxXItr7dnrEXG3fH/cPv8XGa2CtU 1rCrLxcn/p39S/rrPkDlva24PVA0JRibcj+jUBPhj9sfp8oiStr+KIJy1GUAChXx59NR SondLh5YMxuI1PJLYFDLVSUOh4OoGYN0UZ6uz5ytCv4sXbK4t8rvITzrxLIrhhDg3/78 ShyGsMCr/sMXLTLLPKaZ2gkUsl37gAe2NsglXav1ng5w9lKajDtEk8vBDax1EUzP7vTH lPcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332158; x=1794936958; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VCoIVxUN7/HNcrZJQNRrtt1h0uxfOvtG2T4z2RkCTCE=; b=dTlnBqi2r0AwCqDnVVAhfO3BoEu2gE9Gv7ZrWwVFAuhJSY151WNWLsqkBjd5d12IL8 9/pZufh3E7I51tjPekJcy+tl83C3GopXKImqmJjSwbn5WQ1e38P27SHu/ptma7XC93v5 RFS4dgD8SUYd4LLAUA2hZOXbNDMjJizpD1+IGbvPIlnBtHWpU+uo/UHxcnFleAgmUEaz SH1Q7X76mdrfNUQ2HQMxrAsWrKujPYZy70AvUinE/EL5+jiukoEwxBDl1twx7/08m8Cv M3CmqMOodBridf9Z45zqg5rg+ABfVxTm89x0yMHSbdNH/flFp0xW/BFHTg+o+oVsWwlY 4WtA== X-Gm-Message-State: APuU4Z96ZFdq1vqktDfUV0cDG7YhIf+YkiiIRktvRykGAIalmoObVjwi JaLY2OITOr5KjdbgZnX59g1GLBgXsae6Kd8gHQFKTi57RZkNs4ZIlVrAUcF0Bg== X-Gm-Gg: AYBFou1rNZl9yQDqHqwSOTwbWVFqPzYEFrwBfQY/tRPas4CbX8K0QqfA+LNihH4DhtX w/4LKOC5eWo3fuv9naVAh0SRVpruAKOeSopTelJhtuomXjyWjyI1pwP+zFpgSlS/Hdy8yjtUxj8 P16kkaQ7w4VHW3K1guLlEHVp5Xrzstwd2xdhVpjgwqWhqM4fkPJspKK2AsuEXwLLTTX9Gvy+jC2 2X6JpUb+2Ic371UCqF9vsyd3uu3OYg6XE/qABoAdN7wCT2B4uY139yHbUYSD1tPO/yQ4wvYN92G +Lz66k1uWov8R+0P3EEHpzTnfquXz0xZHgVtn3W5pakrr6JfuuAYcI8xP7WmttlxiqlPq4w9jv1 fG67AJ8j8L0CBT3zBx4JMTXaS/J8gm1LK18ytZaoexDEGhMiZSWxxjEFb84vEsEZ5vycyRNfXcX 2sY7gw8S+hh5kFfn5YfW8r5ESaTb6/aOR7MIvRe4+d/5lEkCrgmWdQg1xxBCV43Otti4Le4rigM GYUGfRoyjKl3MzyBoI0Ibs+NZv8puy+ppILTXxaFZfHOcK5UyYBA0sHaOQSUD2+yGjwt3bJlmE5 xFlduaMdcj/pbb36sAh9pK9tfWX1aFVnnZAs3z6vH9gbnanRTJxBYHb1oJrpvp/8svMrW1gIRCR gUJbp X-Received: by 2002:a05:600c:1d18:b0:4a6:eca1:7d5c with SMTP id 5b1f17b1804b1-4ba023580demr53430515e9.32.1794332158396; Tue, 10 Nov 2026 09:35:58 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:35:57 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:33 +0000 Subject: [PATCH meta-oe 04/10] android-tools: adbd: restart after adb root/unroot MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-4-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132101 `adb root` and `adb unroot` write the new privilege state to /run/adbd.root and expect adbd to be restarted to apply it, as Android's init does. Nothing restarted it here, so the client's wait-for-disconnect hung and adbd kept its uid. Have adbd exit after writing the state, and restart the service on any exit, not only on failure. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...exit-after-adb-root-unroot-so-an-init-sup.patch | 60 ++++++++++++++++++++++ .../android-tools/android-tools-adbd.service | 2 +- .../android-tools/android-tools_35.0.2.bb | 1 + 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0019-adb-daemon-exit-after-adb-root-unroot-so-an-init-sup.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0019-adb-daemon-exit-after-adb-root-unroot-so-an-init-sup.patch new file mode 100644 index 000000000000..a55e4259194c --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0019-adb-daemon-exit-after-adb-root-unroot-so-an-init-sup.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Sun, 19 Jul 2026 08:59:06 +0100 +Subject: [PATCH] adb: daemon: exit after adb root/unroot so an init supervisor + restarts adbd + +On Android, `adb root`/`adb unroot` write the desired privilege state and +rely on init restarting adbd (via a property trigger) to pick it up. This +Linux port keeps the "write state file, rely on a restart" model but the +running adbd never exits, so on a non-Android system with nothing watching +the state file the daemon keeps its current uid and the client's +`wait-for-disconnect` hangs (or times out once the USB transport happens to +drop for unrelated reasons). + +Exit after successfully writing the root state, as the classic adbd did, +so the service manager restarts adbd (systemd with Restart=always, or a +supervisor such as runit); on restart should_drop_privileges() reads the +state file and comes back root (root) or drops to the adb user (unroot). A +short delay lets the reply reach the host over USB before the gadget is +torn down. + +Upstream-Status: Pending +Signed-off-by: Alex Kiernan +--- + packages/modules/adb/daemon/restart_service.cpp | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/packages/modules/adb/daemon/restart_service.cpp b/packages/modules/adb/daemon/restart_service.cpp +index 8aee1afeaef8..3c3fd24ed5af 100644 +--- a/packages/modules/adb/daemon/restart_service.cpp ++++ b/packages/modules/adb/daemon/restart_service.cpp +@@ -65,7 +65,16 @@ void restart_root_service(unique_fd fd) { + if (write_root_state(kRootMagic, kRootMagicSize)) { + LOG(INFO) << "adbd restarting as root"; + WriteFdExactly(fd.get(), "restarting adbd as root\n"); +- return; ++ // Unlike on Android (where init restarts adbd on a property ++ // trigger), on this Linux port nothing watches the root-state ++ // file, so a still-running adbd would keep its current uid and ++ // the client's `wait-for-disconnect` would hang. Exit instead so ++ // the init supervisor restarts us; on restart should_drop_ ++ // privileges() reads #ROOT# and we come back as root. Give the ++ // reply time to reach the host over USB before tearing the gadget ++ // down, as the classic adbd did. ++ sleep(1); ++ _exit(0); + } + usleep(100000); + } +@@ -84,6 +93,10 @@ void restart_unroot_service(unique_fd fd) { + } + LOG(INFO) << "adbd restarting as nonroot"; + WriteFdExactly(fd.get(), "restarting adbd as non root\n"); ++ // See restart_root_service(): exit so the init supervisor restarts adbd, ++ // which then reads #NOROOT# and drops privileges again. ++ sleep(1); ++ _exit(0); + } + + void restart_tcp_service(unique_fd fd, int port) { diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service b/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service index 7c16b5cea20f..355d91517cff 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service +++ b/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service @@ -5,7 +5,7 @@ Before=android-system.service [Service] Type=notify -Restart=on-failure +Restart=always ExecStartPre=-/usr/bin/android-gadget-setup adb ExecStart=/usr/bin/adbd diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index 9a0bae98dd19..e247cbbafa60 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -63,6 +63,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0016-adbd-forward-the-reboot-target-to-RESTART2.patch \ file://0017-adbd-shell-start-in-HOME-and-drop-the-Android-only-T.patch \ file://0018-adbd-do-not-use-pthread_kill-as-a-thread-liveness-pr.patch \ + file://0019-adb-daemon-exit-after-adb-root-unroot-so-an-init-sup.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" From patchwork Tue Nov 10 17:35:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103598 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1095.1794332161495632676 for ; Tue, 10 Nov 2026 09:36:01 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=SUIi6bQr; spf=pass (domain: gmail.com, ip: 209.85.128.54, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4b79502c27aso24196415e9.1 for ; Tue, 10 Nov 2026 09:36:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332160; x=1794936960; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=szmYQk25uFUbtHR3HGlqjxsaiM0NvigwkqiZtn3o2V8=; b=SUIi6bQrm3enef4LeWaLGfRJYmG+b2IDlDMo7YWhPd1uK25ilhgR9v5v9cpas+QkON AytcD2O4KH9DSaEvd0JGCHoge05OgI1Byaib+N4YY5PXMytNwj8YcjaZgA8kKP/NLNMg 5Knw6zD7PIBXwlSf+6s/+kfuiIPhnNQoCg3CtqVZmNDuW/shIHRPdP2dvwXUbo5N5MjC /MiFV7btntMTJWU36MMU07ewvyC2ZEGtPfxC8ECoqL42DnwGecd7PM5Sa2lWqcAu6GrP hMWv3HfqhVCHzZ+Ya7lop4H7gTYYKH6E6KfxSLYxO8PW43SSwm9LrXAKAMFRPyRuDE3X ILxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332160; x=1794936960; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=szmYQk25uFUbtHR3HGlqjxsaiM0NvigwkqiZtn3o2V8=; b=OzoPO1shoZtRoYGPKyR/rJZL+vBU7domBTx1Ww7YO5zUMo1qrNtLEJtRO6uKR5zTxy 3Z3pLb0qhXalQkHhW15TawDoNdOPj1Zj6qwZv81MgSMsjayz07JXv2ELm2P97Ii/mkaY SaIqWhhXgq/r652wujZd6Bv8aOKJdIHkQaqwRqwH6+yZNuYp4O5HubfvnjPlHJtUWzSQ UsI3lP/Cv2E+1Ys6TmQnT6mGIh3w3FYok6f4Dob+ARu/pvP8vVgjwqibqA+I/zd4h0+T zKMytbo0QtrBdjwkBmjh1y9Tx3s7Y1G/1nbYHoMc399ycYZKNK8i4y3eyRs6orHD5gIs fN5w== X-Gm-Message-State: APuU4Z+ZB4ufIpaW79OD6Lhtyffp/XgwB7fdyYt4E8to1OWP1svj+7PZ C8ZR7mNIBBHZ5JM/w8XbMOIKtEVdmprcDlRnAqixLassbhqGGfcW4Hlc+zC9JA== X-Gm-Gg: AYBFou1FLQo/79KGenNhN4AIFebQoaXdrptKIYxNmd/M8MtajIp2kgKgcLwzekxDzRc 8N+62qY+Dz/iGTAxSheASxPD3g5OsrpSQ/8fZ1i+j0Hic3a7iTybn3DAMmSTcA6gzm+lmynfwvZ k2xIheJBIpR4k1FTRQSLsPJl/3g0t+vQYLjVj3W+r+NCW5NaGMZ7NY/Wi6XR9wBeNi3uKkBmT9B D/gU1g+Vx30Xic/3Lu9VxDlLslvb8dHJWJTXO8ciLLAPfHlcNgXP8VI5zWcpTYGa/qx3WJtQWWh RtjM09rOeivPieNfCVdnbwJsdumhhhza/6V5l2zIHwayiWZygYJusH/KUhLuF8q+YU/Y9jA3GPr 5WGZyTzUaKqynp9kjn2J2g4F+ws28lPkm9y8fHXlYHcY+EvZp29CHwqp3tke6uqLX3rtWuXfvgZ tINIwYTZ5h0eFWy/QubjQrItI6Irl5BFHbwh4lkBUHL6KIjCoYEQrViMx+wPkuTt2sld5b8rB4d vvYWNR7L6+GDtzex3zWADFwApT3ReEjQ5nmpPFwmN10S7rIURUYE+aowQRG2Ces8A/O1eufErOb 6idEmvEb+MXb+9mHuBQNy6YQu3VJZDocsJbH9p4Rmy9Vr8DRibwDIgTYMxtTjJJST1OzccpQ/e0 olo8t X-Received: by 2002:a05:600c:348d:b0:4a0:1b14:e283 with SMTP id 5b1f17b1804b1-4ba0230531emr57519765e9.1.1794332159328; Tue, 10 Nov 2026 09:35:59 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.35.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:35:58 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:34 +0000 Subject: [PATCH meta-oe 05/10] android-tools: adbd: signal readiness once functionfs is serviced MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-5-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132102 adbd sent sd_notify(READY=1) from adbd_main(), but usb_init() has only started the USB thread by then, so READY=1 raced open_functionfs(). 10-adbd-configfs.conf binds the UDC from ExecStartPost with no delay on the strength of READY=1, so a bind that won the race was dropped and the host never reached CONFIGURED. Signal readiness from the USB thread once functionfs is serviced, which is what that drop-in assumes. Built without systemd, the same point writes a byte to the FIFO named in $ADBD_READY_FIFO instead, if set, for other init systems. It opens the FIFO non-blocking, so adbd never waits on a reader that has given up. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...nal-readiness-once-functionfs-is-serviced.patch | 117 +++++++++++++++++++++ .../android-tools/android-tools_35.0.2.bb | 1 + 2 files changed, 118 insertions(+) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0020-adbd-signal-readiness-once-functionfs-is-serviced.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0020-adbd-signal-readiness-once-functionfs-is-serviced.patch new file mode 100644 index 000000000000..77527437a4e6 --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0020-adbd-signal-readiness-once-functionfs-is-serviced.patch @@ -0,0 +1,117 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Fri, 6 Nov 2026 10:03:09 +0000 +Subject: [PATCH] adbd: signal readiness once functionfs is serviced + +The gadget's UDC must not be bound until adbd is servicing functionfs: +bind earlier and the bind is silently dropped, and the host never +reaches CONFIGURED. adbd_main() sends sd_notify(READY=1) after +usb_init(), but usb_init() only starts usb_ffs_open_thread, detached, so +READY=1 races open_functionfs() - and a unit that binds the UDC on +READY=1 (ExecStartPost with no delay) loses the race. + +Signal readiness from the USB thread instead, once the descriptors are +written and the transport is registered. Built without systemd, the +same point writes a byte to the FIFO named in $ADBD_READY_FIFO instead, +if set, for other init systems. The FIFO is opened non-blocking, so +adbd never waits on a reader that has given up. Readiness is signalled +once; an adbd that is not on USB still signals it from adbd_main(). + +Upstream-Status: Pending + +AI-Generated: Claude Opus 5.5 (Claude Code) +Signed-off-by: Alex Kiernan +--- + packages/modules/adb/adb.h | 6 ++++++ + packages/modules/adb/daemon/main.cpp | 31 +++++++++++++++++++++++++--- + packages/modules/adb/daemon/usb.cpp | 7 +++++++ + 3 files changed, 41 insertions(+), 3 deletions(-) + +diff --git a/packages/modules/adb/adb.h b/packages/modules/adb/adb.h +index b43bb42ec736..20c002051937 100644 +--- a/packages/modules/adb/adb.h ++++ b/packages/modules/adb/adb.h +@@ -263,3 +263,9 @@ void adb_set_reject_kill_server(bool reject); + #endif + + void usb_init(); ++#if !ADB_HOST ++// Tell whoever started adbd that it is ready: sd_notify(READY=1) with systemd, ++// otherwise a byte to the FIFO named in $ADBD_READY_FIFO if set. Only the first ++// call does anything. ++void adbd_notify_ready(); ++#endif +diff --git a/packages/modules/adb/daemon/main.cpp b/packages/modules/adb/daemon/main.cpp +index ac37461f21dc..a5b1d6b3e0eb 100644 +--- a/packages/modules/adb/daemon/main.cpp ++++ b/packages/modules/adb/daemon/main.cpp +@@ -53,6 +53,8 @@ + #include + #endif + ++#include ++ + #include "adb.h" + #include "adb_auth.h" + #include "adb_listeners.h" +@@ -244,6 +246,27 @@ static void drop_privileges(int) { + } + #endif + ++void adbd_notify_ready() { ++ static std::once_flag once; ++ std::call_once(once, [] { ++#if defined(HAVE_SYSTEMD) ++ sd_notify(1, "READY=1"); ++#else ++ const char* ready_fifo = getenv("ADBD_READY_FIFO"); ++ if (ready_fifo != nullptr && *ready_fifo != '\0') { ++ // O_NONBLOCK: with no reader, open() fails with ENXIO rather than ++ // blocking this thread for ever; the reader has given up and ++ // gone ahead without the signal. ++ int fd = adb_open(ready_fifo, O_WRONLY | O_NONBLOCK | O_CLOEXEC); ++ if (fd >= 0) { ++ TEMP_FAILURE_RETRY(adb_write(fd, "1\n", 2)); ++ adb_close(fd); ++ } ++ } ++#endif ++ }); ++} ++ + static void setup_adb(const std::vector& addrs) { + #if defined(__ANDROID__) + // Get the first valid port from addrs and setup mDNS. +@@ -368,9 +391,11 @@ int adbd_main(int server_port) { + init_jdwp(); + D("adbd_main(): post init_jdwp()"); + +-#if defined(HAVE_SYSTEMD) +- sd_notify(1, "READY=1"); +-#endif ++ // On USB, readiness is signalled from the USB thread once functionfs is ++ // serviced; usb_init() has only started that thread. ++ if (!is_usb) { ++ adbd_notify_ready(); ++ } + + D("Event loop starting"); + fdevent_loop(); +diff --git a/packages/modules/adb/daemon/usb.cpp b/packages/modules/adb/daemon/usb.cpp +index e44c7b788587..a970c4e1fd28 100644 +--- a/packages/modules/adb/daemon/usb.cpp ++++ b/packages/modules/adb/daemon/usb.cpp +@@ -805,6 +805,13 @@ static void usb_ffs_open_thread() { + std::move(control), std::move(bulk_out), std::move(bulk_in), + std::move(destruction_notifier))); + register_transport(transport); ++ ++ // functionfs descriptors are written and ep0 is being serviced, so the ++ // gadget will now handle FUNCTIONFS_BIND: this is the moment the UDC ++ // may be bound. Binding earlier races this setup, and the bind is ++ // silently dropped. ++ adbd_notify_ready(); ++ + future.wait(); + } + } diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index e247cbbafa60..f5ab21262ce5 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -64,6 +64,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0017-adbd-shell-start-in-HOME-and-drop-the-Android-only-T.patch \ file://0018-adbd-do-not-use-pthread_kill-as-a-thread-liveness-pr.patch \ file://0019-adb-daemon-exit-after-adb-root-unroot-so-an-init-sup.patch \ + file://0020-adbd-signal-readiness-once-functionfs-is-serviced.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" From patchwork Tue Nov 10 17:35:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103599 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1079.1794332162479716475 for ; Tue, 10 Nov 2026 09:36:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=AuE+KqkX; spf=pass (domain: gmail.com, ip: 209.85.128.54, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4b467581b98so21659635e9.0 for ; Tue, 10 Nov 2026 09:36:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332161; x=1794936961; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Vuhg8gcWyHZ/J3+GUIlfM0bdYOXTiVMVbpbblTsMXtw=; b=AuE+KqkXn2joEnT1BbNsx7otJnJNiL8v6e4KivHqLcRmlE9b8GMbzlBcoNPJhuWWus tUXLtEA+njabWAapTE46bqkSwUS6t9zANZ6XkvYTjFj0VEB+NttGNtrhwKIW4+Lnhmb7 dRMHrqdCJjzJtswEB7oKQ+yXQTen4WVae7fxdnjx1W4eFZ6xrnkv3sRkdwZ+oZ1cCtn6 sO0j5bQ2FOuaIJgSAkXN+Ba0uEYVURm1OEPIVbEB4MPxbQxXBQtLdUA0NPQN+EI7tCgV dp0608FgSu2QZVwVH1/ZSnlvfsn6WqeeGKtZGloSHsIpjpYE4mHuqfnQ0MrGoIx5CkQS 7AcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332161; x=1794936961; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Vuhg8gcWyHZ/J3+GUIlfM0bdYOXTiVMVbpbblTsMXtw=; b=blrMzUHj+a1Km2WvqbcFGTPyeK1F7o8uG5KkEORh7s7u1kU4joMPue1qStvgkqL52y GZWrsIQ1+F9SypAsU7fuEOvWG3z5BJKuyE/F5g8ZlDdROQvBKvZ5gHikQqlwXf+jBxCF Oa6YKwa7VNYr7XR1exvD/ZpLYcZ5bUi40H1EIfTRnxuLCytUJOoJzMaWRzV1eHc1tEcM BAAD/ImbEimmicSpYwlsxJLkybIkbifT3lryEd7PERfnowxiVAYRFR0b03/SL7h8X+4c /xtzjE8X0HsxWnIrcQQxHhEnnLYl2hmKZnxqMCBlrL5yM6vFs0r3OTHMR1lVF1YhrAkH S9iw== X-Gm-Message-State: APuU4Z8+2bz6wOlz/RXXAxsMqKVI0rGV6N8WGI8kqhUyzSWYuRKNQvIp sz0hHxz2h+MsRLUPdsZi6cWGG5IPeo8vohrbZOXrmZDc+lUgh4ZcPbb8LQFEAA== X-Gm-Gg: AYBFou3MGqfJ74z8sTUPvpHuoml1iZ/fahCLJ1e+L8kxSlr/f40R2MrwbmGUCfLCF7g 2Ch5un3W7s6fSNme0xMtZ7Wy2/kAYei6X8LYhBVkmiiGBtY/Xl44etBs9KWKJb9KxlWMz2q4wNN VZOGqhz724Hu/QE2PsCkfVK0e6Qybta1qYAzj6COeKCOfevccS8BtbHY9Js+Cqlp/D+sudwsLrY 2K7CIwaxk3iJ3VDsypZob82zHGNaSjOyRyK+/Lz9EJu7Pn2Z4MgcwpqUFPJxpnW1UnZlLIuNjwr UIywuMPt3AZVnfSdZXq/2pMCTddYGWVJqIFccS+2VrpxJAZ0WRyJVLuWrJMQ0axIZepBBhqKMZl WgQL06S6b029TULPO4TO/byBM+N5wPkqDCSzK5rssp0HWcTLapD8YtdxtnLrOnG3zsm7AqOIwpQ gXSEVYMT7TvZo+u0OHkzB2b6YQMp4a+63LsDPEbB3qS20MMMCvw15HzUJgVD5/PNlwFtlSq6vng MXLo/2HDQh3QPUO+x3Ee29hPPKAvJVAkabhXKrkkboWubQyZGjggGmjLLxxWAmlqbOKdMdcfC3z vvgLZANJvgMGgySHpNoLjscPvhsNWBqbEQ6fxN7DSRLfK29KNLgZO0WZ/wA9yfN2S8cank8bcT2 EUuf4 X-Received: by 2002:a05:600c:3486:b0:4a1:e250:b191 with SMTP id 5b1f17b1804b1-4ba023418ddmr60401035e9.17.1794332160611; Tue, 10 Nov 2026 09:36:00 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:35:59 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:35 +0000 Subject: [PATCH meta-oe 06/10] android-tools: add PACKAGECONFIG debuggable-prop MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-6-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132103 The non-Android liblog says every build is debuggable, so adbd allows `adb root` and the root: service everywhere. With debuggable-prop, liblog reads ro.debuggable from the build.prop-style files in ADB_DEBUGGABLE_PROP_FILES (default ${sysconfdir}/build.prop), and the build is debuggable only if one of them sets it to 1. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...onally-read-ro.debuggable-from-build.prop.patch | 117 +++++++++++++++++++++ .../android-tools/android-tools_35.0.2.bb | 9 +- 2 files changed, 125 insertions(+), 1 deletion(-) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0021-liblog-optionally-read-ro.debuggable-from-build.prop.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0021-liblog-optionally-read-ro.debuggable-from-build.prop.patch new file mode 100644 index 000000000000..6cf4f9c8583e --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0021-liblog-optionally-read-ro.debuggable-from-build.prop.patch @@ -0,0 +1,117 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Fri, 6 Nov 2026 09:38:18 +0000 +Subject: [PATCH] liblog: optionally read ro.debuggable from build.prop-style + files + +The non-Android stub of __android_log_is_debuggable() returns 1, so on a +Linux adbd every build is debuggable: `adb root` and the root: service are +always allowed, and nothing can tell a development image from a production +one. + +When LIBLOG_DEBUGGABLE_PROP_FILES is passed to make - a colon-separated +list of build.prop-style files - read ro.debuggable from them instead. The build is +debuggable if any of them has "ro.debuggable=1", and not otherwise, +including when none of them exists. The files are read on each call rather +than latched, so one written after the process started (a runtime unlock on +tmpfs, say) takes effect without a restart. + +Without the define nothing changes. + +Upstream-Status: Pending + +AI-Generated: Claude Opus 5.5 (Claude Code) +Signed-off-by: Alex Kiernan +--- + debian/system/liblog.mk | 4 +++ + system/logging/liblog/properties.cpp | 52 ++++++++++++++++++++++++++++ + 2 files changed, 56 insertions(+) + +diff --git a/debian/system/liblog.mk b/debian/system/liblog.mk +index 091ccad19c3a..89027bcebacf 100644 +--- a/debian/system/liblog.mk ++++ b/debian/system/liblog.mk +@@ -26,6 +26,10 @@ CPPFLAGS += \ + -Isystem/libbase/include \ + -Isystem/logging/liblog/include \ + ++ifneq ($(LIBLOG_DEBUGGABLE_PROP_FILES),) ++CPPFLAGS += -DLIBLOG_DEBUGGABLE_PROP_FILES='"$(LIBLOG_DEBUGGABLE_PROP_FILES)"' ++endif ++ + LDFLAGS += \ + -Wl,-rpath='$$ORIGIN' \ + -Wl,-soname,$(NAME).so.0 \ +diff --git a/system/logging/liblog/properties.cpp b/system/logging/liblog/properties.cpp +index 657901a34e44..f069ebc4eb22 100644 +--- a/system/logging/liblog/properties.cpp ++++ b/system/logging/liblog/properties.cpp +@@ -17,7 +17,9 @@ + #include + + #include ++#include + #include ++#include + #include + #include + #include +@@ -311,8 +313,58 @@ int __android_log_is_loggable_len(int prio, const char*, size_t, int def) { + return __android_log_is_loggable(prio, nullptr, def); + } + ++#if defined(LIBLOG_DEBUGGABLE_PROP_FILES) ++// True only if the build.prop-style file at path has the line "=1". ++// Anything else, including the file being absent or unreadable, is false. ++static bool prop_file_is_true(const char* path, size_t pathlen, const char* key) { ++ char buf[PATH_MAX]; ++ if (pathlen == 0 || pathlen >= sizeof(buf)) { ++ return false; ++ } ++ memcpy(buf, path, pathlen); ++ buf[pathlen] = '\0'; ++ FILE* f = fopen(buf, "re"); ++ if (f == nullptr) { ++ return false; ++ } ++ const size_t keylen = strlen(key); ++ char line[256]; ++ bool value = false; ++ while (fgets(line, sizeof(line), f) != nullptr) { ++ if (strncmp(line, key, keylen) == 0 && line[keylen] == '=') { ++ const char* v = line + keylen + 1; ++ value = v[0] == '1' && (v[1] == '\0' || v[1] == '\n' || v[1] == '\r'); ++ break; ++ } ++ } ++ fclose(f); ++ return value; ++} ++#endif ++ + int __android_log_is_debuggable() { ++#if defined(LIBLOG_DEBUGGABLE_PROP_FILES) ++ // There is no property service off Android. Read ro.debuggable from a ++ // colon-separated list of build.prop-style files instead, and treat the ++ // build as debuggable if any of them sets it to 1; absent all of them, it is ++ // not. Read on every call, not latched: a file may be written after the ++ // process starts, and the callers are occasional. ++ const char* paths = LIBLOG_DEBUGGABLE_PROP_FILES; ++ while (*paths != '\0') { ++ const char* end = strchr(paths, ':'); ++ const size_t len = end != nullptr ? static_cast(end - paths) : strlen(paths); ++ if (prop_file_is_true(paths, len, "ro.debuggable")) { ++ return 1; ++ } ++ if (end == nullptr) { ++ break; ++ } ++ paths = end + 1; ++ } ++ return 0; ++#else + return 1; ++#endif + } + + int __android_log_security() { diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index f5ab21262ce5..d3d60b514721 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -65,6 +65,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0018-adbd-do-not-use-pthread_kill-as-a-thread-liveness-pr.patch \ file://0019-adb-daemon-exit-after-adb-root-unroot-so-an-init-sup.patch \ file://0020-adbd-signal-readiness-once-functionfs-is-serviced.patch \ + file://0021-liblog-optionally-read-ro.debuggable-from-build.prop.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" @@ -208,7 +209,8 @@ do_compile() { # Debian replaces Android's Soong build system with hand-written GNU make # fragments under debian/system/ and debian/external/. for tool in ${PREREQUISITE_core}; do - oe_runmake -f ${S}/debian/system/${tool}.mk -C ${S} + oe_runmake -f ${S}/debian/system/${tool}.mk -C ${S} \ + ${@'LIBLOG_DEBUGGABLE_PROP_FILES=' + d.getVar('ADB_DEBUGGABLE_PROP_FILES') if bb.utils.contains('PACKAGECONFIG', 'debuggable-prop', True, False, d) else ''} done if echo " ${TOOLS_TO_BUILD} " | grep -q " fastboot "; then @@ -266,8 +268,13 @@ FILES:${PN}-adbd = " \ BBCLASSEXTEND = "native" PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +ADB_DEBUGGABLE_PROP_FILES ?= "${sysconfdir}/build.prop" # Apply Android's fs_config ownership/mode tables to files pushed by adbd to # /system, /vendor and /oem. Off by default: the tables describe Android # partition images and are meaningless on a generic Linux rootfs. PACKAGECONFIG[fs-config] = "" +# Read ro.debuggable from ADB_DEBUGGABLE_PROP_FILES (colon-separated, +# build.prop format), so `adb root` is refused unless one of them sets +# ro.debuggable=1. Off by default: every build is debuggable. +PACKAGECONFIG[debuggable-prop] = "" PACKAGECONFIG[systemd] = ",,systemd" From patchwork Tue Nov 10 17:35:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103600 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1096.1794332163540036057 for ; Tue, 10 Nov 2026 09:36:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=TrvVO15Y; spf=pass (domain: gmail.com, ip: 209.85.128.54, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4a140e7405dso19507345e9.3 for ; Tue, 10 Nov 2026 09:36:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332162; x=1794936962; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=CruFE0B+ab44eamVfh7YVrhzAIixmDzulNVGq/yfSXI=; b=TrvVO15YhxjaS5oA/sqWVAiPiMxyuGbZsGiMXOLOFlLRNHbeDGzM1HnZAZxigmcDq0 qhO8V7dvjRY5BR9C3jAC3oaSuXwMvvRaVb7uY5ijusDA9gnbgwz3amS63dfIOPBtIeIY 8q15lXV+lyYwLz5cypvkDzx2jDZ5baixc5P9zLXY5erA+PAJ9zdJ7TNIN1GW0dLn1j9h HMktkN/5TsFR71GXrmmpvIcPM+CgaIHoEdzHn+xfADeFaqtP+Vja7r1F24SqgIneWuWE Kep27OBrUZzpPfQSN5fBx3oNYN2eJdKJFfI9ZxdIHkVLrUvnncXVH6gOvqskanogDmSo YbjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332162; x=1794936962; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=CruFE0B+ab44eamVfh7YVrhzAIixmDzulNVGq/yfSXI=; b=sdtffH3Ux7U9WOSxLilXYfDR+0Oi5m64OsKliIakrLyEo7AwN6J+SqeKiDmkGA0c2x OhcnCrj02uRT2+aijRXp0Jk3wrp4XK2bPR+qBvHqUsLy+BZbPOqwmq9uWJky91NcISb5 15vKgwSj12FYUbl6sNGx7ysAQ7MUIEkSaXR0qb3SyjlzxWTTRXU+8NIQbLTKvwEprK5E Ug3nbwnbYr3YflsSA0VcV0v4eYJgXXEJD5Z3V8Mj3MsbDwBjxqYIgM4+JUwpbw4IX3dO HHRCBXo91iyt0WX6tRzvfWQAg8esEwJGzi46M8PXwS5fIkNwRLb90/bg6KoXoLCPQHns cd0g== X-Gm-Message-State: APuU4Z/7Jv2zx8NAPegSSy/P28Kko6oVneZX4Vw8GKqd3NgGYWSJnciu EsCpRlKadflrXpupiBxTr2G8OYbnlg+st8r57Ptc8oVWARes58/tb3o7mXII/A== X-Gm-Gg: AYBFou1+8229o4wJuVBwJQrMtOc9GEuLhUbuBgSAzMK9oHZ2EnpK37fY3VfFZzCqJo4 LFSnvzFl3uDcVFJVzNYW9FoU0VRK5pt9DzdTQY84ht/ZsCJ7nZvUEsvORMYtkky6aCNIitimT/b mSDSPblBRHDhDChMNMswxg7vBHrpvGhwI2PxKSqV4ID/hBQ6Z7jCPnPYcpIdpNj98NUCzQ4vrs1 H3aocXMLPwH9OPgMXW5zgLIj1VNLoqwvZCXHPpufY/Xh7qg2FK+Q06LDzPnPMQeNpqYVCCF6aT4 yEH3QwOyKA6E9eW+NIhbczASv66ljvxdzovKopMvjVqTeRBi9EIaSmjB02iVjAHF+F5ExBAO9N1 7TPHrpGmYaPE/dQ9KBTY7H60NJSprFDudGrfDLCrdqW5t+CdHHwW+5JAlqB2xjZ1ERcgRba1p3i VXzh4jb+M9Us3LHWUfXjgyU/2+k2UIfjruielBuLo0r4gvwMTzxa/wDDhuG/f9wbTDIKxunk2zM ek6bizxxbMqyGKxyjNbREpn3JRac6yUTHeGeZk4ZzRBOyYyx10GvmFG+jXi0OhrQYfgmezUgkNV P2MsuduMF4S9gmdmwIUQlNDvo5INChGgKIX3JoXSUU/VUeJ5ZNf4fLqg6EkXJuIWVQQC0dmxpom EljmdcdQciuWCX0HU7YQGNjxv X-Received: by 2002:a05:600c:34c7:b0:4a2:133:45e1 with SMTP id 5b1f17b1804b1-4ba0234cccemr54824815e9.24.1794332161623; Tue, 10 Nov 2026 09:36:01 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:36:00 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:36 +0000 Subject: [PATCH meta-oe 07/10] android-tools: add PACKAGECONFIG auth-unless-debuggable MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-7-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132104 Debian's adbd never asks a host for a key on Linux. With auth-unless-debuggable a host must authenticate unless the build is debuggable, checked for each connection so that a debuggable state that appears while adbd runs applies at once. It needs debuggable-prop to mean anything. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...ally-require-authorization-unless-the-bui.patch | 138 +++++++++++++++++++++ .../android-tools/android-tools_35.0.2.bb | 8 +- 2 files changed, 145 insertions(+), 1 deletion(-) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0022-adbd-optionally-require-authorization-unless-the-bui.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0022-adbd-optionally-require-authorization-unless-the-bui.patch new file mode 100644 index 000000000000..e4115348fd31 --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0022-adbd-optionally-require-authorization-unless-the-bui.patch @@ -0,0 +1,138 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Fri, 6 Nov 2026 09:38:18 +0000 +Subject: [PATCH] adbd: optionally require authorization unless the build is + debuggable + +On a Linux build adbd accepts every connection without a key check: +Debian's "don't require authorization on Linux" sets auth_required to +false unconditionally, because there is no property service to relax it +on development builds the way Android does. + +When make is given ADBD_AUTH_UNLESS_DEBUGGABLE=1, leave auth_required alone +and decide per connection instead: a host must authenticate unless +__android_log_is_debuggable() says the build is debuggable. Deciding per +connection rather than once at startup lets a debuggable state that +appears while adbd runs (LIBLOG_DEBUGGABLE_PROP_FILES re-reads its files) +take effect without a restart. The TLS client-certificate checks make +the same decision. + +Without the define nothing changes. + +Upstream-Status: Pending + +AI-Generated: Claude Opus 5.5 (Claude Code) +Signed-off-by: Alex Kiernan +--- + debian/system/adbd.mk | 4 ++++ + packages/modules/adb/adb.cpp | 2 +- + packages/modules/adb/adb_auth.h | 4 ++++ + packages/modules/adb/daemon/auth.cpp | 17 +++++++++++++++-- + packages/modules/adb/daemon/main.cpp | 2 +- + 5 files changed, 25 insertions(+), 4 deletions(-) + +diff --git a/debian/system/adbd.mk b/debian/system/adbd.mk +index a3f88f169b9b..5e2c5ccaea30 100644 +--- a/debian/system/adbd.mk ++++ b/debian/system/adbd.mk +@@ -109,6 +109,10 @@ LDFLAGS += -lsystemd + CPPFLAGS += -DHAVE_SYSTEMD + endif + ++ifeq ($(ADBD_AUTH_UNLESS_DEBUGGABLE),1) ++CPPFLAGS += -DADBD_AUTH_UNLESS_DEBUGGABLE ++endif ++ + STATIC_LIBS = \ + debian/out/system/libadb.a \ + debian/out/system/libcrypto_utils.a \ +diff --git a/packages/modules/adb/adb.cpp b/packages/modules/adb/adb.cpp +index 78bbfb6df48f..6e753484971c 100644 +--- a/packages/modules/adb/adb.cpp ++++ b/packages/modules/adb/adb.cpp +@@ -392,7 +392,7 @@ static void handle_new_connection(atransport* t, apacket* p) { + // we'll just not verify the client's certificate. This should be the + // first packet the client receives to indicate the new protocol. + send_tls_request(t); +- } else if (!auth_required) { ++ } else if (!adbd_connection_auth_required()) { + LOG(INFO) << "authentication not required"; + handle_online(t); + send_connect(t); +diff --git a/packages/modules/adb/adb_auth.h b/packages/modules/adb/adb_auth.h +index 38312211f3ad..e23ad2b089c7 100644 +--- a/packages/modules/adb/adb_auth.h ++++ b/packages/modules/adb/adb_auth.h +@@ -51,6 +51,10 @@ void adb_auth_tls_handshake(atransport* t); + extern bool auth_required; + extern bool socket_access_allowed; + ++// Whether a connection made now must authenticate. auth_required is decided ++// once at startup; this can also depend on state that changes while adbd runs. ++bool adbd_connection_auth_required(); ++ + void adbd_auth_init(); + void adbd_auth_verified(atransport *t); + +diff --git a/packages/modules/adb/daemon/auth.cpp b/packages/modules/adb/daemon/auth.cpp +index 7df15aedd58a..2bb0fa65aad5 100644 +--- a/packages/modules/adb/daemon/auth.cpp ++++ b/packages/modules/adb/daemon/auth.cpp +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -157,6 +158,18 @@ static uint32_t transport_auth_id = 0; + bool auth_required = true; + bool socket_access_allowed = true; + ++bool adbd_connection_auth_required() { ++#if !defined(__ANDROID__) && defined(ADBD_AUTH_UNLESS_DEBUGGABLE) ++ // Off Android there is no property service to relax auth_required at ++ // startup, and whether the build is debuggable can change while adbd runs ++ // (see LIBLOG_DEBUGGABLE_PROP_FILES), so decide per connection: a ++ // debuggable build accepts any host, and anything else authenticates. ++ return auth_required && !__android_log_is_debuggable(); ++#else ++ return auth_required; ++#endif ++} ++ + static void* transport_to_callback_arg(atransport* transport) { + uint32_t id = transport_auth_id++; + (*transports)[id] = transport->weak(); +@@ -196,7 +209,7 @@ static void IteratePublicKeys(std::function f + } + + bssl::UniquePtr adbd_tls_client_ca_list() { +- if (!auth_required) { ++ if (!adbd_connection_auth_required()) { + return nullptr; + } + +@@ -390,7 +403,7 @@ void adbd_notify_framework_connected_key(atransport* t) { + } + + int adbd_tls_verify_cert(X509_STORE_CTX* ctx, std::string* auth_key) { +- if (!auth_required) { ++ if (!adbd_connection_auth_required()) { + // Any key will do. + LOG(INFO) << __func__ << ": auth not required"; + return 1; +diff --git a/packages/modules/adb/daemon/main.cpp b/packages/modules/adb/daemon/main.cpp +index a5b1d6b3e0eb..d309e235b947 100644 +--- a/packages/modules/adb/daemon/main.cpp ++++ b/packages/modules/adb/daemon/main.cpp +@@ -313,7 +313,7 @@ int adbd_main(int server_port) { + auth_required = android::base::GetBoolProperty("ro.adb.secure", false); + #endif + } +-#else ++#elif !defined(ADBD_AUTH_UNLESS_DEBUGGABLE) + auth_required = false; + #endif + diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index d3d60b514721..1a939b503601 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -66,6 +66,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0019-adb-daemon-exit-after-adb-root-unroot-so-an-init-sup.patch \ file://0020-adbd-signal-readiness-once-functionfs-is-serviced.patch \ file://0021-liblog-optionally-read-ro.debuggable-from-build.prop.patch \ + file://0022-adbd-optionally-require-authorization-unless-the-bui.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" @@ -221,7 +222,8 @@ do_compile() { for tool in ${TOOLS_TO_BUILD}; do oe_runmake -f ${S}/debian/system/${tool}.mk -C ${S} \ - ${@'HAVE_SYSTEMD=1' if bb.utils.contains('PACKAGECONFIG', 'systemd', True, False, d) else ''} + ${@'HAVE_SYSTEMD=1' if bb.utils.contains('PACKAGECONFIG', 'systemd', True, False, d) else ''} \ + ${@'ADBD_AUTH_UNLESS_DEBUGGABLE=1' if bb.utils.contains('PACKAGECONFIG', 'auth-unless-debuggable', True, False, d) else ''} done } @@ -277,4 +279,8 @@ PACKAGECONFIG[fs-config] = "" # build.prop format), so `adb root` is refused unless one of them sets # ro.debuggable=1. Off by default: every build is debuggable. PACKAGECONFIG[debuggable-prop] = "" +# Require hosts to authenticate unless the build is debuggable, decided per +# connection. Off by default, as in Debian: no host is asked for a key. Only +# meaningful with debuggable-prop, without which every build is debuggable. +PACKAGECONFIG[auth-unless-debuggable] = "" PACKAGECONFIG[systemd] = ",,systemd" From patchwork Tue Nov 10 17:35:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103594 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1097.1794332164794662928 for ; Tue, 10 Nov 2026 09:36:05 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=hJwbqJv5; spf=pass (domain: gmail.com, ip: 209.85.128.52, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4a5720b0a57so14064635e9.0 for ; Tue, 10 Nov 2026 09:36:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332163; x=1794936963; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Wgz6v/dxTlEafNcMVdgKqeL4J15jP3zzdfpYWR3p7ic=; b=hJwbqJv5k8C6tBIWkfhrfqn1FeHTs/aFOgSDCLnrsLbiQFXRQ7T1R+YJWtrCCPLlkv Kn6vVZUfpsxqO2zsokoXgNyzjwqDM/Wa5D4yZJ2btx5N6cCNJlUKZkEyo8bKZYq2xbMz xuYjc0368EhQMlxssj2rKsBsypPvX0OiTI0t9J6TNvrbSsxZSmmtkwdiFjwpITdpqF9O AlWbevkRQpoELtWyL27rMgehsIaDXgOhK/AENpdgc+/9iB16GMWxZKExdPF0h2ewvDxR QSKv/G1Gp46QJ+6THb2ye2cWkp48hAkOz2zKyml2OO59p8UOmHmEB99icX+cPE0eha/R rdEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332163; x=1794936963; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Wgz6v/dxTlEafNcMVdgKqeL4J15jP3zzdfpYWR3p7ic=; b=o7TZ8ZcITTWp7aERl4mV5eMxIXS1e72uqGZXAwAPWIGKNcbmhuyLpEOB2XOqHUaCXy DNCONVx9bf7Rqr9zctkzjv8bEesuRMMWB4LDxtE69l9z6xsTDFXoC2ZRIcr9yg5bOdTd 9aimQFKTlX3oJu0TiSwPB53hIU3EBVz+KKXWNy95Ye86OLiGDVgtv5rEl1mrjU9ml50Y mjBxDFhmRuUIxkTj5B5BP6HeDT7PoRVIcHvCZMYIKtfMuEBm2sRcwIk+3PqtVLZ6+yfL xwQlcswqFAqFFieqMITKzahraywTqdj2Mfv7X3M0ExDEOfUGR35iIj4fJ3IC4a+PrUKC N/lg== X-Gm-Message-State: APuU4Z9YXXNQOCpJBGkqXTI5RPcXuYKFP/iQjj+GgbNGgHHrWe5Mkv0e i4kEnyOGhbwDTjLVc35X7gN4PZiHb5z485Wg/aDN9/g1Ws4x9JzEqOzDLGVZqw== X-Gm-Gg: AYBFou2vPl+Ze0NEXszwl1BrYSA2eObhS4EUyCqFTcd1lOQ8jFla6lllKZVrevYoVvx KC0znYG0nFo8bkcgvZU44z8cuwwGXTFzdgVI0bPUD4OZPXFz65tTjBwXoF5jf1ax7wNQVyO7OvC X/MGXY9sf87P1n4X2WMQE7//9ErYCslo5neVgDdw7kqiQ+3KNZmkazGTiN9iLgjJPYxgGGk8nqK 4lPU8Tw2iPHidP9FcjlSh+ldRsGNNS3B39yjFzAgLOMlT5d5dETMkLZynplwtv8ukYu51yZDXVH 3DGUZXUrmR166WFDCV+OToB2c8p1A8FKblHKs+BHCvLpPIJlHzcSYHNKCIQaXGaKHaVzhjShlgl 94ONAtinJmJZ+yeCbvEAxwraYrbmwaas4bflnntbUbocn2TrLdHxQ3vX7e4UsbsM6kH4pCeLvSP 9M03NITUNlvELqapO4Xifq6X7YZ2UfDpNPkKjjx9TatMZXrDggkyVaCLAJKXKOtd7YkLNn8S83N Px3Pny4XYsPmKpkZCboeupAfSWlgGuo5di635YJOPitSLHaau6r7DAdezA4jv1g8ezvedRpxNmv djfVPv8i/uGxhu8FAmdqdphN5ks/2HCHa5ne0KlWqB6padoluxnhzlex9m9arjGcdkvtnilizYp hv/U= X-Received: by 2002:a05:600c:c4ab:b0:4a1:c27d:e1a8 with SMTP id 5b1f17b1804b1-4ba08dcdba8mr1067275e9.10.1794332162937; Tue, 10 Nov 2026 09:36:02 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.36.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:36:01 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:37 +0000 Subject: [PATCH meta-oe 08/10] android-tools: add ADBD_AUTH_KEY_PATHS MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-8-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132105 adbd looks for trusted host keys only in Android's /adb_keys and /data/misc/adb/adb_keys, so a Linux adbd that requires authorization has nowhere sensible to be given one. ADBD_AUTH_KEY_PATHS, colon-separated, replaces that list. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...h-optionally-take-the-trusted-key-paths-a.patch | 72 ++++++++++++++++++++++ .../android-tools/android-tools_35.0.2.bb | 7 ++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0023-libadbd_auth-optionally-take-the-trusted-key-paths-a.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0023-libadbd_auth-optionally-take-the-trusted-key-paths-a.patch new file mode 100644 index 000000000000..581ecc85ce09 --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0023-libadbd_auth-optionally-take-the-trusted-key-paths-a.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Fri, 6 Nov 2026 09:38:18 +0000 +Subject: [PATCH] libadbd_auth: optionally take the trusted-key paths at build + time + +libadbd_auth reads trusted host keys from /adb_keys and +/data/misc/adb/adb_keys, which are Android's locations and rarely exist +on a Linux system - so a Linux adbd that requires authorization has +nowhere to be given a key. + +When ADBD_AUTH_KEY_PATHS is passed to make - a colon-separated list - +read keys from those files instead. They are still read on every attempt, so a key +file that appears after adbd started is picked up. + +Without the define nothing changes. + +Upstream-Status: Pending + +AI-Generated: Claude Opus 5.5 (Claude Code) +Signed-off-by: Alex Kiernan +--- + debian/system/adbd.mk | 4 ++++ + .../native/libs/adbd_auth/adbd_auth.cpp | 19 ++++++++++++++++--- + 2 files changed, 20 insertions(+), 3 deletions(-) + +diff --git a/debian/system/adbd.mk b/debian/system/adbd.mk +index 5e2c5ccaea30..dc82b998e77a 100644 +--- a/debian/system/adbd.mk ++++ b/debian/system/adbd.mk +@@ -113,6 +113,10 @@ ifeq ($(ADBD_AUTH_UNLESS_DEBUGGABLE),1) + CPPFLAGS += -DADBD_AUTH_UNLESS_DEBUGGABLE + endif + ++ifneq ($(ADBD_AUTH_KEY_PATHS),) ++CPPFLAGS += -DADBD_AUTH_KEY_PATHS='"$(ADBD_AUTH_KEY_PATHS)"' ++endif ++ + STATIC_LIBS = \ + debian/out/system/libadb.a \ + debian/out/system/libcrypto_utils.a \ +diff --git a/frameworks/native/libs/adbd_auth/adbd_auth.cpp b/frameworks/native/libs/adbd_auth/adbd_auth.cpp +index 78896ed553c4..9b76c17b1b39 100644 +--- a/frameworks/native/libs/adbd_auth/adbd_auth.cpp ++++ b/frameworks/native/libs/adbd_auth/adbd_auth.cpp +@@ -390,10 +390,23 @@ public: + } + } + +- static constexpr const char* key_paths[] = {"/adb_keys", "/data/misc/adb/adb_keys"}; ++#if defined(ADBD_AUTH_KEY_PATHS) ++ // A colon-separated list, for systems where AOSP's locations mean nothing. ++ // Read on every attempt, so a file that appears after adbd started counts. ++ static std::vector KeyPaths() { ++ return android::base::Split(ADBD_AUTH_KEY_PATHS, ":"); ++ } ++#else ++ static std::vector KeyPaths() { ++ return {"/adb_keys", "/data/misc/adb/adb_keys"}; ++ } ++#endif + void IteratePublicKeys(bool (*callback)(void*, const char*, size_t), void* opaque) { +- for (const auto& path : key_paths) { +- if (access(path, R_OK) == 0) { ++ for (const auto& path : KeyPaths()) { ++ if (path.empty()) { ++ continue; ++ } ++ if (access(path.c_str(), R_OK) == 0) { + LOG(INFO) << "adbd_auth: loading keys from " << path; + std::string content; + if (!android::base::ReadFileToString(path, &content)) { diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index 1a939b503601..b17d92d6e9bb 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -67,6 +67,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0020-adbd-signal-readiness-once-functionfs-is-serviced.patch \ file://0021-liblog-optionally-read-ro.debuggable-from-build.prop.patch \ file://0022-adbd-optionally-require-authorization-unless-the-bui.patch \ + file://0023-libadbd_auth-optionally-take-the-trusted-key-paths-a.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" @@ -223,7 +224,8 @@ do_compile() { for tool in ${TOOLS_TO_BUILD}; do oe_runmake -f ${S}/debian/system/${tool}.mk -C ${S} \ ${@'HAVE_SYSTEMD=1' if bb.utils.contains('PACKAGECONFIG', 'systemd', True, False, d) else ''} \ - ${@'ADBD_AUTH_UNLESS_DEBUGGABLE=1' if bb.utils.contains('PACKAGECONFIG', 'auth-unless-debuggable', True, False, d) else ''} + ${@'ADBD_AUTH_UNLESS_DEBUGGABLE=1' if bb.utils.contains('PACKAGECONFIG', 'auth-unless-debuggable', True, False, d) else ''} \ + ${@'ADBD_AUTH_KEY_PATHS=' + d.getVar('ADBD_AUTH_KEY_PATHS') if d.getVar('ADBD_AUTH_KEY_PATHS') else ''} done } @@ -271,6 +273,9 @@ BBCLASSEXTEND = "native" PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ADB_DEBUGGABLE_PROP_FILES ?= "${sysconfdir}/build.prop" +# Where adbd reads trusted host keys, colon-separated. Empty keeps Android's +# /adb_keys and /data/misc/adb/adb_keys. +ADBD_AUTH_KEY_PATHS ?= "" # Apply Android's fs_config ownership/mode tables to files pushed by adbd to # /system, /vendor and /oem. Off by default: the tables describe Android # partition images and are meaningless on a generic Linux rootfs. From patchwork Tue Nov 10 17:35:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103601 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1099.1794332165815815509 for ; Tue, 10 Nov 2026 09:36:06 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=wTmqE4r3; spf=pass (domain: gmail.com, ip: 209.85.128.54, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4a2153c8525so17648155e9.3 for ; Tue, 10 Nov 2026 09:36:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332164; x=1794936964; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=C/NrZgiHSP6/R5JxePo9fAMZ27Ga9vvB65xPyHltzlE=; b=wTmqE4r3vY5KvBjMRhjMIAOWxnnm1K1JwoKpZT0upGgqpgkGPDYniAymtwu427eJjg l2Q2D0BJSLIpVmqFKrvqeB37a/kIGHE/YCnqk9rVBrbvEss4MjfUtcDnUjjk3G6gdHuB xlLHfCRS0GXl31JD9QO8njnnqDiC5XcNOTJas5nPVS4738AXJfys3Y9szWhVMdyOyy+N PIhMCccJ2m52FrryrMivx342HjU0NTJg+yOj+FRqDERxbzCXCkik1VmJvZeGA4wO/q97 6a5odRZDJdoTp45kftyyl4GFfq8PXz/M8cVJn5ljmw54TKuEIlUsEwfFXzGDTnhBlsDm AktA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332164; x=1794936964; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=C/NrZgiHSP6/R5JxePo9fAMZ27Ga9vvB65xPyHltzlE=; b=LrPD1gla1w39f8Vd2/PoVZwUT0t+tTiYbRIUlr0yixs3lNeePCYEX8pYXlB9FEJ1Jp fR5WGTNSDLnQGFiBBwXvyI0ra20PmrzBS4LSqJJRarPcKHqpc3y0RmfMLFq+5/wBjvxo BD5DYIUErkf6Pfb9Bji+gAtzdTpU4KynZ6gbabY2Ft0tz/KJ2YbxI+K0qNZ1J8kkDHyh r9oiOLXjZLyISFlqyqwQfn1eDZPdFnHn2aPp4IKW+7JoWR1elCCB6vtFWw1WLo+OxA20 8VqVq7kPUE0YbIa0iSqh8k1M7c6gSdsoK/NKJJn9r6yEWPIgatyGw1hVW7PZIacfv7yd FXWA== X-Gm-Message-State: APuU4Z9KejVa8Dmfm4Ad9OYQKapczYBz3G47Wk4rsI/kX4n+VohU/Kmz aZpS/KYRPx2CkuSY4PMfAWFvw8GcH8FDaM6GgxcEBld6EctUHnc37ofQDekYzg== X-Gm-Gg: AYBFou2C2jVAy4RuvSc8BmFy8f07iqn1kf66s8Xi7eWrk9fHnvXDGNDEjEim0ZJjsrk +JrnoiQU3HQd8LjS8BqLZiPR75HnsYnGEuvQEXLjbQ6q6YgwZY6FzwRrz7k3tUfbo6kyw7X9ry2 SulPdwBD94acv8nG2WcU08gLIy3J378v6s5XkQofHFXajb1rObupIkLdSVYobICD0OcgJObWLJh x6rPp8Db8mFoVc8KnrwdGYFjBaT1TZ2rsJlrMuWzV/P9YoE2Xd5mIfvZtEq7QdLNQEcuzCe7r/y 8AZkd4QEEFE8G0kKlKa8hg+AXVjPjZ8pOWm78h8dpKhCp11TZWrqDg5fLqgxYmzrm6hEQUI/kyu XIbBArdnl+8LbMEZEnEHkN0PDMbAmCxVG3OLZaG55SBgDfhLNTkWhJUInl0yHh3dGmAW0L6Ccb4 6v7oMWPFF//XtgfD5KqvOL8YkQIroE1Pw6B1HfCTwy5omy2xq8VhnUEWPczJPmQkkZZTlPIR81Y prrv5+n3/xSog7a+lnba6wKp7rUZEbbDG2b0utd+2Zb51piwdPYDArleFkOZeZhIBULuW/BSCUN Zq4eDgW+dj8cA3GStGLUVUYCC9oN9kJnnlKkxQe7G0wMRYlCu5/ZOiwTXfxxkhilOy622pWt01A oQAo= X-Received: by 2002:a05:600c:3e0f:b0:4a1:7e77:c382 with SMTP id 5b1f17b1804b1-4ba0233d852mr56702045e9.5.1794332163958; Tue, 10 Nov 2026 09:36:03 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:36:03 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:38 +0000 Subject: [PATCH meta-oe 09/10] android-tools: adbd: keep root only while the build is debuggable MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-9-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132106 adbd on Linux restarts as root whenever /run/adbd.root says so, without asking whether the build is still debuggable. With debuggable-prop that can change while the file survives, so honour it only while __android_log_is_debuggable() is true. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- ...oot-on-Linux-only-while-the-build-is-debu.patch | 51 ++++++++++++++++++++++ .../android-tools/android-tools_35.0.2.bb | 1 + 2 files changed, 52 insertions(+) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0024-adbd-keep-root-on-Linux-only-while-the-build-is-debu.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0024-adbd-keep-root-on-Linux-only-while-the-build-is-debu.patch new file mode 100644 index 000000000000..f94bde14f3b1 --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0024-adbd-keep-root-on-Linux-only-while-the-build-is-debu.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Sat, 7 Nov 2026 16:00:25 +0000 +Subject: [PATCH] adbd: keep root on Linux only while the build is debuggable + +`adb root` is refused unless __android_log_is_debuggable(), but the root +state it writes to /run/adbd.root is honoured on every restart without +asking again. A unit that stops being debuggable while that file +survives keeps a root adbd. Drop privileges whenever the build is not +debuggable, whatever the file says; drop_privileges() then rewrites it +as #NOROOT#. + +Without LIBLOG_DEBUGGABLE_PROP_FILES the build is always debuggable on +Linux, so nothing changes. + +Upstream-Status: Pending + +AI-Generated: Claude Opus 5.5 (Claude Code) +Signed-off-by: Alex Kiernan +--- + packages/modules/adb/daemon/main.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/packages/modules/adb/daemon/main.cpp b/packages/modules/adb/daemon/main.cpp +index d309e235b947..9da530d18d27 100644 +--- a/packages/modules/adb/daemon/main.cpp ++++ b/packages/modules/adb/daemon/main.cpp +@@ -40,9 +40,10 @@ + #include + #include + ++#include ++ + #if defined(__ANDROID__) + #include +-#include + #include + + #include +@@ -200,6 +201,11 @@ static void drop_privileges(int server_port) { + + #if !defined(__ANDROID__) + static bool should_drop_privileges() { ++ // The root state file outlives the debuggable state that allowed it to be ++ // written, so only honour it while the build is still debuggable. ++ if (!__android_log_is_debuggable()) { ++ return true; ++ } + int f = unix_open(kAdbRootStatePath, O_RDONLY | O_CLOEXEC | O_NOFOLLOW); + if (f < 0) { + return true; diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index b17d92d6e9bb..2ecfbe49d146 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -68,6 +68,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0021-liblog-optionally-read-ro.debuggable-from-build.prop.patch \ file://0022-adbd-optionally-require-authorization-unless-the-bui.patch \ file://0023-libadbd_auth-optionally-take-the-trusted-key-paths-a.patch \ + file://0024-adbd-keep-root-on-Linux-only-while-the-build-is-debu.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" From patchwork Tue Nov 10 17:35:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 103602 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1100.1794332166876755475 for ; Tue, 10 Nov 2026 09:36:07 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=sTcD5VZH; spf=pass (domain: gmail.com, ip: 209.85.128.50, mailfrom: alex.kiernan@gmail.com) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4a35ac4475dso16069765e9.2 for ; Tue, 10 Nov 2026 09:36:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794332165; x=1794936965; darn=lists.openembedded.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sEIqbx23pQ4jFN2aAD7c4LZ2i043tY0yFXbVnLVGwPE=; b=sTcD5VZHzh0G5beubLW+/E3mocxbwcaAy2rU+3mJdak3D9dM1HZS/y5Hwd/O26re1C BhbcAHZxq+IWuM+YRI5j+2iYNCm+oHh/Xw2fa0T5hja5r/aaFdj6fA52HMVGTYk/vY/K l26cgcvd+RqjATKKSKBg3wM7Qwey/z5m7eJrgL0W9xhUvOSj+klg/KiUy3DGCYblYqEP km1ncWqwWkDNyYMnhBuxph44uRni+VZ3vu9EIUTlPuGbFd+pteCStkfpbHgJZB8D5ehh uIS01qdbcuEiIyqcPqgMuFqE1Of6cGl7bs+3sUkMW0z08KevOfWIkZq0ZPW4toPlIOfT dPTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794332165; x=1794936965; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=sEIqbx23pQ4jFN2aAD7c4LZ2i043tY0yFXbVnLVGwPE=; b=AX6fZkdkLXT6BaRldfS6GPP0nApIadfvcIq83WxebmhyeoXGd2Ek0SO/rHnMlDGM5m j+eiM3JuVyUAJ4hrS38cHtAe9bdz9rNDFjqvvcFGeq3JmyK16PMes5CVo8EX5I1p2sq5 YhJMj0+Xebw27J5MueKsXsbwMU7Ov8JEjEZBqS9zlw36y/cn9T4ePKmAn/UZVG+jhEna US2/PZkgK6apQ5+QgLm//h3LAfCHAKwZMTYxdrC1PpPcO9KYIsVZEp1SUZvJuLu5gup3 39rzvySU0/BJg5Y9JQ7nNZILnV2IROYS4/nBl5oKVe84FckXtDHfZv4z/CrnUoxpJK+m rHQw== X-Gm-Message-State: APuU4Z9A37lQTN2qqhm1BtWUQv1F8G/3J/sw3N1G6PMTXfu4nfcbhiNM Ry8U3noMyOIXZRLSMlg8Pb9Wk/BLAE8l6bO82apx/b2+78vDoJXFj3kKoOGPKA== X-Gm-Gg: AYBFou0QlEoBipdpPzCLUlwBRB/ygtatUymmEsXCMSz0VdOkedrZm5wPk3XGM8f4VhG OPuxfX02ng7Evt8zVulZWYeMJ7+lNa2uAMCe/Xay96Kv2s9PZwn6GoN7UQqtJdHLM3g5gyUN7YO Nwg+wBiLdivBxkvNEistKO6fjQShGZl9gcNdLlUGEE6B4JaAV86cG50DRHg6WN5NQJvNDiIMLa3 4sxhJRZYN68v1ECje+dGlgAZJsUsWH0VPa7Sj8uNCt7dtqnDw43Z8GWA+iwK5zC6Rkz1rqr2k6u WsxMQmYDxYAuGOnDVPTyeCuqZIs+cEK1ZHcGVuMMk/0x6hrOdfF4qO2qAFmyaMJFpnhbixNPeeX wxjN8sgMdo7pEU7FNsZsCTtR/JTbM0R7VBtDwfuzzvDHN53nkihtHaeCwtYYyL6GME7G5IIDHBS M9nRirt/om0JciHsV39uKzbHuDNA3PJdv2AAoTHbs/3ArFaMSDOWyqnqLVkMpMyQs65y31tgkOr JcajZXD7+InEWCka5rQM3Ni2ar6mdxojOZNHNWqzYb9uvuPoLe2YefB0IPwas1Ybty/qMyO+NvG BUoxl5vMzpxuI94CQo41hDCa8SIJH82nJ83BP3x26GVdPTVYm+s2UvTqfriToagFcMhhgtAuoRT KeRo= X-Received: by 2002:a05:600c:1d03:b0:4ac:86c9:b09c with SMTP id 5b1f17b1804b1-4ba02343ca0mr68388365e9.13.1794332165080; Tue, 10 Nov 2026 09:36:05 -0800 (PST) Return-Path: Received: from [192.168.5.15] (cust18-dsl93-89-130.idnet.net. [93.89.130.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fea9eesm122994405e9.11.2026.11.10.09.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 09:36:04 -0800 (PST) From: Alex Kiernan Date: Tue, 10 Nov 2026 17:35:39 +0000 Subject: [PATCH meta-oe 10/10] android-tools-conf: android-gadget-cleanup: don't killall adbd MIME-Version: 1.0 Message-Id: <20261110-android-tools-adbd-v1-10-cc2176f381c3@gmail.com> References: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> In-Reply-To: <20261110-android-tools-adbd-v1-0-cc2176f381c3@gmail.com> To: openembedded-devel@lists.openembedded.org Cc: Alex Kiernan X-Mailer: b4 0.16.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 10 Nov 2026 17:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132107 android-gadget-cleanup runs as the service's ExecStopPost, once adbd has exited, so there is nothing left for `killall adbd` to stop. Under a supervisor that respawns adbd it is worse than redundant: the new adbd starts into a gadget that is being torn down. busybox builds without killall also fail on it silently. Drop it, and stop quietly if there is no adb gadget to clean up. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan --- .../android-tools/android-tools-conf/android-gadget-cleanup | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-cleanup b/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-cleanup index f27d77df5120..5d32dbd2bcb1 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-cleanup +++ b/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-cleanup @@ -4,12 +4,10 @@ cd /sys/kernel/config/usb_gadget -cd adb +cd adb || exit 0 echo -n "" > UDC || true -killall adbd || true - umount /dev/usb-ffs/adb rm configs/c.1/ffs.usb0