LWN: Comments on "CHERI with a Linux on top" https://lwn.net/Articles/1037974/ This is a special feed containing comments posted to the individual LWN article titled "CHERI with a Linux on top". en-us Fri, 07 Nov 2025 09:28:25 +0000 Fri, 07 Nov 2025 09:28:25 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net CHERI plus/versus Rust https://lwn.net/Articles/1041017/ https://lwn.net/Articles/1041017/ tialaramex <div class="FormattedComment"> One nice property of Rust for CHERI is that Rust provides explicit provenance APIs. So you can see OK, what's going on (unsafely) here is legal and ought to still work under CHERI or, contrariwise, nope this is not even supposed to work so we need to expect that these parts must be rewritten or we can't target CHERI with this software.<br> <p> All the safe Rust of course is in the first category, but also isn't reaping much benefit from CHERI.<br> <p> core::ptr::without_provenance(addr) and core::ptr::with_exposed_provenance(addr) are largely text, one of them says we offer no justification for why this can be a pointer (maybe it isn't, if we never dereference it then it's fine even in CHERI AFAIU) the other offers the justification of exposure, a feature CHERI does not support, so it's effectively documenting why it won't work with CHERI.<br> <p> On the other hand some_pointer.with_addr(addr) promises to work under CHERI because we're saying if we keep the CHERI capability bits from some_pointer, but use the address addr instead of the address from some_pointer that's also a valid pointer. On my x86-64 there are no capability bits, but on CHERI there are and on both this works _if_ it would be correct to do this, MIRI can check it, and CHERI can use it.<br> </div> Mon, 06 Oct 2025 19:28:47 +0000 CHERI plus/versus Rust https://lwn.net/Articles/1040891/ https://lwn.net/Articles/1040891/ erithax <div class="FormattedComment"> Does CHERI provide additional memory safety even to Rust programs?<br> <p> <span class="QuotedText">&gt; ""what role do you see CHERI playing in an environment where a majority, even a vast majority, of all C code has been replaced with Rust?"" Shaw said that he wonders how successful TRACTOR will be, given that AI techniques may fall short of being able to reliably translate C for all of the different programs needed. Meanwhile, though, he does not see CHERI and Rust as being in conflict at all; the two can work together and it is something the project is putting effort into. ""There will be a CHERI Rust compiler."" </span><br> <p> This answer does not clear up much. My guess is it would only improve the safety of `unsafe` Rust, like running in Miri does, but with much less performance degradation than Miri, enabling its use in production. While that is a nice safety improvement, we should then weigh whatever performance penalty CHERI has against the small amount of unsafe operations that it protects.<br> <p> <span class="QuotedText">&gt; While memory safety is definitely important, the compartmentalization afforded by CHERI is more interesting to him. ""Being able to get least privilege in software is a real big step forward, I think."" None of the current languages attack that problem, he said, so it would take ""a further evolution of language in order to support this whole concept nicely"". </span><br> <p> I would agree that the non-memory-safety aspects of capability-based security are as important. However, although language support for capabilities should definitely improve, just about every language contains the groundworks of capabilities through encapsulated objects and parameter passing. Additionally, language support is not required for stronger use of capabilities in an OS: see Redox OS.<br> <p> Also, unlike CHERI, Rust can afford memory safety on all existing hardware, awaiting rustc_codegen_gcc support for exotic platforms, which, mind you, probably won't support CHERI.<br> Lastly, I think there's a reason that patching fluid software to fix mistakes in fixed hardware is the norm, and not the other way around. What does CHERI address that could not be fixed in software?<br> </div> Mon, 06 Oct 2025 11:06:35 +0000 Capability Revocation and Indirection https://lwn.net/Articles/1040629/ https://lwn.net/Articles/1040629/ jake <div class="FormattedComment"> <span class="QuotedText">&gt; Then you're using the wrong database server :-)</span><br> <p> Please do not continue down this path, Wol. You have been asked before. Your favorite hobby horse is off-topic on this article (and many, many others).<br> <p> thanks,<br> <p> jake<br> </div> Thu, 02 Oct 2025 17:25:05 +0000 Capability Revocation and Indirection https://lwn.net/Articles/1040628/ https://lwn.net/Articles/1040628/ Wol <div class="FormattedComment"> <span class="QuotedText">&gt; I don't see it scaling well to large workloads either. Imagine a database server with hundreds of GB of memory mapped into the process, no way that you want to sweep through all the pointers in that either. And even if you do it in the background concurrently, you will eat a lot of memory bandwidth, and you risk falling behind.</span><br> <p> Then you're using the wrong database server :-)<br> <p> Cheers,<br> Wol<br> </div> Thu, 02 Oct 2025 17:19:23 +0000 Capability Revocation and Indirection https://lwn.net/Articles/1040500/ https://lwn.net/Articles/1040500/ Vorpal <div class="FormattedComment"> <span class="QuotedText">&gt; While CHERI avoids indirection when using a capability/pointer, a consequence is that capability revocation (e.g. free(3)) requires sweeping the process address space to invalidate capabilities. </span><br> <p> Oof, that seems like a complete deal breaker to me. My main interests are in low latency hard realtime code, and that would completely kill any RT guarantees.<br> <p> I don't see it scaling well to large workloads either. Imagine a database server with hundreds of GB of memory mapped into the process, no way that you want to sweep through all the pointers in that either. And even if you do it in the background concurrently, you will eat a lot of memory bandwidth, and you risk falling behind. <br> <p> Which means we are left with a small niche: small systems with no RT guarantees.<br> <p> <span class="QuotedText">&gt; during the pendency of a concurrent background sweep, a CoW-like scheme temporarily traps all reads to sweep specific pages on demand, permitting forward progress before the concurrent sweep completes.</span><br> <p> Isn't there a race condition in that: if you copy the capability around you may be able to copy it from a yet-to-be-swept page to an already swept page while the sweep is somewhere in between those pages? Or maybe I'm misunderstanding you. <br> </div> Thu, 02 Oct 2025 13:03:49 +0000 Capability Revocation and Indirection https://lwn.net/Articles/1039851/ https://lwn.net/Articles/1039851/ NYKevin <div class="FormattedComment"> I can imagine an alternative scheme, which looks roughly as follows:<br> <p> 1. Every "regular" capability is really a double indirection (a pointer-to-a-pointer) in disguise. I will use the term "outer pointer" to refer to the first layer of indirection (exposed to user code) and "inner pointer" to refer to the second layer (the pointee of the outer pointer).<br> 2. When an allocation is created, we create an inner pointer for it. When an allocation is deallocated, we mark its inner pointer as invalid.<br> 3. Inner pointers live in a special region of address space. When it fills up with dead pointers, you unmap the whole region, and map a fresh one somewhere else. The region is not allowed to contain any object other than an inner pointer (no "real" allocations).<br> 4. A region that has ever been mapped for inner pointers during the lifetime of a process can never again be remapped to contain inner pointers (but it can be remapped for any other purpose, so this is not a pervasive restriction and should not break anything else). malloc or its equivalent would be responsible for the necessary bookkeeping, which might involve mapping regions at some fixed or regular pattern of offsets to reduce the amount of data that you need to track.<br> 5. When an outer pointer is dereferenced by user code, you first check the validity of the outer pointer, then check that it points to a region currently mapped for inner pointers, and finally check the validity of the inner pointer.<br> 6. In principle, you could run out of address space doing this, but that ought to take a rather long time if we're using 64-bit addresses. If we really insist on reusing inner pointer regions, one option could be to give each mapping and each outer pointer a generation number, but CHERI pointers are already wider than standard pointers, and I'm not sure this is worth it. Besides, then you're just running out of generation numbers instead.<br> <p> I know that double indirection is significantly more expensive than single indirection... but sweeping address space not only seems like it should be similarly expensive, it gets slower the more memory we allocate (whereas double indirection is a fixed cost per dereference). How much memory do you have to allocate before you hit the break-even point?<br> <p> The other obvious question is how much of this you can hardware-accelerate, and to what extent.<br> </div> Sat, 27 Sep 2025 23:15:21 +0000 Capability Revocation and Indirection https://lwn.net/Articles/1039675/ https://lwn.net/Articles/1039675/ wahern <div class="FormattedComment"> The Cornucopia Reloaded paper I linked earlier has a decent summary and references. The most recent paper on the topic, also with a good summary and references, is A CHERI C Memory Model for Verified Temporal Safety, <a href="https://dl.acm.org/doi/pdf/10.1145/3703595.3705878">https://dl.acm.org/doi/pdf/10.1145/3703595.3705878</a>. One of the earliest papers discussing revocation is the CHERIvoke paper, <a href="https://www.cl.cam.ac.uk/~tmj32/papers/docs/xia19-micro.pdf">https://www.cl.cam.ac.uk/~tmj32/papers/docs/xia19-micro.pdf</a>. Most CHERI-related papers are listed at <a href="https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/cheri-publications.html">https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/ch...</a><br> <p> Also worthwhile to read the core papers on CHERI, especially papers about and subsequent to the ARM Morello implementation. Once you understand the basic architecture, in particular the hidden 129th bit that tags a word (i.e. C pointer) in memory as a valid capability and which is copied along with the visible 128-bit value (e.g. in `char *b = *a;`), it's easy to see understand the problem space regarding revocation. Most of the early work in CHERI was finding and verifying the minimum software and hardware requirements for guaranteed spatial safety that was also maximally performant in hardware and practical to incorporate into existing platforms (language standards, ABIs, kernels, etc). Temporal safety, especially performant revocation, didn't receive as much attention until later, after the shape of capability pointers (i.e. 129-bit compressed pointers) had already largely been settled. But it's still an active area of research and may yet result in some design changes or at least suggest additional hardware facilities for future implementations.<br> <p> </div> Fri, 26 Sep 2025 12:24:59 +0000 Capability Revocation and Indirection https://lwn.net/Articles/1039643/ https://lwn.net/Articles/1039643/ cpatulea <div class="FormattedComment"> <span class="QuotedText">&gt; capability revocation (e.g. free(3)) requires sweeping the process address space to invalidate capabilities</span><br> <p> Any chance you might have a deeper reference for this?<br> </div> Fri, 26 Sep 2025 00:29:08 +0000 Fantastic title! https://lwn.net/Articles/1039467/ https://lwn.net/Articles/1039467/ kevinlyles <div class="FormattedComment"> I haven't read the article yet, but the title made me chuckle.<br> </div> Thu, 25 Sep 2025 12:34:27 +0000 Capability-Based Computer Systems https://lwn.net/Articles/1039419/ https://lwn.net/Articles/1039419/ chmaynard <div class="FormattedComment"> During the mid-1980s, I was looking for technical information about the IBM System/38 and ran across the book "Capability-Based Computer Systems" by Henry M. Levy, published by Digital Press. <br> <p> From the Amazon.com summary:<br> <p> "The book describes early descriptor architectures and explains the Burroughs B5000, Rice University Computer, and Basic Language Machine. The text also focuses on early capability architectures. Dennis and Van Horn's Supervisor; CAL-TSS System; MIT PDP-1 Timesharing System; and Chicago Magic Number Machine are discussed. The book then describes Plessey System 250, Cambridge CAP Computer, and Hydra System. The selection also discusses STAROS System and IBM System/38 ... The book highlights Intel iAPX 432, and then considers segment and objects, program execution, storage resources, and abstraction support."<br> </div> Thu, 25 Sep 2025 06:30:37 +0000 Spectre mitigation overhead https://lwn.net/Articles/1039398/ https://lwn.net/Articles/1039398/ wahern <div class="FormattedComment"> <span class="QuotedText">&gt; Are CHERI capabilities able to provide SPECTRE-resistant isolation between mutually distrustful privilege domains within a single address space?</span><br> <p> Intrinsically, AFAIU, no. But hardware CHERI support, by requiring both bounds and (to varying extents) provenance information to accompany addresses, potentially makes it easier and more natural to avoid side-channels. And maybe more importantly, CHERI provides an opportunity to nail down ISA guarantees before widespread deployment. See Safe Speculation for CHERI, <a href="https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/202411-iccd-cap-contracts.pdf">https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/202...</a><br> <p> </div> Wed, 24 Sep 2025 23:02:38 +0000 Capability Revocation and Indirection https://lwn.net/Articles/1039395/ https://lwn.net/Articles/1039395/ wahern <div class="FormattedComment"> While CHERI avoids indirection when using a capability/pointer, a consequence is that capability revocation (e.g. free(3)) requires sweeping the process address space to invalidate capabilities. In the simplest implementation it's stop-the-world during a linear word-by-word sweep of the address space. There have been several optimizations explored, including schemes to avoid reading memory unnecessarily by skipping words without the out-of-band capability tag bit, concurrent sweeping by leveraging page tables or memory coloring, etc. I think the latest upstreamed to CheriBSD is Cornucopia Reloaded[1]--during the pendency of a concurrent background sweep, a CoW-like scheme temporarily traps all reads to sweep specific pages on demand, permitting forward progress before the concurrent sweep completes.<br> <p> CHERI is great for spatial safety, but the cost of avoiding indirection means temporal safety requires more work. Perhaps the next evolution will be exploring how linear or affine typing in application languages such as Rust could be leveraged to minimize the sweeping work, e.g. by automatically clearing capabilities as they're copied through the application from malloc through free. Or evolving allocation APIs and page table permission schemes so memory that doesn't need to store a capability/pointer can be skipped from sweeping entirely.<br> <p> [1] <a href="https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/202404asplos-cornucopia-reloaded.pdf">https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/202...</a><br> <p> </div> Wed, 24 Sep 2025 22:49:16 +0000 Spectre mitigation overhead https://lwn.net/Articles/1039394/ https://lwn.net/Articles/1039394/ notriddle <div class="FormattedComment"> <span class="QuotedText">&gt; the compartmentalization afforded by CHERI is more interesting to him</span><br> <p> Rust treats speculative execution as completely out of scope. That, as far as I'm concerned, is its biggest weakness and the main reason you still need hardware isolation.<br> <p> A quick Google drops me onto at least one paper &lt;<a href="https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/202411-iccd-cap-contracts.pdf">https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/202...</a>&gt; that claims to address speculative execution in CHERI, but I don't know if that's been incorporated into real cores, if it's long obsoleted by more recent innovation, or if I'm completely barking up the wrong tree.<br> <p> Are CHERI capabilities able to provide SPECTRE-resistant isolation between mutually distrustful privilege domains within a single address space?<br> </div> Wed, 24 Sep 2025 22:32:42 +0000