Commit graph

75210 commits

Author SHA1 Message Date
Suren Baghdasaryan
8330095807 Merge "init: try converting writepid used with cgroups into task_profiles command" 2022-04-05 16:37:55 +00:00
Shikha Panwar
757f299842 Make some debuggerd libraries available in apex com.android.virt
Test: Build passed & tested the whole topic
Bug:227443903

Change-Id: I113cd1e559307e191fec405206f23e1b4ce1a5fc
2022-04-05 15:55:16 +00:00
Suren Baghdasaryan
746ede9629 init: try converting writepid used with cgroups into task_profiles command
writepid usage to add a task to a cgroup was deprecated in favor of the
task_profile command. The reason is that writepid hardcodes cgroup path
and makes it hard to change it in the future, whereas task profiles
configure cgroup paths in one centralized place and are easy to change.
Log a warning when writepid is used with cgroups and try converting it
into a task_profiles command for well-known cgroups. If conversion is
not possible the writepid operation will still be attempted to avoid
breaking existing use cases and an error will be logged.

Bug: 191283136
Test: build and boot
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ie58393468ef7d92ab0ffb41e6f339e36d21f7478
2022-04-05 01:25:46 +00:00
Treehugger Robot
fad82b6c15 Merge "Add Rust wrapper for tombstoned client using cxx." 2022-04-04 22:38:40 +00:00
David LeGare
fd343ee2ea Add libtrusty-rs
Test: manual using tipc-test-rs
Bug: 226659377
Change-Id: I4afc24e5a602e7ca85d5c7088fecc211b71bfc66
2022-04-04 19:12:15 +00:00
Devendra Singhi
1431665cb0 sparse_fuzzer: Bug fix
Resolved Memory Leak

Test: ./sparse_fuzzer clusterfuzz-testcase-minimized-sparse_fuzzer-6050329726943232
Bug: 214604770

Change-Id: I8df4be935ff586efeebf7e32dccc52dbf82e5076
2022-04-04 14:03:55 +05:30
Suren Baghdasaryan
11602701d4 Merge "init: Treat failure to create a process group as fatal" 2022-04-02 20:11:45 +00:00
Suren Baghdasaryan
1bd1746447 init: Treat failure to create a process group as fatal
During process startup, system creates a process group and places the
new process in it. If process group creation fails for some reason, the
new child process will stay in its parent's group. This poses danger
when the child is being frozen because the whole group is affected and
its parent is being frozen as well.
Fix this by treating group creation failure as a fatal error which would
prevent the app from starting.

Bug: 227395690
Test: fake group creation failure and confirm service failure to start
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I83261bef803751759c7fd709bf1ccd33ccad3a0b
2022-04-01 23:32:47 +00:00
Lucas Wei
f0fb5dde89 fastboot: Add vendor_kernel_boot
Bug: 214409109
Signed-off-by: Lucas Wei <lucaswei@google.com>
Change-Id: I8b0baa887e5e2309a1cb4a602fe8f6ca9e22526b
2022-04-02 01:04:23 +08:00
Florian Mayer
6948bbf62c Merge "Make callback outlive LruCache." 2022-04-01 00:19:15 +00:00
Treehugger Robot
b488db911c Merge "Add a comment to explain how errno is set" 2022-03-31 21:19:14 +00:00
Florian Mayer
e0240d3f61 Make callback outlive LruCache.
The callback can be called by the destructor of LruCache, so it needs to be destructed last.

Bug: 227635615
Change-Id: I7d965a2000c1ec32d9c9e88d25ab0c1ba3e9c739
2022-03-31 20:21:28 +00:00
Bart Van Assche
54136f8bf4 Add a comment to explain how errno is set
Since it is nontrivial which modifies `errno` is modified in
ExecuteForTask(), add a comment that explains this.

Bug: 213617178
Test: Compile-tested only.
Change-Id: I49ce9c8054fdc59e61b2e5f9ffe6f16743a94401
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-31 11:30:03 -07:00
David Anderson
48d403a511 Merge "ueventd: Allow legacy paths in API version 32." 2022-03-30 21:45:46 +00:00
Wei Wang
921d266c81 Merge "Revert "Migrate the blkio controller to the v2 cgroup hierarchy"" 2022-03-30 16:02:45 +00:00
Bart Van Assche
159563561a Revert "Migrate the blkio controller to the v2 cgroup hierarchy"
Revert "Migrate the blkio controller to the cgroup v2 hierarchy"

Revert "Migrate the blkio controller to the cgroup v2 hierarchy"

Revert "Migrate the blkio controller to the cgroup v2 hierarchy"

Revert submission 1962326-blkio-cgroup-v2

Reason for revert: This set of changes is suspected to have caused a redfin boot time regression for the git_tm-dev branch.

Reverted Changes:
Id18d876b6:Migrate the blkio controller to the cgroup v2 hier...
I7dfa52136:Migrate the blkio controller to the v2 cgroup hier...
I5336167be:Migrate the blkio controller to the cgroup v2 hier...
I3f0131d8f:Migrate the blkio controller to the cgroup v2 hier...
Ibb62b2d4d:Migrate the blkio controller to the cgroup v2 hier...

Bug: 227382327
Bug: 227389363
Change-Id: I6c8183ed1c3044c8947c4fca07799deff98101b3
2022-03-30 14:58:20 +00:00
Andrew Walbran
3b7591248d Add Rust wrapper for tombstoned client using cxx.
Bug: 226162295
Test: atest libtombstoned_client_rust_test
Change-Id: Ibe7c41e2381f0f369a76175d6f71fc60b71cc7d5
2022-03-30 14:17:55 +00:00
Suren Baghdasaryan
7c43c6c9a0 Merge "Revert "Fix the cgroup directory owner in createProcessGroupInternal()"" 2022-03-30 01:48:19 +00:00
Bart Van Assche
8eb7a6edea Revert "Fix the cgroup directory owner in createProcessGroupInternal()"
This reverts commit 812d7698d8.

Reason for revert: this patch is suspected to have caused b/227337425.

Bug: 227337425
Bug: 227331047
Change-Id: I4ae26ccf61ad7c63dacc85da878ba0920736951c
2022-03-30 01:40:50 +00:00
David Anderson
ed1bca4b52 ueventd: Allow legacy paths in API version 32.
Bug: 226699360
Test: manual test
Change-Id: I2602eaa217a2b6cba8a5fb8acd6d5a8a9e3d405e
2022-03-29 17:50:01 -07:00
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