Commit graph

3843 commits

Author SHA1 Message Date
Bart Van Assche
fcf047113f init: Apply the NormalIoProfile when creating a service
Prepare for migration of the blkio controller to the v2 cgroup hierarchy
by applying the NormalIoProfile when starting a service. While the
NormalIoProfile is automatically applied when the blkio controller is
mounted in the v1 hierarchy, this is not the case for the v2 hierarchy.

Bug: 213617178
Change-Id: I3cad288a31aa2692e10c778ae1e5fdd04acd66d7
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-08-25 14:01:01 -07:00
Sandro
956ce287f3 Add SeamendcHostTest to selinux.cpp TEST_MAPPING
SeamendcHostTest should run when making changes to selinux.cpp, to
ensure the test logic is updated to match the logic selinux.cpp follows
when it decides to compile the SELinux policy in the OpenSplitPolicy
method.

Bug: 238394904
Test: atest --test-mapping system/core/init/TEST_MAPPING:presubmit
Change-Id: Iaf0ec2356a894b071e6875dd41bcf9e842126e42
2022-08-25 09:26:24 +00:00
Xin Li
4f74d4542d Merge "DO NOT MERGE - Merge Android 13" 2022-08-16 19:08:18 +00:00
Trevor Radcliffe
fcfd725a5c Point directly to generated c sysprop_library
Bug: 226199990
Test: m
Change-Id: I0ea65714f9a27093b37034abde7d59f1951a5cb6
2022-08-12 18:23:40 +00:00
Deyao Ren
aebf88191b Merge "Add apex name to service" am: ec73481e58
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2155014

Change-Id: I3c44c321568173fa11588c2d6c69a43ad48c63f9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-22 23:09:19 +00:00
Jooyung Han
07316159c3 Merge "Respect namespace mnt" am: ba1fbaf50c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2163903

Change-Id: I67d5c5d93109b97b376fb97b01618893aba8af13
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-22 23:08:56 +00:00
Deyao Ren
ec73481e58 Merge "Add apex name to service" 2022-07-22 23:03:45 +00:00
Jooyung Han
5eb441caca Respect namespace mnt
This fixes the regression of aosp/2153354.
SwitchToMountNamespaceIfNeeded() is supposed to switch between "default"
mount namespace and "bootstrap" mount namespace. But it shouldn't affect
services with its own mount namespace.

Bug: 239882455
Test: make a hal service start in a separate mount namespace
    using 'namespace mnt' in its definition.
    see the mount namespace of the service process
    $ cat /proc/$(pgrep -f myservice)/ns/mnt
Change-Id: I8c80eaec723241c405f48980b9e88640123c43ad
2022-07-23 01:41:18 +09:00
Deyao Ren
df40ed1be1 Add apex name to service
Passed apex file name to service. The file name will be parsed
to determine 1) whether the service is from an apex; 2) apex name

Bug: 236090201

Change-Id: I2c292c0c067f4bf44bb25b1f80e4f972b94f7258
2022-07-22 04:00:30 +00:00
Yi-yo Chiang
a367bdbc4c Merge "Revert "first_stage_mount: Bind mount /system after switch root"" am: e321b113d6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2159462

Change-Id: Ie9afb0754d73a7bdcf735c8dc6d1c0fec4a514db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 03:57:26 +00:00
Yi-yo Chiang
e321b113d6 Merge "Revert "first_stage_mount: Bind mount /system after switch root"" 2022-07-20 03:49:59 +00:00
Zhuoyao Zhang
54ec48fad7 Revert "first_stage_mount: Bind mount /system after switch root"
This reverts commit d7e6353a69.

Reason for revert: b/239574953 breaking emulator based test on g3

Change-Id: Ib7d17fe8383937c7764f6612cf89db4fb7e5a4d3
2022-07-19 18:09:42 +00:00
Jiyong Park
35ed22e7c0 Merge "Enhance documentation about SetMmapRndBitsAction" am: ccb1ce32cc
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2156356

Change-Id: I86fbac8de9872ef6733cbd05bb140e1c92820d43
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-19 05:06:30 +00:00
Jiyong Park
a9f856b13b Merge "init: don't touch mmap_rnd_compat_bits on 64-bit only builds" am: 2d79c6c096
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2154914

Change-Id: I1e3ef837b69b85c5a554a9d0f41d319dd986ecb4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-19 05:06:20 +00:00
Jiyong Park
ccb1ce32cc Merge "Enhance documentation about SetMmapRndBitsAction" 2022-07-19 04:41:32 +00:00
Jiyong Park
2d79c6c096 Merge "init: don't touch mmap_rnd_compat_bits on 64-bit only builds" 2022-07-19 04:40:39 +00:00
Jiyong Park
5b16ccb36e Enhance documentation about SetMmapRndBitsAction
Bug: N/A
Test: N/A
Change-Id: I0408158d181ef08831a55e1381477f5b128a5c52
2022-07-19 10:47:47 +09:00
Jooyung Han
6bfcefca0a Merge "Update linker configuration when loading apex" am: 11e757c9cc
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2155096

Change-Id: Ife9943c015595c8d1381716fede99ad0fce2fab1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-18 23:59:47 +00:00
Jooyung Han
11e757c9cc Merge "Update linker configuration when loading apex" 2022-07-18 23:39:56 +00:00
Yi-yo Chiang
c3e43e63fe Merge "first_stage_mount: Bind mount /system after switch root" am: 53f1fab6ac
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2146960

Change-Id: I6f8029284650238dcca3727cb9be81d486a9d314
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-18 10:08:01 +00:00
Yi-yo Chiang
53f1fab6ac Merge "first_stage_mount: Bind mount /system after switch root" 2022-07-18 09:47:56 +00:00
Jooyung Han
626be07153 Update linker configuration when loading apex
On ctl.apex_load <apex_name> control message, init invokes linkerconfig
to update linker configuration for the updated apex.

Bug: 232173613
Test: CtsInitTestCases
Test: VendorApexHostTestCases
Change-Id: I01d975849c3f4efe74205a7b04ebbd6864ba1121
2022-07-18 17:45:15 +09:00
Treehugger Robot
f8415fdc19 Merge "first_stage_mount: Fix log typo "check_at_most_once"" am: 4bc5277152
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2146961

Change-Id: Id41980ebd8e4ec7353def81828f0138374858a49
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-18 06:18:51 +00:00
Jiyong Park
11d7bc52df init: don't touch mmap_rnd_compat_bits on 64-bit only builds
mmap_rnd_compat_bits is for address space randomization of 32-bit
applications on 64-bit system. Configuring it is not only unnecessary
for 64-bit "only" builds, but also can cause a boot failure if the
kernel is built without CONFIG_COMPAT which is the case for Microdroid.

Use ro.product.abilist32 to determine whether 32-bit applications are
supported and if not, don't configure it, but mmap_rnd_bits.

Bug: 237950549
Test: run Microdroid with the kernel built with aosp/2153639

Change-Id: Ifca6fa02f14ad4c7d8f9b2ab8852494c12945c3a
2022-07-18 14:31:13 +09:00
Yi-Yo Chiang
a3832d496b first_stage_mount: Fix log typo "check_at_most_once"
Was "check_most_at_once", should be "check_at_most_once".
Also straighten the if-then-else logic from:
  if (cond) {
    // then
  } else {
    // error...
    return;
  }
to:
  if (!cond) {
    // error...
    return;
  }
  // fallthrough is "then"

Test: Presubmit
Change-Id: I85c1e94c47a727089374d5d05ecd40f4187b66a1
2022-07-18 04:38:02 +00:00
Jooyung Han
db126b9a4e Merge "Return Result<T> from Do(Un)LoadApex()" am: 46fa45d82c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2155095

Change-Id: Ib73a4ed9cfb73ebd26cd03d2c3119aab5f17c5e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-16 03:19:31 +00:00
Jooyung Han
a2fe3e577e Return Result<T> from Do(Un)LoadApex()
For consistent error message. This is a preparation step for the
follow-up change: to generate linker configuration in DoLoadApex()

Bug: 232173613
Test: CtsInitTestCases
Change-Id: I27954ae2429e82da1bde1925ef62b277c24129d3
2022-07-16 08:37:06 +09:00
Jooyung Han
000b85449c Merge "init starts servicemanagers in "default" mount ns" am: e89c457157
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2153354

Change-Id: I9fcb98938403626697ea5b515e1f5d2c82fbefd8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-15 00:34:25 +00:00
Jooyung Han
c5fa15e08c init starts servicemanagers in "default" mount ns
servicemanager/hwservicemanager are pre-apexd services but still wants
to see VINTF fragments from APEXes, especially from /data.

Like ueventd, these services need to be started in "default" mount
namespace.

Bug: 237672865
Test: m && boot
Change-Id: I0266c5be5530a1a07f8ffa23a26186d45a55613f
2022-07-14 18:31:21 +09:00
Treehugger Robot
e03286ac40 Merge "Add ctl.apex_(un)load properties to (un)load apex" am: e271146ec8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2146970

Change-Id: I26a3865aaaae2ded31c84e701a0a6fe3592b65a1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-13 04:20:59 +00:00
Treehugger Robot
e271146ec8 Merge "Add ctl.apex_(un)load properties to (un)load apex" 2022-07-13 04:04:20 +00:00
Treehugger Robot
592de2a382 Merge "Don't kill subcontext if it's null" am: 932e069f0f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2146830

Change-Id: Ib839545df89ff9b6c6b554d7429c2f6e602a32f3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-11 07:17:30 +00:00
Inseob Kim
5caaa5575e Don't kill subcontext if it's null
We don't initialize subcontext in microdroid. subcontext->pid() will
crash in such case.

Test: atest MicrodroidTests
Change-Id: Ifca65acededbf7f113d8bf16afbb8e2c1aa91b41
2022-07-11 14:34:15 +09:00
Jooyung Han
678f0b4828 Add ctl.apex_(un)load properties to (un)load apex
These props are supposed to be used by apexd when installing an apex
without reboot. During the installation, apexd will unmount the current
one and mount the new one. Since the path and its contents will be
replaced, anything loaded from the apex should be unloaded before
unmounting. After apexd mounts the apex again, then init should re-read
.rc files from the apex.

This change only addes required properties:
- ctl.apex_load <apex_name>
- ctl.apex_unload <apex_name>
- init.apex.<apex_name> = loaded | unloaded

Bug: 232114573
Bug: 232173613
Test: atest CtsInitTestCases
Change-Id: I4a8942d67912e2f11acc51bec756c4e3c218179a
2022-07-07 15:58:33 +09:00
Yi-Yo Chiang
d7e6353a69 first_stage_mount: Bind mount /system after switch root
This ensures /system to be a mountpoint, which allows adb-remount to
change the subtree propagation type of /system and MS_MOVE submounts
under /system.

Test: Add submount under /system and adb remount
Change-Id: Ib281be41eaf86bc3e6b7dfac893e5e27b8374da8
2022-07-06 21:51:35 +08:00
Treehugger Robot
0aa01859e6 Merge "Add lz4 support for VABC" am: 3854a69d39
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2061511

Change-Id: I5e15a317788ea6eba843b2c3c6770d549ea7db48
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-30 00:42:20 +00:00
Kelvin Zhang
5cb1b0295e Add lz4 support for VABC
Add lz4 support in CowWriter/CowReader. Lz4 should offer faster
read/write performance but slightly larger COW sizes.

Download time: Reduced from 1264s to 825s (~35% faster)
Filesystem verification time: from 69s to 59s (~15% faster)
COW Size: 2.59GB to 3.21GB, (~25% regression)
Merge time: 37046ms to 27690ms (~25% faster)
Boot time: LZ4 is 2.7% faster

Overall, LZ4 offers faster read/write performance at the cost of 25%
space regression.

Test: th
Bug: 228478555
Change-Id: Ie521852fb3c9ff8a12e55b764c1eb1838f7b2181
2022-06-29 13:10:55 -07:00
Xin Li
ebe6598a1c Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: Ia927c19f544536f78c20ccef5830bd1be0cebf9b
Change-Id: I0267b9eaad470a56db68f3a0b99abfc41192c6d7
2022-06-28 21:23:43 +00:00
Yi-Yo Chiang
01a7dcb240 first_stage_init: Optimize redundant vector copy
```
std::vector<std::string> v2;
for (auto&& e : get_temporary_v1()) { v2.push_back(e); }
```
^^^ This is constructing v2 from a temporary object, which is an
unnecessary manual clone. We should just let copy-elision do its thing:

```
// Give compiler the chance to optimize this with copy-elision...
auto v2 = get_temporary_v1();
```

Also `lp_names` appends an extra ',' at its end. Just use
android::base::Join() here.

Bug: 235111004
Test: Presubmit GSI boot test
Change-Id: Ibe8ce7a29b8521e789aa0a99f7f6d31f3f9c70e9
2022-06-27 16:19:37 +00:00
Eric Biggers
1179b02637 Merge "Rename fscrypt_is_native() to IsFbeEnabled()" am: e5a9a70437 am: 3d3a52a7d4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2127464

Change-Id: I192f917501e5c04aa9ea80168a20ed688edd2116
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-22 19:07:49 +00:00
Eric Biggers
e5a9a70437 Merge "Rename fscrypt_is_native() to IsFbeEnabled()" 2022-06-22 18:24:38 +00:00
Treehugger Robot
de80927e34 Merge "Promote HWASan tests to presubmit." am: 8874ad6378 am: 5efde0b299
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2130634

Change-Id: I4f6f55c73906c4a41a3fbca444674d169cdd1795
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-21 18:09:49 +00:00
Florian Mayer
4effd2f901 Promote HWASan tests to presubmit.
They have been passing and do not show significant slowdown.

Change-Id: I3eba6ecb746160d75e9a2c9561bceb71a09117d3
2022-06-17 22:29:09 +00:00
Eric Biggers
893b1ae313 Rename fscrypt_is_native() to IsFbeEnabled()
Now that emulated FBE is no longer supported, there is no longer any
distinction between native FBE and emulated FBE.  There is just FBE.

Referring to FBE as "fscrypt" is also poor practice, as fscrypt (the
Linux kernel support for filesystem-level encryption) is just one part
of FBE, the Android feature.

Therefore, rename fscrypt_is_native() to IsFbeEnabled().

Bug: 232458753
Change-Id: Ib4dcdf799833b91d326b4b6f7120b0a3d4f4fc31
2022-06-15 18:52:39 +00:00
Treehugger Robot
42ffffd8a1 Merge "Chmod for existing nodes which mode not the same as ueventd.rc" am: a50d431830 am: 79c6750b85
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2063313

Change-Id: Ie057274f2586cb6d2dcbe0a7e5a04d70764c0c70
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-14 17:06:39 +00:00
Treehugger Robot
a50d431830 Merge "Chmod for existing nodes which mode not the same as ueventd.rc" 2022-06-14 14:14:15 +00:00
Yi-yo Chiang
df05b6d488 Merge "Auto enable usb adb if booting with debug ramdisk" am: 155bba8b0c am: 0d9240f898
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2119852

Change-Id: I4bf912c06184106b9effda1e9259ab26362a93c5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-10 13:05:27 +00:00
Yi-Yo Chiang
70c53f5d52 Auto enable usb adb if booting with debug ramdisk
If booting with debug ramdisk (ro.force.debuggable is true), override
the persistent property "persist.sys.usb.config" to always enable adb.
This ensures a consistent debug experience. The developer can expect
that after debug ramdisk (debug boot image) is flashed,
1. Device is rootable with (adb root)
2. adb is enabled automatically
3. no-auth (if $ADB_VENDOR_KEYS is used)

Bug: 223517900
Test: 1. Flash & boot user build, verify device doesn't have usb
  debugging enabled.
  2. Reboot to bootloader and flash vendor_boot-debug.img.
  3. Boot and verify usb debugging is automatically enabled.
  4. Enter Developer Options and manually turn off usb debugging.
  5. Reboot and verify that usb debugging is automatically enabled.
Change-Id: I729e961d645f2dd521ead8ca30b5cb8eb1d9f909
2022-06-08 23:07:13 +08:00
Kean Mariotti
7772fc84f5 Merge "Revert "Set the log callback earlier for showing system property set denials"" am: 526fbe2a37 am: c0e0892a5a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2118487

Change-Id: I351a3a385c5d1be27258343db342910c5ec0291f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-08 09:50:51 +00:00
Kean Mariotti
526fbe2a37 Merge "Revert "Set the log callback earlier for showing system property set denials"" 2022-06-08 09:07:42 +00:00