Commit Graph

240 Commits

Author SHA1 Message Date
June Tate-Gans
be8c32c874 scheduling: Create a secondary sandbox scheduling domain
This updates the kernel configs to setup two domains instead of one,
and also defines a bare-bones domain scheduler that simply round-
robins through the domains.

Bug: 238811077
Change-Id: Ibb49f10265c38dc26235fc246f6147b306055bcb
GitOrigin-RevId: 6b17211d8866bec9207f78dc61c4840c6da9537d
2022-10-06 18:56:23 +00:00
Sam Leffler
ce1543c466 kata: rustfmt
Change-Id: I1edc1d0aa241983fb9336d9bd7e42f2dfa362a15
GitOrigin-RevId: 1a10df3451ce2dfb7d54c6553cfa5d237bf96431
2022-10-06 18:56:15 +00:00
Sam Leffler
05233af12c Add capscan suport.
Add support to output the contents of the top-level CNode of a CAmkES
service or KataOS application to the serial console. This is dependent
on kernel support that is enabled with CONFIG_PRINTING. Applications
must be running; otherwise there is no CSpace to dump.

Specific changes:
- add a "capscan" shell command
- add capscan method to each CAmkES interface
- add capscan_bundle method to the ProcessControlInterface
- add Camkes::capscan() to dump the top-level CNode
- add ProcessManager support to dump the CNode for a bundle

TODO: fix syscall wrapper error return

Change-Id: If6ca222decdb4c40a1d3a63e69792eb3feb30f6a
GitOrigin-RevId: 504c0182ccccf287b5d58cd8e33981c11d7539d7
2022-10-06 18:56:08 +00:00
Sam Leffler
c2accc33b0 MemoryManager: correct initial memory use and add mdebug command
- Use seL4_Untyped_Describe to get an accurate view of each
  UntypedMemory slab being managed; this makes mstats reflect
  rootserver allocations.
- Track memory allocated before we run as "overhead" (was meant to
  track fragmentation but was always zero).
- Add an "mdebug" command to describe each managed memory slab;
  this is useful to see whether the kernel's view of memory use is
  consistent with MemoryManager.

Change-Id: I53b2738c430ad3356ecd16a1cad29ca92dc74beb
GitOrigin-RevId: 2ad43f9b7760c722a6590ea049a3814c8dcccba7
2022-10-06 18:56:00 +00:00
Sam Leffler
a28057ea73 kata-os-model: misc fixups
Fallout from rootserver memory reclamation work:
- add CDL_Object::next_free_slot
- add CONFIG_NOISY_UNTYPEDS feature for spammy debug msgs
- add CONFIG_NOISY_CREATE_OBJECT msgs
- assert if bootinfo/untyped_cnode setup is wrong instead of
  logging msgs and then failing later
- bury ugly BIT usage in is_obj_inside_untyped
- revise handoff_cap api for future use in memory reclamation
- remove some unneeded type coercions
- streamline printing seL4_CPath's
- simplify get_object & get_asid

Change-Id: Ib2c3d717dd41b307cb7afd4821dee4b6be173d57
GitOrigin-RevId: 99f4b79e1df257d373accf96190a77a65ba3305f
2022-10-06 18:55:53 +00:00
Marcin Witkowski
0539aae221 sel4-sys: add isTainted member to UntypedDesc
Change-Id: Id69616f01a6f546e1d4db712092497c5a0367596
GitOrigin-RevId: 11c131a1af0fe1d8b4831a91a3ff5adc757461a1
2022-10-06 18:55:46 +00:00
Sam Leffler
772bd6040a kata-os-model: stop dup'ing TCB's and CNode's
capdl-loader-app duplicated the TCB & CNode caps.  The only possible
reason to do this is if a cap is Move'd (e.g. when constructing the
CSpace for each component) and then later referenced.  But this does
not appear to happen so remove in prep for memory reclamation changes.

Change-Id: I8c9bd1f4f2fa1535da330f782ba978b460b0cf00
GitOrigin-RevId: 7d950dee814705b13b95831b39b7626d4210599b
2022-10-06 18:55:39 +00:00
Sam Leffler
70b4072428 kata-memory-manager: add CONFIG_NOISY_UNTYPEDS feature
Enabling CONFIG_NOISY_UNTYPEDS causes the UntypedMemory slabs received
at boot to be logged to the console.

Change-Id: Ieceedbe17b09c4bb72a2e40e44daa041990019af
GitOrigin-RevId: b5f598cac4302e24b501a8df0c6e0c194b27b991
2022-10-06 18:55:32 +00:00
Sam Leffler
bb7e82468f Merge "Fix CONFIG_PRINTING handling by test applications."
GitOrigin-RevId: 1ea1b3b4e0c7a4d1d817ac1e2ef3939d2b2200b3
2022-10-06 18:55:24 +00:00
Adam Jesionowski
92dc1019be Complete image_manager.
The ML Coordinator will validate the cpio model and collect the fsize
and msizes for each section. It will then pass that information along
with a Boxed version of the bundle_image, which implements the
kata_io::Read trait.

This CL adds the lower level (vec-core) function that writes to the TCM and
calls these functions from the image_manager.

Complete integration of the image_manager is pending splitting the ELF
image into all 6 sections.

Change-Id: I7a5706c588867b4aee04109e2a9edeca071d2ca8
GitOrigin-RevId: 89df1c81bade3ec4508f643a8ba83cae6a3e1f60
2022-10-06 18:55:17 +00:00
Adam Jesionowski
cbe333e2e3 kata/processmanager: Merge ITCM and DTCM into TCM.
For now we treat the image as one big block. A follow up CL will break
it into individual sections like text, model_output, etc.

Change-Id: I86006fc18c940f04f4d15ec032f9196c01255170
GitOrigin-RevId: 7f36043202bca8994f62ced3338b4ba4b1ef922a
2022-10-06 18:55:10 +00:00
Adam Jesionowski
d90b2c173e Partial implementation of Image Manager.
kata-os-common prevents unit testing, so we need to split up
functionality so that other logic can be unit tested. To this end this
CL adds:
kata-ml-shared: structs used in other crates that don't require
kata-os-common
kata-ml-support: logic like image manager that is unit testable

Image Manager is responsible for managing the images loaded onto the
VC's TCM. It tracks pointers into the TCM, which image is loaded where,
and unloads images when space needs to be made.

Change-Id: Icdda9a284b4de7448e8661bb8647e9e6d39e652e
GitOrigin-RevId: cfb65a1dd29d1279aa8ab6c9bf41d5f20206ef68
2022-10-06 18:55:03 +00:00
Sam Leffler
0d82a88f84 MailboxDriver: clippy findings
Change-Id: I116cce53a531915916d0a3509f3324e9694b1293
GitOrigin-RevId: a816c6ea0d3ca42cfc75d5b88cf7795fb99b63f6
2022-10-06 18:54:55 +00:00
Sam Leffler
c70ed4f3e3 MailboxDriver: purge unused stuff
Looks like stuff from when the mailbox test code was in the driver got
left behind; remove it.

Change-Id: I379a58e1fd46895436ed49f780e643efbed81aea
GitOrigin-RevId: 1783642a34ed4f23e7d6703e5e6d041785c1ee4a
2022-10-06 18:54:48 +00:00
Sam Leffler
7bef3289dd Reduce CAmkES per-component heap allocation.
Set the per-component static heap size to 8KB. The heap is only used by
CAmkES RPC for marhsaling dynamic array & string parameters. We mostly
use the former and no more than 4KB at a time so 8KB should be fine until
we can redirect C use to the Rust heap allocator (or replace the C code).

BUG=224069025

Change-Id: I600854c5cb41ed268087f4b2294b70c3384973c2
GitOrigin-RevId: 177a353e6873f2c048cf4b446114534d9dcffc94
2022-10-06 18:54:41 +00:00
Sam Leffler
c4c0e01765 kata-slot-allocator: update bitvec dep to v1.0
With the newer rustc we can switch to the stable version of bitvec;
this includes some api changes.

Change-Id: I9a7af5c2699f9bdebedc06ee68f5e3b7b71b9d75
GitOrigin-RevId: 44d44f930e8b35830d819949b6203c584fea2be3
2022-10-06 18:54:33 +00:00
Sam Leffler
02e1b40885 OpenTitanUARTDriver: fix missing unlock
Bug: 233102476

Writing >CIRCULAR_BUFFER_CAPACITY bytes to the uart will hang because
of a missing unlock of the tx_mutex.

While here add a shell test command that was used to debug the issue
(but don't enable it by default).

Change-Id: I3e35001a653fe2659fb1534e4100727b69f662a1
GitOrigin-RevId: 550b35c88328dcbd1f87dd8e0209b1faabf7f931
2022-10-06 18:54:26 +00:00
Sam Leffler
4ca13e9088 DebugConsole: add features to set initial logging level
Add features to control the log level used before reaching the shell
prompt (where the "loglevel" command can be used to control log
filtering).  The default log level is Info. LOG_DEBUG forces it to
Debug. LOG_TRACE forces it to Trace (max).

Change-Id: Ic55eaf3cd08fc101c53319b5a45a2c7de6f94a66
GitOrigin-RevId: 5500ac5d65186773d5304a75d03295e09b2e9a63
2022-10-06 18:54:19 +00:00
Cindy Liu
c9f36f4da8 Merge "Changes for updating the toolchain to nightly-1.58.0"
GitOrigin-RevId: 6eadbd3c3652d88b3079635f2649b43e370fe4bd
2022-10-06 18:54:11 +00:00
Sam Leffler
7a412467ac DebugConsole: reduce heap size to 16KB
Now that there's MemoryManager integration for zmodem uploads we no longer
need an outsized heap; make it 16KB for now (likely can be smaller).

Change-Id: I3b991ef794c0e718934d055e41aef9abc48b1d6b
GitOrigin-RevId: 7145b14fca96f59ff76497be29da6b1f447c15b0
2022-10-06 18:54:04 +00:00
Sam Leffler
f28da794b2 kata-os-model: CONFIG_NOISY_INIT_CNODE cleanup
Using cap_identify only works on Debug builds; instead print the CDL
cap type.

Change-Id: Ie338877ca12e404f412a7c9b170e1897bfd5d0df
GitOrigin-RevId: fe8a143353b43f18a1b6606b88ef0ba1799adcb8
2022-10-06 18:53:56 +00:00
Cindy Liu
70b86c9c84 Update the cbindgen toml to re-enable clang-format check
Change-Id: I826b172087a09111c4f9934794f2a5c9e195e1ad
GitOrigin-RevId: ed65bc8643bf5e909760dc632d856048e8aace62
2022-10-06 18:53:48 +00:00
Sam Leffler
b2bd86e43b kata-security-coordinator::fakeimpl: correct LoadModel & LoadApplication
Change the fake to behave as the real impl will for LoadModel &
LoadApplication: return a deep copy of the saved package contents as
would happen if the data were pulled from flash. Match this behaviour in
the kata-shell SecurityCoordinator test commands and the MlCoordinator
by taking ownership of the received objects and free'ing them when no
longer needed.

With these changes one can install a bundle and repeatedly load_application
without leaking any memory, capabilities, or slots in the toplevel CNode
of the caller (DebugConsole in this case).

Likewise doing install of a model, test_mlexecute, and then uninstall
of the model's bundle returns all resources.

Specific changes:
- correctly release resources in kata-shell load_application & load_model
- correct release of bundle_frames in seL4BundleImpl::stop
- release resources in MlCoordinator::load_model
- connect the MemoryInterface to the MlCoordinator so it can return memory
- setup two copyregions in the SecurityCoordinator to do the deep copy
- add ObjdDescBundle::cptr_iter for iterating over the set of seL4_CPtr's
- hack kata_frame_alloc_in_cnode to split requests according to the
  kernel's config on the max Retype count
- while here switch test_mailbox to use one of the copyregions

TODO:
- deep_copy allocates all frames at once which requires a band-aid;
  either hide that in MemoryManager or maybe allocate a page at a time

Change-Id: Ia425976b31ea7a32b1d0e4affc3a0ef9ba966c87
GitOrigin-RevId: 31d5bc99b569a5eab9c33c7e1014793bfe57161e
2022-10-06 18:53:33 +00:00
Sam Leffler
272c18cf9b kata-proc-manager: small code shuffle
Move the container slot release up as it logically belongs with the
seL4BundleImpl construction. This makes clear it's unrelated to the
actual start operation.

Change-Id: Idda2a4a829fe6fae2a4d1dbe99aff495ef10b3b8
GitOrigin-RevId: ba2cdc9f4bfb54cfbeca11888bd31cd5657d0182
2022-10-06 18:53:15 +00:00
Sam Leffler
b0d1b6efac kata_object_alloc_in_cnode: misc fixups
- optimize CNode size calc
- remove an extranous map_err that hid the true error

Change-Id: I63a43dff7c242d49f2f968abdde4134ac300d0b1
GitOrigin-RevId: 9e8e9ec4b3bb33dca53ee45aed231836dec7d6e4
2022-10-06 18:53:04 +00:00
Sam Leffler
9920153e10 kata-memory-component: add debug asserts for attached capabilities
Change-Id: I1ef3fa98583a7ac59269d8c3aa15c886a0d8b768
GitOrigin-RevId: 815a4358d6516986e57dc2987f3a9ade46cbffb6
2022-10-06 18:52:45 +00:00
Sam Leffler
393a7653e7 kata-os-camkes: wrap reply ipc buffer capability handling
Add Camkes::set_reply_cap and Camkes:set_reply_cap_release to attach
an seL4 capability to a reply message. The latter ensures the attached
capability is deleted after the seL4 rpc reply is done (this happens
inside the CAmkES C code).

Change-Id: I42fad2e70e6c02fcc0de5ab9a460c5a773041900
GitOrigin-RevId: 7f59e75b10697501a217f943672a40ff67f48229
2022-10-06 18:52:29 +00:00
Sam Leffler
0d27b4a3f0 kata-os-camkes: wrap request ipc buffer capability handling
Add Camkes::set_request_cap to attach an seL4 capability to an outbound
ipc message. The return value is an RAII wrapper that cleans up state
and must be held until after the CAmkES rpc call completes

Change-Id: I0672c59e0b5e43e39c9ea3fb16809270a33f51ef
GitOrigin-RevId: 56be13a2c05fcc1b4a1aa5c8e0eab47bcd0f2345
2022-10-06 18:52:18 +00:00
Sam Leffler
67442dc8f0 kata-os-camkes: export C bindings for better CAmkES integration
In particular this exports the CAP_RELEASE flag so there is a single
source for it's definition and KataOS-specific support in the CAmkES
templates is enabled only for KataOS components.

Specific changes:
- adds cbindgen-generated CamkesBindings.h
- adds include of CamkesBindings.h in component cbindgen files
- add a dep on cbindgen.toml in all Makefiles
- update generated interface files

Change-Id: Ib6239d3ac0036b7a04bb36afccf25a05737b0e56
GitOrigin-RevId: af10117fa253f0c7c67969a5852ced9d992c6274
2022-10-06 18:52:07 +00:00
Sam Leffler
f67ae5616c kata-os-common: add delete support to CSpaceSlot.
CSpaceSlot: :delete deletes any seL4 capability in the slot.
Change-Id: Id59d0b27f231c83d146b2380939ea581363fb9b3
GitOrigin-RevId: 0469f75f5e14366444f2e9e4f6c3db9fc69e2f23
2022-10-06 18:51:58 +00:00
Sam Leffler
060c47e382 kata-os-slot-allocator: add optional tracing msgs
Add debug msgs gated by a new "TRACE_OPS" feature. Messages are prefixed
by the Camkes component name since each component may have an allocator.

Change-Id: Id278bd489a0bedd532f5508c3ebe0101fc749f2c
GitOrigin-RevId: f09b0093eac1fd21ac2523808ee3d67a444abeb3
2022-10-06 18:51:50 +00:00
Sam Leffler
acf7c28eba kata-os-common: add CopyRegion support.
Move the CopyRegion support to kata-os-common. CopyRegion wraps a
CAmkES copyregion virtual memory window to support virtual access to
physical page frames. There is RAII cleanup to clear any virtual mapping.
Embedding a CopyRegion in struct that may be cloned is not recommeded
(at least for now).

Change-Id: I7fd465fafa4a5d1de9a7e565ecb62c38a3b7e81a
GitOrigin-RevId: f58e973b1c47ec05e48bfedcb9cd5e75b71c212a
2022-10-06 18:51:40 +00:00
Sam Leffler
f70a9af73f Remove unused LogFibonacci component.
This is now an app that can be loaded at runtime so remove the component.

Change-Id: Ibb851a64902e69322465fc729cf6d1876ae7943b
GitOrigin-RevId: b534499935f32dd7d7529af86dd5ee0843d9579a
2022-10-06 18:51:33 +00:00
Cindy Liu
51356cd868 kata:rust: Point the rust version to KATA_RUST_VERSION
So we don't need to maintain the version at two places.

Change-Id: Ibbbb9b7744bdd4e209404bf744e2f57e0022db7a
GitOrigin-RevId: 7583eaba9d5364e6c47ede3e5fed4505c73ae790
2022-10-06 18:51:25 +00:00
Cindy Liu
ae9476aa3b kata: pin indexmap crate version to 1.8
indexmap is a dependency crate of serde_ymal, which only loosely
specifies the major release version of indexmap. indexmap > 1.9.0
requires a newer version of Cargo (> 1.56.0-nightly). We can pin
the indexmap version to avoid updating the Cargo toolchain.

Change-Id: I66abb47ca58d081bb1dfe423ccb06b46859fd03e
GitOrigin-RevId: 77428ed6927a9634ccea4d644a221b835c4e6592
2022-10-06 18:51:17 +00:00
Austin Appleby
2b0dd2eb8b Merge "Add basic mailbox driver camkes component + a test script in DebugConsole."
GitOrigin-RevId: 687148fc664b922d3b04ba8a8397fa0f5ff79e29
2022-10-06 18:50:58 +00:00
Adam Jesionowski
8800dc4a96 Merge "Refactor kata-vec-core and add fake-vec-core"
GitOrigin-RevId: 96f07ab9323932ee3b06da58367a5b95a4d7718b
2022-10-06 18:50:46 +00:00
Sam Leffler
3992cc998a Add hello & fibonacci applications for testing.
Two sdk-less applications modeled after minisel:
- hello: prints arguments to the console and loops
- fibonacci: calculates fibonacci #'s, printing state to the console
  every second

You can start multiple fibonacci apps to verify multi-tasking.

Change-Id: I3f1fd79e939d106dc259a9fa923c7f7db4f9fa58
GitOrigin-RevId: 1de1ff4cacd7f7e58c3c35fa2215b9c31d3a21f3
2022-10-06 18:50:30 +00:00
Sam Leffler
6221739c49 SecurityCoordinator: misc fixups
- fix size_buffer & get_manifest requests to marshal responses
- fix size_buffer marshaling (was always returning zero)
- format fakeimpl manifest string
- add shell test commands that exercise the api's (including the
  key api's that were only reachable via the StorageManager)

Change-Id: Ia36906d975fb497e6de81e81fdaf2ff04c7a1e9a
GitOrigin-RevId: cad976c55c99724c2b7c5186b2864f7c44edef13
2022-10-06 18:50:14 +00:00
Sam Leffler
ae3de25663 kata-security-coordinator::fakeimpl: construct unique bundle id's
Fake bundle id's are now "fake.X" where X is the CPtr for the package
contents' CNode (which is known unique).

While here fix some whitespace bogons.

Change-Id: I84c586e11f56c416d9bad667cae8e4cecba5dca2
GitOrigin-RevId: 0cec9e3308d9f3fe019af666dea583f92b3735b4
2022-10-06 18:49:58 +00:00
Sam Leffler
066d37db24 kata-shell: fix bundles display of the empty array
Change-Id: Idfd75a3c3e14c543c79b78a7f3133b0de4edf874
GitOrigin-RevId: 3fe641ccf0e1ee577689776f531eb853e9972d53
2022-10-06 18:49:48 +00:00
Sam Leffler
6850f3b3e0 Merge "kata-shell; overhaul command processing"
GitOrigin-RevId: 6fe5b9078cd47083ae834e81482576272f7b9b7e
2022-10-06 18:49:40 +00:00
Sam Leffler
6d8badf052 Move RUST_TARGET setup to easy-settings.cmake.
RustAddLibrary was setting RUST_TARGET to a fixed string with a potential
override by the caller. The later is not used in our builds so move it
to east-settings.cmake so it can be changed from the cmd line.

Change-Id: I17f16cf8df16e6d7e997091165e8df097f7fcc32
GitOrigin-RevId: 98b687fd600e328cacbaf3c1127eef841d664a92
2022-10-06 18:49:25 +00:00
Sam Leffler
a17ea9d0c2 kata-os-common: first cut at riscv64 support
Change-Id: I78ae428c8362b078d169c47f96e34a18d290df9c
GitOrigin-RevId: 190ceaf2c2e2e6169f122304226862bd04e3b9a9
2022-10-06 18:49:15 +00:00
Marcin Witkowski
2a1cf83ac5 kata-os-common: improve portability & fix aarch64 platform
A smorgasbord of chnages to sel4-sys and kata-os-model mostly in support
of the aarch64 platform. This is derived from Marcin's aarch64 work.

TODO(sleffler): seL4_Page_Map_Flush maybe belongs in sel4-sys

sel4-sys changes:
- hoist seL4_ObjectTypeCount out of arch
- make seL4_Page_Map for ARM honor the grant right to set the NX bit
- fill-in seL4_ObjectType & related impl's for ARM & X86
- import cfg-if crate to cleanup various tangled conditionals

kata-os-model changes:
- add seL4_Page_Map_Flush to encapsulate arch-specific work needed after
  an seL4_Page_Map call; this is kept separate to avoid changing the
  Page_Map api
- purge kobject_t and replace kobject_get_type with get_frame_type
- purge kobject_get_size (only use was to calculate the size of the
  SchedContext object which is arch-independent)
- redo CDL_ObjectType to work for all arch's
- various fixes for target_arch aarch64
- construct platform_gen.rs at build-time from seL4's platform_gen.h for
  seL4_Page_Map_Flush to do it's job
- get target_arch arm closer (esp needs vspace setup fixed)
- correct various "arm" & "x86" target_arch checks to cover both 32-
  and 64-bit arch's
- misc style changes (e.g. sort imports)

capdl changes:
- add arch-specific CDL_CapType entries

NB: seL4_Page_Map_Flush for ARM is overly conservative in invalidating
    the data cache; this could be improved by identifying whether the page
    has a pre-assigned paddr
Change-Id: I005cbbbd36ea6711feed66412391e3790dda2966
GitOrigin-RevId: b5c6893fa1c7f3297d88aa7f522a2792ac3b75c7
2022-10-06 18:49:04 +00:00
Cindy Liu
84986b53d4 Revert "kata-os-common: improve portability & fix aarch64 platform"
This reverts commit c8081ff8d932e5c9b427a1e9bb0bc2db7c674738.

Reason for revert: breaking build with mismatch types (see https://louhi.dev/?projectId=5958780716318720#/execution-detail/5040812206587904)

Change-Id: Id2c9ce3b02a0295511351fc9ed537f1817345e89
GitOrigin-RevId: 0074bda840dabb77f1ca7c936d3d3ede6d05a179
2022-10-06 18:48:50 +00:00
Marcin Witkowski
e64ac727d1 kata-os-common: improve portability & fix aarch64 platform
A smorgasbord of chnages to sel4-sys and kata-os-model mostly in support
of the aarch64 platform. This is derived from Marcin's aarch64 work.

TODO(sleffler): seL4_Page_Map_Flush maybe belongs in sel4-sys

sel4-sys changes:
- hoist seL4_ObjectTypeCount out of arch
- make seL4_Page_Map for ARM honor the grant right to set the NX bit
- fill-in seL4_ObjectType & related impl's for ARM & X86
- import cfg-if crate to cleanup various tangled conditionals

kata-os-model changes:
- add seL4_Page_Map_Flush to encapsulate arch-specific work needed after
  an seL4_Page_Map call; this is kept separate to avoid changing the
  Page_Map api
- purge kobject_t and replace kobject_get_type with get_frame_type
- purge kobject_get_size (only use was to calculate the size of the
  SchedContext object which is arch-independent)
- redo CDL_ObjectType to work for all arch's
- various fixes for target_arch aarch64
- construct platform_gen.rs at build-time from seL4's platform_gen.h for
  seL4_Page_Map_Flush to do it's job
- get target_arch arm closer (esp needs vspace setup fixed)
- correct various "arm" & "x86" target_arch checks to cover both 32-
  and 64-bit arch's
- misc style changes (e.g. sort imports)

capdl changes:
- add arch-specific CDL_CapType entries

NB: seL4_Page_Map_Flush for ARM is overly conservative in invalidating
    the data cache; this could be improved by identifying whether the page
    has a pre-assigned paddr

Change-Id: Ia690006436b2bd5fc892bff139668f8d518cb426
GitOrigin-RevId: c8081ff8d932e5c9b427a1e9bb0bc2db7c674738
2022-10-06 18:48:34 +00:00
Sam Leffler
8255aeb604 kata-security-coordinator: fix fakeimpl memory stats
Request the MemoryManager to free the package contents' CNode
on uninstall.  We were reclaiming this locally without informing
MmemoryManager so it's bookkeeping was off.

Change-Id: I925178ad50cf84a85dd401aafd9fdbea71e050a3
GitOrigin-RevId: 3e369dd558542d6f85f70f0ea9894ea370fd51d6
2022-10-06 18:48:22 +00:00
Sam Leffler
ddacc3762e Add kata-os-common::camkes support.
Add a new "camkes" submodule that consolidates KataOS CAmkES component
integration boilerplate. Each component is expected to declare:

static mut CAMKES: Camkes = Camkes::new("ProcessManager");

and then (typically) use "pre_init" to setup the logger, heap, and the
slot allocator. More fine-grained control is provided by:

fn init_logger(self: &Cmakes, level: Log::LevelFilter);
fn init_allocator(self: &Camkes, heap: &'static mut [u8]);
fn init_slot_allocator(self: &Camkes, first_slot: seL4_CPtr, last_slot: seL4_CPtr);

When receiving capabilities use "init_recv_path" to setup the IPCBuffer
receive path and "assert_recv_path" & "check_recv_path" calls to verify
noting has clobbered the setting.

The debug_assert_slot_* macros are wrapped in Camkes:: functions and a
"top_level_path" function for constructing seL4_CPath objects. Altogether
this normally allows a component to be written without direct use of the
CAmkES global static identifiers SELF_CNODE*.

Change-Id: Ia1351e411a5355789cf74bc0fcfe0e41a418b7d4
GitOrigin-RevId: fb81a8e0687ed9321c9961410edd5dbd54093ce5
2022-10-06 18:48:10 +00:00
Sam Leffler
3bd8389a4c sel4-sys: add arch_generic support
Adds an architecture-independent api for sel4-sys interfaces similar
to what libsel4 does. For example, instead of seL4_RISCV_Page_Map use
seL4_Page_Map. This is mostly aliases for common types & system calls but
also features like the Grant right implying NoExecute for seL4_Page_Map.

While here fix crate paths to sel4-sys; everything external to
kata-os-common is intended to use kata-os-common::sel4-sys.

Change-Id: I6faa07d41ffd2fbb4182bf2fa7c05a768e4368f3
GitOrigin-RevId: f51e5186b61eab541e9fb4d2d4175adcc3ca8cee
2022-10-06 18:47:57 +00:00