Commit graph

44937 commits

Author SHA1 Message Date
Bowgo Tsai
a0f8b05d91 first-stage mount: support using other avb_keys
This change allows specifying additional avb keys to verify a fstab
entry. It can be used together with the original 'avb' flag. When both
'avb' and 'avb_keys' are present, it will try to use avb_keys to verify
this partition and extract the AVB descriptor from the end of it first.
When avb_key fails, it falls back to searching the AVB descriptor in the
built-in /vbmeta (and its chained partitions) with the matched partition
name.

An example of a fstab file:

system  /system  ext4  ro,barrier=1  wait,slotselect,avb=vbmeta,logical,first_stage_mount,avb_keys=/avb/gsi.avbpubkey
vendor  /vendor  ext4  ro,barrier=1  wait,slotselect,avb,logical,first_stage_mount

The overhead of adding an additional 'avb_keys' should not be significant,
as the typical size of a AVB Hashtree descriptor for /system is usually
less than 1000 bytes. e.g., on crosshatch, it's about 600 bytes, which
takes less than 1 millisecond for the following call to return failure.

   auto avb_standalone_handle = AvbHandle::LoadAndVerifyVbmeta(*fstab_entry);

We also checked the time spent on init's first stage on crosshatch, with the
following CL to set ro.boottime.init.first_stage. The testing result
shows no significant difference between them as well.

https://android-review.googlesource.com/c/platform/system/core/+/934536

With an additional avb_keys entry for /system
    [ro.boottime.init.first_stage]: [728]
    [ro.boottime.init.first_stage]: [720]
    [ro.boottime.init.first_stage]: [722]

Without an additional avb_keys entry for /system
    [ro.boottime.init.first_stage]: [730]
    [ro.boottime.init.first_stage]: [728]
    [ro.boottime.init.first_stage]: [725]

Bug: 124491153
Test: boot a device with above fstab settings

Change-Id: I0c81f816efb0dd40c93da2df304f2e215df9d105
2019-04-09 13:38:05 +00:00
Treehugger Robot
f4ccb804b6 Merge "Test is-logical command for vendor and boot partitions." 2019-04-08 22:27:13 +00:00
Treehugger Robot
198536e321 Merge "mini-keyctl: move logs to stdout" 2019-04-08 21:34:24 +00:00
Victor Hsieh
b20e062ff9 mini-keyctl: move logs to stdout
Also, print key id in padd/add like keyctl(1).  This makes local
debugging and integration test easier.

Test: run all commands manually in shell, see expected output
Bug: None
Change-Id: I6be6ea9e273e80e7d5848da5cf348da8308a62c1
2019-04-08 10:59:54 -07:00
Mark Salyzyn
f14652c30b Merge "init: fixes to README.mk" 2019-04-08 17:10:25 +00:00
Mark Salyzyn
b833d17de2 init: fixes to README.mk
Corrected a few technical, spelling and grammar errors.

Test: none
Bug: 129780532
Change-Id: Ia05f44c782d94a3bb4224fc6929ac325852e0c41
2019-04-08 10:06:49 -07:00
Nick Kralevich
ba80ab1373 Merge "zip_archive.cc: Use static cast instead of masking" 2019-04-08 16:23:51 +00:00
Nick Kralevich
9780fc3511 Merge "zip_writer_test.cc: fix implicit integer truncation" 2019-04-08 16:23:20 +00:00
Treehugger Robot
66b0c31f60 Merge "Increase adb-remount timeout" 2019-04-08 15:13:47 +00:00
Treehugger Robot
8e5bd5a247 Merge "Update GSI keys for dynamic system image" 2019-04-08 13:41:47 +00:00
Treehugger Robot
b626177d63 Merge "Revert "Check for data races when reading JIT/DEX entries."" 2019-04-06 17:09:10 +00:00
Hridya Valsaraju
61a5bc6cf4 Test is-logical command for vendor and boot partitions.
Vendor must be a logical partition and boot must not be a logical
partition.

Test: fuzzy_fastboot --gtest_filter=*Logical*
Bug: 117220134
Change-Id: Ifc6f2f715ca92cd1fe779e8fce2d6a10a1f140b9
2019-04-05 11:30:21 -07:00
David Srbecky
b9cc4fbb26 Revert "Check for data races when reading JIT/DEX entries."
This reverts commit 85b5fecec9.

Reason for revert: Breaks ART tests, reverting to investigate.

Change-Id: I1bb905407e87cbd4f832646651133a9caf6fcfc8
2019-04-05 18:23:32 +00:00
Oliver Nguyen
3a6a01bdee Merge "Move gcov output to /data/misc/trace" 2019-04-05 18:11:30 +00:00
Nick Kralevich
2871411902 zip_writer_test.cc: fix implicit integer truncation
converting from a size_t to a uint8_t results in a loss of precision,
which triggers ubsan's implicit-unsigned-integer-truncation checker.
Make the conversion explicit.

This change allows the ziparchive-tests to pass with ubsan enabled.

Test: atest ziparchive-tests
Test: compiles and boots
Bug: 122975762
Change-Id: I63f28b58f1ca1f4c57323494cb1f4a41e0f34fba
2019-04-05 10:08:44 -07:00
Treehugger Robot
50bd6f0eb9 Merge "Add dependency on libdl_android" 2019-04-05 16:45:49 +00:00
Nick Kralevich
c0bf36647b zip_archive.cc: Use static cast instead of masking
Although ubsan's implicit-unsigned-integer-truncation sanitizer may be
happy, this code still performs an implicit conversion from a wider
width data structure to a narrower width data structure. Rather than
masking the bits, make the conversion explicit. This keeps ubsan happy
as well as addressing a -Wconversion warning.

This change addresses comments from the post-submit review
of a4e5433660.

Test: compiles and boots.
Bug: 122975762
Change-Id: I1fa6d6f8a6fcfb93ba9916b7d2b3564ca1d8caf3
2019-04-05 09:32:14 -07:00
Treehugger Robot
be51525424 Merge "Do not restrict .fs-verity keyring in debuggable build" 2019-04-05 16:21:15 +00:00
Treehugger Robot
55ba959c13 Merge "cutils: add ashmem_init" 2019-04-05 09:35:11 +00:00
Matthew Maurer
feae89302e Merge "Enable Trusty Gatekeeper@1.0" 2019-04-05 05:15:11 +00:00
Nick Kralevich
adcfbf804f Merge "zip_archive.cc: fix ubsan false positive" 2019-04-05 03:23:22 +00:00
Tim Murray
8879ed7f2a cutils: add ashmem_init
Add a new ashmem_init function that only dlopens libashmemd_client.
This allows the library to be preloaded in the zygote.

Test: boots, works
Bug: 129543489

Change-Id: Ie106791edf381654f085203c266c9f9c0df35cfc
2019-04-04 17:30:25 -07:00
Victor Hsieh
851026d569 Do not restrict .fs-verity keyring in debuggable build
Test: add logs, see expected behavior
Bug: 112038861
Change-Id: Ib133d2206a7696caaf42ab5f0a6d79aa5308b332
2019-04-04 16:48:57 -07:00
Treehugger Robot
8c82af2454 Merge "Allow to build non-sparse super image." 2019-04-04 23:16:06 +00:00
Nick Kralevich
a4e5433660 zip_archive.cc: fix ubsan false positive
std::hash returns a 64 bit value, which is truncated to a 32 bit value
in ComputeHash. ubsan's implicit-unsigned-integer-truncation doesn't
like this implicit truncation and crashes the program. Explicitly strip
off the top order bits after computing the hash.

Remove the windows specific version of the hash computation. The windows
compile now uses clang, so this code is obsolete. This also avoids us
having to add __attribute__((no_sanitize("integer"))) to the windows
code.

This is needed to support Android booting with ubsan's
implicit-unsigned-integer-truncation option enabled.

Test: compiles and boots
Bug: 122975762
Change-Id: I2f05fbf5ffee8e90a66a6fda32e80de9cca246c0
2019-04-04 14:53:11 -07:00
Treehugger Robot
5c58e092f3 Merge "adb: defuse CHECK on IOVector::append of an empty block." 2019-04-04 21:02:02 +00:00
Oliver Nguyen
360eb055e0 Move gcov output to /data/misc/trace
Gcov output location has world write on debuggable builds.

Test: N/A
Bug: 128524141
Change-Id: Ia6b94e26352dd66f5c6819f6157b4b73dd777a90
2019-04-04 13:57:59 -07:00
Elliott Hughes
17d9938894 Merge "Remove r in R." 2019-04-04 20:48:01 +00:00
Treehugger Robot
21aa749ec7 Merge "Avoid leaking property values into logs on error" 2019-04-04 20:19:31 +00:00
Yifan Hong
a482da1d76 Allow to build non-sparse super image.
- Rename SparseBuilder to ImageBuilder, WriteSplitSparseFiles
  to WriteSplitImageFiles, WriteToSparseFile to WriteToImageFile, etc.
- Add sparsify argument to ImageBuilder, WriteToImageFile, and
  WriteSplitImageFiles

This allows lpmake to write non-sparse super image directly. Virtual
devices needs non-sparse images to work on.

Test: lpmake without --sparse
Test: liblp_test
Bug: 120041578

Change-Id: I76ee09efd02df7caaa8abd37a55ae0bebf9cfa29
2019-04-04 11:33:38 -07:00
Elliott Hughes
0865266048 Remove r in R.
Obsoleted by toybox `devmem` instead.

Test: builds
Change-Id: I35c1ed2cfa9b3073cab405cfaf3c989fb2a72aa2
2019-04-04 10:45:12 -07:00
Treehugger Robot
cc5e2dc2e8 Merge "CgroupSetupCgroups: don't leak fd." 2019-04-04 17:27:27 +00:00
Nick Kralevich
9ca898fff8 Avoid leaking property values into logs on error
The purpose of having fine grain read/write control over the property
space is to help ensure the confidentiality of data stored in
properties. Leaking property values into the dmesg buffer on errors
exposes the value outside of the access control rules specified by
policy.

(arguably this is also true for the property name, not just the value.
However, property names are exposed in other places now, so the
incentive to fix this is lower. It would also take away a valuable
debugging tool.)

Test: compiles
Change-Id: I4a0634b8b5e4fd2edf718eaf7343940df627366d
2019-04-04 10:15:25 -07:00
Treehugger Robot
744677aaf5 Merge "Open image files in binary mode" 2019-04-04 04:38:26 +00:00
Hridya Valsaraju
1a6f6feff4 Open image files in binary mode
This is required for read() to function correctly
in Windows since it behaves differently in text mode and
binary mode and may cause unpredictable behavior depending
on the contents of the image file.

Bug: 129281908
Test: fastboot.exe flashall
Change-Id: I64370af44a050bafea60ff1b0b2be18cc531480a
2019-04-03 18:14:14 -07:00
Treehugger Robot
9e34eee481 Merge "libcgrouprc: version script: linux only" 2019-04-04 00:58:47 +00:00
Christopher Ferris
82a93856be Merge "Fix off by one reading build id." 2019-04-04 00:57:40 +00:00
Christopher Ferris
1760b45709 Fix off by one reading build id.
Update unit tests and add new build id displaying in offline unwinds.

Bug: 129873279

Test: All unit tests pass.
Test: Verify that debuggerd displays build id properly.
Change-Id: I97f4a204842447a20c812f535a458155b937d5e1
2019-04-03 14:51:51 -07:00
Yifan Hong
5ece395328 libcgrouprc: version script: linux only
mac builds doesn't support version script.
This fixes the build.

Test: pass

Change-Id: Ia3d06e4eff05b41982b3dfbb946efa41358b2c76
2019-04-03 14:44:46 -07:00
Treehugger Robot
73bb342956 Merge "libfiemap_writer: test pinned file bit" 2019-04-03 21:31:18 +00:00
Josh Gao
3443b77415 adb: defuse CHECK on IOVector::append of an empty block.
Bug: http://b/129706741
Test: treehugger
Change-Id: I35a35d20d179a155adb4fe83078739fcaf517136
2019-04-03 12:56:22 -07:00
Yifan Hong
8df75fc304 CgroupSetupCgroups: don't leak fd.
- If file is unlinked, the mmapped region is still there.
- If file is truncated, a SIGBUS will be seen, and holding
  the fd doesn't help.

Test: boots (sanity)
Bug: 123664216
Change-Id: I6683804bc795fab6798891a4471e5fe58fbffe13
2019-04-03 12:13:26 -07:00
Yifan Hong
25d42eeaa6 Merge changes from topic "libprocessgroup_rc"
* changes:
  CgroupSetupCgroups -> CgroupSetup
  Add libcgrouprc to ld.config.*.txt.
  libprocessgroup: use libcgrouprc to read cgroup.rc
  libprocessgroup_setup: use libcgrouprc_format
  libprocessgroup: Move CgroupSetupCgroups() to libprocessgroup_setup
  libprocessgroup: Add libcgrouprc
  libprocessgroup: Add libcgrouprc_format
2019-04-03 19:08:51 +00:00
Julien Desprez
c25a9da325 Increase adb-remount timeout
Unblocked the previous error we are now reaching the
default 5min timeout which is too short for this test.
Increase it to 1h.

Test: None
Bug: 117670584
Change-Id: I7fe40e54a7fb978392ee919226c0f05413e7349e
2019-04-03 08:27:29 -07:00
Bowgo Tsai
b9b9a68f49 Update GSI keys for dynamic system image
Bug: 112293933
Test: tree hugger
Change-Id: Ia5fd08410fd680b8fd3676cfc4daae1caf1ff425
2019-04-03 17:54:01 +08:00
Treehugger Robot
cd68bda4ec Merge "Replace reboot-fastboot by reboot fastboot" 2019-04-03 08:24:34 +00:00
David Srbecky
59c70a5b75 Merge "Check for data races when reading JIT/DEX entries." 2019-04-03 07:15:39 +00:00
Yifan Hong
9d7b89abea CgroupSetupCgroups -> CgroupSetup
Test: builds
Bug: 123664216
Change-Id: I47c46ca9ba5c1fbf3f9f7a1b185dc48b058b1e32
Merged-In: I47c46ca9ba5c1fbf3f9f7a1b185dc48b058b1e32
2019-04-02 22:31:57 -07:00
Yifan Hong
063b6beef0 Add libcgrouprc to ld.config.*.txt.
Test: boots (sanity)
Bug: 123664216
Change-Id: I23c3ece44816e4e213f9630b915e19978a259823
Merged-In: I23c3ece44816e4e213f9630b915e19978a259823
2019-04-02 22:31:57 -07:00
Yifan Hong
53e0deb7b2 libprocessgroup: use libcgrouprc to read cgroup.rc
Use the LL-NDK library to read cgroup.rc.

As a side-effect, the CgroupController class is changed
to a wrapper of ACgroupController* from the library. The
class itself essentially becomes the pointer, and can be
trivially copied. Modify all client code for this change.

Test: builds and boots
Bug: 123664216

Change-Id: I635d9885db62e82f37421f6d20f59c84a6f4cbb2
Merged-In: I635d9885db62e82f37421f6d20f59c84a6f4cbb2
2019-04-02 22:31:57 -07:00