Commit graph

71816 commits

Author SHA1 Message Date
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
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
Bowgo Tsai
3a0dac346a fastboot: support vbmeta_vendor.img
Bug: 181909612
Bug: 190564127
Test: build
Change-Id: If61fff1c83513d71605c0cef2737a38f7575d69b
Merged-In: If61fff1c83513d71605c0cef2737a38f7575d69b
(cherry picked from commit a48a78356f)
2021-06-09 03:55:01 +00:00
Yi-yo Chiang
8f654d8a99 Merge changes Iaf2ec527,I6d6abd44,I6304e0de,Ia4fbce58,I3b60dfa4, ... into sc-dev
* changes:
  first_stage_mount: mount point must be canonical path
  fs_mgr_fstab: Parse overlayfs options from fs flags
  Remove deprecated fs_mgr_overlayfs_required_devices()
  adb-remount-test: Make awk scripts mawk-v1.3.3-compatible
  Make fs_mgr_overlayfs_mount_fstab_entry() available for user builds
  adb-remount-test: Strengthen skip_administrative_mounts
  fs_mgr_overlayfs_mount_fstab_entry(): Rename source device name
  fs_mgr_overlayfs: Polish fs_mgr_overlayfs_mount_fstab_entry()
  first_stage_mount: Remove "overlay" hack from InitRequiredDevices()
  fs_mgr_vendor_overlay: Mount vendor overlay with noatime
2021-06-08 07:51:52 +00:00
Nikita Ioffe
a35d50c234 Merge "libdm: Add DeleteDeviceDeferred API" into sc-dev 2021-06-04 10:15:39 +00:00
Mitch Phillips
b9637b0a87 [MTE] Print cause and alloc/dealloc traces to logcat.
This information clearly meets the bar for being dumped to logcat. If we
omit the info, we may confuse the user into thinking that it's not
available at all, especially if it's their first time seeing an MTE
report.

This also adds some functionality to the integration testing library to
pull logcat messages and scan them to make sure the contents are in both
places.

Fixes: 187881237
Test: atest debuggerd_test # on QEMU w/ MTE.
Change-Id: Icc17ea45bda7628331cc4812eaad3bc5c949b7a7
Merged-In: Icc17ea45bda7628331cc4812eaad3bc5c949b7a7
2021-06-03 13:13:15 -07:00
Yi-Yo Chiang
84fe96bfbc first_stage_mount: mount point must be canonical path
Ban weird paths such as /../system or //vendor in first stage mount.
Add utility function fs_mgr_create_canonical_mount_point() that:

* mkdir(mount_point) to ensure mount_point's existence
* Test that realpath(mount_point) =?= mount_point

Bug: 188898525
Test: Presubmit
Test: Boot CF
Change-Id: Iaf2ec52701277f26cc81f3e15a47b6083a788334
Merged-In: Iaf2ec52701277f26cc81f3e15a47b6083a788334
(cherry picked from commit 3431d52675)
2021-06-03 15:53:12 +08:00