Commit graph

28512 commits

Author SHA1 Message Date
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
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
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
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
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
f2b62408b2 Merge "liblogcat: redirect logcat output correctly for -Q"
am: 151fec4032

Change-Id: I462f7bfbee1ec06575768f4271394b41707aefce
2017-02-22 01:27:48 +00:00
Treehugger Robot
151fec4032 Merge "liblogcat: redirect logcat output correctly for -Q" 2017-02-22 01:23:40 +00:00
Mark Salyzyn
f9dbdbc5f5 liblogcat: redirect logcat output correctly for -Q
The -Q option is used in emulator and it fails to redirect the
output of logcat to the desired file.

This CL fixes that problem.

There is no gTest because of /proc/cmdline sniffing for this option.
manually tested on /dev/qemu_pipe inside emulator

Test: manual
Bug: 35326290
Change-Id: I282da685e90450aadb2a989a0517dc3b1bb6634d
2017-02-22 01:21:02 +00:00
Bin Chen
9fc353f608 Merge "init: minor fix to READEME.md"
am: a20c678d45

Change-Id: I2b949b6e96754afc313795f23d35ea1f828d6e8a
2017-02-22 00:28:10 +00:00
Treehugger Robot
a20c678d45 Merge "init: minor fix to READEME.md" 2017-02-22 00:22:28 +00:00
Josh Gao
c2e984eec8 adb: remove win32 dependency on libwinpthread-1.dll.
Explicitly link against the static libwinpthread.a to avoid a
dependency on the dll.

Also, make the tests link against libbase statically.

Bug: http://b/31665213
Test: wine adb.exe
Test: wine adb_test.exe
Change-Id: Ifd41afcb1756a4b9b6db12e102b4db502e73d846
2017-02-21 15:30:11 -08:00
Mark Salyzyn
cafb1b7776 Merge "liblog: Harden log_id check."
am: c280143d9b

Change-Id: I2a87f95287be7ee8009cc9c56c7bbc82f1673b99
2017-02-21 23:10:58 +00:00
Mark Salyzyn
c280143d9b Merge "liblog: Harden log_id check." 2017-02-21 23:06:34 +00:00
Elliott Hughes
03edc9f764 Add timeout support to android::base::WaitForProperty.
Bug: http://b/35201172
Test: ran tests
Change-Id: I025aa0217dc94fabf0eb076b285a84866b00e741
2017-02-21 14:57:15 -08:00
Jerry Zhang
d59b93a5f5 Merge "adb: set max_rw to USB_FFS_BULK_SIZE explicitly"
am: b63d47356a

Change-Id: I84f691f38c05a42fc7e4fd326b3be6d4732c32ca
2017-02-21 22:57:05 +00:00
Jerry Zhang
b63d47356a Merge "adb: set max_rw to USB_FFS_BULK_SIZE explicitly" 2017-02-21 22:52:57 +00:00
Bin Chen
a08f002c23 init: minor fix to READEME.md
Change-Id: I149c2a8f2053ac4dcc61bea6fa8c57f4c7b73c9e
Signed-off-by: Bin Chen <bin.chen@linaro.org>
2017-02-22 09:38:25 +11:00
Jerry Zhang
f3fb7de3c8 adb: set max_rw to USB_FFS_BULK_SIZE explicitly
Sometimes when endpoint_alloc returns ENODEV,
max_rw will end up being a value that is too
big.

Bug: 35634401
Test: push/pull files
Change-Id: Iaa81a3311b1855e2a835562cdf7a46ff4399feb1
2017-02-21 14:37:07 -08:00
Mark Salyzyn
d69e801fe8 liblog: Harden log_id check.
Logd currently checks against LOG_ID_MAX and LOG_ID_KERNEL to
determine if a given log_id is available.  liblog uses only
LOG_ID_KERNEL.  While this matches with the comments in log/log_id.h
to always keep LOG_ID_KERNEL at the end it does not match with other
checks that logd makes, causing inconsistent behavior.  This
inconsistency is noticable on devices that errantly rewrite
LOG_ID_MAX to not equal LOG_ID_KERNEL + 1.  For log buffers with
id's greater than LOG_ID_KERNEL, liblog reports that logd is
unavailable while logd would accept the request.

The guideline is to not use buffer ids above LOG_ID_KERNEL.
This hardening change prevents an inconsistency that results if these
guidelines are not followed.  Partners are urged instead to increase
LOG_ID_KERNEL locally to match their LOG_ID_MAX - 1 when they add new
local log buffers in their private builds.

Signed-off-by: Evan Ralston <eralston@amazon.com>
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: compiles. no functional change
Change-Id: Icd4b12ac79c1e5cd1d8a32f67a9795797580aad5
2017-02-21 22:29:19 +00:00
Mark Salyzyn
88af7ccd58 Merge "liblogcat: LOCAL_C_INCLUDE_DIRS correction"
am: 01815fdcc5

Change-Id: I28a7645ab5375f234b74c6555f774510cb364a8e
2017-02-21 19:41:50 +00:00
Treehugger Robot
01815fdcc5 Merge "liblogcat: LOCAL_C_INCLUDE_DIRS correction" 2017-02-21 19:36:30 +00:00
Michael Wright
8eef0a5dfb Merge "Revert "Only allow system to write to existing input nodes.""
am: 05009d9336

Change-Id: I74bc2d510ab4f978df3e90402b59681f8cbe7be2
2017-02-21 19:02:47 +00:00
Treehugger Robot
05009d9336 Merge "Revert "Only allow system to write to existing input nodes."" 2017-02-21 18:56:05 +00:00
Mark Salyzyn
2a03cd7158 Merge changes I9494ce71,Idc14e4ad,I30de692e,Ieed3223b,I63d0667a
am: ee57bbd9f8

Change-Id: I382a3a1e9c95a5e94a7930ed5a508f5e2b157349
2017-02-21 18:01:32 +00:00
Isaac Chen
e60efc1b0b Merge "Removed cpusets/schedboost build time dependency."
am: d3f8d28db2

Change-Id: Ic864fd54b2ddc225ce54050efb116c87cbf1180f
2017-02-21 17:52:41 +00:00
Michael Wright
14667c19cd Revert "Only allow system to write to existing input nodes."
This reverts commit 344e929e6d.

Bug: 35301292
Change-Id: Ib6805c986c0aa88d14652de59ad4602b1cce8b56
2017-02-21 17:12:59 +00:00
Mark Salyzyn
eb40816fb8 liblogcat: LOCAL_C_INCLUDE_DIRS correction
Test: compile
Bug: 35326290
Change-Id: I62b46443a6b9149577e85d4f512c3946b467a1fb
2017-02-21 08:48:29 -08:00