MoRDor

A weak memory explorer for C-like programs

MoRDor is a weak memory explorer for C-like programs, with a CLI and a web UI. Given a concurrent program as a litmus test, it computes the program’s justified executions: the ways its reads and writes can resolve under relaxed memory, each backed by justifications of what every write depends on. A memory model then decides which executions are coherent. Because every execution carries the justifications it was built from, MoRDor shows not only which outcomes a model allows but why.

MoRDor checks executions against more than forty memory models, from sMRD, RC11 and SC to OCaml and the promising semantics, and compares models execution by execution. It also decides episodicity of unbounded loops and finds use-after-free.

MoRDor also runs in the browser, with nothing to install: the MoRDor playground is the web UI with MoRDor and its SMT solver, Z3, compiled to run in the page itself, without a server. It gives the same answers as the native build, and the first visit downloads about 5 MB.

A recording of the MoRDor web UI: a litmus test is typed into the source panel, in which one thread frees a pointer once it observes a flag, while the other thread reads through that pointer and then clears the flag with a relaxed store; running the analysis draws the event structure and steps through the three consistent executions MoRDor derives, with program order, preserved program order and reads-from edges drawn between the events; the Use-After-Free panel reports one execution in which the read of the freed location is ordered after the free, and selecting the finding jumps to that execution's graph; the relaxed store is then changed to a release store, and re-running leaves two executions and no use-after-free. A recording of the MoRDor web UI: a litmus test is typed into the source panel, in which one thread frees a pointer once it observes a flag, while the other thread reads through that pointer and then clears the flag with a relaxed store; running the analysis draws the event structure and steps through the three consistent executions MoRDor derives, with program order, preserved program order and reads-from edges drawn between the events; the Use-After-Free panel reports one execution in which the read of the freed location is ordered after the free, and selecting the finding jumps to that execution's graph; the relaxed store is then changed to a release store, and re-running leaves two executions and no use-after-free.
From a racy reclamation pattern to a use-after-free and back to a verified fix. [fig1]

The same analysis runs from the command line:

A recording of a terminal running the MoRDor CLI on the same program: mordor interpret prints the symbolic event structure; mordor run reports 14 events, 3 executions, Valid: true and Undefined Behavior: true, one execution freeing the cell another thread is still reading; diff -u against the fixed program shows the one changed line, the relaxed store *rcu := 0 becoming the release store *rcu :rel= 0, plus an added forbid (ub) assertion; mordor run on the fixed program reports Undefined Behavior: false with fewer executions; finally mordor visual-es with --output-mode dot exports an event structure as a Graphviz digraph.
The same use-after-free found and fixed with the CLI, every command really run. [fig2]

It is a reference implementation of Symbolic Modular Relaxed Dependencies (sMRD), following “Symbolic MRD: Dynamic Memory, Undefined Behaviour, and Extrinsic Choice” by Jay Richards, Daniel Wright, Simon Cooksey, and Mark Batty (OOPSLA 2025).

Memory models

A litmus test names its model in the annotation of its assertion, for example allow (r1 = 1) [RC11]; a test that names none runs under sMRD. Every model but the promising semantics checks the executions sMRD derives, and every model links to its entry in the Relaxed Memory Model Zoo. The best known are listed below (tbl1).

Model Annotation Description
sMRD smrd Symbolic MRD (Richards et al., OOPSLA 2025), the default: dependencies, preserved program order, release/acquire synchronisation and lock order.
RC11 rc11 Repaired C11 (Lahav et al., PLDI 2017).
C11, C++17, C++20 c11, c17, c20 The C and C++ standards, out-of-thin-air executions included.
IMM imm The Intermediate Memory Model (Podkopaev et al., POPL 2019).
SC sc Sequential consistency.
x86-TSO tso, x86-tso Total store order.
OCaml ocaml The OCaml memory model (Dolan et al., PLDI 2018).
Promising 1.0, 2.0 ps1, ps2 Promising semantics (Kang et al., POPL 2017; Lee et al., PLDI 2020), computed operationally from promises, certification and per-thread views.
The best-known models MoRDor checks, with the annotation that selects each in a litmus test. [tbl1]

MoRDor also supports: