I am incredibly happy that Apple has added MTE support to the latest iPhones and perhaps the M5 chips as well (?). If that’s the case I don’t think any other personal computers have anything close to Apple machines in terms of memory safety and related topics (Secure Enclave etc).
Hope other vendors will ship MTE in their laptop and desktop chips soon enough. While I’m very positive about x86_64 adding support for this (ChkTag), it’ll definitely take a while…
In my opinion a worthwhile enough reason to upgrade but feels like a waste given my current devices work great.
Not only does M5 have MTE, it has an "enhanced" version of it.
"We conducted a deep evaluation and research process to determine whether MTE, as designed, would meet our goals for hardware-assisted memory safety. Our analysis found that, when employed as a real-time defensive measure, the original Arm MTE release exhibited weaknesses that were unacceptable to us, and we worked with Arm to address these shortcomings in the new Enhanced Memory Tagging Extension (EMTE) specification, released in 2022."[1]
Compiler/runtime support via clang and llvm should help I hope.
I'd like to get to the point where web browsers (for example) always run with memory-safe compilation and runtime features on every platform. OS kernels would be nice as well.
It will be nice to see more OSes ship with memory safety on by default for everything. Maybe OpenBSD is next?
If you don’t mind moving the whole issue to runtime, then sure. The value of rust is that you catch these issues at compile time so you’re not releasing these sorts of bugs in the first place and aren’t reliant on the capabilities of the users machine to catch it for you.
The use of RC is orthogonal to the memory safety guarantees of Rust. The use of RC and safety checking of it is handled at compile time, and only the refcounting aspect is runtime.
RC is a form of declaring shared use and is a parallel to shared_ptr in C++.
And yes there are escape hatches for safety that you can explicitly put yourself in. MTE would catch those at runtime , but you would still have prevented a ton at compile time.
There are also escapes you can find yourself in with memory tagging too.
Also, did you really just create a new account (with an inflammatory name) to crap on Rust while still not being able to address the points in my comment?
Honestly it feels at the right abstraction layer too. With Rust you rely on correctness in translation, it is much better to have defense in depth than in breadth.
> It disappoints me to see hardware compensate for the failures of software. We should have done better.
I disagree. From a user's point of view, hardware-assisted memory safety is always beneficial. As a user of any software, you cannot verify that you are running a program that is free of memory access errors. This is true even when the software is written in Rust or an automatic memory-managed language.
I hope that one day I will be able to enable memory integrity enforcement for all processes running on my computers and servers, even those that were not designed for it. I would rather see a crash than expose my machine to possible security vulnerabilities due to memory access bugs.
I agree. The underlying hardware should be as simple as needed and thus be cheap and consume little power. Fixing bad software practices (like using an unsafe language) via hardware hacks is a terrible mistake.
I always see cheri brought up and admittedly I know very little about it, except that the ergonomics appear poor requiring twice the storage for each pointer and ground up rearchitecting of the OS, making it quite unappealing from an engineering standpoint.
FreeBSD, kernel and base, was ported to CHERI, along with PostgreSQL.
> We have adapted a complete C, C++, and assembly-language software stack, including the opensource FreeBSD OS (nearly 800 UNIX programs and more than 200 libraries including OpenSSH, OpenSSL, and bsnmpd) and PostgreSQL database, to employ ubiquitous capability-based pointer and virtual-address protection.
Um, there's also Memory Tagging which is the topic of this post.
Apple's implemented it as part of the umbrella MIE and eliminates a class of bugs, at least on the surface of their own software, and allows for incremental adoption and doesn't break compatibility with older binaries.
MTE (and PAC before it) store some metadata in previously unused pointer bits, so there are potential issues if you were already using those for something else.
Oh and if your program has memory bugs then you have to fix them of course.
I am incredibly happy that Apple has added MTE support to the latest iPhones and perhaps the M5 chips as well (?). If that’s the case I don’t think any other personal computers have anything close to Apple machines in terms of memory safety and related topics (Secure Enclave etc).
Hope other vendors will ship MTE in their laptop and desktop chips soon enough. While I’m very positive about x86_64 adding support for this (ChkTag), it’ll definitely take a while…
In my opinion a worthwhile enough reason to upgrade but feels like a waste given my current devices work great.
Not only does M5 have MTE, it has an "enhanced" version of it.
"We conducted a deep evaluation and research process to determine whether MTE, as designed, would meet our goals for hardware-assisted memory safety. Our analysis found that, when employed as a real-time defensive measure, the original Arm MTE release exhibited weaknesses that were unacceptable to us, and we worked with Arm to address these shortcomings in the new Enhanced Memory Tagging Extension (EMTE) specification, released in 2022."[1]
The enhancements add:[2]
* Canonical tag checking
* Reporting of all non-address bits on a fault
* Store-only Tag checking
* Memory tagging with Address tagging disabled
[1] https://security.apple.com/blog/memory-integrity-enforcement...
[2] https://developer.arm.com/documentation/109697/0100/Feature-...
It's MTE4. The "enhancements" mostly make it easier for Apple developers to hack XNU into continuing to operate with MTE.
It's more like MTE was originally intended as a debugging tool (like ASan), and MTE4 makes it work as a security hardening measure.
Do you know if macos has the changes needed to make use of MIE with M5? I assume that it has with iPadOS.
do you have a citation for M5 having MTE?
It does.
Compiler/runtime support via clang and llvm should help I hope.
I'd like to get to the point where web browsers (for example) always run with memory-safe compilation and runtime features on every platform. OS kernels would be nice as well.
It will be nice to see more OSes ship with memory safety on by default for everything. Maybe OpenBSD is next?
sel4 ships with memory safety on by default.
Pixels with GrapheneOS also use MTE for security hardening
As usual in these threads, a heads up to Solaris SPARC ADI, and Oracle Linux on SPARC, securing C code since 2015.
https://docs.oracle.com/en/operating-systems/solaris/oracle-...
https://docs.kernel.org/arch/sparc/adi.html
Sooo, less reasons (more excuses) for people to move from C++ to Rust?
When is Rust compiler moving away from LLVM, and GCC integration efforts, both written in C++?
That is the thing, there are endless products written in C++ since the 1980's, which no one is going to rewrite in safer languages.
If you don’t mind moving the whole issue to runtime, then sure. The value of rust is that you catch these issues at compile time so you’re not releasing these sorts of bugs in the first place and aren’t reliant on the capabilities of the users machine to catch it for you.
[flagged]
The use of RC is orthogonal to the memory safety guarantees of Rust. The use of RC and safety checking of it is handled at compile time, and only the refcounting aspect is runtime.
RC is a form of declaring shared use and is a parallel to shared_ptr in C++.
And yes there are escape hatches for safety that you can explicitly put yourself in. MTE would catch those at runtime , but you would still have prevented a ton at compile time.
There are also escapes you can find yourself in with memory tagging too.
Also, did you really just create a new account (with an inflammatory name) to crap on Rust while still not being able to address the points in my comment?
Honestly it feels at the right abstraction layer too. With Rust you rely on correctness in translation, it is much better to have defense in depth than in breadth.
Rust is already part of defense-in-depth. Despite its memory safety, Rust still turns on ASLR, guard pages, stack probes, etc.
Intel / AMD bringing this to x86 soon.
https://community.intel.com/t5/Blogs/Tech-Innovation/open-in...
For the second time though, they borked MPX design.
It disappoints me to see hardware compensate for the failures of software. We should have done better.
> It disappoints me to see hardware compensate for the failures of software. We should have done better.
I disagree. From a user's point of view, hardware-assisted memory safety is always beneficial. As a user of any software, you cannot verify that you are running a program that is free of memory access errors. This is true even when the software is written in Rust or an automatic memory-managed language.
I hope that one day I will be able to enable memory integrity enforcement for all processes running on my computers and servers, even those that were not designed for it. I would rather see a crash than expose my machine to possible security vulnerabilities due to memory access bugs.
How could we have done better without first knowing better?
We have know better for decades, that is why Multics has a higher security score than UNIX, C flaws versus PL/I are noted on DoD report.
I agree. The underlying hardware should be as simple as needed and thus be cheap and consume little power. Fixing bad software practices (like using an unsafe language) via hardware hacks is a terrible mistake.
On the contrary, fixing pervasive and increasingly costly ecosystem issues in hardware is exactly the kind of innovation we need.
wouldn't it be like a crime against the crown to not have a cheri like thing in arm?
I always see cheri brought up and admittedly I know very little about it, except that the ergonomics appear poor requiring twice the storage for each pointer and ground up rearchitecting of the OS, making it quite unappealing from an engineering standpoint.
FreeBSD, kernel and base, was ported to CHERI, along with PostgreSQL.
> We have adapted a complete C, C++, and assembly-language software stack, including the opensource FreeBSD OS (nearly 800 UNIX programs and more than 200 libraries including OpenSSH, OpenSSL, and bsnmpd) and PostgreSQL database, to employ ubiquitous capability-based pointer and virtual-address protection.
Most programs didn't require any changes at all. Even most pointer-integer-pointer conversions can be automatically handled by the toolchain and runtime. See https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/201904...
Sounds good for a clean slate but you couldn't seamlessly transition to it, which is why I said it was unappealing.
> making it quite unappealing from an engineering standpoint
The other option being rewriting everything under the sun from scratch.
Um, there's also Memory Tagging which is the topic of this post.
Apple's implemented it as part of the umbrella MIE and eliminates a class of bugs, at least on the surface of their own software, and allows for incremental adoption and doesn't break compatibility with older binaries.
MTE (and PAC before it) store some metadata in previously unused pointer bits, so there are potential issues if you were already using those for something else.
Oh and if your program has memory bugs then you have to fix them of course.