Commit graph

43842 commits

Author SHA1 Message Date
Thierry Strudel
f73de6f037 healthd.h: add ignorePowerSupplyNames to healthd_config
In case some power supply paths should not be considered, add a black list
to the healthd_config to instruct BatteryMonitor of the power supply paths
to ignore on init.

Bug: 117903348
Change-Id: I6f9ddeff9351ad01772b43728ddc2627da81df2a
Signed-off-by: Thierry Strudel <tstrudel@google.com>
2019-01-11 18:08:23 -08:00
Treehugger Robot
1c4ad71dff Merge "Remove dependency on libdexfile internal header." 2019-01-12 00:33:41 +00:00
Treehugger Robot
a89bd8b721 Merge "Adds atomic install support to adb" 2019-01-12 00:12:07 +00:00
Martin Stjernholm
2677b802bf Remove dependency on libdexfile internal header.
Also remove some tests for implementation details in the libdexfile API that
are now covered by unit tests there (http://r.android.com/867370).

Test: mmma system/core/{libunwindstack,libbacktrace} and run host gtests
Bug: 119632407
Change-Id: Ie731bb929a564de56ce1c78385da12a43d0954ff
2019-01-11 21:05:50 +00:00
Patrick Baumann
dc58b0a388 Adds atomic install support to adb
This change adds an install-atomic command to adb that is shorthand for
creating an atomic install session and an individual session for each
APK supplied to the command.

Bug: 109941548
Test: run command with multiple APKs, observe atomic install
Change-Id: I2817a1ed2d312925d9c7bd621e6c82670a6275fd
2019-01-11 18:13:36 +00:00
Treehugger Robot
d75913a371 Merge changes from topic "move_bionic_to_apex"
* changes:
  Don't create separate mount namespaces for pre-apexd processes
  Bionic libs are located at /system/lib
  Bionic libs and the dynamic linker are bind mounted
2019-01-11 16:59:15 +00:00
Martin Stjernholm
810c57d610 Merge "Some minor updates in the libdexfile external API." 2019-01-11 10:28:03 +00:00
Jiyong Park
5ab1300481 Don't create separate mount namespaces for pre-apexd processes
It is causing problem to the sdcardfs. Specifically, re-mounting events
for /mnt/runtime/{runtime|write} done by the vold process (which is a
pre-apexd process) are not being propagated to other mount namespaces.
As a result, SDCard access isn't working.

The propagation problem is a bug in sdcardfs which is fixed by [1].
However, we can't make all Android devices to have the patch at the same
time. Therefore, by default the separate mount namespace is not created
and will be created only for the devices where the kernel patches are in and
ro.apex.bionic_updatable sysprop is set to true.

[1]
d73d07673edbdbe78e1a7d00e7827ba9bfd86a59 ("ANDROID: mnt: Fix next_descendent")
b5858221c1c4f4bdc9ef67eb75ecf22580368820 ("ANDROID: mnt: remount should propagate to slaves of slaves")

Bug: 122559956
Test: m
Test: device boots
Test: sdcard works (e.g. camera can take pictures)
Test: atest android.appsecurity.cts.ExternalStorageHostTest
Change-Id: I7a309bab46356ee5782f34c5963d1760963c0b14
2019-01-11 15:17:04 +09:00
Jiyong Park
3fa8415b37 Bionic libs are located at /system/lib
Bionic libs, regardless of whether they are bootstrap ones or from the
runtime APEX, are available via /system/lib. Since /system/lib is in the
search paths of the default(platform) namespace, there is no need to
list the bionic libs to the namespace link to the runtime namespace.

Bug: 120266448
Test: m; device boots
Test: atest CtsJniTestCases CtsCompilationTestCases CtsBionicTestCases
all passing except for following tests that are also failing at ToT
dl#exec_linker
dl#exec_linker_load_from_zip
dl#exec_linker_load_self
dl#exec_linker_load_file

Change-Id: Ib67acd4f384b2f0e70b5fe8ec6b45a5506367223
2019-01-11 15:17:04 +09:00
Jiyong Park
2599088ff6 Bionic libs and the dynamic linker are bind mounted
This change makes the bionic libs and the dynamic linker from the
runtime APEX (com.android.runtime) available to all processes started
after apexd finishes activating APEXes.

Specifically, the device has two sets of bionic libs and the dynamic
linker: one in the system partition for pre-apexd processes and another
in the runtime APEX for post-apexd processes. The former is referred as
the 'bootstrap' bionic and are located at
/system/lib/{libc|libdl|libm}.so and /system/bin/linker. The latter is
referred as the 'runtime' bionic and are located at
/apex/com.android.runtime/lib/bionic/{libc|libdl|libm}.so and
/apex/com.android.runtime/bin/linker.

Although the two sets are located in different directories, at runtime,
they are accessed via the same path: /system/lib/* and
/system/bin/linker ... for both pre/post-apexd processes. This is done
by bind-mounting the bootstrap or the runtime bionic to the same path.
Keeping the same path is necessary because there are many modules and
apps that explicitly or implicitly depend on the fact that bionic libs
are located in /system/lib and are loaded into the default linker
namespace (which has /system/lib in its search paths).

Before the apexd is started, init executes a built-in action
'prepare_bootstrap_bionic' that bind-mounts the bootstrap bionic to the
mount points. Processes started during this time are provided with the
bootstrap bionic. Then after the apexd is finished, init executes
another built-in action 'setup_runtime_bionic' which again mounts the
runtime bionic to the same mount points, thus hiding the previous mounts
that target the bootstrap bionic. The mounting of the runtime bionic
(which is only for post-apexd processes) is hidden from pre-apexd
processes by changing propagation type of the mount points to 'private'
and execute the pre-apexd processes with a new mount namespace using
unshare(2). If a pre-apexd process crashes and re-launched after the
apexd is on, the process still gets the bootstrap bionic by unmounting
the runtime bionic which effectively un-hides the previous bind-mounts
targeting the bootstrap bionic.

Bug: 120266448
Test: device boots
Test: cat /proc/`pidof zygote`/mountinfo shows that
/system/lib/{libc|libdl|libm}.so and /system/bin/linker are from the
runtime APEX
Test: cat /proc/'pidof vold`/mountinfo shows that the same mount points
are from system partition.

Change-Id: I7ca67755dc0656c0f0c834ba94bf23ba9b1aca68
2019-01-11 15:17:04 +09:00
Treehugger Robot
d220cdc71f Merge "libpackagelistparser: export profileable_from_shell flag." 2019-01-11 05:00:27 +00:00
Bowgo Tsai
db2bc1a9df Merge "Skip building libfs_avb for darwin host" 2019-01-11 03:55:03 +00:00
Treehugger Robot
5a790d69d5 Merge "run-as: add shared app gid in supplementary groups." 2019-01-11 03:48:25 +00:00
Bowgo Tsai
1b1a1fdbb1 Skip building libfs_avb for darwin host
Bug: 112103720
Bug: 117960205
Test: build
Change-Id: If0bb8d15a62947e3af3bf02485a210715db90fdd
2019-01-11 11:41:01 +08:00
David Anderson
34ad8ca773 Merge "liblp: Add helpers for modifying groups." 2019-01-11 01:45:21 +00:00
Treehugger Robot
89e2aa94b7 Merge "Add conditional class starting" 2019-01-11 00:58:18 +00:00
Yabin Cui
b9fcfc8b98 libpackagelistparser: export profileable_from_shell flag.
Bug: 118835348
Test: test manually on apps that the flag is set properly.
Change-Id: Idd86dca6c7d767be985bb27f4dd3116d79029868
2019-01-10 16:24:20 -08:00
Treehugger Robot
fce33ca0bf Merge "libfs_avb: Switch to range-for for GetHashtreeDescriptor" 2019-01-11 00:14:52 +00:00
Treehugger Robot
29bc428f28 Merge "libfs_avb: refactoring" 2019-01-11 00:14:15 +00:00
Treehugger Robot
333ab452f7 Merge "llkd: do not call sync()" 2019-01-10 23:36:42 +00:00
Tom Cherry
82b8e518e3 Merge "Support mounting same mount points with different fstab config" 2019-01-10 23:36:16 +00:00
Yabin Cui
3a60e68b72 run-as: add shared app gid in supplementary groups.
This is to read profile guide compiled oat files of debuggable apps, which is
needed by simpleperf for profiling.

Bug: none
Test: run run-as manually.
Change-Id: I8ec8897b882be650f02124413c7d20ed8b1b444b
2019-01-10 15:08:22 -08:00
Tom Cherry
37b5edf61b Merge "liblog: remove LOGGER_LOCAL" 2019-01-10 22:46:30 +00:00
Treehugger Robot
d9e73a009b Merge "Libbase: NOLINT legacy unique_fd operator int" 2019-01-10 21:22:55 +00:00
Treehugger Robot
3c1cdaf54d Merge changes from topic "fsmgr_system_other"
* changes:
  fs_mgr: overlayfs clears readonly on scratch devices
  liblp: BLKROSET 0 prior to FlashPartitionTable
  fs_mgr: system_other does not want overlayfs.
2019-01-10 21:11:20 +00:00
Mark Salyzyn
16649d22ca llkd: do not call sync()
sync() will never return if the io subsystem is locked up, drop it.

Test: llkd_unit_test
Bug: 122263600
Change-Id: Ib378124415ce94da987d73391b027dc10317dbe9
2019-01-10 12:52:35 -08:00
David Anderson
c6c6e66813 liblp: Add helpers for modifying groups.
These are needed for non-A/B OTAs.

Bug: 122473283
Test: liblp_test gtest
Change-Id: Ib30614f1691dbea0a56c5a98aadc84fc26d1e639
2019-01-10 11:49:15 -08:00
Yifan Hong
ccdba57545 fs_mgr: overlayfs clears readonly on scratch devices
Fixes adb-remount-test and flashstation because the scratch device
was set to readonly before.

Test: adb-remount-test

Change-Id: I12551d1ed99fb7cfd04f84fcc2b77d3cb94275b2
Fixes: 122454600
Fixes: 122602260
2019-01-10 10:49:05 -08:00
Tom Cherry
2f171cc69e Merge "init: remove the restriction of arguments" 2019-01-10 18:47:53 +00:00
Tom Cherry
d1febd3316 liblog: remove LOGGER_LOCAL
No users ever signed up to use this, so remove it to ease the
refactoring of liblog/libbase.

Bug: 119867234
Test: liblog unit tests
Change-Id: I37b99644112bae7b4a2e3f4d06749db08de4ea14
2019-01-10 10:39:35 -08:00
Treehugger Robot
b9d6cef75e Merge "liblog: convert README to markdown" 2019-01-10 18:34:23 +00:00
Treehugger Robot
29c44f5710 Merge "Use the existing .clang-format-2 for liblog" 2019-01-10 18:30:39 +00:00
Tri Vo
b5b7d0a777 Merge "init: don't restorecon root sepolicy files" 2019-01-10 17:38:15 +00:00
Andreas Gampe
468ffaeecf Libbase: NOLINT legacy unique_fd operator int
The use in implicit conversion is intentional.

Test: m
Change-Id: I6c756e772b274e8a525ba2ad792cc4a8e1fc0176
2019-01-10 08:54:45 -08:00
LongPing Wei
01cf85bd8e Support mounting same mount points with different fstab config
This commits allows multiple lines in a fstab have the same mount
point for first-stage mount, where the first successful mount will be
used.

This allows us to specify a common/shared fstab, with different
settings (e.g., ext4, squashfs) per line, to mount different types
of images on the same mount point. e.g., allows the device to mount
GSI (ext4) while support mounting the original squashfs system.img.

Sample fstab:
fstab in dt:
android {
    fstab {
        odm_ext4 {
            dev = "/dev/block/by-name/odm";
            mnt_point = "/odm";
            type = ext4;
            mnt_flags = "ro";
            fs_mgr_flags = "slotselect";
        };
        odm_f2fs {
            dev = "/dev/block/by-name/odm";
            mnt_point = "/odm";
            type = f2fs;
            mnt_flags = "ro";
            fs_mgr_flags = "slotselect";
        };
    };
}

fstab in file:
/dev/block/by-name/odm /odm ext4 ro slotselect
/dev/block/by-name/odm /odm f2fs ro slotselect

Test: make & boot & check /proc/mounts
Change-Id: I64892e3007b0cfd7d06dad1cfc664c45305197ee
2019-01-10 22:58:18 +08:00
Bowgo Tsai
7bf0479bb9 libfs_avb: Switch to range-for for GetHashtreeDescriptor
Bug: None
Test: boot a device
Change-Id: I9d0bdced5fa08cd4bf125c478504c45e5cfbcd4e
2019-01-10 18:12:17 +08:00
Bowgo Tsai
d79dd84479 libfs_avb: refactoring
This commit has the following changes:

    1. Builds libfs_avb via "fs_mgr/libfs_avb/Android.bp" instead of
       "fs_mgr/Android.bp", and removes the libfs_avb source
       dependencies on "fs_mgr/fs_mgr_priv.h".

    2. Moves static functions in fs_avb.cpp into util.cpp or
       avb_util.cpp, depending on whether the function is related to
       AVB or not.

    3. Introduces two host unit tests: libfs_avb_test and
       libfs_avb_internal_test, the former is to test public
       <fs_avb/fs_avb.h> APIs, while the latter is to test libfs_avb
       internal functions.

    4. Splits fs_avb_unittest_util.* into:
       - fs_avb_test_util.* (host static lib: libfs_avb_test_util),
       - basic_test.cpp (host executable: libfs_avb_test)

Bug: 112103720
Bug: 117960205
Test: atest libfs_avb_test
Test: atest libfs_avb_internal_test
Test: boot a device
Change-Id: I11d6c9e9019e20b594d9321b9a28118d4806e5a7
2019-01-10 18:11:48 +08:00
Treehugger Robot
3ffb4ab82a Merge "Build init with the bootstrap bionic libs" 2019-01-10 07:50:22 +00:00
Haoyu Tang
f32bc7cd29 init: remove the restriction of arguments
X86 Kernel could pass CPU capablity to init as argument. This will cause init
can't start first-stage because unknown argument. Need remove this restriction
of arguments to start init successfully.

Fixes: 122435289
Test: Android init can start successfully

Change-Id: I1d432e25553589dd7f618e42ad238b9372dbe34f
Signed-off-by: Haoyu Tang <haoyu.tang@intel.com>
Signed-off-by: Xihua Chen <xihua.chen@intel.com>
2019-01-10 01:02:29 +00:00
Tri Vo
05f96a2561 init: don't restorecon root sepolicy files
Removing restorecon on root sepolicy files because:
1. Under normal boot the files are properly labeled when creating the
image. Restorecon'ing them successfully would require "adb remount".
2. These restorecon's are not required for recovery to function.

Fixes: 122535196
Test: boot blueline
Change-Id: I20b127e950b16535d4bfa9fd4e626e11228925e7
2019-01-10 00:50:43 +00:00
Treehugger Robot
d184eb1fd9 Merge "Exclude mount entries for vendor overlay" 2019-01-10 00:41:10 +00:00
Justin Yun
d3e2a78a99 Exclude mount entries for vendor overlay
When testing adb-remount with overlayfs, vendor overlay may fail the
test because there are unexpected overlayfs uses by vendor overlay.
By excluding mount entries for vendor overlay, the test runs
regardless of vendor overlay mount.

Bug: 122231184
Test: run adb-remount-test.sh with vendor overlay mount
Change-Id: I795774b27d5e5f973792337813b67487a5d72e29
2019-01-10 00:40:33 +00:00
Yifan Hong
e7f492dc61 liblp: BLKROSET 0 prior to FlashPartitionTable
Test: OTA after cppreopt
Change-Id: I0c611588fac73fbd8d1502cb57481f3363e0cbe8
Fixes: 122487294
2019-01-09 16:20:33 -08:00
Yifan Hong
acf859a891 fs_mgr: system_other does not want overlayfs.
system wants overlayfs, and system_other is a valid candidate;
but system_other does not want overlayfs.

Addresses these denials:
avc: denied { read write } for comm="tune2fs" name="sda6" dev="tmpfs" ino=15114
  scontext=u:r:fsck:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=0
avc: denied { read } for comm="e2fsck" name="sda6" dev="tmpfs" ino=15114
  scontext=u:r:fsck:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=0
avc: denied { read write } for comm="e2fsck" name="sda6" dev="tmpfs" ino=15114
  scontext=u:r:fsck:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=0

Fixes: 122454600
Test: boot, no tune2fs and e2fsck denials

Change-Id: Icce20f1463cfde034a56f25590cba9f8fe5f41a4
2019-01-09 16:20:33 -08:00
Treehugger Robot
1c018862a0 Merge "Add systrace tag for RRO" 2019-01-09 23:50:11 +00:00
Martin Stjernholm
b49289b43a Some minor updates in the libdexfile external API.
Test: m
Test: mmma system/core/{libunwindstack,libbacktrace} and run host gtests
Bug: 119632407
Bug: 120978655
Change-Id: I919586ab503be3617e8a0604dfe48db331e7af94
2019-01-09 23:25:25 +00:00
Daniel Rosenberg
ca00b0edeb Add conditional class starting
This adds the ability to prevent a class from starting
if a certain persistent property has been set to
disallow it.

A class will only load if there is not a property named
persist.init.dont_start_class.[class name] set to 1.

Test: Set a property called persist.dont_start_class.[class]
      to 1. Verify that the given class does not start
Change-Id: I51c70ad635762ed77855d0509e630adb0aec0eb1
2019-01-09 15:18:01 -08:00
Tom Cherry
afd483c645 liblog: convert README to markdown
Android uses markdown for its readmes, not man pages, so update
appropriately.

Test: n/a

Change-Id: I674a9da5af56aeebfaca852764eb6c1ca0b166ff
2019-01-09 14:04:05 -08:00
Tom Cherry
ff4e07076d Use the existing .clang-format-2 for liblog
Test: n/a
Change-Id: Iadbb88d99aecbc2f7485a5dfa91f5b54846a5b67
2019-01-09 13:08:10 -08:00
Josh Gao
afd3dfeeff Merge "Only set mdns_registered on success" 2019-01-09 20:41:17 +00:00