Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Instantiate and run MPS in pKVM #35

Closed
3 tasks
podhrmic opened this issue May 14, 2024 · 7 comments · Fixed by #58
Closed
3 tasks

[FEATURE] Instantiate and run MPS in pKVM #35

podhrmic opened this issue May 14, 2024 · 7 comments · Fixed by #58
Assignees
Labels
application software application software components hardware SUT hardware (real/emulated/simulated) hypervisor SUT hypervisor/separation kernel SoW TA2.1.1.A Develop the Open SUT primarily using existing components and specifications.
Milestone

Comments

@podhrmic
Copy link
Collaborator

podhrmic commented May 14, 2024

Summary

Run the MPS in pKVM

  • Guest VM
    • has a baseline.img (R/W) and MPS.img (R)
    • automatically launches the MPS software
  • Host VM
    • has a baseline.img (R/W) and a config.img (R) that contains the JSON/XML config file, and the respective binaries
    • automatically launches the guest
  • Base
    • runs the test harness
    • if the test harness is not attached, the MPS runs in an interactive mode, and can be commanded through UART

Do

  • Run the original MPS (unmodified HARDENS) code in the guest VM, including the test harness (follow mps-test and mps-build CI jobs)
  • Pipe UART from the Guest VM to the Base platform, run MPS in the Guest VM and the test harness in Base platform
  • Modify the test harness and the MPS code to change the actuator values via GPIO, on top of printing it to UART
@podhrmic podhrmic added hardware SUT hardware (real/emulated/simulated) hypervisor SUT hypervisor/separation kernel application software application software components labels May 14, 2024
@podhrmic podhrmic added this to the MVP 1 milestone May 14, 2024
@podhrmic podhrmic mentioned this issue May 14, 2024
4 tasks
@spernsteiner
Copy link
Contributor

I've started on this on the 35-mps-in-pkvm branch. So far I've written a runner that will start on boot, mount an application partition, and start up processes or VMs as indicated in the application's config file. I've run a simple "hello world" test, and next I'm planning to test "hello world" in nested VMs, mimicking the setup we plan to use for MPS.

@spernsteiner
Copy link
Contributor

I successfully connected MPS in the guest via UARTs to a Unix socket in the base system, and I was able to run one of the MPS test cases against it in that configuration. Some more work is needed to be able to reset the MPS between test cases without shutting down and restarting the entire VM.

@spernsteiner
Copy link
Contributor

Some more work is needed to be able to reset the MPS between test cases

I've implemented a new MPS command R that causes the MPS to re-exec itself, which resets it to the initial state for the next test.

I've gotten many of the tests to pass with MPS running inside the VM. I had some issues with the test suite at first, but eventually discovered that the tests require a specific build configuration: make -C src SENSORS=NotSimulated SELF_TEST=Disabled

I'm currently investigating some issues with the QEMU UART that cause large delays (> 10 seconds) between sending the data and the MPS receiving it. These delays increase over time as the test suite runs until eventually the tests start timing out.

@podhrmic
Copy link
Collaborator Author

Regarding the test build - here is how MPS is built and tested in the CI

@spernsteiner
Copy link
Contributor

With #53, the test suite passes with the tests running on the base system and the MPS running inside the guest VM, with the two communicating via an emulated UART. My guess is that the communication delays I was seeing previously were due to contention on the display lock causing the refresh display (D) command to take a long time to run.

I'm now working on cleaning up the setup code for this so I can open a PR.

@podhrmic podhrmic added the SoW TA2.1.1.A Develop the Open SUT primarily using existing components and specifications. label May 29, 2024
@spernsteiner
Copy link
Contributor

I tried running the MPS test suite without QUICK=1 as a final test of the MPS-on-pKVM setup, and it ran into more issues with UART delays. It's failing in scenarios/normal_4, though not in the same place as #56 (it fails on case 8/9 instead of 272/273).

However, the test suite does work when both the tests and MPS are run inside the guest VM. All tests succeed up to the errors mentioned in #56. I will add some automation for this alternative setup and open a PR for that tomorrow.

@spernsteiner
Copy link
Contributor

spernsteiner commented Jun 1, 2024

I got the test suite working with MPS-in-pKVM (modulo #56) by reducing the frequency of update-display commands to avoid overwhelming the MPS process: 7b3777b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application software application software components hardware SUT hardware (real/emulated/simulated) hypervisor SUT hypervisor/separation kernel SoW TA2.1.1.A Develop the Open SUT primarily using existing components and specifications.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants