CUDASecurity-CON03¶
Avoid race conditions when using library functions
Required inputs: IR
Based on: CertC-CON33
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 |
|---|---|---|---|
non_thread_safe_function_use |
Avoid race conditions when using library functions.{} |
None |
False |
Options¶
This rule shares the following common options: confidence, exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
func_when_with_null¶
func_when_with_null
functions need not be thread-safe if passed a NULL as n'th argument.Type: dict[bauhaus.analysis.config.FunctionName, int]
Default:
{ 'ctermid': 0, 'mbrlen': 2, 'mbrtowc': 3, 'mbsnrtowcs': 4, 'mbsrtowcs': 3, 'tmpnam': 0, 'wcrtomb': 2, 'wcsnrtombs': 4, 'wcsrtombs': 3 }
funcs¶
funcs : set[bauhaus.analysis.config.FunctionName] = {'round'}
remediations¶
remediations
Mapping from function names to remediation descriptions.Type: dict[bauhaus.analysis.config.FunctionName, str]
Default:
{ 'ATOMIC_VAR_INIT': 'Do not attempt to initialize an atomic variable from multiple threads', 'asctime': 'Use asctime_s(), ctime_s() or gmtime_s()', 'atomic_init': 'Do not attempt to initialize an atomic variable from multiple threads', 'c16rtomb': 'Do not call with a null mbstate_t * argument', 'c32rtomb': 'Do not call with a null mbstate_t * argument', 'ctime': 'Use asctime_s(), ctime_s() or gmtime_s()', 'getenv': 'Do not store pointers returned by certain functions', 'getenv_s': 'Do not store pointers returned by certain functions', 'gmtime': 'Use asctime_s(), ctime_s() or gmtime_s()', 'localtime': 'Use asctime_s(), ctime_s() or gmtime_s()', 'mbrtoc16': 'Do not call with a null mbstate_t * argument', 'mbrtoc32': 'Do not call with a null mbstate_t * argument', 'rand': 'Do not use the rand() function for generating pseudorandom numbers', 'round': 'Use rint() in CUDA device code to round to a double-precision floating-point number as this maps to a single instruction', 'setlocale': 'Protect multithreaded access to locale-specific functions with a mutex', 'srand': 'Do not use the rand() function for generating pseudorandom numbers', 'strerror': 'Use strerror_s() in C11 or strerror_r() in POSIX', 'strtok': 'Use strerror_s() in C11 or strerror_r() in POSIX', 'tmpnam': 'Use tmpnam_s()' }