Commit graph

78244 commits

Author SHA1 Message Date
Bart Van Assche
f32c4ecebb libprocessgroup: Provide SetProcessProfiles() and SetTaskProfiles() alternatives
Provide alternative versions that do not force callers to create
std::string objects. This patch has the intended side-effect that all
callers that pass a {string} initializer list to the 'profiles' argument
now call an std::initializer_list<> overload instead of the const
std::vector<std::string>& overload.

Additionally, add std::function<> arguments instead of calling
ExecuteForProcess() or ExecuteForTask() directly to make it easier to
write unit tests for SetTaskProfiles() and SetProcessProfiles().

Bug: 213617178
Change-Id: Ica61e944a66a17178ee43a113b8ca082f7eb834b
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-08-19 07:06:30 -07:00
Bart Van Assche
d0b8ce2115 libprocessgroup: Make GetProfile() and GetAttribute() more efficient
Do not force callers to create an std::string object. This patch
implements the following advice from go/totw/1: "Google’s preferred
option for accepting such string parameters is through a string_view."
Use std::less<> as comparison type to prevent that std::string_view
objects have to be converted into std::string objects for lookups in
std::map<>.

Bug: 213617178
Change-Id: I08125a02220a8c003d9202a7e177be776c3b9829
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-08-19 07:06:30 -07:00
Treehugger Robot
77cff05577 Merge "Prepare /data/property before load_persist_props" 2022-08-19 08:50:59 +00:00
Chung-Kai (Michael) Mei
64e6511540 Merge "libmodprobe: check blockedlist if load failed" 2022-08-19 04:57:31 +00:00
Bart Van Assche
0d78c9a0af Merge "libprocessgroup: Switch from gnu++-17 to gnu++-20" 2022-08-18 21:23:01 +00:00
Bart Van Assche
a823bee9d3 libprocessgroup: Switch from gnu++-17 to gnu++-20
This change enables headers like <span>. Inside the <span> header file
file the following guard makes its functionality unavailable when
building with std=gnu++-17:

 #if _LIBCPP_STD_VER > 17
 [ ... ]
 #endif

Bug: 213617178
Change-Id: I5c40708ea196ab112990b5ca6fae9370b75f8752
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-08-18 12:34:21 -07:00
Jooyung Han
9561496303 Prepare /data/property before load_persist_props
Without the directory (this happens on the very first boot),
load_persist_props can't create an initial version of
/data/property/persistent_properties (probably empty). This leads to
persisting all in-memory "persist.*" properties later when a persistent
property is set. This is regression from Android S because persistent
props from, for example, build.prop will be persisted even when there's
no process to explicitly setprop.

Bug: 242264580
Test: launch cuttlefish and verify that there's no props from build.prop
Change-Id: I5819a97750e4d5d1ee5a7c308bf944c7aeab2f90
2022-08-18 10:03:02 +09:00
Yi-yo Chiang
b3ff0cf8c8 Merge "set-verity-state: Add -h -v -R (automatic reboot) options" 2022-08-17 06:14:55 +00:00
Yi-Yo Chiang
8667495164 set-verity-state: Add -h -v -R (automatic reboot) options
-h: print help
-v: noisy output
-R: automatic reboot if needed

Also remove the "argc != 0" check, as this shouldn't happen most of the
time anyway. The only possible way (I can think of) for this to happen
is to explicitly call execve() with an empty argv, which is against the
calling convention, thus a footgun, to begin with.

Bug: 241688845
Test: adb shell [disable-verity|enable-verity] [-R] [-v] [-h]
Test: adb shell set-verity-state [-R] [-v] [-h] [0|1]
Change-Id: I27fc18b0958650c5926322a3f4bd1df758fd96c8
2022-08-17 06:13:20 +00:00
Yi-yo Chiang
4284589b1c Merge "remount: Remove unused option -C/--clean_scratch_files" 2022-08-17 06:13:06 +00:00
Yi-Yo Chiang
0465273180 remount: Remove unused option -C/--clean_scratch_files
The option was added for debugging purposes in case the "test argv[0] ==
clean_scratch_files" method breaks.
Now it has no user at all and no reason to maintain it, so just remove it.

Also don't use MyLogger() when running as clean_scratch_files, as
clean_scratch_files don't have stdout/stderr.

Bug: 241179247
Test: Presubmit
Change-Id: I2d8069f59fe6b85fc84ab07bb2df6efb39d6ecaa
2022-08-17 06:12:52 +00:00
David Anderson
4f351c3cf5 Merge "libsnapshot: Remove flaky image creation test." 2022-08-16 22:33:21 +00:00
Akilesh Kailash
1fe0e72321 Merge "libsnapshot: reorder COW ops vector" 2022-08-16 19:17:44 +00:00
Xin Li
4f74d4542d Merge "DO NOT MERGE - Merge Android 13" 2022-08-16 19:08:18 +00:00
Treehugger Robot
5efd05c963 Merge "Add io_uring support to fastboot" 2022-08-16 17:52:01 +00:00
Akilesh Kailash
6c462c31f6 libsnapshot: reorder COW ops vector
Reorder COW ops vector based on merge sequence. We don't
need additional vector to be stored in memory.

Memory usage for a full OTA on Pixel:

Without Patch:
RssAnon:       61020 kB

With Patch:
RssAnon:	   51112 kB

Bug: 237490659
Test: OTA on Pixel
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I543dd73acfa7cf4e57379e82bc184e943072e7c8
2022-08-16 17:37:10 +00:00
Trevor Radcliffe
d0a522c9f6 Merge "Point directly to generated c sysprop_library" 2022-08-16 15:09:41 +00:00
Xin Li
5386f6a48e DO NOT MERGE - Merge Android 13
Bug: 242648940
Merged-In: Ibcaa8406e8b1e8758b99a8e9b58c58d68ed57685
Change-Id: I2a0c0961fafa9a6f3beb21bfb10ea1ad5082b874
2022-08-15 22:06:32 -07:00
Treehugger Robot
904e71d2dd Merge "libsnapshot: Use SnapshotManager to delete devices." am: 3de2320e5e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2185322

Change-Id: Ia1e64f5e50652efedc9649d5bd7df3d5ba033531
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-13 10:58:13 +00:00
Treehugger Robot
3de2320e5e Merge "libsnapshot: Use SnapshotManager to delete devices." 2022-08-13 10:39:22 +00:00
David Anderson
97e8a2f0e9 libsnapshot: Remove flaky image creation test.
This test has always been flaky, and is not testing something super
valuable: we know that image creation succeeds throughout the rest of
the suite, so it's not very interesting to know that it can succeed in a
low-space scenario.

The inverse test is much more valuable, since we want the correct status
code when creation fails due to low space.

Bug: 240391002
Test: vts_libsnapshot_test
Change-Id: I6235d11033d2f30efe530077b877863ba2574810
2022-08-12 23:46:31 -07:00
David Anderson
e02ef9e9ce libsnapshot: Use SnapshotManager to delete devices.
Diagnosing DM_DEV_REMOVE failures in the test harness is quite
difficult, and it's not clear if failures are spurious or not. Instead
use SnapshotManager's helper function, which can retry on failure, and
will self-diagnose issues on legitimate failures.

Bug: N/A
Test: vts_libsnapshot_test
Change-Id: Ibcaa8406e8b1e8758b99a8e9b58c58d68ed57685
2022-08-12 23:46:31 -07: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
Yi-yo Chiang
ecb064f763 Merge "remount: Remove dev_t checks from tests." am: c38725ce9c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2184639

Change-Id: I2b76ef63a3f72029cbea9f4541c2019c1e1bb022
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-12 06:30:53 +00:00
Yi-yo Chiang
c38725ce9c Merge "remount: Remove dev_t checks from tests." 2022-08-12 06:11:30 +00:00
David Anderson
e4e51662d9 remount: Remove dev_t checks from tests.
These checks have historically been unreliable, and we make no
guarantees around dev_t with overlayfs.

Bug: 242240650
Test: adb-remount-test.sh
Change-Id: I19e7aabec424a22beb0b56d35b198906841178b0
2022-08-11 21:36:43 -07:00
Kelvin Zhang
682e5b530a Add io_uring support to fastboot
Test: th
Bug: 31712568

Change-Id: If18bd4eb53ffe851c31d7dc61906921da111114f
2022-08-11 18:58:43 -07:00
Thiébaud Weksteen
4f0ad3a9d1 Merge "Remove e2fsdroid and sload_f2fs dep from fastboot" am: 8a6fa3127b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2182995

Change-Id: I16237d9001c5aacd68112d3d4d4b2ddd49afbaf0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-11 23:41:44 +00:00
Thiébaud Weksteen
8a6fa3127b Merge "Remove e2fsdroid and sload_f2fs dep from fastboot" 2022-08-11 23:22:43 +00:00
Treehugger Robot
792984a5b5 Merge "remount: On initial overlay setup, return 0 instead of MUST_REBOOT" am: 60dd4690b3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2183077

Change-Id: I6b85b22d141d156a668a230068a25c4460d1d47d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-11 18:11:29 +00:00
Treehugger Robot
60dd4690b3 Merge "remount: On initial overlay setup, return 0 instead of MUST_REBOOT" 2022-08-11 17:30:35 +00:00
Yi-yo Chiang
dd5ecb2f12 Merge "set-verity-state: Harden logic of overlayfs setup/teardown" am: 7d294906d9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2176946

Change-Id: I2e95167ca804a3408e5526ab03dd3b8ba4a6d6c2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-11 15:11:18 +00:00
Yi-yo Chiang
7d294906d9 Merge "set-verity-state: Harden logic of overlayfs setup/teardown" 2022-08-11 14:43:52 +00:00
Yi-yo Chiang
c7b2916168 Merge "Fix build breakage on -user build" am: 8959962b22
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2183178

Change-Id: I40418b762f4eab3634814712aeffe656b9f80fc8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-11 11:27:36 +00:00
Yi-yo Chiang
8959962b22 Merge "Fix build breakage on -user build" 2022-08-11 10:51:35 +00:00
Yi-Yo Chiang
258f0237c9 set-verity-state: Harden logic of overlayfs setup/teardown
Refactor set_avb_verity_state() to return tri-state result:
  {.success=false}
    Failed to set verity state.
  {.success=true, .want_reboot=false}
    Success but verity already is requested state, so no need to reboot.
  {.success=true, .want_reboot=true}
    Successfully changed verity state, need reboot to take effect.

Setup overlayfs only if verity is going to be or already disabled.
Teardown overlayfs regardless of enable-verity success of not.
This ensures more robust behavior of setup / teardown overlayfs.

Adjust the log messages for consistent wording.
No point logging the errno of fs_mgr_overlayfs_[setup|teardown]
because the error must already be logged by callee.

Bug: 241688845
Test: adb [disable|enable]-verity
Change-Id: I3a77fe567757ca6173e8c3142e77fef483d9b849
2022-08-11 17:23:13 +08:00
Yi-Yo Chiang
3de7da950d Fix build breakage on -user build
Bug: 242145724
Test: Build any -user product
Change-Id: Id34f14a834919f1e381d0365d50847cb52cedf8d
2022-08-11 16:50:43 +08:00
Yi-Yo Chiang
9d03610680 remount: On initial overlay setup, return 0 instead of MUST_REBOOT
aosp/I212bdb0e97016dec50618962d7c24f46d35764c7 changes
`remount` to return MUST_REBOOT after initial overlay setup.
This causes DsuGsiIntegrationTest to fail because the non-zero exit code
cause the test script to think the `remount` command failed.

Change it so that we return 0 instead, to indicate that we
"successfully" setup a new overlay.
We should only return non-zero on unrecoverable error, like when we
failed to disable verity, failed to setup overlay, failed to perform
MS_REMOUNT.

Bug: 241179247
Test: DsuGsiIntegrationTest
Change-Id: I280ffa988118c59e366cdd5bd1479bb43896c278
2022-08-11 14:53:12 +08:00
Yi-yo Chiang
f3725dcdaf Merge "set-verity-state: Start a threadpool to service waitForService() CB" am: e761510df0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2181315

Change-Id: Ie76d47c31bbb39861ad01a289a9c12582e28a7be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-11 06:20:38 +00:00
Treehugger Robot
f12ec6fb16 Merge "Promote HWASan tests to presubmit." am: a8fde6445d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2182216

Change-Id: I81c13d0928cac2aa05a62cc6baa7a24d7d99548b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-11 06:20:28 +00:00
Yi-yo Chiang
e761510df0 Merge "set-verity-state: Start a threadpool to service waitForService() CB" 2022-08-11 06:00:30 +00:00
Treehugger Robot
a8fde6445d Merge "Promote HWASan tests to presubmit." 2022-08-11 05:51:21 +00:00
Thiébaud Weksteen
3c1f230971 Remove e2fsdroid and sload_f2fs dep from fastboot
In commit 5d72d6c, an unused code path for e2fsdroid and sload_f2fs was
removed from fastboot. Remove them from the build dependency list.

Bug: 237960487
Test: m fastboot
Change-Id: Ibee72a86eeb43fcde3a032094bfc1c19de09bc03
2022-08-11 15:36:17 +10:00
Florian Mayer
b68f8a12fd Promote HWASan tests to presubmit.
They have been passing and do not show significant slowdown.

Change-Id: Ie187af5af5defc4738a93140ed840e4a4cd48f55
2022-08-10 19:50:31 +00:00
David Anderson
bd97a1d1f8 Merge changes I7a9e07a4,I3ddab553,I212bdb0e am: 2e007e039b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2175951

Change-Id: Ie30e4e7da2717667e869f3f453bdbd3bd81a9af4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 19:29:10 +00:00
Bart Van Assche
380c12afaf Merge "libprocessgroup: Fix a log message" am: 693ac06a4c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2174782

Change-Id: If85498b868ff992cccd180be3d0aa2d84c8533b3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 19:28:48 +00:00
David Anderson
2e007e039b Merge changes I7a9e07a4,I3ddab553,I212bdb0e
* changes:
  remount: Remove the "backing" parameter to fs_mgr_overlayfs_setup.
  remount: Prevent error spam when remounting fails.
  remount: Move more stuff out of do_remount.
2022-08-10 19:13:45 +00:00
Bart Van Assche
693ac06a4c Merge "libprocessgroup: Fix a log message" 2022-08-10 18:33:18 +00:00
Yi-Yo Chiang
1305c15974 set-verity-state: Start a threadpool to service waitForService() CB
Bug: 241688845
Bug: 241739850
Test: adb disable-verity / adb enable-verity
Change-Id: I5871e0e0f3014b2f4beb786fef4dc4f75af3fbf5
2022-08-10 14:47:32 +08:00
Yi-yo Chiang
1c209f8614 Merge "set-verity-state: Refactor & remove even more dead code" am: 2db517703d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2176442

Change-Id: Ie1a475c23a62dda9891f7fb70e3f539c63ef7100
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 04:09:58 +00:00