Commit graph

3815 commits

Author SHA1 Message Date
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
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
Kean Mariotti
3a6040eb71 Revert "Set the log callback earlier for showing system property set denials"
This reverts commit 8c224faa24.

Reason for revert: 235312897

Change-Id: I80684c80bb6f97853449d429bbf948c07d4cb651
2022-06-08 07:57:53 +00:00
Alex Hong
c0b9b5f2d3 Merge "Set the log callback earlier for showing system property set denials" am: af74368a36 am: 219306f683
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1684665

Change-Id: Ic880afd4b9393b6d5e0516c914d00c5ec27de55c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-08 06:11:38 +00:00
Alex Hong
af74368a36 Merge "Set the log callback earlier for showing system property set denials" 2022-06-08 05:37:22 +00:00
Treehugger Robot
c6e1bb2b8c Merge "Added libinit_headers to Android.bp" am: ac9b59ed5a am: e8ee78b0db
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1985237

Change-Id: I3d4364cb1f4ac8a3186ea862cb8a0f317f569059
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 09:42:33 +00:00
Treehugger Robot
ac9b59ed5a Merge "Added libinit_headers to Android.bp" 2022-06-03 08:57:08 +00:00
Akilesh Kailash
6e01fe9537 Merge "init: Set oom_score_adj to snapuserd process" am: cb3ef68f22 am: 1aae2b57f6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2114498

Change-Id: I4b2186888dff2daef99b9fa356802b60906c13fc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-02 21:59:38 +00:00
Akilesh Kailash
4ffe8a3109 init: Set oom_score_adj to snapuserd process
When a process is started as a native service,
oom_score_adj is set to -1000 so that processes
are unkillable by lmkd.

During boot, snapuserd process is not started as a service;
hence, we need to set the oom_score_adj explicitly else in
the event of low memory situation, lmkd can kill the
process thereby device can never boot.

Bug: 234691483
Test: th and OTA on Pixel
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ic2c85aa470522b4bc847a16b4f5cebfc528ed3cf
2022-06-02 20:49:03 +00:00
Thiébaud Weksteen
ddbc4fdad1 Merge "Add documentation on mkdir about seclabel" am: 715ecbfb23 am: 46e8d29a4f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2110586

Change-Id: I2ff96f2a0dece853749315e1b3dcceadc5d34f75
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 00:02:16 +00:00
Thiébaud Weksteen
715ecbfb23 Merge "Add documentation on mkdir about seclabel" 2022-05-31 23:27:22 +00:00
Thiébaud Weksteen
cc2fb50f52 Add documentation on mkdir about seclabel
Test: n/a
Change-Id: Iab672b4755a259caacf495a6692afcb268b4205f
2022-05-31 14:47:13 +10:00
Kelvin Zhang
151ca69317 Merge changes from topic "snapuserd_ramdisk" am: 321d47639e am: 8e9150e9ba
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2095787

Change-Id: I7204ab5c5d801ca7f4e593203d61458660a091f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-25 16:27:07 +00:00
Kelvin Zhang
321d47639e Merge changes from topic "snapuserd_ramdisk"
* changes:
  Prefer generic ramdisk copy of snapuserd
  Install snapuserd.ramdisk with a separate path
2022-05-25 15:39:17 +00:00
Treehugger Robot
0055dab511 Merge "Suppress most load_property_from_file logs" am: 216b8b67fb am: 9c52f509d7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2101492

Change-Id: Id82e6a0d400957023bc335d7826da1565d578a25
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-25 04:44:48 +00:00
Treehugger Robot
216b8b67fb Merge "Suppress most load_property_from_file logs" 2022-05-25 03:56:24 +00:00
Inseob Kim
946c972162 Suppress most load_property_from_file logs
Some partitions may not have build.prop files (and it's totally fine).
Rather than logging such failures as WARNING, load_property_from_file
now returns a Result<void> object so callers can manually log for
themselves.

Bug: 228389036
Test: boot and logcat
Change-Id: Ia4ad7eef34d572182a3f6e86547664ae31dfd29f
2022-05-25 09:47:08 +09:00
Treehugger Robot
4bdbd24b22 Merge "init: Disable 'on' for non-Vendor APEXes" am: 8b3dff3e82 am: bff647cabd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2101572

Change-Id: I766637091cfbf9b74905f99653d39b9d5c1c201a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-24 14:11:59 +00:00
Jooyung Han
99fa346c35 init: Disable 'on' for non-Vendor APEXes
Mainline modules are not supposed to rely on 'on' action triggers in
their init scripts because events/properties are not guranteed to be
stable across many devices.

To reduce the potential risk of enabling 'on' for APEXes, for now, we
enable it for only Vendor APEXes.

When an init script in a non-Vendor APEX contains 'on' section, init
emits an error on parsing the script and skip the section.

For example, when init.rc in the ADBD APEX has 'on' section,
the following error is emitted on parsing the script.

  init: Parsing file /apex/com.android.adbd/etc/init.rc...
  init: /apex/com.android.adbd/etc/init.rc: 8: ParseSection() failed:
    'on' is supported for only Vendor APEXes.

Bug: 232543017
Test: see above
Change-Id: I6509c8d2c6b632369d215128f740f9ed78858605
2022-05-20 09:31:08 +00:00
Treehugger Robot
af4e6561d7 Merge "init: log services requested restart" am: 0ddcf6d2f1 am: 4d3bf512b0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2099238

Change-Id: I8ef99df0a8ecb38f14d5fdf12374f240f0439f37
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-18 06:38:58 +00:00
Treehugger Robot
0ddcf6d2f1 Merge "init: log services requested restart" 2022-05-18 05:31:04 +00:00
Steven Moreland
61169c76dd init: log services requested restart
We have a case where a service is requested to be started and does
not appear to be running, but we see no indication that it is
actually starting. This log should be enough information to see
if init is in a bad state.

Bug: 232297944
Test: doesn't add too much spam
    ~/android/aosp/system/core/init :) adb logcat -d | grep "requested start" | wc -l
    42
Change-Id: Ic07f250c98b200b9e5b4432200c3668c6ca0ff35
2022-05-17 22:54:55 +00:00
Eric Biggers
2f7a362c42 Merge changes If6611d64,Ie55c3ac1 am: 9fcf000264 am: 1e67c2529f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2098430

Change-Id: Icb7c4a40e6f7c0ffaccc5f1b456965fe111dd074
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-17 02:19:05 +00:00
Eric Biggers
48c05a6d03 init: remove unneeded special cases from FscryptInferAction
All the individual directories being treated specially by
FscryptInferAction() already have an explicit encryption action in the
corresponding mkdir commands.  The explicit action is the source of
truth, so the special cases in FscryptInferAction() are unnecessary.

Also, some of these cases were outdated.  For example, /data/app-staging
was changed from encryption=None to encryption=DeleteIfNecessary at some
point, but FscryptInferAction() was not updated.  This is causing the
warning "Inferred action different from explicit one" to be logged.

Additional "Inferred action different from explicit one" warnings are
logged due to subdirectories of /data/apex being explicitly encrypted.

Change FscryptInferAction() to only do what it needs to do: check
whether the directory is a top-level directory of /data or not.  Remove
the above-mentioned warning which is not useful.

Bug: 232554803
Change-Id: If6611d64107a19d242892c92dfea095577e193e5
2022-05-16 19:06:22 +00:00
Eric Biggers
6cb5a36f4c init: fix mkdir to reliably detect top-level /data directories
To determine the default encryption action, the mkdir command checks
whether the given path is a top-level directory of /data.  However, it
assumed a path without any duplicate slashes or trailing slash(es).

While everyone *should* be providing paths without unnecessary slashes,
it is not guaranteed, as paths with unnecessary slashes still work
correctly for all other parts of the mkdir command, including the
SELinux label lookup and the actual directory creation.  In particular,
the /data/fonts directory is being created using 'mkdir /data/fonts/'.

The effect is that the mkdir command thinks that /data/fonts/ is *not* a
top-level directory of /data, so it defaults to no encryption action.
Fortunately, the full command happens to use "encryption=Require", so we
dodged a bullet there, though the warning "Inferred action different
from explicit one" is still triggered.

There are a few approaches we could take here, including even just
fixing the /data/fonts/ command specifically, but I think the best
solution is to have mkdir clean its path at the very beginning.  This
retains the Linux path semantics that people expect, while avoiding
surprises in path processing afterwards.  This CL implements that.

Note, this CL intentionally changes the behavior of, and thus would
break, any existing cases where mkdir is used to create a top-level
/data directory using a path with unnecessary slashes and without using
an explicit encryption action.  There are no known cases where this
already occurs, however.  No cases exist in platform code, and vendor
init scripts shouldn't be creating top-level /data directories anyway.

Test: atest CtsInitTestCases
Test: Booted and verified that a trailing slash is no longer present in
      the log message "Verified that /data/fonts/ has the encryption
      policy ...".  Also verified that the message "Inferred action
      different ..." is no longer present just above it.
Bug: 232554803
Change-Id: Ie55c3ac1a2b1cf50632d54a1e565cb98c17b2a6a
2022-05-13 19:29:00 +00:00
Jooyung Han
4a8d564a5e Merge changes from topics "action-in-apex-config", "apex-ready-event", "subcontext-for-vendor-apex" am: ec76b5cb4e am: 364bc73186
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2093006

Change-Id: I3f9f6446af71094526e3c5a2ff2034ba25495c7a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-13 03:55:45 +00:00
Jooyung Han
03baf470dc APEX configs support 'on' as well am: badb7de1a2 am: bc3ec37dad
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2093004

Change-Id: I6b656e0e9de265f1532406236d38578e2a99cf7f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-13 03:55:36 +00:00
Jooyung Han
bc3ec37dad APEX configs support 'on' as well am: badb7de1a2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2093004

Change-Id: Iab5bc7325e65c464d42e775d724e7e834671081a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-13 03:13:09 +00:00
Jooyung Han
ec76b5cb4e Merge changes from topics "action-in-apex-config", "apex-ready-event", "subcontext-for-vendor-apex"
* changes:
  Use subcontext for APEX configs from /{vendor, odm}
  add apex-ready event after post-fs-data
  APEX configs support 'on' as well
2022-05-13 01:47:40 +00:00
Eric Biggers
0368bbdf6b Merge "Move creation of /data/user/0 and /data/media/obb to vold" am: 93a8fc215e am: 1cbab9e135
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2095463

Change-Id: I6d28654336561d4b2ff0e114c3100a654124ad6a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 19:57:48 +00:00