Commit graph

4268 commits

Author SHA1 Message Date
Michael Bestas
f4a7c0fa38 Revert "init: remove session keyring workaround for old kernels"
Reason for revert: Still needed for <4.14 devices.

This reverts commit 5d7c35ce20.

Change-Id: I695f04514f4334c77636120d94990b0b6eaa11a3
2024-09-08 23:09:17 +02:00
me-cafebabe
9cb248617d first_stage_mount: Skip dm-verity setup if AVB is not enabled
Change-Id: Ia06e94e91cf5fdce14ce37eb85fdd95df1d059bc
2024-09-08 00:09:17 +02:00
Alessandro Astone
b8eaf5ae42 reboot: allow opting-in to fastbootd
Change-Id: Iaf5eb813e848ef05b1b455ebfe3643f4a8b4f80d
2024-09-08 00:02:48 +02:00
William Bellavance
3fb9072f4d init: don't skip starting a service with no domain if permissive
[Adrian DC] Preserve the log while permissive

Change-Id: I3f2887930e15d09014c2594141ba4acbbc8d6d9d
2024-09-08 00:00:20 +02:00
David Ng
1ba23d4875 init: Add vendor-specific initialization hooks.
Allow optional vendor-specific initializations
within init.  This can be used for runtime
initialization setup that init rc scripts do
not support.

Change-Id: I7623a0d59b18f9ec8e3623958e2f7ccd72b877bf
2024-09-08 00:00:05 +02:00
Treehugger Robot
a1188013f3 Merge "make apex init .XXrc parsing honour .35rc even though we're not yet sdk=35" into main 2024-06-14 14:37:05 +00:00
Steven Moreland
e767a71114 Merge "init: enable 'user root' check at build time" into main 2024-06-05 19:23:20 +00:00
Steven Moreland
81a1b3ec23 init: enable 'user root' check at build time
For visibility.

We could make this only for new API levels, but it isn't
currently exposed at build time, and visibility is good
on upgrades.

Bug: 340953047
Test: build, on device passing and failing requirements
Change-Id: I3a0ea47560c65114bc1b8685954d1fb7687cb8df
2024-06-05 00:58:49 +00:00
Elliott Hughes
c088de1879 libc++fs is part of libc++ now.
Change-Id: I2be806de736377e77bb49e4b3b9f72e25f7d717a
2024-06-04 16:47:32 +00:00
Nate Myren
cdd4cb7db8 Merge "Revert^2 "Only write appcompat properties if flag is defined"" into main 2024-05-31 01:31:38 +00:00
Treehugger Robot
0b64326377 Merge "init: 'user root' check use vendor API" into main 2024-05-29 13:27:16 +00:00
Steven Moreland
5088e588f7 init: 'user root' check use vendor API
This changes user root to use the year date format
that vendor API uses.

Previously this still applied to V devices, which switched
to using API level 202404 after 35.

They recommend the year/date form, and there is no
constant for this.

Bug: 340953047
Test: service_test
Change-Id: I5ba8d1251c877a785e41f0cfcc35d7cb0776f8c7
2024-05-29 00:05:26 +00:00
Nate Myren
b9e0545c85 Revert^2 "Only write appcompat properties if flag is defined"
This reverts commit 6d8304aa46.

Reason for revert: resubmission

Change-Id: Ifb66efa2b1b7a734302316259690950306af99ec
2024-05-28 23:40:59 +00:00
Bart Van Assche
262f1e8096 Create the /dev/sys/block/by-name/zoned_device symbolic link
This link will be used to change the sysfs attributes of the zoned block
device from an .rc file.

Bug: 335708738
Change-Id: I99f74c121e7d9da404c0564860c03ac1efe6c6d8
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2024-05-24 09:36:46 -07:00
Bart Van Assche
254436b3ae Make more DeviceHandler member functions private
Make all member functions private that are not called from outside
DeviceHandlermember functions.

Bug: 335708738
Change-Id: Ibe2e5f6b8b45a79b5be59665627e0a46de4e439a
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2024-05-23 12:45:40 -07:00
Bart Van Assche
ba1e0bdd6c Merge "init: Use std::string_view instead of std::string where appropriate" into main 2024-05-22 23:16:30 +00:00
Bart Van Assche
564d970bd0 init: Use std::string_view instead of std::string where appropriate
Slightly reduce the time that is required to start the init process by
changing two static std::string variables into std::string_view variables.

Change-Id: Ib683a603da5f3d8968b26453b12544fed8a6397f
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2024-05-22 16:14:23 -07:00
Sami Tolvanen
b87b255540 riscv64: increase ASLR randomness for Sv48/57
Linux 6.9+ supports 33 bits with Sv48 and Sv57. Increase the
maximum and update the comment.

Bug: https://github.com/google/android-riscv64/issues/1
Test: Treehugger
Change-Id: Ia2731143ad30c5febe2058d35a381c01b14d8c3c
2024-05-21 17:33:22 +00:00
Treehugger Robot
edbddd3097 Merge "firmware_handler: Print full FW path before loading" into main 2024-05-21 16:16:02 +00:00
Treehugger Robot
0d8a598b40 Merge "init: delay 'user root' test to W+" into main 2024-05-21 15:43:26 +00:00
Steven Moreland
a8a2c5a7e1 init: delay 'user root' test to W+
We'll make it a build time check in V after this.

Due to being a runtime flog, it was hard to spot and
debug, so delaying.

Bug: 340953047
Test: boot, CtsInitTestCases
Change-Id: Ica1a1c780e230c88615dad7937404d2b0fe9c68f
2024-05-20 22:05:00 +00:00
Maciej Żenczykowski
5e88a32def make apex init .XXrc parsing honour .35rc even though we're not yet sdk=35
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I315cfe77c60988d8cdc8ef64bf8cb2f5c37c93db
2024-05-20 14:25:56 +00:00
Treehugger Robot
be6e1459ee Merge "Add restorecon flags for force and data data" into main 2024-05-16 23:15:55 +00:00
Luzanne Batoon
1ebf9cb663 Add restorecon flags for force and data data
Test: m
Bug: 210155681

Change-Id: I9d5b64c48d21e83fb8f03dac261efc530c5f8aa6
2024-05-16 21:35:54 +00:00
Steven Moreland
bf7e0df4d6 Merge "16k kernel dev option changes ro.build.fingerprint" into main 2024-05-16 00:44:41 +00:00
Steven Moreland
188d59a919 16k kernel dev option changes ro.build.fingerprint
When someone uses the 16kb dev option, they switch
out the kernel, but the same build is used. Make
sure this is visible in the fingerprint to help
split up any analytics or reports.

Bug: 332406754
Test: no change on normal device, on 16k dev option device:

:) adb shell getprop ro.product.build.16k_page.enabled
true
:) adb shell getconf PAGE_SIZE
16384
:) adb shell getprop ro.build.fingerprint
generic/aosp_cf_x86_64_phone_pgagnostic_16kb/vsoc_x86_64_pgagnostic:VanillaIceCream/MAIN.b7aab5e4/eng.smorel.20240514.203625:userdebug/test-keys
                                       ^^^^^^
             ----------------------------/

cheers

Change-Id: I9632237cef4a3b077761022eda8cf42784a41753
2024-05-15 20:18:51 +00:00
Florian Mayer
53748d08e5 Merge "Prevent mte_upgrade_test from hanging if MTE is disabled" into main 2024-05-15 17:48:31 +00:00
Florian Mayer
6726655b5c Merge "Fix mte_upgrade_test" into main 2024-05-15 16:49:25 +00:00
Florian Mayer
1277bd4dfd Prevent mte_upgrade_test from hanging if MTE is disabled
Turns out we didn't need the syscall because the kernel checks
for async MTE fault on exit.

Test: atest mte_upgrade_test with and without MTE
Change-Id: Iebdf181d67b4586926499c7549c72e73efc13c56
2024-05-15 16:04:43 +00:00
Florian Mayer
b3c145e0f7 Fix mte_upgrade_test
init ignored the rc file because of incorrect permissions
also replace deprecated "push" with "push-file"

Test: atest mte_upgrade_test
Bug: 335232356
Change-Id: I4c17311dbb1d001567f4cdda65036f16aec2b5c1
2024-05-14 17:38:51 -07:00
Florian Mayer
0b36b59e45 Create OWNERS for test_upgrade_mte
Change-Id: I0dd6bccf9f6a1767f11fd3e687d819eceaab7b5e
2024-05-14 19:43:07 +00:00
Treehugger Robot
babf597508 Merge "Use no_full_install: true instead of installable: false" into main 2024-05-04 00:04:03 +00:00
Nate Myren
31b1582797 Merge "Revert "Only write appcompat properties if flag is defined"" into main 2024-05-02 19:49:45 +00:00
Nate Myren
6d8304aa46 Revert "Only write appcompat properties if flag is defined"
Revert submission 3049635-cherrypicker-L52500030003287943:N44300030053199935

Reason for revert: b/338244859
Bug: 338244859

Reverted changes: /q/submissionid:3049635-cherrypicker-L52500030003287943:N44300030053199935

Change-Id: I4b99429ce5df0af30e6ad99d3463d4dc2c96c012
2024-05-01 19:21:49 +00:00
Jiyong Park
b33025849d Use no_full_install: true instead of installable: false
So far, we have used `instalable: false` to avoid collision with the
other modules that are installed to the same path. A typical example was
<foo> and <foo>.microdroid. The latter is a modified version of the
former for the inclusion of the microdroid image. They however both have
the same instalation path (ex: system/bin) and stem (ex: foo) so that we
can reference them using the same path regardless of whether we are in
Android or microdroid.

However, the use of `installable: false` for the purpose is actually
incorrect, because `installable: false` also means, obviously, "this
module shouldn't be installed". The only reason this incorrect way has
worked is simply because packaging modules (ex: android_filesystem)
didn't respect the property when gathering the modules.

As packaging modules are now fixed to respect `installable: false`, we
need a correct way of avoiding the collision. `no_full_install: true` is
it.

If a module has this property set to true, it is never installed to the
full instal path like out/target/product/<partition>/... It can be
installed only via packaging modules.

Bug: 338160898
Test: m
Change-Id: I37380c19232f2c497bdf492a83cdc16616f0ae8d
2024-05-01 20:59:19 +09:00
Elliott Hughes
c9d44b84fe Don't reject "ctl.stop.*" during shutdown.
We're shutting down anyway, so the service is either dead already
or about to be killed, and callers get upset (and don't have a good
response themselves) if we reject the request.

This was seen by a partner where adbd was asked to stop during
shutdown.

Bug: https://issuetracker.google.com/336223505
Change-Id: If09feeef2e0f2d1be9ff84a88cca6ed593a35362
2024-04-30 20:20:43 +00:00
Florian Mayer
67027efd06 Merge "[MTE] disable memtag stack in early init" into main 2024-04-29 20:58:05 +00:00
Florian Mayer
c2eaac5ed2 [MTE] disable memtag stack in early init
when introducing instrumentation for MTE stack history buffer, we cannot
use stack MTE in early init

Bug: 309446520
Change-Id: I0921ae4ffe03ed971697f8daff4215c9b3772e35
2024-04-26 17:25:05 -07:00
Treehugger Robot
6f5205229b Merge "ueventd: Add devname sys_name to subsystem, pulling device names from sysfs" into main 2024-04-25 19:39:02 +00:00
A. Cody Schuffelen
b479666e3c ueventd: Add devname sys_name to subsystem, pulling device names from sysfs
This change introduces a new mode to `subsystem.devname` in `ueventd.rc`
configuration files, which sets the file name to the contents of
`/sys/DEVNAME/name`.

The objective of this change is to help Cuttlefish distinguish between
console devices, which are only different in uevents by initialization
order. Cuttlefish currently relies on `/dev/hvc##` devices which are
created for non-multiport virtio-console devices.

https://cs.android.com/android/platform/superproject/main/+/main:device/google/cuttlefish/shared/config/ueventd.rc;l=18;drc=5204f119d859d3ae5f1a2ee1c6a05ee68d6a28ed

On Cuttlefish we're considering moving to multiport virtio-console
devices ( https://fedoraproject.org/wiki/Features/VirtioSerial ). It
would be possible to rely on device order here as well, but using names
to distinguish devices makes it possible to drop unused devices in the
future, rather than reserving indexes indefinitely.

Multiport virtio-console devices create uevents with DEVNAME=vport#p#
and DEVPATH=.../vport#p#, only exposing the name in a sysfs file.

Bug: 336663898
Test: Attach multiport console, run with `-DLOG_UEVENTS=1`
Test: Introduce ueventd policy using `devname sys_name`
Change-Id: I59632b556db4a47883eab97e90c0e6ca81a9c650
2024-04-25 11:10:11 -07:00
Treehugger Robot
b46dcf4fcb Merge "Only write appcompat properties if flag is defined" into main 2024-04-24 22:35:37 +00:00
Treehugger Robot
f0db2406f7 Merge "Null terminate the std::array given to execve" into main 2024-04-20 02:41:34 +00:00
Jiyong Park
e873e1d31b Null terminate the std::array given to execve
std::array<T, N> takes exactly N * sizeof(T) bytes, leaving no room for
the null terminator.

Bug: 335047945
Test: re-run the GSI test
Change-Id: Ic3aca5f409021c78a7eb965c5ed610e6a51e42cb
2024-04-20 10:11:46 +09:00
Nate Myren
32677ae8f3 Only write appcompat properties if flag is defined
Only writes the appcompat properties if the
WRITE_APPCOMPAT_OVERRIDE_SYSTEM_PROPERTIES cflag is defined

Fixes: 331307495
Test: manual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f04f6bae4314e01111045ba231010ba7067477a0)
Merged-In: Ie99b5027a9704c0f4f7fe4d3a6a6cf49f4bb8176
Change-Id: Ie99b5027a9704c0f4f7fe4d3a6a6cf49f4bb8176
2024-04-19 19:07:52 +00:00
Jiyong Park
12c64a7586 Don't install Android-only dependencies to microdroid
init_second_stage_defaults provides properties that are common to both
Android's init and Microdroid's init. Before this CL, it included
target.product.required and target.recovery.required properties. The
required dependencies were Android-specific; the dependencies included
Android-only init.rc. Microdroid has its own init.rc (microdroid_init_rc
module).

This was problematic but so far it didn't cause an issue because those
Android-only dependencies were not installed to Microdroid due to a bug
in the build system.

As we fix the build system bug, the Android-only dependencies started
get installed to Microdroid, effectively overriding the Microdroid-only
init.rc file. This made Microdroid fail to boot.

Fixing this issue by moving the Android-only dependencies out of the
defaults module and putting them on the Android's init.

In addition to that, this CL removes the recovery variant for the
Microdroid's init because it's not used.

Bug: N/A
Test: run AVF tests
Change-Id: I09748f1123125cac74ce54fd5c360c9a3ba2f996
2024-04-17 14:36:55 +09:00
Shrinidhi Hegde
4922633d3f Merge "Throttle reboot from native watchdog" into main 2024-04-12 14:30:23 +00:00
Shrinidhi Hegde
ab9b683840 Throttle reboot from native watchdog
Found out that increasing the threshold to 20 crashes pushes the file
system based rollbacks as well. So introducing a throttling behaviour
instead. Now native watchdog performs reboot with ramdump at 5 restarts.
After that packageWatchdog/ RescueParty takes over to perform other
mitigations. Ram dump + reboot will not be performed more than once
in 24hrs.

Test: manual
Bug: 291137901
Change-Id: Ia192411dad94e8e25c26f700d2fe7f94d41439b8
2024-04-11 15:28:07 +00:00
Treehugger Robot
793679f47a Merge "skip nop persistent property writes" into main 2024-04-09 06:41:58 +00:00
Luca Stefani
3e4159a22e firmware_handler: Print full FW path before loading
As of now ueventd only prints the firmware name
requested by the uevent, but in case the device
has multiple firmware going by the same name it's
more interesting to know what file ends up actually
being used for the firmware request.

Test: m, check logcat
Change-Id: Ia90d387f09789d8e8b337a1a178144fad553d37b
2024-04-05 11:39:31 +02:00
Shrinidhi Hegde
09071c46d8 Merge "Revert "Update native watchdog to be triggered after 20 restarts instead of 4."" into main 2024-04-05 00:23:45 +00:00