Commit graph

71850 commits

Author SHA1 Message Date
TreeHugger Robot
232ec664b1 Merge "libdm: Make ExtractBlockDeviceName() return its result" into sc-dev 2021-08-17 05:38:09 +00:00
TreeHugger Robot
d95943088e Merge "Rename two local variables" into sc-dev 2021-08-17 05:38:07 +00:00
TreeHugger Robot
a707c28937 Merge "Handle long responses by keymint IPC." into sc-dev 2021-08-16 20:07:15 +00:00
Bart Van Assche
96b21cc589 libdm: Make ExtractBlockDeviceName() return its result
From https://engdoc.corp.google.com/eng/doc/devguide/cpp/styleguide.md:
"Prefer using return values over output parameters: they improve
readability, and often provide the same or better performance (see the C++
Primer)." Implement this advice for ExtractBlockDeviceName(). This patch
does not change any functionality.

Bug: 194450129
Test: mm libfs_mgr libdm_test
Merged-In: I6363781163eba08e6128507b403200f472f68a59
Change-Id: I7d340b33281ebccded0836cd0b5a293e941f4043
Ignore-AOSP-First: Already in AOSP.
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-08-16 11:04:35 -07:00
Bart Van Assche
c554240e64 Rename two local variables
Improve code readability by renaming 'device' into 'loop_device' and
'device_fd' into 'loop_fd'.

Bug: 194894000
Test: Built Android images and installed these on an Android device.
Merged-In: Ia9c2d7a525e727f8706e66631b97fc4678c6a4d9
Change-Id: I3fa0c9ca53277b621bb5b81aca394a3079c6e0a3
Ignore-AOSP-First: Already in AOSP.
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-08-16 11:04:18 -07:00
Max Bires
98f87ca8a7 Merge "Make RemoteProvisioner required for KeyMint cc_bin" into sc-dev 2021-08-15 17:55:48 +00:00
Xin Li
dc9e8e5084 Merge stage-aosp-sc-ts-dev before making it an upstream
Bug: 169893837
Merged-In: I3735e0752a6e502536000bd3102abda30cbd58fe
Change-Id: I0e78f7e9c3f27e44d1c04bbd138e840829a3dc84
2021-08-13 18:27:12 +00:00
The Android Open Source Project
65335e200f Merge ab/7633965
Bug: 169893837
Merged-In: I7afea72a15b1a2a7aa676bddd12ea4a2dd896f81
Change-Id: Id30ca5943b34b6fffc1f203667b5a59a79950f67
2021-08-12 22:27:46 +00:00
Tri Vo
c87ea84d20 Merge "trusty: storage: Allow starting without /data mounted" into sc-dev 2021-08-11 16:02:35 +00:00
Janis Danisevskis
5f4770944a Handle long responses by keymint IPC.
The KeyMint TA may send responses that are longer thant the 8K buffer
that the KeyMint HAL holds. This patch introduces
trusty_keymaster_call_2 which can grow the receive buffer on demand.

Ignore-AOSP-First: No mergepath from AOSP.

Bug: 195622501
Test: VTS and CTS test for regression testing.
Change-Id: Ia06e590e547e649ca81cda9a71851f334970788f
2021-08-10 15:08:20 -07:00
David Anderson
bbedda71e1 Use std::shared_ptr in Epoll's callback list. am: 2cf268ab9f am: 81c5a30224
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15128087

Change-Id: I7afea72a15b1a2a7aa676bddd12ea4a2dd896f81
2021-08-10 21:19:35 +00:00
David Anderson
6fa3c6a94a Use std::shared_ptr in Epoll's callback list. am: 2cf268ab9f am: 5e66f7148b
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15128087

Change-Id: Ie32637ad0fc07205c9df915fdbcd5dc1a9154701
2021-08-10 21:18:25 +00:00
David Anderson
81c5a30224 Use std::shared_ptr in Epoll's callback list. am: 2cf268ab9f
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15128087

Change-Id: I87c13501dddf402605de939f51fb894c53039943
2021-08-10 21:09:03 +00:00
David Anderson
5e66f7148b Use std::shared_ptr in Epoll's callback list. am: 2cf268ab9f
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15128087

Change-Id: I57974f85be50fdea6ec6e10d9038a16061763f61
2021-08-10 21:08:21 +00:00
David Anderson
2cf268ab9f Use std::shared_ptr in Epoll's callback list.
Ignore-AOSP-First: Awaiting security triage
Bug: 187862380
Bug: 184569329
Test: CtsInitTestCases
Change-Id: Ibb34a6b8a5675dbc515b7f8a43d7eecf2084510c
(cherry picked from commit aea9781530)
2021-08-09 21:25:49 +00:00
Max Bires
58aa431069 Make RemoteProvisioner required for KeyMint cc_bin
This change adds the RPK apk back into the image for Trusty Keymint
devices, though the functionality will still be disabled by the
server check-in for now.

Ignore-AOSP-First: Will be CP'ed to AOSP
Bug: 194509629
Test: atest RemoteProvisionerUnitTests
Change-Id: Ic20ca119bd9c0614f7559b24ad60718c813a0cca
2021-08-06 05:58:24 -07:00
Tri Vo
84b4353790 trusty: storage: Allow starting without /data mounted
Bug: 187105270
Test: m
Change-Id: I3735e0752a6e502536000bd3102abda30cbd58fe
Merged-In: I3735e0752a6e502536000bd3102abda30cbd58fe
2021-08-06 05:38:27 +00:00
Akilesh Kailash
533c2f6d55 Crash during OTA merge may lead to blocks with stale data
This is a corner case wherein a crash during OTA
merge can lead to missing of some COW operations to be
merged thereby some blocks may end up with stale data.

Fix here is to avoid any re-ordering of COW operations.
Merge the COW operations as present in the COW file.

New tests have been added to cow_snapuserd.

Bug: 194955361
Test: cow_snapuserd_test, Incremental OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Merged-In: Id895fe7a3d6b4510676490a86d0caf62dec9b079
Change-Id: I14900b9537c4deb7824547e1dfe80f15274bdda4
Ignore-AOSP-First: manual merge from aosp
2021-07-29 16:30:01 +00:00
TreeHugger Robot
f3fea37772 Merge "Revert "Add systrace tag for system property"" into sc-dev 2021-07-23 17:04:39 +00:00
Eric Biggers
1fda6f1bf1 Revert "init: make reboot_on_failure not apply to manually stopped services"
This reverts commit 1c51525f66 because it
accidentally made reboot_on_failure be a no-op for all services.  This
is because Reap() itself calls KillProcessGroup() on devices with a
vendor level >= R, which in turn sets SVC_STOPPING.  I had overlooked
this somehow, probably because I didn't consider that a service can
consist of multiple processes.

It turns out that real FDE devices don't actually need the above commit
because FDE devices aren't allowed to have updatable apexes enabled, and
without updatable apexes enabled, apexd exits automatically and
therefore doesn't have to be stopped.  This can be verified by using the
aosp_cf_x86_phone_noapex build target, rather than aosp_cf_x86_phone
which I had used for testing before.  So just revert it for now.

Bug: 194370048
Change-Id: I90eddf2a87397449b241e5acaaa8d4a4241d73a9
(cherry picked from commit d14a178d01)
Merged-In: I90eddf2a87397449b241e5acaaa8d4a4241d73a9
2021-07-22 19:46:29 -07:00
Bowgo Tsai
94b21c0c8c Revert "Add systrace tag for system property"
Revert "Add systrace tag for system property"

Revert "Add systrace tag for system property"

Revert "Adding system property tracing"

Revert submission 1403568-sysprop_trace

Reason for revert: makes property get/set non-reentrant
Reverted Changes:
I6f85f3f52:Add systrace tag for system property
Id2b93acb2:Adding system property tracing
Id78992d23:Add systrace tag for system property
I1ba9fc7bd:Add systrace tag for system property

Ignore-AOSP-First: b/193050299#comment17

Bug: 193050299
Change-Id: I9305003531c6a86194d55dc72c613337d213b53d
Merged-In: I9305003531c6a86194d55dc72c613337d213b53d
Test: build and boot a device
(cherry picked from commit 18e0f65cbf)
2021-07-22 04:52:40 +00:00
David Drysdale
830ea32e77 TrustyKeyMint: support boot, vendor patchlevels
- Invoke TrustyKeymaster::ConfigureVendorPatchlevel() from
   remote keymint Initialize(), using vendor patchlevel retrieved
   from property.
 - Add TrustyKeymaster::ConfigureVendorPatchlevel() method to
   send the CONFIGURE_VENDOR_PATCHLEVEL message.
 - Add message type values for
   CONFIGURE_{VENDOR,BOOT}_PATCHLEVEL messages.

Bug: 193423844
Test: manual VTS test on device
Merged-In: Ie42345112b08ef9c669535cef2de60ea77da15b4
Change-Id: Ie42345112b08ef9c669535cef2de60ea77da15b4
Ignore-AOSP-First: manual merge from aosp
2021-07-21 16:48:05 +01:00
Wenhao Wang
440bad0bdd trusty:storageproxyd: Add wakelock to the UFS commands
We add a wakelock to the sequence of UFS commands so that
the sequence will not be disrrupted when devices get suspended.

Bug: 193456223
Test: Trusty storage tests
Merged-In: Ib90f8b284017cf261d2a2aea940834a42c21de02
Change-Id: Ib90f8b284017cf261d2a2aea940834a42c21de02
2021-07-16 14:29:05 -07:00
Wenhao Wang
c66e99bf24 trusty:storageproxyd: Fix return paths on errors
The function send_ufs_rpmb_req is missing return paths on errors.
This patch fixes it so that any UFS command failure will return
error code to the function caller.

Bug: 193855098
Test: Trusty storage tests
Merged-In: I391ecff9ed3f892b7c3adae0ceeb18930791326f
Change-Id: I391ecff9ed3f892b7c3adae0ceeb18930791326f
2021-07-16 19:50:50 +00:00
TreeHugger Robot
db4a23996d Merge "task_profiles.json: add taskprofile for dex2oat boot_complete policy" into sc-dev 2021-07-12 18:51:11 +00:00
Wei Wang
3745ce7aa8 task_profiles.json: add taskprofile for dex2oat boot_complete policy
Since installation time is also critical and sometime we want a finer
control on its behavior for vendor. Instead of set dex2oat to background
group, add a new task profile.

The default policy is to mirror SP_BACKGROUND to be compatible with
legacy devices.

Test: Boot
Bug: 188947181
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I7d5e113d1c368205f712eadad27775de226131ce
2021-07-08 11:00:02 -07:00
Devin Moore
91ef4dacce init: remove extra space in list of bootconfig values
If a bootconfig argument has a list of values, it has a space between
them in /proc/bootconfig.

Example:
BOARD_BOOTCONFIG := parameter=value1,value2,value3

In /proc/bootconfig, it looks like:
parameter = "value1", "value2", "value3"

Before this CL, that example would end up with the value string of:
"value1, value2, value3"

To keep consistent behavior with kernel cmdline the value string should be:
"value1,value2,value3"

Test: Boot cuttlefish with test bootconfig params and verify ro.boot.*
Bug: 192257482
Merged-In: Iccdec451f53330162fa2c9ad2b7c2630f32b4168
Change-Id: Iccdec451f53330162fa2c9ad2b7c2630f32b4168
2021-07-08 16:53:59 +00:00
Nikita Ioffe
b7f123fb66 Merge "Also populate lastUpdateMillis in ActivateFlattenedApexesIfPossible" into sc-dev 2021-07-08 13:14:05 +00:00
Nikita Ioffe
b47f266671 Also populate lastUpdateMillis in ActivateFlattenedApexesIfPossible
Test: m
Bug: 192647837
Change-Id: I11dca132168d6a30372d7a68fe590894d3cc5ccf
Merged-In: I11dca132168d6a30372d7a68fe590894d3cc5ccf
2021-07-08 11:27:18 +00:00
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