AmbiML / sparrow-cantrip-full

Apache License 2.0
7 stars 2 forks source link

m simulate question #8

Closed Arthasczt closed 1 year ago

Arthasczt commented 1 year ago

I tried to run "m simulate " and seems like I didn't get the same result as the "getting started" said. Did I do songthing wrong? `Booting all finished, dropped to user space cantrip_os_rootserver::Bootinfo: (344, 131072) empty slots 1 nodes (15, 77) untyped 131072 cnode slots cantrip_os_rootserver::Model: 366 objects 1 irqs 0 untypeds 2 asids cantrip_os_rootserver::capDL spec: 0.06 Mbytes cantrip_os_rootserver::CAmkES components: 0.47 Mbytes cantrip_os_rootserver::Rootserver executable: 0.47

<<seL4(CPU 0) [decodeARMFrameInvocation/2137 T0xffffff8000341400 "" @410878]: ARMPageMap: Attempting to remap a frame that does not belong to the passed address space>> <<seL4(CPU 0) [decodeARMFrameInvocation/2137 T0xffffff8000341400 "" @410878]: ARMPageMap: Attempting to remap a frame that does not belong to the passed address space>> <<seL4(CPU 0) [decodeARMFrameInvocation/2137 T0xffffff8000341400 "" @410878]: ARMPageMap: Attempting to remap a frame that does not belong to the passed address space>> ...... cantrip_os_rootserver::Rootserver cnode: 768 used of 10000 cantrip_os_rootserver::Rootserver untypeds: 76 used of 230 <<seL4(CPU 0) [decodeCNodeInvocation/107 T0xffffff8000341400 "" @40ac5c]: CNode Copy/Mint/Move/Mutate: Source slot invalid or empty.>> <<seL4(CPU 0) [decodeCNodeInvocation/107 T0xffffff8000341400 "" @40ac5c]: CNode Copy/Mint/Move/Mutate: Source slot invalid or empty.>> <<seL4(CPU 0) [decodeCNodeInvocation/107 T0xffffff8000341400 "" @40adb0]: CNode Copy/Mint/Move/Mutate: Source slot invalid or empty.>> ...... CANTRIP> packages unknown command CANTRIP> start hello start failed: BundleNotFound CANTRIP> start keyval start failed: BundleNotFound CANTRIP> bundles CANTRIP> start logtest start failed: BundleNotFound CANTRIP> start panic start failed: BundleNotFound CANTRIP> start timer start failed: BundleNotFound CANTRIP> bundles CANTRIP> mstats cantrip_memory_manager::Global memory: 0 allocated 130510592 free, reserved: 2273280 kernel 1392640 user 48 bytes in-use, 130510544 bytes free, 48 bytes requested, 1392640 overhead 2 objs in-use, 2 objs requested CANTRIP> stop hello stop failed: BundleNotFound CANTRIP> stop keyval stop failed: BundleNotFound CANTRIP> stop logtest stop failed: BundleNotFound CANTRIP> stop panic stop failed: BundleNotFound CANTRIP> stop timer stop failed: BundleNotFound CANTRIP> mstats 48 bytes in-use, 130510544 bytes free, 48 bytes requested, 1392640 overhead 2 objs in-use, 2 objs requested CANTRIP> EOF `

sleffler commented 1 year ago

I had a different experience. The code does not compile as-is; the cpio crate lacks derive(Debug) so the log msgs that use "{:?}" don't compile.

$ repo diff

project cantrip/projects/cantrip/ diff --git a/apps/system/components/SecurityCoordinator/cantrip-security-coordinator/src/fakeimpl/ mod.rs b/apps/system/components/SecurityCoordinator/cantrip-security-coordinator/src/fakeimpl/ mod.rs index d663c4e..03ffc91 100644

a/apps/system/components/SecurityCoordinator/cantrip-security-coordinator/src/fakeimpl/ mod.rs +++ b/apps/system/components/SecurityCoordinator/cantrip-security-coordinator/src/fakeimpl/ mod.rs @@ -142,7 +142,7 @@ fn get_builtins() -> BundleIdArray { let mut builtins = BundleIdArray::new(); for e in CpioNewcReader::new(cpio_archive_ref) { if e.is_err() {

  • error!("cpio read err {:?}", e);
  • error!("cpio read err"); break; } builtins.push(e.unwrap().name.to_string()); @@ -159,7 +159,7 @@ fn get_bundle_from_builtins(filename: &str) -> Result<BundleData, SecurityReques }; for e in CpioNewcReader::new(cpio_archive_ref) { if e.is_err() {
  • error!("cpio read err {:?}", e);
  • error!("cpio read err"); break; } let entry = e.unwrap();

After working around that I get this:

CANTRIP> source -q autostart.repl

cantrip_memory_manager::Global memory: 0 allocated 130543360 free, reserved: 2273280 kernel 1359872 user CANTRIP> packages autostart.repl hello.app keyval.app logtest.app panic.app timer.app CANTRIP> start hello Bundle "hello" I am a C app! Done, sleeping in WFI loop started. CANTRIP> start keyval Bundle "keyval" started. CANTRIP> bundles [keyval]::read(foo) failed as expected hello keyval CANTRIP> start logtest [keyval]::write ok Bundle "logtest" started. CANTRIP> star[keyval]::read returned [49,t panic 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

[keyval]::delete ok [keyval]::delete ok (for missing key) Bundle "panic" started. CANTRIP> start timer

[panic]::panicked at 'Goodbye, cruel world', panic/panic.rs:18:5 Bundle "timer" started. CANTRIP> bundles [timer]::sdk_timer_cancel returned Err(SDKNlogtest hello panic timer keyval CANTRIP> mstats 648832 bytes in-use, 129894528 bytes free, 648832 oPlatformSupport) with nothing running [timer]::sdk_timer_poll returned Err(SDKNoPlatformbytes requested, 1359872 overhead 175 objs in-use, 175 objs requested CANTRIP> stop hello Support) with nothing running [timer]::sdk_timer_oneshot returBuned Err(SDKNoSuchTimer) with an invalid timer id [timer]::sdkndle "hello" stopped. CANTRIP> stop keyval _timer_oneshot failed: SDKNoPlatformSupport [timer]::sdk_timer_periodic failed: SDKNoPlatformSupport [timer]::sdk_timer_periodic 1 failed: SDKNoPlatformSupport Bundle "keyval" stopped. CANTRIP> stop logtest Bundle "logtest" stopped. CANTRIP> stop panic Bundle "panic" stopped. CANTRIP> stop timer Bundle "timer" stopped. CANTRIP> mstats 4272 bytes in-use, 130539088 bytes free, 648832 bytes requested, 1359872 overhead 4 objs in-use, 175 objs requested CANTRIP> EOF CANTRIP> EOF

which looks about right (there is no timer driver so various things fail).

I also had to upgrade my rustc to the new MSRV with:

$ rustup +$CANTRIP_RUST_VERSION target add aarch64-unknown-none

info: downloading component 'rust-std' for 'aarch64-unknown-none'

info: installing component 'rust-std' for 'aarch64-unknown-none'

I'll fix the cpio issue.

On Wed, Mar 8, 2023 at 11:07 PM Arthasczt @.***> wrote:

I tried to run "m simulate " and seems like I didn't get the same result as the "getting started" said. Did I do songthing wrong? `Booting all finished, dropped to user space cantrip_os_rootserver::Bootinfo: (344, 131072) empty slots 1 nodes (15, 77) untyped 131072 cnode slots cantrip_os_rootserver::Model: 366 objects 1 irqs 0 untypeds 2 asids cantrip_os_rootserver::capDL spec: 0.06 Mbytes cantrip_os_rootserver::CAmkES components: 0.47 Mbytes cantrip_os_rootserver::Rootserver executable: 0.47

<<seL4(CPU 0) [decodeARMFrameInvocation/2137 T0xffffff8000341400 "" @410878]: ARMPageMap: Attempting to remap a frame that does not belong to the passed address space>> <<seL4(CPU 0) [decodeARMFrameInvocation/2137 T0xffffff8000341400 "" @410878]: ARMPageMap: Attempting to remap a frame that does not belong to the passed address space>> <<seL4(CPU 0) [decodeARMFrameInvocation/2137 T0xffffff8000341400 "" @410878]: ARMPageMap: Attempting to remap a frame that does not belong to the passed address space>> ...... cantrip_os_rootserver::Rootserver cnode: 768 used of 10000 cantrip_os_rootserver::Rootserver untypeds: 76 used of 230 <<seL4(CPU 0) [decodeCNodeInvocation/107 T0xffffff8000341400 "" @40ac5c]: CNode Copy/Mint/Move/Mutate: Source slot invalid or empty.>> <<seL4(CPU 0) [decodeCNodeInvocation/107 T0xffffff8000341400 "" @40ac5c]: CNode Copy/Mint/Move/Mutate: Source slot invalid or empty.>> <<seL4(CPU 0) [decodeCNodeInvocation/107 T0xffffff8000341400 "" @40adb0]: CNode Copy/Mint/Move/Mutate: Source slot invalid or empty.>> ...... CANTRIP> packages unknown command CANTRIP> start hello start failed: BundleNotFound CANTRIP> start keyval start failed: BundleNotFound CANTRIP> bundles CANTRIP> start logtest start failed: BundleNotFound CANTRIP> start panic start failed: BundleNotFound CANTRIP> start timer start failed: BundleNotFound CANTRIP> bundles CANTRIP> mstats cantrip_memory_manager::Global memory: 0 allocated 130510592 free, reserved: 2273280 kernel 1392640 user 48 bytes in-use, 130510544 bytes free, 48 bytes requested, 1392640 overhead 2 objs in-use, 2 objs requested CANTRIP> stop hello stop failed: BundleNotFound CANTRIP> stop keyval stop failed: BundleNotFound CANTRIP> stop logtest stop failed: BundleNotFound CANTRIP> stop panic stop failed: BundleNotFound CANTRIP> stop timer stop failed: BundleNotFound CANTRIP> mstats 48 bytes in-use, 130510544 bytes free, 48 bytes requested, 1392640 overhead 2 objs in-use, 2 objs requested CANTRIP> EOF `

— Reply to this email directly, view it on GitHub https://github.com/AmbiML/sparrow-cantrip-full/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRM7IIRJC55TF3RXAOPWALW3F6RJANCNFSM6AAAAAAVUWLUZM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sleffler commented 1 year ago

https://github.com/AmbiML/sparrow-cantrip-full/commit/59a5ce0541c018c49744659f766a43e3b8c59610 should fix the cpio issue