News for hackers. Stuff that matters.
Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @01:39AM (#27969001)
That paper has many problems. For example:

> There is no particular need to rewrite existing C code, provided the same benefit can be obtained more cheaply by alternative implementations of C

To be clear, those "alternative implementations" do not exist, and no-one actually working on C compilers or tools to make C code safer has been able to produce one, or even come up with a credible plan for producing one.

Re:The Insecurity Industry by h_anna_h on Tuesday July 27, 2021 @02:46AM (#27969373)
This is false. There are multiple safe C implementations. compcert and https://staff.aist.go.jp/y.oiwa/FailSafeC/index-en.html are two such.
Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @03:12AM (#27969521)
Compcert is a verified compiler. It guarantees that the generated code does what the source code requires. It doesn't turn unsafe C programs into safe ones.

"Fail-Safe C" is a research project that has been dead for ten years. Note:

> Some benchmark results show that the execution time are around 3 to 5 times of the original, natively-compiled programs, in avarage

That overhead is actually a lot higher than similar projects I also consider failures, such as CCured.

To be clear, when we talk about "an alternative implementation of C", it needs to give similar performance and other properties (e.g. function and data interop) to other C compilers. You can't impose a 3-5x slowdown and say "look, C is safe".

Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @04:25AM (#27969970)
Actually that is what Oracle did with SPARC ADI, Google/ARM are pushing for with MTE, Apple is trying to do with PAC, Microsoft with Phonon.

When everything else fails, kill the bug with hardware memory tagging spray.

Re:The Insecurity Industry by h_anna_h on Tuesday July 27, 2021 @12:33PM (#27974385)
The CompCert C reference interpreter aborts execution on undefined behavior.

> To be clear, when we talk about "an alternative implementation of C", it needs to give similar performance and other properties (e.g. function and data interop) to other C compilers. You can't impose a 3-5x slowdown and say "look, C is safe".

Pretty much every language (except rust) which claims to be "C but safe" has the same issue, except you have to rewrite your program in it.

Re:The Insecurity Industry by the_why_of_y on Tuesday July 27, 2021 @05:38PM (#27977980)
> The CompCert C reference interpreter aborts execution on undefined behavior.

A C interpreter is not exactly the sort of thing that the embedded software industry has been waiting to deploy in production.

Re:The Insecurity Industry by trasz on Tuesday July 27, 2021 @03:28AM (#27969617)
Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @04:28AM (#27969990)
CHERI is far more than just an "alternative implementation of C". It includes a completely different hardware platform and replacing all your hardware can hardly be considered "cheap".
Re:The Insecurity Industry by trasz on Tuesday July 27, 2021 @05:12AM (#27970301)
It's many orders of magnitude cheaper than replacing all your software.
Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @06:24AM (#27970743)
You can't just adopt that hardware and get memory safety. The hardware is providing support for a capabilities model, which you then have to adopt at a software level both within your OS, compiler, and application code. This also would break C and C++ ABIs, so it's very unlikely to get adopted for a number of cases.

Further, CHERI is not enough to achieve temporal memory safety, it only provides the primitive that one could use to implement an efficient, correct tracing GC.

Perhaps most importantly, one can not use CHERI today. It is just not an option. Memory safe languages exist, and have existed for quite some time.

Pointer tagging and other approaches like CHERI are very promising. Keeping in mind of course that they double the size of pointers and have a global runtime performance cost. Less ambitious but otherwise similar mitigations are already being adopted.

Re:The Insecurity Industry by trasz on Tuesday July 27, 2021 @07:25AM (#27971109)
Indeed, you need the whole stack. However, the (non-temporal) memory safety alone is still quite easy to get - the compiler will take care of it, as a programmer you just need to make sure your code doesn't get in the way by eg manually stashing pointers into non-pointer types. It's been demonstrated on large, real-world code bases, such as FreeBSD and PostgreSQL.

(Disclaimer: been there, done that, part of the CHERI team)

Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @11:00AM (#27973260)
Yep, much of the wins look to be a matter of just recompiling, which is great. I'm a big fan of these pointer tagging techniques in general. I just want to be clear that pointing at CHERI and going "See? We already have memory safe C and C++" is glossing over some important details.

Best of luck with the research, I'm quite bullish on the work.

Re:The Insecurity Industry by neolog on Tuesday July 27, 2021 @05:33AM (#27970419)
The author of that paper has written a safe C implementation.

https://github.com/stephenrkell/libcrunch

Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @08:45AM (#27971744)
I applaud him for giving it a go, but it's far from complete ... no use-after-free protection at all yet, for example.