Commit graph

3103 commits

Author SHA1 Message Date
Vincent Donnefort
79ac2ad6d4 Add ramdisk_node_list
This file contains a description of dev nodes added to the CPIO archive
for the Android ramdisks. /dev/null is a security requirement for
bionic, /dev/console is needed so the kernel can set-up stdout stderr
and stdin before running /init.

Bug: 254835242
Change-Id: I111e2db53fabd63d070b8e9ab9c52faebf484ab3
2023-01-24 18:36:43 +00:00
Eric Biggers
5265b8d425 Clean up references to FDE in documentation and comments
Bug: 208476087
Change-Id: I328026d68c9dd7a5042ef4b5369f34af93760b37
2023-01-18 02:17:43 +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
Carlos Galo
177f5b1822 Merge "Set memlock rlimit to 64KB" 2023-01-09 19:05:59 +00:00
Kalesh Singh
93e02c6da6 Merge "init: Take wakelock on zygote restart" 2023-01-09 17:55:09 +00:00
David Brazdil
468c62a037 Merge "Change permissions of /data/misc/virtualizationservice" 2023-01-06 16:13:32 +00:00
Jooyung Han
c7a6fe684c Revert "Migrate the blkio controller to the v2 cgroup hierarchy"
Revert submission 2218645-blkio-cgroup-v2

Reason for revert: 260143932, 264620181

Reverted changes: /q/submissionid:2218645-blkio-cgroup-v2

Change-Id: I8bf1592cd5f7234f28094fe80341c37d42fa609b
2023-01-06 06:20:54 +00:00
Bart Van Assche
5400ae2440 Migrate the blkio controller to the v2 cgroup hierarchy
There are multiple use cases in Android for which background writes need
to be controlled via the cgroup mechanism. The cgroup mechanism can only
control background writes if both the blkio and memcg controllers are
mounted in the v2 cgroup hierarchy. Hence this patch that migrates the
blkio controller from the v1 to the v2 cgroup hierarchy.

This patch increases the TOTAL_BOOT_TIME for devices with a 4.19 kernel
(redfin) from 18.9 s to 20 s. This patch does not affect the boot time
for devices with a 5.10 or 5.15 kernel.

This patch increases the time spent in CgroupMap::ActivateControllers()
by 25 microseconds in Cuttlefish on an x86-64 CPU.
CgroupMap::ActivateControllers() is called by Service::Start().

Bug: 213617178
Test: Cuttlefish and various phones
Change-Id: I490740e1c9ee4f7bb5bb7afba721a083f952c8f2
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-01-05 13:07:00 -08:00
David Brazdil
bc491e2544 Change permissions of /data/misc/virtualizationservice
The folder is used for temporary files of virtualizationservice, with
a subfolder for each running VM. This wil continue to be the case but
each subfolder will be populated by a different instance of virtmgr,
running under the UID of the client (as opposed to system UID of
virtualizationservice).

To this end, change the permission mask of the root folder from 0770 to
0775. This gives non-system UIDs the permission to search the root
folder. This is necessary for the clients to be able to search their
own subfolder. It does not give them permission to read other
subfolders as those will be owned by different client UIDs.

Bug: 245727626
Test: atest -p packages/modules/Virtualization:avf-presubmit
Change-Id: Ie6e3be601ccb3b385f70bcf5b31bf8fff3aff8bc
2023-01-05 18:10:20 +00:00
Carlos Galo
1447120f78 Set memlock rlimit to 64KB
Defaulting Android to limit memlock to 64KB. This will help preventing
pages from being swapped until the app is killed it's memory will stay
resident. CTS test is enforced only in U+ devies.

Bug: 201797650
Test: Added new test to verify we are memlock at or under 64KB
Change-Id: I5a9e9da12f6df5a056ee47d0593c13e9c779e054
2023-01-05 16:29:59 +00:00
Nikita Ioffe
b728ecda2c boringssl self tests: explicitly specify empty capabilities
If a service doesn't specify any capabilities in it's definition in the
.rc file, then it will inherit all the capabilities from the init.
Although whether a process can use capabilities is actually controlled
by selinux (so inheriting all the init capabilities is not actually a
security vulnerability), it's better for defense-in-depth and just
bookkeeping to explicitly specify that boringssl_self_test doesn't need
any capabilities

The list of capabilities was obtained via:
```
$ adb pull /sys/fs/selinux/policy /tmp/selinux.policy
$ sesearch --allow -s boringssl_self_test -c capability,capability2 /tmp/selinux.policy
```

Bug: 249796710
Test: device boots
Test: presubmit
Change-Id: I866222e2325e59d7e39d00db59df7b83efc657d9
2023-01-03 16:36:30 +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
Kalesh Singh
2255e8ed77 init: Take wakelock on zygote restart
If the framework is restarting (and cannot yet aquire
wakelocks to block suspend). Take a kernel wakelock
to allow the system to make sufficient progress before
autosuspend can be triggered.

The wakelock is later disable when the framework has
and invokeds enableAutosuspend() on the suspend service.

Bug: 255898234
Test: adb shell "echo mem > /sys/power/state && killall system_server"
Change-Id: Id8cff6564ef05d8c22a8264c51dd313263cb6a9d
2022-12-14 11:25:01 -08: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
Sanjana Sunil
aeee1c6231 Merge "Create misc_ce and misc_de mirror storage" 2022-12-08 18:09:11 +00:00
Kiyoung Kim
5bc57325fb Merge "Remove LLNDK libraries from system required" 2022-12-06 00:48:15 +00:00
Daeho Jeong
2accf5bd79 set iostat_period_ms to 1 sec
Current period of this is 3 sec and it is used when Perfetto profiling is running on Android. Without Perfetto profiling, it doesn't affect the system at all. However, 3 sec doesn't provide enough granularity to understand F2FS I/O behaviors. To make F2FS I/O profiling ftrace effective, set the ftrace period to 1 sec.

Test: check f2fs iostat_period_ms sysfs node value
Change-Id: I2d418795613dfbd1aea6c4f13c9a39af3deb1c4d
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2022-12-01 22:27:09 +00:00
Kiyoung Kim
62a307ab61 Remove LLNDK libraries from system required
Remove LLNDK libraries from system required libs as those libraries will
be appended to the configuration from the build.

Bug: 251782700
Test: Cuttlefish build and boot succeeded
Change-Id: I81d508a5e15a9dd1919935f07569271609738710
2022-12-01 11:36:45 +09:00
Sanjana Sunil
5c7ff8841a Create misc_ce and misc_de mirror storage
Create a mirror directory for misc_ce and misc_de storage by bind
mounting the respective directories. This is done for the defaul null
volume only, and other volumes are handled at a later staged.

When an SDK sandbox process is spawned and data isolation needs to
occur, the sdksandbox directories present in the misc directories will
be used to bind mount from, after tmpfs is mounted on the original.

Bug: 214241165
Test: atest SdkSandboxStorageHostTest

Change-Id: Icb1dc7d7fbd53a5c3853acf2f9d4d75b278d7295
Merged-In: Icb1dc7d7fbd53a5c3853acf2f9d4d75b278d7295
2022-11-14 14:57:35 +00:00
Jooyung Han
d9d3a5cb2b Merge "Revert "add apex-ready event after post-fs-data"" 2022-11-14 06:51:14 +00:00
Victor Chang
f6a35e2c5f Merge "Revert "Add ::1 to localhost in etc/hosts"" 2022-11-11 15:36:13 +00:00
Victor Chang
1498382581 Revert "Add ::1 to localhost in etc/hosts"
Revert submission 2291455-localhost_v6

Reason for revert: b/258627476
Reverted Changes:
Icd11fab47:[Test] Update test to comply with etc/hosts change...
Ibcee52a14:Add ::1 to localhost in etc/hosts

Bug: 258627476
Change-Id: I42c8b0aebdbd8b73a90606c0a999f25d8d071cd1
2022-11-11 12:26:49 +00:00
Ken Chen
f7a95c879e Merge "Add ::1 to localhost in etc/hosts" 2022-11-10 08:19:07 +00:00
Ken Chen
7e6f2a44db Add ::1 to localhost in etc/hosts
::1 is IPv6 loopback address.

Bug: 256507503
Test: $ adb shell /data/dnschk localhost
      # localhost (via nethandle 0):
      127.0.0.1
      ::1
Change-Id: Ibcee52a14143856db50fca301c48ea9e2591914b
2022-11-09 17:05:35 +08:00
Jooyung Han
8fbd79e689 Revert "add apex-ready event after post-fs-data"
This reverts commit 1eb3394e9c.

Reason for revert: b/244406239, we've migrated to a sysprop(apex.all.ready) instead of an event.

Change-Id: Iae54df241257e3a3dcad4e54fdbf9dd14e9814de
2022-11-09 07:55:58 +00:00
Remi NGUYEN VAN
20edb70280 Merge "Add libconnectivity_native" 2022-11-07 02:07:45 +00:00
chenyc5
7e357eb731 Make bpf_attach_tracepoint() available as soon as possible
The "sys.init.perf_lsm_hooks" is set on TestPerEventSelinux and it
is before early-init, but it need trigger by queue_property_triggers
and it is after late-init (zygote start on late-init).
The property is ready on load_bpf_programs, make sure
bpf_attach_tracepoint() is available on zygote start.

Bug: 257102190
Test: cat /sys/fs/bpf/map_time_in_state_uid_time_in_state_map
Change-Id: I5aa102df54b82e1584882800e93efd06ccf61c16
2022-11-03 10:21:45 +08:00
Eric Biggers
745111fbec Merge "Remove unneeded 'slave' flag for /data_mirror/data_ce/null" 2022-10-27 19:17:09 +00:00
Eric Biggers
28a1969ebf Remove unneeded 'slave' flag for /data_mirror/data_ce/null
Remove the 'slave' mount flag that was added by commit ef9275223c
(https://r.android.com/2095463) because it doesn't actually do anything
in this context.  MS_SLAVE can only be used to change the propagation
type of an existing mount, and the kernel ignores it if MS_BIND is also
specified, due to the way the various high-level operations that the
mount() system call can do are prioritized.

The reason that the /data/user/0 mount gets propagated into /data_mirror
anyway is because the /data mount has the "shared" propagation type.  In
the above-mentioned commit I had assumed the default Linux mount
semantics, but actually Android applies the "shared" propagation type to
everything (see SetupMountNamespaces() in init/mount_namespace.cpp).

Test: Booted Cuttlefish and verified (via /proc/self/mountinfo) that
      /data/data is still bind-mounted to both /data/user/0 and
      /data_mirror/data_ce/null/0.
Bug: 156305599
BYPASS_INCLUSIVE_LANGUAGE_REASON=commit message mentioning removed code
Change-Id: Idc45d8dcb3a21d4e8e2e72f4d4dda7286f898127
2022-10-26 18:33:11 +00:00
Nathan Huckleberry
8f6fcd19af Fix flaky AVB test from late verity_update_state
CtsNativeVerifiedBootTestCases is currently flaky due to race conditions
between verity_update_state and the test running.

Moving the call to verity_update_state before zygote-start should fix
the test.

Bug: 253033920
Test: Boot Android and check that partitions.system.verified.hash_alg
    has a non-empty value
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Change-Id: I9d252b0b6d74ed784ec2ffe091de2db53c5f45ba
2022-10-25 21:12:43 +00:00
Jooyung Han
b08709fa63 Add libconnectivity_native
The library provides an interface to interface with the
ConnectivityNative service, and implement port blocking APIs.

Bug: 179733303
Test: atest connectivity_native_test
Change-Id: I86018bfeb60d031faee818e5df469f02ebe32707
2022-10-13 12:47:16 +09:00
Ludvig Hansson
f2435108ce wear: add libicu to list of public libraries
Bug: 250668939
Test: atest CtsIcu4cTestCases:Icu4cGTests

Change-Id: I3348171dbbe5c22f601427de763109e02bd7e913
2022-10-10 14:56:20 +00:00
Peter Collingbourne
9f7a19d0f3 Merge "Resync zygote64 and zygote64_32 rc files." 2022-09-30 18:56:35 +00:00
Peter Collingbourne
d77b91b4ba Resync zygote64 and zygote64_32 rc files.
I noticed that the zygote64 and zygote64_32 files
had gotten slightly out of sync as a result of change
I3aad4b4b1d2f54db9e7ba86db8a655d8552bad0a. Merge the zygote64_32 changes
into zygote64, and to prevent this from happening again, replace the
64-bit zygote declaration in zygote64_32 with an import from zygote64.

Change-Id: I7fcceeb22b722c2164b9acf0b517a32ce34731fd
2022-09-29 17:21:54 -07:00
Pete Bentley
751cdc9489 Merge "Add AID for PRNG seeder daemon." 2022-09-26 21:27:42 +00:00
Pete Bentley
6cb61610e6 Add AID for PRNG seeder daemon.
Also adjust permissions on /dev/hw_random to allow prng_seeder group
read access.

Manual testing protocol:
* Verify prng_seeder daemon is running and has the
  correct label and uid/gid.
* Verify prng_seeder socket present and has correct
  label and permissions
* Verify no SELinux denials
* strace a libcrypto process and verify it reads seeding
  data from prng_seeder (e.g. strace bssl rand -hex 1024)
* strace seeder daemon to observe incoming connections
  (e.g. strace -f -p `pgrep prng_seeder`)
* Kill daemon, observe that init restarts it
* strace again and observe clients now seed from new instance

Bug: 243933553
Test: Manual - see above
Change-Id: I4d526844b232fc2a1fa5ffd701ca5bc5c09e7e96
2022-09-26 17:50:09 +01:00
zhanglongxia
40e1666fb9 init.rc: create /data/misc/threadnetwork folder
This folder is used to store Thread network settings data files.

Bug: b/248145048
Test: /data/misc/threadnetwork is created.
Change-Id: I58eb3d814723c5f7acfbecef7f852d8e5336c975
2022-09-22 15:25:39 +08:00
Jooyung Han
9561496303 Prepare /data/property before load_persist_props
Without the directory (this happens on the very first boot),
load_persist_props can't create an initial version of
/data/property/persistent_properties (probably empty). This leads to
persisting all in-memory "persist.*" properties later when a persistent
property is set. This is regression from Android S because persistent
props from, for example, build.prop will be persisted even when there's
no process to explicitly setprop.

Bug: 242264580
Test: launch cuttlefish and verify that there's no props from build.prop
Change-Id: I5819a97750e4d5d1ee5a7c308bf944c7aeab2f90
2022-08-18 10:03:02 +09:00
Christopher Ferris
e6c462d209 Merge "Revert "Add support for only starting 64 bit zygote."" am: 86cc51ae60
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2155013

Change-Id: Ic0251c315a947f5f810fe38c84650a528f892ab4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-15 00:34:51 +00:00
Christopher Ferris
86cc51ae60 Merge "Revert "Add support for only starting 64 bit zygote."" 2022-07-15 00:24:10 +00:00
Christopher Ferris
3fa3f861d4 Revert "Add support for only starting 64 bit zygote."
This reverts commit da94c7f650.

Reason for revert: It appears this change slows down boot on normal devices.

Technically, this change is not necessary, but it prevents starting the secondary and having it throw an error in the only run 64 bit zygote config. But it's easier to throw the error than slow down boot up.

Bug: 238971179

Test: Verified that on a 64 with 32 config, the secondary zygote
Test: starts but exits.
Change-Id: I7ab0496a402db83e70168d52e5d5911b82a3b06a
2022-07-14 22:13:29 +00:00
Elliott Hughes
594a67ce35 Merge "Add support for only starting 64 bit zygote." am: 1012626192
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2061509

Change-Id: I16d2104ef124cd3bee86923f36c80352117ff69f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-13 20:19:00 +00:00
Elliott Hughes
1012626192 Merge "Add support for only starting 64 bit zygote." 2022-07-13 19:57:47 +00:00
Pete Bentley
4e245edf96 Merge "Move boringssl self tests from early-init to init." am: 00bf9dcb01
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2148027

Change-Id: Icc07f5446583b26b15b43092762f4f38ecfe09d0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-12 10:31:09 +00:00
Pete Bentley
c017e2ce0a Move boringssl self tests from early-init to init.
In previous releases, these self tests had a secondary purpose
of writing a flag file to save future processes from running
some slow self checks.  This is no longer true in T.

However running the tests from early-init has caused issues
on some devices as the kernel's entropy pool is not yet
initialised, causing the process to block for a second or more.

Bug: 231946889
Test: m && flashall
Change-Id: I2116f2029ca6a21e4359407dfff4dc79edd39084
2022-07-07 15:34:46 +01:00
Xin Li
ebe6598a1c Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: Ia927c19f544536f78c20ccef5830bd1be0cebf9b
Change-Id: I0267b9eaad470a56db68f3a0b99abfc41192c6d7
2022-06-28 21:23:43 +00:00
Almaz Mingaleev
2f38c39169 Do not create /data/misc/zoneinfo.
APK time zone update mechanism used to store tzdata file there.
The feature is removed, no need to create that folder.

Bug: 148144561
Test: atest CtsBionicTestCases
Test: atest BionicTzdbConsistencyTest

Change-Id: I249f1d1b6c1a3f1a283d1ca43fcc93b10cbd910a
2022-06-23 17:21:39 +01:00
Almaz Mingaleev
7f79ee42ee Merge "Remove TZUvA feature." 2022-06-23 07:47:26 +00:00
Treehugger Robot
247a07b481 Merge "charge the permissions for the proc/bootconfig" am: 5683591ff9 am: b6ac0cc227
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2121492

Change-Id: I35510e58ec908d42cab162c3e5544fdbbc0eea7b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-13 21:32:17 +00:00
zexin.hou
46314853fe charge the permissions for the proc/bootconfig
The current/proc/bootconfig node is the root user group,but some Android modules of our company do not have permission to access the root user group node. We want to add the same permissions to /proc/cmdline for the proc/bootconfig node in init.rc

Change-Id: I98f63a09cf7306be65c40674b1b28f1153c705fb
2022-06-13 12:42:47 +00:00