Commit graph

69435 commits

Author SHA1 Message Date
Devin Moore
6d5445b9f4 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
Change-Id: Iccdec451f53330162fa2c9ad2b7c2630f32b4168
2021-07-08 01:52:46 +00:00
Nikita Ioffe
fb1e841a9f Merge "Also populate lastUpdateMillis in ActivateFlattenedApexesIfPossible" 2021-07-08 01:16:49 +00:00
Daniel Rosenberg
b19c333f2f Merge changes from topic "CowSequenceOp"
* changes:
  libsnapshot: Switch merge to CowRevMergeOpItr
  libsnapshot: Add seq op support to inspect_cow
  libsnapshot: Add CowRevMergeOpIter
  libsnapshot: Add IsOrderedOp
  libsnapshot: Cleanup iterators
  libsnapshot: Add Sequence Ops
2021-07-07 23:59:43 +00:00
Suren Baghdasaryan
86e0c6f409 Merge "libprocessgroup: Remove unnecessary permissions change in uid/pid hierarchy" 2021-07-07 23:09:48 +00:00
Daniel Rosenberg
437a49ae66 libsnapshot: Switch merge to CowRevMergeOpItr
This switches merge code over from using the old RevOpItr to the new
MergeRevOpItr. Since there are no other users, RevOpItr is no longer
needed.

Changed names of copy_ops_ and total_data_ops_ to more accurately
reflect their meaning.

Bug: 177104308
Test: cow_snapuserd_test
Change-Id: Ic053be4877cfdc86656551f5a3d5d95f3825f937
2021-07-07 22:23:44 +00:00
Daniel Rosenberg
fffb9ff8ee libsnapshot: Add seq op support to inspect_cow
This adds the -m option to inspect_cow, allowing it to display the ops
according to CowRevMergeOpItr

Bug: 177104308
Test: inspect_cow -m on file with and without seq ops
Change-Id: Ic9a062b8175c77084e76c437414c23fd09e34cc6
2021-07-07 22:23:38 +00:00
Daniel Rosenberg
9b34ea8541 libsnapshot: Add CowRevMergeOpIter
This presents cow ops in the reverse of their merge order, as requested
when we perform a merge. It starts with sorted non-ordered ops sorted by
blocks, and then the ordered ops. Already merged ops are removed.

Bug: 177104308
Test: cow_api_test
Change-Id: I864bcab5cda447cf4a197abc02d954f9db08b744
2021-07-07 22:23:27 +00:00
Daniel Rosenberg
f7001fad6f libsnapshot: Add IsOrderedOp
Ordered Ops are Cow Ops with source block dependencies.
Currently this is only Copy Ops, but will extend to XOR
blocks when they're added.

Bug: 177104308
Test: Builds, does not impace cow_api_test/cow_snapuserd_test
Change-Id: I0a50dfe3316ec3a3b1d035335f094c62296649a5
2021-07-07 22:23:22 +00:00
David Anderson
ccea7dfae7 Merge "Fix gid not being set in ueventd when device nodes already exist." 2021-07-07 22:06:09 +00:00
Suren Baghdasaryan
29c9e26776 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
Merged-In: I182298c36f6b0b4580ab59e440bd3aea16f5fbfe
2021-07-07 19:42:25 +00:00
Nikita Ioffe
1f662999e3 Also populate lastUpdateMillis in ActivateFlattenedApexesIfPossible
Test: m
Bug: 192647837
Change-Id: I11dca132168d6a30372d7a68fe590894d3cc5ccf
2021-07-05 16:44:03 +01:00
Treehugger Robot
a436f589ab Merge "init: disable watermark_boost feature" 2021-07-04 08:16:08 +00:00
David Anderson
f8825fafc8 Fix gid not being set in ueventd when device nodes already exist.
The chown() call will fix the uid for pre-existing nodes, but not the
gid. This fix ensures the correct gid is set if needed.

Bug: 187738549
Test: manual test modifying ueventd.rc
Change-Id: I0fadd745a7c57a089fed9afc2572ace597a05396
2021-07-02 20:50:23 -07:00
Daniel Rosenberg
f0d9beb162 libsnapshot: Cleanup iterators
The libsnapshot iterators can all use the same interface instead of
duplicating the interface. We don't have any need for the internal class
variable iterators, so remove them.

Test: Builds, does not impact cow_api_test/cow_snapuserd_test
Change-Id: I5f008401e067a55a57812b7bf101a472ad97df18
2021-07-02 20:53:16 +00:00
Treehugger Robot
4717129e57 Merge "libprocessgroup: Do not remove uid cgroups directory" 2021-07-02 18:28:04 +00:00
Li Li
d0464b0c01 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
Merged-In: I2e91088f21f45e4eda6c709a4af65ace7e135801
Change-Id: I2e91088f21f45e4eda6c709a4af65ace7e135801
2021-07-02 10:27:00 -07:00
Daniel Rosenberg
83127b73b8 libsnapshot: Add Sequence Ops
This adds the ability to write sequence ops. A Sequence op is a list of
block values in the new image. These ops may have dependencies on data
that is overwritten by future ops, so must be merged in a specific
order, regardless of their order in the cow file.

This patch only introduces the operation. The following patches will
actually make use of it.

Bug: 177104308
Test: Builds
Change-Id: I9162b49e5061079416ac9e5661c8b1245298044b
2021-07-01 20:09:44 -07:00
Treehugger Robot
da2f0aceb5 Merge "Forward HAT and ConfirmationToken to TA on finish." 2021-07-01 23:44:25 +00:00
Janis Danisevskis
b24f12226a 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.

Test: CtsVerifier biometrics tests.
Bug: 192201272
Merged-In: Ifb2b08514acab78ff3d4fec4bc928260820d4ce0
Change-Id: Ifb2b08514acab78ff3d4fec4bc928260820d4ce0
2021-07-01 15:17:32 -07:00
David Anderson
2359145f4c Merge "libsnapshot: Add a source build fingerprint to the update state." 2021-07-01 19:18:28 +00:00
Christopher Ferris
64a0c467f8 Merge "Update for new TRAP_PERF value." 2021-07-01 16:54:38 +00:00
Martin Liu
9f8b024c72 init: disable watermark_boost feature
In newer kernel, it introduces watermark boost feature
to enhance memory fragmentation problems. This feature
will dynamically boost/down watermark level which conflicts
with LMKD assumption and causing LMKD not to work properly.
Disabling this feature first until we address it.

Bug: 189938926
Test: check vm parameter.
Signed-off-by: Martin Liu <liumartin@google.com>
Change-Id: I6db5163f843f1129080bb944df7cbb8c799a58e0
2021-07-01 12:26:44 +08:00
Christopher Ferris
c31ccb44bf Update for new TRAP_PERF value.
For the new kernel 5.13 heders, there is a new TRAP_PERF value that
needs to be handled.

Test: Builds.
Change-Id: I2c6658ca94423c210db9ad6692ec69f6be69b3f5
2021-07-01 03:35:24 +00:00
Elliott Hughes
8d7c887b23 Merge "debuggerd_client: also log errors to the dump file." 2021-06-30 15:45:31 +00:00
David Anderson
9d069875da libsnapshot: Add a source build fingerprint to the update state.
Bug: 188909957
Test: manual test
Change-Id: I9aa155eee25dd49f48baede4f0a2e4ab2ab76980
2021-06-29 22:12:44 -07:00
Treehugger Robot
7d067aee62 Merge "libutil: no special copy from StaticString16" 2021-06-30 02:20:40 +00:00
Treehugger Robot
3551e457ca Merge "String16 is moveable (noexcept)" 2021-06-30 01:23:02 +00:00
Jooyung Han
6f92640d45 libutil: no special copy from StaticString16
String16's ctors already handle static strings, so we don't need a
specialized constructor which accepts StaticString16.

Bug: n/a
Test: libutils_test
Change-Id: I93a1ba70d743ff9c73f113d53ffba73cef6adade
2021-06-30 09:04:29 +09:00
Daniel Rosenberg
2c1aead903 Merge "Add exfat utilities for mkfs and fsck" 2021-06-29 23:57:57 +00:00
Treehugger Robot
9e52385898 Merge "[MTE] Add a HWASan-style tag dump to tombstones." 2021-06-29 22:46:59 +00:00
Devin Moore
41d3223d3f Merge "Revert "Handle "hardware" bootconfig parameter as "androidboot.hardware""" 2021-06-29 19:47:15 +00:00
Kalesh Singh
a9ea7e5b8e debuggerd_client: also log errors to the dump file.
Dumping stack in ANR can fail, but error message is only printed
to logcat. To allow easier debugging of such cases we add the
error messages in the ANR file as well.

Also factor out some duplication, inline single-call functions to
their call sites, and make some of the lambdas clearer by only having
implicit state unrelated to their primary purpose in captures but
passing as arguments things they fundamentally need to do their job
(and actually adding some duplication for time_left() which was subtle
enough to fool me into thinking that we only needed one call of
set_timeout(), which I've renamed to update_timeout()).

Bug: 191172191
Test: Manual
Change-Id: I39a50ca5b72059bfeff48b010d3be44f19eb32fa
2021-06-29 11:59:14 -07:00
Steven Moreland
f326be7cfb Merge "storaged: remove unused libsysutils dep" 2021-06-29 18:00:35 +00:00
Steven Moreland
eac62c1389 Merge "snapshotctl: remove unused libbinder dep" 2021-06-29 17:58:39 +00:00
Steven Moreland
435bae7acd Merge "usbd - remove unused libcutils dep" 2021-06-29 17:58:38 +00:00
David Anderson
da75aa7b6b Merge "init: fix to set sd device label correctly for FS" 2021-06-29 04:12:13 +00:00
Jooyung Han
98b396e785 String16 is moveable (noexcept)
String16 is still in use by AIDL compiler. Because String16 is not
noexcept-move-constructible, the C++ compiler will complain when it is
used with non-copyable types (such as ParcelFileDescriptor).

For example, when vector<Foo> is resized, copy-ctor of Foo is called,
which is not available.

  parcelable Foo {
    String s;
    ParcelFileDescriptor[] pfds;
  }

By providing noexcept move-ctor for String16, vector<Foo> can be resized
with no problem.

Btw, copy from StaticString16 is specialized for efficiency and move
from StaticString16 don't need to be different from copy.

Bug: 192136980
Test: libutils_test
Change-Id: I13744a2ceebf5781c3ef7f3a04237a6750b0db0a
2021-06-29 10:18:23 +09:00
Steven Moreland
5864a6211c snapshotctl: remove unused libbinder dep
not needed (may be needed by deps, but still).

Bug: N/A
Test: N/A
Change-Id: I3bc128717df50120c803d1d8bb5f9537f27cefd8
2021-06-29 00:24:02 +00:00
Steven Moreland
13e8fa6664 storaged: remove unused libsysutils dep
Unused.

Bug: N/A
Test: build only
Change-Id: I47e5e2c2c19e2e06b920bf36695f28af4db6095f
2021-06-29 00:10:39 +00:00
Nikita Ioffe
c037bdbc5a Merge "Add CreateEmptyDevice and WaitForDevice APIs" 2021-06-29 00:08:33 +00:00
Steven Moreland
9000a133cc usbd - remove unused libcutils dep
Well, the dependency of my dependency is still my dependency, so it'll
still be loaded, but there is no need for the declaration here.

Bug: N/A
Test: N/A
Change-Id: I27495eee1a76401dba316f425c2e43a692357543
2021-06-28 23:56:29 +00:00
Mitch Phillips
5ddcea2924 [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
2021-06-28 15:53:10 -07:00
Nikita Ioffe
15e0f5a98a Add CreateEmptyDevice and WaitForDevice APIs
These APIs support a flow in which dm devices can be created before they
are actually needed, hence minimizing the time a process will wait for
ueventd to create user space paths.

Bug: 190618831
Test: atest libdm_test
Change-Id: I4dfa14e5271a6a13de6da73ec3c7efb1ebc0f8b8
2021-06-28 18:54:12 +01:00
Treehugger Robot
5e2363e14d Merge "License boilerplate." 2021-06-26 00:33:20 +00:00
Treehugger Robot
8704d21c79 Merge "Correctly implement a stub for AddSequenceData" 2021-06-26 00:33:01 +00:00
Elliott Hughes
813fd6d1fd License boilerplate.
Bug: http://b/191499510
Test: treehugger
Change-Id: Ie0c34ec4713e04511a31ec033a097cb1c033fe79
2021-06-25 14:42:51 -07:00
Kelvin Zhang
a1e1727b61 Correctly implement a stub for AddSequenceData
AddSequenceData isn't supposed to be a "free function".
It belongs to ICowWriter class

Test: m update_engine
Change-Id: I2828651f26eefe5f9c76526608b9abdb6225dea0
2021-06-25 20:38:09 +00:00
Treehugger Robot
d669e6291c Merge "trusty: Increase maximum number of coverage counters" 2021-06-25 18:50:30 +00:00
Wei Wang
d6f64171fe Merge "init.rc: remove system cgroup migraion" 2021-06-25 17:06:11 +00:00
Guo Weichao
bcefbb1dfb init: fix to set sd device label correctly for FS
The sysfs node of sd blk_device is /sys/fs/f2fs/sd-<num>, we shouldn't
skip partition number at this time.

Bug: 189257443
Test: access sd-<num> sysfs correctly
Signed-off-by: Guo Weichao <guoweichao@oppo.com>
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Change-Id: Ibcd7bb265f8fca9cd26f8770403f1bafad433acb
2021-06-25 21:42:17 +08:00