arXiv:2610.26054cs.PLOct 2026

Manuscript Offprint

arXiv:2610.26054

Blame-aware Recomposition for Secure Compilation Proofs of Low-Level Compartment Isolation

Basile Schlosser, Jérémy Thibault, Catalin Hritcu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Basile Schlosser 1,3^{1,3}

Jérémy Thibault 2,3^{2,3}

Cătălin Hrițcu 3^{3}

1^{1}ENS Paris-Saclay, France

2^{2}EPFL, Lausanne, Switzerland

3^{3}MPI-SP, Bochum, Germany

Abstract—The security guarantees of existing formally verified compilers for compartmentalized programs in unsafe languages like C stop at a rather high level, assuming a built-in protection mechanism and a block-based memory model. Verifying a concrete, low-level enforcement mechanism for compartment isolation is still a major challenge for current proof techniques. In particular, Abate et al.'s proof technique fails because one of their proof steps, recomposition, essentially requires hiding all information about the code of each compartment, which is not practically achievable at a low level. We propose an extension of their proof technique to a low-level setting where compartments can fully observe each other's code. To do so, we introduce an overlay semantics that allows us to characterize these observations as a form of undefined behaviour, and we use a novel variant of recomposition that we call blame-aware recomposition, which essentially allows recomposing executions as needed in the original high-level proof technique, even if the low-level context observes the code, because this context is ultimately going to be discarded. We apply this new proof to a compartment isolation mechanism that uses a programmable tag-based reference monitor.

1 Introduction

Vulnerabilities in software systems can lead to devastating attacks when exploited by malicious attackers. In particular, unsafe languages such as C call out many undefined behaviours (UB), which include various memory safety vulnerabilities that account for 70% of high-severity security bugs, according to both Microsoft and Chrome [8, 29].

Compartmentalization [12, 14, 25, 32, 36] is an often proposed practical countermeasure against vulnerabilities that relies on the principle of least privilege: programs are split into mutually distrustful compartments that interact through protected interfaces. If one compartment is compromised, the security impact on the rest of the program is limited. Compartmentalization is widely deployed in web browsers, which use process-level isolation to protect web sites from each other [25, 26] and software-fault isolation (SFI) [28, 32, 36] to sandbox WebAssembly code and third-party libraries [15, 22].

In order to characterize precisely the security guarantees a compilation chain for compartmentalized source programs should satisfy in the presence of undefined behaviour, Abate et al. [1, 2] propose a criterion: secure compilation should restrict undefined behaviours both spatially (to just the compartments that encounter undefined behaviour), and temporally (compartments are protected until they encounter an undefined behaviour). They reduce their criterion to a variant of a secure compilation criterion known as Robust Safety Preservation (RSP) [3, 24] that they call RSCMDDCRSC_{MD}^{DC}, standing for Robustly Safe Compilation with Dynamic Compromise and Mutual Distrust. Their variant states that any attack mounted by low-level attackers (i.e., low-level compartments that may have been dynamically compromised by undefined behaviour) against a safety property of a compiled program can also be mounted by source attackers (i.e., source-level compartments) against the source program. In addition, they formally verify that a compiler for a simple compartmentalized source language is secure according to this criterion. Since then, this result has been extended to incorporate memory sharing [10], to prove stronger secure compilation criteria [31], and most prominently to build SECOMP [30], a formally secure compiler based on CompCert for a C variant with compartments.

However, a common limitation of these works is that they do not verify secure compilation all the way down to the actual machine; instead, they stop at a relatively high-level assembly language with an abstract view of memory and with an abstract model of compartments built into the semantics. Instead of a realistic flat memory model, where code is laid out in memory, they assume a block-based memory model [20] which only allows for a limited amount of memory unsafety (for instance, they cannot model heap overflows), and have code in a separate part of the state (so it cannot be modified or even read during execution). Hence, their abstract model of compartments is just a specification of what an actual compartment isolation mechanism should do at a lower level.

Abate et al. [1] implement this specification in two lower-level compiler backends: one based on SFI [25, 28, 32], and another one based on a compartment isolation micropolicy [4], a programmable tag-based reference monitor. They leave verifying these backends open, and instead systematically test their SFI backend. Similarly, SECOMP [30] proposes an unverified lower-level backend targeting a variant of the CHERI RISC-V capability machine [35].

These works cannot verify such realistic backends because their proof technique relies on a step called recomposition [2], which allows one to split two whole programs (obtained by linking partial programs together, denoted by a bowtie ⋈\bowtie) that produce the same event trace (calls, returns and outputs; written ↔m\leftrightarrow m) into two parts each, and then recombine these parts into a new whole program that produces the same event trace. In their proof, recomposition lets them replace a target-level context CTC_T with a compiled one CS↓:1C_S\downarrow:^1

∀m,CT⋈P↓⇝mCS↓⋈P′↓⇝m}  ⟹  CS↓⋈P↓⇝m\forall m,\left.\begin{array}{l}\mathbf{C}_{\mathcal{T}}\bowtie\mathbf{P}\downarrow\leadsto m\\ \mathbf{C}_{\mathcal{S}}\downarrow\bowtie\mathbf{P}^{\prime}\downarrow\leadsto m\end{array}\right\}\implies\mathbf{C}_{\mathcal{S}}\downarrow\bowtie\mathbf{P}\downarrow\leadsto m

This step relies on the event traces capturing all possible interactions between compartments, meaning that the traces need to be “fully abstract” [13, 17, 23], and for this, compartments cannot observe other compartments’ code.

This has little chance to hold at a low level, because there are many new observations compartments can make that are invisible (i.e. they don’t appear on event traces) and hard to prevent. A simple example would be reading code directly.

Example 1 (Reading code directly). Consider the following function f belonging to a compartment C1:

C1.f() { x := 100; // guesses an address if (*x < 1000) { // reads at it ... } else { ... } }

This function exploits the fact that there is no difference between a pointer and an integer in the low-level language to read memory at an arbitrary location, and branch on the result. That is a problem, because after code is laid out in memory, address 100 may point to the code of another compartment, so the branch taken by f depends on the code of the compartments C1 is linked with! Hence, compartment C1 learns information about other compartments' code, which is not recorded on the trace.

A second example shows observations through allocation.

Example 2 (Observation through allocation).

C1.f() { x := malloc(1); // allocates one byte C2.g(); y := malloc(1); // allocates another byte if (y - x > 1) { // compares the two addresses ... } else { ... } }

This function allocates a byte, calls a function from another compartment, C2.g, and then allocates another byte. By comparing the addresses of the two allocations, C1 obtains information about the internal behaviour of another compartment, and can branch on it; this breaks recomposition, because allocating and comparing the two addresses are not events that are recorded on the event trace.

With a high-level memory model such as the block-based one of CompCert [20], these observations are not possible, even in CompCert's Asm: subtracting or ordering pointers to different blocks is undefined behaviour, and so is dereferencing an integer. This is why previous recomposition proofs [2, 30] did not run into them: executions stop with undefined behaviour before performing such observations. Compiling further down to a flat memory model turns this undefined behaviour into defined low-level behaviour, so even a compartment compiled from source can perform such observations once it has been compromised by undefined behaviour, which is exactly the dynamic compromise scenario that RSCMDDCRSC_{MD}^{DC} is designed to protect against.

We propose a significant extension of the recomposition-based proof technique of Abate et al. [2] that enables the verification of a secure compilation backend targeting a low-level assembly with a realistic memory model and a compartmentalization mechanism, which we call the low-level backend. Our technique is based on two observations: first, that the partial programs kept in recomposition are both compiled, so they do not trigger undefined behaviours along the considered trace; and second, that one can characterize most behaviours that break recomposition at the lower level as undefined behaviours w.r.t. an overlay semantics [11, 27].

Specifically, we introduce an intermediate language that is all but equal to the low-level language targeted by the backend, except that it considers these behaviours undefined. We write ↔ov\leftrightarrow_{ov} for the overlay semantics (whereas we use ↔\leftrightarrow for the low-level semantics).

We then replace the use of recomposition by a new variant we call blame-aware recomposition. This variant allows recomposing partial programs just like before, with the added precondition that three out of the four partial programs behave in a defined way according to the overlay semantics, i.e., do not have the behaviours that would break recomposition. More specifically, blame-aware recomposition takes two executions:

if CS↓⋈P′↓⇝ovmC_S \downarrow \bowtie P' \downarrow \leadsto_{ov} m in the overlay semantics

and either CT⋈P↓⇝ovmC_T \bowtie P \downarrow \leadsto_{ov} m in the overlay semantics

or CT⋈P↓⇝mC_T \bowtie P \downarrow \leadsto m in the low-level semantics,

but all undefined behaviours

in this execution happen in CTC_T

and yields an execution of the recomposed program CS↓⋈P↓C_S \downarrow \bowtie P \downarrow:

CS↓⋈P↓⇝ovmC_S \downarrow \bowtie P \downarrow \leadsto_{ov} m in the overlay semantics.

The preconditions ensure that the observations that would break recomposition can only occur in CTC_T, which is discarded, while CS↓C_S \downarrow cannot perform such an observation, at least along the trace mm, because it executes in the overlay semantics. This allows proving blame-aware recomposition for low-level backends that don’t explicitly prevent these observations.

Our blame-aware recomposition proof technique is strong enough to deal with observations that can be cleanly characterized in an overlay semantics, such as Example 1. The observations of Example 2 would be difficult to characterize as undefined behaviour in an overlay semantics without overly restricting acceptable behaviours (for instance, comparing pointers to the same block is allowed in CompCert-like memory models, and we would like to preserve this ability) or resorting to very complex tracking schemes. Hence, instead of dealing with Example 2 using overlay semantics, we address it with a compiler-based masking scheme to hide compartments' heap usage: each compartment is statically assigned its own

1^{1}We use bold, dark blue for source objects, and thin, red for target objects.

space in memory, ensuring that all of a compartment’s memory allocations are contiguous independently of other compartments. An advantage of this solution is that it prevents the allocation channel from leaking information not only about other compartments’ code, but also about their data; the latter would be required to extend our guarantees beyond robust safety preservation in the future [3].

We updated the formerly unverified micro-policy backend of Abate et al. [1] to close leaks of this kind, with an allocator that uses our masking scheme. We prove that the resulting backend satisfies blame-aware recomposition using an overlay semantics. Our overlay semantics is constructed as a variant of the micro-policy used at the lowest level: in addition to using the enforcement from the concrete backend, the overlay semantics calls reading and writing to code in memory and executing data undefined behaviours.

To prove blame-aware recomposition in this instance, we reuse the proof diagrams introduced to prove recomposition in SECOMP [30]. While proving the main diagrams of blame-aware recomposition, we are, as expected, forced to reason about the concrete implementation of the compartment isolation mechanism, which is highly relevant for security.

In summary, we put forward the following contributions:

  1. We introduce blame-aware recomposition, a novel variant of recomposition that relies on an intermediate overlay semantics and gives rise to a proof technique that allows one to prove the security of a compiler targeting a low-level backend with a flat memory model.

  2. We generically prove that blame-aware recomposition can be used to replace recomposition and obtain RSCMDDCRSC_{MD}^{DC}. Our technique is formalized in the Rocq proof assistant.

  3. We apply our methodology to the micro-policy backend of Abate et al. [2], modified as described above, proving blame-aware recomposition and as a consequence the security of this backend, in the Rocq proof assistant.

Outline: The rest of this paper is structured as follows: in §2, we describe our new approach in a generic setting. In §3, we discuss our adaptation of the micro-policy backend to make the proofs work. In §4, we discuss how we prove blame-aware recomposition for this backend. Finally, §5 and §6 discuss related and future work.

Artifact: Our formal development is available at the following URL: https://github.com/secure-compilation/when-good-components-go-bad/tree/mp-transitional

References (30)