logoalt Hacker News

musicaleyesterday at 6:18 AM8 repliesview on HN

I want an OS distro where all C code is compiled this way.

OpenBSD maybe? or a fork of CheriBSD?

macOS clang has supported -fbounds-safety for a while, but I"m not sure how extensively it is used.


Replies

kgeisttoday at 3:53 PM

Maybe this:

https://fil-c.org/pizlix

>Pizlix is LFS (Linux From Scratch) 12.2 with some added components, where userland is compiled with Fil-C. This means you get the most memory safe Linux-like OS currently available.

The author, @pizlonator, is active on HN.

show 2 replies
wyldfiretoday at 2:06 PM

You need to annotate your program with indications of what variable tracks the size of the allocation. So, sure, but first work on the packages in the distro.

Note that corresponding checks for C++ library containers can be enabled without modifying the source. Google measured some very small overhead (< 0.5% IIRC) so they turned it on in production. But I'd expect an OS distro to be mostly C.

[1] https://libcxx.llvm.org/Hardening.html

bombcartoday at 2:08 PM

Get gentoo, add this to CFLAGS and start fixing everything that breaks. Become a hero.

pjmlptoday at 2:34 PM

It is called Solaris, and has this enabled since 2015 on SPARC.

https://docs.oracle.com/en/operating-systems/solaris/oracle-...

show 1 reply
1over137today at 2:05 PM

>I want an OS distro where all C code is compiled this way.

You first have to modify "all C code". It's not just a set and forget compiler flag.

prussiantoday at 2:34 PM

Fedora and its kernels are built with GCC's _FORTIFY_SOURCE and I've seen modules crash for out of bounds reads.

show 1 reply
groundzeros2015today at 3:19 PM

What are you hoping it will achieve?

show 1 reply
pezgrandetoday at 2:17 PM

does any distro uses clang? I thought all linux kernels were compiled using gcc.

show 3 replies