Commit graph

75240 commits

Author SHA1 Message Date
Treehugger Robot
ec8519e953 Merge "Tweak linux_glibc properties for musl builds in system/core" 2022-03-30 00:09:01 +00:00
Daniel Norman
c015f7f96d Merge "Adds an init host lib for use in host_apex_verifier." 2022-03-29 23:56:15 +00:00
Treehugger Robot
98c7076202 Merge "Fix build error from signed/unsigned comparison" 2022-03-29 23:13:51 +00:00
Jason Macnak
b29ff55897 Merge "Relax requirements on android_ycbcr to allow P010" 2022-03-29 20:00:03 +00:00
Bart Van Assche
0090e72568 Merge "Migrate the blkio controller to the v2 cgroup hierarchy" 2022-03-29 18:31:08 +00:00
Andrei Homescu
1a867dcb6e Fix build error from signed/unsigned comparison
Bug: 224644083
Test: m
Change-Id: I9adbe1ea53193d8c59f9022754cd3e23533e54ad
2022-03-29 00:30:34 +00:00
Bart Van Assche
07f6c82a4c Migrate the blkio controller to the v2 cgroup hierarchy
This patch preserves the following parameter values:
* Foreground BFQ weight:      100
* Foreground CFQ group_idle:    0
* Foreground CFQ weight:     1000
* Background BFQ weight:       10
* Background CFQ group_idle:    0
* Background CFQ weight:      200

The foreground BFQ weight in task_profiles.json is the default BFQ
weight. From
https://www.kernel.org/doc/Documentation/block/bfq-iosched.txt:
"weight (namely blkio.bfq.weight or io.bfq-weight): the weight of the
group inside its parent. Available values: 1..10000 (default 100). The
linear mapping between ioprio and weights, described at the beginning
of the tunable section, is still valid, but all weights higher than
IOPRIO_BE_NR*10 are mapped to ioprio 0."

Bug: 213617178
Test: Booted Android in Cuttlefish and ran the following test:
Test: adb -e shell cat /sys/fs/cgroup/*/*/io.bfq.weight | sort | uniq -c
Test: 22 default 10
Test: 98 default 100
Change-Id: I7dfa521363a316592852fecce9192708c7a90514
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-28 20:56:15 +00:00
Konstantin Vyshetsky
04a4a10ee1 Merge changes from topic "fastbootd-reset-fd"
* changes:
  fastbootd: reset file descriptor on unaligned writes
  fastbootd: add support to reset fd by handle
  fastbootd: pass handle in place of fd
2022-03-28 20:13:25 +00:00
Konstantin Vyshetsky
57b23d25eb fastbootd: reset file descriptor on unaligned writes
Writes on file descriptors opened with O_DIRECT will fail if the buffer
is not page aligned. This CL will reset the file descriptor without the
O_DIRECT flag for such instances.

Bug: 225108941
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I841c84f5d2c0b9435b394c48b1bfcc2d51d771bb
2022-03-28 10:57:03 -07:00
Konstantin Vyshetsky
1cee2ed239 fastbootd: add support to reset fd by handle
There are cases where the flags the file descriptor was opened with need
to be modified. This CL adds functionality to reset the file descriptor
held by a PartitionHandle, reopening with new flags and repositioning
file offset to previous.

Bug: 225108941
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I9adb0e7696bc6af74e14dd61a6cb0ef10b4c98c8
2022-03-28 10:57:03 -07:00
Treehugger Robot
6079d30145 Merge changes I8a2764a6,I6e8b9d63,I6e041dfc
* changes:
  Canonicalize cgroup paths
  Micro-optimize MergeCgroupToDescriptors()
  Fix support for optional cgroup attributes
2022-03-26 01:25:30 +00:00
Bart Van Assche
d31602063e Canonicalize cgroup paths
Make it possible to verify whether the memory cgroup controller has been
mounted in the v2 hierarchy by comparing its path with the cgroup v2
path. This patch changes the path of cgroup controllers mounted in the
v2 hierarchy from /sys/fs/cgroup/. into /sys/fs/cgroup (no trailing /.).

Bug: 213617178
Test: Added debug code that prints the path for the memory cgroup in the
Test: v2 hierarchy.
Change-Id: I8a2764a6daae84caecf360a918eab62778e3f546
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-25 16:11:45 -07:00
Bart Van Assche
ebea9097a8 Micro-optimize MergeCgroupToDescriptors()
Introduce a local variable for an expression that occurs twice. Use
string append instead of string concatenation because the former is more
efficient.

Bug: 213617178
Test: Compile-tested only.
Change-Id: I6e8b9d63b10accb220216dc484dffd18f5c54ce7
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-25 16:11:10 -07:00
Bart Van Assche
9b5a232083 Fix support for optional cgroup attributes
The Linux kernel returns error code EACCES (Permission denied) if either
a cgroup attribute does not exist or if the process that is trying to
write into a cgroup attribute does not have permission to write. In
other words, it is not possible to tell the difference between these two
scenarios by checking the value of 'errno'. Hence this patch that adds a
stat() call to check whether or not a cgroup attribute exists. This
patch makes lines like the following disappear from logcat for optional
cgroup attributes:

03-22 23:16:04.816   616   649 E libprocessgroup: Failed to write '0' to /sys/fs/cgroup/./uid_10077/p
id_1695/io.group_idle: Permission denied

Bug: 213617178
Test: Booted Android in Cuttlefish and inspected logcat.
Change-Id: I6e041dfc34a52c9bdb75a8c70d99ad79b06eee06
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-25 14:37:16 -07:00
Treehugger Robot
daf60339ff Merge "Fix the cgroup directory owner in createProcessGroupInternal()" 2022-03-25 21:02:45 +00:00
Ray Ye
9f6770e6a6 Merge "Added async trace functions with a track name argument" 2022-03-25 20:33:45 +00:00
Bart Van Assche
812d7698d8 Fix the cgroup directory owner in createProcessGroupInternal()
Without this patch attempts to modify the blkio cgroup attributes by
/system/bin/mediaserver fail as follows:

03-23 09:27:59.542   517  1811 E libprocessgroup: Failed to write '100' to /sys/fs/cgroup/./uid_1013/pid_517/io.bfq.weight: Permission denied

This is because the mediaserver process is started as user 'media',
because the mediaserver process is not in the system group and hence
does not have permission to write into a directory with the following
owner, group and permissions:

vsoc_x86_64:/ # ls -ld /sys/fs/cgroup/./uid_1013/pid_517/io.bfq.weight
-rwxrwxr-x 1 system system 0 2022-03-23 09:27 /sys/fs/cgroup/./uid_1013/pid_517/io.bfq.weight

Bug: 213617178
Test: Booted Android in Cuttlefish and inspected logcat.
Change-Id: I788acc9a137ae29898177f492cae2f954a9c811c
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-25 07:32:56 -07:00
Bart Van Assche
a6c82269e5 Merge "Fix the stat() return value check in createProcessGroupInternal()" 2022-03-25 14:31:40 +00:00
Ray Ye
399465a93e Added async trace functions with a track name argument
Bug: 221119585
Test: atest TraceDevTest
Change-Id: I48d9e858ce588e3735ddbbe14b1bd7c8f264cd83
2022-03-24 23:55:00 +00:00
Colin Cross
10bbb01823 Tweak linux_glibc properties for musl builds in system/core
For convenience, builds against musl libc currently use the
linux_glibc properties because they are almost always linux-specific
and not glibc-specific.  In preparation for removing this hack,
tweak the linux_glibc properties by either moving them to host_linux,
which will apply to linux_glibc, linux_musl and linux_bionic, or
by setting appropriate musl or linux_musl properties.  Properties
that must not be repeated while musl uses linux_musl and also still
uses the linux_glibc properties are moved to glibc properties, which
don't apply to musl.  Whether these stay as glibc properties or get
moved back to linux_glibc later once the musl hack is removed is TBD.

Bug: 223257095
Test: m checkbuild
Test: m USE_HOST_MUSL=true host-native
Change-Id: I076fa026d7dddfccfa5cc395dd06bdc979eee1d8
2022-03-24 15:59:08 -07:00
Bart Van Assche
55a9b1e22d Fix the stat() return value check in createProcessGroupInternal()
From the stat() man page: "RETURN VALUE On success, zero is returned.
On error, -1 is returned, and errno is set appropriately." Hence check
for failure by checking whether the return value is negative instead of
1.

Bug: 213617178
Test: Booted Android in Cuttlefish and inspected logcat.
Fixes: 9e628a6b42 ("libprocessgroup: fix uid/pid hierarchy for recovery mode")
Change-Id: I774d142058b083403d32b3f6aae4a4b3de00192c
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-24 15:08:16 -07:00
Treehugger Robot
3d0143dc62 Merge "storaged: Fix double ownership for HealthInfoCallback." 2022-03-24 17:03:28 +00:00
Bart Van Assche
c408ee943a Merge "Use the proper memcg directory for the v2 hierarchy" 2022-03-24 00:25:47 +00:00
Bart Van Assche
4c95712c9f Use the proper memcg directory for the v2 hierarchy
When using the v1 hierarchy per process memcg directories exist under
/dev/memcg/apps. When using the v2 hierarchy per process memcg
directories exist under /sys/fs/cgroup. Hence this patch that selects
the proper top-level directory depending on the memcg version.

Bug: 213617178
Test: Verified Android operation inside the Cuttlefish emulator.
Change-Id: I7373fb407cb6ad2b1181579691ff54886fd36c24
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-23 14:12:43 -07:00
Bart Van Assche
3e9eeb8329 Merge "Enable the memory_recursiveprot mount option" 2022-03-23 20:34:22 +00:00
David Anderson
b51b109ea9 Merge "fastboot: Fallback to "raw" partition type if fastboot hal isn't present" 2022-03-23 18:09:25 +00:00
Bart Van Assche
4f2e62913d Enable the memory_recursiveprot mount option
Enable the memory_recursiveprot mount option for v2 cgroups because the
v2 memcg documentation mentions the following: "Recursively apply
memory.min and memory.low protection to entire subtrees, without
requiring explicit downward propagation into leaf cgroups.  This allows
protecting entire subtrees from one another, while retaining free
competition within those subtrees. This should have been the default
behavior but is a mount-option to avoid regressing setups relying on the
original semantics (e.g. specifying bogusly high 'bypass' protection
values at higher tree levels)."

Source: https://www.kernel.org/doc/Documentation/admin-guide/cgroup-v2.rst

Bug: 213617178
Test: Verified this change inside the Cuttlefish emulator.
Change-Id: Iecd86109d9ecb9d3354f9d28577b147edf7c50a8
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-23 10:37:26 -07:00
Treehugger Robot
f1df9ba5c4 Merge "vts_libsnapshot_test: Fix free space calculation." 2022-03-23 16:40:20 +00:00
Treehugger Robot
a41f3812fd Merge "Load kernel modules in parallel" 2022-03-23 07:40:18 +00:00
Treehugger Robot
99c892e579 Merge "restorecon /dev/console at the second stage boot" 2022-03-23 04:29:53 +00:00
Yifan Hong
f764aaf998 storaged: Fix double ownership for HealthInfoCallback.
SharedRefBase objects can only be created via
SharedRefBase::make, not std::make_shared. Otherwise
there'll be a double-ownership problem.

Test: TH
Fixes: 225448524
Change-Id: I856677626cb146eb52a5b4a4562148e899d5a57b
2022-03-22 21:25:28 -07:00
Inseob Kim
89d6913cf2 restorecon /dev/console at the second stage boot
It could be the case that /dev/console is created at the first stage
boot. ueventd doesn't have a permission to relabel from tmpfs to
console_device, so we should try restorecon /dev/console, together with
/dev.

Bug: 193118220
Test: atest MicrodroidHostTestCases
Change-Id: Ic538bc9214d3996fe7b37fa2224c1f0c6eb373d1
2022-03-22 21:51:07 +09:00
Eric Biggers
0c9413d883 Merge "init.rc: remove commented-out code that set vold.post_fs_data_done" 2022-03-22 03:42:23 +00:00
Treehugger Robot
76bb5f1c6e Merge "Symbolic constants for older minijails" 2022-03-22 02:01:29 +00:00
Treehugger Robot
38fe7c848c Merge "Add libmodprobe to hwasan-postsubmit" 2022-03-22 01:42:17 +00:00
Treehugger Robot
1f34b28356 Merge "Add support for memcg v2 attributes" 2022-03-22 01:40:09 +00:00
Treehugger Robot
948b4a5a8b Merge "Add keymint to hwasan-postsubmit" 2022-03-22 00:27:17 +00:00
Treehugger Robot
9f856bf6aa Merge "Add etc to hwasan-postsubmit" 2022-03-22 00:26:02 +00:00
Ray Essick
926f753e20 Symbolic constants for older minijails
Inline definitions of a few constants that don't appear on Q/R devices,
so that this works for us in mainline modules that are loaded on those
older devices.

Bug: 225406881
Test: boot on Q, watch logcat
Test: boot on R, watch logcat
Change-Id: Ic5781976d4c1e2d16e230c015fc49d9fde74e289
2022-03-21 16:31:00 -07:00
Daniel Norman
f1200fb117 Adds an init host lib for use in host_apex_verifier.
Includes extracting the APEX-specific SDK version naming scheme filter
logic so it can be reused when host_apex_verifier looks at rc files
inside the APEX.

Bug: 222121216
Test: Use in host_apex_verifier
Change-Id: I0396a455f30d2de71525ccd3fa69c75576054048
2022-03-21 15:45:44 -07:00
Eric Biggers
881ca51a84 init.rc: remove commented-out code that set vold.post_fs_data_done
The "vold.post_fs_data_done" system property was only used by FDE, which
is no longer supported, and this code was commented out anyway.

Bug: 208476087
Change-Id: Ib9346d14368c77058a598e5c4f5f2ed72f5a5316
2022-03-21 22:15:53 +00:00
Treehugger Robot
8461ca5945 Merge "Added trackName as additional argument to WRITE_MSG to handle trace messages with a track name" 2022-03-21 19:45:30 +00:00
Konstantin Vyshetsky
b3e1829421 fastbootd: pass handle in place of fd
There are cases such as non 4KB aligned buffers which break writes on
file descriptors opened with O_DIRECT. Flashing functions need more
control over the file descriptor, which is not achievable easily by
having only a file descriptor passed. This CL modifies the logic to pass
the PartitionHandle in place of the file descriptor during flashing.

Bug: 225108941
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I049d0ffb183c9de1267b7e442488c8ba5002186a
2022-03-21 11:35:42 -07:00
Treehugger Robot
4767dccadf Merge "Copy snapuserd to first_stage_ramdisk" 2022-03-21 15:47:25 +00:00
Kelvin Zhang
22929da287 Copy snapuserd to first_stage_ramdisk
Certain binaries, such as snapuserd, are only available under
/system/bin. To make them accessible by first stage init, we copy
/system/bin/snapuserd to /first_stage_ramdisk/system/bin/snapuserd .

Test: th
Bug: 219841787
Change-Id: I913425a82905c745a05ac32d488f08506dc264ff
2022-03-19 00:56:25 -07:00
Treehugger Robot
04288337c3 Merge "Rename FstabEntry::metadata_encryption to metadata_encryption_options" 2022-03-19 04:12:05 +00:00
Treehugger Robot
ee0584b2db Merge "Add property_service to hwasan-postsubmit" 2022-03-19 01:14:37 +00:00
Florian Mayer
e866ce421d Merge "Add libcutils to hwasan-postsubmit" 2022-03-19 00:25:31 +00:00
Florian Mayer
bf6f7fafb6 Merge "Add libpackagelistparser to hwasan-postsubmit" 2022-03-19 00:21:49 +00:00
Florian Mayer
3a99e7d2c4 Merge "Add socket_lazy to hwasan-postsubmit" 2022-03-19 00:15:53 +00:00