Commit graph

116 commits

Author SHA1 Message Date
Jooyung Han
2f814176ea Add dm-thin support
thin-pool and thin targets are supported via DmTargetThinPool and
DmTargetThin. DM_TARGET_MSG is also added via a new method
SendMessage() because it's used to create a thin volumn.

dmctl is extended to support thin-pool and thin targets.

TODO: thin-pool target constructor can accept feature arguments.

Bug: 327081431
Test: atest libdm_test (CF with dm-thin enabled kernel)
Change-Id: I4c51c668bfe1489b959f6d03c205a5e2e63d9a1d
2024-04-03 10:47:47 +09:00
Treehugger Robot
0b671f4432 Merge "dmctl: add report of IMA" into main 2024-03-18 16:59:31 +00:00
Jaegeuk Kim
9459f7c09c dmctl: add report of IMA
This adds an option "ima" in dmctl.

$ dmctl ima product-verity
Targets in the device-mapper table for product-verity:
0-7463768: verity, target_name=verity,target_version=1.9.0,hash_failed=V,verity_version=1,data_device_name=254:4,hash_device_name=254:4,verity_algorithm=sha256,root_digest=d7af9fcb04d184219ba5477b97bb2bbc89fd23a46e03d1dea31d674cc4934769,salt=19d4f2345adfc8b7cc22a3c2f21dd413e5020fc7920a08a33f46f3c61492dfcc,ignore_zero_blocks=y,check_at_most_once=n,verity_mode=restart_on_corruption;

Change-Id: I057970b6c786b3f9a394b4919f5f5115b27cbc08
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2024-03-15 16:34:20 -07:00
Ed Tsai
43de4ef22d Support for striped in libdm
Add dm stripe in dmctl framework to support stripe on two block devices.

Bug: 321628121
Change-Id: I2f326f19f7ccff1ee03598743022fb702b3e8d6a
Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
2024-02-23 08:11:30 +08:00
Nikita Ioffe
5ff9025ae1 dm_test.cpp: DeleteDeviceWithTimeout asserts that unique path is deleted
Before this patch, DeleteDeviceWithTimeout was checking that the dev
node (i.e. /dev/block/dm-XX) is deleted after the call to DeleteDevice
API. Since ueventd first deletes the symlinks that correspond to a
device and only then deletes this device node, this assertion introduced
a race condition (DeleteDevice API waits for the symlink to be deleted).

This patch changes the DeleteDeviceWithTimeout test to check that unique
path of the device has been deleted.

Bug: 318425605
Test: presubmit
Change-Id: I3fd9de507c75bcf6ac1350fa0b8adfdb5a2e89e8
2024-01-08 11:25:45 +00:00
Jaegeuk Kim
a720fe785c Use target device mapper given mapper target
Let's translate /dev/block/mapper for dm libs.

Bug: 311084775
Change-Id: I23666c5590a15652192e004e1990edd73b7a8df8
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2023-11-15 13:08:39 -08:00
Jiyong Park
e09de2a5ca libdm: don't expect uevent for devices that have never been activated
Previously, libdm ensured that uevent will be generated when a dm device
is deleted. However, there actually are cases where uevent can't be
expected; for example, if an empty dm device is created, but then gets
deleted without being activated, then there should be no uevent upon
deleting because there actually is nothing to remove from /dev. (dm
device gets added to /dev only if it is activated).

Actually such a case exists in apexd. As a performance optimization, it
proactively creates empty dm devices for all APEXes it scanns. But
some of them don't ever get activated if the APEX is already in a
dm-verity protected block device (i.e. the pre-instaled APEX is the
latest one). In that cases, the empty dm devices are deleted at the end
of the boot process as a clean up.

The libdm triggered error during the clean up, because there was no
uevent generated for the empty dm devices. This has triggered a lot of
false alarms to the apex team.

This CL fixes this by ensuring uevent only for activate dm devices. If
the dm device doesn't show up in /dev, we just delete the in-kernel
object and don't expect it to generate uevent for it - which actually is
the kernel's behavior.

Bug: 286176029
Test: build and run aosp_cf_x86_64_phone. observe dmesg.

Before the change:
I apexd   : Deleting unused dm device com.android.hardware.core_permissions
E apexd   : Didn't generate uevent for [com.android.hardware.core_permissions] removal
W apexd   : Failed to delete dm-device com.android.hardware.core_permissions

After the change:
I apexd   : Deleting unused dm device com.android.hardware.core_permissions
<no error or warning logs>

Change-Id: I52042de7d4d9ab62e6a13428c32a67e13395d1b5
2023-06-22 00:43:32 +09:00
David Anderson
59abbfe647 ueventd: Fix a race condition in handling device-mapper events.
We've had flake in libdm_test for a long time, with no clear cause.
Lately however it has become particularly reproducible when running
the UeventAfterLoadTable test in isolation, and thus we've identified
the root cause.

uevents for device-mapper are fired when the sysfs node is added, but at
that time, the "dm" subnode has not yet been added. The root node and dm
node are added very close together, so usually it works, but sometimes
ueventd is too fast.

Instead of relying on sysfs, query the uuid/name node directly from
device-mapper.

Bug: 270183812
Test: libdm_test
Change-Id: I258de5de05d813c3cb7f129e82e56dbfe8bf3117
2023-05-17 15:52:16 -07:00
Mitchell Wills
2da7808bad Fix the return values of DmTable::valid to match the expected type
Test: make libdm
Change-Id: Id2be81eafe5168be9bfb37a5bcabfbdba3de8fa7
2023-05-08 13:26:35 -07:00
David Anderson
09545d1454 Merge "libdm: Remove dm_linear_fuzzer." 2023-01-25 18:05:25 +00:00
David Anderson
b888430f15 libdm: Remove dm_linear_fuzzer.
This fuzzer can only mutate the numerical inputs to a dm-linear table,
which is unlikely to find kernel bugs, and very unlikely to find libdm
bugs. There are a number of automated notifications from it due to
making ASSERT_EQ a no-op, which causes misuse of libdm API calls. None
of these appear to be real bugs.

Bug: 174907083
Test: N/A
Change-Id: Iaa8955eaa4423e4315b8cb74741e6425a56cc303
2023-01-24 21:37:18 -08:00
David Anderson
f723ef3043 Merge "libdm: Fix failing test on older kernels." 2023-01-24 23:51:08 +00:00
David Anderson
717b97a201 libdm: Fix failing test on older kernels.
This test was added only for behavior introduced in the 5.15 kernel, where uevents are delayed until a table is laoded.

Bug: 263291020
Test: libdm_test
Change-Id: I6236c4304d8e6b780704df405290f7361d5827cc
2023-01-24 05:20:57 +00:00
David Anderson
6433d16543 libdm: Add a helper function for creating placeholder devices.
Bug: 259328366
Test: device boots and mounts userdata
Change-Id: I7aced2eeca984e8ec69633c25d44cd411d0a0583
2022-12-14 21:56:45 -08:00
David Anderson
d6bf86b8cf Support sysfs changes in the Linux 5.15 kernel.
DM_DEV_CREATE no longer creates sysfs nodes. Note this in ueventd and
add some helper APIs to libdm, so devices can be created with a
placeholder table.

This also fixes a bug in dmctl where the detailed info on suspended
devices was wrong.

Bug: 259328366
Test: dmctl with "uevents" tool
Change-Id: I822f8010e48d32841aa0ee508822f76d03a3dd85
2022-12-08 16:22:47 -08:00
Colin Cross
5186681f58 Support building fs_mgr against musl
Support building fs_mgr against musl by including the missing
sys/types.h header.

Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: Ie3b3907b1c60ba550c04e8780f11b7adf09a6471
2021-12-16 12:49:33 -08:00
David Anderson
af09c15049 Merge "adds LO_FLAGS_AUTOCLEAR for loop device of zram backing device" 2021-10-07 15:49:18 +00:00
Justin Yun
43678b17a5 Replace test_min_api_level with test_options.min_shipping_api_level
Test options for the api levels are moved to test_options.
test_min_api_level property will be removed with this change.

Bug: 187258404
Test: build
Change-Id: Id943566de2ac693b5955bd84a8463e5013a8bb0f
2021-09-28 20:35:09 +09:00
Liangcai Fan
d884ba5916 adds LO_FLAGS_AUTOCLEAR for loop device of zram backing device
Userdata spaces leak when zram writeback is enable and repeatedly kill
system_server(restart android).
The reason is that per_boot‘s inode is hold by loop device
although per_boot is deleted by user which become orphan inode in system.

Adds LO_FLAGS_AUTOCLEAR for loop device of zram backing device,
so loop device can release resouce.

Bug: 200904398

Change-Id: Ifeee9c0b58b10cdf7698077fbcaf54d5faccc3b1
Signed-off-by: Liangcai Fan <liangcai.fan@unisoc.com>
Signed-off-by: Hongyu Jin <hongyu.jin@unisoc.com>
Signed-off-by: Jing Xia <jing.xia@unisoc.com>
2021-09-26 10:07:50 +08:00
David Anderson
efec0abf4a libdm, libsnapshot: Add a virtual interface for DeviceMapper.
It is difficult to test libsnapshot failures because there is no way to
inject failure scenarios into the kernel's device-mapper. Exposing a
virtual interface will allow this kind of testing via dependency
injection.

Bug: 199785546
Test: builds, tests pass
Change-Id: I5add0c7e24f7fa2853114eaeda7c479eaa4e0552
2021-09-20 22:13:20 -07:00
Bart Van Assche
c24f7b8224 libdm: Export ExtractBlockDeviceName()
Make this function available to libdm users. A caller outside libdm will
be added by a later patch.

Bug: 194450129
Test: mm libfs_mgr libdm_test
Change-Id: I3e3560f3cdef8978eac644d5b53cf3851209c0c2
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-08-12 15:11:48 -07:00
Bart Van Assche
6b296db8e3 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
Change-Id: I6363781163eba08e6128507b403200f472f68a59
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-08-12 15:11:39 -07:00
Akilesh Kailash
a11a338e2b snapuserd: Read partition blocks to memory
When the device is rebooted after OTA is done,
daemon will read through all the dynamic partitions
to bring the blocks to memory. When update-verifier
runs, all the blocks would be in page-cache thereby
cutting down the boot time.

Boot time improvements on Pixel:

Full OTA:
===========

VABC (Without this patch): 37.308 seconds
VABC (With this patch): 28.604 seconds

Incremental OTA:
=================

VABC (Without this patch): 39.072 seconds
VABC (With this patch): 27.523 seconds

We read the blocks only during second stage transition. Thus,
it shouldn't impact when snapuserd is spin up during
post-install phase or during first-stage init.

Bug: 193863442
Test: Full and Incremental OTA on pixel
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Id654449238e22125f7d6288c7100fde512cc2ced
2021-08-04 08:38:10 +00:00
Nikita Ioffe
7756779289 Deflake libdm#CreateEmptyDevice test
Judging from local experiments, it looks like device-mapper doesn't
always generate a uevent after DM_DEV_CREATE ioctl.

Test: presubmit
Bug: 193462349
Change-Id: I8a74375631b20c14a32a41dbaf38380ebc0078e6
2021-07-15 15:33:17 +01: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
79e0890f6d Merge "fs_mgr: support 'check_at_most_once' for dm-verity" 2021-06-15 05:27:34 +00:00
JeongHyeon Lee
14e9a70e7a fs_mgr: support 'check_at_most_once' for dm-verity
Parse the hashtree descriptor of the AVB-protected partitions
and add 'check_at_most_once' option to dm-verity table.

Test: build & check dm-verity table
Test: atest --host libfs_avb_test
Test: atest --host libfs_avb_internal_test -- --test-arg \
      com.android.tradefed.testtype.HostGTest:native-test-timeout:5m

Signed-off-by: JeongHyeon Lee <jhs2.lee@samsung.com>
Change-Id: I226a545aa95e07ebd7096dde18c357ac1ed1241c
2021-05-31 10:43:25 +00:00
Nikita Ioffe
d13cef7435 libdm: Add DeleteDeviceDeferred API
This can be useful in case when a device mapper device can't be deleted
straight away, and instead delete needs to be enqueued until last
reference to the device is closed.

Bug: 187864524
Bug: 188713178
Test: atest libdm_test
Change-Id: Ie8a130baa54e6e16d8d159389bd760bf873eca40
2021-05-26 19:29:07 +01:00
JeongHyeon Lee
9eb1296ea9 Add new dm-verity error handling mode
The latest kernel supports dm-verity has new error handling mode(panic).
However, there is no code to support in android.

Signed-off-by: JeongHyeon Lee <jhs2.lee@samsung.com>
Change-Id: Ib88ec258adb76ca4c88df1a78636f73f40604b40
2021-04-14 09:10:37 +09:00
Bob Badour
d69ad69a93 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Id740a7d2884556081fdb68876584b25eb95e1bef
2021-02-19 12:59:05 -08:00
Elliott Hughes
c3a206ccda Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"
This reverts commit 187b7d1950.

Reason for revert: system/core is multiple projects, not one.

Change-Id: I790ea41741f8cd9b8b6db2f59a49e71fb0958fd6
2021-02-16 20:01:20 +00:00
Bob Badour
187b7d1950 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  Android.bp
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I5bd81adb5cdcf2b4dd4141b204eb430ff526af8f
2021-02-16 04:10:03 -08:00
David Anderson
d1aa4a2996 libsnapshot: Build snapuserd and its dependencies into vendor_ramdisk.
For GKI devices, snapuserd should be in vendor_boot.

Bug: 173463595
Test: manual test
Change-Id: I1df18a2f3f2b67605187f18b4f7b6b3cf4f89674
2020-11-18 22:06:05 -08:00
Nikita Ioffe
3b39a9ef6a Don't SIGABORT if device-mapper doesn't generate uevent for DeleteDevice
It looks like in some rare scenarios device-mapper won't create an
uevent while handling DM_DEV_REMOVE ioctl.

Since failure to generate uevent will result in ueventd not cleaning up
/dev paths in user space, it should be ok to just fail DeleteDevice call
without aborting the entire process.

Test: presubmit
Bug: 171266986
Change-Id: Iece28e6e02c35ac4bf33b9be74dfe1bbbb466bd4
2020-11-06 22:38:23 +00:00
Palmer Dabbelt
eef49c9e3c libdm: dm-user target creation takes an additional argument
Rather than using some implicit naming scheme, we've decided to just let
userspace pick whatever control device naming scheme it wants.  This requires
an additional argument to be passed to the kernel.

Test: cow_snapuserd_test
Bug: 168259959
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Change-Id: Ibf7f378b67abb6ca7457a9fdc9b8739e3d31bee3
Signed-off-by: Akilesh Kailash <akailash@google.com>
2020-10-16 18:16:55 +00:00
Dan Shi
67b7dd570f Remove vts10 related configs
Bug: 169582597
Test: build
Change-Id: I38e1e0f8e32b86ab14b905d040c1c62245a1a9e3
2020-10-06 13:52:44 -07:00
Akilesh Kailash
516ded7320 Support of multiple device partitions by dm-user driver
Add basic support for daemon creation and handle signals

Test: Add test case to test system and product COW partitions
Bug: 162790322

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Icf8dbe49d2237cec6f7dbcdd84256eb6c5afa1cd
2020-09-16 00:35:42 +00:00
Palmer Dabbelt
7dd8fe8e70 Add "dmctl uuid" command
This makes looking up device UUIDs a bit easier, as rather than depending on
the device mapper's sysfs layout we can depend on dmctl.  There's some
associated libdm plumbing, but the UUID was already pretty much availiable.

Test: I just ran this by hand.
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Change-Id: I7028eec6ab04601308047b67057e51a0ff44c0a7
2020-09-15 18:39:39 +00:00
David Anderson
8a11622bca Add experimental daemon for handling dm-user requests.
Right now this is open-coded. As the API stabilizes it will be
integrated into libdm.

Bug: 154536437
Test: manual test
Change-Id: I07bb811b6fb80d85d55e218d788023634c8158b7
2020-07-08 15:46:27 -07:00
Palmer Dabbelt
2def03a2b9 Add libdm and dmctl support for dm-user targets
dm-user is very much a WIP and while this may change (we need to figure out how
to get credentials to the dm-user daemon, for example) it seems like a somewhat
safe bet to assume that the behavior will at least include a start/end range.

Test: I just ran "dmctl create palmer user 0 1024", which created the device.
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Change-Id: Ic5f84de6a4f09bf906246035d450edd637cc38ed
2020-06-26 12:24:53 -07:00
Paul Lawrence
2709331f90 Merge "Set block size in dm-bow" 2020-06-08 17:07:36 +00:00
Paul Lawrence
2f0c6cb0f7 Set block size in dm-bow
Fix block-level checkpointing to work correctly when used in combination with
512 byte hardware sectors and metadata encryption with dm-default-key v2.

Bug: 153512828
Test: Parameter is passed to dm-bow based on first_api_level
Change-Id: Ic0a071221559271db20b06b2f17459b5b041e02d
2020-06-05 07:47:45 -07:00
David Anderson
a212760ec6 libdm: Fallback to legacy ueventd logic if running on an older system.
When delivering single-stage, non-AB OTAs, the updater binary is built
on a newer OS than recovery is compiled with. libdm relies on newer ueventd
behavior which therefore breaks this model. As a workaround, we allow
libdm to fallback to the old ueventd logic if the following conditions
hold true: (1) we're in recovery, (2) the device is not an AB device,
and (3) the release is <= 10.

Since the old ueventd behavior can lead to races in libdm, this fallback
should stay as narrow as possible.

Bug: 156536673
Bug: 155202260
Test: manual test
Change-Id: I7f9da49e4ba8dfe165e0923d9918827d51d090cd
2020-05-28 20:44:31 -07:00
Treehugger Robot
edf8335c72 Merge "Rename vts-core to vts" 2020-04-07 05:11:55 +00:00
Dan Shi
ab8acaedae Rename vts-core to vts
Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL moves all tests in vts-core to vts.
It won't change test logic or behavior.

Change-Id: I24779951257ce37fc18929f214d3cf5f76c23a19
Merged-In: I24779951257ce37fc18929f214d3cf5f76c23a19
2020-04-07 02:48:48 +00:00
Paul Crowley
539b98fb58 Abolish DmTargetDefaultKey::IsLegacy
To make it easier to support disk formats created using old versions
of dm-default-key with new kernels, stop checking the kernel module
version; instead, the caller decides whether to use the old or new
options format.

Bug: 150761030
Test: crosshatch and cuttlefish boot normally; cuttlefish
    fails with "default-key: Not enough arguments" as expected when
    option is set to 1
Change-Id: I810bb7e085b9b8648858de1a02165162d1fd163e
2020-04-05 19:51:14 -07:00
David Anderson
e580566b00 libdm: Link libraries statically for VTS.
Bug: 152180548
Test: 32-bit libdm_test
Change-Id: I9f356c854833b5e68820e4d3d4e9709af1288381
2020-03-25 23:43:22 -07:00
Treehugger Robot
ecfdda2c14 Merge "Convert vts configs to Android.bp" 2020-03-10 05:00:33 +00:00
David Anderson
66147bad94 Merge "libdm: Fix WaitForFile early-returning on failed accesses." 2020-03-10 00:06:09 +00:00
Dan Willemsen
a8f188f011 Convert vts configs to Android.bp
Test: treehugger
Change-Id: Ibe8ed03555ac78ee38be6511eb4169cddfcd3555
2020-03-07 21:21:33 -08:00