arXiv:2608.26353cs.CRAug 2026

Manuscript Offprint

arXiv:2608.26353

FRESCO: Complete and Scalable Temporal Safety for CHERI Application Processors

Merve Gülmez, Nils Jordan, Jialun Zhang, Hossam ElAtali, Gang Tan, N. Asokan, Thomas Nyman

Abstract

CHERI provides hardware-enforced spatial memory safety. While prior work extends it with heap temporal safety, stack use-after-return remains unaddressed. Existing defenses fall short: compiler analysis reliably catches only references that escape as function return values, while dynamic sanitizers impose overheads that preclude production deployment.

We present FRESCO, built on the principle that a stack capability must not outlive the frame that created it. FRESCO “colors” the stack pointer with per-invocation provenance identifiers; every capability derived from it inherits that lifetime and is hardware-invalidated the moment the function exits, regardless of how or where it escaped. Because stack frames retire orders of magnitude more frequently than heap allocations, FRESCO manages the resulting color pressure through: 1) Color Saver, a static capability-aware escape analysis that confines coloring to functions needing it, and whose core algorithm we mechanically verify in Rocq, and 2) capability-color segmentation, which partitions memory into disjoint segments, each with an independent color namespace. Color segmentation lets stack and heap temporal safety coexist on one system, making FRESCO the first hardware/software co-design to provide complete and scalable temporal safety for CHERI application processors. We realize FRESCO on the CHERI-RISC-V QEMU full-system emulator and the out-of-order CHERI-Toooba FPGA softcore, with software support in the CHERI-enabled Clang/LLVM compiler and CheriBSD OS. FRESCO systematically prevents use-after-return, use-after-free, and double-free across the NIST Juliet Test Suite and CVEs, with only a small run-time overhead in SPEC CPU ( ≈\approx 4% g.m.), SQLite, and PostgreSQL ( ≈\approx 10 – 14%).

1 Introduction

Capability Hardware Enhanced RISC Instructions (CHERI) is a prominent design for hardware-assisted memory safety. By using capabilities—hardware-supported descriptions of permissions—instead of conventional pointers, it inherently provides hardware-enforced spatial safety for C and C++. Prior work augments CHERI to also provide temporal-safety guarantees by mitigating heap-based use-after-free/use-after-reallocation vulnerabilities [1, 2, 3, 4]. However, they only cover heap allocation in CHERI application processors, leaving stack use-after-return unmitigated. Stack use-after-return bugs occur when a stack-allocated object is used after the function where the object is defined has returned. Compiler-based escape analysis can reliably detect use-after-return when stack-local references escape the allocating function as return values (as returning such a reference is always an error), but escapes via, e.g., pointers embedded into heap-allocated or global objects require dynamic analysis, e.g., sanitizers [5, 6].

This paper and contributions. Building on recent work introducing colored capabilities [3] to CHERI, we design stack coloring, a novel stack-focused temporal-safety scheme which deterministically protects against use-after-return. Stack coloring leverages the ability to simultaneously retract sets of colored capabilities at once without the need to fully revoke them. It turns the stack pointer capability into a colored capability ensuring that any capabilities that reference allocations in a particular stack frame reflect a stack allocation's provenance through a 'color' (provenance identifier) assigned to precisely that frame. By retracting dangling capabilities to retired stack frames when a function returns, stack coloring prevents use-after-return conditions regardless of how references escape the functions their allocations belong to.

Since stack frames are retired orders of magnitude more frequently than heap allocations, we must scale colored capabilities well beyond the ≈2M\approx 2M unique provenance identifiers (IDs) in prior work [3] to support stack coloring. We manage the resulting color pressure through two complementary mechanisms: 1) Color Saver: a compiler extension which confines coloring to functions that need it through a capability-aware escape analysis and prevents stale capability reads from reused stack memory; we mechanically verify the soundness of its escape classifier in Rocq [7], and 2) capability-color segmentation: a hardware feature that associates segments of memory with distinct provenance-validity tables (PVTs), allowing ≈2M\approx 2M colors per memory segment.

Color segmentation allows stack and heap temporal-safety enforcement leveraging colored capabilities to coexist on the same system. Further, we demonstrate how color segmentation improves performance of heap temporal-safety enforcement in color-segmented allocators. This enables us to realize a full temporal-safety solution for CHERI in FRESCO, the first hardware/software co-design providing complete and scalable temporal safety for CHERI application processors.

∗^{*}The authors contributed equally to this research.

In summary, our contributions are:

  • A complete temporal-safety solution for CHERI combining stack coloring, a novel stack temporal-safety scheme leveraging colored capabilities ( §4.1§4.1); and a color-segmented allocator enforcing temporal safety of heap allocations ( §4.2§4.2). We implement stack coloring in CHERI-enabled Clang/LLVM ( §6.2.2§6.2.2) and a jemalloc-based color-segmented allocator in CheriBSD ( §6.3.3§6.3.3).

  • Color Saver, combining capability-aware escape analysis and stale-read prevention to reduce color use without weakening guarantees ( §4.1.1§4.1.1). We integrate Color Saver with CHERI-enabled Clang/LLVM ( §6.2.1§6.2.1) and mechanically verify the basic escape classifier in Rocq ( §5.1§5.1).

  • Capability-color segmentation, an extension to colored capabilities [3] scaling them well beyond ≈\approx 2M provenance IDs ( §4.1.1§4.1.1). We implement color segmentation in FRESCO, a CPU design based on CHERI-RISC-V realized in the QEMU full-system emulator and CHERI-Toooba [8] FPGA softcore ( §6§6).

• Showing FRESCO systematically prevents use-after-return, use-after-free, and double-free conditions in NIST Juliet test cases and real-world CVEs ( §7.1§7.1).

• Demonstrating the efficacy of the full solution running on FRESCO in the SPEC CPU benchmarks and real-world SQLite, PostgreSQL, and gRPC benchmarks ( §7.3§7.3).

References (46)