CUDASecurity-CON04

Do not allow data races in multithreaded code

Required inputs: IR

Based on: CertC-CON43

With excerpts from SEI CERT, Copyright (C) 1995-2021 Carnegie Mellon University. See 9.4 3rd-Party Licenses in the documentation for full details.

Possible Messages

Key

Text

Severity

Disabled

data-race

Do not allow data races in multithreaded code.

None

False

threads-write

Prevent data races when writing from multiple threads.

None

False

write-race

Prevent data races when writing from multiple threads.

None

False

Options

enter_critical_functions

enter_critical_functions : set[bauhaus.analysis.config.QualifiedName] = {'std::lock_guard::lock_guard', 'std::mutex::lock'}

Set of function names to enter a critical region.
 

enter_critical_macros

enter_critical_macros : set[bauhaus.analysis.config.MacroName] = set()

Set of macro names to enter a critical region (macros must expand to asm() statement).
 

exit_critical_functions

exit_critical_functions : set[bauhaus.analysis.config.QualifiedName] = {'std::lock_guard::~lock_guard', 'std::mutex::unlock'}

Set of function names to exit a critical region.
 

exit_critical_macros

exit_critical_macros : set[bauhaus.analysis.config.MacroName] = set()

Set of macro names to exit a critical region (macros must expand to asm() statement).
 

inspect_pointers

inspect_pointers : bool = True

Whether pointer targets should be inspected to detect more global variable uses.
 

nested_critical_regions

nested_critical_regions : bool = True

If set to true, critical regions nest; if set to false, a single exit-critical-region terminates all open critical regions.
 

report_read_races

report_read_races : bool = False

Whether potentially conflicting read accesses (R/R) should be reported, too.
 

synchronizing_routines

synchronizing_routines

Type: set[bauhaus.analysis.config.QualifiedName]

Default: {'__syncthreads', 'cooperative_groups::__v1::thread_block::sync', 'cuda::barrier::arrive_and_wait', 'cuda::barrier::wait'}

Calls to these routines will be considered synchronization points. Usually, global memory is written before such a point and only safely read afterwards.