Commit graph

42450 commits

Author SHA1 Message Date
Paul Lawrence
c735bfe5da Fix bug in fs_mgr with calling vdc
Parameter count was hard coded to 3, make dynamic

Test: Metadata encrypted device boots

Change-Id: I25bb5adb7f27fc392564bfa6ed3ed2efeb5c5a40
2018-08-29 12:56:53 -07:00
Tom Cherry
7b02605bf2 Merge "Switch root to /system in first stage mount" 2018-08-29 17:05:40 +00:00
Treehugger Robot
90cd262d47 Merge "fastboot: Clean up the image array a bit." 2018-08-29 15:46:21 +00:00
Treehugger Robot
379e09927b Merge "fastboot: Flash boot partitions before rebooting to fastbootd." 2018-08-29 15:46:18 +00:00
David Pursell
1735516651 Merge "libcutils test: make set_sched_policy optional" 2018-08-29 15:33:24 +00:00
Elliott Hughes
11cd49c0c8 Merge "Move off safe-iop." 2018-08-29 15:23:09 +00:00
Treehugger Robot
49c4cd4d41 Merge "fs_mgr: set overlayfs_file context" 2018-08-29 14:32:00 +00:00
Treehugger Robot
9177927311 Merge "libdebuggerd: decode fdsan owner tags." 2018-08-29 01:50:19 +00:00
Mark Salyzyn
40b45b87c3 fs_mgr: set overlayfs_file context
Security minded hardening, let's not depend on reboot and restorecon.

Test: manual, make sure all sepolicy context are as expected before reboot
Bug: 109821005
Change-Id: I9d3419ce57be072daa55f704f75df7775fbaf5fb
2018-08-28 22:21:00 +00:00
Treehugger Robot
d2b29eb3af Merge "fs_mgr: overlayfs skip mount points that are more specific" 2018-08-28 22:20:35 +00:00
David Anderson
0debda098f fastboot: Clean up the image array a bit.
This makes the following changes to the images array:
 * The "optional_if_no_partition" flag is removed, as it was a temporary
   workaround for super.img.
 * The "flashall" flag is removed.
 * The "needed_for_fastbootd" flag is now an ImageType enum.

Bug: N/A
Test: fastboot builds, flashall works
Change-Id: Id000ea20cf83639cec2c9ae94f28c799b34606f1
2018-08-28 15:17:48 -07:00
Treehugger Robot
24f4ec6012 Merge "llkd: clear PR_SET_DUMPABLE" 2018-08-28 22:13:25 +00:00
Ryan Mitchell
1645312436 Merge "Open zips using _wopen on windows." 2018-08-28 21:26:29 +00:00
Josh Gao
8808f6c1c9 libdebuggerd: decode fdsan owner tags.
Test: debuggerd `pidof system_server` | grep " fd "
Change-Id: Ic4bb30b8602acf5912e776a61825d9645ec93c65
2018-08-28 13:48:08 -07:00
Elliott Hughes
85528e8a75 Move off safe-iop.
Bug: http://b/25224572
Test: ran tests
Change-Id: I6687015eedb28c69d1f57c9d3cd7324d4995e47a
2018-08-28 13:40:04 -07:00
Mark Salyzyn
62aeb16e1d fs_mgr: overlayfs skip mount points that are more specific
This is an optimization to limit us to an optimal set of overlay
mounts.  If an entry is identical or more specific (eg: /vendor is
less specific than /vendor/firmware_file), then no need to craft an
override for it.

We do the check in the setup and mount_all paths.

Test: confirm on devices with more specific mounts they do not get override
Bug: 109821005
Change-Id: If34775455fc7989903f70bc4f075c948db91ce37
2018-08-28 13:32:08 -07:00
Treehugger Robot
065cdf322f Merge "fs_mgr: correct support for ro.build.system_root_image" 2018-08-28 20:31:11 +00:00
David Pursell
6fd4b9b6b5 libcutils test: make set_sched_policy optional
set_sched_policy checks that operations related to the kernel config
CONFIG_CGROUP_SCHEDTUNE are working properly, but this config is not
required so devices without this were failing the test.

This CL splits set_sched_policy into two tests so that the policy and
timerslack tests can be skipped individually when devices don't support
them.

Bug: 113185515, 112550681
Test: libcutils_test{32,64} now pass on aosp_x86_64 emulator
Change-Id: I31638b61e033f0c96b63428a8d27d27dbc36bce3
2018-08-28 13:26:04 -07:00
Josh Gao
06512082d3 Merge changes from topic "fdsan_abort_msg"
* changes:
  debuggerd_test: add test for fdsan abort message.
  debuggerd_handler: receive abort messages via sigqueue(DEBUGGER_SIGNAL).
2018-08-28 20:20:21 +00:00
Mark Salyzyn
4832a8bd76 llkd: clear PR_SET_DUMPABLE
Test: compile
Bug: 33808187
Bug: 111910505
Bug: 80502612
Change-Id: I21ed937d79b3eb81b67ad145664ea82413fb65fd
2018-08-28 13:13:50 -07:00
David Anderson
95d4093b49 fastboot: Flash boot partitions before rebooting to fastbootd.
Userspace fastboot is required when flashing logical partitions. If for
some reason userspace fastboot is broken, the user may be stuck with
bootloader fastboot. To address this scenario, we now flash "boot",
"vbmeta", "recovery", "dtbo", and "dts" before booting into userspace
fastboot, using whatever fastboot is currently active.

Bug: 78793464
Test: fastboot flashall with device in bootloader fastboot
Change-Id: I773707bbbe9235c560416c70976e32fd8e52a5a3
2018-08-28 12:54:01 -07:00
Treehugger Robot
abf8ff7e81 Merge "fs_mgr: Better error messages in fs_mgr_update_verity_state." 2018-08-28 18:58:21 +00:00
Treehugger Robot
9adafe260d Merge "fastboot: Automatically reboot to userspace fastboot." 2018-08-28 18:19:45 +00:00
David Anderson
356386246d fs_mgr: Better error messages in fs_mgr_update_verity_state.
With verity disabled, fs_mgr_update_verity_state spews some confusing
error messages from device-mapper. This change checks whether a device
exists and logs an explicit error.

Bug: N/A
Test: AVB properties are set correctly on AVB device
      Messages are logged correctly with AVB disabled

Change-Id: If490c18cfec2d63ad784972c13ceef63d9aa3e4c
2018-08-28 10:42:00 -07:00
Chih-hung Hsieh
33f91de2c6 Merge "Use multiple patterns and emails in per-file syntax." 2018-08-28 17:03:44 +00:00
Ryan Mitchell
c77f9d380f Open zips using _wopen on windows.
Allows for opening zip files usng paths longer than 260 characters and
with unicode characters on Windows.

Bug: 113110184
Test: manual and libziparchive_tests
Change-Id: I9ce96ac2f1b1e448ae2a2f69c1d4cb3395ea79ee
2018-08-28 09:31:26 -07:00
David Anderson
1d887434da fastboot: Automatically reboot to userspace fastboot.
In order to flash logical partitions, "flashall" must be run against
userspace fastboot. When the bootloader supports the "reboot-fastboot"
command, we now attempt to automatically reboot into userspace fastboot.

We do this by closing the transport, sleeping for one second, and then
polling for a new connection until one is available. FastBootDriver is
then assigned the new transport.

Bug: 78793464
Test: fastboot flashall on device with logical partitions, while booted
      into bootloader fastboot

Change-Id: I6949871b93ab5e352784cabe0963c6ecfc0af36d
2018-08-28 09:07:40 -07:00
Mark Salyzyn
7bb77d321d Merge "adb: use fs_mgr_has_shared_blocks" 2018-08-28 15:58:18 +00:00
Mark Salyzyn
d3dc3c825a fs_mgr: correct support for ro.build.system_root_image
Failed to convert fstab entries from "/" to "/system" when setting
up directory tree.  Introduce an internal fs_mgr_mount_point to
simplify conversion.

Test: manual
Bug: 109821005
Change-Id: Iadc1e967b92702cf01b6522f8f13b2cf3685f2af
2018-08-28 07:38:58 -07:00
Josh Gao
bf06a40a0d debuggerd_test: add test for fdsan abort message.
Bug: http://b/112770187
Test: debuggerd_test
Test: bionic-unit-tests
Change-Id: Ia93761e89074aea4629b8d0f232c580d6f0f249c
2018-08-27 16:55:07 -07:00
Josh Gao
4843c18634 debuggerd_handler: receive abort messages via sigqueue(DEBUGGER_SIGNAL).
Make it possible for code such as fdsan that generates debugging
tombstones via raise(DEBUGGER_SIGNAL) to pass an abort message as well.

Bug: http://b/112770187
Test: debuggerd_test
Change-Id: Idc34263241c18033573e466da3a45aa6f716ddb3
2018-08-27 16:55:07 -07:00
Treehugger Robot
53ba407a89 Merge changes I4a8f1804,I3aa44c5a
* changes:
  SocketListener: use poll() instead of select()
  libsysutils: add some rudimentary tests
2018-08-27 22:23:42 +00:00
Bernie Innocenti
ca76859aca SocketListener: use poll() instead of select()
FD_SET is limited to 1024 file descriptors in Linux, which causes
processes with too many open files or connections to crash:

  FORTIFY: FD_ISSET: file descriptor 1024 >= FD_SETSIZE 128

The fix we used elsewhere is replacing select() with poll(), but in the
case of SocketListener we additionally need to replace the SocketClient
list with a map indexed by fd in order to avoid quadratic behavior on
each poll() wakeup.

Bug: 79838856
Test: device boots and appears to work normally, tests pass
Change-Id: I4a8f1804fa990d3db3a2c96b9acd60b2c7135950
2018-08-28 05:52:56 +09:00
Bernie Innocenti
763ccaa104 libsysutils: add some rudimentary tests
Test: atest libsysutils_tests
Change-Id: I3aa44c5af821c3161cf598b86216480d2424d336
2018-08-28 05:52:48 +09:00
Treehugger Robot
31e5fc5cf7 Merge "keychords.cpp: O_RDWR -> O_RDONLY" 2018-08-27 20:37:22 +00:00
Nick Kralevich
7ab971acf4 keychords.cpp: O_RDWR -> O_RDONLY
The keycodes functionality in init only needs to read key events. It
doesn't need to inject key events. A read-only file descriptor is
perfectly sufficient.

Test: pressing volume-up/volume-down/power still generates a bugreport
Change-Id: Iecbf21c544914334006ac6258c03df390f417e80
2018-08-27 12:20:34 -07:00
Chih-Hung Hsieh
3487e22b66 Use multiple patterns and emails in per-file syntax.
Test: build/make/tools/checkowners.py -c -v OWNERS
Change-Id: I60460b93903afbb01a87d7f11ac526fbde9f392c
2018-08-27 10:19:32 -07:00
Mark Salyzyn
7c2020bf64 adb: use fs_mgr_has_shared_blocks
Use fs_mgr_has_shared_blocks in fs_mgr for adb.

Test: compile
Bug: 109821005
Change-Id: Idccaa252c7630375e49f58727a014e61b50a96d6
2018-08-27 16:29:58 +00:00
Treehugger Robot
3a6c7519a3 Merge "fastboot: allow automatic detection of super location" 2018-08-27 14:41:24 +00:00
Treehugger Robot
472223ee35 Merge "getevent: O_RDWR -> O_RDONLY | O_CLOEXEC" 2018-08-25 15:22:59 +00:00
Treehugger Robot
993ae1f271 Merge changes Ifab22a4c,I03eb9c78
* changes:
  fs_mgr: add fs_mgr_has_shared_blocks and make default if overlayfs
  fs_mgr: add overlayfs for small-space filesystems
2018-08-25 00:14:47 +00:00
Mark Salyzyn
8fb0fb86a7 fastboot: allow automatic detection of super location
Add "super" to the table of known images so that automatic file
resolution can occur.  Add a flag to indicate if the image should
be flashed with flashall and set it to false for the new "super"
image, all else true.

Test: 'fastboot flash super' works.
      'fastboot flashall' does not flash super
Bug: 78793464
Change-Id: I5b85536b1d4890264531af357aba84a061d6df44
2018-08-24 15:24:41 -07:00
Tao Bao
eff7027a8c Merge changes from topic "init_defaults"
* changes:
  init: Build init_tests only for the first arch.
  init: init_defaults uses more shared libraries.
2018-08-24 21:48:41 +00:00
Nick Kralevich
38e9f2320a getevent: O_RDWR -> O_RDONLY | O_CLOEXEC
No need to open the device read write. Just open it read-only.

This is a partial redo of
https://android-review.googlesource.com/c/platform/system/core/+/334583
which was reverted in
https://android-review.googlesource.com/c/platform/system/core/+/342483

Bug: 30861057
Test: ran getevent, saw correct output, played with device
Change-Id: I426efd68f39dcd97d3ee23c13ed1a9ed96cb4c2e
2018-08-24 12:16:17 -07:00
Tao Bao
a3d36a8ce7 init: Build init_tests only for the first arch.
Not all the dependent shared libs are installed on device with both
arches. For example, we don't have 32-bit `libfs_mgr.so` or
`libbootloader_message.so` on marlin, which would cause 32-bit
`init_tests` to fail.

Bug: 112494634
Test: Run (64-bit) init_tests on marlin.
Test: `m -j continuous_native_tests` with aosp_marlin-userdebug. Check
      that only 64-bit init_tests is included in
      `continuous_native_tests.zip`.
Change-Id: I999d58750d48c34df7dbabccf8863a6ccaf0b83c
2018-08-24 11:28:54 -07:00
Treehugger Robot
07c2c9a58d Merge "Added support to fuzzy_fastboot for more sparse tests" 2018-08-24 17:54:24 +00:00
Tao Bao
66209ca9bf init: init_defaults uses more shared libraries.
This CL switches init_defaults and thus init_second_stage to depend on
commonly used shared libraries. In particular, use the following shared
libs that have been available on device (under both of normal boot and
recovery):
 - libbootloader_message
 - libext4_utils
 - libfs_mgr
 - libhidl-gen-utils
 - libkeyutils
 - liblogwrap

The following transitive dependencies have been dropped. They were only
needed when including the above libs statically. Dropping them doesn't
further affect the size though.
 - libfec
 - libfec_rs
 - libsquashfs_utils

With the change, the second stage init size has been reduced from
1094328 to 627992 bytes (aosp_taimen-userdebug), with no new shared libs
installed.

Also evaluated the impact of using `libprotobuf-cpp-lite.so` and
`libseccomp_policy.so`. It doesn't look beneficial -- at least not right
now with `init` as the singler user.
 - statically linked them both: 627992-byte
 - with libprotobuf-cpp-lite.so: 605880 (init) + 262624 (.so)
 - with libseccomp_policy.so: 605848 (init) + 32208 (.so)

Bug: 112494634
Test: `mmma -j system/core/init` with aosp_marlin-userdebug
Test: Flash the marlin build on device. Run init_test.
Test: Boot into recovery successfully.
Change-Id: I49debe9066ff36dfda55b08266862e29e2bfc96b
2018-08-24 10:54:24 -07:00
Treehugger Robot
a37dada049 Merge "Fix mac build breakage due to missing usb_osx.cpp in Android.cpp file for libfastboot2" 2018-08-24 17:25:10 +00:00
Aaron Wisner
ab2645514d Added support to fuzzy_fastboot for more sparse tests
Test: Pixel 2
Change-Id: Ibd491336ace4f346c3900a61bca30ac3023e4f21
2018-08-24 16:22:54 +00:00
Aaron Wisner
a5ad20aecc Fix mac build breakage due to missing usb_osx.cpp in
Android.cpp file for libfastboot2

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

Test: Build on osx
Change-Id: I6151e37581ac332e4d5cfb5e40feb3ea0e3093df
2018-08-24 10:53:04 -05:00