Commit graph

71821 commits

Author SHA1 Message Date
Max Bires
dfbb22c8e7 Merge "Client side implementation of Trusty IRPC HAL" into sc-dev 2021-07-08 03:00:24 +00:00
Suren Baghdasaryan
add9a25335 libprocessgroup: Remove unnecessary permissions change in uid/pid hierarchy
When a new process is launched it ensures that all files under its uid/
and uid/pid hierarchy are accessible by the user/group of that process.
If the directory already exists that means the access permissions have
been already set before, therefore we do not need to reset them again.
This also avoids a race between two processes in the same uid with one
process being launched and walking the uid/ directory while the other
process is being killed and changing the content of that directory. In
such a race the process walking uid/ might find the uid/pid directory of
the process being killed but by the time it tries to set its permissions
the directory might be removed because the process got killed. The
change eliminates the possibility of this race.

Bug: 192421915
Bug: 192512069
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I182298c36f6b0b4580ab59e440bd3aea16f5fbfe
2021-07-07 19:42:03 +00:00
Max Bires
5ac2c87c7a Client side implementation of Trusty IRPC HAL
This change includes the code necessary to communicate to the
IRemotelyProvisionedComponent backend implementation running in Trusty.
It also makes the relevant changes to the manifest XML file to add the
IRemotelyProvisionedComponent HAL.

Ignore-AOSP-First: Will cherry-pick to AOSP
Bug: 192228022
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I32c30ce2dc44e95ff91574ce405f10e3b5dc9699
2021-07-07 07:15:17 +00:00
TreeHugger Robot
9c62cdf3ac Merge "Revert "Completely migrate init first stage to Soong"" into sc-dev 2021-07-07 03:02:01 +00:00
David Anderson
d308a5ab84 Merge "libsnapshot: Add a source build fingerprint to the update state." into sc-dev 2021-07-02 18:26:35 +00:00
Li Li
cc25244b77 libprocessgroup: Do not remove uid cgroups directory
In some rare cases, race happens between 2 processes in the same uid.

1. Process A is dying
2. system_server calls RemoveProcessGroup() for A
3. Zygote forks Process B with the same uid of A
4. system_server calls MkdirAndChown(uid) for B
5. system_server calls MkdirAndChown(uid, pid) for B

As 2 & 4/5 belong to different threads, 2 might happens before or after
step 4/5, or even in the middle of 4/5. In such a case, 4 or 5 will
fail, leaving process B in wrong (Zygote) group.

The uid dir is only created when the corresponding apps have been
launched at least once. It's reasonable to assume one of them is going
to be launched again. Deleting and recreating the uid dir just slows
down applaunch.

Introducing a new lock in libprocessgroup can also solve the race issue.
But that will slow down the applaunch further.

Therefore, reusing the uid dir is an optimized way to solve the race.

Ignore-AOSP-First: Freezer is not a public feature yet

Bug: 192512069
Bug: 168907513
Test: Kill corresponding apps and check the uid cgroupfs dir
Change-Id: I2e91088f21f45e4eda6c709a4af65ace7e135801
2021-07-02 02:03:20 +00:00
TreeHugger Robot
a21c4c1a80 Merge "Forward HAT and ConfirmationToken to TA on finish." into sc-dev 2021-07-01 23:24:48 +00:00
David Anderson
e00a567047 libsnapshot: Add a source build fingerprint to the update state.
Bug: 188909957
Test: manual test
Change-Id: I9aa155eee25dd49f48baede4f0a2e4ab2ab76980
Merged-In: I9aa155eee25dd49f48baede4f0a2e4ab2ab76980
2021-07-01 15:43:53 -07:00
Nikita Ioffe
bfa4e30bf2 Merge "Only run RebootTest under root" into sc-dev 2021-07-01 22:25:24 +00:00
Janis Danisevskis
94c4e237e5 Forward HAT and ConfirmationToken to TA on finish.
The Trusty KeyMint HAL did not forward auth tokens and confirmation
tokens to the TA. This broke all per-op-bound key operations.

Ignore-AOSP-First: No mergepath from AOSP.
Test: CtsVerifier biometrics tests.
Bug: 192201272
Change-Id: Ifb2b08514acab78ff3d4fec4bc928260820d4ce0
2021-07-01 14:57:18 -07:00
Devin Moore
3cc7a0c5a6 Merge "Revert "Handle "hardware" bootconfig parameter as "androidboot.hardware""" into sc-dev 2021-07-01 21:55:10 +00:00
Inseob Kim
651db0935d Revert "Completely migrate init first stage to Soong"
Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Update init_first_stage"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add BOARD_BUILD_SYSTEM_ROOT_IMAGE to config vars"

Revert "Add install_in_root to cc_binary"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert submission 15071196-init_first_stage_soong

Reason for revert: fixes b/192248690
Reverted Changes:
I23cf4f975:Add ramdisk_available to init_first_stage's deps
Icd98c7e24:Add ramdisk_available to init_first_stage's deps
If9da9ba16:Add ramdisk_available to init_first_stage's deps
Ibc8668029:Add ramdisk_available to init_first_stage's deps
I3b4b8c475:Add ramdisk_available to init_first_stage's deps
I59cd149e0:Completely migrate init first stage to Soong
I36d789578:Add ramdisk_available to init_first_stage's deps
I2a0daa612:Add BUILD_USES_RECOVERY_AS_BOOT to soong config
Ic76c325ce:Directly create ramdisk dirs in ramdisk image rule...
I4c5374deb:Add BOARD_BUILD_SYSTEM_ROOT_IMAGE to config vars
I8aab5faf3:Add ramdisk_available to init_first_stage's deps
I9d5a10661:Add ramdisk_available to init_first_stage's deps
Iaa2edeb4a:Add ramdisk_available to init_first_stage's deps
I7cb582ca0:Update init_first_stage
I06091d15e:Add ramdisk_available to init_first_stage's deps
I8bdb8dda3:Add ramdisk_available to init_first_stage's deps
I7436b8dd1:Add ramdisk_available to init_first_stage's deps
I39693fd86:Add ramdisk_available to init_first_stage's deps
I0a9ba90f0:Add ramdisk_available to init_first_stage's deps
Ib66b4c4ea:Add ramdisk_available to init_first_stage's deps
I31ce63d23:Add ramdisk_available to init_first_stage's deps
Icb580f97c:Add ramdisk_available to init_first_stage's deps
I044a075b7:Add ramdisk_available to init_first_stage's deps
I33164a7e7:Fix ndk and aml arch order
Ib8d92904a:Add ramdisk_available to sysprop_library
Ibc3516453:Add install_in_root to cc_binary

Change-Id: I147777bb1c4a3b818bc0118c6cf44ccfbf7970a0
2021-07-01 06:50:40 +00:00
Inseob Kim
9fa041c9a4 Revert "Remove RECOVERY_AS_BOOT check for init_first_stage"
This reverts commit 94c2593ea0.

Reason for revert: build breakage

Change-Id: I270a56bb33d19a2747298c69f6ec1b24746d97bf
2021-07-01 02:33:53 +00:00
Inseob Kim
94c2593ea0 Remove RECOVERY_AS_BOOT check for init_first_stage
This has kept adb_debug.prop from being installed.

Ignore-AOSP-First: fixes sc-release test breakage

Bug: 192432810
Test: build ramdisk-debug.img and see contents
Change-Id: I254579d2c6427213f40e9ae8e50d046e19390ba5
2021-06-30 11:35:21 +00:00
Nikita Ioffe
49b3a5c891 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
Change-Id: I3c5c9917d0a787d66272ccf4aefc57e6573841bc
2021-06-29 23:23:33 +00:00
Mitch Phillips
729e08f6ea [MTE] Add a HWASan-style tag dump to tombstones.
We already dump the tags in the regigster dump section by appending the
tag to the memory address. You only get 2 granules before each register
and 13 after.

The HWASan-style tag dump is extremely useful for debugging, as it gives
a pretty comprehensive overview of the memory subsystem. It also
provides enough context bytes (256) to give you a reasonable intuition
about a particular bug.

The tag dump shows up only if PTRACE_PEEKTAGS returns at least one value
in the 256 requested. If the start of end of the region is untagged,
it's omitted. The tag dump looks like this:

Change-Id: Icc33fb97542d9b1fa3ae9e58aba34d524c6ba7b5

---
Memory tags around the fault address (0x60000704414d340), one tag per 16 bytes:
      0x704414d000: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
      0x704414d100: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
      0x704414d200: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    =>0x704414d300: 0  0  0  0 [2] 2  0  0  0  0  0  0  0  0  0  0
      0x704414d400: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
      0x704414d500: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
      0x704414d600: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
      0x704414d700: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
      0x704414d800: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
      0x704414d900: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
      0x704414da00: 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
---

Bug: 183992164
Test: atest debuggerd_test on MTE+QEMU and sunfish.

Change-Id: I8d5842e4803ca30b407e866c99eef56f2cb36600
Merged-In: I8d5842e4803ca30b407e866c99eef56f2cb36600
2021-06-29 16:17:58 -07:00
Devin Moore
68bb5c4195 Revert "Handle "hardware" bootconfig parameter as "androidboot.hardware""
This reverts commit 0a799bdfd6.
Now that the kernel bootconfig feature has been to updated to handle
mixed subkeys and values, androidboot.hardware parameter is supported.

Test: build and boot Cuttlefish with "androidboot.hardware=cutf_vm"
Bug: 191502832
Merged-In: I0e436a27730d20689bc6974562c3e88d744385db
Change-Id: I0e436a27730d20689bc6974562c3e88d744385db
2021-06-29 12:53:08 -07:00
Wei Wang
67fa21cbdc Merge "init.rc: remove system cgroup migraion" into sc-dev 2021-06-25 17:04:00 +00:00
Christopher Ferris
a705c040ea Merge "Avoid using thread cache in unwinder." into sc-dev 2021-06-25 00:03:51 +00:00
Inseob Kim
86454f80ef Merge "Completely migrate init first stage to Soong" into sc-dev 2021-06-24 23:21:04 +00:00
Wei Wang
b4e79853cd init.rc: remove system cgroup migraion
We never use CONFIG_RT_GROUP_SCHED in GKI kernel, but that could be set
on legacy devices. Remove system cgroup migration and also RT settings
as we should not have any task under those groups.

Bug: 191925901
Test: Build
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I492833975e28e9888e412711e80670ca0901010d
2021-06-24 14:46:45 -07:00
TreeHugger Robot
70f5ffc6e7 Merge "reboot_utils: Check bootconfig for reboot parameters" into sc-dev 2021-06-24 21:18:29 +00:00
yidong zhang
72d0f9b6e7 Avoid using thread cache in unwinder.
Using  thread cache will cause SIGSEGV for 32bit+kernel4.9 device.

Bug: 190579082
Bug: 189803009

Test: run cts -m CtsSeccompHostTestCases
Change-Id: I47b13d02674aadbacd8dac36d8382eed0885413c
Merged-In: I47b13d02674aadbacd8dac36d8382eed0885413c
Signed-off-by: yidong zhang <yidong.zhang@amlogic.com>
(cherry picked from commit cbf7c466e6)
2021-06-24 20:28:34 +00:00
David Anderson
91b351ea7b Perform a consistency check before deleting snapshots.
If for some reason the COW state is not fully synced to disk, but
dm-snapshot has flushed its pending merges, we do not want to delete
snapshots. Doing so could potentially leave blocks unmerged.

This situation is quite unexpected so we label it as a merge failure.
The device can recover by completely syncing the COW state, and then
rebooting, which will attempt to make forward progress on the merge.

Bug: 190582627
Test: vts_libsnapshot_test
      full OTA on bramble
      incremental OTA on bramble
Change-Id: Ib887f1d9e4397a712ed2f800cc1222cf9305a039
Merged-In: Ib887f1d9e4397a712ed2f800cc1222cf9305a039
2021-06-23 19:12:01 -07:00
Devin Moore
2d93a2a100 reboot_utils: Check bootconfig for reboot parameters
Androidboot parameters have moved from /proc/cmdline to /proc/bootconfig
so we need to check both places in reboot_utils.
"ro.boot.*" properties can not be used because this is initialized
before the properties are set.

Test: boot Cuttlefish with init_fatal_panic and
init_fatal_reboot_target in bootconfig and in cmdline
Bug: 191494101

Merged-In: I6c230496ec1c3632470d20ff4a31f28db96ea71b
Change-Id: I6c230496ec1c3632470d20ff4a31f28db96ea71b
2021-06-23 11:27:52 +00:00
Inseob Kim
7418252a4e Completely migrate init first stage to Soong
adb_debug.prop is migrated too. And ramdisk_available is added to all
dependencies.

Bug: 187196593
Test: boot
Change-Id: I59cd149e0021211b8fd59c44b93bbf18dc8637bf
Merged-In: I59cd149e0021211b8fd59c44b93bbf18dc8637bf
2021-06-23 04:26:12 +00:00
TreeHugger Robot
028303d523 Merge "Isolate app profile ref data" into sc-dev 2021-06-22 16:22:45 +00:00
Shawn Willden
2a3c9238fe Merge "Revert^2 "Activate KeyMint."" into sc-dev 2021-06-21 23:12:32 +00:00
Shawn Willden
5dfd44ed5c Revert^2 "Activate KeyMint."
81cdd3f3da

Bug: 177729159
Test: VtsAidlKeyMintTargetTest & CtsKeystoreTestCases
Change-Id: I85d9e57fe83627992ddaa705946893a4b9890001
2021-06-21 19:44:02 +00:00
TreeHugger Robot
c01255b092 Merge "Revert "Activate KeyMint."" into sc-dev 2021-06-21 17:49:42 +00:00
Ioannis Ilkos
81cdd3f3da Revert "Activate KeyMint."
Revert "Activate KeyMint"

Revert submission 14947110-activate_keymint

Reason for revert: Likely b/191652216
Reverted Changes:
I6c5210356:Activate KeyMint
I784d39383:Activate KeyMint.

Bug: b/191652216
Change-Id: I7028a6aedc6e5aca670991033a616b6e8a97515b
2021-06-21 15:45:04 +00:00
Shawn Willden
aa73d0467d Merge "Activate KeyMint." into sc-dev 2021-06-21 12:51:59 +00:00
Treehugger Robot
7980327d6b Isolate app profile ref data
Due to aosp/1708274, ref data directory is now world accessible.
We need to fix ref data directory so that it does not leak app
visibility information.

Bug: 189787375
Test: AppDataIsolationTests
Merged-In: I716852478ce0734c7038934c88c36a567c06393f
Change-Id: I351fd9763c4bdb6d3c0c9a9047de9a4f9986bd03
2021-06-17 19:13:54 +01:00
Shawn Willden
2efdeec6eb Merge "Splitting out Trusty IPC into a library." into sc-dev 2021-06-15 23:17:37 +00:00
Elliott Hughes
eec890e173 Merge "Check for overflow in String16::append and String16::insert." into sc-dev 2021-06-15 22:19:15 +00:00
Elliott Hughes
20462789dc Merge "Check for overflow in String8::real_append." into sc-dev 2021-06-15 20:49:48 +00:00
Max Bires
fc0ed9527d Splitting out Trusty IPC into a library.
This allows the relevant IPC code to be included in the provisioner tool
easily as it's shuffled over into a non-AOSP component due to
chip specific requirements in provisioning Device IDs.

Bug: 178796950
Test: Stuff builds
Change-Id: I57482e89035e8648544f87291ec14c6aece09bd0
2021-06-15 12:15:36 -07:00
Wei Wang
99234c4967 Merge "task_profiles.json: add taskprofile for SurfaceFlinger" into sc-dev 2021-06-15 19:15:19 +00:00
Shawn Willden
8caf16a46e Merge "Add TrustyKeyMintDevice" into sc-dev 2021-06-15 13:15:33 +00:00
Bowgo Tsai
e89ec3c0dc Merge "fastboot: support vbmeta_vendor.img" into sc-dev 2021-06-15 02:09:57 +00:00
Wei Wang
6d6b71e582 task_profiles.json: add taskprofile for SurfaceFlinger
In some platforms, setting a different cpuset (or remove it) and/or
uclamp setting is beneficial to both performance and power. Adding 2
separate profiles for vendor to override surfaceflinger scheduling
policies.

Bug: 170507315
Test: build and boot
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: Ib313fd67c6ccd701109c5683d8dbab9ecd1580d8
2021-06-14 14:47:00 -07:00
Shawn Willden
c3626d0b1d Activate KeyMint.
Ignore-AOSP-First: No merge path from AOSP
Bug: 177729159
Test: VtsAidlKeyMintTargetTest
Change-Id: I784d393835d15e1eac3dd369202a1e245048801f
2021-06-14 14:33:00 -06:00
Shawn Willden
5bd73cceb5 Add TrustyKeyMintDevice
Ignore-AOSP-First: No merge path from AOSP
Bug: 177729159
Test: Not testable until more CLs land
Change-Id: Iea4e70bb5b4ce051492f2e42d2e0d219d088388e
2021-06-14 14:33:00 -06:00
Christopher Ferris
8f682940e5 Merge "Avoid thread cache in unwinder." into sc-dev 2021-06-14 19:40:40 +00:00
TreeHugger Robot
0b6e4c2c5a Merge "Allow others to read the profile ref dir" into sc-dev 2021-06-14 15:29:55 +00:00
Elliott Hughes
a6be6f0acb Check for overflow in String16::append and String16::insert.
Bug: http://b/178802681
Bug: http://b/178821065
Test: new tests
Change-Id: I2352ea4c65e3f29e44e2ad6cad20ad610ceace1f
2021-06-10 17:06:26 -07:00
Elliott Hughes
59682761fb Check for overflow in String8::real_append.
Bug: http://b/178822418
Test: new tests
Change-Id: I73631a070ade0689441abe5645ba5a5f64a58675
2021-06-10 16:42:20 -07:00
Christopher Ferris
49e5a76544 Avoid thread cache in unwinder.
The code in the fallback path calls pthread_key_create when using the
normal thread cache. However, this code is executed out of the linker,
which means that the call doesn't see keys created by the libc version
of pthread_key_create. As of now, simply avoid using the thread cache
to avoid this problem.

Bug: 189803009

Test: debuggerd -b on a media process on a 32 bit Android Go device
Test: and observe no crash.
Test: debuggerd unit tests pass.
Change-Id: I9ca1a55e44d3bb69d49450826d7d64d7a64145c3
2021-06-10 01:24:50 +00:00
David Anderson
1de7384c10 Use std::shared_ptr in Epoll's callback list.
Ignore-AOSP-First: Awaiting security triage
Bug: 187862380
Bug: 190126442
Test: CtsInitTestCases
Change-Id: Ibb34a6b8a5675dbc515b7f8a43d7eecf2084510c
(cherry picked from commit aea9781530)
2021-06-09 19:59:20 +00:00
Calin Juravle
3c34eecf50 Allow others to read the profile ref dir
ART wants to optimize the time when the profile information
is saved for an app. To do so, it needs access to both, the current
profile, and the reference profile. This will allow ART to access
the ref profiles, which previously was not needed.

Test: m & flash
Bug: 185979271
Merged-In: Ie07bce81d2fba9c0b0ae4f322418e960c024e15d
Change-Id: Ie07bce81d2fba9c0b0ae4f322418e960c024e15d
(cherry picked from commit 11197dd8a8)
2021-06-09 13:51:01 +00:00