Commit graph

29998 commits

Author SHA1 Message Date
Elliott Hughes
3e8d923276 Merge "Allow configuration of the number of tombstones." 2017-06-27 20:57:08 +00:00
Luis Hector Chavez
683ebc8059 init: Terminate gracefully when CAP_SYS_BOOT is absent
This change makes it possible for Android running in a container to
terminate cleanly instead of calling abort() when requested to shut
down.

Bug: 62388055
Test: setprop sys.powerctl reboot makes init terminate nicely

Change-Id: I31c7b475d89d7cbd665e135d9b8951dfd4bca80d
2017-06-27 13:51:46 -07:00
Dan Albert
9893f93950 Indicate that a packet was truncated.
Test: make checkbuild, check adb log
Bug: None
Change-Id: I0006ed284697f01966fdd79ca0b05dbc6d2eecf0
2017-06-27 13:26:14 -07:00
Mark Salyzyn
4eb0ba058c init.rc: setup console-ramoops-0
On later kernels /sys/fs/pstore/console-ramoops becomes
/sys/fs/pstore/console-ramoops-0

Test: none
Bug: 63058217
Change-Id: Ibe1feb39ef9081b1ab2316510674bf181bdc7b0c
2017-06-27 09:32:38 -07:00
Mark Salyzyn
26f1dd764c healthd: check console-ramoops-0
On later kernels /sys/fs/pstore/console-ramoops becomes
/sys/fs/pstore/console-ramoops-0

Test: none
Bug: 63058217
Change-Id: I05be83e40dfc1730ed62b74a146123cdb8573ca6
2017-06-27 09:28:57 -07:00
Mark Salyzyn
cab56c0ba5 fs_mgr: check console-ramoops-0
On later kernels /sys/fs/pstore/console-ramoops becomes
/sys/fs/pstore/console-ramoops-0

Test: none
Bug: 63058217
Change-Id: If1422e4df09b68c44f16608b1d191aeb6378c66b
2017-06-27 09:10:16 -07:00
Treehugger Robot
449bfd7a93 Merge "libcutils: fs_config: fix "system/<partition>/" aliasing" 2017-06-26 22:43:37 +00:00
Treehugger Robot
b22067677e Merge "Revert "adb: turn on libusb by default."" 2017-06-26 21:33:34 +00:00
Ben Fennema
acd7b7b0c0 libcutils: fs_config: fix "system/<partition>/" aliasing
Pull prefix checking into fs_config_cmp and make prefix_cmp be a
glorified partial ? strncmp() : strcmp()

Results before:
[ RUN      ] fs_config.system_alias

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: vendor/lib/hw didn't match system/vendor/lib

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/vendor/bin/wifi didn't match vendor/bin/wifi

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/odm/bin/wifi didn't match odm/bin/wifi

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/oem/bin/wifi didn't match oem/bin/wifi
system/core/libcutils/tests/fs_config.cpp:247: Failure
Value of: check_fs_config_cmp(fs_config_cmp_tests)
  Actual: true
Expected: false
[  FAILED  ] fs_config.system_alias (6 ms)

Results after:
[ RUN      ] fs_config.system_alias
[       OK ] fs_config.system_alias (0 ms)

Bug: 62204623
Test: gTest libcutils-unit-test --gtest_filter=fs_config.*
Change-Id: I8282827002816e86ea3014fed29eabf43b837815
Signed-off-by: Ben Fennema <fennema@google.com>
2017-06-26 14:13:52 -07:00
Elliott Hughes
35bb6d2a89 Allow configuration of the number of tombstones.
Bug: http://b/62810514
Test: altered the property, got more tombstones
Change-Id: Iba8089915fa715658d2dfecb076c6a61321243bd
2017-06-26 14:00:00 -07:00
Josh Gao
969110ca4a Revert "adb: turn on libusb by default."
This reverts commit f2f0b31850.

libusb seems to be causing flakiness on some machines. Disable it for
now.

Bug: http://b/62962248
Test: python test_device.py (with DeviceOfflineTest commented out)
Change-Id: Ia9de78ab772c22574cf5ca7facb78f22af6d7a71
2017-06-26 13:17:58 -07:00
Treehugger Robot
c70bf5836c Merge "AVB: allow no metadata in the generic system.img for project Treble" 2017-06-24 01:28:25 +00:00
Bowgo Tsai
60f19a0792 AVB: allow no metadata in the generic system.img for project Treble
The generic system.img released from project Treble can't contain any verity
metadata (e.g., vboot 1.0, AVB, or any other implementation) because it's
*generic*. To make any device can boot with it, `avbctl disable-verification`
is introduced to set a new flag AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED
in the top-level vbmeta to disable the entire AVB verification process. This
should be done prior to flash the generic system.img. See the following link
for details:

    https://android-review.googlesource.com/#/c/418399/

This CL checks whether AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED is
set in the top-level vbmeta. When set, skip verifying the vbmeta structs
against androidboot.vbmeta.{hash_alg, size, digest} because it will be
absent in kernel cmdline. Also, only top-level vbmeta struct is read then
returned by libavb in this case.

Note that another flag AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED, usually
set by `adb disable-verity`, is used to signal fs_mgr to skip setting up
dm-verity, but libavb still verifies all vbmeta structs. fs_mgr will
also verify all vbmeta structs against androidboot.vbmeta.{hash_alg,
size, digest} from kernel cmdline as well.

Also rename SetUpAvb() to SetUpAvbHashtree() to better fit its usage.
This function will return kDisabled when any of the above two flags is set.

Finally, regardless of which flag is set or not set, we still only allow two
return values from avb_slot_verify():

   - AVB_SLOT_VERIFY_RESULT_OK: it's still possible to get this value
     when any of these flags are set in build time. e.g.,
     BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS=--flags 2

   - AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: in most cases we should
     get this value, because the flags are likely set at run time.

Bug: 62523303
Test: boot device with 'avbctl disable-verification'.
Test: boot device with 'avbctl enable-verification'.
Test: boot device with 'adb disable-verity'.
Test: boot device with 'adb enable-verity'.

Test: build image with BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS=--flags 2, then boot device.
      repeat the above steps to boot device again.

Change-Id: Ie8436f3e0e82c78490208f3b85eac5238a9fdfdb
2017-06-24 09:20:15 +08:00
Tom Cherry
040212706b Merge "init: create android::init:: namespace" 2017-06-23 23:07:23 +00:00
Treehugger Robot
45b4fe454a Merge "libsysutils: Fix vold vulnerability in FrameworkListener" 2017-06-23 20:31:49 +00:00
Tom Cherry
81f5d3ebef init: create android::init:: namespace
With some small fixups along the way

Test: Boot bullhead
Test: init unit tests
Change-Id: I7beaa473cfa9397f845f810557d1631b4a462d6a
2017-06-23 13:21:20 -07:00
Christopher Ferris
62a17c6c4a Merge "Add section parsing and function name handling." 2017-06-23 20:18:35 +00:00
Tom Cherry
84c2eebbdd Merge "init: cleanup some string usage" 2017-06-23 19:40:24 +00:00
Christopher Ferris
8098b1c378 Add section parsing and function name handling.
Add the code to parse the Elf section headers.

Add the plumbing through of all the symbol handling code.

Add tests for all of this new functionality.

Bug: 23762183

Test: Pass new unit tests.
Change-Id: Ie2d90cbb3d7653c53251dbcf34d9e5d241278377
2017-06-23 10:51:28 -07:00
Narayan Kamath
111f351762 Merge "tombstoned: Improve message on java trace completion." 2017-06-23 08:12:51 +00:00
Treehugger Robot
b2bf7a5330 Merge "Debuggerd: Extend crash_dump timeout to 5 seconds" 2017-06-23 05:31:14 +00:00
Treehugger Robot
0c65c5c856 Merge "Debuggerd: Fix debuggerd_test" 2017-06-23 05:14:38 +00:00
Andreas Gampe
b02851a984 Debuggerd: Extend crash_dump timeout to 5 seconds
Some processes have lots of threads and minidebug-info. Unwinding
these can take more than the original two seconds.

Bug: 62828735
Test: m
Test: debuggerd_test
Test: adb shell kill -s 6 `pid system_server`
Change-Id: I0041bd01753135ef9d86783a3c6a5cbca1c5bbad
2017-06-22 20:19:11 -07:00
Andreas Gampe
26cbafb892 Debuggerd: Fix debuggerd_test
Follow-up to commit 695713e931f0436aca56be9c0dacf2a5dd4e56e7 in
bionic. Change expectations of the abort callstack.

Test: mmma system/core/debuggerd
Test: adb shell /data/nativetest/debuggerd_test/debuggerd_test32
Test: adb shell /data/nativetest64/debuggerd_test/debuggerd_test64
Change-Id: I350a29ee1713a7ebdd50f2b9bdc2078c671e22c7
2017-06-22 20:19:11 -07:00
Jaesung Chung
1dcee84294 Merge "crash_dump: lower THREAD_COUNT in debuggerd_client.race for low-speed devices" 2017-06-23 01:59:28 +00:00
Treehugger Robot
7ff1eb698c Merge "Fix stack test on arm32" 2017-06-23 00:31:44 +00:00
Tom Cherry
1c3a53f03c init: cleanup some string usage
1) property_set() takes const std::string& for both of its arguments,
   so stop using .c_str() with its parameters
2) Simplify a few places where StringPrintf() is used to concatenate strings
3) Use std::to_string() instead of StringPrintf() where it's better suited

Test: Boot bullhead
Test: init unit tests
Change-Id: I68ebda0e469f6230c8f9ad3c8d5f9444e0c4fdfd
2017-06-22 17:24:22 -07:00
Jaesung Chung
cde2b524f1 crash_dump: lower THREAD_COUNT in debuggerd_client.race for low-speed devices
The debuggerd_client.race tests the crash_dump process to finalize the
killed process within 2 seconds. The 2 seconds timeout for finalizing a
process, which has 1024 threads, is bit small for low-speed devices.
This CL lowers the bar in order to make such devices pass the test.
Wraping up 128 threads within 2 seconds looks safe.

Bug: 62600479
Test: debuggerd_test passes on low-speed devices.
Change-Id: I3089415961422e6933405d2c872913273425caff
2017-06-23 08:59:22 +09:00
Treehugger Robot
52998574d1 Merge "libmemunreachable: turn off MEM_ALOGV messages" 2017-06-22 22:53:50 +00:00
Treehugger Robot
ae38b373a5 Merge "Move libmemunreachable into namespace android" 2017-06-22 22:37:43 +00:00
Colin Cross
76464d958b Fix stack test on arm32
The stack test puts a pointer to an allocation on the stack, checks
that there are no leaks, then lets it go out of scope and checks
that libmemunreachable can find a leak.  This works on arm64, but
on arm32 the pointer on the stack doesn't get overwitten and the
leak is not detected.  Rewrite the pointer to be NULL instead.

Test: memunreachable_test
Change-Id: I5959a34cbb572a5d8670270077a85d247a3a4880
2017-06-22 14:21:52 -07:00
Colin Cross
75752c1911 Merge "libmemunreachable: clang-format everything" 2017-06-22 20:57:03 +00:00
Colin Cross
f3ce8bc8ae libmemunreachable: turn off MEM_ALOGV messages
The move to async safe logging in I3d3b2111f6f6bf8a0d7039295d34d5168c191651
caused MEM_ALOGV messages to print even when NDEBUG was set.

Test: builds
Change-Id: Ibebe69d8c96f8f2556991c1eb5446a77782d43c7
2017-06-22 13:46:56 -07:00
Colin Cross
a9939e9a23 Move libmemunreachable into namespace android
Putting libmemunreachable in the global C++ namespace was an oversight,
move it into namespace android.

Test: m -j checkbuild
Change-Id: I0799906f6463178cb04a719bb4054cad33a50dbe
2017-06-22 10:58:23 -07:00
Colin Cross
a83881e33c libmemunreachable: clang-format everything
clang-format -i --sort-includes $(find . -name "*.cpp" -o -name "*.h")

Test: builds
Change-Id: Ia8e0677fe7f3f26dddba3a851cd2dfab9f14e421
2017-06-22 10:58:05 -07:00
Narayan Kamath
79dd143e5f tombstoned: Improve message on java trace completion.
For java traces, log the kind of dump as well as the PID of the
completed dump. This makes it easier to correlate dump requests with the
actual file they're written to.

Sample log statement:
E /system/bin/tombstoned: Traces for pid 4737 written to: /data/anr/trace_00

The message for native traces / tombstones remains unchanged because
several tools parse it.

Test: manual
Bug: 32064548

Change-Id: I7b3792dd5ae312ee0bc055c22ec3f7c747152072
2017-06-22 11:04:33 +01:00
Narayan Kamath
07a57f0f28 Merge "tombstoned: change path for traces from "anr_" to "trace_"" 2017-06-22 08:30:42 +00:00
Treehugger Robot
b7e2f272ee Merge changes from topic 'eng_first_stage_mount'
* changes:
  Revert "Revert "init: poll in first stage mount if required devices are not found""
  Revert "Revert "ueventd: remove PlatformDeviceList""
  fs_mgr: differentiate if fs_mgr_set_verity() was skipped or disabled
2017-06-21 23:55:52 +00:00
Sandeep Patil
4cbedee541 Revert "Revert "init: poll in first stage mount if required devices are not found""
This reverts commit d6fccea093.

Bug: 62681642
Bug: 62682821
Bug: 62864413

Change-Id: Ic9c27552acbd2ae312e44ea2cdf060dcf493bfe6
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-06-21 15:04:57 -07:00
Sandeep Patil
cd2ba0d184 Revert "Revert "ueventd: remove PlatformDeviceList""
This reverts commit 516ff99711.

Bug: 62864413
Bug: 62864413

Change-Id: Ie3980cd536c2c83adace063f0950128f68561105
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-06-21 15:04:57 -07:00
Sandeep Patil
95366e97dd fs_mgr: differentiate if fs_mgr_set_verity() was skipped or disabled
In case of non-secure builds (eng variant) fs_mgr_setup_verity() skips
verity checks regardless of fstab options. This is slightly different
than 'adb disable-verity' where it would first read the verity metadata
to check if verity is disabled.

So, this change adds a new return value of FS_MGR_SETUP_VERITY_SKIPPED
instead of piggy backing on the FS_MGR_SETUP_VERITY_DISABLED.

Bug: 62864413
Test: Boot sailfish

Change-Id: I42bf2bdce0ecb18b4c3b568e2bc96bf1590dfb35
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-06-21 15:04:46 -07:00
Treehugger Robot
293936e41c Merge "Decode ptrace-induced SIGTRAP si_code values." 2017-06-21 21:59:25 +00:00
Treehugger Robot
5dd87c4ef6 Merge "healthd: add battery health status values from JEITA spec" 2017-06-21 19:11:45 +00:00
Tom Cherry
9c5f614945 Merge "Revert "ueventd: remove PlatformDeviceList"" 2017-06-21 18:42:22 +00:00
Tom Cherry
516ff99711 Revert "ueventd: remove PlatformDeviceList"
Bug: 62864413

This reverts commit c94ce7b130.

Change-Id: I014360251e5cda89c87adfec46d8b1e5000f3a9c
2017-06-21 18:42:07 +00:00
Tom Cherry
c9a27f79ad Merge "Revert "init: poll in first stage mount if required devices are not found"" 2017-06-21 18:41:57 +00:00
Tom Cherry
d6fccea093 Revert "init: poll in first stage mount if required devices are not found"
Bug: 62864413

This reverts commit ccf0d39316.

Change-Id: I343e304db4c0e7af2402397ef468cc743a3f08a9
2017-06-21 18:40:58 +00:00
Narayan Kamath
b123220dd6 tombstoned: change path for traces from "anr_" to "trace_"
The only case where tombstoned creates files for java traces is
when the process is signalled "by hand" using "shell kill -3", or
by the program itself. Such traces do not correspond to an ANR, so
name those files "trace_XX".

When dumpstate / system_server want to dump java traces, they set up
a tombstoned intercept and manage the lifetime of any associated file
that themselves.

Bug: 32064548
Test: manual, debuggerd_test
Change-Id: I97006ec7c0cd35de4b9564f535e77af846cc3891
2017-06-21 18:00:09 +01:00
Elliott Hughes
336a52e00c Decode ptrace-induced SIGTRAP si_code values.
Example:

  signal 5 (SIGTRAP), code -32763 (PTRACE_EVENT_STOP), fault addr 0x274e00005fb3

I'm tempted to say that %d isn't the best choice for si_code, but as long as
we're fully decoding all the values, I don't think it matters.

Bug: http://b/62856172
Test: manual debuggerd run
Change-Id: Ieeca690828e1e12f4162bbadece53f4aa7b9537a
2017-06-21 08:45:33 -07:00
Elliott Hughes
199c27734f Merge "Shave a stack frame off asserts." 2017-06-21 15:09:55 +00:00