-
Notifications
You must be signed in to change notification settings - Fork 3
smartmeter demo (CHERIoT device bits) #20
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
base: main
Are you sure you want to change the base?
Conversation
285556b
to
778c515
Compare
Looks like I cannot push to this branch. Here's a slightly different design to highlight the security guarantees of CHERIoT against a system that has no compartmentalization:
The grid controller and provider each run a thread for receiving data in the form of MQTT messages, and the provider runs a thread for sending accumulated consumption information. The javascript VM has FFI functions to access
On a system with no security features, a user can write a javascript program that abuses the set load consumptions or set battery charge/discharge functions to specify an arbitrary 32-bit index to update any value in the memory. With CHERIoT, each of the above components can be specified as a separate compartment and as a result, the user compartment that has the javascript VM cannot access/update arbitrary memory using the index value in the set load consumptions/set battery charge/discharge functions. Note that the grid controller is optional for this security feature demonstration and can potentially be removed to simplify the design. |
106b4bd
to
fa09d89
Compare
28a966f
to
f940bcb
Compare
This should allow making the demo more interesting
Also change the name of CHERIOT_SDK env variable to CHERIOT_RTOS_SDK to avoid confusion with --sdk option to xmake.
Also set default board for smart_meter demo to sonata-1.1.
We self-check for validity only if debugging is turned on, and how odd that '-' isn't in the spec's permitted set (3.1.3.1, MQTT-3.1.3-5).
Works after CHERIoT-Platform/cheriot-rtos#461
On monolithic builds, move the sensor data and the userJS data snapshot objects into (the one compartment's) globals. This should make it possible, in a monolithic build, for a cap held in the JS machine to be abused to write to the sensor data.
Place sensitive and non-sensitive structures not just in the same .data segment but as subobjects of the same struct. This subverts CHERIoT-LLVM's understanding of properly bounding address-taken globals and permits subobject bounds violtion to model code running on a pre-CHERI machine.
Defaults to 'random' which causes the device to generate a random ID on boot.
Have the server interpret them relative to the static resource directory, as they would be by the clients (served out of the static directory).
- Give symbolic name to the coarsening depth - Fix a rather embarassing bug
And make it really the default JS baked in. While here, make that process easier and document it.
This lets the JS crash and get forcibly unwound back to a calling compartment rather than to thread exit.
This partially reverts ca4e802 and puts the merged data object back into the monolith compartment's .data. The separated user compartment can get it via a cross-compartment call during initialization. This means that it can be accessed via the CGP exposed to JS, too, in addition to the array pointer exposed via the FFI.
While here, sort the consumption arrays so we know we're dropping prefixes, just in case timestamps wiggle a bit.
- Move to IRQ-based reads, rather than burning the core - Bump the sensor thread priority over the workers' - Prevent std::string from consuming unbounded heap - Have std::string perform allocation up front and Debug::Assert success
We're seeing somewhat mysterious allocation failures, so try to reduce the number of allocations we make?
multiwaiter_wait() overwrites the value fields of its EventWaiterSource structures, so cache the values passed in. Update the cache and copy from it back to the wait events each loop iteration.
We were running out of stack deep in the network code, spinning in a tight loop of failing to allocate a network buffer. Don't do that.
Also move it to /static dir as that's where it needs to be.
Adjust graph width properties to make this work.
The FreeRTOS-Plus-TCP network stack drops with success UDP datagrams it cannot immediately send, so our first attempt at this is all but guaranteed to fail at present. Don't wait quite so long for that to happen, and don't wait so long between attempts. Continue to allow the 2nd and subsequent attempts to take longer.
No description provided.