Skip to content

This repo contains a version of libc-test that is modified to test a Checked C version of the musl C library. Checked C is an extension to C that adds checking to detect or prevent common programming errors such as out-of-bounds memory accesses.

Notifications You must be signed in to change notification settings

checkedc/checkedc-libc-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a version of libc-test meant to test the musl C library which has been converted to Checked C. The sources here have been mirrored from this repo. This version of libc-test is meant to compile with the checkedc-clang compiler. It is also meant to link against a pre-built compiler-rt downloaded from llvm.org.

Usage

Before building checkedc-libc-test make sure you have built checkedc-musl. Also make sure that you have set the MUSL_PATH environment variable as documented here.

Set up compiler-rt

libc-test needs compiler-rt for the runtime libraries. We download the 10.0 version of the pre-built compiler-rt for Ubuntu from llvm.org.

export RT_PATH=</some/dir>
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz 
tar -xvf clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -C $RT_PATH --strip 1

Build libc-test

Note: Make sure the environment variables MUSL_PATH and RT_PATH are set.

export PATH=</path/to/checkedc-clang/bin>
git clone https://github.com/microsoft/checkedc-libc-test.git
cd checkedc-libc-test
make clean && make -j32 2>&1 | tee log

Results of libc-test

After building and running libc-test check if any errors have occurred. There should be 0 errors found in the log file. grep error: log | wc -l

Next, check what tests have failed, if any. grep ^FAIL log | wc -l

Note: At the time of writing this README, there were 62 known failures in libc-test.

To check if an error in your musl would produce errors in libc-test, you can do the following:

  • Add an error to your musl sources (like in src/string/strchr.c)
  • Rebuild musl
  • Rebuild libc-test
  • grep ^FAIL log | wc -l

About

This repo contains a version of libc-test that is modified to test a Checked C version of the musl C library. Checked C is an extension to C that adds checking to detect or prevent common programming errors such as out-of-bounds memory accesses.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages