Skip to content

linD026/ucsan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ucsan

The User Concurrency Sanitizer (UCSAN) is the watchpoint-based data race detector. It uses the thread sanitizer interface in Clang (v3.2+) and GCC (v4.8+) to determine whether the variable data race.

Currently, it only will check the non-volatile type of variable access. In other words, all the variables with thread-safety operations can declare as volatile types to avoid data race checking.

Get start

Build

Build this project with following commands:

$ make                  # Generate static library: libucsan.a
$ make clean            # Delete generated files

Makefile Parameter

  • nr_cpu : number of cpu.
  • nr_wp : number of watchpoint slot.
  • CC : compiler, gcc or clang.

How to use?

Add the static library libucsan.a to your project:

$ gcc -c main.c -fsanitize=thread
$ gcc -o main main.o -L/path/to/libucsan/ -lucsan -rdynamic -pthread

Or you can move the libucsan.a to your project directory. Then:

$ gcc -c main.c -fsanitize=thread
$ gcc -o main main.o libucsan.a -rdynamic -pthread