Skip to content

Can buffers passed between user apps and capsules be complex data types? #445

Answered by lschuermann
potto216 asked this question in Q&A
Discussion options

You must be logged in to vote

Generally, Tock's system calls are not aware of the structure or semantics of allow-data passed in. Fundamentally, this layer is limited to passing byte arrays to capsules (and, in the case of IPC, also other applications, though that may be unsupported in libtock-rs right now).

While in C it is possible to overlay a given region of memory with a structure simply through pointer casts, in Rust this is inherently unsafe, as writes to the underlying in-memory representation could violate arbitrary invariants. For example, if this were a safe operation, one could dereference arbitrary pointers and thus invoke unsoundness simply by writing to the memory location shadowing a Rust reference. See

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jrvanwhy
Comment options

@potto216
Comment options

Answer selected by potto216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants