Commit Graph

36235 Commits

Author SHA1 Message Date
Josh Gao 18ea0978cf Delete obsolete debuggerd references.
Test: treehugger
Change-Id: Ic1a8cfb867decd76443fdc26333f2bcaa98b61bb
2017-10-27 16:12:49 -07:00
Tao Wu ee14225e0d Merge "Fix race condition between restart and stop/reset." 2017-10-27 21:32:51 +00: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 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
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 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
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
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
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 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
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
Mark Salyzyn bcf66ed699 bootstat: fix test regression (extra logging)
Deal with regression from 9a3870490a
where additional content is logged and should be ignored.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I70709ba5b00ea18a653ff8d1658556b7d4c48775
2017-10-25 15:40:56 -07:00
Yao Chen 07320dc0a3 Allow stats buffer to be empty in liblog CTS.
Bug: 68205209
Test: CtsLiblogTestCases
Change-Id: I846c7cf72c54b02c2bc67c9c9e37b5cf4ae3da2b
2017-10-25 13:46:42 -07:00
Elliott Hughes 77451492bc Merge "Remove Foreground Boost CPUSet" 2017-10-25 19:55:50 +00:00
Christopher Ferris 3adedf9895 Merge "Add an interface for stopping in certain maps." 2017-10-25 19:18:21 +00:00
Christopher Ferris 1ab86ad3bc Merge "Remove PauseTiming/ResumeTiming calls." 2017-10-24 23:14:49 +00:00
Christopher Ferris 1cb84cea2f Add an interface for stopping in certain maps.
Also, change the std::set parameters to std::vector. As jmgao points out,
a small std::set is not really the best choice for performance reasons.

Test: All unit tests pass, enabled the new unwinder and did a kill -3 on
Test: an android process.
Change-Id: I81227d7b79a9b7cf1d54fb0e3331d3cf4d4d3c4f
2017-10-24 15:45:59 -07:00
Christopher Ferris 09123383cb Merge "If the pc is set to zero, the unwind is done." 2017-10-24 20:50:30 +00:00
Treehugger Robot b128c78aef Merge "libutils: Fix bug in strstr16." 2017-10-24 20:20:00 +00:00
Treehugger Robot 0f2097c0f0 Merge "Don't use TEMP_FAILURE_RETRY on close()" 2017-10-24 19:47:20 +00:00
Christopher Ferris 5169c167c5 Remove PauseTiming/ResumeTiming calls.
These calls can only be used after the call to state.KeepRunning(),
which handles the start/stop itself.

Bug: 68170209

Test: Ran the benchmark and got reasonable results.
Change-Id: Ie12eb3a983f6fe60c85d6dfc90957eedc16b5526
2017-10-24 12:39:10 -07:00
Nick Kralevich 3d118e72dd Don't use TEMP_FAILURE_RETRY on close()
See https://lkml.org/lkml/2005/9/10/129 for details.

Bug: 20501816
Test: code compiles and boots with no obvious problems.
Change-Id: I5a9c470156d498852cfd81fbd59ddcf267309e73
2017-10-24 10:46:34 -07:00
Branislav Rankov bf3fff1a9e libutils: Fix bug in strstr16.
In the original code when target is an empty string
strlen16() would start reading the memory until a
"terminating null" (that is, zero) character is found.
This may happen because "*target++", at line 300,
would increment the pointer beyond the actual string.

Signed-off-by: Branislav Rankov <branislav.rankov@arm.com>
Signed-off-by: Tamas Petz <tamas.petz@arm.com>
Test: libutils_tests --gtest_filter=UnicodeTest.strstr16*
Change-Id: I213ffe061057c7fa8f34b68881e106a709557dcd
2017-10-24 10:36:00 -07:00
Josh Gao cada8d74d0 Merge changes I8f33830f,Icd2b891b,I8736ff5c,Iae6e342a
am: 1c65e77e6d

Change-Id: I886dcc26c8dbc51c67011452ee615a95456385c7
2017-10-24 04:08:01 +00:00
Treehugger Robot 1c65e77e6d Merge changes I8f33830f,Icd2b891b,I8736ff5c,Iae6e342a
* changes:
  libunwindstack: add method to iterate across registers.
  libbacktrace: expose BacktraceMap's unwindstack::Memory.
  libunwindstack: expose UnwindStackMap::GetFunctionName.
  libbacktrace: expose libunwindstack Unwind routine.
2017-10-24 04:03:18 +00:00
Wei Wang 121ff413ef Merge "init: call umount unconditionally"
am: b409e5e00b

Change-Id: I9eb45b728145301418b9d7775067ce298551f063
2017-10-24 02:13:43 +00:00
Treehugger Robot b409e5e00b Merge "init: call umount unconditionally" 2017-10-24 02:07:48 +00:00
Jake Weinstein 60bc597183 Remove Foreground Boost CPUSet
This functionality was removed at
https://android.googlesource.com/platform/frameworks/base/+/a712d4058f6f85268838
2017-10-23 20:07:22 -04:00
Wei Wang 25dc30f3be init: call umount unconditionally
std::all_of is using std::find_if, which means, if any element the given
predicate returns false, it stops further iteration and just returns false.
std::all_of used in Reboot.cpp will cause umount not to be called on all
block devices if some block device returns false in the middle.

Bug: 68158923
Test: reboot
Change-Id: I43ba6bd0c18018c1ed5fe2b63996552bc51cc67c
2017-10-23 16:25:31 -07:00