Commit graph

43327 commits

Author SHA1 Message Date
Josh Gao
68b5d0c3e3 adb: flush stderr after logging on Windows.
Test: set ADB_TRACE=1 & adb.exe server nodaemon
Change-Id: Ibb109618be7eaae49461a306e34ff79451ec330e
2018-11-12 14:08:40 -08:00
Josh Gao
cd85556151 adb: libusb: don't set interface alternate setting.
Match behavior with the legacy implementation.

Test: ADB_TRACE=1 adb server nodaemon
Change-Id: If1451871f252ef4499b3bb887e947169f8d2432f
2018-11-12 14:08:40 -08:00
Treehugger Robot
42b38900d7 Merge "fastboot: pin USB interface versions on darwin." 2018-11-12 20:23:26 +00:00
Tom Cherry
13856a05e7 Merge "Reland: "init: chroot from recovery to /first_stage_ramdisk"" 2018-11-12 16:38:59 +00:00
Nick Kralevich
adfe8c4545 Merge "Set bin directories to 0751" 2018-11-12 05:06:50 +00:00
Treehugger Robot
a4e4e39421 Merge "init parses *.rc files from APEXes" 2018-11-12 02:53:41 +00:00
Eran Messeri
be0ab0a6e0 fastboot: pin USB interface versions on darwin.
Similar to the change to adb in Id26760bc62c89a1f7ef67511b21f9d9252ab69f3,
pin the interface version to IOUSBFamily 5.0.0.

Bug: 119264733
Test: Manual
Change-Id: Ied9164532c0ba6f20415dafecb0c774578aa5c57
2018-11-11 18:14:58 -08:00
Nick Kralevich
f4fc922f0b Set bin directories to 0751
Currently, /system/bin, /system/xbin, /product/bin, and /vendor/bin
are 0755, which allows any process to iterate through those
directories and list out the contents. For the vast majority of
processes, this is unnecessary. They only need to know whether a
particular binary exists or doesn't exist, but they don't need to
know the other binaries within those directories.

Allowing this is particularly problematic for SELinux. In particular,
some third party Android applications try to examine every file in
the bin directories, generating SELinux audit noise along the
way. This audit noise makes it harder to see real bugs, and falsely
implies an architectural dependency between the application and random
files in directories like /system/bin.

This change removes the ability to list the contents of the various bin
directories, preventing random probing by such apps. The ability to
execute files, or to probe a specific file by name, remain unchanged.

Addresses SELinux denials similar to the following:
  avc: denied { getattr } for comm="Thread-11" path="/system/bin/atrace" dev="dm-0" ino=189 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:atrace_exec:s0 tclass=file permissive=0 app=uk.co.santander.santanderUK
  avc: denied { getattr } for comm="Binder:26637_2" path="/system/bin/atrace" dev="dm-0" ino=168 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:atrace_exec:s0 tclass=file permissive=0 app=com.tencent.mm
  avc: denied { getattr } for comm="Thread-12" path="/system/bin/apexd" dev="dm-0" ino=451 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:apexd_exec:s0 tclass=file permissive=1 app=com.grppl.android.shell.CMBlloydsTSB73

Shell access to these directories continues to be allowed, to allow for
host-side CTS tests.

Also adjust the indentation of some clang directives, to make the
presubmit hooks happy.

Test: Device boots and no apparent problems.
Change-Id: Ibe75682fac1983d39f3f479a5850ab5a96f6627d
2018-11-11 11:29:10 -08:00
Treehugger Robot
b6ae0e4fc3 Merge "liblp: Add a helper method for upgrading metadata on retrofit devices." 2018-11-10 22:28:41 +00:00
David Anderson
140d053c02 liblp: Add a helper method for upgrading metadata on retrofit devices.
This adds a new MetadataBuilder constructor, NewForUpdate, that can be
used by update_engine to simplify upgrading metadata. It is safe to call
whether or not the device is a retrofit. If the metadata has block
devices assigned to a specific slot, and that slot matches the slot
suffix, it will ensure that an equivalent entry exists for the alternate
slot.

Thus, if the source slot is _a and the target slot is _b, and the
metadata has "system_a" as a block device but not "system_b", this will
automatically add "system_b" as a block device.

Bug: 116802789
Test: liblp_test gtest
Change-Id: Ie89d4dbf4c708b5705e658220227ebf33fcb1930
2018-11-09 16:03:40 -08:00
Tom Cherry
866c08c0ac Reland: "init: chroot from recovery to /first_stage_ramdisk"
When using the recovery image as a trampoline to boot the system,
first chroot from the recovery image to /first_stage_ramdisk, to
minimize differences between these two boot paths.

Primary motivation is due to the fact that the basename of each mount
point is used by device-manager to name its nodes, and the previous
code that created used /system_recovery_mount as the mount point for
system.img broke AVB.  Instead of hacking around that issue, this
change unified mounting for the recovery trampoline and true first
stage ramdisk paths.

Change when relanding: the original change skipped the move mount from
/first_stage_ramdisk to / and only did a chroot instead.  This was a
mistake that resulted in the subsequent move mount of /system to / to
mount over the '/' directory instead of moving that mount.  This
change uses a bind mount of /first_stage_ramdisk to itself instead of
skipping the first move mount.

Bug: 114062208
Test: AVB works with blueline_mainline
Change-Id: I65207edfe98531892da2eafcbff19b438c9c64fe
2018-11-09 14:58:46 -08:00
Jiyong Park
c240440eec init parses *.rc files from APEXes
Init now parses *.rc files from the APEXs when the apexd notifies the
mount event via apexd.status sysprop.

Bug: 117403679
Test: m apex.test; adb root; adb push <builtfile> /data/apex; adb reboot
adb root; adb shell setprop ctl.start apex.test; dmesg shows that init
tries to start the service which doesn't exist.

[   47.979657] init: Could not ctl.start for 'apex.test': Cannot find '/apex/com.android.example.apex/bin/test': No such file or directory

Change-Id: I3f12355346eeb212eca4de85b6b73257283fa054
2018-11-10 04:18:09 +09:00
Tom Cherry
223114008c Merge "Revert "init: chroot from recovery to /first_stage_ramdisk"" 2018-11-09 18:51:14 +00:00
Tom Cherry
e087a6a3bb Revert "init: chroot from recovery to /first_stage_ramdisk"
This reverts commit 56999b41af.

Reason for revert: Something is broken here; we're not switching to /system properly.

Change-Id: I777fedcfb545c11275c9cc12f99b99a2423959a0
2018-11-09 18:47:26 +00:00
Josh Gao
6a08b2c255 Merge "adb: pin USB interface versions on darwin." 2018-11-09 18:45:52 +00:00
Tom Cherry
64ae77e526 Merge "init: chroot from recovery to /first_stage_ramdisk" 2018-11-09 17:01:41 +00:00
Treehugger Robot
55e4577e90 Merge "liblp: Fix io_tests." 2018-11-09 05:33:10 +00:00
David Anderson
3d08636934 liblp: Fix io_tests.
These broke after recent changes to use IPartitionOpener in more places.
The io_tests must now give block device info to TestPartitionOpener.

Bug: N/A
Test: liblp_test gtest
Change-Id: I0a6505c7223e74507dc13184069fdc34bb6b81e4
2018-11-08 19:04:05 -08:00
David Anderson
3f814c8370 Merge "liblp: Split super.img for retrofit devices." 2018-11-09 01:26:17 +00:00
Josh Gao
b35ee22887 adb: pin USB interface versions on darwin.
It's possible to build against an SDK that's newer than the OS that
we're actually running via Xcode update, and Apple increments the
unversioned IOKit interface IDs to the newest version on every release,
which leads to mysterious failures to acquire an interface.

Pin the interface versions to IOUSBFamily 5.0.0, which shipped on OS X
10.7.3.

Bug: http://b/119264733
Test: ./test_device.py
Change-Id: Id26760bc62c89a1f7ef67511b21f9d9252ab69f3
2018-11-08 16:49:46 -08:00
Tom Cherry
56999b41af init: chroot from recovery to /first_stage_ramdisk
When using the recovery image as a trampoline to boot the system,
first chroot from the recovery image to /first_stage_ramdisk, to
minimize differences between these two boot paths.

Primary motivation is due to the fact that the basename of each mount
point is used by device-manager to name its nodes, and the previous
code that created used /system_recovery_mount as the mount point for
system.img broke AVB.  Instead of hacking around that issue, this
change unified mounting for the recovery trampoline and true first
stage ramdisk paths.

Bug: 114062208
Test: AVB works with blueline_mainline
Change-Id: Iffb154962b6e160150917e068f1e7d0bf7cb84e7
2018-11-08 15:47:36 -08:00
David Anderson
7165154334 liblp: Split super.img for retrofit devices.
On retrofit devices, we need images that can be flashed in the
bootloader for the component "super"partitions. This change rewrites
SparseBuilder so that it generates one sparse image per block device,
and now handles partitions that span across multiple block devices.

A new API function has been added to write the set of sparse images to
an output folder.

Bug: 118887112
Test: manual test, flash split images
Change-Id: Iff56efdcb7bdfd5bc8dd7ff44e8234e091ac2346
2018-11-08 14:19:42 -08:00
David Anderson
9e04f62895 Merge "liblp: Allow automatic slot suffixing of partition names." 2018-11-08 22:13:51 +00:00
Josh Gao
9c27dde899 Merge "adb: switch version back to 40." 2018-11-08 21:31:54 +00:00
Chih-hung Hsieh
141fcfb5c5 Merge "Revert "Use ld when lld fails"" 2018-11-08 20:27:58 +00:00
Yabin Cui
318591509f Merge "run-as: add ":fromRunAs" selector in seinfo." 2018-11-08 17:55:30 +00:00
David Anderson
76cde4173a liblp: Allow automatic slot suffixing of partition names.
On retrofit devices, an OTA package or super_empty.img won't know which
slot it applies to. This is not an issue on devices shipping with
dynamic partitions, since they ship on the "a" slot.

To work around this, partitions and block devices can be flagged as
"auto-slot-suffixed". This indicates that ReadMetadata should
automatically append a slot suffix before returning the metadata. This
flag is added by MetadataBuilder when requested, and will be enabled via
lpmake separately.

After ReadMetadata has applied slot suffixes, it takes care to remove
the slot-suffix flag. This prevents the suffix from being applied twice,
if for example the metadata is then imported into a MetadataBuilder.

Bug: 116802789
Test: liblp_test gtest
      retrofit device boots

Change-Id: Ic7de06d31253a8d5b8d15c0d936175ca2939f857
2018-11-08 09:51:03 -08:00
Chih-hung Hsieh
060056d4f2 Revert "Use ld when lld fails"
This reverts commit 29e54f8e75.

Bug: 78118944
Reason for revert: This now passed TH boot tests.

Change-Id: I5bcff44a96ade6354b1f3247ebe1f47f3898de96
2018-11-07 23:54:10 +00:00
Treehugger Robot
71c29a9ce0 Merge "fs_mgr: overlayfs earlier kernels do not need override_creds=off" 2018-11-07 20:51:07 +00:00
Mark Salyzyn
6a11694c1b fs_mgr: overlayfs earlier kernels do not need override_creds=off
Kernels at or older than 4.6, the overlayfs drivers do not need,
or support, override_creds=off.  Drop using the mount option.

Commit 3fe6e52f062643676eb4518d68cee3bc1272091b introduced the
need for override_creds=off, and none of the kernels that contain
this patch without the patch that introduces override_creds can
be used with Android.

Test: compile
Bug: 118882257
Bug: 109821005
Change-Id: I832c8ca3fce0269bdef4ce988541adb7ba9662ed
2018-11-07 11:05:18 -08:00
Treehugger Robot
76b420f38d Merge "Fix bootchart" 2018-11-07 07:36:35 +00:00
Treehugger Robot
94514b75e7 Merge "[GPU Service] Add independent AID for gpu service." 2018-11-07 00:53:01 +00:00
Yabin Cui
97e3bb3a94 run-as: add ":fromRunAs" selector in seinfo.
It notifies libselinux that the setcontext request is from run-as.
And libselinux will set current process to runas_app domain, which
can execute app data files.

Bug: 118737210
Test: run CtsSimpleperfTestCases.
Change-Id: Ib94087f910786dd5d2a2b2e3b1bf76dfa7131ced
2018-11-06 15:31:59 -08:00
David Anderson
a97d6e36d5 Merge "fastboot: Query the name of the super partition." 2018-11-06 22:59:17 +00:00
Treehugger Robot
7d87981f79 Merge "adb: overlayfs failed to remount /system" 2018-11-06 22:49:45 +00:00
Treehugger Robot
d016c75104 Merge "fastboot: Fix flashing both slots with dynamic partitions." 2018-11-06 22:48:45 +00:00
Treehugger Robot
a50225ae36 Merge "run-as: Use 2-space clang-format." 2018-11-06 21:01:49 +00:00
Peiyong Lin
126c19b6ec [GPU Service] Add independent AID for gpu service.
BUG: 118347356
Test: Build, flash and boot, `adb shell cmd gpuservice vkjson` to verify

Change-Id: Ic8c4154668d09b3dbfedf4a7c0dc376a01a9bde6
2018-11-06 12:52:01 -08:00
Treehugger Robot
612c2854ad Merge "fs_mgr: enable DT fstab based on its status node appropriately" 2018-11-06 20:30:44 +00:00
David Anderson
88fd7e60d0 Merge "liblp: Fix flashing metadata to multiple block devices." 2018-11-06 19:45:26 +00:00
David Anderson
90fe0a43ab fastboot: Query the name of the super partition.
This patch adds a new variable, "super-partition-name", to query the
name of the super partition (with a slot suffix if it has one). The
fastboot flashing tool has been updated to query this variable.

Since the super partition name can no longer be determined without
fastbootd, the presence of super_empty.img is used to test for
dynamic partition support rather than the presence of a super partition.

Bug: 116802789
Test: fastboot flashall on retrofit device
Change-Id: If830768eba6de7f31ac3183c64167fae973c77a4
2018-11-06 11:43:04 -08:00
David Anderson
96a9fd4063 fastboot: Fix flashing both slots with dynamic partitions.
When updating the super partition, attempt to preserve partitions from
the other slot. If any partition can't be preserved, fail and require a
wipe (-w) to proceed. This allows two bootable builds to be flashed to
both slots.

The preserve operation can fail if the metadata is not compatible with
the old partition layout. For example, if the partition references a
group that no longer exists, or a group changed its capacity, or the
metadata's block device list or list contents changed.

Bug: N/A
Test: liblp_test gtest
      fastboot flashall --skip-secondary

Change-Id: I53fdd29bc1f0ef132005a93d3cf1cdcd7f2fc05f
2018-11-06 11:43:03 -08:00
Yabin Cui
bcbffddb10 run-as: Use 2-space clang-format.
Bug: none
Test: none.
Change-Id: I8fc2f9a534675347bae5af0ce12b0bf3d7c32d55
2018-11-06 11:18:44 -08:00
Tom Cherry
1eb04561c1 fs_mgr: enable DT fstab based on its status node appropriately
Follow the typical device tree guidelines that a node is only enabled
if it does not have a 'status' property or if it does have a 'status'
property with a value of 'ok' or 'okay'.

Bug: 117933812
Test: status='disabled' DT fstab is not present when reading fstab
Change-Id: Icb4cbe654757658460aabfdb952d71fb8354e09e
2018-11-06 10:44:51 -08:00
David Anderson
fa36e318cf Merge "init: Regenerate uevents for dependent super partition devices." 2018-11-06 17:52:17 +00:00
Mark Salyzyn
beb4cb8e43 adb: overlayfs failed to remount /system
Regression introduced commit bb1efbd1c6

By not first checking if overlayfs mount on /system is in /proc/mounts
remount fails to discover the override and take the selected action.

Test: adb-remount-test.sh
Bug: 109821005
Change-Id: I1f0bae22caae1bca84fc1e33b508b54d98f4ed5c
2018-11-06 09:49:10 -08:00
Sandeep Patil
c68ac11c8a Merge "libmeminfo: Add libmeminfo to gather global and per-process memory stats" 2018-11-06 13:28:06 +00:00
David Anderson
f89b1df1a5 init: Regenerate uevents for dependent super partition devices.
This patch adds another uevent-regeneration pass to the first stage
mount. When the super partition spans multiple block devices, we need
/dev/block/by-name symlinks to have been created before we begin mapping
dynamic partitions.

Bug: 116802789
Test: retrofit device boots
Change-Id: I00bb277e1d81385a457c5b4205a95d8fbe365bb2
2018-11-05 17:53:49 -08:00
Treehugger Robot
32b3f60a7a Merge "Suppress lint warnings on google-default-arguments" 2018-11-06 01:25:47 +00:00
Treehugger Robot
a123155f3e Merge "Fix run-as for non-owner users" 2018-11-06 01:17:37 +00:00