Commit graph

80100 commits

Author SHA1 Message Date
Chih-Hung Hsieh
7e575a07be Disable clang-tidy on crash test.
Bug: 263274255
Test: presubmit; make tidy-system-core-debuggerd_subset
Change-Id: I2eb5dcb87894b3282ff19e006f6a0209c9153519
2023-01-03 15:58:29 -08:00
Bart Van Assche
b333a400c9 Merge "Make an error message more informative" 2023-01-01 16:16:41 +00:00
Bart Van Assche
f85317fb43 Make an error message more informative
From
https://android-build.googleplex.com/builds/tests/view?testResultId=TR66328435937757440&invocationId=I00700010119503421:

system/core/init/init_test.cpp:219: Failure
Failed
Value of: service->Start()
  Actual: createProcessGroup(0, 15611) failed for service 'console'
  Expected: is ok

The above error message does not contain enough information to
root-cause the test failure. Hence this CL that makes an error message
more informative.

Bug: 262090304
Change-Id: I09929b2f2aabf1eec4d90ec93234a9e968888da4
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-12-31 23:41:29 +00:00
Vamsidhar reddy Gaddam
433dae11ce Merge "Revert "host_init_verifier: add check for root services and linux capabilities"" 2022-12-28 16:19:58 +00:00
Nikita Ioffe
24d1c238ce Revert "host_init_verifier: add check for root services and linux capabilities"
This reverts commit f1e3bfff40.

Reason for revert: Breaks builds

Bug: 263874232
Change-Id: Iabe5cd01114bf4a3731ace4345da8009e6b86f74
2022-12-28 16:18:20 +00:00
Nikita Ioffe
9d984772b3 Merge "host_init_verifier: add check for root services and linux capabilities" 2022-12-28 15:38:51 +00:00
Inseob Kim
eb3912ea73 Merge "Don't retry kill if cgroups isn't available" 2022-12-27 01:48:37 +00:00
Bart Van Assche
91bc6d30dd Merge "Updating Attributes on task_profiles.json" 2022-12-26 01:31:14 +00:00
Nikita Ioffe
f1e3bfff40 host_init_verifier: add check for root services and linux capabilities
If a service that runs under root doesn't have the capabilities field in
it's definition, then it will inherit all the capabilities that init
has.

This change adds a linter to detect such services and ask developers to
explicitly specify capabilities that their service needs. If service
doesn't require any capabilities then empty capabilities fields should
be added in the service definition.

The actual access control list on what capabilities a process can use is
controlled by the SELinux, so inheriting all the init capabilities is
not a security issue here. However, asking services to explicitly
specify the capabilities they need is a good defense-in-depth mechanism.

So far this linter only checks the services on /system partition.

All currently offending services are added to the exempt list. I will
work on fixing some of them in the follow-up changes.

Bug: 249796710
Test: m dist
Change-Id: I2db06af165ae320a9c5086756067dceef20cd28d
2022-12-22 22:08:49 +00:00
Zhi Dou
94cc82cfc8 Merge "Replace "apex_inherit" min_sdk_version" 2022-12-22 14:59:33 +00:00
Carlos Galo
92153fb955 Updating Attributes on task_profiles.json
Adjusting attributes that correspond to the `blkio`(v1)/`io`(v2) controller. The migration of the `blkio` v1 controller to v2 requires renaming it to `io`, therefore we want to update the `File` field to point to `blkio` file and `FileV2` to point to `io` file.

Test: Verified with cuttlefish that this works with the `io` controller migration by cherry-picking aosp/2218645
Bug: 263269364
Bug: 213617178
Change-Id: I0aacfc6d74e3eec61ebb2ce443b04c792392aa9e
2022-12-22 00:53:00 +00:00
Chih-hung Hsieh
dd75c27f26 Merge "Fix uninitialized value warnings." 2022-12-21 19:54:22 +00:00
David Brazdil
cc2e7c21a2 Merge "Make /dev/{kvm,vhost-vsock} accessible to all UIDs" 2022-12-21 05:51:54 +00:00
Chih-Hung Hsieh
0ebbc62c63 Fix uninitialized value warnings.
* Also applied clang-format.

Bug: 263274255
Test: presubmit; make tidy-system-core_subset
Change-Id: I63149572b3e1af6ef33ce19c8d3f18b4f28a3eab
2022-12-20 11:56:40 -08:00
Zhi Dou
ff9e640e43 Replace "apex_inherit" min_sdk_version
Replace "apex_inherit" min_sdk_version to a conditional setting. If
environment veriable KEEP_APEX_INHERIT is set, using "apex_inherit" as
the min_sdk_version, otherwise set the number to "29". For more detail
please refer
https://docs.google.com/document/d/1R2vZw0cQa-haAMgFyQ682uSq9aGBNQrzMHKIsU17-XY/edit?usp=sharing&resourcekey=0-gUbs463r9LCKs7vdP_Xkmg

Test: build APEX uses this library, and presubmit
Bug: 254634795
Change-Id: If7acfce5fb2e1cb1cc7208a8c57b1e1cd1499c11
Merged-In: Ie6984128e6b84ba73de3f4c08eca5560657c5ca2
2022-12-20 16:05:54 +00:00
David Brazdil
8faa47c3ec Make /dev/{kvm,vhost-vsock} accessible to all UIDs
We will continue to restrict access to /dev/kvm and /dev/vhost-vsock with SELinux.

Bug: 245727626
Test: atest -p packages/modules/Virtualization:avf-presubmit
Change-Id: Id4f3e19c18a51bc51e6363d6ffde31c1032cf967
2022-12-20 08:20:26 +00:00
Jiyong Park
3e951a7758 Merge "Skip StartConsole test on user builds." 2022-12-20 07:08:23 +00:00
Jiyong Park
5b7a51a59a Skip StartConsole test on user builds.
It runs a service with root privilege which can't be done on user
builds. Until the issue is resolved, skip the test on user builds.

Bug: 262090304
Test: N/A
Change-Id: I690ffbd7fdaef688a0c862e0c653e9b21e281ece
2022-12-20 10:46:31 +09:00
Treehugger Robot
fd98382506 Merge "Run the console test with /dev/null" 2022-12-16 01:54:14 +00:00
Carlos Galo
ce318e8818 Merge "Updating owners of libprocessgroup" 2022-12-16 00:02:01 +00:00
Treehugger Robot
583b616ba8 Merge "Update docs around capabilities and root processes" 2022-12-15 19:31:37 +00:00
David Anderson
1c34ae8864 Merge "Update vts_fs_test to reflect VSR." 2022-12-15 19:17:03 +00:00
Carlos Galo
8ceaf0c636 Updating owners of libprocessgroup
Adding tjmercier@google.com and carlosgalo@google.com, and removing
ccross@google.com, in the OWNERS file. Adding buganizer component to
OWNERS.

Bug: 262738363
Test: N/A
Change-Id: I7f8cdc513232b46eb341f3c98f64dfb1d9bd9d7a
2022-12-15 19:12:33 +00:00
Nikita Ioffe
cc0e90a964 Update docs around capabilities and root processes
Current documentation is misleading: if a service runs as root and
doesn't specify any capabilities, then it will start with all the
capabilities (note that whether it can use them is controlled by
selinux).

Test: n/a
Bug: 249796710
Change-Id: I0d6a884127c6a6c5b651c1222fcf48322065daae
2022-12-15 18:04:21 +00:00
David Anderson
3460b75289 Merge "libdm: Add a helper function for creating placeholder devices." 2022-12-15 17:26:59 +00:00
Jiyong Park
ae412804ca Run the console test with /dev/null
The availability of /dev/console varies across different devices and
even across different build variants (ex: userdebug/user). Instead of
relying on the device-specific condition, use the /dev/null as the
console device for the test.

Bug: 262090304
Test: atest CtsInitTestCases on raven-user
Change-Id: I3b12d66e94609328dfdd6f640d1adb88a773fa38
2022-12-15 16:32:38 +09:00
Inseob Kim
110cd77b30 Don't retry kill if cgroups isn't available
It makes no sense, because there are no cgroup procs file.

Bug: 257264124
Test: atest MicrodroidBenchmarkApp
Change-Id: I4e3a118d2237afc46aa8fbcbad055afb7d56f464
2022-12-15 15:29:38 +09:00
David Anderson
37b52b6576 Update vts_fs_test to reflect VSR.
Bug: 253052346
Test: vts_fs_test
Change-Id: I8dbdf731acea9ff5d5006ee3767eda5417d476fd
2022-12-14 22:08:40 -08:00
David Anderson
6433d16543 libdm: Add a helper function for creating placeholder devices.
Bug: 259328366
Test: device boots and mounts userdata
Change-Id: I7aced2eeca984e8ec69633c25d44cd411d0a0583
2022-12-14 21:56:45 -08:00
Hasini Gunasinghe
6dfeccf9c8 Merge "Process large messages from TA" 2022-12-14 16:33:24 +00:00
Jiyong Park
717ece7397 Merge "Clarify the behavior about event and property triggers" 2022-12-14 15:16:31 +00:00
Yi-yo Chiang
3ae0234484 Merge "overlayfs: Mount overlay with context= fs_options if original mount has it" 2022-12-14 07:18:06 +00:00
Treehugger Robot
b7d4804453 Merge "Skip system/bin/bootstrap/linkerconfig" 2022-12-14 07:16:12 +00:00
Steven Moreland
bb1ee3c689 Merge "ignore error -> log" 2022-12-14 01:29:20 +00:00
Steven Moreland
507209ba55 ignore error -> log
Current code ignores an error, which is a code
rot risk.

Bug: 261700511
Change-Id: I04ca7046dc42d761ecaaf56f6100c96cc8298ec5
Test: N/A
2022-12-13 22:43:58 +00:00
Treehugger Robot
f6fe4fc9fa Merge "Remove an unnecessary #include." 2022-12-13 18:38:38 +00:00
Eran Messeri
33937f432c Merge "Bump the KeyMint version to v3" 2022-12-13 17:58:17 +00:00
Elliott Hughes
a27f23e61e Remove an unnecessary #include.
This confused me while doing a code search.

Test: treehugger
Change-Id: Ic8d63a3f5b8efb8557d0033d458f5265762da716
2022-12-13 17:08:24 +00:00
Yi-Yo Chiang
b0e6c82a86 overlayfs: Mount overlay with context= fs_options if original mount has it
Say we have mount configurations as follows:
  mount <dev> /mnt_point -t ext4 -o ro,context=<se_file_context>
  mount overlay /mnt_point2 -t overlay -o lowerdir=/mnt_point,upperdir=...

Overlayfs driver doesn't forward the overridden file context from
/mnt_point to /mnt_point2, thus the same file (same inode) would have
different file context when accessed via /mnt_point and /mnt_point2.

This change makes adb remount to mount filesystem overlays with context=
option if the overlaid mountpoint has it too. This makes the files under
context= mountpoint to retain the same file context after remount.

Also run clang-format on the whole file to fix some formatting issues.

Bug: 243501054
Test: adb remount && check file context with "ls -Z"
Change-Id: Ie4815604c56f1ce81b755cd0569b6577bd5f575f
2022-12-13 12:00:38 +00:00
Yi-yo Chiang
e0877535ab Merge "overlayfs: fs_mgr_overlayfs_setup() should accept Fstab as input" 2022-12-13 11:56:17 +00:00
Jooyung Han
56bee1f7d0 Skip system/bin/bootstrap/linkerconfig
Early processes can't rely on APEXes anyway. We don't need to run
linkerconfig.

This helps to reduce the storage usage (no
/system/bin/bootstrap/linkerconfig) and the boottime (not running
linkerconfig).

If we need more complicated linker config even for early processes, then
we could generate it at build-time and use it like recovery version.

Bug: 262330207
Bug: 260982509
Test: MicrodroidAppTest
Test: device boots
Change-Id: Iceca5ffdb1655fd94e90b0091f439bd22130185e
2022-12-13 18:04:52 +09:00
Yi-yo Chiang
acac60d5a4 Merge "libfstab: Add const overload of GetEntryForMountPoint()" 2022-12-13 06:24:46 +00:00
David Anderson
95cfb31bd2 Merge "Support sysfs changes in the Linux 5.15 kernel." 2022-12-12 18:38:04 +00:00
Yi-Yo Chiang
e508ac4f2e overlayfs: fs_mgr_overlayfs_setup() should accept Fstab as input
Right now fs_mgr_overlayfs_setup() always reads the default fstab and
this makes the "-T" option of remount useless.
Change it so that the fstab is passed in by the caller.

Bug: 243501054
Test: adb remount -vT <path/to/fstab>
Test: and check that overlay is active after reboot
Change-Id: Ia4101938a50c305f105c57018b02aec01f862dec
2022-12-13 01:53:37 +08:00
Yi-Yo Chiang
d45750aa2c libfstab: Add const overload of GetEntryForMountPoint()
Const version of GetEntryForMountPoint() accepts a pointer to const
Fstab and returns a pointer to const FstabEntry.

In order to refrain from adding more boilderplate, simplify the
implementation of GetEntryForMountPoint() to "return first entry of
GetEntriesForMountPoint()". The added overhead should be negligible as
fstab is usually small (around dozens of entries max), so iterating the
whole list is not computationally expensive.

Also templatize the implementation of GetEntriesByPred() to reduce the
amount of boilerplate.

Bug: 243501054
Test: Presubmit
Change-Id: I046d61d68385825656bb7bc7177c0d1d3e8b36e1
2022-12-13 01:53:37 +08:00
Jiakai Zhang
70d34f01a3 Merge changes I52e778d1,I33f4d1d2
* changes:
  Rename "Dex2OatBootBackground" to "Dex2OatBackground".
  Add task profile "Dex2OatBackground".
2022-12-12 17:37:42 +00:00
Akilesh Kailash
a96e27ca44 Merge changes from topic "libsnapshot-batch-writes"
* changes:
  libsnapshot: Test batch writes and threaded compression
  libsnapshot: Batch write COW operations in a cluster
  libsnapshot: Use two threads to run compression
2022-12-12 16:39:00 +00:00
Jiakai Zhang
180a51d6f3 Rename "Dex2OatBootBackground" to "Dex2OatBackground".
Bug: 261557677
Change-Id: I52e778d13cffcae4212acb05ef2bd62b827fbaf3
Test: Presubmit
Merged-In: I52e778d13cffcae4212acb05ef2bd62b827fbaf3
(cherry picked from commit 473f03bfd9)
2022-12-12 16:28:11 +00:00
Jiakai Zhang
38e9373a4b Add task profile "Dex2OatBackground".
Bug: 261557677
Test: Presubmit
Change-Id: I33f4d1d2270da82cf90a772ef52b450bcecafec2
Merged-In: I33f4d1d2270da82cf90a772ef52b450bcecafec2
(cherry picked from commit ecfbf9c6f4)
2022-12-12 16:27:15 +00:00
Treehugger Robot
5c3e24816d Merge "Kill services even when cgroups is disabled" 2022-12-12 01:20:45 +00:00