Commit Graph

28906 Commits

Author SHA1 Message Date
Wei Wang 4d71bc5350 fs_mgr: fix const parameter in fs_mgr_do_tmpfs_mount
Bug: 35425974
Test: mma, marlin/angler boot
Change-Id: Ibadd04ad3a7c4ea184a6344d566302d577d8fee3
2017-02-24 19:33:53 -08:00
Jaekyun Seok 9afcdc825d Merge "Treblize init.rc location"
am: 76e9a180a8

Change-Id: I8415b555308b8ad489413f9e99f6e73ee9caa17e
2017-02-25 02:50:32 +00:00
Treehugger Robot 76e9a180a8 Merge "Treblize init.rc location" 2017-02-25 02:41:29 +00:00
Elliott Hughes 5498d39b84 Merge "Add cross-platform <android-base/endian.h>."
am: 8a16081fa1

Change-Id: I6306de56d135fbc8666648b919432abe5ad05006
2017-02-25 02:16:56 +00:00
Elliott Hughes 8a16081fa1 Merge "Add cross-platform <android-base/endian.h>." 2017-02-25 02:07:05 +00:00
Jaekyun Seok 4ec72cc25f Treblize init.rc location
Treblization requires to locate partner-specific modules in its own
partition. So their own init.rc file could be located in /odm or
/vendor.
This CL is to support those locations for the init.rc.
Additionally thic CL modified import parser to support importing a
relative path.

Test: building succeeded and tested on sailfish with enabling early
mount.
Bug: 35269867

Change-Id: I1bce924a32c8a2b53fb5d981d35d758cf9ddd9a6
2017-02-25 08:06:12 +09:00
Sandeep Patil ad384fc992 Merge changes from topic 'fs_mgr_dt'
am: dbb40b64e9

Change-Id: I8e54aecb4825f4adc3fd92ceff1da76e1c4b227b
2017-02-24 23:05:00 +00:00
Treehugger Robot dbb40b64e9 Merge changes from topic 'fs_mgr_dt'
* changes:
  fs_mgr: refactor: consolidate device tree file reading in one place
  fs_mgr: consolidate DT compatible check
2017-02-24 23:01:08 +00:00
Elliott Hughes 1dbd976200 Add cross-platform <android-base/endian.h>.
Bionic has <sys/endian.h>, glibc <endian.h>, and macOS and Windows have
nothing. This has often been annoying.

Bug: N/A
Test: new tests
Change-Id: I2a40c570df6a9bb30607ace1af653265938cc4b8
2017-02-24 14:03:36 -08:00
Sandeep Patil 4cd9a46916 fs_mgr: refactor: consolidate device tree file reading in one place
If Device tree values are read for comparison, they produce false
negatives with std::strings due to trailing '\0'. This change
consolidates the triming of trailing null into a single helper function
to be used everywhere fs_mgr reads DT values for comparison or other
reasons where it wishes to have the trailing null trimmed.

b/27805372

Test: Boot sailfish w/ early mount /vendor

Change-Id: If71efc830dc440323df764c7461867e71ed6515b
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-24 13:29:33 -08:00
Sandeep Patil e396c607ff fs_mgr: consolidate DT compatible check
Fixes the compatible check in fs_mgr_boot_config by consolidating the
check in a single privately exported function within fs_mgr (i.e.
is_dt_compatible()).

b/27805372

Test: Boot sailfish w/ early mount

Change-Id: Ie2d1646b81cf9eba8d16828ca8cf2c75156c294c
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-24 13:29:26 -08:00
Colin Cross a05a666c01 Merge "Make libutils test compile on the host"
am: f5fd4888ce

Change-Id: Id45309c93a25cba0aa632757eebee341d2dc8d98
2017-02-24 21:19:52 +00:00
Colin Cross f5fd4888ce Merge "Make libutils test compile on the host" 2017-02-24 21:16:01 +00:00
Josh Gao 00613c52ca Merge "Revert "adb: remove win32 dependency on libwinpthread-1.dll.""
am: 87eb0fc3d0

Change-Id: I58794c4e5325a2f1bd0812bed2d451c82ba97056
2017-02-24 21:09:05 +00:00
Josh Gao 87eb0fc3d0 Merge "Revert "adb: remove win32 dependency on libwinpthread-1.dll."" 2017-02-24 21:02:25 +00:00
Colin Cross 155c983ad1 Make libutils test compile on the host
Reapply of Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78 with
RefBase_test.cpp and Looper_test.cpp removed from mac builds.

Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
Test: out/host/darwin-x86/nativetest64/libutils_tests/libutils_tests
Change-Id: I5979b296a8500b5697d94d64fc441363047adcea
2017-02-24 08:10:06 -08:00
Richard Uhler 5682e001e9 Merge "Revert "Make libutils test compile on the host""
am: 16f4fb9c4e

Change-Id: I855db58666f2a2b2dda4bb9bb36d7c4df44a3903
2017-02-24 11:14:43 +00:00
Richard Uhler 16f4fb9c4e Merge "Revert "Make libutils test compile on the host"" 2017-02-24 11:10:43 +00:00
Richard Uhler 26bfee52b3 Revert "Make libutils test compile on the host"
Fails mac build: "system/core/include/utils/Looper.h:25:10: fatal error: 'sys/epoll.h' file not found"

This reverts commit afa891e85e.

Change-Id: Ib558b8f5a303b55ab32a399d338d8aac0fae32b2
2017-02-24 09:36:13 +00:00
Colin Cross 92466ff6ea Merge changes Icd5f39ae,I2a4e956c
am: 6d795c2883

Change-Id: Iada421394365a767712b553706a5897b21b2ae5a
2017-02-24 07:04:39 +00:00
Treehugger Robot 6d795c2883 Merge changes Icd5f39ae,I2a4e956c
* changes:
  Make libutils test compile on the host
  Fix ODR issue in StrongPointer_test.cpp
2017-02-24 06:59:11 +00:00
Colin Cross afa891e85e Make libutils test compile on the host
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
Change-Id: Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78
2017-02-23 21:25:19 -08:00
Colin Cross fe06c63301 Fix ODR issue in StrongPointer_test.cpp
StrongPointer_test.cpp's Foo was colliding with RefBase_test.cpp's
Foo.

Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
      from later CL
Change-Id: I2a4e956c88a07cec72d7ce734cf06c58134a4235
2017-02-23 21:25:18 -08:00
Colin Cross 6d7751a13b Merge "Fix multiton issue"
am: 78b285b367

Change-Id: I56c87e6d4d8b5f5364d2c37c95cf0097d6071985
2017-02-24 04:07:49 +00:00
Treehugger Robot 78b285b367 Merge "Fix multiton issue" 2017-02-24 04:03:11 +00:00
Colin Cross b0145091a7 Fix multiton issue
I385a05a3ca01258e44fe3b37ef77e4aaff547b26 broke Singleton in the
same way that 544e3e3606 had already
fixed once.  Fix it again, the next CL will add tests.

This affected cases where two libraries referenced the same singleton,
the one that was supposed to define the singleton was already loaded,
and then the second library was dlopen'd.

Bug: 35674422
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
      from later CL
Change-Id: I87c64f95ed294a887e67a6c11be3072299789f01
2017-02-23 18:22:46 -08:00
Sandeep Patil 2eb715d866 Merge changes from topic 'early-mount-verity'
am: 93072f2ce3

Change-Id: Idf13b00a6e69f96d8496377ec2ce58944599666e
2017-02-24 02:18:54 +00:00
Treehugger Robot 93072f2ce3 Merge changes from topic 'early-mount-verity'
* changes:
  adb: early-mount: fix verity toggle through adb for early mount
  early_mount: fs_mgr: move all fstab logic into fs_mgr
2017-02-24 02:13:50 +00:00
Tom Cherry fb13dab611 Merge "Check setegid() return values"
am: 0d24c8f852

Change-Id: I4642339cbd5f03113994a9f2042dca8dc645e209
2017-02-24 00:59:53 +00:00
Elliott Hughes 8d8c3026a8 Merge "Add some basic docs for <android-base/logging.h>"
am: 3b5089371b

Change-Id: I5bc37c1c113f2448954d15ec7f635e7dba56f21c
2017-02-24 00:59:42 +00:00
Treehugger Robot 0d24c8f852 Merge "Check setegid() return values" 2017-02-24 00:55:36 +00:00
Elliott Hughes 3b5089371b Merge "Add some basic docs for <android-base/logging.h>" 2017-02-24 00:55:17 +00:00
Sandeep Patil f134fe07b8 adb: early-mount: fix verity toggle through adb for early mount
verity toggle through adb failed to work for early mount due to fstab
entries being moved into kernel/dt. This change fixes that by using the
new fs_mgr_read_fstab_default() api that will make sure all fstab
entries (from dt as well as from /fstab.{ro.hardware}) are combined
before returning the fstab object.

b/27805372

Test: early mount /system and /vendor on angler.
- test adb disable-verity && adb root to ensure rebooted instance
doesn't have 'partition.system.verified' property set. i.e. verity is
indeed disabled.

- test adb enable-verity && adb root to ensure rebooted instance does
have 'partition.system.verified' property set, i.e. verity is enabled.
also verified by trying to do 'adb remount' which correctly warns about
verity

Change-Id: Iffdcc0a0b959a65c326219bd4e9e41cba9ec7c88
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-23 16:48:52 -08:00
Sandeep Patil c20c0c2cdd early_mount: fs_mgr: move all fstab logic into fs_mgr
With init parsing fstab fragments from kernel separately, the fs_mgr
would completely miss the device tree entries. That leads to things like
'adb remount' to go through without warning for verity even if /system
is verified. This happens because 'verity_update_state' completely
misses the partitions passed to android through the device tree.

solution is to teach fs_mgr about device tree fstab entries and add 2
new public APIs.

1. fs_mgr_read_fstab_dt() - reads device tree and returns fstab
generated from it.

2. fs_mgr_read_fstab_default() - reads both device tree fstab and
/fstab.{ro.hardware} and returns the combined table.

This also reduces the hardcoded /fstab.{ro.hardware} occurence only to
fs_mgr and for eveyone who wants to read the "default" fstab must be
changed to call fs_mgr_read_fstab_default() instead. e.g. adb.

b/27805372

Test: Angler was used since it has 2 early mounted partitions instead of
one. 1 verified and 1 unverified.
- Boot angler successfully without early mount
- Boot angler successfully with /vendor early mount and test if 'adb
remount' warns us about verity
- Boot angler successfully with both /system and /vendor early mounted
and ensure 'adb remount' warns us about verity.
- check partitions.system.verified status after /system early mount ot
ensure it is set to VERITY_MODE_DEFAULT.
- 'adb disable-verity' with early mounted /system doesn't work due to
missing changes in adb

TODO:
change adb to use the new fs_mgr_read_fstab_default() API

Change-Id: I82038d87c7a44488e938acce2cc1082c08f6f73a
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-23 16:48:43 -08:00
Tom Cherry 36ba2fbef7 Merge "Make Condition use CLOCK_MONOTONIC"
am: 7f932afefc

Change-Id: I755d45661ad5575db6dbd3e86f2860e718a6ff0c
2017-02-23 22:05:38 +00:00
Treehugger Robot 7f932afefc Merge "Make Condition use CLOCK_MONOTONIC" 2017-02-23 22:00:27 +00:00
Tom Cherry 0506b18a36 Check setegid() return values
The clang static analyzer is complaining that we are not checking the
setegid() return value, so let's add these checks.  We should never
fail to return to AID_ROOT, so fail hard in this case.

Bug: 26962034
Test: Boot bullhead
Test: export WITH_STATIC_ANALYZER=1 and run 'mm' in the project directory
Change-Id: I62e95b045c5734305c71502871b6cf17f152edbc
2017-02-23 13:50:21 -08:00
Josh Gao 3d4d973e82 Revert "adb: remove win32 dependency on libwinpthread-1.dll."
This reverts commit c2e984eec8.

Move the change to build/make, so that other win32 binaries get this as
well.
2017-02-23 13:16:52 -08:00
Tom Cherry 1fb04ff4e5 Make Condition use CLOCK_MONOTONIC
Changes to the REALTIME clock can cause Condition::waitRelative() to
timeout early or delayed.  This behavior is undesired and new since
https://android-review.googlesource.com/#/c/181058/ moved the
underlying pthread_cond_timedwait() implementation to use absolute
timeouts rather than relative ones.  Having Condition use
CLOCK_MONOTONIC prevents these timeout issues.

Bug: 34592766
Bug: 35678943
Test: Boot bullhead
Test: Ensure time changes do not cause Condition::waitRelative() to
timeout early or delayed

Change-Id: I3a8d7a48f9b42fe990c3c7331313b6d85aa546f9
2017-02-23 10:58:05 -08:00
Sandeep Patil e0d7b830f0 Merge changes from topic 'early-mount-support'
am: 4bd3facbb1

Change-Id: I5552daa47fd96119b704c41913979e782155cbb2
2017-02-23 07:19:42 +00:00
Treehugger Robot 4bd3facbb1 Merge changes from topic 'early-mount-support'
* changes:
  fs_mgr: add a generic fs_mgr_get_boot_config internal API
  init: early_mount: create device node for verity metadata partition
  init: early_mount: disallow partitions to be verified at boot
  init: early_mount: add support to mount verity enabled partitions early
  fs_mgr: make fs_mgr_setup_verity public API
  fs_mgr: fix the fs_mgr_setup_verity param name
  init: refactor to allow successive device_init calls
  fs_mgr: add fs_mgr_do_mount_one() API
2017-02-23 07:16:18 +00:00
Josh Gao 98ee7349f0 Merge "adb: add `adb host-features`, report libusb status."
am: 311de0ac28

Change-Id: I2b4f99aa5babb601a88209f7c6b2157b6496c58f
2017-02-23 04:36:55 +00:00
Treehugger Robot 311de0ac28 Merge "adb: add `adb host-features`, report libusb status." 2017-02-23 04:29:47 +00:00
Josh Gao 5d1756ceb5 adb: add `adb host-features`, report libusb status.
Add a 'host-features' command to get the features of the currently
running host adb server. Abuse it to report libusb status.

Bug: http://b/34983123
Test: adb host-features; adb kill-server; ADB_LIBUSB=1 adb start-server; adb host-features
Change-Id: I0e8d503a2dbdff9002ebb6ce8a298498a9421422
2017-02-22 18:19:21 -08:00
Elliott Hughes 811971d949 Merge "Address property service DoS."
am: 8d302763ab

Change-Id: I61da77b9d380ecc4a552aab1138de0c838dfb401
2017-02-23 02:17:16 +00:00
Treehugger Robot 8d302763ab Merge "Address property service DoS." 2017-02-23 02:14:00 +00:00
Elliott Hughes 9f4c8f753b Add some basic docs for <android-base/logging.h>
Bug: http://b/35360600
Test: N/A
Change-Id: I3de6bbe4afc7ca6adbfb0c9b01a5a3d4c2c35cfc
2017-02-22 18:02:46 -08:00
Mark Salyzyn 71919f4f5d liblogcat: measure performance
Existing dummy benchmark converted to a single-pass benchmark.

Add support for ">[filename]" interpretation in liblogcat, helpful to
provide more consistent benchmark results when sending output to
/dev/null.

NB: results are not consistent as there is a roundtrip to logd
    service, but they are indicative of better performance for
    liblogcat.

Benchmark                                Time           CPU Iterations
----------------------------------------------------------------------
BM_logcat_stat_popen_libc         35221677 ns     603314 ns        100
BM_logcat_stat_popen_liblogcat    15871805 ns     579398 ns       1287
BM_logcat_stat_system_libc        39037825 ns     319882 ns        100
BM_logcat_stat_system_liblogcat    9896755 ns     762610 ns       1310
BM_logcat_dump_popen_libc        776206254 ns  131448772 ns          5
BM_logcat_dump_popen_liblogcat   610674905 ns  118709624 ns          6
BM_logcat_dump_system_libc       512191254 ns     388724 ns         10
BM_logcat_dump_system_liblogcat  443897570 ns  377215696 ns          2

Test: logcat-benchmarks --benchmark_filter='BM_logcat_stat*|BM_logcat_dump*'
Bug: 35326290
Change-Id: Ie94900a3070487f45742f6c0789b5b3cf036df34
2017-02-22 16:06:24 -08:00
Mark Salyzyn b7987ce8c4 Merge "logd: add getEventTag id= command"
am: 3e3aaca4c3

Change-Id: I57671afa8b9a8219fef9f5f690260ecae682d9ca
2017-02-22 23:12:42 +00:00
Mark Salyzyn 7cb2658b26 Merge "liblog: logprint followup"
am: 60c77ed265

Change-Id: I89e5d0b5b52bcd1e9b17e07fd17f14479c25791b
2017-02-22 23:12:30 +00:00