Commit graph

30096 commits

Author SHA1 Message Date
Treehugger Robot
d5b36f38ef Merge "init: Do full shutdown even for thermal shutdown" 2017-07-20 03:21:41 +00:00
Treehugger Robot
a68f633675 Merge "fs_mgr_verity: allow verification error when the device is unlocked" 2017-07-20 01:48:34 +00:00
Tom Cherry
9aaf66b61f Merge "ueventd: fixup ueventd_test.cpp" 2017-07-20 01:05:28 +00:00
Keun-young Park
30173874fc init: Do full shutdown even for thermal shutdown
- Skipping SIGTERM / SIGKILL / umount brings race between block
  device driver and fs layer. Do umount before shutting down.
- Reduce timeout to 1 sec for thermal shutdown and skip other time
  taking part like fsck.
- Refactor waiting part to check time in ms so that 1 sec can
  have enough resolution.

bug: 63686426
Test: adb shell setprop sys.powerctl thermal-shutdown, adb shell setprop sys.powerctl reboot and check dmesg
Change-Id: I048bac767b328c8d656a97fe65dde5f2b5bf4ae5
2017-07-19 17:27:05 -07:00
Tom Cherry
2ef572be30 ueventd: fixup ueventd_test.cpp
Use ASSERT_EQ() instead of EXPECT_EQ() to prevent segfaults after
failed API calls.

Do not run setfscreatecon_IsPerThread unless we're in permissive mode
as it will not pass otherwise.

Test: init unit tests
Change-Id: I70525d438e89f1ec036255890169a50b5007b4c4
2017-07-19 15:29:20 -07:00
Keun-young Park
c13a2da2f4 Merge "dump stack before kill all" 2017-07-19 22:17:06 +00:00
Christopher Ferris
33913ebfb5 Merge "Add signal handling to the register object." 2017-07-19 15:39:23 +00:00
Treehugger Robot
4f59afe9fa Merge "system/core: use proper nativehelper headers" 2017-07-19 15:22:41 +00:00
Bowgo Tsai
b674894199 fs_mgr_verity: allow verification error when the device is unlocked
On a A/B device, the image combination in VTS is:
  - system.img (userdebug): provided by Google (system as root)
  - vendor.img (user): provided by the OEM

The generic system.img provided by Google doesn't have /verity_key.
So verified boot will fail when it tries to verify the signature of
vendor.img. This CL allows signature verification error (including
no verity_key) when the device is unlocked.

This CL also changes the return value to FS_MGR_SETUP_VERITY_SKIPPED when
signature verification failed in logging mode. Otherwise, first stage
mount will fail because it assumes verity device initialization should be
successful when receiving FS_MGR_SETUP_VERITY_SUCCESS.

Bug: 63821912
Test: boot generic system.img on a A/B device
Change-Id: I33e5ef753913ae9f0c8b02c518ae94d4c8505611
2017-07-19 18:45:40 +08:00
Keun-young Park
c59b822d1f dump stack before kill all
- If problematic process is from user, kill all kills
  it and dump does not show problematic process.

bug: 37737296
Test: reboot and check log
Change-Id: Iaa4f7d12f5a40fa7528c6672567c36e30b140372
2017-07-18 18:52:25 -07:00
Robert Benea
b84666cbc0 Merge "Add memcg related configs to init." 2017-07-19 00:54:41 +00:00
Christopher Ferris
a019665b3c Add signal handling to the register object.
- Add the StepIfSignalHandler function to the Regs object that checks
  if the code is in a signal handler.
- Add tests for new code, also add a test that unwinds through a signal
  handler.
- Slight modification to Elf to fail if a bad machine type is encountered.
  Add tests for this.

Bug: 23762183

Test: Ran unit tests.
Change-Id: Idafa1105d00b91a9343d7464ac9ed1cb95830963
2017-07-18 17:27:48 -07:00
Steven Moreland
00fe3ad728 system/core: use proper nativehelper headers
libnativeheader exports headers under nativeheader. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: modules using system/core find headers
Bug: 63762847
Change-Id: I86240f7857dd815100cab32ad261aa9a0a54329c
2017-07-18 17:03:20 -07:00
Robert Benea
d485226951 Add memcg related configs to init.
Allow configuring memory.swappiness, memory.soft_limit_in_bytes
and memory.limit_in_bytes by init; by doing so there is better
control of memory consumption per native app.

Test: tested on gobo branch.
bug: 63765067
Change-Id: I8906f3ff5ef77f75a0f4cdfbf9d424a579ed52bb
2017-07-18 15:58:40 -07:00
Treehugger Robot
a022ea424d Merge "uml: init: add USER_MODE_LINUX cflag, USER_MODE_LINUX case in init.cpp" 2017-07-18 21:16:30 +00:00
Quang Luong
dd6a85ccd5 uml: init: add USER_MODE_LINUX cflag, USER_MODE_LINUX case in init.cpp
Modified Android.mk to define cflag "USER_MODE_LINUX" if
TARGET_USER_MODE_LINUX := true in BoardCofig.mk.
Modified set_mmap_rnd_bits_action to return 0 if "USER_MODE_LINUX" is
defined. This is needed since uml does not support the mmap_rnd_bits
sysctl, and init would otherwise crash without this check.

Test: manual

Bug: 32523022
Change-Id: I409ef64a1fa253bfb3f9fb59d0267be159819bb8
Signed-off-by: Quang Luong <qal@google.com>
2017-07-18 18:18:31 +00:00
Tom Cherry
d13547347f Merge "Remove ALOGD_IF_SLOW" 2017-07-18 17:20:39 +00:00
Treehugger Robot
11649e8925 Merge "Do not umount /vendor, /system, and /oem even if they are R/W." 2017-07-18 03:08:42 +00:00
Treehugger Robot
e03665142e Merge "adbd: lessen security constraints when the device is unlocked" 2017-07-18 02:36:12 +00:00
Bowgo Tsai
f1d3dbc32f adbd: lessen security constraints when the device is unlocked
ALLOW_ADBD_ROOT ('adb root') and ALLOW_ADBD_NO_AUTH (ro.adb.secure = 0)
are false in user build. This prevents a non-A/B device from running
Treble VTS because it requires 'adb root'. Without ALLOW_ADBD_NO_AUTH,
adb still can work if ro.adb.secure = 1. However, allowing it to be 0
is better for test automation.

The image combination in VTS is:
  - system.img (userdebug): provided by Googlg
  - boot.img (user): provided by the OEM  <-- adbd is here
  - vendor.img (user): provided by the OEM

This change allows 'adb root' and 'ro.adb.secure = 0' when the device is
unlocked in user build. No changes for userdebug/eng builds.

Note that the device must be unlocked when running VTS. Otherwise,
verified boot will prevent it from booting the system.img provided by
Google (no verity metadata).

Bug: 63313955
Bug: 63381692
Test: use the above image combination, check 'adb root' and
      'ro.adb.secure = 0' can work

Change-Id: I109d96c950e54c4fb0ac0c98b989a20593681e52
2017-07-18 08:41:19 +08:00
Keun-young Park
6e12b3887e Do not umount /vendor, /system, and /oem even if they are R/W.
- /vendor, /system, /oem can be remounted to R/W for development
  purpose.

- In such case, umounting these partitions can lead into some processes
  not running properly during shutdown or blocking umount of fs.

- So skip them. As it is dev feature, it is up to each developer to
  understand the risk. But for normal adb sync - reboot should be ok
  as shutdown involves sync operations.

bug: 37737296
Test: adb remount,reboot, and check last kmsg
Change-Id: Iab6a6374bc558375d359b3b49b14db93d363b1ad
2017-07-17 17:32:26 -07:00
Treehugger Robot
420eabe3b3 Merge "Revert "Mark libmetricslogger vendor_available."" 2017-07-18 00:14:41 +00:00
Treehugger Robot
0ba56096d5 Merge "ueventd: add tests for setegid()/setfscreatecon() and threads" 2017-07-17 19:51:58 +00:00
Steven Moreland
0430efbc05 Revert "Mark libmetricslogger vendor_available."
This reverts commit 7f96d49370.

Reason for revert: depends on private liblog APIs
- log/log_event_list.h is not in the vndk

Change-Id: I448c2f1059bd6b225d8efff87eb3948e931de47a
2017-07-17 19:33:17 +00:00
Treehugger Robot
d1c73b57b5 Merge "logcat: Add missing newline to read failure" 2017-07-17 18:27:45 +00:00
Tom Cherry
c2e181cf1d ueventd: add tests for setegid()/setfscreatecon() and threads
setegid() and setfscreatecon() on Android both operate on a per-thread
basis, not a per-process basis.

Ueventd may take advantage of this in the future, so this CL
introduces tests that ensure that this functionality remains
consistent.

Bug: 63441941
Test: newly added unit tests
Change-Id: I8b1c62cc322b6fe44b748550a4cea8658d9efd88
2017-07-17 11:08:41 -07:00
Christopher Ferris
ca94f65ea0 Merge "Make the library usable as a library." 2017-07-15 16:49:27 +00:00
Tom Cherry
5be05733c2 Merge changes from topic 'ext4_encryption_flag'
* changes:
  fs_mgr: set ext4 encryption flag with tune2fs when needed
  fs_mgr: refactor pre-mount logic into prepare_fs_for_mount()
2017-07-14 23:06:30 +00:00
Treehugger Robot
91a17a41f6 Merge "rootdir: record last build signature and kernel version" 2017-07-14 21:15:36 +00:00
Christopher Ferris
d226a51409 Make the library usable as a library.
- Add namespace unwindstack everywhere so that it's easier for other
  code to use the library.
- Move some of the header files into include/unwindstack so that they
  can be exposed.
- Modify the headers so that only a limited number need to be exposed.
- Update the tools to use the new headers.
- Add a GetLoadBias() call on the Elf object. This prevents the need
  to get the interface object out of the Elf object.
- Move the GetRelPc() call out of the Reg class, to the Elf class. It's
  not always the case that a Reg object will be around when you want to
  get a relative pc. The tests for this moved to ElfTest.cpp.

Bug: 23762183

Test: Unit tests pass.
Change-Id: Iac609dac1dd90ed83d1a1e24ff2579c96c023bc3
2017-07-14 12:20:23 -07:00
Mark Salyzyn
93394034a2 rootdir: record last build signature and kernel version
Rotate /default.prop and /proc/version into /data/misc/recovery/
as an aid in determining the vintage of the LAST_LOGCAT and
LAST_DMESG in the bugreport collection.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: manually confirm content rotation through reboots
Bug: 62793047
Change-Id: Ibbe546c76041f20e308e58e5548939afac75db97
2017-07-14 11:39:14 -07:00
Treehugger Robot
b76158d56a Merge "fs_mgr: trim the terminating '\0' when reading from device tree" 2017-07-14 05:11:00 +00:00
Treehugger Robot
f610d6db82 Merge "crasher: add a case that leaks until OOM-kill." 2017-07-13 23:46:59 +00:00
Christopher Ferris
d312abe7c0 Merge "Move tools to separate directory." 2017-07-13 22:41:55 +00:00
Josh Gao
399b4ee21e crasher: add a case that leaks until OOM-kill.
Bug: http://b/63143027
Test: adb shell crasher leak
Change-Id: I6e4105972ef3d86430d0f332938f5fd33ebae100
2017-07-13 14:00:26 -07:00
Christopher Ferris
b5d7a87512 Move tools to separate directory.
Bug: 23762183

Test: Ran unit tests, ran new tools.
Change-Id: Icc7cbb4102a68042f4683d6dd622f21bc5e74deb
2017-07-13 13:20:10 -07:00
Colin Cross
454285dfcc Merge "libmemunreachable: track kernel binder references" 2017-07-13 19:41:26 +00:00
Bowgo Tsai
f559655912 fs_mgr: trim the terminating '\0' when reading from device tree
Bug: 63637343
Test: boot device
Change-Id: I35ead1ad852493f7f92bdb6c87617fde57b3b0be
2017-07-13 15:11:16 +08:00
Colin Cross
f572b91c4f libmemunreachable: track kernel binder references
The kernel can hold references to binder objects that have no userspace
references.  Allow libmemunreachable to call into libbinder and
libhwbinder to get lists of kernel references.  Use undefined weak
symbols so that libmemunreachable will continue to work in processes
that do not have libbinder.

Test: memunreachable_binder_test
Bug: 28275695
Change-Id: I9eae73f2a51a49a7025ffe6309ccdc2693a2391b
2017-07-12 14:59:11 -07:00
Treehugger Robot
f42d02830d Merge "Add vendor_available to liblog_headers." 2017-07-12 21:07:26 +00:00
Steven Moreland
c30f248cd4 Add vendor_available to liblog_headers.
Renamed NDK headers to "liblog_ndk_headers"
(these names aren't used anywhere).

libutils_headers now properly export liblog_headers.

Test: with BOARD_VNDK_VERSION=current
Merged-In: I3a85385f588b84393c57fd6d1bcac620f708f0f1
Change-Id: I3a85385f588b84393c57fd6d1bcac620f708f0f1
2017-07-12 12:59:30 -07:00
Tom Cherry
08678e1f8b Remove ALOGD_IF_SLOW
ALOGD_IF_SLOW isn't intuitively implemented as it cannot handle
temporaries used as its parameters.  Since there are so few users of
it already and since it's just sugar on top of 2 otherwise trivial
lines, we opt to remove it entirely.

Bug: 62820330
Test: Build

Change-Id: Ie91b40cdaf650154203ccf0ca70e029cc097b350
Merged-In: Ie91b40cdaf650154203ccf0ca70e029cc097b350
2017-07-12 17:59:12 +00:00
Christopher Ferris
0c22c5646e Merge "A few cleanups." 2017-07-12 17:44:03 +00:00
Treehugger Robot
5607f36e01 Merge "libutils: liblog export headers" 2017-07-12 05:42:10 +00:00
Christopher Ferris
f6d5431273 A few cleanups.
- Cleanup the blueprint file a bit.
- Fix the formatting in DwarfMemoryTest.cpp.
- Fix the misnamed test MemoryBuffer.cpp to MemoryBufferTest.cpp.
- Add a function to find the location of the test files so it's not
  necessary to run the test in the same directory as the test files.

Bug: 23762183

Test: Builds and unit tests pass.
Change-Id: I5666972bd01f14b8ee47c518f1840f8aeb7fd08b
2017-07-11 19:10:34 -07:00
Treehugger Robot
5aee3ff22a Merge "Remove old LOG_EVENT_* code from libsysutils" 2017-07-12 00:11:50 +00:00
Baligh Uddin
97ba18ed7f Merge "Fix mips build." 2017-07-11 23:07:43 +00:00
Yifan Hong
087f3b74af Remove old LOG_EVENT_* code from libsysutils
As a side effect, this change fixes
libbsysutils => liblog dependencies. LOG_EVENT_*
macros are not defined for liblog.vendor.

Test: BOARD_VNDK_VERSION=current mma
Bug: 33241851
Bug: 63034227
Change-Id: I3df700d97481ec9aa59cf1796da1e991af28bdf5
2017-07-11 15:14:26 -07:00
Christopher Ferris
3517fe0413 Fix mips build.
Don't build for mips, none of this is supported on mips.

Bug: 23762183

Test: Mips build passes.
Change-Id: Iba89466a7bc13856f8fcd59ca0708a30f417b6c6
2017-07-11 15:06:19 -07:00
Robert Benea
3c7f566495 Merge "Use mem cgroups in libprocessgroup if they're available" 2017-07-11 21:52:39 +00:00