Commit Graph

296 Commits

Author SHA1 Message Date
Sam Leffler
8abb4dc89d apps/rust: add keyval app to exercise key-value db api's
Change-Id: I298b8eae7f7a0e6646a29b712da359a66533b450
GitOrigin-RevId: 0b1ba4f1294a37ab3a86f82c7454ce8124e32db2
2022-10-06 19:04:32 +00:00
Sam Leffler
8b7c33c565 SDKRuntime: add key-val store api's
Change-Id: Ic25986719bdea04adc989f2ea5d2cedd664017d7
GitOrigin-RevId: 738e0e63de82ec0bda91e1982d32e0922a181184
2022-10-06 19:04:25 +00:00
Sam Leffler
fae20dcd68 apps/rust: add panic test app to test panic!
Change-Id: I4615cdc48996c2d8739a00a4c585d09faf03b63b
GitOrigin-RevId: 9a0041d37df0d9526e29171f4c17d339579a44ef
2022-10-06 19:04:16 +00:00
Sam Leffler
95f8965986 apps/rust: start of sdk runtime support for Rust apps
Rust application runtime support + equivalents of hello & fibnoacci.

Change-Id: Ica9b0d181387f159169cbe5f219d26c96540a56d
GitOrigin-RevId: 0a14b67ddd9b166a8ba5c13bac37a30204deb3b0
2022-10-06 19:04:10 +00:00
Sam Leffler
d0d46c89e1 SDKRuntime: plumb application access
Setup a connection to the SDKRuntime for each application. To do this
add an SDKManager interface to the SDKRuntime for the ProcessManager to
obtain a badged endpoint and install that in each application's CNode.
SDKRuntime now rejects requests received without a registered badge.

RPC's are handled entirely in Rust (no CAmkES). ProcessManager sets up
RPC resources and delivers them to an application through registers.
The application-side SDK runtime uses the resources to marshal RPC
parameters in a page that is attached to the IPC buffer sent to the
SDKRuntime. Reply parameters are written to the shared page and decoded
on return.

Overhaul the SDKRuntime api to be like SecurityCoordinator to consolidate
parameter marhsaling/unmarshaling and to simplify adding new methods.

Rust applications use the SDKRuntime interface directly. C application
will wrap a C interface around the Rust impl (TBD).

Specific changes:
- add SDKManagerInterface
- sel4bundle now plumbs a connection to the SDKRuntime, the CNode slot
  with the capability is passed to the application to future-proof CNode
  setup changes (an alternative is to use a global const since we control
  the application-side runtime api's)
- add kata-sdk-manager crate with SDKManager client interface support;
  the only api's are get_endpoint (to get a badged endpoint to SDKRuntime),
  release_endpoint (to remove a badged endpoint), and capscan (to dump
  the SDKRuntime's top-level CNode)
- add "capscan sdk" in the shell to inspect the SDKRuntime service
- make SDKRuntime require a registered badge on inbound IPCs
- fill-in ping & log SDK api's
- connect ProcessManager to SDKRuntime for SDKManager api use,
  everything else happens outside CAmkES
- make SDKRuntime lock against concurrent requests--the SDKManager
  runs concurrently and shares SDKRuntime state
- remove kata-shell test_sdk_* commands (replaced by test applications)

Change-Id: I7810949ad0051ff8eda244e0385f662882a556e4
GitOrigin-RevId: 5fef55428e076f670cff325965047c98d84cfbca
2022-10-06 19:04:02 +00:00
Sam Leffler
48c3e88004 sel4-sys: riscv32 seL4_Recv & seL4_ReplyRecv cleanups
Use separate in+out variables instead of a single r/w variable.
This makes all simular code paths consistent.

Change-Id: I0b78e9cdac881db775b6d08ba1051ebc3f0b096d
GitOrigin-RevId: e12735b6c9c7aba49f60327328baaa6a7fcc7519
2022-10-06 19:03:55 +00:00
Sam Leffler
d25dffb3dd kata-security-interface: guard against sending a random cap
- assert kata_security_install is really sending a CNode
- have kata_security_request clear any unexpected capability associated
  with the ipcbuffer; this mostly guards against a received badge being
  treated as a cap if the ipcbuffer is turned around from recv to send

Change-Id: I8ac6634809aa11f0f249a7be296b43807d56dff8
GitOrigin-RevId: 21930c5f7a5e809460348da0d0b617004e77e065
2022-10-06 19:03:46 +00:00
Sam Leffler
a36368cf63 kata-security-component: minor cleanups
- eliominate direct use of KATA_CSPACE_SLOTS
- simplify some code now that CSpaceSlot::release returns the released slot

Change-Id: I95300c476a514de7cbe9aa08ccba336878149c23
GitOrigin-RevId: 4c1441f44ff1565610c156fb6c1af60fba554904
2022-10-06 19:03:39 +00:00
Sam Leffler
a49dda0ad6 kata-os-camkes: misc additions
- clear_request_cap to clear a request ipbuffer's cap
- debug_assert_recv_path_{empty,cnode,frame}

Change-Id: I25ad559c810fc063d95a4a9c0a15b9dbab9cbf3b
GitOrigin-RevId: ee0af0dc3ab93b555a4f42cdfb8a2b7a6dd92dca
2022-10-06 19:03:31 +00:00
Sam Leffler
4f6df89be3 sel4-sys: purge build-env manifest entry
Change-Id: I2f9e397c80bc1e8a9a23c72d507ea3aa4a13ad25
GitOrigin-RevId: d78f428613467efb30e0d1d7b04f8ad10cc3f298
2022-10-06 19:03:24 +00:00
Sam Leffler
0f00de9795 kata: fix README typo
Signed-off-by: Michael Gielda mgielda@antmicro.com

Change-Id: I8c4fd2bcec1707b3a2d485975f0e0b87d455b617
GitOrigin-RevId: 285c7f5a3e592a3331cf6c0bcd68b0a7d0f2ef7c
2022-10-06 19:03:16 +00:00
Sam Leffler
b113b052e5 kata-os-common: reduce internal dependencies
kata-os-common is an "aggregate crate" used many places where only
a subset of the code is used (esp applicatiions written in Rust).
Reduce internal dependencies to reduce bloat and speed up builds:
- expand the scope of the "camkes_support" feature
- adjust sel4-sys deps that do not require serde support
- add a "capdl_support" feature (default disabled)

Change-Id: Ie1319f1168d37bd6c8f0de8d19708153c7b80dcd
GitOrigin-RevId: a02c4b1a5d6ca26920cba013d9339415b607a2c0
2022-10-06 19:02:25 +00:00
Sam Leffler
7107bef631 sel4-sys: feature-control serde support under "serde_support" (default enabled)
Change-Id: I8852faa0e38e1823c022b0f369f5b83750152e39
GitOrigin-RevId: a96afd065f51335cf85512a8214e81b1bad0410b
2022-10-06 19:02:16 +00:00
Sam Leffler
24975a813e kata-os-cmakes: add get_request_cap
Change-Id: I53ef53d4b75150b67dd06062ac6c0f2d34a339c2
GitOrigin-RevId: f3ad14def755ad21b40a03f9020aa8cf3af39652
2022-10-06 19:02:08 +00:00
Sam Leffler
ecf7592adb sel4bundle: fix application CNode guard setup
Change-Id: Ie53663d223ecc25633cb41c77b1a189570f0a7e8
GitOrigin-RevId: 612dd66db3952d94e25d0e46ca2cdeffec8c2e78
2022-10-06 19:02:00 +00:00
Sam Leffler
5683ba6e20 kata-os-cspace-slot: multiple api changes
- copy_to now take rights
- add dup_to that does a copy with all-rights preserved
- add mint_to
- add mutate_to
- change release to return any assigned slot
- fixup callers

Change-Id: I747c01d426906042e76ba00c19513eae3fa3b03c
GitOrigin-RevId: 7270785dc92ee5ef6b56d330b0076d57dc9374f8
2022-10-06 19:01:53 +00:00
Sam Leffler
bbe49faf65 sel4-sys: fix MCS-affected syscall wrappers for risv32
The seL4_Recv call (as well as related syscalls) have a different api
with MCS; correct that. As part of this try splitting riscv32 into MCS-
and non-MCS-files to reduce cfg usage.

Bug: 247129956

Change-Id: I5f0c0e192e6b366f68b23c14ae26836b4cd14158
GitOrigin-RevId: 4f844e700cb9c13c06c0026b2ea0bd752e6e9fab
2022-10-06 19:01:46 +00:00
Sam Leffler
b446c00783 kata-os-camkes: add debug_assert_slot_frame
Change-Id: I07f272d2a63dc605e26ff93cd089bb56169eea2e
GitOrigin-RevId: 6a5966d52eb634c079bbd5c91a67e3aa500dd27d
2022-10-06 19:01:38 +00:00
Sam Leffler
201876492b sel4bundle: fix handling of segment gaps
Need to account for gaps between application segments when calculating
the index of the page frame object. This was being handled only for a
gap before the first page/segment.

Bug: 243556006

Change-Id: I0e723a58dc5e2b9c49b29aebe030a546bbe024ac
GitOrigin-RevId: 83e6cad536ffa148c434341fbefdce2dd43667ee
2022-10-06 19:01:31 +00:00
Sam Leffler
173e7211c7 Merge "kata-memory-manager: remove dead code"
GitOrigin-RevId: e6f4bd529b9f934e3488cc7c162b4f825511b0a4
2022-10-06 19:01:24 +00:00
June Tate-Gans
6ee08d8b47 Merge "apps: Extract crt0 from C apps"
GitOrigin-RevId: af8b6e41c39a9d5d0b85cb5f7b66d986e1bc3cf9
2022-10-06 19:01:17 +00:00
Sam Leffler
13799ab779 Remove StorageManager.
StorageManager (the component) did nothing useful so remove it and plumb
the only user (DebugConsole) directly to the SecurityCoordinator. When
the SDKRuntime is ready it likewise will talk directly to
SecurityCoordinator. The only visible change in this is the "kvread" shell
command displays the raw key value instead of converting it to a string.

Change-Id: I5a285dc083e5f02ecbf0defc83deebb34a7b38d7
GitOrigin-RevId: 70d04d8155167f9bf3f88291363760d91c10a279
2022-10-06 19:01:09 +00:00
Sam Leffler
fb94ac248a suicide: honor CONFIG_PRINTING
Change-Id: I19d4ac10558ce2e43226661875c9e758e6ea9e5f
GitOrigin-RevId: 25fff914e44565e6acbbf45c7fcc2f4ba08cfe9e
2022-10-06 19:00:58 +00:00
Sam Leffler
58862a4803 kata-os-logger: correctly match types
Change-Id: I55cd8201cc22135cb3dc9bd91011137569223ae5
GitOrigin-RevId: 34cfbff90f1e3243b9f181259876ea307a1ba0d2
2022-10-06 19:00:51 +00:00
Sam Leffler
3d0a31f7b4 MailboxDriver: fix debug build breakage
Need to disable camkes support in kata-os-common to avoid dragging in refs
to SELF_CNODE_* symbols.

Change-Id: I58fc07e79a7cf438342433ef8a8f99a49561392b
GitOrigin-RevId: 6bc8bdd0332197c5191617c7c67d4a425d4a9844
2022-10-06 19:00:43 +00:00
Sam Leffler
186ad6adc3 MailboxDriver: use consistent build options
Change-Id: I64d553bcb4e2669e7ded9e459faf1fbdee7d9881
GitOrigin-RevId: cc890aeadcd8f236e431c53ea8ab4e9d5686784e
2022-10-06 19:00:36 +00:00
Sam Leffler
601e7f5c78 kata: compile-out debug & trace log calls in release builds
Change-Id: Ibde5a49141daa67c57e24340b73b436d08e68e7a
GitOrigin-RevId: 4a77833a6cd3e16850d2e4d90b7e7ed916770b50
2022-10-06 19:00:28 +00:00
Sam Leffler
b099005951 kata-os-logger: support no logging interface connection out of a component
When a CAmkES component lacks an outbound connection to send log msgs
there will be no logger_log symbol. Use a weak ref here to handle that
without resorting to a feature or similar.

Mark logger connections as "maybe" so they are optional.

Change-Id: I6ecd939014d26a612d115741fd2ac673afa40857
GitOrigin-RevId: 0b1bf2611cbb628500cae37889c6547a996d50e9
2022-10-06 19:00:19 +00:00
Sam Leffler
326ec0d6c9 MemoryManager: sort untyped slabs by available space
Change-Id: I3ee5a717c506f8a969dd7e3465ad612863835b7a
GitOrigin-RevId: 4f75f4a24d6a4a72dd4fcf3879bae342eee0ce7d
2022-10-06 19:00:10 +00:00
Sam Leffler
daa3bb819c kata-security-coordinator::fakeimpl: eliminate deep_copy panics
Bug: 243575548

Change-Id: Ie48e8bb4bfcf2fd2284c5822b12b3ace75018a62
GitOrigin-RevId: 92fa86dc4f528c4046dcf2bb635bf7ad0a50551c
2022-10-06 19:00:02 +00:00
Sam Leffler
9dc07abe53 Merge "kata-shell: remove test_bootinfo"
GitOrigin-RevId: ac301ac9646027657db4bdcd43080c8de171c102
2022-10-06 18:59:54 +00:00
Sam Leffler
fe24490359 kata: add a hello test application wrtten in Rust
This hello app uses the logger crate plumbed to the console. Way
bigger than the C version.

Change-Id: I7bf7e8b559fea8e045123d057412493bf7b71a24
GitOrigin-RevId: 97e12e93cc9ebfb4be021cff506417d7434b27f5
2022-10-06 18:59:46 +00:00
Sam Leffler
e95c0bebeb Merge "hello: use ProcessManager-supplied value to setup __sel4_ipc_buffer"
GitOrigin-RevId: cc80eb54acc4305aa54ce884f25b8577fdae2642
2022-10-06 18:59:38 +00:00
Sam Leffler
831a698120 Merge "sel4bundle: pass ipc buffer address"
GitOrigin-RevId: 8d2799961ded3be2393529253ba5d0b5dfafecfb
2022-10-06 18:59:31 +00:00
Sam Leffler
159d64e4ed README.md: fixups
Change-Id: I9dc18155328360922919224455f83c5762789c6c
GitOrigin-RevId: 3fc7b8106de1eaac2601b1f9903951017dcfd01b
2022-10-06 18:59:23 +00:00
June Tate-Gans
1a068b0143 kata: Prepend the Google copyright and Apache 2.0 license
This includes adding it to TOML files and CAmkES assembly files.

Change-Id: I263e7a566df91fccc04f9b2186edab13331290c5
GitOrigin-RevId: 48a35b06ca868a0a4d379f881068cc4dad491669
2022-10-06 18:59:16 +00:00
June Tate-Gans
c0c03fe731 Merge "SDKRuntime: Introduce skeleton implementation"
GitOrigin-RevId: 4c147d204f782881662e3d30b36f848906ae51d3
2022-10-06 18:59:07 +00:00
June Tate-Gans
02e6caec95 suicide: Introduce the fault handler test app
Change-Id: I3dc62dd7131d8f77ff81b44cbe06c675c8e52f04
GitOrigin-RevId: d9313e605ba3d1a9462117980ae14f408398437f
2022-10-06 18:59:00 +00:00
Sam Leffler
ca6153b68c kata: move test apps into a C hierarchy in prep for adding Rust apps
Note this requires companion changes to the build glue.

Change-Id: I5876d3c8b50f373d21d42cf30dbb7031654fb709
GitOrigin-RevId: 963f05fb3c018ad2d509ef68ef37bf83d924337e
2022-10-06 18:58:52 +00:00
June Tate-Gans
f75b87d6b4 Merge "docs: Add in an overview of component construction."
GitOrigin-RevId: a44fb57b60906de7d2549082e2de980f83fd85bb
2022-10-06 18:58:43 +00:00
Sam Leffler
0b528c2a59 Merge "kata: clang-format C test apps"
GitOrigin-RevId: 88ffd6d1d37febf95c606cf51804069ac5efeb50
2022-10-06 18:58:36 +00:00
June Tate-Gans
a5ca02b0e7 cbindgen: Dynamically generate header files during toplevel build
Change-Id: I9e62df409506f9e9e79c984f966b34cf09c1b95f
GitOrigin-RevId: 319803d00536e972f6aa65eacb5c471db97be9af
2022-10-06 18:58:29 +00:00
Sam Leffler
d890571c5e README.md: fix url
Change-Id: Ic3fb2a4c01007d846d7dae7cb06097cfc4138641
GitOrigin-RevId: 5261616892d6772f27a98d0e745393323e12a973
2022-10-06 18:58:22 +00:00
Sam Leffler
a2d5e3f37b kata: add oss materials
- copyrights in code
- more README (mostly copied from manifest/README)

Change-Id: If7c4293bbd52102a9e8039176be4460206aea12f
GitOrigin-RevId: 5d9c70fa5c357c38ae5f1ef601eb06a8039f6974
2022-10-06 18:58:02 +00:00
Sam Leffler
f61d20ef11 Merge "processmanager: add/tweak OSS materials"
GitOrigin-RevId: 89dcfbb2a0c3d2b69a6c15d88ed51ffa21597bf6
2022-10-06 18:57:54 +00:00
Adam Jesionowski
492a4e725d MlCoordinator: Use return information at model_output
Previously we put the return code and fault PC (if any) at the very end
of the TCM. This was always intended to be temporary. The return
information has instead been placed at the beginning of the model_output
section.

Minor changes:
* Running_model tracks the image_id instead of an index.
* Re-ordered ImageSizes members to match layout in memory.
* Rename unpacked_size to in_memory_size to match rest of MlCoordinator
* Fix fake-vec-core to match kata-vec-core

Change-Id: I33ceb59cb36312b60992a6ada49605ffa3b2fa78
GitOrigin-RevId: 5cf399e2c609e0b4ca83101714881b02eb09b94e
2022-10-06 18:57:47 +00:00
Adam Jesionowski
fd7f31bcb2 kata: Integrate Image Manager and WMMU changes
This CL handles the integration of the Image Manager, which comes
concurrent with the necessary WMMU changes needed by the Image Manager.

The ML Coordinator now calls into Image Manager to make space, commit
images, and set the WMMU.

The MlCoordinator now first verifies that an image is valid by first making a pass through the section headers. It stores the two sizes that we're interested in per image: how big it is packed on flash, and how big it is unpacked in memory.

Known issues:
b/241799340: Refactor BundleImage to support unit testing
The writes to DMEM via the kata-vec-core crate was meant to be in image_manager.rs, but this interfered with the ability to run unit tests. We can refactor BundleImage to make this work.

b/241799866: Improve heap management
Right now I clear all of the "temporary data section" (bss, stack,
heap), but I suspect only the heap needs to be cleared. This needs more effort to check that that's correct, and track those locations.

Minor changes:
ImageId is used instead of (String, String) in the component.

Change-Id: I1505c6474fc60205323ce3bb13610fdac3702b89
GitOrigin-RevId: 5df9938a6cbd7ca5510ce8fcb500ce471f42b2cb
2022-10-06 18:57:39 +00:00
Cindy Liu
50cd809320 Merge changes If949288d,I9849065a,I121edee2
* changes:
  kata: LSC: rustfmt with global rustfmt.toml
  kata: update global rustfmt flags
  kata: Promote rustfmt.toml to all kata crates

GitOrigin-RevId: 452e66fa7231f39cff81dc2fbe37ad1a1fc62fb9
2022-10-06 18:57:32 +00:00
Sam Leffler
f33b5b4a9e rust.cmake: add comment pointing to CAmkES setting of --tls-model
Change-Id: I5b2674ef86b9a5c35f441666a9d3ec55cd591f7e
GitOrigin-RevId: 32312f93e053ea0579cb6d98e9fc991ba325ddb2
2022-10-06 18:57:25 +00:00
June Tate-Gans
c8e27dab0a domains: Remove TPA sandbox domain for now
At the moment, the scheduler is wasting 50% of its time in an idle thread for
the application sandbox domain. Until we can figure out how to use these domains
more effectively, we'll reduce to a single domain.

Bug: 238811077
Change-Id: If40d01d5c94e31cc8d522dd5f906f857e363cc42
GitOrigin-RevId: 911f6fe046c61b8ce7e9ba00f8de0ec872997ec3
2022-10-06 18:57:17 +00:00