Skip to content

Commit d781f91

Browse files
committed
liaison: t-opsem expert session held on 2026-05-26
1 parent 5cc0933 commit d781f91

1 file changed

Lines changed: 252 additions & 0 deletions

File tree

  • subcommittee/liaison/meetings/2026-05-26-opsem-expert-session
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
# Safety-Critical Rust Consortium Meeting on 2026-05-26 @ 12pm EDT / 6pm CEST
2+
3+
Expert session with Ralf Jung and Ben Kimock of the Rust Project Operational Semantics Team (t-opsem)
4+
5+
| Search Key | Description |
6+
| :---- | :---- |
7+
| \[todo\] | Action Item |
8+
| \[decision\] | Something decided on |
9+
| \[important\] | Key information |
10+
11+
## Agenda
12+
13+
1. Introduction to t-opsem
14+
2. Discuss
15+
16+
## Check-in area
17+
18+
**Please add your name, and an emoji that describes your day.**
19+
20+
* Pete LeVasseur 🦀✍️
21+
* Max Jacinto 👾💻
22+
* Andreas Weis
23+
* Kartik Ohlan
24+
* David de Rosier 🐠
25+
* Tiago Manczak
26+
* Erik Rose🌹
27+
* Christof Petig ⏲️
28+
* Roberto Bagnara 🏴‍☠️
29+
* Marcos Borges 🤯
30+
* Félix Fischer ☕
31+
* Marc Schoolderman 🥪
32+
* Samuel Wright 🍽️
33+
34+
**Notetaker:**
35+
36+
* Pete LeVasseur
37+
38+
## Housekeeping section
39+
40+
*
41+
42+
## Tasks
43+
44+
* Andreas Weiss to come back with small, self-contained examples of the kinds of “gray zone” areas of soundness / definedness which still would make sense in the larger context of iceoryx2
45+
46+
## Meeting Minutes
47+
48+
## Introduction to t-opsem
49+
50+
* The truly settled items are in the Reference and in the standard library docs
51+
52+
FCP \- *Final Comment Period*
53+
54+
* Mechanism by which teams agree
55+
* List of current FCPs where the opsem team has reached consensus on: [https://github.com/rust-lang/opsem-team/blob/main/fcps.md](https://github.com/rust-lang/opsem-team/blob/main/fcps.md)
56+
* List is most likely incomplete (it is updated by hand)
57+
58+
**Note**: regarding the UCG / Unsafe Code Guidelines Reference
59+
60+
* **Not complete, basically unmaintained.**
61+
* The document exists for historical reference.
62+
* **The Glossary** can be used as an informative reference. The guidelines cannot.
63+
* [https://rust-lang.github.io/unsafe-code-guidelines/](https://rust-lang.github.io/unsafe-code-guidelines/)
64+
65+
Important opsem tooling: Miri
66+
67+
* The **MIR** **i**nterpreter
68+
* [https://github.com/rust-lang/miri](https://github.com/rust-lang/miri)
69+
* Latest paper about miri: [(2026) Miri: Practical Undefined Behavior Detection for Rust](https://plf.inf.ethz.ch/research/popl26-miri.html)
70+
71+
Mini Rust talk given at last year’s RustWeek 2025
72+
73+
* [MiniRust: A core language for specifying Rust \- Ralf Jung](https://www.youtube.com/watch?v=yoeuW_dSe0o)
74+
75+
Some Operational Semantics Concerns are outside of Rust
76+
77+
* E.g. make sure that LLVM does the right thing
78+
* Mapping same memory into multiple address spaces kicks out a potentially large number of optimizations that LLVM does
79+
80+
## Eclipse iceoryx2 \- shared memory, zero-copy transport
81+
82+
* Written in Rust
83+
* Going to safety-certify
84+
* Working to understand the Rust reference and the standard library docs to make sure know how to rest a safety argument
85+
86+
Shared memory, for example, seems challenging to describe accurately via the Rust Abstract Machine
87+
88+
* Use-case for library 2 different processes that map the same memory to their address space
89+
* Could also be used from single process; in that case same memory mapped into two spots in same address space
90+
* Would like to put atomics to be able to reason about “when” changes are made
91+
92+
Same memory segment mapped to different addresses
93+
94+
* Pointers don’t work anymore
95+
* Need to discuss in terms of offsets
96+
* Use own address as base for the offset
97+
* Found it difficult to implement this reasonably
98+
99+
In preparation put together small document that describes constructs that may be problematic
100+
101+
* [https://github.com/ekxide/iox2-scrc-examples/blob/main/README.md](https://github.com/ekxide/iox2-scrc-examples/blob/main/README.md)
102+
103+
Use case: being able to put complex data structures into shared memory and then interact with the shared memory objects “like normal” is a key thing that’s valuable
104+
105+
* Publishing a hashmap, such as being able to make changes right in place
106+
* The subscriber side still wants to be able to make lookups into the hashmap
107+
108+
What is the “trust relationship” in entities among iceoryx2?
109+
110+
* Difficult scenario \-- safety-critical, mixed criticality systems. Need to ensure that subscriber is low-criticality it cannot compromise a higher-criticality publisher.
111+
* Constraint: Want to ensure if low-criticality process dies this does not compromise a high-criticality one
112+
* Unable to do locks, lock-free
113+
114+
Hard problems in opsem
115+
116+
* Two processes which do not trust each other, how can they share data
117+
* Not LLVM clear way of going about this
118+
* Let alone when it comes to how to specify this in the Rust Abstract Machine
119+
* If possible for only one “side” to mutate at a time, then picture changes
120+
121+
Want to ensure that iceoryx2 takes care of some of the complications
122+
123+
* E.g. in Subscriber side, map only as read-only segment to prevent common issues
124+
125+
Can one side read, while the other side is writing?
126+
127+
* Quite hard; limitation of operating systems
128+
* Is it the case that at any time one side is reading while the other side is writing?
129+
* No; but could be abstracted over in the Rust Abstract Machine
130+
* Attempt to make APIs which respect Rust’s model
131+
* Useful article: [How to use storytelling to fit inline assembly into Rust](https://www.ralfj.de/blog/2026/03/13/inline-asm.html)
132+
* If can be reframed in the model from the above blog post, then don’t need language or compiler changes.
133+
* Wrapping in inline assembly code can prevent optimizations from being run which would break the program
134+
* Is this formalized?
135+
* No, but there’s a line of argumentation that could be used
136+
* Not put into a theorem prover yet
137+
* One idea for project goal might be to involve this towards being accepted normatively
138+
139+
Mechanism of working together
140+
141+
* Attempt to write safety comments on each gray zone usage of **`unsafe`**
142+
* For those which we cannot have a safety comment written from normative locations (Reference, Standard library docs) gather them up
143+
144+
### Feedback on 5: Uninitialized memory one
145+
146+
* How do you know the memory doesn’t contain the magic bit pattern at the outset?
147+
* Operating system guarantees that raw memory block is given that is zero initialized (sbreak sp?)
148+
* Then could say that Rust Abstract Machine guarantees this as well (confirm this?)
149+
* Memory could become deinitialized
150+
* If **memcpy** from A \=\> B then could copy over uninitialized memory mistakenly making the destination deinitialized
151+
* In the Abstract Machine anything padding between fields is not copied over
152+
* Layout is assumed fixed and known in an earlier part of the compiler
153+
* E.g. **(u8, u16)** tuple if copied over, then the destination would have that padding byte be uninitialized as the last item in the tuple is not reordered (not stable behavior)
154+
155+
Can just pretend mmap is a “weird” version of malloc/calloc to make some safety arguments
156+
157+
* If mmap allows for things like punching holes in allocations or extending them, then that is different
158+
159+
Rust Abstract Machine
160+
161+
* Can just pretend that every function call could do what malloc could
162+
* Need to do some sort of “storytelling” in the language of the Abstract Machine
163+
* As long as no overlap of memory with what would be handed out by Rust Abstract Machine, e.g. anything that need to be put onto the heap
164+
165+
### Feedback on 7: Benign reads of padding bytes
166+
167+
* Whenever reading data, including padding bytes, as **u8**
168+
* Want to be able to read them as a series of **u8** even if they are uninitialized, since we don’t care about the value of the bytes
169+
* Would simply reading them already put you in trouble? Do we need to skip over the holes of the padding bytes?
170+
* Cannot read as **u8**, but can read as **MaybeUninit\<u8\>**
171+
* **u8** is really a number in Rust, unlike C; so if you load it, it needs to be initialized memory as a **u8** in a legal value
172+
* Allows copying of bytes from A \=\> B without interpreting their value
173+
* Would this also work with atomic access?
174+
* No way to do this on potentially uninitialized memory
175+
* There is a crate someone wrote with uses inline assembly (least incorrect way of doing this, since it hides as much information from the compiler as possible)
176+
* No reason it cannot exist, but someone would need to do the work to specify this and
177+
* Load and store are possible, but nothing barring from doing this from an opsem perspective
178+
* Compare and Swap doesn’t make sense with initialized memory
179+
180+
### Feedback on 6: Sequence Locks
181+
182+
* **UnrestrictedAtomic** type seems the right path, but blocked on LLVM
183+
* Has been blocked for \~3 years or so on the C++ side of things
184+
* Might have been due to ISO standards concerns
185+
* Want this added for monotonic atomics, which is called ***Relaxed memory ordering*** in Rust
186+
* No fundamental issues with doing this in Rust afterwards
187+
* Should be enough at that point for doing a Sequence Lock
188+
* Perhaps should get in touch with person at Google that works on the C++ portion of LLVM
189+
* \[TODO\] Andreas \+ Pete to reach out
190+
191+
### Feedback on 1: [Hidden Aliasing Through Shared Memory](https://github.com/ekxide/iox2-scrc-examples/blob/main/README.md#example-1---hidden-aliasing-through-shared-memory)
192+
193+
* Idea is to, with the iceoryx2 APIs, hide the “ugly” aspects of doing shared memory from the user
194+
* Publisher requests memory segment to write into, can make changes within constraints of payload type to send
195+
* Once published, no pointers are retained to that shared memory on the publisher
196+
* That way on the Subscriber side there’s assurance the memory contents are changed no more
197+
* Ensure to not re-use memory so long as there’s still some references to it
198+
* Is this like each time **loan\_init()** is called, then we get a new fresh thing which doesn’t interact with anything else?
199+
* Conceptually yes
200+
* In practice, it’s reused when can be sure not any other references
201+
* Answer: Conceptually seems totally fine, would need to put some kind of empty inline assembly block as a barrier
202+
* How to deal with pages mapped into multiple address spaces \-- in Rust Abstract Machine terms
203+
* There is realloc; could “pretend” and split runtime of program into Phase A, Phase B, Phase C would then make this remotely correct to run through an optimizing compiler
204+
* When going from Phase X \=\> Y then you can invalidate all the old pointers
205+
* Allows for implementing as empty inline assembly block as input
206+
* Give old pointer, return new pointer
207+
* Don’t need to exist in assembly
208+
* Allows for reasoning about this in terms of the Rust Abstract Machine
209+
* (This was the hope of Eclipse iceoryx2)
210+
* What does the “magical incantation” look like?
211+
* Related to the blog post shared; need to make argument under that reasoning of the Rust Abstract Machine using inline assembly
212+
* Related RFC for “fake” **realloc**, useful for ARM architectures to make some portion of it a magic token: [RFC 3700: ptr::assume::moved](https://github.com/mrkajetanp/rfcs/blob/ptr-tag-helpers/text/3700-ptr-assume-moved.md)
213+
* Publisher and subscribers in this example are in the same process
214+
* When peeking at their addresses, they appear to be pointing to different places
215+
* But they are actually pointing at the same underlying memory
216+
* “Hidden aliasing”
217+
* **realloc** idea in that case will not work
218+
* Litmus test: can we come up with a Rust Abstract Machine story to tell?
219+
* So long as both of them are read-only, shouldn’t be too hard
220+
* Doesn’t need to mean they are read-only at the hardware level, could be logically: *“is it **supposed to** be read from?”*
221+
* The empty inline assembly block creates two new read-only allocations, put the source into both of them and mark as read-only
222+
* “Mark as read-only” is not currently an operation in the AM
223+
* Fine, but needs a bit of specification work
224+
* Only important that the program doesn’t write it, doesn’t need to be “true” at the hardware level
225+
* Further complication: the sample the user receives is read-only; the memory segment that reads in needs to be writable to communicate to the publisher side when done reading
226+
* Book-keeping data structures are written to by the Subscriber
227+
* Also duplicated in address space?
228+
* That’s a lot harder and may not be able to be deeply formally justified
229+
* Would have to dig into the code; need to carefully investigate
230+
231+
## Closing the meeting: **next steps in this conversation?**
232+
233+
* Identify the most interesting places in the implementation that touches on the key concepts discussed today?
234+
* Create smaller implementations to investigate?
235+
* This route is more helpful for discussion
236+
* Could be put into the t-opsem Zulip chat; get larger support without a need to read entirety of iceoryx2
237+
* Small reproducible bits of code that are concrete are useful to review by t-opsem
238+
* Need to be careful in carrying over what’s learned into the main library
239+
* Need to ensure small examples make the same sorts of assumptions
240+
* Exact MMAP interactions become important, so having those details exposed would be worthwhile
241+
* Could get to a state where we can lean on the MMAP implementation in Miri (currently somewhat limited) to allow for spelling out the model in code, within Miri
242+
* May be able to build shim for iceoryx2
243+
* When would we be able to have the small set of reproducible examples?
244+
* Maybe 3-4 weeks’ time
245+
* Get help from colleagues in putting the small reproducible together
246+
247+
## Material
248+
249+
Any material to read before the meeting should be included here.
250+
251+
*
252+

0 commit comments

Comments
 (0)