Commit graph

30387 commits

Author SHA1 Message Date
Jesse Hall
081806e5f2 sync: Add NDK sync.h and libsync
The new header provides an updated interface to libsync appropriate
for the NDK. Clients use existing syscalls where possible (e.g. poll()
instead of sync_wait()), and the remaining functions return structures
used in mainline Linux kernels rather than the Android staging sync
framework.

Over time, framework clients will be migrated to using the NDK
interface, which will eventually replace the current internal
interface. The only difference is the header will be named
<android/sync.h> in the NDK and <sync/sync.h> internally.

Bug: 35138793
Test: sync-unit-tests on bullhead
Change-Id: Ieb3649b80565393e26b604416158438d32c2a256
2017-02-23 18:44:50 -08:00
Jesse Hall
077ffd5055 sync: Use correct type in size calculation
The previous and current types are the same size, so this wouldn't
have caused a bug in practice, but it is confusing, and would have
been a problem in the unlikely event we changed the size of one of the
types.

Test: sync-unit-tests on bullhead
Change-Id: Ic43b81f3b4ff214af86b6b6d4d02c648f95d0c4b
2017-02-23 18:44:50 -08:00
Tom Cherry
917cca2f04 Merge "Make Condition use CLOCK_MONOTONIC" am: 7f932afefc am: 36ba2fbef7
am: 83f76a20a8

Change-Id: I214548f856db2826b7a4ea96a98950fee7d20a27
2017-02-23 22:09:39 +00:00
Tom Cherry
83f76a20a8 Merge "Make Condition use CLOCK_MONOTONIC" am: 7f932afefc
am: 36ba2fbef7

Change-Id: Ib15f34fcb36761dbbc7f3094a3a76a771792b593
2017-02-23 22:07:09 +00: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
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
bb5a8380b0 Merge changes from topic 'early-mount-support' am: 4bd3facbb1 am: e0d7b830f0
am: 5f08cb2aea

Change-Id: I40a70549a545d9d1dd4f007f5fd259102785412c
2017-02-23 07:23:37 +00:00
Sandeep Patil
5f08cb2aea Merge changes from topic 'early-mount-support' am: 4bd3facbb1
am: e0d7b830f0

Change-Id: Icd0db777090c067dba1ba01349a0d1f58adda1e9
2017-02-23 07:21:36 +00: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
6624cdb2b1 Merge "adb: add adb host-features, report libusb status." am: 311de0ac28 am: 98ee7349f0
am: a06225bf97

Change-Id: Ie47d74db9582fc5fbc1cac826630d25f2b9a0e3c
2017-02-23 04:40:55 +00:00
Josh Gao
a06225bf97 Merge "adb: add adb host-features, report libusb status." am: 311de0ac28
am: 98ee7349f0

Change-Id: I43ce6513d1615fe9841f166e0963411aabba8ec9
2017-02-23 04:39:24 +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
Elliott Hughes
fa5b4577cb Merge "Address property service DoS." am: 8d302763ab am: 811971d949
am: 6aaa953ddb

Change-Id: I38d680ccfe949582e3d5b25f5f7e7d53843817ad
2017-02-23 02:37:17 +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
6aaa953ddb Merge "Address property service DoS." am: 8d302763ab
am: 811971d949

Change-Id: Id867417dc6491af129151cde91913a0d0208ebec
2017-02-23 02:19:16 +00: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
Mark Salyzyn
9f27c6985d Merge "logd: add getEventTag id= command" am: 3e3aaca4c3 am: b7987ce8c4
am: 9bd6e36a9f

Change-Id: I5995e912626100462dd5a706d5e3af7d92488155
2017-02-22 23:33:55 +00:00
Mark Salyzyn
8cb338e085 Merge "liblog: logprint followup" am: 60c77ed265 am: 7cb2658b26
am: f70743f2ae

Change-Id: Ie969e99b7b4e6e743bfb1087aebdf2b4bd7cc05f
2017-02-22 23:33:43 +00:00
Mark Salyzyn
9bd6e36a9f Merge "logd: add getEventTag id= command" am: 3e3aaca4c3
am: b7987ce8c4

Change-Id: I9a06ab0061a357bf51d782a03eaf420435966ed6
2017-02-22 23:15:13 +00:00
Mark Salyzyn
f70743f2ae Merge "liblog: logprint followup" am: 60c77ed265
am: 7cb2658b26

Change-Id: I4f8409ad193976b2d8089cbf7982fb2255c29cdd
2017-02-22 23:15:01 +00: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
Mark Salyzyn
3e3aaca4c3 Merge "logd: add getEventTag id= command" 2017-02-22 23:09:20 +00:00
Mark Salyzyn
60c77ed265 Merge "liblog: logprint followup" 2017-02-22 23:08:02 +00:00
Elliott Hughes
b005d90816 Address property service DoS.
Bug: http://b/35166374
Test: ran new test
Change-Id: I94cf5750f0d2dc87f4a118b2c63b16255ef30fd2
2017-02-22 14:54:15 -08:00
Mark Salyzyn
407537f798 logd: add getEventTag id= command
This is the precursor for "Plan B" recovery when access to
/dev/event-log-tags is blocked to untrusted zones.  Also
deals with mitigating issues with long-lived mappings that
do not update /dev/event-log-tags when dynamically changed.

Test: gTest logd-unit-test --gtest_filter=logd.getEventTag_42
Bug: 31456426
Bug: 35326290
Change-Id: I3db2e73763603727a369da3952c5ab4cf709f901
2017-02-22 14:16:31 -08:00
Mark Salyzyn
8dcd94b2cd liblog: logprint followup
Add comment and braces to add maintenance clarity.

Test: gTest logcat-unit-tests
Bug: 35326290
Change-Id: Ie25b42faba19ae3cf52d4c6cefc4fc539ec23e79
2017-02-22 14:16:31 -08:00
Sandeep Patil
9de748f745 fs_mgr: add a generic fs_mgr_get_boot_config internal API
depending on when fs_mgr is trying to read the configuration passed into
the kernel commandline, it may be able to read it successfully.
Specially in the case when init has not initialized properties.

This change adds a new fs_mgr_get_boot_config() API to be used by all
fs_mgr code in order to get filesystem parameters specified in kernel
command line or device tree. This way the fs_mgr code doesn't have to
handle the "early" cases separately anywhere.

Test:
Tested angler boot with both /system and /vendor mounted in init
first stage.
Tested sailfish to make sure /vendor can be continued to be
mounted early without verity

Change-Id: I9a44cdfc32681f714c5d73ae55c3deda95c02545
2017-02-22 12:58:15 -08:00
Sandeep Patil
e9da79bd44 init: early_mount: create device node for verity metadata partition
Most devices pass the veritymode through 'androidboot.veritymode' kernel
cmdline partition. However, for those who don't, the verity state is
read from a different block device whose path it passed to "verify="
fs_mgr option in fstab.

This change add support for such a case if the partition that needs to
be mounted early requires this additional block device to load the
verity state from.

Note that, there can only be 1 partition to get the verity state
regardless of the number of partitions we enable verity for.

Bug: 27805372

Test: Test angler by removing the metdata argument in fstab when it
boots fine. Tested by adding the argument when it fails to boot as
veritymode gets set to EIO during early mount due to lack of access to
properties as expected.

TODO: fs_mgr must pull the veritymode from kernel cmdline or device tree
by itself

Change-Id: I9e62b8c1bf2c0ae0365677df697a0cbe9e5810c1
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-22 11:30:35 -08:00
Sandeep Patil
05ff38ba43 init: early_mount: disallow partitions to be verified at boot
While technically possible, the verification at boot basically will
block init for as long as the entire partition is read while nothing
else is running. Disallow that as this is not going to be used anywhere.

Bug: 27805372
Test: boot angler with verifyatboot fs_mgr option for early mounted
vendor partition. That resulted in a panic() as expected.

Change-Id: I9da5caa163cae8bce6dbfb630f0ed5605ea044a0
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-22 11:22:53 -08:00
Sandeep Patil
0a3e36fbb1 init: early_mount: add support to mount verity enabled partitions early
support mounting partitions early regardless of their "verified" status.
uses the newly exported fs_mgr APIs to split verity setup and mount
operations.

b/27805372

Test:
 Angler:
 - Early mount /vendor without dm-verity
 Sailfish:
 - Early mount /vendor without dm-verity
 - Early mount /vendor with dm-verity

TODO:
 add support for metadata partition used in angler
to load dm-verity data

Change-Id: Ie2768d4d895c19d045293c573773ee7bb03fff99
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-22 11:22:53 -08:00
Sandeep Patil
4129f20aaf fs_mgr: make fs_mgr_setup_verity public API
Consequently this removes the 'early' version of the exact same API.
This is to be used by early mount code where we need to do
1. setup verity
2. create verity device
3. mount partition
as separate steps since that happens during init first stage.

b/27805372

Test: Boot sailfish successfully

Change-Id: I01abecfdfa210d3e240a291ddcb3d2e9ed39ede6
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-22 11:22:53 -08:00
Sandeep Patil
d2462570b8 fs_mgr: fix the fs_mgr_setup_verity param name
The 'verify_dev' parameter for fs_mgr_setup_verity is confusing, since
it doesn't necessarily control the "verification" part of the function.
Instead, it merely allows the caller to skip the
wait_for_dm_verity_device part of the function. So, rename that
parameter for what it is.

b/27805372

Test: Boot sailfish

Change-Id: I024e02fd728f5cd5bb333d9c3b512861731fa215
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-22 11:22:53 -08:00
Sandeep Patil
971a460c5b init: refactor to allow successive device_init calls
device_init opens the uevent socket and sehandle when called.
For early_mount however, depending on the fs_mgr flags we may call this
in order to run coldboot for device mapper, dm-verity devices etc.
So the change makes sure we don't try to re-open the uevent socket,
file context handle and selinux status on successive calls to
device_init from within the same process.

b/27805372

Test: Boot saifish successfully

Change-Id: Ifa0e665403211684183efb9be66e4e8d0d86a206
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-22 11:22:49 -08:00
TreeHugger Robot
89df46202d Merge "storaged: include start time in IO usage dumpsys" 2017-02-22 08:08:31 +00:00
Josh Gao
aeb35cf02b Merge "adb: remove win32 dependency on libwinpthread-1.dll." am: 1d73abb443 am: ef260561f3
am: b17ca7f367

Change-Id: I4545e81ce41a8e18c9b31d79fb1f98035c9c3cc3
2017-02-22 02:15:21 +00:00
Josh Gao
b17ca7f367 Merge "adb: remove win32 dependency on libwinpthread-1.dll." am: 1d73abb443
am: ef260561f3

Change-Id: Id5d828b6d68d93b5d6aa5a1d2e701c72340b88a0
2017-02-22 02:12:52 +00:00
Josh Gao
ef260561f3 Merge "adb: remove win32 dependency on libwinpthread-1.dll."
am: 1d73abb443

Change-Id: Ia3a2c84844eb6a2446a2722fe80248fed0e8a996
2017-02-22 02:10:51 +00:00
Treehugger Robot
1d73abb443 Merge "adb: remove win32 dependency on libwinpthread-1.dll." 2017-02-22 02:06:40 +00:00
Elliott Hughes
83e2d41cad Merge "Add timeout support to android::base::WaitForProperty." am: ff692a5ace am: 6bbdfa3260
am: 6f4e2cf604

Change-Id: I159037a0fc54831494ce9f4e3dcf2b4237afd9d3
2017-02-22 01:52:28 +00:00
Elliott Hughes
6f4e2cf604 Merge "Add timeout support to android::base::WaitForProperty." am: ff692a5ace
am: 6bbdfa3260

Change-Id: I72b4839593fe67be88ba5ff5dd95822af8f8d819
2017-02-22 01:49:57 +00:00
Elliott Hughes
6bbdfa3260 Merge "Add timeout support to android::base::WaitForProperty."
am: ff692a5ace

Change-Id: Icbcce8c39374116164d191883b618155059d1102
2017-02-22 01:48:00 +00:00
Treehugger Robot
ff692a5ace Merge "Add timeout support to android::base::WaitForProperty." 2017-02-22 01:43:31 +00:00
Mark Salyzyn
aaa49f2c02 Merge "liblogcat: redirect logcat output correctly for -Q" am: 151fec4032 am: f2b62408b2
am: a119bcc8f6

Change-Id: Ic0b73fa49ef8b88c2e89740ce1dee71b7df2113e
2017-02-22 01:31:49 +00:00
Mark Salyzyn
a119bcc8f6 Merge "liblogcat: redirect logcat output correctly for -Q" am: 151fec4032
am: f2b62408b2

Change-Id: If045db1a428c44bf801c1602dd38bc2c10bc818a
2017-02-22 01:29:48 +00:00
Mark Salyzyn
f2b62408b2 Merge "liblogcat: redirect logcat output correctly for -Q"
am: 151fec4032

Change-Id: I462f7bfbee1ec06575768f4271394b41707aefce
2017-02-22 01:27:48 +00:00