Commit graph

81828 commits

Author SHA1 Message Date
Yi-Yo Chiang
79ad1e2e9b init: Unify kernel bootconfig parser with libfs_mgr
Right now there are two bootconfig parsers that gets linked into `init`.
One is from libinit itself and the other is from libfs_mgr.

The one in libinit removes all space characters between list elements,
so `key = "val1", "val2"` gets unquoted and squeezed into:
  `key=val1,val2`
The one in libfs_mgr doesn't remove spaces, it only unquotes:
  `key=val1, val2`

The libinit behavior is due to existing systems (such as sysprop)
expect the config value to be in the same format as kernel cmdline.
(aosp/1757971)
THe libfs_mgr behavior is due to the `androidboot.boot_device[s]`
format explicitly allows quoted comma appear in its list value, thus
relies on space, not comma, as the list value delimeter.

This commit merges the two parsers into libfs_mgr. Since all usages in
libfs_mgr besides `boot_device[s]` do not care about how list value are
delimited, and most usages in init expects the bootconfig value format
to be the same format as cmdline. We just special case the
`boot_device` scenario.

Also harden the test cases to cover all the different config value
format and expected result.

Note:
The format of kernel bootconfig is described here
https://docs.kernel.org/admin-guide/bootconfig.html

Bug: 293695109
Test: CtsFsMgrTestCases
Change-Id: I42b9bf626e8de38a60e8e09fac0693126b7efd91
2023-08-02 09:57:37 +00:00
Yi-Yo Chiang
0b30e34a04 Merge "init: Unify duplicated get_android_dt_dir with libfs_mgr" into main 2023-08-02 09:56:36 +00:00
David Anderson
c99cd86610 Merge "libsnapshot: Introduce a dynamically linked version of libsnapshot." into main 2023-08-01 16:35:44 +00:00
David Anderson
a637416a87 libsnapshot: Introduce a dynamically linked version of libsnapshot.
This will cut down on the binary sizes of update_engine, snapshotctl,
and lpdumpd.

Bug: 291688516
Test: treehugger
Change-Id: Idae5ea075ab21c2bd4fdb839eb065d865cb07d58
2023-08-01 16:35:38 +00:00
Jooyung Han
deff223842 Merge "Revert "Use /bootstrap-apex for bootstrap APEXes"" into main 2023-08-01 10:44:45 +00:00
Yi-Yo Chiang
b8c23259b1 init: Unify duplicated get_android_dt_dir with libfs_mgr
init and libfs_mgr both defines get_android_dt_dir() with subtle
differences. Merge the two implementations into libfs_mgr to reduce code
duplication (in terms of source code and code gen)

Note:
init's implementation checks the kernel cmdline first and then the
kernel bootconfig, while libfs_mgr's order is the opposite.
Realistically I don't think this order matter much though. If any, we
should prioritize bootconfig over kernel cmdline most of the time.

Bug: 293695109
Test: Presubmit
Merged-In: Ic8d2c965c62f9e873ccdaf77d67c7708f25a7b56
Change-Id: Ic8d2c965c62f9e873ccdaf77d67c7708f25a7b56
2023-08-01 10:15:05 +00:00
Jooyung Han
840691be71 Revert "Use /bootstrap-apex for bootstrap APEXes"
Revert submission 2666915-share-bootstrap

Reason for revert: b/293949266 vold_prepare_subdirs fails to create apexdata directories.

Reverted changes: /q/submissionid:2666915-share-bootstrap

Change-Id: I3e97e8511755844de4b54f51ff20afc154bd8e74
2023-08-01 09:06:47 +00:00
Yi-Yo Chiang
d53c1a7b62 Merge changes Ib70a8498,I06f7450c into main
* changes:
  fs_mgr: Split libfs_mgr and libfstab
  fs_mgr: Remove `include_dirs` declaration
2023-08-01 05:11:13 +00:00
Yi-Yo Chiang
96126069c2 fs_mgr: Split libfs_mgr and libfstab
The goal is to make the header definitions of the two curiously
intertwined libraries less chaotic.

After this change, libfstab's header would be self contained. In the
sense that all symbols exported by its headers are defined in its
compilation units.
libfs_mgr would still embed libfstab like before, it can use internal
symbols (symbols not exported by public headers) of libfstab through
the libfstab/fstab_priv.h private header.

Keep include_fstab/ as a symbolic link pointing to its new location.
This is a temporary workaround as there are still some bad build rules
(incorrectly) depending on the old include path with Android.bp
`include_dirs` directive.

Bug: 293695109
Test: build
Change-Id: Ib70a84984ac2cbfca5f5b27fadebf6a16e58146a
2023-08-01 04:56:41 +00:00
Yi-Yo Chiang
c30f033b4e fs_mgr: Remove include_dirs declaration
We aren't using anything through the removed path.
We also shouldn't use `include_dirs` to begin with, as it bypasses any
build system checks.

Bug: 293695109
Test: build
Change-Id: I06f7450c3ce545aa2583f8c3f8db18c45073f69e
2023-08-01 04:56:41 +00:00
Yi-Yo Chiang
bb1cc95f6c Merge "fs_mgr: Refactor mandatory overlayfs kernel patch checks" into main 2023-08-01 04:56:06 +00:00
Kelvin Zhang
dccb1e904d Merge "Make libdebuggerd ramdisk available." into main 2023-08-01 04:46:48 +00:00
Yi-Yo Chiang
d838dde6aa fs_mgr: Refactor mandatory overlayfs kernel patch checks
The check result can just return the exact mount flags to use, this
reduces code duplication at the caller's side.

Bug: 293695109
Test: adb-remount-test
Change-Id: I9b5c918968f2494c0c1be3cb8d8e6b527a9c4eb2
2023-08-01 03:32:54 +00:00
Yi-Yo Chiang
f6dc8ee31e Merge "libfstab: Unexport InRecovery()" into main 2023-08-01 03:19:48 +00:00
Yi-Yo Chiang
7b5c38f8eb libfstab: Unexport InRecovery()
It was accidentally moved to the public header when I was previously
refactoring the code. It hasn't caused any harm yet, but we probably
don't want to export this, too.

Bug: 293695109
Test: build
Change-Id: Id81c802cc6cc697c5a4204638aa467966bea1562
2023-08-01 03:19:39 +00:00
Jooyung Han
58ba0b44c2 Merge "Use /bootstrap-apex for bootstrap APEXes" into main 2023-07-31 21:53:57 +00:00
Jooyung Han
e90d93ab6e Merge "init: move MarkServicesUpdate later" into main 2023-07-31 21:47:13 +00:00
Christopher Ferris
48d6e0452e Make libdebuggerd ramdisk available.
Test: Builds and debuggerd unit tests pass.
Change-Id: I2a5bd96e349f81ae0bec8dbffc49646c1f58bfea
2023-07-31 14:24:01 -07:00
Jooyung Han
201801ce8e Use /bootstrap-apex for bootstrap APEXes
This new directory is bind-mounted to /apex in the bootstrap mount
namespace so that apexd-bootstrap mounts bootstrap APEXes there via
/apex.

The directory is detached from /apex in the default mount namespace but
still visible in case bootstrap APEXes are needed.

However, there are (mostly, virtual) devices which don't need two mount
namespaces. Those devices don't need to make /bootstrap-apex directory
at all.

Bug: 290148078
Test: atest VendorApexHostTestCases
Test: atest MicrodroidTests
Change-Id: I541cec71d9970b14971d46e01e4808b23590dbed
2023-07-31 18:16:46 +09:00
Akilesh Kailash
1db90d0aac Merge "libsnapshot: Verify the ordering of COW operations." into main 2023-07-28 22:52:20 +00:00
Daniel Zheng
b0f9c07590 Merge "Adding include to functional" into main 2023-07-28 20:00:44 +00:00
Daniel Zheng
750fe6a37b Adding include to functional
adding include to functional since we use it in this file. Some users
are reporting build issues due to missing this include

Test: m fastboot
Change-Id: I9ba11bdaf7dcedf5f9ebfb6fa50013be50738f48
2023-07-28 11:00:16 -07:00
Akilesh Kailash
63ec4c6180 libsnapshot: Verify the ordering of COW operations.
Sequence op should contain all ordered ops followed
by Replace and Zero ops. There shouldn't be any non-ordered
ops embedded between ordered ops in the sequence ordering.

Bug: 290159346
Test: inspect_cow <cow_file>, OTA
Change-Id: Ia840340b0e4be07525f216838043bf0265f690c3
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-07-28 10:11:06 -07:00
Jooyung Han
5ffd88f26f init: move MarkServicesUpdate later
MarkServicesUpdate() starts delayed services which are mostly for
APEXes. (e.g. start a service from APEX). But before
"DefaultNamespaceReady", services are started in "bootstrap" mount
namespace, which makes services from non-bootstrap APEXes fail to start.

This is a quick fix for the problem before coming up with better
solution in the future.

Bug: 293535323
Test: add 'start adbd' before 'perform_apex_config' in init.rc
      adbd starts successfully.
Change-Id: I846689f7c38cdca83c1f7faec0106b8174527e09
2023-07-28 17:28:27 +09:00
Treehugger Robot
545f3e0d35 Merge "trusty: keymint: Statically link Rust deps" into main 2023-07-27 23:29:48 +00:00
Treehugger Robot
50eaceedda Merge changes I02e3046b,I5b33ca47 into main
* changes:
  libprocessgroup: optimize SetAttributeAction::ExecuteForProcess performance
  libprocessgroup: fix reset of file_v2_name
2023-07-27 22:59:34 +00:00
Matthew Maurer
cac69b6cb8 trusty: keymint: Statically link Rust deps
Vendor libraries can be linked dynamically now, but until more Rust
components are using it, static is more efficient.

Bug: 292062611
Test: TH
Change-Id: I3708f5fac1ace797b6233811adf3ec71218d5738
2023-07-27 22:36:28 +00:00
Suren Baghdasaryan
3483798fd9 libprocessgroup: optimize SetAttributeAction::ExecuteForProcess performance
Current implementation of SetAttributeAction::ExecuteForProcess reuses
SetAttributeAction::ExecuteForTask while not utilizing available uid/pid
information. This results in a call to GetPathForTask() which is an
expensive function due to it reading and parsing /proc/$pid/cgroups.
This can be avoided if we utilize available uid/pid info and the fact
that cgroup v2 attributes share the cgroup v2 hierarchy as process
groups, which use a known path template.

Bug: 292636609
Change-Id: I02e3046bd85d0dfebc68ab444f1796bb54cc69c7
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-07-27 21:55:48 +00:00
Suren Baghdasaryan
3507846872 libprocessgroup: fix reset of file_v2_name
ProfileAttribute::Reset does not reset file_v2_name, fix that. Also
provide ProfileAttribute::file_name() to consolidate the code.

Bug: 292636609
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I5b33ca47b4fa5cabf582c8804bd13f72f6e58411
2023-07-27 21:55:40 +00:00
Treehugger Robot
bb3976c149 Merge "Add bug component to cutils" into main 2023-07-27 18:29:10 +00:00
Lee George Thomas
9d398af95c Merge "Create /data/misc/bootanim folder in init.rc." into main 2023-07-27 17:34:08 +00:00
Tomasz Wasilczyk
8fe4f073c2 Add bug component to cutils
Bug: 289414897
Test: N/A
Change-Id: Ic7122e52c3847beba3891b121b723d19bf2076de
2023-07-27 10:16:05 -07:00
Treehugger Robot
f8d02eeee1 Merge "libprocessgroup: UIDs in linux are unsigned" into main 2023-07-27 01:27:48 +00:00
T.J. Mercier
aa6158b410 libprocessgroup: UIDs in linux are unsigned
We missed two incorrect specifiers in the previous commit with this same
title.

We use the %d format specificier for uid_t, which maps to
__kernel_uid32_t, which is unsigned. [1] This is undefined behavior
which can lead to paths with negative UIDs when erroneously large
values are passed for uid:

E libprocessgroup: No such cgroup attribute: /sys/fs/cgroup/uid_-89846/cgroup.freeze

Fix it with %u.

[1] https://cs.android.com/search?q=typedef.*__kernel_uid32_t&ss=android%2Fplatform%2Fsuperproject%2Fmain

Change-Id: Ica04b03526bd2e156f026a2797fe9912b259cd9f
2023-07-26 22:12:44 +00:00
Eric Biggers
428622bb7f Merge "Revert "init.rc: stop calling 'fsverity_init --load-verified-keys'"" into main 2023-07-26 18:06:51 +00:00
Treehugger Robot
17df69eb5f Merge "Add bug component to system/core" into main 2023-07-26 15:26:59 +00:00
Tomasz Wasilczyk
a895aac5e0 Add bug component to system/core
Bug: 289414897
Test: N/A
Change-Id: I9709b2483988f8d7a4204d5398cc559d167f14bf
2023-07-26 07:57:58 -07:00
Yunkai Lim
9292f74fc1 Revert "init.rc: stop calling 'fsverity_init --load-verified-keys'"
Revert submission 2662658-fsverity-init-cleanup

Reason for revert: Culprit for test breakage b/293232766

Reverted changes: /q/submissionid:2662658-fsverity-init-cleanup

Change-Id: I77086f955a53eec274166b7395a88b7dc0e1ad53
2023-07-26 06:21:43 +00:00
Eric Biggers
5aade9ca04 Merge "init.rc: stop calling 'fsverity_init --load-verified-keys'" into main 2023-07-25 22:49:09 +00:00
Lee George Thomas
2493d50328 Create /data/misc/bootanim folder in init.rc.
This folder is used to host bootanim data files.

Bug: 210757252
Test: /data/misc/bootanim is correctly created.
Change-Id: I9c9949316d073ad7ebac503f097c5fee6c0b2a22
2023-07-25 15:07:17 -07:00
Ryan Prichard
60dbdaa3fa Merge "Explicitly ignore the result of std::async" into main 2023-07-25 20:21:14 +00:00
Treehugger Robot
406d43397c Merge "Add safety comments." into main 2023-07-25 07:00:16 +00:00
Treehugger Robot
a414e2fd9b Merge "libprocessgroup: UIDs in linux are unsigned" into main 2023-07-24 22:44:22 +00:00
Treehugger Robot
e4cbd9a6a0 Merge "storageproxyd: Start only a single binder thread" into main 2023-07-24 21:35:45 +00:00
Yi-Yo Chiang
64062f8f4a Merge changes I2581fd7c,I1ed57e6d into main
* changes:
  fs_mgr: Refactor by inlining trivial helpers
  fs_mgr_overlayfs: Make all string constants constexpr
2023-07-24 09:53:26 +00:00
Ryan Prichard
c5184f79ee Explicitly ignore the result of std::async
The newer libc++ marks std::async with [[nodiscard]] in C++20 mode.

Bug: b/175635923
Test: treehugger
Change-Id: Ib63259983d952b97cf1b1c6c243c831cb72f9724
2023-07-21 15:21:28 -07:00
Akilesh Kailash
da2fc1c6af Merge "snapuserd: use local buffers for xor processing during sync I/O" into main 2023-07-21 22:18:21 +00:00
Akilesh Kailash
37c18b30cb snapuserd: use local buffers for xor processing during sync I/O
Bug: 291862304
Test: Incremental OTA on Pixel - Verify first stage boot logs
Change-Id: Ifc4f1ec912ccc1d24673f7bb03b05129ce504fa1
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-07-21 20:08:37 +00:00
Stephen Crane
b05b870671 storageproxyd: Start only a single binder thread
We only need a single binder thread to receive notifications, so we
should set the thread pool max to 0 rather than 1. startThreadPool()
starts one thread + the max count.

Test: m storageproxyd
Bug: 281951047
Fixes: 292030372
Change-Id: I53a90eaa2aa69469fd3a00b6da0d7061318c8ba9
2023-07-21 19:23:45 +00:00
Andrew Walbran
f580fe5799 Add safety comments.
These will soon be required by a lint.

Bug: 290018030
Test: m rust
Change-Id: I0b25bcaa18d167fb9c2d63e637833d4935dc8ff4
2023-07-21 19:13:48 +01:00