Commit graph

84742 commits

Author SHA1 Message Date
Jaegeuk Kim
191af79538 Merge "Use target device mapper given mapper target" into main 2023-11-15 22:40:45 +00:00
Jaegeuk Kim
a720fe785c Use target device mapper given mapper target
Let's translate /dev/block/mapper for dm libs.

Bug: 311084775
Change-Id: I23666c5590a15652192e004e1990edd73b7a8df8
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2023-11-15 13:08:39 -08:00
Akilesh Kailash
91161042b7 Merge "Disable partition verification when device boots on snapshot" into main 2023-11-15 05:14:50 +00:00
Christopher Ferris
f5a0639899 Merge "Update to support new shared_ptr returns." into main 2023-11-15 01:02:58 +00:00
Akilesh Kailash
889a5d23af Disable partition verification when device boots on snapshot
No need partition verification when device boots on snapshot without
slot switch.

This also saves couple of seconds of boot time.

Bug: 299011882
Test: Boot device on snapshot, OTA on Pixel
Change-Id: I5b781de7e0f745bbfe9646f88ca912139b2d853e
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-11-14 16:58:59 -08:00
Daniel Zheng
b119efef47 Merge "libsnapshot: update offset functions" into main 2023-11-14 23:00:23 +00:00
Daniel Zheng
59ce7a45d1 libsnapshot: update offset functions
Since these functions are used across both parser and writer, updating
it as inline functions in cow_format.

Test: cow_api_test
Change-Id: I9824684e3b9b48947accce935335d4019d745ae0
2023-11-14 12:40:12 -08:00
Daniel Zheng
3200697586 Merge "libsnapshot: resume_point_count" into main 2023-11-14 20:39:42 +00:00
Daniel Zheng
9270152900 Merge changes I19568d11,I08204e2d into main
* changes:
  libsnapshot: update FindResumeOp type
  libsnapshot: v3 writer GetCowSize
2023-11-14 20:30:19 +00:00
Akilesh Kailash
41305c3870 Merge "libsnapshot: Check if OTA update in progress during reboot" into main 2023-11-14 20:14:57 +00:00
Treehugger Robot
b37d7cbef8 Merge "Attempt process kill even if cgroup is already removed" into main 2023-11-14 20:10:34 +00:00
Kelvin Zhang
109932146d Attempt process kill even if cgroup is already removed
Test: th
Bug: 308900853
Change-Id: I21ae5bacf4a25cc06a1fd47e2aadbf5ae22661a7
2023-11-14 11:13:28 -08:00
Akilesh Kailash
f1f06f8678 libsnapshot: Check if OTA update in progress during reboot
If any of the read-only partitions are mounted off dm-user
then certainly update is in-progress.

Bug: 308900853
Test: OTA on Pixel, reboot during OTA.
Change-Id: I36121e1d99ec7c1f1110a65fc67996190875af18
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-11-14 16:04:17 +00:00
Daniel Zheng
f897650f6e libsnapshot: resume_point_count
We want to add a resume_point_count in the header to represent how many
resume points we've written. In the case that we've written less than
resume_buffer_size, we only want to read the valid resume points.

without these changes incremental OTA runs into segfault or have faulty
data when trying to FindResumeOp() as our resume points contain invalid
entries

Test: full ota followed by inc ota on cuttlefish
Change-Id: I0a8971955439639f2d0f39d9d518c1145ae15c3d
2023-11-13 15:57:25 -08:00
Daniel Zheng
a503453767 libsnapshot: update FindResumeOp type
Update FindResumeOp to take in a uint64_t to match the value of the
caller function

Test: ota with following CL
Change-Id: I19568d119b7ebd75ea9e98970b311ae7da92ff0e
2023-11-13 15:57:24 -08:00
Daniel Zheng
c1a18756dc libsnapshot: v3 writer GetCowSize
Cow size should just be wherever the last data position is written. In
v3 we no longer have a footer, so this calculation is simple. This
function is used by cow estimator

Test: cow_api_test
Change-Id: I08204e2d560b120450019a529baa41de9b8e66d5
2023-11-13 13:17:50 -08:00
Daniel Zheng
e343580f72 Merge "libsnapshot: update cow estimation" into main 2023-11-13 18:13:09 +00:00
Daniel Zheng
a4f80e5ca3 Merge "libsnapshot: implement resume buffer" into main 2023-11-13 18:13:01 +00:00
Elliott Hughes
dbb4a11156 Merge "run-as: remove a special case." into main 2023-11-13 15:43:37 +00:00
David Anderson
06f29501c7 Merge "libsnapshot: Add a test case for recent decompress regression." into main 2023-11-11 04:03:18 +00:00
David Anderson
92b29e1925 libsnapshot: Add a test case for recent decompress regression.
The attached test data is a 4096 length byte run that gz compresses to
exactly 4096 bytes. This exposes an edge case in CowReader::ReadData
with v2 snapshot files.

Bug: 310191184
Test: cow_api_test
Change-Id: I35e8d7e939d607d1dc118285ebc2f636c2291a20
2023-11-11 00:29:41 +00:00
Elliott Hughes
84e41ca0e2 run-as: remove a special case.
This is a change for some system apps that have /data/user_de/0/ in the
package list, but it's easier to reason about and more consistent to
always go down the same path.

Bug: http://b/308990322
Test: treehugger
Change-Id: I479485655c61e8a31fb23f779c66d54b0bb476c0
2023-11-10 22:02:00 +00:00
Christopher Ferris
1503890fc6 Update to support new shared_ptr returns.
Bug: 309857311

Test: All unit tests pass.
Change-Id: Ia44ebeb558d3d1101ab63b064731656f0f89c487
2023-11-10 00:05:49 -08:00
Daniel Zheng
79a68a934b libsnapshot: update cow estimation
Cow estimator needs to update next_data_pos_ to be in the correct
position

Test: th
Change-Id: I1e3f2c9434573197e840be5637a90c679610ac4e
2023-11-09 15:49:15 -08:00
Daniel Zheng
c2ce084889 libsnapshot: implement resume buffer
Add resume space to cow v3. Resume buffer goes after header and scratch
space, and is currently set to contain 4 resume points. When AddLabel is
called, the oldest label is replaced with newest one.

Parser will parse up until the last resumable op from a given label.

Test: cow_api_test
Change-Id: Ie072f245721776887d59c96dad296965ad31a5cc
2023-11-09 15:48:42 -08:00
Daniel Zheng
0ac91e1f02 Merge "libsnapshot: add compatibility check" into main 2023-11-09 19:38:18 +00:00
Daniel Zheng
04ca59d6ff libsnapshot: add compatibility check
Ensure that cow was written by v3 writer for the data_length check to
work. All ops written by v2 writer should go through the decompressor
path if a compressor was used.

Test: cow_api_test
Change-Id: I053d6fdaf29ef7001e68f43b45d5a3ff1a36b1c3
2023-11-09 11:32:02 -08:00
Elliott Hughes
ec63f6f10a Merge "run-as: remove unecessary code." into main 2023-11-09 16:00:51 +00:00
Treehugger Robot
c3ef20c326 Merge "Updated liblp fuzzers." into main 2023-11-09 10:02:11 +00:00
Christopher Ferris
580e728696 Merge "debuggerd_test: Scale timeouts by HwTimeoutMultiplier" into main 2023-11-09 01:41:35 +00:00
Mattias Simonsson
38ab045342 debuggerd_test: Scale timeouts by HwTimeoutMultiplier
Timeouts in tombstoned.cpp and intercept_manager.cpp are scaled
by HwTimeoutMultiplier, but the timeouts in debuggerd_test.cpp
are not, which means the CrasherTest#intercept_timeout test will
fail for any platform that has a high enough HwTimeoutMultiplier.

Bug: 309532789
Test: debuggerd_test.CrasherTest#intercept_timeout
Change-Id: I83cd01e87644c011efa155a32fd5d92cc8a43a95
2023-11-08 14:56:48 -08:00
Akilesh Kailash
14270410cf Merge "init: Start snapuserd_proxy after early-init" into main 2023-11-08 20:37:28 +00:00
Elliott Hughes
d291d68c4c run-as: remove unecessary code.
We haven't had a symlink here for many years, so there's no reason to
allow one any more.

Test: treehugger
Change-Id: Ic10d547a88fc6d9c442a5dfb228c5914ea48a32d
2023-11-08 10:46:51 -08:00
Elliott Hughes
1b86c0dd7d Merge "run-as: reduce the scope of changed egid." into main 2023-11-08 16:02:33 +00:00
Akilesh Kailash
76b553c93b init: Start snapuserd_proxy after early-init
When service is started prior to early init and if per-app memcg is enabled, service start will fail as the required directories for memcg isn't present viz /dev/memcg/apps.

Bug: 308818430
Test: th and CF OTA test with per-app memcg enabled
Change-Id: Ic65e8d179fbfb8e2135f2de5cc7c77d6c29ea7d2
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-11-08 15:07:57 +00:00
Daniel Zheng
5e83e63bd7 Merge "libsnapshot: Add single threaded compression to v3 writer" into main 2023-11-08 05:41:09 +00:00
Treehugger Robot
7d1f582d36 Merge changes I5e259fdd,I5b9ab456 into main
* changes:
  init: Make WaitToBeReaped() wait less long
  init: Create different file descriptors for SIGCHLD and SIGTERM
2023-11-08 01:35:58 +00:00
Elliott Hughes
bfc115311e run-as: reduce the scope of changed egid.
There's no bug here that I can see, but having a larger than necessary
scope just seems like a bad idea in case anyone adds anything later.

Also switch to modern struct initialization syntax.

Bug: http://b/308990322
Test: treehugger
Change-Id: If2576f902de62e8c24d4a643c224df8ea6cff5d5
2023-11-07 14:46:25 -08:00
Daniel Zheng
e363841e75 libsnapshot: Add single threaded compression to v3 writer
Add compression path back into Cow operations. Main change is that the
compression algorithm is stored in the header instead of each individaul
op. Have the writer_v3 set this algorithm when parsing options.

There looks to be a lot of code we'll be able to factor out into the
base class, but we can leave that to a later CL.

Test: cow_api_test
Change-Id: Ie9a8eceb5fbdaecae50911119c75f2e51d776a28
2023-11-07 14:28:57 -08:00
Bart Van Assche
a75f210398 init: Make WaitToBeReaped() wait less long
Reduce the time spent in WaitToBeReaped() by waiting for SIGCHLD instead
of waiting for 50 ms.

Bug: 308687042
Change-Id: I5e259fdd22dec68e45d27205def2fc6463c06ca3
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-07 10:52:26 -08:00
T.J. Mercier
cf35a2ed4b Merge "libprocessgroup: Internal linkage for removeAllProcessGroupsInternal" into main 2023-11-07 15:35:35 +00:00
T.J. Mercier
9431b63a7c libprocessgroup: Internal linkage for removeAllProcessGroupsInternal
This function is internal and shouldn't be visible externally.

Bug: 301871933
Change-Id: Ie8261795fa8b010c47da667f21e61949d7a9ae00
2023-11-07 13:52:36 +00:00
T.J. Mercier
49d3cdc90b Merge "libprocessgroup: Convert incorrect PLOGs to LOGs" into main 2023-11-07 12:11:49 +00:00
Yi-Yo Chiang
c900c0ddc0 Merge "fs_mgr: Remove deprecated include path system/core/fs_mgr/include_fstab" into main 2023-11-07 07:31:51 +00:00
Daniel Zheng
03b2213e38 Merge "test_v3: write multiple ops" into main 2023-11-07 05:41:21 +00:00
Daniel Zheng
2bc7fd4538 Merge "test_v3: Add max op test case" into main 2023-11-07 05:41:16 +00:00
Daniel Zheng
5c8c768c10 Merge "libsnapshot: Add XorOp to v3 Cow" into main 2023-11-07 05:41:08 +00:00
Daniel Zheng
1c9f0474a6 test_v3: write multiple ops
test case for reading and writing multiple operations of different types

Test: cow_api_test
Change-Id: I8d59a460a50c7054df0b17dc44dd6605048682aa
2023-11-06 15:05:22 -08:00
Daniel Zheng
16d35611ed test_v3: Add max op test case
Add test case to ensure that add blocks will fail when we try to add
more blocks that options.op_count_max specifies. Expected behavior is
that we will write until that count and then fail

Test: cow_api_test
Change-Id: Icb44508c1bacbbe676347df9a58c0526068eebe0
2023-11-06 15:05:22 -08:00
Daniel Zheng
770bb3ec99 libsnapshot: Add XorOp to v3 Cow
Adding in XOR operation to v3 writer. Parser has to go through ops and
create a mapping of XOR operation to it's data

Test: cow_api_test
Bug: 307452468
Change-Id: I51e13a59ba472b62bdcc05921f2e5d6e2c8ad2af
2023-11-06 15:05:21 -08:00