Repository navigation
Conversation
- Set settings/global adb_allowed_connection_time to 0 during bot init and configure_device_settings() so Android 11+ does not auto-revoke /data/misc/adb/adb_keys after 7 days. - Sync filesystem buffers before adb.reboot() and adb.hard_reset(), and attempt graceful adb reboot before falling back to /proc/sysrq-trigger (via su root) only on reboot failure or timeout. - Skip MASTER_CLEAR in adb.factory_reset() on physical devices via bad_state_reached() so boot timeouts do not wipe /data/misc/adb/adb_keys.
smolkaj
left a comment
There was a problem hiding this comment.
Thansk foir the PR!
One question:
Tested on a physical Pixel 6 bot
I take it this is referring to manual testing? Do we have the ability to automate such tests today?
smolkaj
left a comment
There was a problem hiding this comment.
How sure are we that we rely on ADB keys at /data/misc/adb/adb_keys rather than keys baked into the build or similar?
I am asking because AI pointed out that the regular flash seems to also wipe that file using fastboot -w, and work fine.
Anyhow, AI suggests that running the following on a phone from the incident should settle the question:
adb shell getprop ro.adb.secure # 0 = ADB auth is off, any host is trusted
adb shell ls -l /adb_keys /product/etc/security/adb_keys # keys baked into the build
Could we give that a quick go?
|
Ran those on one of the phones from the incident:
Regarding |
smolkaj
left a comment
There was a problem hiding this comment.
Thanks for double checking the key location. LGTM
I don't think we can automate on the CI at least because they aren't devices connected. It seems like there is code to be able to test locally but in this case, being a such destructive test is better not to do so |
I'm a bit worried that we have to rely on manual testing, since it doesn't prevent future regressions and thus doesn't scale. But this seems like a larger topic that is not in scope for this PR. |
Hi Steffen, just chiming in FYI we have this bug: b/485715892 (bugs under this feature are public but the main feature is not) for that same concern, is a WIP and its currently paused(because of bandwidth) but overall the design is approve and the foundations are already here in the repo. |
|
Thanks for the pointers, @IvanBM18, this is useful context. |
Context:
During a prolonged startup-crash outage on physical Pixel 6 bots, 4 of 7 phones became unusable without manual reflashing (1 with
f2fs/datacorruption and 3 inadb unauthorizedstate):adb_allowed_connection_timeto 7 days, auto-revoking/data/misc/adb/adb_keysif ADB goes idle across an outage. Set it to0during bot init andconfigure_device_settings().adb.hard_reset()ranecho b > /proc/sysrq-trigger(an immediate kernel restart without unmounting/data, and withoutsu rootwhenadbdruns asshell) before tryingadb reboot. Flush buffers (sync) and try gracefuladb rebootfirst, falling back to rootsysrq-triggeronly ifadb rebootfails or times out.adb.factory_reset()broadcastedMASTER_CLEARon physical devices after boot timeouts, wiping/data/misc/adb/adb_keys. Exit viabad_state_reached()on physical phones (matching Cuttlefish) while keepingMASTER_CLEARfor emulators.Testing:
adb_test.py,device_test.py) andbutler.py lint.adb_allowed_connection_timewent from'null'to'0'and persisted across reboot,factory_reset()exited viabad_state_reached()without wiping/data,hard_reset()did a cleaninitreboot (ro.boot.bootreason=reboot), and a simulatedadb rebootfailure fell back tosu root/proc/sysrq-triggerand reset the kernel.