Commit graph

80219 commits

Author SHA1 Message Date
Mitch Phillips
18ce54241c Add recoverable GWP-ASan.
Recoverable GWP-ASan is a mode landed upstream in
https://reviews.llvm.org/D140173. For more information about why/what it
is, see
https://android-review.git.corp.google.com/c/platform/bionic/+/2394588.

This patch makes debuggerd call the required libc callbacks for GWP-ASan
to recover from the memory corruption. It also adds the functionality
that libart/sigchain eventually ends up calling, which dumps a GWP-ASan
report for the first error encountered.

Test: Build the platform, run sanitizer-status in recoverable mode,
asserting that it doesn't crash but we get a debuggerd report.
Bug: 247012630

Change-Id: I27212f7250844c20a8fd1e961417cdb4e5bd3626
2023-02-01 15:25:29 -08:00
Treehugger Robot
a812f45678 Merge "Pass fault address to GWP-ASan's changed API." 2023-01-17 20:29:46 +00:00
Treehugger Robot
aaa402ae6a Merge "TEST_MAPPING: add vts core lib tests" 2023-01-17 18:40:24 +00:00
Treehugger Robot
c332f33187 Merge "init: Make console a shutdown critical service" 2023-01-13 21:10:22 +00:00
Florian Mayer
cad7f577d1 Merge "Handle scudo_ring_buffer_size = 0" 2023-01-13 17:54:50 +00:00
Akilesh Kailash
545870e53a Merge "init: Wait for daemon to fully spin up all threads" 2023-01-13 06:35:33 +00:00
Gabriel Jacobo
12f9ff8951 init: Make console a shutdown critical service
A critical shutdown service is one that stays on right until the system
is rebooted. In order to be able to capture kernel messages right until
reboot this is required, otherwise after the console service is
terminated some messages can be lost.

Test: Reboot and verify messages show up on serial further down the reboot process
Change-Id: Iea58b5a76afe45b3346803021e3be81742b02ea0
2023-01-12 16:46:38 -08:00
Florian Mayer
30a25286c4 Handle scudo_ring_buffer_size = 0
Bug: 263287052
Change-Id: I0bec3a817d7a16c72d5dfeddd0dcc86830f5a311
2023-01-12 16:06:10 -08:00
Treehugger Robot
d5d01db888 Merge "fastboot: Copy AVB footer from recovery.img to the end of the partition" 2023-01-13 00:04:58 +00:00
Isaac J. Manjarres
acb49528a7 fastboot: Copy AVB footer from recovery.img to the end of the partition
Copy the AVB footer of the recovery.img to the end of the recovery
partition, so that it can be found when loading a recovery image
from a partition that is larger than the image.

Bug: 261673286
Test: m and flashing recovery image and bootloader can now detect
AVB footer.
Change-Id: Ib93da33c72f3a96eb8d9bcedaab5ef0c3a4d418d
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
2023-01-12 14:33:56 -08:00
David Anderson
9b9924b412 Merge "init: Allow persistent properties to be written asynchronously." 2023-01-12 21:50:42 +00:00
Mitch Phillips
8a34b179ad Pass fault address to GWP-ASan's changed API.
GWP-ASan changed one of the APIs upstream to now take the fault address
as well. This is to support the recoverable mode.

Add the fault address as well.

Test: gwp_asan_unittest
Bug: N/A
Change-Id: I8a4edd3fad159d91cc036050d330bbb8f9c8d435
2023-01-12 09:48:11 -08:00
Elliott Hughes
beeef8c01a Merge "mkbootfs: consistency." 2023-01-12 17:02:53 +00:00
David Drysdale
82ef14bf76 Merge "Helper for setting attestation IDs" 2023-01-12 06:20:45 +00:00
Treehugger Robot
52d91b3fc0 Merge "usb: migration to USB gadget AIDL" 2023-01-12 05:37:41 +00:00
Elliott Hughes
ad1a0a9b0b mkbootfs: consistency.
Move all the error reporting over to err()/errx() rather than the
current mix of errx(), fprintf()+exit(), and the homebrew die().

Also make the two "read all the lines in the file" loops match, by
copying the newer getline() style into the older fgets() loop.

Test: treehugger
Change-Id: Ia732df90588d7fd12dfe965e11c6ed72a96b098d
2023-01-12 04:34:15 +00:00
Treehugger Robot
99b26cf41b Merge "remount: Add checkpoint instructions with warning" 2023-01-12 01:44:03 +00:00
Treehugger Robot
a4dae3c6f5 Merge "Do not create worker thread if threading isn't enabled" 2023-01-12 01:12:06 +00:00
Chih-hung Hsieh
4c3b71ee83 Merge "Suppress clang-analyzer-security.FloatLoopCounter warnings" 2023-01-12 00:18:27 +00:00
Daniel Rosenberg
61b2304ffb remount: Add checkpoint instructions with warning
When debugging an issue before boot complete, it may be necessary to
remount before checkpointing can finish. This gives instructions on
ending checkpointing early, allowing a remount, along with a warning to
not do that unless you know what you are doing.

Bug: 252989722
Test: Displays text in log
Change-Id: Ibdd39464b980ec531a900e162469a884f9096904
2023-01-12 00:04:54 +00:00
Treehugger Robot
e8d42e65c8 Merge changes I169b52cf,Ieb0e4e24
* changes:
  init: Add test for gentle_kill
  init: Add gentle_kill service property
2023-01-11 23:16:55 +00:00
Chih-Hung Hsieh
dfd1d517b1 Suppress clang-analyzer-security.FloatLoopCounter warnings
* Suppress also the alias check name cert-flp30-c.
* Leave comment in code for code owners to rewrite
  the loop with integer counters.

Bug: 265171053
Test: presubmit; tidy-system-core-storaged_subset
Change-Id: I8297161366a7a2e1c7cdbec8efb7a8e9e435166a
2023-01-11 14:21:46 -08:00
Treehugger Robot
46134b9cae Merge "Zero-length packet send bug resolution for fastboot." 2023-01-11 20:55:28 +00:00
Akilesh Kailash
717ee9120a Merge "init: Avoid killing all processes during reboot if update is in progress" 2023-01-11 20:52:13 +00:00
Shaju Mathew
dce1371666 Zero-length packet send bug resolution for fastboot.
Bug: 208675141

Test: Treehugger, cursory test of fastbootd against macOS Monterey running fastboot.

Change-Id: Id2ac1be428470385c866d505f860e50bd9132e2e
Signed-off-by: Shaju Mathew <shaju@google.com>
2023-01-11 19:32:01 +00:00
Akilesh Kailash
5140f3ad47 init: Wait for daemon to fully spin up all threads
During selinux transition, daemon will notify `init` process
by writing to file "/metadata/ota/daemon-alive-indicator".

Init will wait until daemon notifies it. Furthermore, daemon
will only write to that file once all threads are spin up
and attached to dm-user misc devices.

Once snapshot-merge is completed, this file will be removed.
Additionally, during boot, init will also ensure that
there are no stale files and will try to remove just
before selinux transition.

Bug: 262407519
Test: OTA on Pixel - Verify new file exits and init waits until daemon
is fully up.
Change-Id: Iabef58ad282d80a7afa493e9df9468ae41a13e44
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-01-11 19:24:56 +00:00
Treehugger Robot
7fcaa14e27 Merge "Add comment about out-of-bounds being on purpose" 2023-01-11 18:55:18 +00:00
Treehugger Robot
d2401873f2 Merge "Parser::ParseConfigFile returns Result<void>" 2023-01-11 12:11:18 +00:00
Treehugger Robot
bf3c1c56d8 Merge "BatteryMonitor: fix depending on multiple versions of the same aidl_interface" 2023-01-11 11:25:17 +00:00
Jooyung Han
6b88d1684c Parser::ParseConfigFile returns Result<void>
ParseApexConfigs() uses Parser::ParseConfigFile() to parse .rc files in
the target apex. ParseConfigFile() returning bool (with logging on
error) doesn't propagate the error message back to the callers
(including apexd or PackageManager).

We'd better to migrate other Parse*() methods of Parser class to return
Result<T>. But this change focuses on plumbing error progagation for
APEX configs.

Bug: 238820991
Test: atest CtsInitTestCases
Change-Id: Ifad97635dbb53a70053ec73a7a5b7e742466daf6
2023-01-11 17:20:16 +09:00
Akilesh Kailash
2c52d09078 init: Avoid killing all processes during reboot if update is in progress
Bug: 262321167
Test: Reboot device post OTA reboot
Change-Id: I5d13844e4e157d24a414dce668163bb1915bf65e
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-01-11 06:00:34 +00:00
Daniel Rosenberg
ed8178c8cc init: Add test for gentle_kill
Tests that a service marked as gentle_kill terminiated with SIGTERM

Bug: 249043036
Test: atest CtsInitTestCases:init#GentleKill
Change-Id: I169b52cfd74f07b4d2439761ea315117323b3fcb
2023-01-10 18:29:46 -08:00
Daniel Rosenberg
de76688e40 init: Add gentle_kill service property
If a service specifies gentle_kill, attempt to stop it will send SIGTERM
instead of SIGKILL. After 200ms, it will issue a SIGKILL.

Bug: 249043036
Test: atest CtsInitTestCases:init#GentleKill
      Added in next patch
Change-Id: Ieb0e4e24d31780aca1cf291f9d21d49cee181cf2
2023-01-10 18:29:46 -08:00
Jack Wu
f83e5a6ebd BatteryMonitor: fix depending on multiple versions of the same aidl_interface
When health aidl_interface version updraged, some libraries are
depending on V1 and libbatterymonitor or libhealthd_charger_ui at
the same time. It will cause multiple versions depending if
libbatterymonitor or libhealthd_charger_ui are depending on new
version.

Fork libbatterymonitor and libhealthd_charger_ui to generate two
versions, so that other libraries can depend on the same aidl_interface
version, to avoid multiple versions depending.

Bug: 251425963
Test: build
Change-Id: I37ba23169428677550176916e5d0b52c154d7b85
Signed-off-by: Jack Wu <wjack@google.com>
2023-01-11 08:58:46 +08:00
Florian Mayer
fe9d83251b Merge "Use scudo_ring_buffer_size from process_info" 2023-01-10 21:23:33 +00:00
Kelvin Zhang
124492d875 Do not create worker thread if threading isn't enabled
Currently, we would create worker threads even if number of compression
thread is set to 1. This works, but having context switches and data
exchange between two threads is complete overhead if main thread is just
blocking on the worker thread.

Test: th
Change-Id: I02f98ee1e0c4889dc1ae602eb06667b05796d3f0
2023-01-10 12:09:46 -08:00
David Drysdale
2ac6aed466 Helper for setting attestation IDs
Useful for testing on unprovisioned devices, so that IDs match those
expected by the VTS tests.

Note that any attestation involving the values set as attestation IDs
will only be signed by a fake key, and so will not be a valid
attestation of anything.

Bug: 258602662
Test: VtsAidlKeyMintTargetTest --gtest_filter="*NewKeyGenerationTest.EcdsaAttestationIdTags*default"
Change-Id: Ic31e4f28ec3a2830ae12a794b2fa063944df2614
2023-01-10 06:30:06 +00:00
Ricky Niu
ba43d547b6 usb: migration to USB gadget AIDL
Using the USB gadget AIDL

Bug: 261027750
Test: USB function switch success and AIDL service is running.
Change-Id: I4781ac9eb641a5340ecfb6bda0881761b7a01eb2
2023-01-10 11:24:36 +08:00
Treehugger Robot
22e18082d1 Merge "Fix the cgroup v2 thread path" 2023-01-10 01:30:07 +00:00
David Anderson
0af9ab3308 init: Allow persistent properties to be written asynchronously.
Persistent properties are flushed with fsync which can cause the
non-persistent property write path to block.

Bug: 250125146
Test: manual test with ro.property_service.async_persist_write = true
Change-Id: Id123bfc7de948b76c51b4d98d00c8cb4a0850bf1
2023-01-09 16:41:56 -08:00
Colin Cross
6f2dab0ba7 Merge "Use err() instead of error() in mkbootfs" 2023-01-10 00:09:12 +00:00
Mariah Papy
f079b5ca01 Merge "Android typo fix exercise, uknown -> unknown Test: refactoring CL. Existing unit tests still pass." 2023-01-09 23:12:47 +00:00
Bart Van Assche
0e8e4f87fd Fix the cgroup v2 thread path
The name for the file with thread IDs is "tasks" in the v1 hierarchy and
"cgroup.threads" in the v2 hierarchy.

References:
* https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/cgroups.html
* https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html

Bug: 213617178
Fixes: 82b72a5667 ("libprocessgroup: Add support for task profiles")
Change-Id: I87d67edeb12803cb83486be8f1b1b56a3f275a9d
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-01-09 14:40:51 -08:00
Colin Cross
6f2ae489d7 Use err() instead of error() in mkbootfs
error() is a glibc extension that is not available in musl libc.
err() is a BSD extension, but is present in glibc, musl libc and
bionic.

Test: m USE_HOST_MUSL=true host-native -k
Change-Id: I2ba7bddc2a725826be8be7f80208587b81de9238
2023-01-09 14:15:27 -08:00
Edward Liaw
51c52426f7 TEST_MAPPING: add vts core lib tests
Bug: 258819618
Test: atest :kernel-presubmit
Change-Id: I5e60c69e4f442d33a67b138314918725c6321137
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-01-09 22:05:37 +00:00
Florian Mayer
04fb2c838d Add comment about out-of-bounds being on purpose
Change-Id: I97e334f0555cce80eeab6567905054d807af3c91
2023-01-09 21:46:10 +00:00
Mariah Papy
23f6b6727d Android typo fix exercise, uknown -> unknown
Test: refactoring CL. Existing unit tests still pass.

Change-Id: I8b8d1f3f54f3c1c6b05b9a41a49ed5c418140310
2023-01-09 19:13:01 +00:00
Carlos Galo
177f5b1822 Merge "Set memlock rlimit to 64KB" 2023-01-09 19:05:59 +00:00
Vincent Donnefort
60305abf38 Merge changes Ieb75b1d1,Id1c83c8b,I8cb3de94
* changes:
  mkbootfs: Add support for a dev node list file
  mkbootfs: Add support for dev nodes
  mkbootfs: Use getopt_long
2023-01-09 18:21:42 +00:00
Kalesh Singh
93e02c6da6 Merge "init: Take wakelock on zygote restart" 2023-01-09 17:55:09 +00:00