Commit Graph

312 Commits

Author SHA1 Message Date
June Tate-Gans
3ef5eb76d3 Make the README heading a little less overwhelming 2022-11-30 00:16:23 +00:00
June Tate-Gans
d30c056a99 Update the readme in preparation for archival. 2022-11-30 00:15:40 +00:00
Sam Leffler
f9ea7c196e SDKRuntime: overhaul rpc mechanism
Simplify the rpc mechanism and make it more robust. Instead of serializing
the request token at the front of the slice assigned to request arguments,
write the token to the label field of the MessageInfo. Likewise instead
of incorporating the status in the response data return that in the
label field.  This noticeably simplifies the code and properly handles
the case where the receiver fails to map the page frame associated with
rpc (previously it kinda punted, now the caller get a proper status
result). While here extend the request/reswponse enum's to give each
error a distinct value.

Note that requsst/response tokens are passed as raw numbers under the
assumption sender + receiver are on the same machine so are using the
same byte order.

NB: this adds the num_enum crate to handle enum<>primitive conversions.

Change-Id: I536a23c7bddc43c686cc4335f22524debeeedf4f
GitOrigin-RevId: 8a9fa009dc65605b8d160330edcde02dcfa2172b
2022-10-18 15:36:40 -07:00
Sam Leffler
88841cb7a7 DebugConsole: add autostart script support & make uart optional
- make kata-uart-client use dependent on a new "sparrow_uart_support"
  feature; this is needed for headless operation and for platforms
  without a working uart driver
- add a mechanism where an "autostart.repl" file is fetched  from the
  builtins (if present) and passed through the shell; output goes to
  the uart if configured, otherwise the kernel or /dev/nnull
- add a new "source" shell command that interprets the contents of a
  builtins file as console input
- rework the command interpreter to support autostart & source
- move the logging hookup to kata-debug-console so the system builds
  when no uart support is conffigured (need to add fallback to debug
  syscalls in case that works when no driver is present)

Change-Id: I5e6725c93488a48d212dfaca425ede37cbdb72e5
GitOrigin-RevId: 6f360cab71ea103af52e3c68ca240fc16e0f20bb
2022-10-18 15:36:33 -07:00
Sam Leffler
d866234653 kata-shell: fix bitrot in fringe cmds
Change-Id: I89dde4ae42cefafb101a5edf1bbfe02a198eea81
GitOrigin-RevId: 0e979acba0aa8f86d80ca62c0a74c98f01330cc5
2022-10-18 15:36:25 -07:00
Sam Leffler
fed472240d default-uart-client: a fallback io client (mostly) for autostart
Adds a kata-io-compatible client that returns data from a slice and
sends writes to the kernel (if possible) or discards them.  This will
be used for running cli scripts and for platforms that do not have a
uart device/driver.

Change-Id: I84facebf16eb9b6692e872e930db027998dd160f
GitOrigin-RevId: 11a3502fb2f8716f9d1a204519b5e93162274590
2022-10-18 15:36:17 -07:00
Sam Leffler
613d5e8783 kata: add directory for repl scripts
For now therre's just a single empty "autostart.repl" script that's run at boot.

Change-Id: I45e58131cde52fcbed855ebbe5d3ce12c93ba302
GitOrigin-RevId: 9740e9b0fdecf60f4b2c900309cdb467113c3059
2022-10-18 15:36:09 -07:00
Sam Leffler
bf2be62e71 kata-shell: make ml support optional
The "ml_support" feature controls MlCoordinator commands are included.
The "TEST_ML_COORDINATOR" feature is now dependent on "ml_support".

Change-Id: I13e3e0b467f006a564bb2cf4839a11ab8a1b04c8
GitOrigin-RevId: 133e8842848c73644e593ebfd4c9115fde1afd3b
2022-10-18 15:36:01 -07:00
Sam Leffler
a9901bfff9 kata-security-coordinator: move test_mailbox to the real impl
Make the mailbox_api dependency optional so builds without a security
core work as intended. This means users of the fake lose the test_mailbox
shell command but given it was only a test vehicle it should be ok to
require configuring the sel4 feature.

As part of this update the "real impl" skeleton to the current traits.

Change-Id: I2a8628d316cca576d9c5dc579f099e16003a8f19
GitOrigin-RevId: e6232073ed02aa6919ef2ed11a80dee1bcb11872
2022-10-18 15:35:53 -07:00
Sam Leffler
34809a47e1 kata-memory-interface: improve portability
Change-Id: I8b436a32aabbc5e0e57d14680cc7d09f46b7bc30
GitOrigin-RevId: 79e28f7b6f5ac4bb96a2e09f152ac92bb91dc5f7
2022-10-18 15:35:45 -07:00
Sam Leffler
130887a482 kata-shell: improve portability of memory manager test cmds
Change-Id: I1632dcc553a5e4b0e4763ec56bbba2493b21eeeb
GitOrigin-RevId: e5b3fc43438dd8fb4e7404234b47888e7502f1c0
2022-10-18 15:35:38 -07:00
Sam Leffler
91941d0028 kata-shell: remove use of private cpio change
We added Debug formatting of the error status to the rcore-os/cpio crate.
Remove use so this code builds with the upstream crate unchanged (it
was mostly useful during development).

Change-Id: Ibc83fc2201c128ec7362c60afaebba584c7eaecd
GitOrigin-RevId: 4af28c4d281e7ff5e74d8c0a21d0f774b9a1eeb0
2022-10-18 15:35:31 -07:00
Sam Leffler
c584a70fa0 README.md: update for new code drop
Change-Id: I7a8ab421f614b6bfe7c489fb3530a313dfe4ebd0
GitOrigin-RevId: bf4fc91facd437acd45bbce8d575bc5ff2990ee2
2022-10-11 22:25:34 +00:00
Sam Leffler
05b85c780a sel4-sys: fixup MCS-affected syscall wrappers for aarch64
- correct seL4_Recv & co for MCS api difference
- split MCS- vs !MCS-syscall wrappers into separate files
- use split inout handling of src => badge

Change-Id: Iecf7fd50bf1f47f135d7123aad968ef482af671e
GitOrigin-RevId: 769bb4d75ae9efca0de52f273caf8268f3c35b8f
2022-10-06 19:04:55 +00:00
Sam Leffler
b2117c9439 kata: rename kata-sdk-interface to sdk-interface
Rename the cate and functions to better identify things as
application-specific.

Change-Id: Ie4c888f6b0c0b66c2d4cfb6e0fb3b5b1e0b82c48
GitOrigin-RevId: 5ea9e1204023f717bbb63dcc0cf0579c1359e2da
2022-10-06 19:04:47 +00:00
Sam Leffler
cc8e4c65e6 apps/rust: remove debug code that passes a0-a3 to main
Change-Id: I9f86d15e2415d04611bc0533003ed3c6c258442b
GitOrigin-RevId: 3f4481bbc5ce1891caed283304fbba568a872224
2022-10-06 19:04:40 +00:00
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