Commit graph

3669 commits

Author SHA1 Message Date
Treehugger Robot
d0a4e710e9 Merge "Remove references to nonplat sepolicy" 2021-11-05 17:29:55 +00:00
Jeff Vander Stoep
5effda49e1 Remove references to nonplat sepolicy
"nonplat" was renamed to "vendor" in Android Pie, but was retained
here for Treble compatibility.

We're now outside of the compatbility window for these devices so
it can safely be removed.

While I'm here, improve accuracy of some comments and
in-code-documentation.

Test: build boot cuttlefish device. adb remount, modify
/system/etc/selinux/plat_sepolicy_and_mapping.sha256 to force
on-device policy compilation. reboot. Verify that device boots
without new selinux denials.

Change-Id: Ibe5c5fa1ea206c1b4d5ad8183433c332a8aaadbf
2021-11-05 09:13:26 +01:00
Tianjie Xu
f1c8904e95 Merge "Fix unittest that checks build id" 2021-10-29 22:15:35 +00:00
Tianjie
c8cf2a4155 Fix unittest that checks build id
Should check ro.build.id instead of the ro.boot.build.id. The former
is a component of the build fingerprint.

Bug: 204507710
Test: run CtsInitTestCases
Change-Id: Iee13b30b195685c2461255f946685a288f352e06
2021-10-28 21:51:43 -07:00
Bowgo Tsai
5998c74d7a Sets 'verity_update_state' in init.rc
This is required since Android 12, because
CtsNativeVerifiedBootTestCases will read property
"partition.${partition}.verified.hash_alg" to
check that sha1 is not used.

Also see https://r.android.com/1546980 for more details.

Bug: 175236047
Bug: 203720638
Test: build and boot a device
Change-Id: I300265f4af9c2781d40537f391bda9eaf62c27ba
2021-10-21 21:38:22 +08:00
Justin Yun
4446a85dc5 Fix the vendor api level
ro.vendor.api_level must be the minimum of ro.product.first_api_level
and ro.board.(first_)api_level.

Bug: 202919753
Test: getprop ro.vendor.api_level
Change-Id: Ie70dd64b21c01ed8cd5e43b01095e1e0d8ff4444
2021-10-14 12:16:27 +09:00
Ray Essick
35ffd69db5 Versioning for apex init.rc files
Support an "init.#rc" versioning scheme for apex init files.
chooses highest # <= current system sdk.
".rc" (aka the old init.rc) is treated as sdk 0
Document these semantics in README.md

Bug: 198186200
Test: booting, lots of logcat output
Change-Id: I2d0405be73dae9bafa6f22535b29ed6b053ddbc4
2021-10-11 19:02:47 -07:00
Treehugger Robot
30b3cb13c1 Merge "init: introduce ro.kernel.version property" am: 939353e1e3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1840075

Change-Id: I0f2dd754e0deb081550b86497bca58888dc53fa0
2021-10-01 18:24:39 +00:00
Treehugger Robot
939353e1e3 Merge "init: introduce ro.kernel.version property" 2021-10-01 18:14:34 +00:00
Alexander Potapenko
1e966fa9f1 init: introduce ro.kernel.version property
This property will hold the major.minor part of the kernel version (e.g. "5.4"), allowing init scripts to act depending on that version, enabling and disabling certain features.

Bug: 194156700
Change-Id: Icec640b8a7150b344d9aa3bc0bdbcdae050c7c45
Test: manual on a Pixel device
Signed-off-by: Alexander Potapenko <glider@google.com>
2021-10-01 16:06:02 +00:00
Treehugger Robot
69a9fb4922 Merge "Define ro.vendor.api_level" am: 0a671e24f5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1839954

Change-Id: Ic9f2dced1b547ec2f83c5fd8c791193781473961
2021-10-01 03:32:50 +00:00
Treehugger Robot
0a671e24f5 Merge "Define ro.vendor.api_level" 2021-10-01 02:46:09 +00:00
Treehugger Robot
2d046219ee Merge changes Ie5e47d84,I3c5c9917,Ife48b163 am: 9f2c62481f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1838534

Change-Id: I91df1e384d10566dc9fb31220681719bbfc240a9
2021-09-29 23:30:23 +00:00
Jiyong Park
3b3d87de79 Don't create vendor_init in microdroid
vendor_init is a subcontext of init which is responsible for handling
the vendor-defined services and vendor-defined actions. This is mainly
to enforce the Treble architecture in which the vendor components are
provided with a less-privileged context than the system components
because they are less-trusted.

However, in case of microdroid, both the system and the vendor
partitions are from the same entity. As VMs don't have direct access to
any of the underlying hardware, the vendor partition is targeting the
virtual platform, not the real hw platform. There really is no need for
the discrimination.

This CL disables the creation of the vendor_init subcontext when init
runs in microdroid.

Bug: 201363575
Test: atest MicrodroidHostTestCases
Change-Id: Ie5e47d84e9e245565239b4f2159e8182b457699d
2021-09-29 21:35:08 +09:00
Nikita Ioffe
0a0e4793e3 Only run RebootTest under root
This test requires running test services, which causes test to crash
(and still incorrectly be reported as passing) when running on
non-rooted device.

Ignore-AOSP-First: reboot_test is not in AOSP yet
Bug: 190958734
Test: atest CtsInitTestCases
Merged-In: I3c5c9917d0a787d66272ccf4aefc57e6573841bc
Change-Id: I3c5c9917d0a787d66272ccf4aefc57e6573841bc
2021-09-29 21:34:59 +09:00
Nikita Ioffe
86b4324a0a Add reboot_test
This test spawns several services backed by /system/bin/yes executable,
and then stops them either while SIGTERM or SIGKILL.

Ideally we want to unit test more of reboot logic, but that requires a
bigger refactoring.

Test: atest CtsInitTestCases
Bug: 170315126
Bug: 174335499
Merged-In: Ife48b1636c6ca2d0aac73f4eb6f4737343a88e7a
Change-Id: Ife48b1636c6ca2d0aac73f4eb6f4737343a88e7a
2021-09-29 20:09:18 +09:00
Justin Yun
dfbdd93336 Define ro.vendor.api_level
ro.vendor.api_level will have the api_level that the vendor images
are required to implement based on the various api level properties.
ro.board.api_level and ro.board.first_api_level explicitly states
the api level of the vendor images for grf.
If these properties are not provided, it reads the device's launching
api level.
The rest of the properties may show the implemented api level of the
vendor images.

Bug: 200258600
Test: getprop ro.vendor.api_level
Change-Id: Id4131b53d6db00d5bbef3b048384d33c1736d681
2021-09-29 15:37:27 +09:00
Yi-Yo Chiang
aff8d4b02c Merge "init_first_stage: Remove unused srcs & static libs" am: 15ae358c71
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1838538

Change-Id: I73b198ae080e3aa1aa35d6471905bcf8902653c7
2021-09-29 04:10:36 +00:00
Yi-Yo Chiang
bc35e823e9 init_first_stage: Remove unused srcs & static libs
Test: Build pass
Change-Id: Id79ad1cf1e66c34c9ef24776c417f40286941bc7
2021-09-28 20:22:45 +08:00
Yi-Yo Chiang
623fb83cb2 Merge "Reland: Add /system_ext/etc/selinux/ to the debug policy search path for GSI" am: 711b56e2a0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1834756

Change-Id: I6f9544179fea2a9685d13f067df58ad2046d1acb
2021-09-24 03:25:31 +00:00
Yi-Yo Chiang
bb77c544e5 Reland: Add /system_ext/etc/selinux/ to the debug policy search path for GSI
This change only *adds* /system_ext/etc/selinux to the debug policy
search path, and does not change any preconditions to load the debug
policy. The device still needs to be bootloader-unlocked and has the
debug ramdisk flashed to be able to use the debug policy. The only thing
changed is that now the debug policy can be loaded from /system_ext or
/debug_ramdisk when system partition is compliance testing GSI.

The debug policy in the boot ramdisk may be outdated if the system
partition is flashed with a image built from a different revision.
This happens frequently when running the compliance testing VTS, where
the device is flashed with (A) GSI and (B) device vendor image & debug
boot image, and (A) and (B) are built from different git revisions.

To address this, we install a copy of the debug policy under
/system_ext, so that the version desync between (A) & (B) wouldn't be a
problem anymore because (A) no longer relies on the debug policy file
from (B).

Bug: 188067818
Test: Flash RQ2A.201207.001 bramble-user with debug ramdisk & flash
  gsi_arm64-user from master, device can boot and `adb root` works
Change-Id: Ibe17eb1ecb0e813309c9596d1f152b7455686b26
2021-09-23 14:26:27 +00:00
Santiago Seifert
f60946a242 Merge "Revert "Add /system_ext/etc/selinux/ to the debug policy search ..."" am: 2b324f5642
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1834618

Change-Id: I8b3e938430736bbe1a42c173d167d66c397f88de
2021-09-23 13:33:47 +00:00
Santiago Seifert
be09a1e643 Revert "Add /system_ext/etc/selinux/ to the debug policy search ..."
Revert "Add a copy of debug policy to GSI system image"

Revert "Add PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT"

Revert "Add system_ext_userdebug_plat_sepolicy.cil for GSI"

Revert submission 1824717-gsi_debug_policy

Reason for revert: Breaks the build (see b/200933187).
Reverted Changes:
I37ef02628:Add a copy of debug policy to GSI system image
I9c3dad8bb:Add PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT
I43adc6ada:Add system_ext_userdebug_plat_sepolicy.cil for GSI...
I4d6235c73:Add /system_ext/etc/selinux/ to the debug policy s...

Change-Id: I2eb3b00abb981c25514b75b2e7b4b7b203653390
2021-09-23 13:07:25 +00:00
Yi-Yo Chiang
1e27e4b5da Merge "Add /system_ext/etc/selinux/ to the debug policy search path for GSI" am: d7f8cf483b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1824634

Change-Id: I6107412518294026723339a5de215593c1e6a1e7
2021-09-23 10:15:17 +00:00
Yi-Yo Chiang
650b29d234 Add /system_ext/etc/selinux/ to the debug policy search path for GSI
This change only *adds* /system_ext/etc/selinux to the debug policy
search path, and does not change any preconditions to load the debug
policy. The device still needs to be bootloader-unlocked and has the
debug ramdisk flashed to be able to use the debug policy. The only thing
changed is that now the debug policy can be loaded from /system_ext or
/debug_ramdisk when system partition is compliance testing GSI.

The debug policy in the boot ramdisk may be outdated if the system
partition is flashed with a image built from a different revision.
This happens frequently when running the compliance testing VTS, where
the device is flashed with (A) GSI and (B) device vendor image & debug
boot image, and (A) and (B) are built from different git revisions.

To address this, we install a copy of the debug policy under
/system_ext, so that the version desync between (A) & (B) wouldn't be a
problem anymore because (A) no longer relies on the debug policy file
from (B).

Bug: 188067818
Test: Flash RQ2A.201207.001 bramble-user with debug ramdisk & flash
  gsi_arm64-user from master, device can boot and `adb root` works
Change-Id: I4d6235c73472e4d97619b2230292e6a0bc4b3e05
2021-09-18 20:21:25 +08:00
Treehugger Robot
c04e5ea14d Merge "doc: verity_update_state has no args" am: 4759545abb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1821977

Change-Id: I5766c3007cebf1f4263f1426dbeeed0644bd3ca3
2021-09-09 09:18:53 +00:00
Jooyung Han
f0e03fdac3 doc: verity_update_state has no args
`verity_update_state` command doesn't have a <mount-point> arg.

Bug: n/a
Test: n/a (documentation updated)
Change-Id: I6a807f8cce05c8669e85fe5cea935fbd668aa678
2021-09-09 15:46:41 +09:00
Tianjie Xu
7cb8e25a9f Merge "Dump the root digest of hashtree for dm-verity partitions" am: 055abbb4d6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1814305

Change-Id: I7b7895da336fb2389d243d5d67c7ea5a19d0731f
2021-09-01 17:59:04 +00:00
Tianjie
10bec65ca8 Dump the root digest of hashtree for dm-verity partitions
It's requested by the partner engineering team to uniquely
identify a partition.

Bug: 197973981
Test: boot the device and check props
Change-Id: I0f7aa34dd0087f0698fe90b9df6c0eae06fc4f5d
2021-08-30 17:11:02 -07:00
David Anderson
55b5360a6b Merge "first_stage_init: Add SIGCHLD handler in first_stage_console" am: ce8aa990d5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1807489

Change-Id: Ie7a6e0d1c341e7cf67c12f8fdef693ce49f743af
2021-08-25 02:46:35 +00:00
David Anderson
ce8aa990d5 Merge "first_stage_init: Add SIGCHLD handler in first_stage_console" 2021-08-25 02:33:59 +00:00
Elliot Berman
6eb234017a first_stage_init: Add SIGCHLD handler in first_stage_console
Add a simple SIGCHLD handler to reap zombie processes given to init.

Bug: 197662257
Change-Id: I6e7930cfd7c311c454b361b9a541369ece2eb744
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2021-08-24 17:20:02 -07:00
Treehugger Robot
740824dfb3 Merge "Add MicrodroidHostTestCases to TEST_MAPPING" am: a896241e9b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1795367

Change-Id: I15ae1fd75576439e5bc7deab9b00e7596e15d11c
2021-08-20 00:28:15 +00:00
Inseob Kim
32c0ad4d33 Add MicrodroidHostTestCases to TEST_MAPPING
Microdroid shares init with its host, defined under system/core/init.
This change adds MicrodroidHostTestCases to TEST_MAPPING to ensure that
Microdroid tests can verify patches to init.

Test: presubmit
Change-Id: I55f7e3ffbaf3401d145afac5f7c53d83f69e6ba7
2021-08-19 02:50:49 +00:00
David Anderson
5392f87b72 Merge "Fix shutdown animation cannot be shown" am: 95983cbbb6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1795394

Change-Id: I5bf7c171fb96642943f9b550d87302e4147e7813
2021-08-18 17:45:58 +00:00
David Anderson
95983cbbb6 Merge "Fix shutdown animation cannot be shown" 2021-08-18 17:26:50 +00:00
Elliott Hughes
5153cdee39 Merge "Split up the system/core/ TEST_MAPPING." am: 0589b7eb94
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1797132

Change-Id: I49316e97d5997bf5a0e5f7932aa3f1016b4566e6
2021-08-18 16:41:35 +00:00
Elliott Hughes
0589b7eb94 Merge "Split up the system/core/ TEST_MAPPING." 2021-08-18 16:25:15 +00:00
Treehugger Robot
e7b9de02f6 Merge "init: python3." am: ba62af23b4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1798336

Change-Id: Ie9a09fae7183abb57f09a1b4467bc5d4bb2001d7
2021-08-18 00:15:21 +00:00
Treehugger Robot
ba62af23b4 Merge "init: python3." 2021-08-17 23:57:35 +00:00
Elliott Hughes
34b0cc11a8 init: python3.
I've actually left the two other scripts on python2, since they're not
used in the build, and I don't actually know whether anyone's still
using them manually. Leaving them on python2 should be a sign to future
maintainers (assuming they're far enough in the future) that maybe
no-one's using them and they can just be deleted instead.

Test: treehugger
Change-Id: I4d7dfdbf9f2a34ddd15cd4be077eeef2248cc596
2021-08-17 14:46:59 -07:00
Suren Baghdasaryan
5cdaecf693 init: Add extra_free_kbytes.sh script to adjust watermark_scale_factor am: 642048d969
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1780972

Change-Id: I0e818f411b580cbe37288f0fe9ac77c4e2f5d75a
2021-08-17 19:24:24 +00:00
Xin Li
b0356efd79 Merge "Merge sc-dev-plus-aosp-without-vendor@7634622" into stage-aosp-master 2021-08-17 18:14:27 +00:00
Suren Baghdasaryan
642048d969 init: Add extra_free_kbytes.sh script to adjust watermark_scale_factor
Android uses an out-of-tree /proc/sys/vm/extra_free_kbytes kernel knob
to increase low watermark. A similar /proc/sys/vm/watermark_scale_factor
knob supported in upstream kernel can be used for the same purpose.
The script implements conversion from desired extra_free_kbytes value
to watermark_scale_factor value and sets watermark_scale_factor according
to the value for extra_free_kbytes provided as a parameter.
Note that watermark_scale_factor affects high watermark differently
from extra_free_kbytes. While extra_free_kbytes increases low and high
watermarks by the same amount, watermark_scale_factor affects high
watermark 2x times. Therefore it is expected that replacing the usage
extra_free_kbytes with watermark_scale_factor will keep the same low
watermark but high watermark will be higher than before.

Usage:
    extra_free_kbytes.sh <extra_free_kbytes value>

Bug: 109664768
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Id8949be731da77be884cdeec3a765ea291dbc2f0
2021-08-17 17:02:18 +00:00
Elliott Hughes
22e082e87a Split up the system/core/ TEST_MAPPING.
A lot of things had moved out of system/core/ without their TEST_MAPPING
entries having gone with them, reducing the amount of presubmit coverage
for those things.

In order to reduce the likelihood of that happening again, I've pushed
all that remained in the system/core/ TEST_MAPPING down into the
individual subdirectories.

Test: treehugger
Change-Id: Ib75d65f9200fa64ae1552471da6fbe5b7023cf94
2021-08-16 16:37:10 -07:00
Hongguang Chen
f156552ef1 Merge "Add Quiescent Reboot Target" 2021-08-16 18:12:17 +00:00
zengshuchuan
21c97a5780 Fix shutdown animation cannot be shown
Don't start shutdown critical service or turn off
backlight, when ro.init.shutdown_animation=true

Bug: 196511757
Test: config ro.init.shutdown_animation=true and build
      shutdownanimation.zip to /system/media/
Signed-off-by: zengshuchuan <zengshuchuan@allwinnertech.com>
Change-Id: I5932b7281af630e80247048a70fe1b24f536d1d9
2021-08-13 17:34:39 +08:00
Shikha Malhotra
3779f10fee Merge "Move flattened APEX activation logic to apexd." am: f870b88e1b am: 60658140ec
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1782386

Change-Id: I619814df7b4251c4dea03209f17bee86fd10450d
2021-08-06 08:46:43 +00:00
Shikha Malhotra
f870b88e1b Merge "Move flattened APEX activation logic to apexd." 2021-08-06 08:15:23 +00:00
Shikha Malhotra
720694dcca Move flattened APEX activation logic to apexd.
Also the check that linker configuration should not be updated if APEX
is in updatable state, is removed as now with refactoring of code and its
movement to apex project, that is also needed.

Resolves: https://b.corp.google.com/issues/192838499
Test: Run the AVD Device and check that it boots and run atest
ApexTestCases

Change-Id: I80a94fa0a4145d30546bb34a6d478a20a2881368
2021-08-05 19:57:21 +00:00