microsoft / checkedc-libc-test

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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License:Other


Languages

Language:C 99.9%Language:Makefile 0.1%Language:Shell 0.0%