Commit graph

3667 commits

Author SHA1 Message Date
Treehugger Robot
7794308dd3 Merge "Add some README.md text for init triggers." am: 04d0f7d303 am: 283798235e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1724076

Change-Id: I2628cf5fafa4999555687345b178662a1ffe0559
2021-06-15 20:11:32 +00:00
Treehugger Robot
04d0f7d303 Merge "Add some README.md text for init triggers." 2021-06-15 19:27:53 +00:00
David Anderson
6bc2a789bb Use std::shared_ptr in Epoll's callback list. am: 1de7384c10
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/14923579

Change-Id: I06355a0b0e7a6c33d160f7dd2a1f10b038928f1c
2021-06-14 10:09:17 +00:00
David Anderson
1de7384c10 Use std::shared_ptr in Epoll's callback list.
Ignore-AOSP-First: Awaiting security triage
Bug: 187862380
Bug: 190126442
Test: CtsInitTestCases
Change-Id: Ibb34a6b8a5675dbc515b7f8a43d7eecf2084510c
(cherry picked from commit aea9781530)
2021-06-09 19:59:20 +00:00
David Anderson
ea700e89db Merge "ueventd: the parallel restorecon dirs is configurable [1/1]" am: cc8572441e am: 0451dc4129
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1699465

Change-Id: Iaaca2833fe4ba9abccf03e63956abd100d5dc617
2021-06-07 23:49:21 +00:00
David Anderson
cc8572441e Merge "ueventd: the parallel restorecon dirs is configurable [1/1]" 2021-06-07 23:08:59 +00:00
David Anderson
93f2916edb Merge "Warn loudly if using deprecated ueventd paths." am: 391056ea73 am: 5f6539dcd0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1726330

Change-Id: I151aa7593a23e67fad14e7b647df319fbb56af14
2021-06-03 22:53:52 +00:00
David Anderson
391056ea73 Merge "Warn loudly if using deprecated ueventd paths." 2021-06-03 22:12:25 +00:00
Yi-Yo Chiang
84fe96bfbc first_stage_mount: mount point must be canonical path
Ban weird paths such as /../system or //vendor in first stage mount.
Add utility function fs_mgr_create_canonical_mount_point() that:

* mkdir(mount_point) to ensure mount_point's existence
* Test that realpath(mount_point) =?= mount_point

Bug: 188898525
Test: Presubmit
Test: Boot CF
Change-Id: Iaf2ec52701277f26cc81f3e15a47b6083a788334
Merged-In: Iaf2ec52701277f26cc81f3e15a47b6083a788334
(cherry picked from commit 3431d52675)
2021-06-03 15:53:12 +08:00
Yo Chiang
59b6a62695 Merge "first_stage_mount: mount point must be canonical path" am: 4063fc4a01 am: 53ce569e4f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1719044

Change-Id: Ied100a325228a90b2d8a2a40a302c9585b2f63bd
2021-06-03 06:56:08 +00:00
David Anderson
0050bef9e1 Warn loudly if using deprecated ueventd paths.
Bug: 189268918
Test: treehugger
Change-Id: Ib4cfa4f3a1f4626afcd37278d93390ad34b0216b
2021-06-02 18:22:28 -07:00
yuehu mi
ddffa0ea74 ueventd: the parallel restorecon dirs is configurable [1/1]
PD#SWPL-45884
BUG:187441275

Problem:
ueventd: coldboot took too much time

Solution:
1.The parallel restorecon dirs can be configured in ueventd.rc
2.Add 'parallel_restorecon_dir' keywords
parallel_restorecon_dir <directory>

Verify:
redi

Change-Id: Id5b13f18d36afb894891697f21ac63e78b3fe130
Signed-off-by: yuehu mi <yuehu.mi@amlogic.com>
2021-06-02 20:02:59 +08:00
Yi-Yo Chiang
3431d52675 first_stage_mount: mount point must be canonical path
Ban weird paths such as /../system or //vendor in first stage mount.
Add utility function fs_mgr_create_canonical_mount_point() that:

* mkdir(mount_point) to ensure mount_point's existence
* Test that realpath(mount_point) =?= mount_point

Bug: 188898525
Test: Presubmit
Test: Boot CF
Change-Id: Iaf2ec52701277f26cc81f3e15a47b6083a788334
2021-06-02 16:38:17 +08:00
David Anderson
8ce8c89b35 Add some README.md text for init triggers.
Bug: 180475195
Test: N/A
Change-Id: I33ec5a03b6aced835f15315b1755e17d07969d4c
2021-06-01 21:38:41 -07:00
Yo Chiang
30687fbdbe Merge "Make fs_mgr_overlayfs_mount_fstab_entry() available for user builds" am: 869ab86944 am: c88ce98631
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1711246

Change-Id: Ie9f509f32dfc85deaa38480b7a51c7206ea5aa7e
2021-05-27 09:38:41 +00:00
Yi-Yo Chiang
18a6cc2bac Make fs_mgr_overlayfs_mount_fstab_entry() available for user builds
Rename fs_mgr_overlayfs_mount_fstab_entry() to
fs_mgr_mount_overlayfs_fstab_entry() and move it out of
fs_mgr_overlayfs.cpp to make it available for user builds.

Add checks to unsure overlayfs mount point doesn't contain symbolic
link or /../.

Check the mount point with an allowlist if user build. The mount point
should either be /vendor, /product ... or their submounts, or strict
submounts of /mnt/vendor and /mnt/product.

Bug: 188862155
Test: Boot test with overlayfs mount entries on user build
Change-Id: I3b60dfa4b63cf2ae0754f53d1d08365aa7be1ee0
Merged-In: I3b60dfa4b63cf2ae0754f53d1d08365aa7be1ee0
(cherry picked from commit 23816e84ca)
2021-05-27 16:55:28 +08:00
Yo Chiang
869ab86944 Merge "Make fs_mgr_overlayfs_mount_fstab_entry() available for user builds" 2021-05-27 08:54:20 +00:00
Yi-Yo Chiang
94d1f3b4fa fs_mgr_overlayfs: Polish fs_mgr_overlayfs_mount_fstab_entry()
* Add logs.
* Append "override_creds=off" overlayfs mount flag only if
  fs_mgr_overlayfs_valid() returns kOverrideCredsRequired.
  Pre-4.6 kernels or kernels without the override_creds patch don't
  need or don't recognize the override_creds mount flag.
  (Background: I832c8ca3fce0269bdef4ce988541adb7ba9662ed)
* mkdir(mount_point) before mount() to ensure the mount point exists.
  This could happen if the mount point is in a tmpfs, such as /mnt.

Bug: 188862155
Test: Boot to normal with overlayfs mount entries in first stage fstab
Change-Id: I1a05696346610d7fd61de6d25c379520fd58ca9b
Merged-In: I1a05696346610d7fd61de6d25c379520fd58ca9b
(cherry picked from commit dcf1c1f462)
2021-05-26 07:31:19 +00:00
Yi-Yo Chiang
aa061738bc first_stage_mount: Remove "overlay" hack from InitRequiredDevices()
GetDmVerityDevices() should filter out overlayfs fstab entries in the
first place, so InitRequiredDevices() don't need to filter out overlayfs
pseudo device names.

Bug: 188862155
Test: Boot to normal with overlayfs mount entries in first stage fstab
Change-Id: I0ac8b7ac0f21daa0c191580d9349adf217854864
Merged-In: I0ac8b7ac0f21daa0c191580d9349adf217854864
(cherry picked from commit 87290f8e9b)
2021-05-26 07:31:12 +00:00
David Anderson
26e1ad4fb7 Merge "KillZramBackingDevice: Return immediately if backing_dev is none." am: 7e2d32bc06 am: 4c21150d8d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1710548

Change-Id: Ifd8db64e5d1cd829d2271a917e4bdadff73083e0
2021-05-26 04:24:15 +00:00
David Anderson
7e2d32bc06 Merge "KillZramBackingDevice: Return immediately if backing_dev is none." 2021-05-26 03:29:05 +00:00
Yi-Yo Chiang
23816e84ca Make fs_mgr_overlayfs_mount_fstab_entry() available for user builds
Rename fs_mgr_overlayfs_mount_fstab_entry() to
fs_mgr_mount_overlayfs_fstab_entry() and move it out of
fs_mgr_overlayfs.cpp to make it available for user builds.

Add checks to unsure overlayfs mount point doesn't contain symbolic
link or /../.

Check the mount point with an allowlist if user build. The mount point
should either be /vendor, /product ... or their submounts, or strict
submounts of /mnt/vendor and /mnt/product.

Bug: 188862155
Test: Boot test with overlayfs mount entries on user build
Change-Id: I3b60dfa4b63cf2ae0754f53d1d08365aa7be1ee0
2021-05-25 22:10:30 +08:00
Yo Chiang
51c0482fe4 Merge "fs_mgr_overlayfs: Polish fs_mgr_overlayfs_mount_fstab_entry()" am: 71db89b1da am: 349cb5d4c7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1710550

Change-Id: I66894e12496b42fa7b51604f7b329220a03f0b70
2021-05-20 07:15:13 +00:00
Yo Chiang
eea7cf4dfd Merge "first_stage_mount: Remove "overlay" hack from InitRequiredDevices()" am: b440fc9c06 am: 99893a20f7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1711245

Change-Id: Ibe004599e297111f82bb52241c0fa6df16bc37c7
2021-05-20 07:15:07 +00:00
Yi-Yo Chiang
dcf1c1f462 fs_mgr_overlayfs: Polish fs_mgr_overlayfs_mount_fstab_entry()
* Add logs.
* Append "override_creds=off" overlayfs mount flag only if
  fs_mgr_overlayfs_valid() returns kOverrideCredsRequired.
  Pre-4.6 kernels or kernels without the override_creds patch don't
  need or don't recognize the override_creds mount flag.
  (Background: I832c8ca3fce0269bdef4ce988541adb7ba9662ed)
* mkdir(mount_point) before mount() to ensure the mount point exists.
  This could happen if the mount point is in a tmpfs, such as /mnt.

Bug: 186342252
Test: Boot to normal with overlayfs mount entries in first stage fstab
Change-Id: I1a05696346610d7fd61de6d25c379520fd58ca9b
2021-05-20 06:40:27 +00:00
Yi-Yo Chiang
87290f8e9b first_stage_mount: Remove "overlay" hack from InitRequiredDevices()
GetDmVerityDevices() should filter out overlayfs fstab entries in the
first place, so InitRequiredDevices() don't need to filter out overlayfs
pseudo device names.

Bug: 186342252
Test: Boot to normal with overlayfs mount entries in first stage fstab
Change-Id: I0ac8b7ac0f21daa0c191580d9349adf217854864
2021-05-20 06:39:57 +00:00
Treehugger Robot
02bb576054 Merge "ueventd: Run external handler as non-root group" am: 5123a3eafc am: 7db6b64f2d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1707926

Change-Id: If2f9837c9ec4c66cadda829f335639078b75a899
2021-05-18 23:47:17 +00:00
shisiyuan
423c4f1994 KillZramBackingDevice: Return immediately if backing_dev is none.
It's possible that CONFIG_ZRAM_WRITEBACK is y,
but userspace doesn't set the /sys/block/zram0/backing_dev,
so its value is 'none'.
It's the same with "CONFIG_ZRAM_WRITEBACK is not set".

Change-Id: I2df89ceee68e4685deef5113bada21be96779e9b
Signed-off-by: shisiyuan <shisiyuan@xiaomi.com>
2021-05-18 14:47:47 +08:00
Suchang Woo
10c6374e81 ueventd: Run external handler as non-root group
The external firmware handler always has root group privileges because
it is forked/executed without setgid() by ueventd which has root
privileges. This patch calls setgid() with group ID specified in
ueventd.rc before execv().

Test: atest CtsInitTestCases
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
Change-Id: Id1430e783b0e409d55ac80fe213e81ba099729e2
2021-05-17 10:37:19 +09:00
Tianjie Xu
0a2bb08371 Merge "Add a unittest for fingerprint calculation" am: 023ac49db2 am: b026f15df0 am: 8408b03092
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1698093

Change-Id: Ic7cca5299f5a9f06cfc701990bcf781e3103f82f
2021-05-11 07:00:04 +00:00
Tianjie
69e880e257 Add a unittest for fingerprint calculation
Add a test to check the build fingerprint when the dynamic build
id is in use.

Bug: 186786987
Test: th
Change-Id: I44d6be0c18552f319bcb8d19cca5659ce580d26c
2021-05-10 12:11:28 -07:00
Tianjie Xu
87eeec4d40 Merge "Support appending vbmeta digest to id/fingerprint" am: 57b9a5370e am: 8b6d881071 am: 4e83aa5beb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1695266

Change-Id: I3be9c44e07194c9c317677fe33e9dc1568548783
2021-05-09 00:10:02 +00:00
Tianjie Xu
57b9a5370e Merge "Support appending vbmeta digest to id/fingerprint" 2021-05-08 22:56:56 +00:00
Roman Kiryanov
bc7acaadda Merge "Remove the tech debt from the property_service" am: 8371ec25ab am: 9beeed390c am: 8456b731d8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1698925

Change-Id: I1cdeeeed17212edcdd120cdddfd79e2ed7106231
2021-05-06 23:58:51 +00:00
Tianjie
becfa77e5d Support appending vbmeta digest to id/fingerprint
Background in http://go/compatible-build-fingerprint. To uniquely
identify the mixed build, we plan to append the unique vbmeta digest
to ro.build.id.

If BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT is true, the build system
will not set ro.build.id. Instead, init will set it at runtime, by
appending the digest to the legacy build id.

Bug: 186786987
Test: build and boot a device with new build id
Change-Id: Idea57df599bfd6eede760671e2555541f7dc3f21
2021-05-06 22:31:54 +00:00
Roman Kiryanov
2d1a401b6e Remove the tech debt from the property_service
emulator migrated to bootconfig, we don't use
the kernel command line to pass userspace properties.

Bug: 182291166
Test: boot
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Iff2f627aec64b7ba2240444639acedc76a1aa806
2021-05-06 11:55:29 -07:00
Treehugger Robot
641371794c Merge "Revert "init: adding fallback paths for debug ramdisk"" am: 0d712ad3a2 am: e21050474a am: 05c21f24f7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1697285

Change-Id: Ic0b4d1855fe4deeee22e0390e7c59062f8f04f70
2021-05-06 08:18:26 +00:00
Treehugger Robot
0d712ad3a2 Merge "Revert "init: adding fallback paths for debug ramdisk"" 2021-05-06 07:05:41 +00:00
David Anderson
6870933e8e Merge "OverlayFS support for fstab" am: 7cdbd8e64d am: 1e5400b429 am: 2f8663919e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1691625

Change-Id: I5b951b3340d095a2afddb7dbf7bf71a53a6db0d9
2021-05-06 02:51:15 +00:00
David Ng
d926aded73 OverlayFS support for fstab
Add overlayfs (lowerdir) mount entry support to fstab.

  overlay  <final dir>  overlay lowerdir=/1:/2

E.g.
  overlay /vendor overlay lowerdir=/odm/vnd_ovl1/1:/odm/vnd_ovl2

Test: Ensure mounting with fstab overlayfs entry
Change-Id: Ib025e203f8ac1836ab62dfa96fb14e8e108f82fb
2021-05-05 09:30:18 -07:00
Bowgo Tsai
26c1b74998 Revert "init: adding fallback paths for debug ramdisk"
This reverts commit 6cb4311f4d.

Reason for revert: no need to keep the compatibility now

Bug: 186485355
Change-Id: Iffdf3abebc17f32e36f3b3fe2b4f9c2592da9653
Test: TreeHugger
2021-05-05 10:31:29 +00:00
David Anderson
b4d299618f Merge "init: Add tests and document the new fnmatch behavior in ExternalFirmwareHandler." am: 6939583deb am: b383eb7f99 am: eb50ea4ea3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1677040

Change-Id: Ia7b82f126dd25b7caa2b66ff8b5381026a816d19
2021-05-05 01:34:39 +00:00
David Anderson
6939583deb Merge "init: Add tests and document the new fnmatch behavior in ExternalFirmwareHandler." 2021-05-05 00:21:34 +00:00
Eric Biggers
6ba6672ce7 Merge "init: make reboot_on_failure not apply to manually stopped services" am: 890fd0c239 am: 7a07e8c1ad am: 506762b310
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1684056

Change-Id: Ia6a0f3b488a278c062b5cb6a01bc95300bbf788a
2021-05-04 21:53:53 +00:00
Eric Biggers
1c51525f66 init: make reboot_on_failure not apply to manually stopped services
Add a new service flag SVC_STOPPING which tracks whether a service is
being manually stopped by init, and make the "reboot_on_failure" service
setting not apply when SVC_STOPPING is set.

This is needed for devices that use FDE, because otherwise the device
reboots during the following init script fragment:

    on property:vold.decrypt=trigger_shutdown_framework
        class_reset late_start
        class_reset main
        class_reset_post_data core
        class_reset_post_data hal

... because that stops all services, including apexd which has been
marked with reboot_on_failure since
https://android-review.googlesource.com/c/platform/system/apex/+/1325212.
So init was killing apexd, then rebooting the device because apexd
"failed" due to having been killed.  Making reboot_on_failure not apply
when init stops a service itself fixes the problem.

This is one of a set of changes that is needed to get FDE working again
so that devices that launched with FDE can be upgraded to Android 12.

Bug: 186165644
Test: Tested FDE on Cuttlefish
Change-Id: I599f7ba107e6c126e8f31d0ae659f0ae672a25e4
2021-05-03 21:38:50 -07:00
Inseob Kim
43f3a6b92c Merge "Fix precompiled sepolicy logic" am: 4664bbc6c7 am: ff9de56e37 am: 257a50e59d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690527

Change-Id: I359d9a1ea580a79d10f06825ee0a9c554f996c7b
2021-04-30 03:06:34 +00:00
Inseob Kim
4664bbc6c7 Merge "Fix precompiled sepolicy logic" 2021-04-30 01:14:15 +00:00
Inseob Kim
28fdb6794c Fix precompiled sepolicy logic
If precompiled vendor policy has system_ext hash, system_ext also has to
have its hash, to use precompiled sepolicy.

Bug: 186727553
Test: remove system_ext's hash and see sepolicy compiled in runtime
Change-Id: I4af3418d614156b5e9cd0b0116c2814ba994ee81
2021-04-29 19:50:38 +09:00
Treehugger Robot
277178c2c5 Merge "Allow a kernel bootconfig to set the qemu key" am: 6cbc7e01b2 am: 0d13e9370c am: 57f01c51e5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690216

Change-Id: Ia251f2c3fc296783b001d1584f34370e4b73aea6
2021-04-29 04:23:34 +00:00
Treehugger Robot
6cbc7e01b2 Merge "Allow a kernel bootconfig to set the qemu key" 2021-04-29 02:16:33 +00:00
Roman Kiryanov
6e20ff83ac Allow a kernel bootconfig to set the qemu key
The existing code has a lot of references to the
`ro.boot.qemu` and `ro.boot.qemu.something` properties
which is not supported by the bootconfig if we place
everything under `androidboot.qemu`.

Bug: 182291166
Test: getprop | grep qemu
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Icb9d29c8dc39e1fa52a6f2ce43b4f42182b7995d
2021-04-28 15:31:52 -07:00
Treehugger Robot
5f7573c9c4 Merge changes from topic "debug_ramdisk_path" am: c4a1a32e91 am: d6fbaa0945 am: ee2cb68b2d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1687907

Change-Id: If65a7996a499b7a312b0ab0b2a43554c0d807859
2021-04-28 18:59:08 +00:00
Bowgo Tsai
e62fdae795 init: loading debug resources before chroot into first_stage_ramdisk am: 64e92f946f am: 20a73996fa am: ba04147ae5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1684655

Change-Id: I68ff80a39cf6df93486c3b30fa285ab11836b271
2021-04-28 18:59:06 +00:00
Bowgo Tsai
20a73996fa init: loading debug resources before chroot into first_stage_ramdisk am: 64e92f946f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1684655

Change-Id: Idedf53ec0e74a1fd12f4b883a7605200561d5ff3
2021-04-28 18:19:47 +00:00
Treehugger Robot
c4a1a32e91 Merge changes from topic "debug_ramdisk_path"
* changes:
  init: adding fallback paths for debug ramdisk
  init: loading debug resources before chroot into first_stage_ramdisk
2021-04-28 16:27:34 +00:00
Bowgo Tsai
6cb4311f4d init: adding fallback paths for debug ramdisk
Currently the gki_4_19_pixel5 presubmit test uses an old
vendor_boot-debug.img from a release branch. Adding fallback
paths to load debug resources from /first_stage_ramdisk dir to
pass the presubmit.

This CL should be reverted later once the vendor_boot-debug.img
gets updated to store the debug resources on the root dir.

Bug: 186082603
Test: boot a device with boot-debug.img
Test: boot a device with vendor_boot-debug.img
Change-Id: I9fcd77fc5a60a15cff254e432e05f1c9122ad80d
2021-04-27 15:25:31 +08:00
Bowgo Tsai
64e92f946f init: loading debug resources before chroot into first_stage_ramdisk
Currently the debug resources might under /first_stage_ramdisk/*
of the ramdisk, if there is androidboot.force_normal_boot=1 in the
kernel cmdline to request init chroot into /first_stage_ramdisk dir.

To make a generic boot-debug.img works on devices with and without
this chroot, moving the debug resources to the root of the ramdisk.
And copy them for later use before the chroot.

Bug: 186082603
Test: boot a device with boot-debug.img
Test: boot a device with vendor_boot-debug.img
Change-Id: I052a92b2d26c7fdf749991fc55015ff68743efc2
2021-04-27 15:25:18 +08:00
Treehugger Robot
a4c2d51c27 Merge "[Bugfix]Fix userspace-reboot failure when backing_dev exists but zram not swapped on" am: 23a50b3860 am: bce0c15f3f am: 11f3ed6133
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1674154

Change-Id: I1574031bb51c6a0c668be14654ee0ced824ae5ee
2021-04-23 01:09:45 +00:00
Treehugger Robot
23a50b3860 Merge "[Bugfix]Fix userspace-reboot failure when backing_dev exists but zram not swapped on" 2021-04-23 00:28:49 +00:00
Treehugger Robot
73f0dfd416 Merge "init: apexd is started in the current mount namespace" am: 778f2b6837 am: fe5f60d051 am: d61e073a6a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1680266

Change-Id: I6150bf4b982075fc578eec644bd5c0214d0209f1
2021-04-21 06:45:25 +00:00
Jooyung Han
e5232a71b2 init: apexd is started in the current mount namespace
init starts services in "bootstrap" mount namespace until the "default"
mount namespace is ready even when init's current mount namespace is
"default".

apexd and linkerconfig are those processes to set up the mount
namespaces: apexd activates apexes and linkerconfig generates linker
configs.

Previously apexd is allowed to be started in the "current" namespace by
checking its "service name"(it should be "apexd"). But there can be a
certain environment apexd is started in a different way. For example, in
microdroid, apexd is started using "exec -- /system/bin/apexd --vm"
because it wants to run in a different execution mode.

So, instead of checking the service name, its executable's path is
checked against to allow apexd to be started in the current mount
namespace.

Bug: 179342589
Test: MicrodroidTestCase (microdroid boots)
Test: cuttlefish boots
Change-Id: I7c2490e15d481c28ddf382d2d3fdf58a78e467ec
2021-04-20 22:50:12 +09:00
David Anderson
5b7d0be4c3 Merge "ueventd: Allow pattern matching to find external firmware handler" am: 4a3ab034c6 am: dd7da900a0 am: 1875508cdf
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1664121

Change-Id: I25b4c6abe1a3197264b271f01c8ecda14e795e6a
2021-04-16 21:41:00 +00:00
David Anderson
19872d0156 init: Add tests and document the new fnmatch behavior in ExternalFirmwareHandler.
Bug: N/A
Test: atest CtsInitTestCases
Change-Id: I232db8416318ba31ea3f78cc07f235d9a47efac4
2021-04-16 13:35:11 -07:00
Suchang Woo
22fdd0ae13 ueventd: Allow pattern matching to find external firmware handler
Only the exact same devpath uevent can launch external handler specified
in ueventd.rc. So, you should specify all possible devpaths, even
firmware with different filenames on the same device. Pattern mactching
can be used to simplify this.

Test: atest CtsInitTestCases
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
Change-Id: If3b7a2cabb8055bf4b768d928f0fc0012da3c177
2021-04-16 13:35:10 -07:00
Treehugger Robot
7f647a232a Merge "Do not populate ro.kernel. properties in init" am: 5e89a35ae3 am: f7c4f3b94b am: ff435d8995
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1676728

Change-Id: I136d3529e90f8f2ba869ac79da5d1cf54409f9de
2021-04-15 20:09:41 +00:00
luwei9
8a3653cfe2 [Bugfix]Fix userspace-reboot failure when backing_dev exists but zram not swapped on
'/sys/block/zram0/backing_dev' will exist even if zram is not swapped on in some devices. And there is no reason to ensure that zram is swapped on if '/sys/block/zram0/backing_dev' exists. So, if we want to kill backing_dev during userspace reboot, we should check if zram is swapped on first.

TEST: as follow
 - adb root
 - adb shell swapoff /dev/block/zram0
 - adb shell echo 1 > /sys/block/zram0/reset
 - adb shell setprop test.userspace.reboot.flag 1
 - adb reboot userspace
 - (wait reboot ending) adb shell getprop test.userspace.reboot.flag (1 will be show if successful)

Signed-off-by: luwei9 <luwei9@xiaomi.com>
Change-Id: Icca569cf8d64bc024b867dae2ab789fc9e76445a
2021-04-15 08:08:20 +00:00
Roman Kiryanov
f4adb894cc Do not populate ro.kernel. properties in init
`ro.kernel.` is deprecated, emulator migrated to
`ro.boot.`.

Bug: 182291166
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I074f9a63dc4e3edcc01930b2e8481efd1d85eb55
2021-04-14 20:45:55 -07:00
Yo Chiang
ad5c80fda5 Merge "Load *_compat_cil_file from system_ext as well" am: 3841fdfa3c am: 6e944a9484 am: 832c06c27c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1650271

Change-Id: I62e8157a2a320ee0d8e46aca126ca03d433859d7
2021-04-13 07:40:22 +00:00
Yo Chiang
3841fdfa3c Merge "Load *_compat_cil_file from system_ext as well" 2021-04-13 05:48:04 +00:00
Hridya Valsaraju
1e0028a917 Merge "Use property ro.product.enforce_debugfs_restrictions to enable debugfs restrictions" am: 2a8b028c04 am: bdc512a21b am: 230df281ab
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1663702

Change-Id: Ie415770c7639361c9148db761cadf1b26a9c4513
2021-04-12 18:27:55 +00:00
Hridya Valsaraju
2a8b028c04 Merge "Use property ro.product.enforce_debugfs_restrictions to enable debugfs restrictions" 2021-04-12 17:11:23 +00:00
Treehugger Robot
d7f9768f25 Merge "Populate ro.boot.dalvik.vm.checkjni from android.checkjni" am: cd52a78472 am: a50cdc1d0a am: f69c016c5b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1668586

Change-Id: I9693f111b0369ccb6fa485959ebcfdb8dfa51daa
2021-04-08 19:45:34 +00:00
Treehugger Robot
33156eea6f Merge "Populate ro.boot.debug.sf.nobootanimation from android.bootanim" am: a8b2ac4b30 am: 1e9abd4fff am: 5e496f269b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1666095

Change-Id: I344fb7505478ed3fd00245708d3e3252e035c9e4
2021-04-08 19:45:21 +00:00
Roman Kiryanov
0312c20a71 Populate ro.boot.dalvik.vm.checkjni from android.checkjni
emulator passes `android.checkjni` in the kernel
command which we want to use in
frameworks/base/core/jni/AndroidRuntime.cpp

Bug: 182291166
Test: getprop ro.boot.dalvik.vm.checkjni
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: If9473aa9492fa09d8de7cc8fb08614380e4e15f3
2021-04-07 15:55:21 -07:00
Roman Kiryanov
c755e5edf9 Populate ro.boot.debug.sf.nobootanimation from android.bootanim
emulator passes `android.bootanim=0` in the kernel
command line to disable boot animation.

Bug: 182336906
Test: boot emulator with -np-boot-anim
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Id89a6c92dd4724cac414ffbf8ee731b2bfcc7195
2021-04-06 20:44:57 -07:00
Treehugger Robot
35f9c0d65d Merge "ueventd: Fix wrong argument index in devpath comparison" am: 0cf8af6860 am: deca6caf46 am: aec92150f2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1664601

Change-Id: I13b45f9c4544911cde704ca0ef891271eac220a7
2021-04-07 01:19:09 +00:00
Suchang Woo
8681f7e7a3 ueventd: Fix wrong argument index in devpath comparison
args[2](user name to run as) is used instead of args[1](devpath).

Test: atest CtsInitTestCases
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
Change-Id: Id271755993d55e332bad54d0414e2232071e5e8e
2021-04-06 11:15:28 +09:00
Hridya Valsaraju
6b7311fc99 Use property ro.product.enforce_debugfs_restrictions to enable debugfs
restrictions

Use the property ro.product.enforce_debugfs_restrictions to enable
debugfs restrictions instead of checking the launch API level. Vendors
can enable build-time as well as run-time debugfs restrictions by
setting the build flag PRODUCT_SET_DEBUGFS_RESTRICTIONS true which in
turn sets ro.product.enforce_debugfs_restrictions true as well enables
sepolicy neverallow restrictions that prevent debugfs access. The
intention of the build flag is to prevent debugfs dependencies from
creeping in during development on userdebug/eng builds.

Test: build and boot
Bug: 184381659
Change-Id: If555037f973e6e4f35eb7312637f58e8360c3013
2021-04-02 17:00:50 -07:00
Yo Chiang
6979590818 Merge "fs_mgr: Suppress SkipMountingPartitions log in ReadFstabFromFile" am: a2b662cf23 am: 14d8badf58 am: 6b4cb7a2dd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1662019

Change-Id: I8398be0a36d9eed52b88592055c1518cbe10d20e
2021-04-02 07:15:21 +00:00
Yi-Yo Chiang
20579011cf fs_mgr: Suppress SkipMountingPartitions log in ReadFstabFromFile
Minor refactoring and renaming, goal is to make the follow-up patch
easier to read.

Bug: 184132970
Test: Presubmit
Change-Id: I66416161b30ac310934d901cbaf11bc926e2cbf7
2021-04-02 05:23:02 +00:00
Treehugger Robot
484234a373 Merge "Populate all other emulator properties as ro.boot.qemu.*" am: 6463f60a56 am: 07d6796b6f am: 2915bc3bc8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1661935

Change-Id: Icf30f1bdecceec8bf857b35473f238d54a0168e6
2021-04-02 00:11:40 +00:00
Roman Kiryanov
bcc7946ef0 Populate all other emulator properties as ro.boot.qemu.*
Bug: 182291166
Test: getprop | grep "ro\.boot\.qemu\."
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I0d2a4a9edd87999b35fac8496e9cda93fc7d0cf1
2021-04-01 11:39:30 -07:00
Yi-Yo Chiang
731d2473da Load *_compat_cil_file from system_ext as well
So we can extend platform policies with target specific compat rules.
This use case surface in the context of system only upgrade, when the
vendor policy cannot be updated, then the system_ext partition can
contain target specific compat policies.

Bug: 183362912
Test: Presubmit
Change-Id: Ic6436eb8a269f07f932331dedf7dbaa629538ade
2021-03-30 13:05:50 +08:00
Treehugger Robot
752c3c7f83 Merge "Populate more emulator properties to ro.boot." am: 5d5e16db57 am: 669af0aa1e am: 68301b2ddd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624567

Change-Id: I5a9a706afc8d5b87edbb85297b7be591bada972f
2021-03-23 21:12:50 +00:00
Treehugger Robot
942ceeb60a Merge "Do not populate ro.kernel.qemu in ProcessKernelCmdline" am: e37b6f4f67 am: fddb2e3b98 am: 5189edc2c2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1649687

Change-Id: I58dc487de0ce1d3da041c58e3e6f41f77fa403ef
2021-03-23 11:35:34 +00:00
Roman Kiryanov
4ddfd023cc Populate more emulator properties to ro.boot.
ro.boot.config.low_ram
ro.boot.dalvik.vm.heapsize
ro.boot.debug.hwui.renderer
ro.boot.debug.stagefright.ccodec
ro.boot.opengles.version

Bug: 182291166
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I4d7ee19feb13a418a95f31be7534df98dfaeb3e3
2021-03-22 14:34:36 -07:00
Roman Kiryanov
94ce40a527 Do not populate ro.kernel.qemu in ProcessKernelCmdline
The emulator migrated to `ro.boot.qemu`.

Bug: 182291166
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Iaa3bdff5cc1efa79c21ae2dc2bdf7ec74731f66c
2021-03-22 14:18:44 -07:00
Will McVicker
b8325c03a0 Merge "init: fix debuggable paths for recovery mode" am: fb9953e4d3 am: dc64a95871 am: f737aa8549
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1634601

Change-Id: Ia4b0829d0a921331444477e447ce9687d8a04dfb
2021-03-18 23:35:37 +00:00
Will McVicker
8891c2002e init: fix debuggable paths for recovery mode
Since recovery mode doesn't switch root to /first_stage_ramdisk, we need
to update the debuggable file paths for recovery mode. Without this,
adb needs to be authorized in recovery mode even with a debug
vendor_ramdisk.

Bug: 182612208
Test: verify adb is authorized on pixel 5
Signed-off-by: Will McVicker <willmcvicker@google.com>
Change-Id: I557429e1834efcdd92ba0e135377055ffa677137
2021-03-17 18:53:48 +00:00
Alistair Delva
1fa0bd44f0 Merge "init: check for verifiedbootstate in properties" am: fb1cffb46b am: daa9eebcf4 am: 0cf1df828e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1625199

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifd08ea7daa8aff0f2f81a1b71867ca819068d392
2021-03-15 05:44:34 +00:00
Alistair Delva
fb1cffb46b Merge "init: check for verifiedbootstate in properties" 2021-03-15 04:03:17 +00:00
Inseob Kim
69bab73587 Merge "Allow precompiled sepolicy w/o system_ext/product" am: b56165cce3 am: cdac5b72f0 am: dc0a85cfe4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1626229

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iff9e0ab96c9b9478d2a5d3d9d9de5bec16227afe
2021-03-14 16:52:08 +00:00
Inseob Kim
b56165cce3 Merge "Allow precompiled sepolicy w/o system_ext/product" 2021-03-14 15:28:42 +00:00
Roman Kiryanov
a69b993066 Merge "Populate ro.boot.qemu for the emulator device" am: dce1f88bfb am: b132468af1 am: e506d1862f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624291

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0a0f8cf848e1a36c6e28d6207b1b4781f6272528
2021-03-12 07:34:07 +00:00
Roman Kiryanov
2f45ab60f7 Merge "Populate only emulator specific properties into ro.kernel." am: 7787e70417 am: 7cf1c09c6c am: 917c6e0daa
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1625179

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic5cadcc08201136e3918acd073e85ef752f875f5
2021-03-12 07:33:56 +00:00
Roman Kiryanov
2a2de564fb Merge "Move the androidboot. literal into its own variable" am: a3d37ac9b2 am: 8c1cd62d10 am: 49340ac490
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624290

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic15bdcb74224fa495b614d13f56960dcd4598d13
2021-03-12 06:13:42 +00:00
Roman Kiryanov
dce1f88bfb Merge "Populate ro.boot.qemu for the emulator device" 2021-03-12 06:06:03 +00:00
Roman Kiryanov
7787e70417 Merge "Populate only emulator specific properties into ro.kernel." 2021-03-12 06:05:35 +00:00
Roman Kiryanov
a3d37ac9b2 Merge "Move the androidboot. literal into its own variable" 2021-03-12 04:32:13 +00:00
Inseob Kim
d99d977f17 Allow precompiled sepolicy w/o system_ext/product
Some devices might not have system_ext or product partitions. But init
has been refusing to use precompiled sepolicy because init always checks
system / system_ext / product hashes, regardless of existence. This
makes system_ext and product optional, so hash check can be skipped for
non-existing partitions. Of course system is always checked.

Bug: 181640066
Test: boot microdroid and cuttlefish, see precompiled sepolicy works
Change-Id: I32c296fffd894c27097e8b4e10ade977a21d61ab
2021-03-12 11:40:15 +09:00
Roman Kiryanov
4a47c74b75 Populate ro.boot.qemu for the emulator device
Bug: 182291166
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Ied78f42363c1f6580fe6e5660b14c257960aed98
2021-03-11 16:49:17 -08:00
Roman Kiryanov
1a705d4943 Populate only emulator specific properties into ro.kernel.
`ro.kernel.` is an emulator specific prefix.

Bug: 182291166
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Ie4a19127f05f3074ccb02bd055711e9b70702ba6
2021-03-11 16:48:26 -08:00
Roman Kiryanov
ccc15c5dbd Move the androidboot. literal into its own variable
Bug: 182291166
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I19f25671c82fff34dd52e3557361c4340706aab0
2021-03-11 16:46:00 -08:00
Alistair Delva
4b03eee5ca Merge changes from topic "bootconfig-selinux-property" am: c19a7dd30e am: aff8b2da5c am: 3104a550af
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624584

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie71107e6f7797c0c4026cbc1786c5d683ea7b42d
2021-03-11 17:00:55 +00:00
Alistair Delva
4ea63b727e Allow android_dt_dir to be set by bootconfig am: 3bb240bd4c am: 7d0bfb1956 am: 696017ac7c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624583

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I282bd9e51c8c6947e026a4ac3268d967394a804f
2021-03-11 17:00:52 +00:00
Alistair Delva
7d0bfb1956 Allow android_dt_dir to be set by bootconfig am: 3bb240bd4c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624583

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I08c06f25e2098dbf8e27028a0984fea4d26ee9c8
2021-03-11 16:16:53 +00:00
Alistair Delva
c19a7dd30e Merge changes from topic "bootconfig-selinux-property"
* changes:
  Allow selinux to be set by bootconfig
  Allow android_dt_dir to be set by bootconfig
2021-03-11 15:52:02 +00:00
Devin Moore
7cb6333dc2 Merge "Handle "hardware" bootconfig parameter as "androidboot.hardware"" am: 394a1ede40 am: 330ade5851 am: 0ca6f1617b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624139

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib37e60a69e8d2b631a5d6d3e5a6659d482885169
2021-03-11 03:21:52 +00:00
Devin Moore
0a799bdfd6 Handle "hardware" bootconfig parameter as "androidboot.hardware"
The parameter "androidboot.hardware" has been removed from bootconfig
and replaced by "hardware" parameter.

Test: launch_cvd with 4.19 and 5.10 kernels
Test: atest CtsFsMgrTestCases
Bug: 173815685
Change-Id: I627426ae1bd0a165b70b8f2584ec184abfb4236f
2021-03-09 14:10:48 -08:00
Devin Moore
6c01baf075 init: check for verifiedbootstate in properties
This check in export_oem_lock_status happens after PropertyInit() so
all of the ro.boot.* properties will be set. There is no need to import
the kernel cmdline again.

Test: build and boot cuttlefish
Bug: 173815685
Change-Id: I5df7c0105566d4617442dbb8e77eb26e465775f1
2021-03-09 13:56:25 -08:00
Alistair Delva
63594a4dbc Allow selinux to be set by bootconfig
The androidboot.selinux property is loaded in a special way, because it
happens in the "selinux_setup" stage, and not the true second stage.
Allow it to be passed through bootconfig instead of only via the kernel
cmdline.

Bug: 173815685
Test: launch_cvd -extra_kernel_cmdline androidboot.selinux=permissive
Test: launch_cvd -guest_enforce_security=false [bootconfig method]
[..]
init: Permissive SELinux boot, forcing sys.init.perf_lsm_hooks to 1.
[..]
Change-Id: I92003c7a2dac5d6e7d0e0f4ee2757f86cc0087c7
2021-03-09 19:18:50 +00:00
Alistair Delva
3bb240bd4c Allow android_dt_dir to be set by bootconfig
The androidboot.android_dt_dir property is special, because it is loaded
to find out where to get the other DT properties from, and those DT
properties are supposed to override the cmdline/bootconfig ones. So, it
need special casing, and that special case lacked bootconfig support.

Bug: 173815685
Test: launch_cvd -extra_kernel_cmdline androidboot.android_dt_dir=/tmp
[..]
init: Using Android DT directory /tmp
[..]
Change-Id: Ie0958dd0a96394d65f6568653b754ea6f885212e
2021-03-09 19:14:17 +00:00
David Anderson
b8112a37c3 Merge "init: only mlock() system pages when performing snapuserd transitions." am: c90fce4387 am: 0d462c23e0 am: a1e59f9d10
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1621424

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3af8018a6e83c9016eb0c7acbca9b4b40a837258
2021-03-08 21:26:42 +00:00
Devin Moore
a924cec7ff init: handle more bootconfig parameters am: 79058486d2 am: 786355f304 am: 2bdd018b39
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1615298

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5ce7e91c2da7b115316dd4393bd723012c3ebbca
2021-03-08 20:13:05 +00:00
David Anderson
c90fce4387 Merge "init: only mlock() system pages when performing snapuserd transitions." 2021-03-08 19:32:34 +00:00
Devin Moore
786355f304 init: handle more bootconfig parameters am: 79058486d2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1615298

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3a7250bb7c6a7694eb2431d31d9f104721a9507b
2021-03-08 18:44:30 +00:00
Devin Moore
7c98b89886 Merge changes from topic "bootconfig_args"
* changes:
  fs_mgr: handle more bootconfig parameters
  init: handle more bootconfig parameters
2021-03-08 18:27:50 +00:00
Kiyoung Kim
64349c250d Merge "Check if service is executed before APEX is ready" am: fcb28f5d30 am: 2acff0c5e8 am: ce276e54ea
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1612017

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id706840b209c415a67b35546d9e7871c4e923262
2021-03-08 01:39:12 +00:00
Kiyoung Kim
fcb28f5d30 Merge "Check if service is executed before APEX is ready" 2021-03-07 23:56:06 +00:00
David Anderson
9fd8862741 init: only mlock() system pages when performing snapuserd transitions.
Bug: 181032115
Test: manual test w/ VABC OTA
Change-Id: Ib4d2856b9b5eaf8688534f9d84edeb64d4b3244d
2021-03-05 15:44:25 -08:00
Devin Moore
79058486d2 init: handle more bootconfig parameters
As parameters are moved from kernel cmdline to bootconfig,
first_stage_init needs to be updated to handle the new
location.
/proc/bootconfig should be checked first, if not present, then check
/proc/cmdline.

Test: launch_cvd
Test: launch_cvd with 4.19 kernel artifacts that do not support
bootconfig
Test: Both of the above configurations with --num_instances 0 or 4
Test: Both configurations with androidboot.boot_devices or
androidboot.boot_device set
Bug: 173815685

Change-Id: I03743f922351d58375e8b9a903899b8bc54bd71e
2021-03-05 09:21:19 -08:00
Kiyoung Kim
0cbee0de2a Check if service is executed before APEX is ready
Any service which is executed when Runtime apex is mounted, but
linkerconfig is not updated can fail to be executed due to missing
information in ld.config.txt. This change updates init to have a status
variable which contains if current mount namespace is default
and APEX is not ready from ld.config.txt, and use bootstrap namespace if
it is not ready.

Bug: 181348374
Test: cuttlefish boot succeeded
Change-Id: Ia574b1fad2110d4e68586680dacbe6137186546e
2021-03-05 16:42:20 +09:00
Treehugger Robot
c72c69e42d Merge "Detect the absence of the default fstab" am: d9b7c9b4a7 am: 900c6010e0 am: 8cc232422c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1607906

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib919bfa1a2d939ae7ca7629be2ac6836b99b8bb5
2021-03-02 23:27:06 +00:00
Treehugger Robot
900c6010e0 Merge "Detect the absence of the default fstab" am: d9b7c9b4a7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1607906

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1f5b467eab74cc86c525a09210811e51459dab97
2021-03-02 21:50:30 +00:00
Jiyong Park
c6f19688f8 Detect the absence of the default fstab
This is a follow-up of I828ce999be6d786bf46dd5655dfda81d046906ab. The
change introduced a behavioral change that fstab is read twice: before
root is changed to /first_stage_ramdisk, and once again after that.
Previously, that happend only after the root is switched. That change
caused a problem when there is no fstab in DT and fstab is provided via
a file. The fstab file has been at
/first_stage_ramdisk/fstab.<hardware> because that file was supposed to
be read after the root switch.

With the change, init fails to read the fstab during the first attempt
because there is no /fstab.<hardware> at the moment. Here comes the
problem. Although it failed to read fstab, DoCreateService() is invoked
because ReadFirstStageFstab() doesn't report the failure; it returns an
empty fstab object. As a result, DoCreateDevices() is called but it
doesn't create the dm linear device because it couldn't find an fstab
entry having `logical` option.

Then after /first_stage_ramdisk becomes the root, the fstab file is
correctly read. But since the prior run of DoCreateDevices() is recorded
as 'done', init doesn't try to do that again; dm linear device is never
created. Then we fail to mount any of the logical partitions.

This change fixes the problem by modifying ReadFirstStageFstab()
function so that the failure is correctly reported back to the caller.
When it fails, DoCreateDevices() is not called.

Bug: N/A
Test: Watch TH
Change-Id: Idf2dbc6c0fb6c311ab3f5ff1f28315f7daa2b4ce
2021-02-26 17:58:34 +09:00
Treehugger Robot
2ba8fdfe2a Merge "first_stage_mount: Create snapshot devices before launching first_stage_console" am: 0c931aa993 am: c30a2b00ca am: 02a1995eec
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1565166

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie422200b33f48618c6f215c5444b49fcafdb10b0
2021-02-25 23:19:29 +00:00
Treehugger Robot
c30a2b00ca Merge "first_stage_mount: Create snapshot devices before launching first_stage_console" am: 0c931aa993
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1565166

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6d92b22489e5bae7acbe7ae7e0ecbf3f738ba719
2021-02-25 21:49:12 +00:00
Treehugger Robot
0c931aa993 Merge "first_stage_mount: Create snapshot devices before launching first_stage_console" 2021-02-25 20:58:12 +00:00
Devin Moore
37377229af Merge "Support bootconfig in first stage init and fs_mgr" am: cb4ebecbbd am: 7e3beff24e am: bf810e9d93
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1580792

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id4b0bc6dab41d30be112065770c85da6efffb353
2021-02-24 17:57:26 +00:00
Devin Moore
7e3beff24e Merge "Support bootconfig in first stage init and fs_mgr" am: cb4ebecbbd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1580792

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib5cdbb7f02f963b8316439f3f9d6c0d656503155
2021-02-24 16:40:07 +00:00
Devin Moore
a4ef15bebb Support bootconfig in first stage init and fs_mgr
Androidboot parameters are being moved from the kernel commandline to
bootconfig.
fs_mgr looks for these parameters in properties and falls back to
reading directly from /proc/cmdline. So both of these sources are
updated for bootconfig.
The androidboot parameters from /proc/bootconfig
are added as ro.boot properties, and fs_mgr will fall back to searching
/proc/bootconfig if it is too early.

Test: boot cuttlefish with androidboot.fstab_suffix and
androidboot.hardware in bootconfig and not in cmdline.
Test: atest CtsFsMgrTestCases
Bug: 173815685

Change-Id: Iea36a0da94c26e1aa37d97c576725e0ad77cd3ad
2021-02-23 07:42:06 -08:00
TreeHugger Robot
38aa1b393d Merge "Merge ab/7061308 into stage." into stage-aosp-master 2021-02-23 08:45:48 +00:00
Treehugger Robot
183a133977 Merge "Revert^2 "Remove ART APEX from the bootstrap apexes"" am: acc82258cc am: 15108cd4a6 am: 059cf3a6ab
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1581185

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8e38d2670e2fc2daa039aea9848b25a783153aff
2021-02-23 03:15:04 +00:00
Treehugger Robot
059cf3a6ab Merge "Revert^2 "Remove ART APEX from the bootstrap apexes"" am: acc82258cc am: 15108cd4a6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1581185

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6846b4c09d601ca10eaf3b957bba7d62655881a3
2021-02-23 02:17:22 +00:00
Treehugger Robot
acc82258cc Merge "Revert^2 "Remove ART APEX from the bootstrap apexes"" 2021-02-23 00:47:22 +00:00
satayev
d317757826 Merge "Introduce load_exports action." am: 7f9fabad4f am: d30a6991bf am: ef9cb4ecf2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1589512

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ica66311b956b1645b2103da6dcfb7f4799ebf944
2021-02-22 19:06:17 +00:00
satayev
ef9cb4ecf2 Merge "Introduce load_exports action." am: 7f9fabad4f am: d30a6991bf
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1589512

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I18290eedeb9b6c832a5919a9d3f0e978af24bda3
2021-02-22 18:45:08 +00:00
satayev
7f9fabad4f Merge "Introduce load_exports action." 2021-02-22 17:14:19 +00:00
Lisa (LeeWei) Liu
df57474f63 Merge "init: ro.boottime.init.modules" am: 74b03a16be am: 02d2bcf0f6 am: 2f223491a4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1574952

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icff0d087f53cda187636f5e2f56c94f1f8e7c2ee
2021-02-22 04:19:28 +00:00
Lisa (LeeWei) Liu
2f223491a4 Merge "init: ro.boottime.init.modules" am: 74b03a16be am: 02d2bcf0f6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1574952

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8affbaf1398519f642bbbb20e61ef19391c450dd
2021-02-22 03:50:40 +00:00
Lisa (LeeWei) Liu
74b03a16be Merge "init: ro.boottime.init.modules" 2021-02-22 01:57:17 +00:00
Bob Badour
994fe355d9 Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/core" am: d0bfde2f78 am: b2145c414a am: 4cf31dacb3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1591651

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3ea2cdf9470b391f3a1067a9f6eb666fd461d92b
2021-02-21 17:31:20 +00:00
Xin Li
493484d39e Merge ab/7061308 into stage.
Bug: 180401296
Merged-In: I90ee4644f921d6bde03dbaef3f3e86fc080affaa
Change-Id: I0eff7d54656f2b4da44644429a35bdc5ba954fbc
2021-02-21 09:25:21 -08:00
Bob Badour
4cf31dacb3 Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/core" am: d0bfde2f78 am: b2145c414a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1591651

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I67de80308f4c4a44d71f597ae9203a47113d245d
2021-02-21 16:53:45 +00:00
Bob Badour
d69ad69a93 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Id740a7d2884556081fdb68876584b25eb95e1bef
2021-02-19 12:59:05 -08:00
Artur Satayev
500946b637 Introduce load_exports action.
The action reads a file with individual `export` actions declared on
each line, and calls `setenv` for each.

See go/updatable-classpath for details on how this is going to be used.

Bug: 180105615
Test: manual
Change-Id: I5390e52cf8ffd9c3babf31ed854eeecc727351eb
2021-02-19 17:12:26 +00:00
Lisa Liu
08c862fa00 init: ro.boottime.init.modules
Add a property ro.boottime.init.modules to provide kernel modules
loading time in milliseconds. Also add corresponding log to show in init
log along with loaded module count.

Test: boot test
Bug: 178143513
Change-Id: I77e3939c2a271da6841350a8c2a34ad32f637377
2021-02-19 15:59:04 +08:00
Treehugger Robot
ab2290b7d2 Merge "Build first-stage init in Soong" am: 9e22a46db9 am: b8eed6199c am: 844eaae056
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1588294

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2d1fa78344f72783d447479176cd2503e6c50792
2021-02-18 00:30:32 +00:00
Treehugger Robot
844eaae056 Merge "Build first-stage init in Soong" am: 9e22a46db9 am: b8eed6199c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1588294

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifa81eb2609fdf1b16783c06c5762e6bf97593a92
2021-02-18 00:08:40 +00:00
Treehugger Robot
f5186a5128 Merge "Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"" am: ca474f994d am: aea25045ba am: fa48b67e98
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1590280

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifdbd05d3e1c993bf1b6c92161669555fba108abd
2021-02-17 00:46:03 +00:00