Commit graph

57152 commits

Author SHA1 Message Date
Josh Gao
49ba558aa8 adb: add interfaces for Encoder/Decoder.
More groundwork to support more compression algorithms.

Bug: https://issuetracker.google.com/150827486
Test: python3 -m unittest test_device.FileOperationsTest{Uncompressed,Brotli}
Change-Id: I638493083b83e3f6c6854b631471e9d6b50bd79f
2020-04-02 17:11:07 -07:00
Bill Peckham
362a41a4f6 Merge "Ignore functionfs mounts." 2020-04-02 22:46:28 +00:00
David Anderson
f9459a45eb Merge "fs_mgr: Allow commas in boot device paths." 2020-04-02 21:11:44 +00:00
Nikita Ioffe
2884943687 Merge "Improve logging in bootstat." 2020-04-02 18:12:55 +00:00
Nikita Ioffe
49062f3b72 Improve logging in bootstat.
This should help in debugging issues related to the mismatch between
actual last reboot reason property and the expected one (see attached
bug).

Test: adb reboot
Test: adb logcat | grep bootstat
Bug: 152900920
Change-Id: I085cf1fb80a30389fd3ba821d40b6111a3294d95
2020-04-02 13:03:21 +01:00
Nikita Ioffe
2af5bd00b0 Merge "Properly fail userspace reboot if it's not supported" 2020-04-02 10:23:45 +00:00
David Anderson
fabc36445e fs_mgr: Allow commas in boot device paths.
If the value of androidboot.boot_devices has a comma in its path, it'll
get split and /dev/block/by-name symlinks won't work. As a workaround,
add "androidboot.boot_device" as a valid command-line parameter. It can
be repeated multiple times to retain multiple-boot-device semantics.

Bug: 153024538
Test: device boots with androidboot.boot_device= set
Change-Id: I1be5aeec287ba198768c3452b1930d59b2f13463
2020-04-01 19:58:18 -07:00
Maciej Żenczykowski
23bfaae6dc Merge "NetlinkEvent - ignore captive portal and pref64 nd user opts" 2020-04-02 02:37:19 +00:00
Josh Gao
73d44bb6c2 Merge changes I90e10c74,I038d1df4,I4299bd96
* changes:
  adbd: delete unused variable.
  adb: move things around to prepare to add LZ4.
  adb: fix misindentation in Android.bp
2020-04-01 22:38:38 +00:00
Bill Peckham
647a8cdd44 Ignore functionfs mounts.
Vendors may add additional functionfs mounts. Since these
will never be remounted, we can safely filter these out.

Bug: 153008210
Test: Test device with previously unfiltered entries.
Change-Id: I7f384b8a0ce93dd6701fe3c4d9dd2557370b31e1
2020-04-01 14:29:12 -07:00
Josh Gao
e485bdf06e adbd: delete unused variable.
Bug: https://issuetracker.google.com/150827486
Test: m adb com.android.adbd.apex
Change-Id: I90e10c74d695659c702dea4173cb33ac5ca1a102
2020-04-01 13:09:31 -07:00
Josh Gao
6e697f2f8c adb: move things around to prepare to add LZ4.
Bug: https://issuetracker.google.com/150827486
Test: m adb com.android.adbd.apex
Change-Id: I038d1df4f179ddb23102016d781c9bd90da5a546
2020-04-01 13:09:29 -07:00
Josh Gao
31d42aa73c adb: fix misindentation in Android.bp
Bug: https://issuetracker.google.com/150827486
Test: none
Change-Id: I4299bd962963a58ef5f075405b99b1d1e4c1febc
2020-04-01 13:09:16 -07:00
Tom Cherry
d54a4bf9a3 Merge "init: don't sync() before shutting down services" 2020-04-01 15:40:44 +00:00
Nikita Ioffe
92116e4129 Properly fail userspace reboot if it's not supported
Previously, after `adb reboot userspace` is called on a device that
doesn't suppor it, init would've logged an error and quietly exit the
shutdown sequence. This was leaving adb handing forever.

With this approach, init will fail setprop
"sys.powerctl=reboot,userspace" in case userspace reboot is not
supported.

Test: adb root
Test: adb setprop init.userspace_reboot.is_supported 0
Test: adb reboot userspace
Test: atest CtsInitTestCases
Bug: 146639622
Change-Id: I1264078f53ed3ff54638c7f3b6846b7437f98ee5
2020-04-01 14:34:54 +01:00
Nikita Ioffe
884b570100 Merge "Make init.userspace_reboot.is_supported a rw property" 2020-04-01 13:14:21 +00:00
Maciej Żenczykowski
a806a7153f NetlinkEvent - ignore captive portal and pref64 nd user opts
These are provided to userspace by newer kernels.

Test: builds
Bug: 150648313
Change-Id: I811c75e9a4739db149f502b9a43c99a8ed883341
2020-03-31 20:25:33 -07:00
Tom Cherry
10615eb397 init: don't sync() before shutting down services
Devices in the lab are hitting an issue where they're getting stuck
likely in the sync() call in DoReboot() before we start the reboot
monitor thread and before we shut down services.

It's possible that concurrent writing to RW file systems is causing
this sync() call to take essentially forever.  To protect against
this, we need to remove this sync().  Note that we will still call
sync() after shutting down services.

Note that the service shutdown code has a timeout and there is a
reboot monitor thread that will shutdown the device if more than 30
seconds pass above that timeout.  This change increases that timeout
to 300 seconds to give the final sync() calls explicitly more time to
finish.

Bug: 150863651
Test: reboot functions normally
Test: put an infinite loop in DoReboot and the the reboot monitor thread
      triggers and shuts down the device appropriately
Change-Id: I6fd7d3a25d3225081388e39a14c9fdab21b592ba
2020-03-31 18:59:23 -07:00
Tom Cherry
e55818cd83 Merge "init: only print backtraces on subsequent reboots with a value" 2020-04-01 00:53:10 +00:00
Peter Collingbourne
bc1a6191f1 Merge "Fix off-by-one in ReadBuildIDFromMemory." 2020-03-31 23:08:12 +00:00
Tianjie Xu
fcf2d8b89b Merge "Support parsing of data descriptor" 2020-03-31 21:52:52 +00:00
Tom Cherry
8890d42939 Merge "fastbootd: sync() after flashing partitions or updating super" 2020-03-31 21:52:39 +00:00
Tom Cherry
9174a9bff8 init: only print backtraces on subsequent reboots with a value
Userspace reboot resets sys.powerctl to an empty string once it
starts, which was inadvertently triggering the backtrace of the main
init thread.

Test: no more unexpected backtraces
Change-Id: I35d6f1b37aa31a46ae9266647f41a709f28b6099
2020-03-31 14:36:03 -07:00
Tianjie
0ec0eaa214 Support parsing of data descriptor
The size fields in the data descriptor can be either 4 bytes or 8 bytes.
This depends on if the size are read from the zip64 extended field in
the local file header. This cl adds support to parse these cases.

Also fix a misconception in that the uncompressed and compressed size
doesn't need to exist together in the zip64 fields of the central
directory. But they still need to co-exist in the fields of the local
file header.

Bug: 150900468
Test: unit tests pass, python tests pass
Change-Id: Ia54f9bf56c85ff456ead90a136f7fddc5be5220c
2020-03-31 12:01:12 -07:00
Tom Cherry
e4a6ed8534 fastbootd: sync() after flashing partitions or updating super
There is a chance that devices are failing to reboot in the lab due to
sync() taking explicitly long during reboot.  Let's add the sync()'s
here to ensure they get accounted for in the flashing process.

A side benefit is it's likely safer to sync immediately after
flashing than to hope init does it during reboot.

Bug: 150863651
Test: flash local devices successfully
Change-Id: I4c4b0114f3cde8af4b8b2cb283ec21f869ef9f6f
2020-03-31 10:54:58 -07:00
Peter Collingbourne
a7b4c5d25a Fix off-by-one in ReadBuildIDFromMemory.
This was sometimes causing build ids to be truncated, probably because
of memory corruption in std::string. A similar off-by-one was fixed in
ReadBuildID in aosp/939619.

Bug: 129873279
Change-Id: I401fe7f991dbd135f5b4836381b48ea3c6a2243f
2020-03-31 10:29:38 -07:00
Yurii Zubrytskyi
f8dc296dfd Merge "adb: fix apex installation." 2020-03-31 16:56:07 +00:00
Jaegeuk Kim
a76ee8b929 Merge "rootdir: init.rc: use default dirty writeout policy" 2020-03-31 15:57:22 +00:00
Josh Gao
db22f23dd3 Merge "Statically link libadbd into minadbd." 2020-03-31 08:25:27 +00:00
Josh Gao
d6211a2dde Merge "adb: temporarily kill adb_benchmark." 2020-03-31 03:40:47 +00:00
Josh Gao
3c1803cab5 adb: fix apex installation.
Incremental doesn't support apex installation, but we were exiting
instead of returning -1 to fall back to regular installation.

Bug: http://b/151900478
Test: manual
Change-Id: Id27009250090a65fbb45bb65fc39c1799bf1f861
2020-03-31 02:08:14 +00:00
Josh Gao
3735614b28 Statically link libadbd into minadbd.
Bug: http://b/150317254
Test: booted aosp_walleye-eng into recovery
Change-Id: Ie479ae2fbaf1006228a531dab26c7d535ed403db
2020-03-30 18:51:15 -07:00
Jaegeuk Kim
58ff5075ac rootdir: init.rc: use default dirty writeout policy
This patch removed the old writeout policy tune which was never touched since
2009. In the meantime, most of Android devices are equipped with over 4GB DRAM
and very fast flash storages like UFS, which becomes more like desktop or
servers in 2009. So, it'd be worth to go back to use the default kernel configs.

Bug: 129751503
Change-Id: Idb58f5b01bbc4afd270cffba5b8912ea3565819f
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-03-31 01:49:13 +00:00
Josh Gao
fd193bd291 Merge "Move adbd's legacy USB implementation to fastboot." 2020-03-31 00:24:20 +00:00
Josh Gao
c6cb89ea80 adb: temporarily kill adb_benchmark.
Temporarily delete adb_benchmark, since it seems difficult to make this
sensibly work with a single target that's used for both libadb and
libadbd benchmarking.

Bug: http://b/150317254
Test: treehugger
Change-Id: Ibf81fdff4f2b7304b586ce9a7955b4bc2c11484e
2020-03-30 16:43:06 -07:00
Josh Gao
0871824de6 Move adbd's legacy USB implementation to fastboot.
This code path is effectively dead in adbd, and fastboot's dependency on
libadbd makes it hard to refactor adbd's dependencies.

Bug: http://b/150317254
Test: built and flashed aosp_walleye-eng
Change-Id: I5118136d32fdcbbd011559ed0a4a71e1dc7bf064
2020-03-30 16:43:06 -07:00
Nikita Ioffe
663cd35030 Make init.userspace_reboot.is_supported a rw property
General recommendation is to avoid read-only properties, and instead control
"read-onlines" by only allowing init/vendor_init to set the property.

Since ro.init.userspace_reboot.is_supported was added in this release, and
nobody outside of the platform is querying it directly, it should be fine to
simply rename it.

Test: adb shell getprop init.userspace_reboot.is_supported
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 152803929
Change-Id: I7552d5ccc6e9b750a6081947eef8fcb027be13e1
2020-03-30 23:40:45 +01:00
Peter Collingbourne
cd63cae6b2 Merge "Read fault address on arm64 using proposed kernel API." 2020-03-30 21:40:58 +00:00
Peter Collingbourne
5677803cb7 Merge "Create a debugger_process_info data structure with the process info pointers." 2020-03-30 21:36:41 +00:00
Tianjie Xu
b480dc4f3f Merge "Fix integrity check when parsing zip64 eocd" 2020-03-30 20:33:45 +00:00
Peter Collingbourne
e2b76c5b00 Merge "Move crash_dump into the runtime APEX." 2020-03-30 19:03:41 +00:00
Tom Cherry
3de710f84f Merge changes I3b20be28,I7118025c
* changes:
  Revert "init: disable oneshot_on test"
  init: require root for oneshot_on test
2020-03-30 18:03:00 +00:00
Treehugger Robot
6f6beb3cc0 Merge "Move PC-only unwind frame generation to libunwindstack." 2020-03-30 17:49:35 +00:00
Tom Cherry
91537d30de Revert "init: disable oneshot_on test"
This reverts commit d30c51157e.

This test wasn't flaky, it was failing when not run as root, but that
has been fixed.

Bug: 152630580
Bug: 152637928
Test: this test is okay now
Change-Id: I3b20be2839dae90ffc6a8eeea68f36e532060af1
2020-03-30 09:37:05 -07:00
Tom Cherry
14f4afd2f2 init: require root for oneshot_on test
Bug: 152630580
Bug: 152637928
Bug: 152662041
Bug: 152662652
Test: this test is skipped when run as non-root
Change-Id: I7118025cc20081a200000bf484a08c9ed0b0d3ec
2020-03-30 09:12:31 -07:00
Treehugger Robot
4e18727421 Merge "libdm: Link libraries statically for VTS." 2020-03-30 01:46:54 +00:00
Tianjie
173aba03f7 Fix integrity check when parsing zip64 eocd
The old check has some missing cases and may lead to read OOB.

Bug: 152433916
Test: unit tests pass
Change-Id: I3e8705b9c2db081228c5f9bd191c133668376ff2
2020-03-28 21:31:56 -07:00
Treehugger Robot
56188cc1c2 Merge "init: disable oneshot_on test" 2020-03-28 19:49:26 +00:00
Songchun Fan
26a8ed983c Merge "[adb] use zip iteration with functor" 2020-03-28 03:03:07 +00:00
Peter Collingbourne
f03af8844a Read fault address on arm64 using proposed kernel API.
On aarch64, the top 8 bits of the address (i.e. the tag bits) of
the fault address in si_addr are always clear. This isn't ideal for
MTE which will require these bits in order to correctly diagnose
tag mismatches.

A proposed kernel patch [1] exposes the full fault address including
the tag bits as part of the ucontext. Change debuggerd to read this
fault address if available.

[1] https://patchwork.kernel.org/patch/11435077/

Bug: 135772972
Change-Id: Ia05be574113860f4e9ecc36a310c4b740e0c4afb
2020-03-27 20:00:06 -07:00