Reading for 11/30: CompCert #418
Replies: 9 comments 26 replies
-
Speaking to safety critical aeronautic code verification, SpaceX uses Astree static analysis and extensive testing of its C++ flight control code base. As noted in a 2014 NASA example collection of formal verification methods applied to certification of critical systems, the onus of checking the model checker (and serious liability consequences) can lead to failure to share real full methods and case studies so each organization must resort to build and roll their own proprietary verification infrastructure. Also of note is that despite providing 203 pages of case study and supporting material, even they "do not address the verification of Executable |
Beta Was this translation helpful? Give feedback.
-
Regarding the first question, while soundness indeed holds greater importance in compiler verification, dismissing the need for formal verification of completeness, especially for deterministic programs, might overlook potential risks. Overlooking completeness, even in deterministic scenarios, could lead to unnoticed discrepancies between the source and generated code that may evade testing. The paper's authors acknowledge that completeness issues are challenging to test comprehensively due to the vast input space, leaving potential corner cases unexplored; this could raise concerns about relying solely on testing to validate completeness, as testing might not cover all possible scenarios, potentially leaving critical vulnerabilities unaddressed. While soundness takes precedence, considering formal verification for completeness ensures a more comprehensive assurance of a compiler's correctness, minimizing the likelihood of undetected issues in compiled code. |
Beta Was this translation helpful? Give feedback.
-
One major obstacle to the widespread adoption of CompCert in sectors like defense and avionics is the established reliance on proprietary compilers. These industries often have stringent requirements for security, reliability, and compatibility, leading them to develop or use custom-tailored compilers. Shifting to an open tool like CompCert might raise concerns over control, integration with existing systems, and meeting specific compliance standards. Additionally, the transition would require significant investment in terms of training, testing, and possibly modifying the tool to fit into established workflows. These factors combined make the adoption of CompCert a challenging proposition for industries that rely heavily on proven, bespoke software solutions. |
Beta Was this translation helpful? Give feedback.
-
Just because code is well-trusted does not necessarily mean it is correct; indeed, this paper was able to find bugs in many trusted C compilers (CompCert included). If we truly want a fully verified compiler, then it is important to ensure that all parts of the compiler in question are verified. Though CompCert does come a long way in terms of verifying certain aspects of compiler correctness, it's important to note that there can always still be lurking bugs in its unverified components. |
Beta Was this translation helpful? Give feedback.
-
I guess not.
Formal verification is not magic, so it doesn't seem like their methods would scale well to more complicated programming languages, architectures, or optimization strategies. It sounds like too much work. For example, wouldn't a lot of the perks of object-oriented programming, like dynamic polymorphism, be hard to reconcile with formal verification? Are semantics often the bottleneck of formal verification methods? I'm not very familiar with the research area, so I am curious what you guys think. |
Beta Was this translation helpful? Give feedback.
-
Reading the line,
reminded me of Ken Thompson's Turing award lecture on introducing silent vulnerabilities (or even exploits) into the C compiler: https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf I hope that verified compilers will give at least some more confidence that our compilers are secure. |
Beta Was this translation helpful? Give feedback.
-
This does feel like the end-goal, to have a language that is inherently safe(r than C) with a verified compiler. Maybe this is wishful thinking, but looking at the benchmarks I want to say this will come sooner than later. The use of "verified verifier" is also interesting; the optimizations can be more easily implemented and then a verifier comes along and checks afterward. There are tradeoffs with complete correctness but it seems certainly possible to handle the aggressive optimizations in most use cases |
Beta Was this translation helpful? Give feedback.
-
This paper was the first time that I had seen things from my System Security class outside of the class, which was super fun! Terms like trust, high-assurance, low-assurance -- security terms with heavy implications -- really brought me to the realization that frequently we do have a lot of axiomatic trust in our compiler stack. Writing correct source code is hard enough, and frequently developers have the mindset of "the compiler is going to help optimize something like this, because the compiler is smarter than me." Looking at this -- and how we can only verify a very small subset of C (even though they say its a large subset, they make a lot of C's flexible memory manipulation impossible) -- does not provide a very strong basis for trust in our compilers at all. I know that software engineers are meant to mitigate this by doing a lot of testing and good code writing, but many software developers also do not do those things, and makes we wonder if it's a bit disheartening that we must have some large number of vulnerabilities hiding in source code around the world due to compiler bugs? Or if most vulnerabilities still come from source code, rather than compilation. Side note, I like how the semantic preservation definition is predicated on "S safe" -- its a bit remniscient on like... C++ compilers having an incredibly long list of undefined behaviors that say "because you have this UB, your program can go absolutely wild now." I wonder if that is exactly done for semantic preservation and "S safe"? |
Beta Was this translation helpful? Give feedback.
-
This is really interesting. I'm very curious about how exactly the code of the compiler itself and the proof of algorithms are bridged. This argument seems to imply that functional languages are easier to prove then conventional imperative language. Why is this the case? |
Beta Was this translation helpful? Give feedback.
-
Hello! @stephenverderame, @alifarahbakhsh, and I will be leading a discussion about the CompCert paper on 11/30. Please discuss your questions and insights below! Here are a couple questions to get started.
Beta Was this translation helpful? Give feedback.
All reactions