Commit graph

56819 commits

Author SHA1 Message Date
Automerger Merge Worker
0cef47636d Merge "init.rc: disable kernel module autoloading" am: e7f014da9c
Change-Id: I2b83cdd3d121a3633a26157a4087f9a56f195121
2020-03-12 21:39:22 +00:00
Eric Biggers
e7f014da9c Merge "init.rc: disable kernel module autoloading" 2020-03-12 21:19:38 +00:00
Automerger Merge Worker
a5876cd674 Merge "Add OptimizeSourceCopyOperation" am: 6ae132fd10
Change-Id: Ib571e6e82731ad7cf9a4c8cedf3329470ed12853
2020-03-12 21:04:40 +00:00
Yifan Hong
6ae132fd10 Merge "Add OptimizeSourceCopyOperation" 2020-03-12 20:44:24 +00:00
Automerger Merge Worker
e7524d43a5 Merge "Remove mips pixelflinger." am: 86f83cf41e
Change-Id: Ie848b0f6edff90f1f393e255efe93c78c9636a0d
2020-03-12 18:58:21 +00:00
Elliott Hughes
86f83cf41e Merge "Remove mips pixelflinger." 2020-03-12 18:43:12 +00:00
Automerger Merge Worker
30f22b376f Merge "libfs_mgr_binder: Cleanup GetGsiService()" am: 133df17ea1
Change-Id: Ibb4c01a854c8c762e93188be7ff7d66d7894e1e9
2020-03-12 03:56:21 +00:00
Treehugger Robot
133df17ea1 Merge "libfs_mgr_binder: Cleanup GetGsiService()" 2020-03-12 03:37:52 +00:00
Automerger Merge Worker
9281e97450 Merge "Make libselinux a stub library" am: b407502c98
Change-Id: I7145d1c9cfc35b40bdeb4dfa402cc953e4cd1985
2020-03-12 03:09:59 +00:00
Treehugger Robot
b407502c98 Merge "Make libselinux a stub library" 2020-03-12 02:57:14 +00:00
Automerger Merge Worker
c2d303231d Merge "adb: Avoid a couple std::string constructions" am: 2442e64416
Change-Id: I6e89af8ee9133c03978f3fa543c0b777a5080402
2020-03-12 00:25:53 +00:00
Jiyong Park
3ffdad0cb5 Make libselinux a stub library
libselinux is currently being copied to APEXes. This is risky because
the library is not designed to be portable; part of it is tied to the
specific version of the Android that it was developed for.

This change fixes the problem by declaring that the library supports
a stub with the list of C APIs that are included in the stub. Then there
is only one copy of libselinux in /system/lib and other APEXes use the
copy by dynamically linking to it.

Also, adbd no longer statically links to it, because doing so brings
libselinux in it.

Bug: 151053366
Test: m com.android.adbd. It doesn't include libselinux in it.
Test: m com.android.adbd-deps-info. then inspect
out/soong/com.android.adbd-deps-info.txt. The dependency to libselinux
is shown as '(external)'.

Change-Id: If418cbe3abdeacb759d59052e6dca4c2067678dd
2020-03-12 00:02:18 +00:00
Treehugger Robot
2442e64416 Merge "adb: Avoid a couple std::string constructions" 2020-03-11 23:29:40 +00:00
Automerger Merge Worker
203a724070 Merge "fs_mgr_get_mounted_entry_for_userdata: handle logical partitions" am: 34ae0c58d2
Change-Id: I37ddf7e2da1291bc9f042f675bb19e480ec1020a
2020-03-11 21:53:28 +00:00
Nikita Ioffe
34ae0c58d2 Merge "fs_mgr_get_mounted_entry_for_userdata: handle logical partitions" 2020-03-11 21:29:31 +00:00
Automerger Merge Worker
441f9aa043 Merge "run ext4 tools in first_stage_ramdisk" am: 8aeada63f2
Change-Id: Ice6ac1eeab966e4162fa3efbfcc47d757b1b3817
2020-03-11 20:29:16 +00:00
Treehugger Robot
8aeada63f2 Merge "run ext4 tools in first_stage_ramdisk" 2020-03-11 20:04:50 +00:00
Nikita Ioffe
17824f0590 fs_mgr_get_mounted_entry_for_userdata: handle logical partitions
In case of GSI on DSU, /data is mounted on the following stack:
userdata -> userdata_gsi -> actual block device, and fstab returned from
ReadDefaultFstab() function will say that /data should be
mounted onto userdata_gsi. This configuration wasn't supported.

To support it, fs_mgr_get_mounted_entry_for_userdata now unwinds the
dm-device stack /data is mounted onto, and for each entry in fstab
resolves corresponding block device (in case of logical partitions by
asking DeviceMapper to resolve name -> path, and for other cases by
reading a symlink), and then checking whenever resolved block device
belongs to the unwinded stack.

Test: on both normal boot & DSU
Test: atest CtsUserspaceRebootHostSideTestCases
Test: atest CtsFsMgrTestCases
Bug: 148612148
Change-Id: I1bb3e64ae92d56de905b4f7f1997b7499b101b0f
Merged-In: I1bb3e64ae92d56de905b4f7f1997b7499b101b0f
(cherry picked from commit f495fe798b)
2020-03-11 19:21:37 +00:00
Yifan Hong
dee5225b6c Add OptimizeSourceCopyOperation
... so that an operation can be skipped partially. For example, if
an operation contains blocks:
    563412 -> 123456
... then optimized operation is:
    5612 -> 1256

Test: update_engine_unittests
Test: apply incremental OTA
Bug: 148623880

In an experiment, this reduces CoW size of an incremental update
package by 200MB (out of 700MB).

Change-Id: I86ca23fd589ddbc84c81318283b5f4e71782a759
2020-03-11 12:10:32 -07:00
Eric Biggers
843f46e674 init.rc: disable kernel module autoloading
There is a longstanding bug where file-based encryption causes spurious
SELinux denials of module_request because it uses the kernel's crypto
API, and the crypto API tries to autoload kernel modules.

While this sometimes indicate missing kconfig options, it can still
happen even if all needed kconfig options are enabled.  This is because
a crypto algorithm can be a composition like "hmac(sha512)", and the
crypto API will first look for the full composition before it
instantiates it using the components like "hmac" and "sha512".  But
often an implementation of the full composition doesn't exist.

However, as far as I can tell, Android doesn't actually use kernel
module autoloading at all.  First, Android never changes
/proc/sys/kernel/modprobe from the default of "/sbin/modprobe", yet this
isn't where modprobe is located on Android.  Android's SELinux policy
contains a neverallow rule that ensures that only init (not even
vendor_init) can write to this setting, so vendors can't be changing it.

Vendors could potentially be setting CONFIG_STATIC_USERMODEHELPER_PATH,
which overrides the path of all usermode helpers including modprobe.
But this is a relatively new kconfig option, available only in
android-4.14 and later.  Also, for a vendor to actually do this they'd
also need to extend the SELinux policy with a domain_auto_trans rule to
allow their usermode helper to be executed by the kernel.

Android does increasingly use kernel modules, and GKI (Generic Kernel
Image) will require them.  However, the modules are actually inserted by
userspace by 'init', not autoloaded.

It's possible to disable kernel module autoloading completely by setting
/proc/sys/kernel/modprobe to an empty string.  So, let's do that.

This prevents lots of spurious SELinux denials, and allows removing
unnecessary rules to allow or dontaudit the module_request permission.

Note: when the kernel doesn't have CONFIG_ANDROID_BINDERFS enabled, this
change exposes a kernel bug that causes a WARNING in get_fs_type().  To
avoid this WARNING, a kernel fix should be applied too -- currently
under discussion upstream
(https://lkml.kernel.org/r/20200310223731.126894-1-ebiggers@kernel.org).

Bug: 130424539
Bug: 132409186
Bug: 144399145
Bug: 146477240
Bug: 148005188
Bug: 149542343

Test: Tested on cuttlefish and coral:

    - Checked that /proc/sys/kernel/modprobe contains /sbin/modprobe
      before this change, and the empty string after.

    - Checked that if all SELinux rules for module_request are removed,
      there are SELinux denials for module_request before this change
      but none after.

    - Ran lsmod both before and after and verified that the list is the
      same, i.e. checked that this change doesn't break how Android
      actually loads kernel modules.

Change-Id: I4132fe1a491e7b789311afcf693c1f6493fb9dc5
2020-03-11 10:01:32 -07:00
Jaegeuk Kim
b9be427848 run ext4 tools in first_stage_ramdisk
Bug: 149039306
Change-Id: I646960baa3c0d5a0dedda82b1fdc3816321aaa2e
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-03-11 09:33:51 -07:00
Greg Kaiser
edfec96679 adb: Avoid a couple std::string constructions
With some internal API changing from "const char*" to
"const std::string&", we can change a couple calling sites to
directly pass a std::string reference, instead of getting the
c_str() version of the string.  This avoids us creating a
temporary std::string for the call.

Test: TreeHugger
Change-Id: I2fe0760ce8bf7d352010a341005356c0a801d351
2020-03-11 07:07:55 -07:00
Yo Chiang
bef044a46a libfs_mgr_binder: Cleanup GetGsiService()
GetGsiService() is defined in libgsid, let libfs_mgr_binder link to
libgsid instead of duplicating the logic.

Test: Build and boot
Change-Id: I28d0c92b432a53770a3bdc5f4c5cd91e3466151c
2020-03-11 18:35:51 +08:00
Automerger Merge Worker
872aeede04 Merge "don't include liblog to APEXes" am: f1e27502e4
Change-Id: Ic29e1b7672cd4a33de5c0f925c1c353206679771
2020-03-11 09:41:24 +00:00
Jiyong Park
f1e27502e4 Merge "don't include liblog to APEXes" 2020-03-11 09:20:24 +00:00
Jiyong Park
95b6f45b0e don't include liblog to APEXes
liblog is a platform library that provides stable C API. There is no
need to include the library, especialy by statically linking to it, in
any APEX. It not only wastes the storage/ram, but also is incorrect
because the socket interface to logd which is implemented in liblog is
not guaranteed to be stable.

Fixing this issue by converting static_libs: ["liblog"] into
shared_libs: ["liblog"], in which case the dependency to the library
is satisfied via the stub variant of the library.

As a result, we could restrict the availablity of the library to
the platform and the runtime APEX.

Exempt-From-Owner-Approval: already approved when this was in internal
master (ag/10572699)

Bug: http://b/151051671
Bug: http://b/150827719
Test: m
Change-Id: I5aab863cb12b8767b6979255c247000a59355b0e
2020-03-11 09:20:08 +00:00
Automerger Merge Worker
350aa9e6cf Merge changes from topic "liblog" am: ac72606f98
Change-Id: I9dfd4685f04fffaad79908d20d7e8104bc104011
2020-03-11 08:16:48 +00:00
Automerger Merge Worker
04e8075418 libbase uses liblog symbols via dlsym when it is built for APEX am: 2c608b32db
Change-Id: I6763e2b02e367006e7791c0b4cb326fc3c64243f
2020-03-11 08:16:46 +00:00
Jiyong Park
ac72606f98 Merge changes from topic "liblog"
* changes:
  Whole static link libasync_safe to libbacktrace.a
  libbase uses liblog symbols via dlsym when it is built for APEX
2020-03-11 07:55:40 +00:00
Jiyong Park
cc26bbd232 Whole static link libasync_safe to libbacktrace.a
When libbacktrace.a is statically lined to somewhere, that library had
to add libasync_safe.a to static_libs because libbacktrace.a has
references to libasync_safe.a. But libbacktace depending on
libasync_safe is an implementation detail of libbacktrace, and therefore
its client shouldn't be affected by it.

Fixing this by doing the whole static link to libasync_safe to
libbacktrace.a so that the former is included in libbacktrace.a

Exempt-From-Owner-Approval: cherry-pick rvc-dev

Bug: 149569129
Test: m
Merged-In: If7366a240bc945dda9944fe7c111e10d328165bb
(cherry picked from commit 7c8e2b247d)
Change-Id: If7366a240bc945dda9944fe7c111e10d328165bb
2020-03-11 07:55:23 +00:00
Jiyong Park
2c608b32db libbase uses liblog symbols via dlsym when it is built for APEX
libbase is a popular library that is used by many APEXes either directly
or transitively. It is being used by several Mainline modules that were
launched with Q, in which case everything in the APEX - including
libbase - shouldn't use new APIs that are added post Q, i.e. R.

libbase however is using a few new R symbols from liblog, and this is
preventing those Q-launching Mainline modules that are built in R source
tree from being installed to Q devices.

Fortunately, the dependencies to the new R symbols are guarded with a
flag; when the existence of the symbols are not guaranteed, it uses
dlsym. This change fixes the aforementioned problem by turning on the
flag also when libbase is built for an APEX.

Exempt-From-Owner-Approval: cherry-pick rvc-dev

Bug: 149569129
Test: TARGET_BUILD_APPS=com.android.media
vendor/google/build/build_mainline_modules.sh
adb install --staged out/dist/mainline_modules_arm64/com.android.media.apex
adb reboot
The APEX is installed and mediaextractor process doesn't crash

Merged-In: I44b5ec028850613cb45fc3e792f43cd8e87cfd00
(cherry picked from commit 5280b5c03e)
Change-Id: I44b5ec028850613cb45fc3e792f43cd8e87cfd00
2020-03-11 07:53:23 +00:00
Automerger Merge Worker
ddcb227953 Merge "Create an interface for the cd entry hash table" am: 73ae00bbde
Change-Id: Iae11aee9b3a130f56fedba5a53368cb63a36f13d
2020-03-11 00:10:34 +00:00
Tianjie Xu
73ae00bbde Merge "Create an interface for the cd entry hash table" 2020-03-10 23:51:18 +00:00
Automerger Merge Worker
3353af6e8c Merge "base: tag unique_fd::reset as reinitializing for clang-tidy." am: a964a96ae7
Change-Id: I99f84e2544258f569ba2a310c544d2ecb78bb495
2020-03-10 23:18:51 +00:00
Josh Gao
a964a96ae7 Merge "base: tag unique_fd::reset as reinitializing for clang-tidy." 2020-03-10 22:32:41 +00:00
Automerger Merge Worker
8f43505fca Merge changes Ib8a4835c,I2e11b782 am: eb20ff0be0
Change-Id: I149f5748f300006234f1f44942bc18feb985399f
2020-03-10 21:06:41 +00:00
Automerger Merge Worker
3a3c6ec494 Merge "adbd: make libadbd_services cc_library again." am: 0ac447ab95
Change-Id: I0bdf847d77bd38655aad30c46044e7891766405c
2020-03-10 21:04:15 +00:00
Tom Cherry
eb20ff0be0 Merge changes Ib8a4835c,I2e11b782
* changes:
  Revert "init: handle property service callbacks asynchronously"
  Revert "Stop & Resume property service when switching to bootstrap namespace"
2020-03-10 20:44:55 +00:00
Tom Cherry
832f9f1dbd Revert "init: handle property service callbacks asynchronously"
This is apparently causing problems with reboot.

This reverts commit 7205c62933.

Bug: 150863651
Test: build
Change-Id: Ib8a4835cdc8358a54c7acdebc5c95038963a0419
2020-03-10 11:53:11 -07:00
Tianjie Xu
28f8eaeffb Create an interface for the cd entry hash table
The current implementation of the hashtable uses less memory than
a std::map. As most of the zip files we encountered don't use the zip64
extension, we should keep the current implementation. And the interface
adds the flexibility for us to switch to std::map for zip64 format.

Bug: 150900468
Test: unit tests pass
Change-Id: Ifd008785c9ff416a27049f9e0c54d9eef985bd85
2020-03-10 11:51:53 -07:00
Tom Cherry
459ca0be74 Revert "Stop & Resume property service when switching to bootstrap namespace"
Dependent change was reverted.

This reverts commit 352ae2d225.

Bug: 150863651
Test: build
Change-Id: I2e11b782fcd2b7baded133a841fdcf519f702b84
2020-03-10 11:48:24 -07:00
Tianjie Xu
0ac447ab95 Merge "adbd: make libadbd_services cc_library again." 2020-03-10 18:43:30 +00:00
Automerger Merge Worker
944d5b0656 Merge changes from topic "no_snapshot_callstack" am: 86008cccb3
Change-Id: I9b061b9a8197be2d91cb7aa6b7db23f2c5fb2ec5
2020-03-10 17:26:01 +00:00
Yifan Hong
86008cccb3 Merge changes from topic "no_snapshot_callstack"
* changes:
  Revert "libsnapshot::RemoveAllUpdateState log stack"
  Revert "libsnapshot callstack files readable by dumpstate"
  libsnapshot: delete InitiateMergeAndWait.
2020-03-10 17:08:54 +00:00
Automerger Merge Worker
58894ac28e Merge "liblog: add API level guard to NDK log.h header" am: cc032194b3
Change-Id: I27428102301041120007667f7aa0e1b9c4de1e52
2020-03-10 16:16:47 +00:00
Tom Cherry
cc032194b3 Merge "liblog: add API level guard to NDK log.h header" 2020-03-10 16:00:44 +00:00
Tom Cherry
59e93a55fc liblog: add API level guard to NDK log.h header
Bug: 119867234
Test: build
Change-Id: I6fdd7c070af06f04314b9bf7bbfede2a106e0d7c
2020-03-10 08:50:46 -07:00
Automerger Merge Worker
0d0e8f6a4a Merge "Convert gsid to use the dynamic AIDL service infrastructure" am: 14326821f0
Change-Id: Id69799c15b20dd2deb74cd80386c6ff8861da33d
2020-03-10 10:11:48 +00:00
Howard Chen
14326821f0 Merge "Convert gsid to use the dynamic AIDL service infrastructure" 2020-03-10 09:49:01 +00:00
Automerger Merge Worker
bacaf76c0e Merge "Set apex_available property" am: 2401f5f2cc
Change-Id: I6b870349f9c526bda074e045ed52ffbd93b11249
2020-03-10 07:56:11 +00:00