Commit graph

36259 commits

Author SHA1 Message Date
Elliott Hughes
ddc4e5cfbf Merge "fastboot should fail if it runs out of space while unzipping."
am: b88aa023d4

Change-Id: I898da8a51df593eef8c6856e69d0109533eba1ef
2017-10-28 01:23:34 +00:00
Treehugger Robot
b88aa023d4 Merge "fastboot should fail if it runs out of space while unzipping." 2017-10-28 01:16:29 +00:00
Josh Gao
2bf84f9cdd Merge "Delete obsolete debuggerd references."
am: 1193f3bff6

Change-Id: I025b3c707785c9979515d545ef74eefe6eb9bc90
2017-10-28 01:14:02 +00:00
Treehugger Robot
1193f3bff6 Merge "Delete obsolete debuggerd references." 2017-10-28 01:05:20 +00:00
Josh Gao
18ea0978cf Delete obsolete debuggerd references.
Test: treehugger
Change-Id: Ic1a8cfb867decd76443fdc26333f2bcaa98b61bb
2017-10-27 16:12:49 -07:00
Tao Wu
5c5a6bdc87 Merge "Fix race condition between restart and stop/reset."
am: ee14225e0d

Change-Id: Ia49e967f5fb7fc58058c260fcad4559b2a4df15d
2017-10-27 21:48:15 +00:00
Tao Wu
ee14225e0d Merge "Fix race condition between restart and stop/reset." 2017-10-27 21:32:51 +00:00
Elliott Hughes
4089d34b93 fastboot should fail if it runs out of space while unzipping.
Previously fastboot would carry on regardless if decompression failed:

  fastboot: archive does not contain 'vbmeta.img'
  fastboot: extracting vendor.img (260 MB)...
  fastboot: W/ziparchive(56777): Zip: unable to allocate  272781472 bytes at offset 0 : No space left on device
  fastboot: failed to extract 'vendor.img': I/O error
  fastboot: archive does not contain 'vendor_other.img'
  fastboot: wiping userdata...

This is because all but "boot" and "system" are considered "optional",
and the implementation of "optional" was "ignore any failures". What it
_should_ have meant was "it's okay if these don't exist, but if they do,
failures matter".

Fix this logic, use die() more aggressively, and remove spurious "\n"s
from die() format strings.

Also fix spurious whitespace in the libziparchive format string. Before:

  Zip: unable to allocate  272781472 bytes at offset 0 : No space left on device

After:

  Zip: unable to allocate 272781472 bytes at offset 0: No space left on device

Bug: http://b/68383022
Test: `fastboot update` on marlin
Change-Id: I3cbf55f1a33ca125f293f873eafbcfb86c880ba8
2017-10-27 14:21:12 -07:00
Tao Wu
84b856d901 Fix race condition between restart and stop/reset.
If there is a restart follow a stop/reset immediately or vice versa,
clear previous flag bits.

Test: manual - trigger restart after stop immediately to check if
service get started.

Change-Id: I4503177d7cb5ed054dbcf50cd8e09728415404d4
2017-10-27 11:31:42 -07:00
Mark Salyzyn
a4e1f24322 Merge "bootstat: test: add error propagation for fastboot format userdata"
am: 7de02203cc

Change-Id: Ia45b8d0bcdf94f91b9df42326937de279918e396
2017-10-27 16:19:57 +00:00
Mark Salyzyn
7de02203cc Merge "bootstat: test: add error propagation for fastboot format userdata" 2017-10-27 16:12:11 +00:00
Mark Salyzyn
e7c95fb34f bootstat: test: add error propagation for fastboot format userdata
Test: system/core/bootstat/boot_reason_test.sh optional_factory_reset
Bug: 63736262
Change-Id: I8893df15ef802bb76c0795288df91d8463bfe3d1
2017-10-27 08:32:55 -07:00
Mark Salyzyn
fd83ec77d7 Merge changes I93b4210f,Ifdc1d4fd
am: 92803eeb32

Change-Id: Ie22d9a87535c6a4948addfc965732f3839467134
2017-10-27 14:27:58 +00:00
Treehugger Robot
92803eeb32 Merge changes I93b4210f,Ifdc1d4fd
* changes:
  bootstat: handle a bad bit error rate issue with pstore
  bootstat: better validation of battery level (shutdown,battery)
2017-10-27 14:16:44 +00:00
Narayan Kamath
c72f5276fb Merge "zip_archive: Make Inflate a public API."
am: d2ea4471bc

Change-Id: I5d6fd63d2e1f76c47273dd7e488b58cc35eda786
2017-10-27 08:36:12 +00:00
Narayan Kamath
de0153c20b Merge "zip_archive: generalize deflate method."
am: 661b3827a6

Change-Id: I07b03e639aec39ba66907ce5e2402632f345bac2
2017-10-27 08:35:28 +00:00
Narayan Kamath
5cc1bd65ed Merge "zip_archive: Remove unused ziparchive-host"
am: 4adb4ce223

Change-Id: I4fc662198b3e281b19cd98e9977fde7357a988e1
2017-10-27 08:34:23 +00:00
Narayan Kamath
d2ea4471bc Merge "zip_archive: Make Inflate a public API." 2017-10-27 08:27:20 +00:00
Narayan Kamath
661b3827a6 Merge "zip_archive: generalize deflate method." 2017-10-27 08:25:22 +00:00
Narayan Kamath
4adb4ce223 Merge "zip_archive: Remove unused ziparchive-host" 2017-10-27 08:25:04 +00:00
Mark Salyzyn
511e05f893 Merge changes Ia1c401b8,I571fb7da,I47999569
am: c2cdaf1840

Change-Id: Ic6e12a40e75f0a68400f803e53987aff4590c7bc
2017-10-27 00:46:52 +00:00
Treehugger Robot
c2cdaf1840 Merge changes Ia1c401b8,I571fb7da,I47999569
* changes:
  bootstat: Do not allow unknown boot reasons to land in first field.
  bootstat: move boot reason validation transformation policy into subroutine.
  bootstat: test: fix Its_Just_So_Hard_reboot
2017-10-27 00:28:32 +00:00
Josh Gao
b57a60c0bd Merge "libbacktrace: correctly number frames when skipping."
am: b5f090d870

Change-Id: Ifb1961bc39bcb914f7b7964a140ec34ae7cb7838
2017-10-27 00:17:54 +00:00
Tao Wu
36be7e61bf Merge "Fix one race condition between start and stop."
am: 876b13d0ec

Change-Id: Id2aee53665a57772f29c9f2e7604ba5418bfaecb
2017-10-27 00:17:20 +00:00
Tom Cherry
bd0f354eb4 Merge "Add test for android::base::Split with a trailing empty part."
am: 972753e094

Change-Id: If8a35976199d72a027c302e45cb4a9502c28a7da
2017-10-27 00:16:46 +00:00
Treehugger Robot
b5f090d870 Merge "libbacktrace: correctly number frames when skipping." 2017-10-26 23:28:35 +00:00
Tao Wu
876b13d0ec Merge "Fix one race condition between start and stop." 2017-10-26 22:48:51 +00:00
Tao Wu
990d43cb82 Fix one race condition between start and stop.
For a oneshot service, if start happens immediately after stop,
the service could be still in stopping status and then start
won't do anything. This fix this race condition.

Test: manual - see reproduce instructions in bug.
Bug: 68020256
Change-Id: I20202fa346f1949a8bda3d90deedc8b6a6d814d3
2017-10-26 22:08:56 +00:00
Josh Gao
cd546c11d6 libbacktrace: correctly number frames when skipping.
Correct for the number of skipped frames when unwinding with
libunwindstack.

Test: backtrace_test32  --gtest_filter="unwind_frame_skip_*"
Change-Id: I9528977104fde3c4ec792a6db1ada24ed571b867
2017-10-26 14:19:49 -07:00
Mark Salyzyn
293cb3b217 bootstat: handle a bad bit error rate issue with pstore
Create a private rfind that allows a fuzzy match based on a bit error
rate (BER) of 1 every 8 bits.  last kmsg is affected by pstore ramoops
backing that suffers from data corruption.  Add some additional
validation based on possible data corruption scenarios, as a noisy
match means higher chance of noisy data.

Noisy data notably can affect the battery level detection, but do not
typically result in false positives.  Battery level, or failure, is
the responsibility of the BatteryStats service, providing a positive
signal and strong device-independent algorithm.  The checking done in
bootstat is likely to be deprecated in favour of an API request to
BatteryStats once their algorithms deal with surprise outages due to
aging.

The kernel logging heuristic and BER fixup handily deals with a
prevalent issue where some bootloaders failure to properly notify us
of panics.  This is where the gains are noticed with this improvement.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I93b4210f12fb47c5c036f4d6eb4cafeee4896d35
2017-10-26 14:17:14 -07:00
Mark Salyzyn
747c0e6216 bootstat: better validation of battery level (shutdown,battery)
Replace simple strtoull with loop that ensures no leading zeros.
Restrict size of value buffer being checked as allocation was
going to end of retrieved buffer, which can cause unnecessary
memory pressure during boot.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ifdc1d4fd3a73794c001577024ce7cbfde9c25028
2017-10-26 14:17:14 -07:00
Mark Salyzyn
dafced93a5 bootstat: Do not allow unknown boot reasons to land in first field.
If we sniff an unknown boot reason from last kmsg, make sure it
has a "reboot," prefix.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ia1c401b8899d1f0c56bd4f5d8d2d19b7fc889a30
2017-10-26 14:14:40 -07:00
Mark Salyzyn
88d692c09e bootstat: move boot reason validation transformation policy into subroutine.
Allow for future policy adjustments.

SideEffects: None
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I571fb7dafc6b80c75d2809a3da3f9b96784cef06
2017-10-26 14:11:04 -07:00
Mark Salyzyn
72a8ea3d3c bootstat: test: fix Its_Just_So_Hard_reboot
Add the test injection to known list, and deal with an error
propagation issue.

Test: system/core/bootstat/boot_reason_test.sh Its_Just_So_Hard_reboot
Bug: 63736262
Change-Id: I4799956978a8884c69c830fcedd7febd143651fd
2017-10-26 14:10:31 -07:00
Tom Cherry
972753e094 Merge "Add test for android::base::Split with a trailing empty part." 2017-10-26 19:49:09 +00:00
Joe Tanen
0f9791bdd3 Merge "init: fixed issues related to forking services"
am: 03d67dd99e

Change-Id: Ia1ebbffce9bc510d28d03f76e9e4e8a53ec39198
2017-10-26 18:44:25 +00:00
Treehugger Robot
03d67dd99e Merge "init: fixed issues related to forking services" 2017-10-26 18:38:23 +00:00
Tom Cherry
fbbf27da02 Add test for android::base::Split with a trailing empty part.
Test: this new unit test
Change-Id: Ia14ba878f2866e333a69f1e6f7f56b66a7e657a5
2017-10-26 10:50:20 -07:00
Narayan Kamath
485b3640a4 zip_archive: Make Inflate a public API.
For use from zipalign and androidfw::ZipUtils.

Test: make
Bug: 35246701

Change-Id: I1bdeff3770d0833dfc0807d8a69ba9fea525772a
2017-10-26 18:43:49 +01:00
Narayan Kamath
4b97a71cb1 zip_archive: Remove unused ziparchive-host
Test: make
Change-Id: Ice7fdfb59bc939d075d3be216e48bea46a80e82d
2017-10-26 17:50:49 +01:00
Narayan Kamath
8b8faed17d zip_archive: generalize deflate method.
Remove dependencies on zip_archive specific data structures. In follow
up changes, this method will be promoted to a public API and used from
androidfw/ZipUtils as well as tools/zipalign, thereby allowing us to
remove a near-exact copy of this code and to simplify depdencies.

Test: zip_archive_test
Bug: 35246701
Change-Id: If24a9965fbd6fff308c8758859026684fd2af3b9
2017-10-26 17:47:50 +01:00
Joe Tanen
4bfdcb3932 init: fixed issues related to forking services
Fixed issues related to forking services into new PID + mount
namespaces.

Remounting rootfs recursively as slave when creating a service in new
PID + mount namespaces. This prevents the service from interfering with
mount points in the parent namespace.

Unmount then mount /proc instead of mounting it with MS_REMOUNT, since
MS_REMOUNT is not sufficient to update /proc to the state appropriate
for the new PID namespace. Note that the /proc mount options specified
here are not the same as those used in the default mount namespace. I
kept them consistent with those used in the code prior to this fix.

Test: Used custom sleepd service to test init 'namespace' keyword.
Tested on angler in oreo-dev - I had to add PID namespaces to the
kernel (commit ad82c662).

Change-Id: I859104525f82fef3400d5abbad465331fc3d732f
2017-10-26 09:08:11 -07:00
Mark Salyzyn
3adf871e00 Merge changes I30d6b530,Ie2e5872a,I313cfef2,I87dfb6a0,I70709ba5
am: 5b2d0987bf

Change-Id: I2c19629027e9127e2e9bfdfe6c3db056ee9a26dd
2017-10-26 14:38:03 +00:00
Mark Salyzyn
5b2d0987bf Merge changes I30d6b530,Ie2e5872a,I313cfef2,I87dfb6a0,I70709ba5
* changes:
  bootstat: add shutdown,thermal,battery
  bootstat: add reboot,2sec
  bootstat: test: check ro.boot.bootreason in some tests
  bootstat: fix test regression (exec_background)
  bootstat: fix test regression (extra logging)
2017-10-26 14:33:01 +00:00
Yao Chen
5b5ffbda22 Merge "Allow stats buffer to be empty in liblog CTS."
am: 41a9b3c81d

Change-Id: I05e9dc0ae0ad1eea67f0739403aa8160f472f848
2017-10-25 23:15:24 +00:00
Treehugger Robot
41a9b3c81d Merge "Allow stats buffer to be empty in liblog CTS." 2017-10-25 23:09:32 +00:00
Mark Salyzyn
c89f9da060 bootstat: add shutdown,thermal,battery
Test: system/core/bootreason/boot_reason_test.sh
Bug: 63736262
Change-Id: I30d6b5308fd8616eae31ad13e925d66c9fc07367
2017-10-25 15:45:49 -07:00
Mark Salyzyn
cabbe4ff35 bootstat: add reboot,2sec
Test: system/core/bootreason/boot_reason_test.sh
Bug: 63736262
Change-Id: Ie2e5872adb14e0979ff87eb4d2f57ab2849facd4
2017-10-25 15:45:49 -07:00
Mark Salyzyn
2a8e5cce33 bootstat: test: check ro.boot.bootreason in some tests
blind_reboot_test() did not report the ro.boot.bootreason value,
making it more difficult to diagnose failures.

Test: system/core/bootstat/boot_reason_test.sh cold warm hard
Bug: 63736262
Change-Id: I313cfef202b1e06c583b0b47cd5d0e0888a7dbe7
2017-10-25 15:45:49 -07:00
Mark Salyzyn
73691aafc2 bootstat: fix test regression (exec_background)
Deal with regression from 557a9d4054
where bootstat was moved to exec_background and actions delayed
to improve boot time.  Add a 1 second sleep rather than trying to
inspect the dmesg (debug only) for clues to the end of bootstat.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I87dfb6a07130112bf51c367632967efa53ea2534
2017-10-25 15:45:46 -07:00