News for hackers. Stuff that matters.
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by transpute on Tuesday March 19, 2024 @12:17AM (#39752906)
Probabilistic Arm MTE memory safety is a stepping stone to deterministic CHERI hardware, https://saaramar.github.io/memory_safety_blogpost_2022/ & https://news.ycombinator.com/item?id=39668053

  The right kind of mitigations targets the 1st order primitive; the root cause of the bug.

  Hardware solutions: CHERI (Morello, CheriIoT), MTE
  Software mitigations: kalloc_type+dataPAC, AUTOSLAB, Firebloom, GuardedMemcpy, CastGuard, attack surface reduction
  Safe programming languages: Rust, Swift

  MTE/CHERI play pretty nicely - they help ensure that whatever bugs we have in these areas are killed at their root cause… MSR, MSRC and Azure Silicon pushed for… scaling CHERI down to RISC-V32E, the smallest core RISC-V specification.
Microsoft Research open-sourced a hardware/software stack for CHERI in IoT devices, https://msrc.microsoft.com/blog/2023/02/first-steps-in-cheri...

  CHERI-based microcontroller that aims to… get very strong security guarantees if we are willing to co-design the instruction set architecture (ISA), the application binary interface (ABI), isolation model, and the core parts of the software stack… our microcontroller achieves the following security properties:

  Deterministic mitigation for spatial safety (using CHERI-ISA capabilities).
  Deterministic mitigation for heap and cross-compartment stack temporal safety (using a load barrier, zeroing, revocation, and a one-bit information flow control scheme).
  Fine-grained compartmentalization (using additional CHERI-ISA features and a tiny monitor).
David Chisnall, U of Cambridge, https://lobste.rs/s/gnjx2n/c_can_be_memory_safe#c_9ohzku via https://eclypsium.com/blog/a-faster-path-to-memory-safety-ch...

> There are around 13 billion lines of open source C and C++, which end up in various TCBs. This number gets even bigger when you include proprietary code… if we all stopped writing C/C++ code now and every software engineer focused on rewriting legacy code in safe languages (and on the assumption that everything can be written in safe languages) then it would take 5-10 to replace everything and we’d likely see a lot of logic bugs because we’d be replacing old well-tested code with new code that would need different algorithms and data structures to fit with allowable idioms in safe languages.

> If we didn’t do the rewriting thing and just stopped writing code in C/C++, then at normal code replacement rates, our TCBs would be entirely safe in around 50 years. If we don’t all agree to stop writing C/C++, it’s at least 100 years.

> In contrast, if the major CPU vendors shipped CHERI CPUs in five years, most machines (and all high-value ones) would have memory safety within 15 years of today, without needing programmers to change their behaviour.

Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by pjmlp on Tuesday March 19, 2024 @03:41AM (#39753699)
There is also Solaris SPARC ADI, that most folks keep forgeting, because Oracle and the state of Solaris SPARC, unfortunely.
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by fanf2 on Tuesday March 19, 2024 @07:47AM (#39754792)
That’s comparable to MTE, and much weaker than CHERI.
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by pjmlp on Tuesday March 19, 2024 @08:06AM (#39754893)
CHERI is great, but until it becomes a widespread product and not ARM Morello test board, or current RISC-V prototype, anything else in production is better than nothing.
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by yjftsjthsd-h on Tuesday March 19, 2024 @09:51AM (#39755739)
Does SPARC count as being in production anymore?
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by pjmlp on Tuesday March 19, 2024 @11:54AM (#39757088)
It definitely counts, it is available for anyone that still wants to buy one.
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by pigeons on Tuesday March 19, 2024 @10:28AM (#39756072)
Its certainly available though.
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by gchadwick on Tuesday March 19, 2024 @05:55AM (#39754211)
For anyone interested in CHERI for embedded/IoT and other similar use cases lowRISC (whom I work for) are building a couple of FPGA based evaluation platforms for CHERIoT (The Microsoft created CHERI variant referred to above): https://www.sunburst-project.org/

The first is the Sonata system: https://github.com/lowRISC/sonata-system. This comprises a dedicated PCB with an FPGA along with various peripherals and headers. The PCB design is done and will be available through Mouser (plus it's open source including the board layout so you can assemble your own if you like). We're currently working on the RTL for the FPGA. When complete you'll have a complete CHERIoT based microcontroller like system with documentation and tooling.

Additionally we're building the Symphony system, which combines Sonata with the OpenTitan Earl Grey root of trust: https://github.com/lowRISC/symphony-system

Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by rightbyte on Tuesday March 19, 2024 @07:14AM (#39754616)
The root problem seems to be that the user is executing malicious code and abuse some MMU hash collision.

The exploit can probably be written in most languages, including Rust.

Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by helloooooooo on Tuesday March 19, 2024 @07:24AM (#39754665)
What are you smoking?
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by rightbyte on Tuesday March 19, 2024 @08:45AM (#39755139)
I am chewing my tabacoo. Maybe I misunderstood the article ...
Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by hedora on Tuesday March 19, 2024 @10:31AM (#39756105)
Since this was an off-CPU hardware bug, I don't see how CHERI would help.

Anyway, the last time I looked into it, CHERI wasn't sound: It was still possible to write memory bugs on top of it. Have they fixed that yet?

Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by sweetjuly on Tuesday March 19, 2024 @11:28PM (#39762625)
Yes and no. CHERI provides bounds safety but not lifetime safety. If you use capability enhanced garbage collection you can have both, but obviously bolting garbage collection on top of everything you're already doing with manual management (reference counting, etc.) in your existing C/C++ codebase is going to be the worst of both worlds.

Lifetime safety is a much harder problem to solve. Despite CHERI providing ""more robust"" bounds safety, the fact that you get decent lifetime safety for essentially free from MTE is a huge plus. The two technologies aren't incompatible so in theory you could bolt the two together to get MTE lifetime safety and CHERI bounds safety, but that would likely waste a ton of memory.

Re:Gaining kernel code execution on an MTE-enabled Pixel 8 by zdragnar on Tuesday March 19, 2024 @10:47AM (#39756249)
> then it would take 5-10 to replace everything

If we're talking years, that seems wildly optimistic. I imagine the bike-shedding alone would take that long.