Commit graph

86559 commits

Author SHA1 Message Date
Treehugger Robot
c049af4e37 Merge "libprocessgroup: Reject JoinCgroup actions for v2 controllers" into main 2023-11-17 20:23:03 +00:00
Bart Van Assche
f99ca8aeb1 Migrate the blkio controller to the v2 cgroup hierarchy
There are multiple use cases in Android for which background writes need
to be controlled via the cgroup mechanism. The cgroup mechanism can only
control background writes if both the blkio and memcg controllers are
mounted in the v2 cgroup hierarchy. Hence this patch that migrates the
blkio controller from the v1 to the v2 cgroup hierarchy.

The changes compared to the previous version of this CL are as follows:
- The JoinCgroup actions for the "io" controller have been left out
  since these caused processes to be migrated to the v2 root cgroup.
- The BfqWeight / CfqGroupIdle / CfqWeight settings have been included
  in this CL instead of applying these settings as a separate CL.

Change-Id: I67e06ce3462bb1c1345dba78f8d3d655b6519c74
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-17 11:37:24 -08:00
Bart Van Assche
2953a9273e libprocessgroup: Reject JoinCgroup actions for v2 controllers
A JoinCgroup action for a v2 cgroup controller migrates a process or task
from the uid_%d/pid_%d cgroup into another cgroup, e.g. the root cgroup.
This may make services unkillable because Service::Stop() only stops a
service if the uid_%d/pid_%d cgroup still exists when Service::Stop() is
called.

Bug: 309674654
Change-Id: I20b797afdf596125ff5a6ed41cb33fe59b84ac88
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-17 11:37:24 -08:00
Treehugger Robot
5820c77132 Merge "libprocessgroup: Make a log message more detailed" into main am: b190d94469
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2829575

Change-Id: I60b116b1a439043c8417a739d85e989656b1454a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 19:34:20 +00:00
Treehugger Robot
b190d94469 Merge "libprocessgroup: Make a log message more detailed" into main 2023-11-17 19:10:24 +00:00
Kalesh Singh
24a47eccf7 x86_64: mmap rnd bits: Allow min bits of less than 32
With a regular x86 kernel we are always able to get 32
min bits for mmap randomization.

However to emulate 16KB for x86 app developers the kernel
can only provide 30 bits for the randomization due the to
larger page size (PAGE_SHIFT =+ 2).

Allow the min rand bits to be (32 - (PAGE_SHIFT - 12)) in
order to generically support larger than 4KB page sizes.

This should be a no-op change for all devices, except the
x86 16KB emulator, since they will always be able to get
32 random bits.

Bug: 309816695
Test: Boot test 4k x86 device
Test: Boot test emulated 16k x86 device
Change-Id: I48d47d56ac3aecb71a9e0093a7033bb60b89c2b7
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-11-17 11:02:04 -08:00
Jaegeuk Kim
90703b86d9 Use the dm target for userdata
Framework or applications can try to find userdata dm target from "/proc/mounts"
which gives "/dev/block/mapper/userdata".

That causes breaking the assumption in all the places.

Bug: 311165039
Change-Id: I9ea1b4589cdd52021d9807f7240c2e4b6d6d05ef
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2023-11-17 10:39:03 -08:00
Bart Van Assche
df98534e19 libprocessgroup: Make a log message more detailed
For log messages like the following it is not possible to derive why
this message has been logged:

E libprocessgroup: AddTidToCgroup failed to write '3949'; fd=55: Operation not supported on transport endpoint

Hence include the cgroup path and the tid type in the log message.

Change-Id: I057711fe576b82f6454456b7284186ddeece33c3
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-17 10:11:20 -08:00
Florian Mayer
0f64c8e23e Allow to set scudo allocation buffer size
This is used for fullmte builds, which are optimized for bug detection.

Bug: 309446692
Change-Id: I004635ebb7e1161e63012935271851c806cb8574
2023-11-16 21:16:44 +00:00
Jaegeuk Kim
24a9789b3b Merge "Use target device mapper given mapper target" into main am: 191af79538
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2832970

Change-Id: I0ad8149f9cb0be868f04fe14a791270e62ebc9cd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 23:00:30 +00:00
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
Kelvin Zhang
459edb0bd0 Make RemoveCgroup idempotent
When attempting to remove a cgroup, a ENOENT means this cgroup is
already removed. Treat such errno as success for idempotency.

Test: th
Bug: 308900853
Change-Id: I6ef3c25f03d185194205b3845784d284fdc4d444
2023-11-15 08:39:41 -08:00
Akilesh Kailash
2942157fc5 Merge "Disable partition verification when device boots on snapshot" into main am: 91161042b7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2828287

Change-Id: I332db8349368941bf051eda3b48eabcb6bc65389
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 05:45:03 +00:00
Akilesh Kailash
91161042b7 Merge "Disable partition verification when device boots on snapshot" into main 2023-11-15 05:14:50 +00:00
Daniel Norman
e4f981dce0 Assigns system user/group to /dev/hidraw* devices.
This allows system_server to access these devices.

Note: This also matches existing ueventd rules used by any
device which followed the Sensor HAL's dynamic sensor README.

Bug: 303522222
Test: ls -l /dev/hidraw0
Change-Id: I0830aca77422d6cab64af05dba1554667737760c
2023-11-15 03:04:07 +00:00
Christopher Ferris
9270883a90 Merge "Update to support new shared_ptr returns." into main am: f5a0639899
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2825168

Change-Id: Ida5e791f9e2d8ec3041515d25e55d44ab3d2070b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 01:40:11 +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
8996b1c6b7 Merge "libsnapshot: update offset functions" into main am: b119efef47
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2830390

Change-Id: Iae1c49fd0490a79c626a2ef11199f9729db6e166
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 23:29:05 +00:00
Daniel Zheng
b119efef47 Merge "libsnapshot: update offset functions" into main 2023-11-14 23:00:23 +00:00
Daniel Zheng
c8107e4de5 Merge "libsnapshot: resume_point_count" into main am: 3200697586
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2828451

Change-Id: I930a286449f30cf40a3b90e1c1b6666eeacf53fd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 20:43:03 +00:00
Daniel Zheng
3376e2c24c Merge changes I19568d11,I08204e2d into main am: 9270152900
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2828280

Change-Id: I9115b7de5e1fc255f91cdd1e6732910ec328ba34
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 20:42:53 +00:00
Akilesh Kailash
a9e02133dc Merge "libsnapshot: Check if OTA update in progress during reboot" into main am: 41305c3870
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2829570

Change-Id: Ica2c1c8454a32700c05ecf742b8f02815a7ae1c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 20:42:40 +00:00
Treehugger Robot
d5462260cd Merge "Attempt process kill even if cgroup is already removed" into main am: b37d7cbef8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2828279

Change-Id: I8307139f5da756a2db54edd836021fac4803f9ed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 20:42:10 +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
d37e54207e Merge "libsnapshot: update cow estimation" into main am: e343580f72
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2825163

Change-Id: Ifb609f19c9c7108074f9187ecc96661874faf12c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-13 19:06:49 +00:00
Daniel Zheng
7786db0ae7 Merge "libsnapshot: implement resume buffer" into main am: a4f80e5ca3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2816891

Change-Id: I4e089b84434a56a62c16e08b0a7050079be3d002
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-13 19:01:10 +00: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
4b149f35f0 Merge "run-as: remove a special case." into main am: dbb4a11156
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2826237

Change-Id: Ie40491d7a1815f44c299293e6aa8cd5fb7a1ad2f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-13 16:11:24 +00:00
Elliott Hughes
dbb4a11156 Merge "run-as: remove a special case." into main 2023-11-13 15:43:37 +00:00
David Anderson
a5c2601e5d Merge "libsnapshot: Add a test case for recent decompress regression." into main am: 06f29501c7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2826242

Change-Id: I0e575a9f91165c4a310e3bddc774c09f9ca80205
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-11 04:41:57 +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
f18e9ae66e Merge "libsnapshot: add compatibility check" into main am: 0ac91e1f02
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2820944

Change-Id: I525d46ab5e20db8144c22782c7117e31387519b6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-09 20:47:12 +00:00
Daniel Zheng
0ac91e1f02 Merge "libsnapshot: add compatibility check" into main 2023-11-09 19:38:18 +00:00