-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
My original implementation was a bit CHERI-happy and put a lot of capabilities in each endpoint to enforce properties with a not-very-well-thought-through thread model. The new code is simpler in a few ways: - The queue metadata and ring buffer are a single allocation. - The producer / consumer counters are indexed directly, not via indirection. - We don't do permission checks and claims for defensive programming in the send and receive functions, we use the unwind error handling so don't need to enumerate possible badness. - The library returns a pointer to the allocation directly, rather than a (large) value type and a pointer that is used for freeing. - Restricted endpoints are just a simple indirection layer and are only in the sealed version where they might make sense with a threat model. - The FreeRTOS compatibility APIs no longer need a heap allocation to store a pointer to another heap allocation. This is an API break, but the new APIs are simpler so it's probably worth it, and good to do before 1.0. I believe the only users are using the FreeRTOS-Compat wrappers, which are not changed (though can now easily be extended to support message queues between compartments in the compat layer). Fixes #309
- Loading branch information
1 parent
ce5ad17
commit c3c0fb1
Showing
10 changed files
with
456 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Message queues | ||
============== | ||
|
||
Message queues, as described in [`queue.h`](../../include/queue.h). | ||
|
||
This directory provides two targets. | ||
|
||
- The message queue library (`message_queue_library`) provides APIs for message queues that can be shared between two threads in the same compartment. | ||
- The message queue compartment (`message_queue`) wraps these in APIs that can be used from different compartments. | ||
|
||
The library uses the `setjmp`-based error handler (see: [`unwind.h`](../../include/unwind.h)) to recover from invalid bounds or permissions. | ||
If you are using the library and want to be robust in the presence of CHERI exceptions, you should either add `unwind_error_handler` as a dependency of your compartment or provide an error handler that calls `cleanup_unwind`. |
Oops, something went wrong.