Commit graph

81823 commits

Author SHA1 Message Date
Jooyung Han
deff223842 Merge "Revert "Use /bootstrap-apex for bootstrap APEXes"" into main 2023-08-01 10:44:45 +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
Yi-Yo Chiang
98e3522762 fs_mgr: Refactor by inlining trivial helpers
Inline some trivial helpers and remove unused header declarations.

Remove fs_mgr_*access() as it is really just access().
Remove fs_mgr_overlayfs_super_device() as we always want the primary
slot and having this wrapper isn't particularly helpful.

Test: adb-remount-test
Change-Id: I2581fd7c7d5071cbb97778535b7811dbcb80d76e
2023-07-22 00:08:51 +08:00
Yi-Yo Chiang
b2e0edcaae fs_mgr_overlayfs: Make all string constants constexpr
According to https://abseil.io/tips/140, string constants should be
constexpr char array or string_view object. This avoids subtle bugs due
to the toolchain shuffling object initialization order between/within
compilation units.

string_view has bad interoperability between C APIs as many of those
functions require string values to be null-terminated. Thus we can only
rely on good old c-string constants.

This change groups all string constants together and change them all to
constexpr char array for consistent style.
Also remove some duplicated method definition.

Test: adb-remount-test
Change-Id: I1ed57e6dc24ce3750e72c5538c388a6872cd2b40
2023-07-21 20:44:50 +08:00
Yi-Yo Chiang
6b57c885d3 Merge "init_first_stage: Disable ThinLTO" into main 2023-07-21 05:08:13 +00:00
T.J. Mercier
bf2bebd8e7 libprocessgroup: UIDs in linux are unsigned
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: Ibb52ba2503e30e2f20770b7d23629167e38d076a
2023-07-21 00:39:57 +00:00
David Anderson
89d22239d2 Merge "snapuserd: Fix ubsan when reading a single aligned sector." into main 2023-07-20 16:23:08 +00:00