Compilation pipeline hardening reduces timing side-channel leakage on RISC-V
The authors claim their taint-driven control-flow transformations produce binaries safe against timing attacks despite lacking cycle-accurate constant-time execution
Security & privacy arXiv 14 Oct 2026 Defense Prototype evidence
Published as “FreeSBee: A Constant-Time Compilation Pipeline”
Why it matters
The pipeline can be adopted in existing CompCert-based build flows to substantially reduce timing side-channels in embedded C code, but developers must still apply additional mitigations for cache effects and instruction-level timing variations.
Summary
The hardening pipeline reduces timing variance of the AES decryption function, dropping the standard deviation from 78.8 to 19.3 cycles and making best-case and worst-case static timing estimates coincide for simple, memory and const-i models, indicating constant-time behavior under those models. However, statistical t-tests still show occasional values above the leakage threshold, revealing remaining cache-related side-channels that require manual source-level mitigation, and the approach does not address operand-dependent instruction timing.
What they found 4
- Standard deviation of decryption time drops from 78.8 to 19.3 cycles after hardening.
“As can be observed in Figure 3, while the average execution time after hardening is higher due to linearization and predication, the standard deviation drops from 78.8 to 19.3 cycles, and spikes disappear.”
- Best-case and worst-case timing estimates coincide for simple, memory and const-i models after hardening.
“After applying hardening, the best-case and worst-case results coincide for the timing models simple, memory, and const-i, so the code can be considered constant-time in these basic models.”
- Statistical t-values are lower after hardening but some still exceed the leakage threshold, indicating residual cache effects.
“After hardening, the t-values are significantly lower, although some do still exceed the threshold and a general trend for rising values can be observed (Figure 6). This also suggests the presence of secret-related cache effects that are still present after CFG hardening.”
- Manual cache-countermeasure eliminates secret-dependent variance, with no t-value exceeding 4.5 after applying it.
“The t-test, shown in Figure 7, confirms our assessment that any observed variance is now independent of the secret: no value exceeds the threshold value of 4.5 and no rising trends are identifiable.”
Caveats 8
- Some Welch's t-test values still exceed the 4.5 threshold after CFG hardening, showing remaining leakage.
- Cache-related timing variance persists unless a manual source-level transformation is applied.
- The pipeline does not address operand-dependent instruction timing (e.g., early-out multipliers).
- The approach does not achieve cycle-accurate constant-time execution.
- In this work, we mainly consider execution time variability introduced by control flow and, to some extent, caching. We acknowledge possible operand dependent variability in the execution time of individual instructions aside from control-transfer and load/store instructions.
- In rare cases, when a loop exits only through a secret exit and never through a public one before the transformation, it will loop forever after the transformation. Our pipeline rejects programs with loops that only have secret exits.
- We did not consider any microarchitectural effects aside from caching effects.
- While the implemented compiler extension eliminated only execution time variance introduced via control flow, the general approach is also applicable for handling possible side-channels introduced by the target CPU’s microarchitecture if those effects are known.
What’s new here 4
- Integrates taint analysis with an automated control-flow linearization pass in CompCert.
- Evaluates hardened binaries using both static timing analysis across multiple microarchitectural models and Welch's t-test statistical analysis.
- Demonstrates a semi-automated source transformation to eliminate cache-based timing variance.
- Provides a workflow that can be incorporated into existing embedded build systems without requiring hardware-specific models.