News

Checked C Targets More Secure, Reliable C Language Coding

Microsoft Research is open sourcing the project to help extend the C language, while also aiming to make it more secure and reliable.

A new project, dubbed Checked C, has emerged from Microsoft Research that aims to increase the the security and reliability of C code, which is the bedrock code base for the bulk of systems software that runs today's infrastructure.

"The Checked C research project is investigating how to extend the C programming language so that programmers can write more secure and reliable C programs," Microsoft Research says on its Web site. "The project is developing an extension to C called Checked C that adds checking to C to detect or prevent common programming errors such as buffer overruns, out-of-bounds memory accesses, and incorrect type casts. The extension is designed to be used for existing system software written in C."

The project is in the research stage, but it's already being put to use in real-world projects such as LLVM/clang. LLVM provides a set of modular and reusable compiler and toolchain technologies, according to its site, which describes Clang as "an "LLVM native" C/C++/Objective-C compiler, which aims to deliver amazingly fast compiles."

Reducing errors such as buffer overruns, bad type casts and mistakes with pointers -- which "point" to certain memory locations where specific data is supposed to reside rather than to the actual data itself -- can help with program reliability and security, Microsoft said. That's because pointers and array indices aren't bounds checked in C and C++, which borrows much from its older cousin.

"Between 2010 and 2015, buffer overflows accounted for between 10-16 percent of publicly reported security vulnerabilities in the U.S. National Vulnerability Database each year," Microsoft Research said in the latest version of the Checked C specification (PDF download), just published on last week. "The vulnerabilities have affected software implemented in C and C++ that is widely used, including the Windows and Linux operating systems, the Internet Explorer, Chrome, and Safari Web browsers, the Apache Web server, the OpenSSL security library, scripting language implementations for Bash, Ruby, and PHP, and media playback software such as QuickTime."

While many more modern programming languages such as Java and C# include bounds checking by automatically adding it to data structures, that functionality isn't available to developers writing systems software.

"This is a problem for system software, where the programmer needs precise control over what a program is doing," Microsoft Research said. "In Checked C, the programmer controls the placement of information needed for bounds-checking and how the information flows through the program, so the programmer retains precise control over what a program is doing."

The Checked C extension provides new kinds of pointer types and array types, programmer-inserted dynamic checks, bounds declarations and many more mechanisms to address the aforementioned problems for developers writing new systems code or modifying legacy code.

"The Checked C extension will let programmers add checking to their programs to detect these kinds of errors when a program runs or while it is being written," the company said. "Existing system software can be modified incrementally in a backwards-compatible fashion to have this checking."

Microsoft Research said the Checked C project is an open and collaborative research project, undertaken with the cooperation of researchers at the University of Maryland and incorporating feedback from other researchers at Samsung and Cornell.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube