News for hackers. Stuff that matters.
Re:Boringcc: Proposal for a C compiler for secure software by dxhdr on Monday December 21, 2015 @03:01PM (#10773092)
I'm not sure this would be helpful, working with any unpredictable system is a nightmare. The compiler emitting warnings of undefined behavior being utilized would be the best solution, though it would not be able to identify all scenarios. Input fuzzing would likely get you the rest of the way there.
Re:Boringcc: Proposal for a C compiler for secure software by octo_t on Monday December 21, 2015 @03:04PM (#10773110)
the problem is that the compiler assumes undefined behaviour can never happen ALL the time.

Signed integer overflow is the most common one, since it means you can hoist 32bit ints into 64bit ints so they fit in one register or similar and save hitting the stack.

Re:Boringcc: Proposal for a C compiler for secure software by derefr on Monday December 21, 2015 @04:21PM (#10773608)
I'd personally be fine with being forced to specify what sort of undefined behaviors I want to allow to be "assumed I didn't mean"; it's not a problem for me if some code refuses to compile until I e.g. type-annotate my u32s with "they're not going to overflow, don't worry."

I was about to say that "this would break a ton of other projects"—but actually, it seems like it'd be fine as long as it was an opt-in -W switch.

Re:Boringcc: Proposal for a C compiler for secure software by tacostakohashi on Monday December 21, 2015 @07:32PM (#10774731)
Emitting warnings and errors mostly works fine for undefined behaviors, the real problem is with implementation-defined behaviors.

Let's say that, on the pathological compiler, it's documented that sizeof(int) is 4, and chars are signed if the number of seconds in the current minute is even, otherwise sizeof(int) is 5 and chars are unsigned. If your code compiles and works with either setup, it's probably correct and portable.

It's not really feasible for programmers to avoid implementation-defined things like sizeof(int) varying across implementations, not is it feasible for compilers to detect assumptions made about the implementation's definition in the program. The existence of a pathological compiler would make it far easier to write programs that work across all implementations.

It's true that working with unpredictable systems is a nightmare, but that's precisely the nature of undefined and implementation-defined behavior in C. The existence of a pathological compiler would merely allow developers to work through these issues on a single machine, which would be an improvement on needing to obtain a variety of compilers and platforms test with to find these issues.

Re:Boringcc: Proposal for a C compiler for secure software by __s on Monday December 21, 2015 @06:45PM (#10774466)
It could detect all scenarios by compiling to a C virtual machine which checks for UB at runtime