Commit graph

64925 commits

Author SHA1 Message Date
David Anderson
61484f03ce Merge "libsnapshot: Add an open /dev/null mode for CowWriter." am: 56850e12e3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1488476

Change-Id: I0048a52c875b877b93bca24f533e8e0222f7ad89
2020-11-05 08:14:51 +00:00
David Anderson
56850e12e3 Merge "libsnapshot: Add an open /dev/null mode for CowWriter." 2020-11-05 07:37:43 +00:00
David Anderson
1b9ab3f544 libsnapshot: Add an open /dev/null mode for CowWriter.
This will be used by payload_generator to estimate the COW size without
using extra storage space.

Bug: 168554689
Test: cow_api_test, ota_from_target_files
Change-Id: I095c809e7d81eff5321b86f4c6bdfb6e9467e84e
2020-11-04 20:38:50 -08:00
Treehugger Robot
e8704b1ddb Merge "libsnapshot: Only sync after labels" am: f2609b2b0f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1480663

Change-Id: I1f6146f5949f9965735aee0d2bbf1c794c7916b8
2020-11-05 04:08:18 +00:00
Treehugger Robot
f2609b2b0f Merge "libsnapshot: Only sync after labels" 2020-11-05 03:52:04 +00:00
David Anderson
3c75ccfd50 Merge "libsnapshot: Use the COW size from the update manifest." am: c497a1c63c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1482764

Change-Id: I67f3804c6794477145f12a6c49b6c6513091f2af
2020-11-04 20:32:22 +00:00
David Anderson
c497a1c63c Merge "libsnapshot: Use the COW size from the update manifest." 2020-11-04 20:20:14 +00:00
Treehugger Robot
6eef59ca58 Merge "Fix unused function error for user build" am: fded8e696c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1487337

Change-Id: I5ad8046a960c938b2e57bfe6f4e321a1acd1dcc8
2020-11-04 11:21:59 +00:00
Treehugger Robot
fded8e696c Merge "Fix unused function error for user build" 2020-11-04 10:47:35 +00:00
Yo Chiang
cc86e967c7 Fix unused function error for user build
```
system/core/fs_mgr/fs_mgr_overlayfs.cpp:83:6: error: unused function
'fs_mgr_is_dsu_running' [-Werror,-Wunused-function]
```

Bug: 172405271
Bug: 165925766
Test: build aosp_bonito-user, no warning/error
Change-Id: I3206e5bd13658ab0b7f5826e8e1c206c8df65684
2020-11-04 07:02:47 +00:00
Rick Yiu
43622aea3c Merge "libprocessgroup: Support write to file feature" am: b4a3f080e6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1474116

Change-Id: I5fa613c73603071bc561a4ac980c8ac300efe844
2020-11-04 05:27:55 +00:00
Treehugger Robot
a80dc0d4e2 Merge changes I669a03a6,Ibb774d6d am: f6d42d45c5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1484983

Change-Id: I6a84a6f5bda3018766def14edbf9536da3859256
2020-11-04 05:27:28 +00:00
Rick Yiu
b4a3f080e6 Merge "libprocessgroup: Support write to file feature" 2020-11-04 04:54:42 +00:00
Treehugger Robot
f6d42d45c5 Merge changes I669a03a6,Ibb774d6d
* changes:
  libsnapshot: Fix footer values and verification
  libsnapshot: Fix some minor formatting bugs
2020-11-04 04:50:42 +00:00
Yo Chiang
7d485cec05 Merge changes from topic "dsu-overlayfs" am: 65f4f4359d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1476596

Change-Id: I4d6acf0e9b2edffd14275caa0c4cad634931cd2d
2020-11-04 03:46:58 +00:00
Yo Chiang
db7bf1c9a1 Enable overlayFS on DSU system am: 0267bf0e96
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1469563

Change-Id: Ide20f97ea0d42a71de86e15092156cd5a6b70ce0
2020-11-04 03:46:52 +00:00
Yo Chiang
7358c52efb Merge "adb-remount-test.sh: Make devt errors warnings instead" am: 497bca09c7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1473230

Change-Id: Iaab4e86d0fe8101285743c74d3104bc86231dd24
2020-11-04 03:46:49 +00:00
Yo Chiang
fa48a7bac2 Merge "TransformFstabForDsu() skips handling special devices" am: 5ab4400db1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1469562

Change-Id: I00bcd137caa1be54d5ed0b5f774056a52554b1e2
2020-11-04 03:46:37 +00:00
Yo Chiang
65f4f4359d Merge changes from topic "dsu-overlayfs"
* changes:
  Refactor fs_mgr_overlayfs_teardown()
  Enable overlayFS on DSU system
2020-11-04 03:30:31 +00:00
Yo Chiang
497bca09c7 Merge "adb-remount-test.sh: Make devt errors warnings instead" 2020-11-04 03:30:31 +00:00
Yo Chiang
5ab4400db1 Merge "TransformFstabForDsu() skips handling special devices" 2020-11-04 03:30:31 +00:00
David Anderson
a2614723fe Merge changes from topic "init-snapuserd" am: dfaede06bc
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1482757

Change-Id: I88b77810bd622ec02e7bf695720e71beb8d2df1e
2020-11-03 18:43:33 +00:00
David Anderson
f1581607bf Start snapuserd if needed as soon as possible during second-stage init. am: b031def229
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1481096

Change-Id: If4c20716b76fb7e034bb5ca31e7c9b2867758be4
2020-11-03 18:43:28 +00:00
David Anderson
8515f5c24e libsnapshot: Add support for first-to-second-stage transitions of snapuserd. am: f57fd97df3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1478510

Change-Id: Ib8a1f47f3f398224cdc11930081b6e3532cdd746
2020-11-03 18:43:16 +00:00
David Anderson
dfaede06bc Merge changes from topic "init-snapuserd"
* changes:
  libsnapshot: Implement MapAllSnapshots and UnmapAllSnapshots.
  Start snapuserd if needed as soon as possible during second-stage init.
  libsnapshot: Add support for first-to-second-stage transitions of snapuserd.
2020-11-03 18:24:49 +00:00
Tom Cherry
b02b3c6896 Merge "Move CtsLiblogTestCases and CtsLogdTestCases to system/logging/TEST_MAPPING" am: 22e036bd26
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1483685

Change-Id: I2e5c71d1009aad16a0165819c3c25ebc63e223f8
2020-11-03 14:48:24 +00:00
Tom Cherry
22e036bd26 Merge "Move CtsLiblogTestCases and CtsLogdTestCases to system/logging/TEST_MAPPING" 2020-11-03 14:14:08 +00:00
Rick Yiu
bc1ad9671a libprocessgroup: Support write to file feature
There may be some use cases that it needs to write string to a
file. This patch support write "Value" to "FilePath", where
both parameters could use special string "<uid>" and "<pid>" to
represent actual uid and pid.

Bug: 170507963
Test: function works
Change-Id: I543846f523518a9bcb3dd1b3437163a1b3157d95
2020-11-03 20:56:48 +08:00
Daniel Rosenberg
d5bcbaa066 libsnapshot: Only sync after labels
This changes labels to belong at the end of the set of ops that they
refer to. We only sync after writing a label, or the footer, saving the
cost of syncing after ever op.

Change-Id: Iee9dd69132b8e3321eccfe1e43fa0c072a94d3bd
Bug: 172026020
Test: cow_api_test
2020-11-03 00:40:02 -08:00
Daniel Rosenberg
290b0ed4b3 libsnapshot: Fix footer values and verification
A few values in the footer were being set inconsistently. We weren't
verifying them, so it didn't matter. This adds verification and sets
them properly.

Change-Id: I669a03a6e1e87ace31775aba5b67dde9b6e5ecf5
Bug: 168829493
Test: cow_api_test
2020-11-03 00:40:02 -08:00
Daniel Rosenberg
46ef7595d0 libsnapshot: Fix some minor formatting bugs
A few minor issues snuck through code review.
Removed a debug line in cow_api_test to persist file.
Removed unused function declaration for cow writer
Switched PLOG to LOG where no errno exists.

Change-Id: Ibb774d6de518fc2a8746e4b9eefc3655c9973c30
Bug: 168554689
Test: cow_api_test
2020-11-03 00:39:45 -08:00
Treehugger Robot
f54a27bf70 Merge "Fix the expected tagged_addr_ctrl in a test." am: 485505c06d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1484250

Change-Id: I252838ef872fed929fc17bed8be4f26dcdfac826
2020-11-03 03:29:10 +00:00
Treehugger Robot
485505c06d Merge "Fix the expected tagged_addr_ctrl in a test." 2020-11-03 03:12:02 +00:00
Treehugger Robot
893ec3cc5a Merge "Store result of mount_all for mounted userdata by metadata encryption" am: 8df6d9e0de
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1483899

Change-Id: I1a052c2ad8566651294bda0c22bba3976b8ef64f
2020-11-03 02:36:44 +00:00
Treehugger Robot
8df6d9e0de Merge "Store result of mount_all for mounted userdata by metadata encryption" 2020-11-03 02:18:24 +00:00
Treehugger Robot
ca0b409fbd Merge "Remove symlink libprocinfo" am: 9979a4f79d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1484249

Change-Id: If4eb88632d39241b1f7f4cae035fbac4e77bfe70
2020-11-03 00:03:21 +00:00
Peter Collingbourne
2b6764a625 Fix the expected tagged_addr_ctrl in a test.
It turns out that I had originally written the test with a local
patch applied that forces TCF0 to SYNC, so it was testing for the
wrong tagged_addr_ctrl value. Fix it.

Bug: 135772972
Change-Id: Ibb9b25e5f5635372ad5de7825c31d7264ff02590
2020-11-02 16:00:08 -08:00
Tri Vo
91bc8e8105 Merge changes I7741c7e5,I30bb2844,If55b93b1,Ife058ca2 am: 0b0f7f31b9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1482120

Change-Id: I011d2980090658ab49fb3b649f987b1371b4e41d
2020-11-02 23:50:18 +00:00
Treehugger Robot
9979a4f79d Merge "Remove symlink libprocinfo" 2020-11-02 23:29:24 +00:00
Tri Vo
0b0f7f31b9 Merge changes I7741c7e5,I30bb2844,If55b93b1,Ife058ca2
* changes:
  trusty: fuzz: dump trusty kernel logs on crash
  trusty: Add corpus for gatekeeper fuzzer
  trusty: Fuzzer for Gatekeeper TA
  trusty: fuzz: Helper library
2020-11-02 23:09:13 +00:00
Treehugger Robot
bd0fe606b7 Merge "Move e2fsck into /first_stage_ramdisk." am: 8b4a9a9a61
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1478507

Change-Id: I1ff6a9cf72259e8227e1fe657e6228c354655c5e
2020-11-02 22:51:02 +00:00
Treehugger Robot
8b4a9a9a61 Merge "Move e2fsck into /first_stage_ramdisk." 2020-11-02 21:33:07 +00:00
David Anderson
eb7eb4bef6 libsnapshot: Use the COW size from the update manifest.
When Virtual A/B Compression is enabled, the manifest contains the
predicted COW size. Use this instead of the algorithm based on the
kernel COW format.

Bug: 168554689
Test: vts_libsnapshot_test
Change-Id: I545679b4834957ff80a930d91cb44afbadebb66c
2020-11-02 13:24:16 -08:00
David Anderson
2eb7b9221b libsnapshot: Implement MapAllSnapshots and UnmapAllSnapshots.
Bug: 168554689
Test: vts_libsnapshot_test
Change-Id: I6809e226741dabcf337c3a5cfaba56afdb9edd64
2020-11-02 13:24:15 -08:00
David Anderson
b031def229 Start snapuserd if needed as soon as possible during second-stage init.
snapuserd is used as a user-space block device implementation during
Virtual A/B Compression-enabled updates. It has to be started in
first-stage init, so that updated partitions can be mounted.

Once init reaches second-stage, and sepolicy is loaded, we want to
re-launch snapuserd at the correct privilege level. We accomplish this
by rebuilding the device-mapper tables of each block device, which
allows us to re-bind the kernel driver to a new instance of snapuserd.
After this, the old daemon can be shut down.

Ideally this transition happens as soon as possible, before any .rc
scripts are run. This minimizes the amount of time the original
snapuserd is running, as well as any ambiguity about which instance of
snapuserd is the correct one.

The original daemon is sent a SIGTERM signal once the transition is
complete. The pid is stored in an environment variable to make this
possible (these details are implemented in libsnapshot).

Bug: 168259959
Test: manual test
Change-Id: Ife9518e502ce02f11ec54e7f3e6adc6f04d94133
2020-11-02 13:24:06 -08:00
David Anderson
f57fd97df3 libsnapshot: Add support for first-to-second-stage transitions of snapuserd.
This patch introduces the fundamentals needed to support booting off
dm-user. First, a method has been added to start snapuserd in
first-stage init. It simply forks and execs, creates a specially named
first-stage socket, then waits for requests.

Next, a new method has been added to SnapshotManager to perform a
second-stage handoff. This works by first launching a second copy of
snapuserd using init's normal service management functionality. The new
snapuserd runs alongside the original, but has correct privileges and a
correct selinux context. Next, we inspect each COW device, and if its
table uses dm-user, we replace the table with a renamed control
device. The new control device is bound to the new snapuserd.

device-mapper guarantees that such a table swap is safe. It flushes I/O
to the old table and then replaces it with the new table. Once the new
table is in place, the old dm-user control devices are automatically
destroyed. Thus, once all dm-user devices has been transitioned, the
first-stage daemon is idle and can gracefully exit.

This patch does not modify init. A few changes will be needed on top of
this patch:

(1) CreateLogicalAndSnapshotPartitions will need further changes to
start the first-stage daemon and track its pid. Additionally, it will
need to ensure the named socket file is deleted, so there is no further
IPC allowed after partitions are completed.
(2) init will need to propagate the pid to second-stage init so the
process can be killed (or signalled).
(3) first-stage snapuserd will need to gracefully exit once it has no
active handler threads.
(4) second-stage init will need to invoke the transition helper on
SnapshotMaanager, ideally as soon as feasible.

Bug: 168259959
Test: manual test
Change-Id: I54dec2edf85ed95f11ab4518eb3d7dbaf0bdcbfd
2020-11-02 13:24:05 -08:00
Tom Cherry
5c14450f4f Move CtsLiblogTestCases and CtsLogdTestCases to system/logging/TEST_MAPPING
Test: these tests run in presubmit
Change-Id: If7055853d3477ca3b40cc3b39c69f6077a42f990
2020-11-02 12:44:37 -08:00
Yifan Hong
32f6dd81fa Merge changes from topic "toybox_vendor_ramdisk" am: 92836b2e95
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1470053

Change-Id: I1fb8569f312fe4f24de637fa1534be29853c287b
2020-11-02 19:04:59 +00:00
Yifan Hong
bac613c540 Make libraries {vendor_,}ramdisk_available. am: 89d1c19ca0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1470052

Change-Id: Ia219d450141246d1f66ba928f0b9ee3bd33887ee
2020-11-02 19:04:35 +00:00
Yifan Hong
92836b2e95 Merge changes from topic "toybox_vendor_ramdisk"
* changes:
  Add shell_and_utilities_vendor_ramdisk
  Make libraries {vendor_,}ramdisk_available.
2020-11-02 18:33:33 +00:00