Commit graph

469 commits

Author SHA1 Message Date
Armelle Laine
2ea6ecf71d trusty: keymint: rename trusty_ipc_dev property
matching the naming convention for a system service property

Bug: 309007107
Test: launch_cvd --noresume --console=true \
      --extra_kernel_cmdline='androidboot.selinux=permissive' \
      --secure_hals=guest_keymint_trusty_insecure
Change-Id: I7c31f36dcac49d60469de44ce75c9b46a333786e
2024-09-19 14:25:45 +00:00
Arve Hjønnevåg
ced57af116 trusty: keymint/gatekeeper: Pass device name from init scripts
If the ro.hardware.trusty_ipc_dev.gatekeeper (respectively .keymint) property is set, pass it as the device name to the gatekeeper (respectively keymint) HALs.

Test: "setprop ro.hardware.trusty_ipc_dev VSOCK:2048:1" and restart HALs
Change-Id: I0947e532ac70ce1821cec49897f21ca10e1af03e
2024-09-10 04:00:09 +00:00
Treehugger Robot
e57d3f2110 Merge "trusty: Add host build for rpmb_dev" into main 2024-09-09 19:45:16 +00:00
Alice Wang
d694b61591 [km] Include non-secure KM HAL with Trusty VM in /system_ext
Bug: 355194622
Test: launch_cvd --noresume --console=true \
     --extra_kernel_cmdline='androidboot.selinux=permissive' \
     --secure_hals=guest_keymint_trusty_insecure
Change-Id: I1ecdca049cfd6d33caf98f95d1260083bed2c155
2024-09-04 09:29:00 +00:00
Alice Wang
b9b2830c81 [km] Add a new rust binary for non-secure KeyMint host
The new binary sets non-secure RoT for keymint. The non-secure
version will be used on cuttlefish.

Bug: 355194622
Test: CF is gets booted with KeyMint TA in VM
Change-Id: Iff202c6d4bb70dabeb866b4f3fbc18c006bb219e
2024-08-29 11:25:27 +00:00
Stephen Crane
3fa77a15c5 trusty: Add host build for rpmb_dev
Building rpmb_dev as a host tool in soong makes it easy to package for
acloud, rather than building it in the Trusty build system and uploading
that to the remote instance.

Test: m
Bug: 354771029
Change-Id: I3b7f623238957ae3b25524d424025fd08f805657
2024-08-22 21:09:14 +00:00
Arve Hjønnevåg
dfeaa4e32b trusty: libtrusty-rs: Add vsock support
Bug: 298705967
Test: Manual run android.hardware.security.keymint-service.rust.trusty -d VSOCK:2048:1

Change-Id: I2aa5660c3c86fed53420b874de3ef6db9dc22f96
2024-08-07 11:27:27 +00:00
Arve Hjønnevåg
d5359abe11 trusty: libtrusty: Add vsock support
Add support for connecting to a vsock port that multiplexes trusty
services. The first vsock packet contains the tipc port name. To enable
this mode, pass "VSOCK:<cid>:<port>" as the device name string (where
<cid> and <port> is replaced with the cid and port numbers you want to
connect to).

Test: manual - ran storageproxyd and storage test with new option
Bug: 298705967
Change-Id: I9b75244ca38b7eb69ed7fc19b27aa309d0f7ed13
2024-08-06 13:06:24 +00:00
Arve Hjønnevåg
b4158e2599 trusty: keymint: Add commandline option to specify device name
Bug: 300338484
Test: VtsAidlKeyMintTargetTest (emulator subset)
Change-Id: Ibaa89dd0a3db65565101c0a37303c7155f999fb7
2024-07-31 08:21:53 +00:00
Arve Hjønnevåg
31154a9e60 trusty: keymaster: Add commandline option to specify device name
Bug: 300338484
Test: VtsAidlKeyMintTargetTest (emulator subset)
Change-Id: I7ca0a7e72b55fcf9e9b015f68425b67c778aca9e
2024-07-31 08:21:50 +00:00
Arve Hjønnevåg
2fea1dd4ab trusty: gatekeeper: Add device option
Add commandline option to specify the trusty device to use.

Bug: 300338484
Test: VtsHalGatekeeperTargetTest
Change-Id: Ib2ef34dfc104c65119a98937280ae9db74417766
2024-07-31 08:21:47 +00:00
Treehugger Robot
69c7daf1a7 Merge "Add trusty_rkp_set_uds_cert for UdsCert provisioning" into main 2024-07-29 15:53:54 +00:00
Tommy Chiu
5c1378a5ff Add trusty_rkp_set_uds_cert for UdsCert provisioning
Bug: 330791928
Test: trusty_rkp_set_uds_cert /data/rkp_uds_cert_test.xml
Change-Id: I368be346197099ff6d3fe7a09d666791faada040
2024-07-23 15:41:45 +00:00
Mike McTernan
9c77e66d56 storageproxy: set a property when secure storage becomes rw
Bug: 350362101
Test: ABTD
Change-Id: I877a62e5c6337f31ffe63a4fd3cdeb54b69a8ae6
2024-07-18 14:41:43 +01:00
Seth Moore
b1a58e12dd Use shared trusty OWNERs file
Change-Id: I20f118c39927f56890a37eaa059249db5285e59b
2024-05-28 23:00:10 +00:00
Snehal
4334a6320c [Trusty][Metrics] Update struct to add is_crash on the NS side
Bug: 340509044

Change-Id: I4547286c5cefa3caaf1bf1c30f205145fb5e689c
2024-05-17 17:01:32 +00:00
Treehugger Robot
d6f6d0e6e3 Merge "[Trusty][Coverage] Update counter to let Trusty know coverage dump has been read" into main 2024-05-07 19:45:05 +00:00
Snehal
b47c9b065f [Trusty][Coverage] Update counter to let Trusty know coverage dump has been read
Bug: 339194547

Change-Id: I075742200998e837e59ba9c24e4dca8b5d4d1199
2024-05-07 15:07:35 +00:00
Snehal
030dd05027 [Coverage] Fix coverage bug in which extra garbage is being written
Bug: 296356127

Change-Id: I2e4128af461b297bbe170c015dc52899089e9b8b
2024-04-30 14:32:07 +00:00
Donnie Pollitz
4f75b6699c storageproxyd: Fix x86 builds
Background:
* printf format specifiers and size_t literal were invalid.

Bug: 324989972
Test: Builds
Change-Id: I408cfe0d41fb6850d5dcfe9963bb88be48f4a0c6
Signed-off-by: Donnie Pollitz <donpollitz@google.com>
2024-04-22 22:42:54 +02:00
Donnie Pollitz
63ef65c138 Merge "storageproxyd: Add arguments for storage mapping and max file" into main 2024-04-22 18:20:44 +00:00
David Drysdale
8005cfa7e4 Warn that reboot might be needed after setting IDs
Test: compile
Change-Id: Iac93f6a60df7e1a9f89183deabb37e0efc16df91
2024-04-17 16:27:49 +01:00
Donnie Pollitz
636234bebf storageproxyd: Add arguments for storage mapping and max file
Background:
* -f = Allows mapping files in the format `-f file:backing_file`.  This
  can be used for mapping secure storage files like `0` and `persist/0`
  to block devices.  Storageproxyd will handle creating the appropriate
  symlinks in the root datapath
* -m = Allows specifying the the max size constraint for file backed storages.
  The constraint is chosen by giving a file, this allows for passing a
  block device for which a max file size can be queried.  File based
  storages will be constrained to that size as well.

Bug: 324989972
Test: File sizes are restricted as specified, and mappings are created
Change-Id: I8ff550afafbd372288daa9e27c4db3451948b25d
Signed-off-by: Donnie Pollitz <donpollitz@google.com>
2024-04-15 16:26:34 +00:00
Raphaël Hérouart
20c3933ed4 Merge "lib/trusty: tipc-test should not print results to error stream" into main 2024-04-08 11:07:23 +00:00
Raphael Herouart
b238b90a79 lib/trusty: tipc-test should not print results to error stream
tipc-test results cannot be parsed in the CI because they output to
error stream

Bug: 314130383
Test: /data/nativetest64/vendor/tipc-test/tipc-test -t echo -r 1 -B 100
Change-Id: I2d6506fd69af06338041035526ca759884719c7b
2024-04-08 09:13:46 +00:00
Raphaël Hérouart
ef2e67eec1 Merge "lib/trusty: tipc-test suite name is incorrect in JSON output" into main 2024-04-05 14:56:22 +00:00
Raphael Herouart
4f3a4cbc5e lib/trusty: tipc-test suite name is incorrect in JSON output
tipc-test suite should be tipc not crypto

Bug: 314130383
Test: /data/nativetest64/vendor/tipc-test/tipc-test -t echo -r 1 -B 100
Change-Id: Icc0921a032f8b784f4797f43b6180136777f422f
2024-04-05 11:50:42 +00:00
Charisee
0f42bd4a83 Update needed for Rust v1.77.0
error: field `0` is never read
  --> system/core/trusty/keymint/src/keymint_hal_main.rs:40:24
   |
40 | struct HalServiceError(String);
   |        --------------- ^^^^^^
   |        |
   |        field in this struct
   |
   = note: `HalServiceError` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
   = note: `-D dead-code` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(dead_code)]`
help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
   |
40 | struct HalServiceError(());
   |                        ~~


Bug: http://b/330185853
Test: ./test_compiler.py --prebuilt-path dist/rust-dev.tar.xz  --target aosp_cf_x86_64_phone --image

Change-Id: I79fb9019ba00900508aead414de80edd51f3fa2e
2024-04-02 04:53:01 +00:00
Arve Hjønnevåg
294ba38082 trusty: rpmb_dev: Use socket from init and update init script
Stop creating a socket on a persistent filesystem and use a socket
created by init in /dev/socket/ instead.

Many init script changes to make rpmb_dev.rc usable on cuttlefish.

Test: Build and run aosp_cf_x86_64_phone_trusty_vm-trunk_staging-userdebug
Bug: 309007107
Change-Id: Idc830211b3298d25bbb310dcb7489dd89fe5afc6
2024-03-19 20:02:34 +00:00
Snehal
dfd84433dd [Metrics] Add helper data structures to parse metrics messages
Bug: 323508669

Change-Id: Ic4716dd47168481b6aa780f55d9db1208623b61d
2024-03-06 17:27:57 +00:00
David Drysdale
f28e284141 Drop TODO for flag enablement
Flag control for enabling Secretkeeper is done in the device-specific
makefiles, triggering whether they set SECRETKEEPER_ENABLED:=true

Test: none, comment change
Change-Id: I399d1840519864687aca6c53697317d449eed325
2024-02-21 13:50:12 +00:00
Snehal
f425428c2d Sync tipc.h with one from trusty
Bug: 325069766

Test: Android boot and crasher test

Change-Id: I36244cfb698a81be79c204eb019e1a59b90d2e6c
2024-02-13 18:10:00 +00:00
Jeff Vander Stoep
56aedd5551 Replace use of deprecated logging functions
This is needed to upgrade the android_logger crate from 0.12.0
to 0.13.3.

with_max_level provides the same functionality as with_min_level.
The renaming is admittedly confusing, but the new name is accurate
and it makes sense that they deprecated and then removed the
previously poorly named with_min_level.

See crate documentation [1] and code [2].

[1]: https://docs.rs/android_logger/0.12.0/android_logger/struct.Config.html#method.with_min_level
[2]: https://docs.rs/android_logger/0.12.0/src/android_logger/lib.rs.html#227

Bug: 322718401
Test: build and run CF with the change.
Test: m aosp_cf_x86_64_phone
Change-Id: Ib4fbd486267d30e74e886139846950b066848d43
2024-02-06 12:32:36 +01:00
David Drysdale
073133811e Secretkeeper: require SECRETKEEPER_ENABLED=true
Make the makefile safer by requiring a specific value for the
environment variable that turns on Secretkeeper

Bug: 306364873
Test: TreeHugger
Change-Id: Ic5bb5e7411a19941f58ec8c973104c1e53f3834f
2024-01-30 16:49:13 +00:00
David Drysdale
b077fcce13 Merge "Secretkeeper HAL: support large messages" into main 2024-01-29 14:09:42 +00:00
David Drysdale
81190566f9 Merge "Revert "rpc_binder: Change trusty_tipc_fuzzer to support multiple connections and messages"" into main 2024-01-26 10:15:47 +00:00
Ryan Prichard
49be29ed5b Merge "trusty: clear fuzzer's extra counters directly" into main 2024-01-26 05:13:52 +00:00
David Drysdale
7171c676c0 Secretkeeper HAL: support large messages
The TIPC channel between HAL service and TA has a max message size of
around 4K. Cope with larger messages by using fragmentation and
reassembly for all messages.

Test: VtsSecretkeeperTargetTest
Change-Id: I18cc9a9f6e6b90ab66bc3bcf1972e1a5c5112c89
2024-01-23 10:24:01 +00:00
David Drysdale
9c88c9d351 Merge "Secretkeeper: add Trusty fuzzers" into main 2024-01-18 08:42:27 +00:00
David Drysdale
8867607642 Merge "Initial Secretkeeper HAL service for Trusty" into main 2024-01-18 07:34:16 +00:00
Raphael Herouart
3ae52c45ce tipc-test: Allow tipc tests to be run as benchmarks
Adding one command line parameter -B to allow tipc test to be run as benchmarks.

Bug: 314130383
Test: /data/nativetest64/vendor/tipc-test/tipc-test -t echo -r 1 -B 100
Change-Id: I5cdd643ce6e9e289033180cff433e45f77206729
2024-01-17 16:51:33 +00:00
David Drysdale
b1105589b7 Revert "rpc_binder: Change trusty_tipc_fuzzer to support multiple connections and messages"
This reverts commit 589c8d1e44.

Reason for revert: fuzzer crashes immediately on line 99 as vector is empty

Change-Id: I5e56a94671a43cd131c250d98f7cfae3c96f34ab
2024-01-12 16:21:11 +00:00
David Drysdale
36dfed9476 Secretkeeper: add Trusty fuzzers
Bug: 306364873
Test: initial short run of fuzzers on device, with aosp/2737933 reverted
Change-Id: I00ac6ab2678697d69a71aa3615c580c210772f20
2024-01-12 15:53:11 +00:00
Ryan Prichard
42a3f876ad trusty: clear fuzzer's extra counters directly
The FuzzerDefs.h APIs are internal to the fuzzer and aren't available
when the fuzzer is built with a custom private libc++, so remove the
ExtraCountersBegin/ExtraCountersEnd assertions and inline the array
clearing.

Bug: 175635923
Bug: 303175229
Bug: 315079422
Test: m libtrusty_fuzz_utils trusty_gatekeeper_fuzzer
Change-Id: I1ca9d9867026ff6f8e494ac6026fb1314caab7d1
2024-01-11 12:33:15 -08:00
David Drysdale
8e1c267cdf Initial Secretkeeper HAL service for Trusty
Disabled by default; enable with `export SECRETKEEPER_ENABLED=y` before
building.

Also needs the Secretkeeper TA to be present in Trusty; if the TA is
absent, the HAL service will (repeatedly) fail to connect.

Test: build, VtsSecretkeeperTargetTest
Bug: 306364873
Change-Id: I529013395d0e3afbff4a24b663088adce2a23805
2024-01-11 09:45:20 +00:00
Mike McTernan
5647c0b738 trusty: storageproxyd: fix logging of freed path pointer
Bug: 316859216
Test: build.py
Change-Id: I09557d43cda13e21175ba6fceeb806ec1f9115e1
2023-12-18 11:03:36 +00:00
Mike McTernan
b22e5bcf60 trusty: apploader: fail specifically if app package is 0 bytes
Replace assert with check and log message.  Also log more about the request if DMA heap allocation fails.

Bug: 315283243
Test: boot to home
Test: touch x && trusty_apploader x
Change-Id: Ic075809fd2a6b09d9c4e8dff986709c4deae8fb7
2023-12-07 12:16:09 +00:00
Owner Cleanup Bot
3d37da29e7 Remove marcone@google.com from trusty/OWNERS
This suggested change is automatically generated based on group
memberships and affiliations.
If this change is unnecessary or in error, vote CR -1 and the bot
will abandon it. Vote CR +1/2 to approve this change.

See the owner's recent activity for context:
https://android-review.googlesource.com/q/marcone@google.com

To report an issue, file a bug in the Infra>Codereview component.

Change-Id: Ia8f5d261cbfc7328c7dffa0bdf92a5732ba3eee8
2023-11-30 16:37:53 +00:00
David Drysdale
9d6d134e44 Merge "Add tipc fuzzer for KeyMint/Rust" into main 2023-10-19 08:31:09 +00:00
Kalesh Singh
d469fdcd93 Merge "trusty: Remove explicit page-alignment of mmap and dmabuf allocations" into main 2023-10-12 22:19:26 +00:00