Residual Data

Domain Switch Flush

Zeroes all shared workspace buffers on every domain switch, verified clean before the new domain activates. Prevents covert channels through residual state in shared memory between SECRET and OFFICIAL domains.

System Topology — Shared Workspace with Flush
  +------------------+                        +-------------------+
  |  domain_secret   |                        |  domain_official  |
  |    (pri 100)     |                        |    (pri 100)      |
  +--------+---------+                        +---------+---------+
           |                                            |
       secret_buf                                 official_buf
           |                                            |
           +--------------------+  +--------------------+
                                |  |
                      +---------+--+---------+
                      |  switch_controller   |
                      |  (trusted, pri 200)  |
                      |                      |
                      |  maps: secret_buf    |
                      |        official_buf  |
                      |        workspace     |
                      +----------------------+
                                |
                           workspace
                        (zeroed on switch)

  Workspace is zeroed completely on every domain switch.
  Verified clean before new domain activates.
3
Protection Domains
3
Memory Regions
2
Channels

Security Properties

seL4 Microkit + C

The switch controller runs at priority 200 with access to both domain buffers and the shared workspace. On receiving a switch notification, it zeroes the workspace and verifies the result before notifying the new active domain.

System Description domain_switch_flush.system
<?xml version="1.0" encoding="UTF-8"?>
<system>
    <memory_region name="secret_buf" size="0x1_000" />
    <memory_region name="official_buf" size="0x1_000" />
    <memory_region name="workspace" size="0x1_000" />

    <protection_domain name="domain_secret" priority="100">
        <program_image path="domain_secret.elf" />
        <map mr="secret_buf" vaddr="0x4_000_000" perms="rw" setvar_vaddr="secret_buf_vaddr" />
    </protection_domain>

    <protection_domain name="domain_official" priority="100">
        <program_image path="domain_official.elf" />
        <map mr="official_buf" vaddr="0x4_000_000" perms="rw" setvar_vaddr="official_buf_vaddr" />
    </protection_domain>

    <protection_domain name="switch_controller" priority="200">
        <program_image path="switch_controller.elf" />
        <map mr="secret_buf" vaddr="0x4_000_000" perms="rw" setvar_vaddr="secret_buf_vaddr" />
        <map mr="official_buf" vaddr="0x5_000_000" perms="rw" setvar_vaddr="official_buf_vaddr" />
        <map mr="workspace" vaddr="0x6_000_000" perms="rw" setvar_vaddr="workspace_vaddr" />
    </protection_domain>

    <channel><end pd="domain_secret" id="1" /><end pd="switch_controller" id="1" /></channel>
    <channel><end pd="domain_official" id="1" /><end pd="switch_controller" id="2" /></channel>
</system>
Key Code Highlight switch_controller.c
typedef enum { DOMAIN_SECRET, DOMAIN_OFFICIAL } domain_t;
static domain_t active = DOMAIN_SECRET;

static void flush_workspace(void) {
    /* Zero entire workspace region */
    memset((void *)workspace_vaddr, 0, WORKSPACE_SIZE);
}

static int verify_clean(void) {
    /* Verify every byte is zero before allowing new domain */
    volatile uint8_t *p = (volatile uint8_t *)workspace_vaddr;
    for (size_t i = 0; i < WORKSPACE_SIZE; i++) {
        if (p[i] != 0) return 0;
    }
    return 1;
}

void notified(microkit_channel ch) {
    flush_workspace();
    assert(verify_clean());  /* Must be clean before switch */

    active = (active == DOMAIN_SECRET)
        ? DOMAIN_OFFICIAL : DOMAIN_SECRET;

    microkit_channel target = (active == DOMAIN_SECRET)
        ? SECRET_CH : OFFICIAL_CH;
    microkit_notify(target);
}
Full implementation available on request. Contact us at alex.potanin@anu.edu.au.
Coming Soon

Fiducia Specification

The Fiducia version will write the domain switch as a process. The flush becomes a named computation event that runs before every switch, and the SECRET/OFFICIAL state becomes a guard.

  • Flush as a computation event — The process runs flush before every switch, so the order is in the program and in the UPPAAL model, not buried in C
  • Switch as guarded choice — The current domain picks the branch; fire verify can check that no path switches without flushing
  • Contract on the flush — An ACSL contract on the C flush (the workspace is all zeroes afterwards), proved with Frama-C