|
|
Log in / Subscribe / Register

Memory-safe C code

Memory-safe C code

Posted Nov 20, 2025 22:28 UTC (Thu) by anton (subscriber, #25547)
In reply to: Memory-safe C code by khim
Parent article: Rust in Android: move fast and fix things (Google Security Blog)

If such thing would have been created 20 or even 10 years ago it would have been very interesting
There were several C implementations that caught bounds violations presented at the poster session of PLDI 2002 (probably elsewhere, too, but I was involved in that poster session, so I remember that). They used fat pointers for that work. Somehow that did not catch on, but in recent years I have read about similar things, this time including protection against dangling pointers and double free, with even fatter pointers. I think there has been an LWN article about such an effort recently.

In 2006 I listened to a talk by George Necula, where he explained that one needs to go with the regular ABI in order to be accepted, so he presented an approach that allowed sticking with the regular ABI: Add some annotations about the code (e.g., that argc provides the upper bound of argv), and the bounds correctness will either be proven at compile time or checked at run-time. This sounded very interesting to me. This has been implemented in the Ivy/Deputy work. After the research project ended (AFAIK in 2009 or so), nobody productized this work, so apparently it was not "very interesting" to the C programmers at the time.

I still think it's saner to add some annotations to a C program than to rewrite it in Rust, but apparently there is some cultural hurdle that cannot be taken: Some programmers welcome the checking, but they don't program in C, not even in deputized C; other programmers program in C, but they are not interested in the features that Ivy/Deputy or the fat-pointer C implementations offer. And it seems to me that this is just as true now as it was 20 or 10 years ago.


The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:

Note: you can avoid this step in the future by logging into your LWN account.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds