Commit Graph

67245 Commits

Author SHA1 Message Date
Treehugger Robot 5205bb0758 Merge "iorap: Remove toggling iorapd on/off when using 'start' command." 2020-11-17 00:09:08 +00:00
Akilesh Kailash 023c62798c libsnapshot: snapuserd: Handle flush request
Handle flush operations by dm-snap post merge and
the ABI changes from dm-user. This
is now in sync with the latest dm-user patch (patch 25).

In case of any failures observed in daemon in the IO
path, return error code back to dm-user which
will eventually fail the IO.

Bug: 168311203
Test: vts_libsnapshot_test, cow_snapuserd_test

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I4af63845f8c3e1c445f6c55374ea58b6f3454795
2020-11-16 23:59:35 +00:00
Peter Collingbourne be582abd1b Merge "Switch to the new kernel API for obtaining fault address tag bits." am: 2a9da2ae9b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1498948

Change-Id: I8bcff62606e60cb64632c472f463d279be37e457
2020-11-16 23:52:35 +00:00
Peter Collingbourne 2a9da2ae9b Merge "Switch to the new kernel API for obtaining fault address tag bits." 2020-11-16 23:09:19 +00:00
Palmer Dabbelt c16e503faa dmuserd: Simple dm-user daemon
This provides a block device via dm-user, with all accesses backed by
in-memory storage.  It's essentially the same as what I have in
selftests, with the kselftests stuff removed so it'll build in Android.

Test: mkfs.f2fs, dd, fsck.f2fs
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Change-Id: I68515d6e9001c2f6d199d394e67ebe528b382406
2020-11-16 22:23:07 +00:00
David Anderson b7d5f662f7 Merge changes I0cdef3d5,Ib4a281a3,I1569f927 am: 7e3d157019
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1498162

Change-Id: I037b9bb601339b51846736a9eee1b409a9f96962
2020-11-16 21:28:52 +00:00
Treehugger Robot 6187c38e36 Merge "Fix comments." am: 5f5f6a11ef
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1500212

Change-Id: I7fca4d01d2c3bf8e537be957caa10850b6bf0e00
2020-11-16 21:28:19 +00:00
Yifan Hong 87812ab882 Merge "Fix AVB key path again." am: a1ee8cea9d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1497639

Change-Id: I2031e6fb58920a2e315f1be8bc2dc618454b29cf
2020-11-16 21:13:10 +00:00
David Anderson 7e3d157019 Merge changes I0cdef3d5,Ib4a281a3,I1569f927
* changes:
  init: Always create and restorecon /dev/dm-user.
  libsnapshot: Get DaemonTransition test passing again.
  libsnapshot: Move first-stage pid var constant into IDeviceInfo.
2020-11-16 19:53:35 +00:00
Treehugger Robot 5f5f6a11ef Merge "Fix comments." 2020-11-16 19:51:14 +00:00
yawanng 762653bdac iorap: Remove toggling iorapd on/off when using 'start' command.
Bug: 173166524
Test: adb shell stop
Test: adb shell start
Change-Id: I09722380f249405aeeb8a68287828d602313baa2
2020-11-16 18:45:47 +00:00
Yifan Hong 9210ee391d Fix comments.
Test: none
Change-Id: I1f2446ac31d9466ba01cef59079b49815571d6a1
2020-11-16 10:07:16 -08:00
Yifan Hong a1ee8cea9d Merge "Fix AVB key path again." 2020-11-16 18:06:53 +00:00
lijiazi 9fa773746c Ramdisk: add metadata dir in ramdisk
Add the matadata directory for the non-VAB device to eliminate the
following init error logs:
[    1.891172] init: [libfs_mgr]check_fs():
mount(/dev/block/by-name/metadata,/metadata,ext4)=-1: No such
file or directory

Test: dmesg | grep metadata | grep "No such file or directory"

Change-Id: Ie4db10bd3cbc194d05e64ffb954f1956db2321c6
Signed-off-by: lijiazi <lijiazi@xiaomi.com>
2020-11-15 11:10:35 +08:00
Chun-Wei Wang 7c05aa34b5 Merge "Create the rollback directories in init (1/n)" am: 171621a90f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1498100

Change-Id: I617c8e3afc716a0ec5cc762722ebb44c1334f093
2020-11-14 12:11:08 +00:00
Chun-Wei Wang 171621a90f Merge "Create the rollback directories in init (1/n)" 2020-11-14 12:03:28 +00:00
Yifan Hong 5d83d87ee6 Fix AVB key path again.
If device specifies moving AVB keys to vendor ramdisk, but
doesn't have a dedicated recovery partition, install to
vendor-ramdisk/first_stage_ramdisk.

Test: manual
Bug: 156098440
Change-Id: I05a8731236996dda0d1ab3c09828f7dac46f4ac7
2020-11-13 19:08:43 -08:00
Peter Collingbourne ebc78cc852 Switch to the new kernel API for obtaining fault address tag bits.
The discussion on LKML is converging on v16 of the fault address tag
bits patch [1]. In this version of the patch the presence of the tag
bits in si_addr is controlled by a sa_flags bit, and a protocol is
introduced to allow userspace to detect kernel support for sa_flags
bits. Update the tombstone signal handler to use this API to read
the tag bits, update the interceptors in libsigchain to implement
the flag support detection protocol and hide the tag bits in si_addr
from chained signal handlers that did not request them to match the
kernel behavior.

[1] https://lore.kernel.org/linux-arm-kernel/cover.1605235762.git.pcc@google.com/

Change-Id: I57f24c07c01ceb3e5b81cfc15edf559ef7dfc740
2020-11-13 16:08:27 -08:00
David Anderson 1ff7581f53 init: Always create and restorecon /dev/dm-user.
Dynamically creating /dev/dm-user makes it difficult to set an inotify
watch for child devices to appear. It requires having an additional
watch on /dev, and more complicated sepolicy as a result.

Bug: 168554689
Test: full OTA with VABC enabled
Change-Id: I0cdef3d5a953a372446ff4e539a25a7b5314500d
2020-11-13 00:43:01 -08:00
JW Wang 5fc74a490e Create the rollback directories in init (1/n)
/data/rollback-history is used to store deleted rollbacks
for debugging purpose.

Bug: 172644981
Test: Boot device without this, then try to boot with it without wiping.
Change-Id: I79da5190aad455448ccd73fe42abdc79b3649e86
2020-11-13 16:20:00 +08:00
David Anderson 943dd5cff5 libsnapshot: Get DaemonTransition test passing again.
This fixes a number of small bugs in libsnapshot. It also refactors the
handler list a bit. Previously, it was a list of unique_ptrs. Now it is
a list of shared_ptrs to simplify ownership.

Additionally, Snapuserd is now keyed solely on the misc device name.
This allows two identical snapshots to run in the same daemon, with
different control names (a scenario that comes up in the
DaemonTransition test). As part of this change, the two-stage
initialization process has been refactored slightly. The "init" message
sets all the device paths, and the "start" message needs only the misc
name.

Both the init and start messages now validate that no duplicate handlers
exist, and that we're not overwriting any previous thread.

This cleanup also fixes a bug in DmUserHandler cleanup - if a control
device shut down raced with WaitForDelete(), the std::thread object
would delete without a call to detach() or join(). In the new
RemoveHandler(), we now correctly detach() in this scenario.

This also fixes a bug where, if a COW had no partition component (it
only resided on /data), the second-stage transition would fail because
it used the wrong device-mapper name.

Bug: N/A
Test: vts_libsnapshot_test
Change-Id: Ib4a281a3b5fe665c727c7077672e3c6b0b3abdba
2020-11-12 20:41:25 -08:00
David Anderson 3e3159c83e libsnapshot: Move first-stage pid var constant into IDeviceInfo.
This will fail in vts_libsnapshot_test because the pid isn't set (and
even if it was, we don't want to kill any running snapuserd instances).
Rather than start an instance just for the sake of killing it, use
dependency injection instead.

Bug: N/A
Test: vts_libsnapshot_test
Change-Id: I1569f927e018319cf4008673a32d5526573d8d57
2020-11-12 20:41:24 -08:00
Wenhao Wang 450311d91a trusty-ut-ctrl: Make it as binary
Make the trusty-ut-ctrl as binary such that we can put it into
factory image, put it into PRODECT_PACKAGES_DEBUG fro the device.mk

Bug: 152901318
Test: Trusty storage tests
Change-Id: I8229113e7649c25d0a712b2b0964f23c9d41cf26
2020-11-12 16:48:18 -08:00
Treehugger Robot 6e2de1228f Merge "Create a pool of 20 measurement files per library for coverage." am: 13e33f7f80
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1484360

Change-Id: I52f7bb99bf41440ba74d18dbd858cd0ee7ec6384
2020-11-12 20:32:18 +00:00
Treehugger Robot 13e33f7f80 Merge "Create a pool of 20 measurement files per library for coverage." 2020-11-12 19:57:36 +00:00
Devin Moore c21e63ea26 Merge "libutils: add unit tests for invalid utf-8 and utf-16 strings" am: eb85221dcf
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1470423

Change-Id: I5025f3ee9247d4ba9c16bbbbec620b1cc1c8d4b2
2020-11-12 16:29:20 +00:00
Devin Moore eb85221dcf Merge "libutils: add unit tests for invalid utf-8 and utf-16 strings" 2020-11-12 16:05:38 +00:00
Martijn Coenen afe86cc088 Call early-boot-ended from init.
To make sure it's always called after apexd has run.

Bug: 168585635
Bug: 173005594
Test: inspect logs
Change-Id: Iaff175dea6a658523cdedb8b6894ca23af62bcbf
2020-11-12 11:04:34 +01:00
David Anderson d095f410ff Merge changes Ie79ab525,I3befc71f am: 9e6cef7f07
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1493825

Change-Id: Ic2aa475140b5a3d3468d2d6e89453f24eb54f8f7
2020-11-12 01:57:48 +00:00
David Anderson 9e6cef7f07 Merge changes Ie79ab525,I3befc71f
* changes:
  libsnapshot: Refactor COW reading/writing of footers.
  libsnapshot: Don't try to truncate block devices
2020-11-12 01:45:19 +00:00
Akilesh Kailash beb5700648 Merge "libsnapshot: Retrieve base sector for dm-user device creation" am: 70d27113d0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1496842

Change-Id: I9c3d78464ba0f1b8fa7f5f41be1c531cec9a3174
2020-11-12 01:04:56 +00:00
Akilesh Kailash 70d27113d0 Merge "libsnapshot: Retrieve base sector for dm-user device creation" 2020-11-12 00:45:21 +00:00
David Anderson ea79136740 libsnapshot: Refactor COW reading/writing of footers.
This simplifies the footer and label resume system for COW files.
Previously, a footer could be missing, and we'd try to recover the file.
Any ops we could recover were handed off to the CowWriter, which then
searched up to the correct resume label.

In the new model, a reader is opened with an optional label (resume
mode), or without a label.

When resuming to a label, a footer is optional. The read is terminated
by EOF, discovery of the requested label, or the presence of a footer.
However the requested label must be found, and parsing fails if it is
not found.

When opening a COW without a label, the footer must be present, as this
signals the file was successfully flushed. Parsing fails if no footer is
found.

Bug: N/A
Test: cow_api_test
      full OTA with VABC
Change-Id: Ie79ab5259f532dd16c72f0e42da7568c5c5c4623
2020-11-11 15:51:15 -08:00
Daniel Rosenberg ce69f2985b libsnapshot: Don't try to truncate block devices
When we're writing to a block device, we can't truncate. Ignore those
commands. Truncate mostly just saves time in the read phase by chopping
off unused data in the event finalize wasn't called.

Bug: 172026020
Test: cow_api_test
Change-Id: I3befc71fa9597edf8243d0f9e17440db91409aea
2020-11-11 15:49:18 -08:00
Oliver Nguyen ca54a7b7a6 Create a pool of 20 measurement files per library for coverage.
Reduces disk space usage for commonly used libraries by merging coverage
data across processes.

Bug: 171338125
Test: Forrest run of coverage tests
Change-Id: I2b9e94871fc5d66971c5b7e725b296bcd721ccf2
2020-11-11 14:55:58 -08:00
Akilesh Kailash 8ec3fa8aba libsnapshot: Retrieve base sector for dm-user device creation
dm-user device requires sector information which is retrieved
from snapuserd daemon once the metadata read is completed.
Split up the initialization of daemon into two APIs. Once
the metadata read is completed, send the sector information
back to libsnapshot to create the dm-user device.

On a sidenote, remove unused code from snapuserd_client

Bug: 168311203
Test: vts_libsnapshot_test, cow_snapuserd_test

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I0647ebbeea3a4705599966974bfec2318a3e1e4e
2020-11-11 22:40:49 +00:00
George Burgess IV adafe20222 Merge "fs_mgr: fix potential uses of nullptr" am: 3d0f195bcc
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1493826

Change-Id: If6aebba378be30981abbc5bed0bd5b952e1899c2
2020-11-11 22:31:42 +00:00
George Burgess IV 3d0f195bcc Merge "fs_mgr: fix potential uses of nullptr" 2020-11-11 22:02:29 +00:00
Steven Moreland 2f58202b7d Merge "Add @SensitiveData to GateKeeperService" am: 99ed2152de
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1484363

Change-Id: I70e0196a7586c598d0cc95a4e2201e6ebb8ae635
2020-11-11 17:16:01 +00:00
Steven Moreland 99ed2152de Merge "Add @SensitiveData to GateKeeperService" 2020-11-11 16:17:19 +00:00
Akilesh Kailash faea3f2e6d Merge "libsnapshot:snapuserd: Snapshot merge support." am: d29c2f5dbc
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1490701

Change-Id: Ifb35162b092cc6f0df6433e05d96b5785e1d6b6a
2020-11-11 01:20:52 +00:00
Akilesh Kailash d29c2f5dbc Merge "libsnapshot:snapuserd: Snapshot merge support." 2020-11-11 01:04:23 +00:00
Yo Chiang 7917c5f5f6 Merge "Use default DSU slot name when active DSU is empty" am: 26f47f8815
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1492276

Change-Id: I66f2383874860eef1172c6adefef13bb2ee70b17
2020-11-10 10:59:54 +00:00
Yo Chiang 26f47f8815 Merge "Use default DSU slot name when active DSU is empty" 2020-11-10 10:24:00 +00:00
Jaegeuk Kim dfcebcd845 Merge "fastboot: add casefold/projid/compress options" am: 0a71c0e38c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1489380

Change-Id: I62ba5acab1a8ad1361793edc1e080d500f61a90c
2020-11-10 08:24:53 +00:00
Jaegeuk Kim 0a71c0e38c Merge "fastboot: add casefold/projid/compress options" 2020-11-10 08:08:17 +00:00
George Burgess IV 1c8d814cea fs_mgr: fix potential uses of nullptr
Clang's static analyzer flagged the following potential null pointer
dereferences. Looks like a transitive caller of this function has

```
if (change) *change = foo;
```

...and no nullness checks between that and these unconditional
assignments to `*change`.

> system/core/fs_mgr/fs_mgr_overlayfs.cpp:1100:13: warning: Dereference
of null pointer (loaded from variable 'change')
[clang-analyzer-core.NullDereference] >
system/core/fs_mgr/fs_mgr_overlayfs.cpp:1167:17: warning: Dereference of
null pointer (loaded from variable 'change')
[clang-analyzer-core.NullDereference]

Bug: None
Test: TreeHugger
Change-Id: I656e3b0f56b18ec3ca3d1db773feb81adf163122
2020-11-09 22:24:37 -08:00
Kiyoung Kim ef6affe07f Merge "List up libraries with system dependency in the configuration file" am: f81058343d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1468962

Change-Id: I81e17fc8373b1b66568dc5af985aac7afc004ea1
2020-11-10 06:08:52 +00:00
Kiyoung Kim f81058343d Merge "List up libraries with system dependency in the configuration file" 2020-11-10 05:49:35 +00:00
Akilesh Kailash 6dce4c47c5 Merge "libsnapshot:snapuserd: Read the cow_operation in reverse order" am: 3e64e2ba25
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1490700

Change-Id: I8f84cdeba459c6b7cd0957b22cdd75ea4cc2b0df
2020-11-10 04:06:54 +00:00