Commit graph

86468 commits

Author SHA1 Message Date
Daniel Zheng
43aeb22858 libsnapshot: add sequence data
v3 writer to write sequence data. Sequence data will be written after
the scratch space and before the resume space. Since this is just a list
of integers, writing and reading should be trivial

Test: cow_api_test
Change-Id: If3b6b1cfa155aeb65bf693263fc373154ba8e81d
2023-11-21 09:50:16 -08:00
Daniel Zheng
d2d7a1ff0e Merge changes I56a0d747,I1585601a,I9e44330e into main
* changes:
  libsnapshot: move header op count setup
  libsnapshot: sync header metadata
  libsnapshot: update variable name
2023-11-21 17:49:29 +00:00
Bart Van Assche
9c6b723adb init: Introduce the function ReapAndRemove()
Prepare for adding a second caller of ReapAndRemove().

Change-Id: I0f54af6136f49caa0198c123a4c8de968e5f41ba
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-21 09:16:50 -08:00
Yi-Yo Chiang
4537430631 Merge changes I12bc2ccd,I8174257c into main am: 7f322bcaf0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2805253

Change-Id: I1e29d675e597258a3c6576b6fe720f66bcb1de0b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-21 10:04:36 +00:00
Yi-Yo Chiang
7f322bcaf0 Merge changes I12bc2ccd,I8174257c into main
* changes:
  fs_mgr_overlayfs: Fix "/" mount propagation type after remount
  fs_mgr_overlayfs: Fix submount propagation type after remount
2023-11-21 09:36:47 +00:00
Daniel Norman
6f3fa7bfe7 Merge "Assigns system user/group to /dev/hidraw* devices." into main am: 97807f53ef
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2828895

Change-Id: Ib8784d425a5a2ef76de077b13b5b4fbdb474b9e6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-21 02:44:33 +00:00
Treehugger Robot
4774ceef11 Merge "Use vendor/etc/ueventd.rc on microdroid" into main am: 2e2e836a89
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2836366

Change-Id: Ic11e721a26539d29e4b32edf75b5a2e6e20fcca9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-21 02:43:59 +00:00
Daniel Norman
97807f53ef Merge "Assigns system user/group to /dev/hidraw* devices." into main 2023-11-21 02:10:09 +00:00
Treehugger Robot
2e2e836a89 Merge "Use vendor/etc/ueventd.rc on microdroid" into main 2023-11-21 02:03:16 +00:00
Inseob Kim
52d8fe9b04 Use vendor/etc/ueventd.rc on microdroid
... because vendors should be able to extend ueventd.rc for their own
devices (in microdroid) and microdroid's system.img can't be amended.

Bug: N/A
Test: boot microdroid
Change-Id: I7ceaf3f87453c8e29f9d9bf03d4d1866185d4fec
2023-11-21 10:05:49 +09:00
Daniel Zheng
209fda3562 libsnapshot: move header op count setup
Op count should be set before we sync the header. This way subsequence
writers can initialize with the correct op buffer size

Test: cow_api_test
Change-Id: I56a0d747b3f2a1d9d582d8f9d643b81cbdd9b8d7
2023-11-20 11:53:21 -08:00
Daniel Zheng
763776435d libsnapshot: sync header metadata
After we write emit a label, we need to update the number of resume
points + sequence data and op_count. Realistically we could just call
Finalize, but maybe synching these specific fields could prevent
unexpected outcomes.

Test: cow_api_test
Change-Id: I1585601a134221689ce8d5675a2a3e32f1e8a0e6
2023-11-20 11:53:20 -08:00
Treehugger Robot
ba8817789b Merge "init: Combine two global sigchld_fd variables into one" into main am: 142f8129ec
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2834996

Change-Id: I124e222e4bcdc67cd939c7a11e5685e1b384aa7a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-20 19:49:49 +00:00
Daniel Zheng
5d30009a7e libsnapshot: update variable name
updating name to count rather than buffer size

Test: cow_api_test
Change-Id: I9e44330e7a230b5ab5f5e914ef74a63cc4ebaa61
2023-11-20 11:40:36 -08:00
Treehugger Robot
142f8129ec Merge "init: Combine two global sigchld_fd variables into one" into main 2023-11-20 19:18:39 +00:00
Daniel Zheng
c29ecff899 Merge "libsnapshot: update resume offset calculation" into main am: bc518418c7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2837775

Change-Id: Ie59d23ba8162d84c08b773b2f3cd366920894951
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-20 18:57:50 +00:00
Treehugger Robot
7793c55fc8 Merge "Add StrongPointer::release()" into main am: 558fd9ab7a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2826730

Change-Id: Ic13698ba2942bb0b54bab9b5f9a014e09da59cfa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-20 18:57:21 +00:00
Daniel Zheng
bc518418c7 Merge "libsnapshot: update resume offset calculation" into main 2023-11-20 18:54:19 +00:00
Treehugger Robot
558fd9ab7a Merge "Add StrongPointer::release()" into main 2023-11-20 18:27:15 +00:00
Bart Van Assche
97047b54e9 init: Combine two global sigchld_fd variables into one
Remove the Service::SetSigchldFd() method. Make the Service::GetSigchldFd()
create a signalfd for SIGCHLD. This makes it possible to use a SIGCHLD
signalfd in unit tests.

Change-Id: I0b41caa8f46c79f4d400e49aaba5227fad53c251
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-20 09:32:59 -08:00
John Reck
e01550bbb6 Add StrongPointer::release()
Useful when dealing with raw pointers in unavoidable places. Avoids
an awkward (and "slow") dance of mySp->incStrong(0); mySp->get(); ~mySp;

Test: make && atest --host libutils_binder_test
Change-Id: Ib8d46150592725cc256779bccfed19a16dce78b2
2023-11-20 11:55:02 -05:00
Daniel Zheng
95cc6b6f01 libsnapshot: update resume offset calculation
Update resume offset calculation to use function call

Test: cow_api_test
Change-Id: I7a9a86dc007110d02d889d1e59b24c3068b8d9e9
2023-11-20 03:30:40 -08:00
Bart Van Assche
9b631cb3f5 Merge "Revert "libprocessgroup: Add a function to remove only empty process groups"" into main am: ced62e53ed
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2829574

Change-Id: Id06846550547a5234a04c2862a0c4bfcbb34adc9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-18 17:39:22 +00:00
Bart Van Assche
ced62e53ed Merge "Revert "libprocessgroup: Add a function to remove only empty process groups"" into main 2023-11-18 17:02:44 +00:00
Daniel Rosenberg
d01ca43d6b fs_mgr: Support 16k F2FS
This passes the block size to mkfs. Currently f2fs must have page size
equal to block size. If this changes, we may want to revisit this.

Change-Id: I1ecdffcb2a271aa80c0bd07fd095941720fb48d0
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 279820706
Test: Boot 16K device
2023-11-17 17:46:29 -08:00
Daniel Rosenberg
d922df36b2 fs_mgr_overlayfs: Support 16k F2FS
Currently, f2fs block size must be equal to page size.
If this is not the case in the future, this code should be revisited.

Bug: 279820706
Test: adb remount on 16k f2fs device
Change-Id: Ib0d1ea81f921be99471d0433c8499ae077208db7
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2023-11-17 17:46:29 -08:00
Christopher Ferris
dd7b4017d7 Merge "Avoid crashing on bad architecture value." into main am: d1067b3f0c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2837078

Change-Id: I2da5c9b7d0b6be21e427f3e1c0ed58d9effef004
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-18 00:44:01 +00:00
Christopher Ferris
d1067b3f0c Merge "Avoid crashing on bad architecture value." into main 2023-11-18 00:07:03 +00:00
Bart Van Assche
3048812055 Revert "libprocessgroup: Add a function to remove only empty process groups"
Revert this CL because it tests whether or not cgroup.procs files are
empty with the stat() system call and because the cgroup filesystem
always reports st_size == 0. Rename RemoveUidCgroups() into
RemoveEmptyUidCgroups().

Change-Id: I4de6f16c814c4b47d8d74c8045f0c1ee71975ac0
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-17 14:28:30 -08:00
Christopher Ferris
c7cc571fa1 Avoid crashing on bad architecture value.
The only way to get a bad architecture value in the protobuf is if
the data was corrupted or an unsupported architecture was added without
the register support.

If the protobuf is corrupted, this is strictly better since it
still produces a tombstone with the data present.

If there is an unsupported architecture, it will still result in a tombstone,
only the registers would not be present. It would also be very obviously
a problem that needs to be fixed. Again, this is strictly better since
the crash in generation is not necessarily visible unless you look at
the log. Here, the data is in the log and in the tombstone.

This also removes the only dependency in this file on the async_safe
library.

Test: Ran unit tests.
Test: Forced an invalid architecture and verified tombstone is present
Test: with error message, and error message printed in the log.
Change-Id: I8e4a2e3f778fafb5b7241c2f23d5f867f1341ed8
2023-11-17 22:12:14 +00:00
Kalesh Singh
6585b0f0fa Merge "x86_64: mmap rnd bits: Allow min bits of less than 32" into main am: 72d8882153
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2825759

Change-Id: I9672c7ca311a3af7b860b49218697e4239b2740c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 21:58:23 +00:00
Kalesh Singh
72d8882153 Merge "x86_64: mmap rnd bits: Allow min bits of less than 32" into main 2023-11-17 21:23:26 +00:00
Bart Van Assche
cd6c434d6b Merge "Migrate the blkio controller to the v2 cgroup hierarchy" into main am: 6ebc14d97f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2829577

Change-Id: I3b4a6eb4439d3c00428c87c97eb814177e7f2a8f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 20:55:31 +00:00
Jaegeuk Kim
426361dc7c Merge "Use the dm target for userdata" into main am: 389c03d4c8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2835040

Change-Id: Id6f83b214d10bc1e02281198eff3924990641af2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 20:55:17 +00:00
Treehugger Robot
c497737de2 Merge "libprocessgroup: Reject JoinCgroup actions for v2 controllers" into main am: c049af4e37
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2829576

Change-Id: Id1635038ce4b9b306858a4332772b7f7e6aae3cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 20:53:26 +00:00
Bart Van Assche
6ebc14d97f Merge "Migrate the blkio controller to the v2 cgroup hierarchy" into main 2023-11-17 20:34:24 +00:00
Jaegeuk Kim
389c03d4c8 Merge "Use the dm target for userdata" into main 2023-11-17 20:26:00 +00:00
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