diff --git a/build/conf/bison_lex.conf b/build/conf/bison_lex.conf index 7d31521ed4f2..ea8c657ad703 100644 --- a/build/conf/bison_lex.conf +++ b/build/conf/bison_lex.conf @@ -161,11 +161,16 @@ macro _SRC("l", SRC, SRCFLAGS...) { # tag:src-processing macro _SRC("lex", SRC, SRCFLAGS...) { - .CMD=$_SRC(l $SRC $SRCFLAGS) + # TODO redirection .CMD=$_SRC(l $SRC $SRCFLAGS) + .CMD=$_FLEX_TOOL $LEX_FLAGS ${SRCFLAGS} $_FLEX_HEADER ${hide:_FLEX_GEN_EXT} -o${output;suf=$_FLEX_GEN_EXT:SRC} ${hide;output_include:"util/system/compiler.h"} ${input:SRC} ${hide;kv:"p LX"} ${hide;kv:"pc yellow"} + .STRUCT_CMD=yes + .ADDINCL=$_FLEX_TOOL_DIR } # tag:src-processing macro _SRC("lpp", SRC, SRCFLAGS...) { - .CMD=$_SRC(l $SRC $SRCFLAGS) - #.STRUCT_CMD=yes + # TODO redirection .CMD=$_SRC(l $SRC $SRCFLAGS) + .CMD=$_FLEX_TOOL $LEX_FLAGS ${SRCFLAGS} $_FLEX_HEADER ${hide:_FLEX_GEN_EXT} -o${output;suf=$_FLEX_GEN_EXT:SRC} ${hide;output_include:"util/system/compiler.h"} ${input:SRC} ${hide;kv:"p LX"} ${hide;kv:"pc yellow"} + .STRUCT_CMD=yes + .ADDINCL=$_FLEX_TOOL_DIR } diff --git a/build/conf/custom_lint.conf b/build/conf/custom_lint.conf index ab8f29ba73cd..1afdee72feeb 100644 --- a/build/conf/custom_lint.conf +++ b/build/conf/custom_lint.conf @@ -3,7 +3,7 @@ JSON_LINTER_DEFAULT_CONFIGS=build/config/tests/json_style/default_configs.json # tag:lint tag:internal macro _CUSTOM_LINT_FILES(GLOB_VAR, EXT, DIRS[], DIRS_RECURSE[]) { - _GLOB(${GLOB_VAR} ${suf=/*.(${EXT}):DIRS} ${suf=/**/*.(${EXT}):DIRS_RECURSE} ${suf=/**/ya.make:DIRS_RECURSE} ${suf=/ya.make:DIRS} EXCLUDE ya.make) + _GLOB(${GLOB_VAR} ${suf=/*.(${EXT}):DIRS} ${suf=/**/*.(${EXT}):DIRS_RECURSE} ${suf=/**/ya.make:DIRS_RECURSE} ${suf=/ya.make:DIRS} EXCLUDE ya.make RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) } # tag: internal diff --git a/build/conf/docs.conf b/build/conf/docs.conf index 20d1b26a4cd8..457ff1e6ec88 100644 --- a/build/conf/docs.conf +++ b/build/conf/docs.conf @@ -107,7 +107,7 @@ module DOCS_LIBRARY: _DOCS_BARE_UNIT { macro _DOCS_SRCS(SRCDIR=".", EXCLUDE[], INCLUDE...) { SET(_VAR_DOCS_SRCS_SALT __SRCDIR__ $SRCDIR __EXCLUDE__ $EXCLUDE __INCLUDE__ $INCLUDE) SET(_DOCS_SRCS_GLOB uniq_docs_${hash:_VAR_DOCS_SRCS_SALT}) - _GLOB(${_DOCS_SRCS_GLOB} ${pre=${SRCDIR}/:INCLUDE} EXCLUDE ${EXCLUDE}) + _GLOB(${_DOCS_SRCS_GLOB} ${pre=${SRCDIR}/:INCLUDE} EXCLUDE ${EXCLUDE} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET_APPEND(_DOCS_SOURCES_VALUE ${input:$_DOCS_SRCS_GLOB}) SET(_YFM_DOCS_DIR_DEFAULT_VALUE __dummy_dir__) } @@ -311,7 +311,7 @@ macro _YFM_DOCS_DIR(DIR) { SET(_VAR_DOCS_DIR_SALT __MODDIR__ $MODDIR __DIR__ $DIR) SET(_DOCS_DIR_GLOB uniq_docs_dir_${hash:_VAR_DOCS_DIR_SALT}) - _LATE_GLOB(${_DOCS_DIR_GLOB} ${ARCADIA_ROOT}/$DIR/**/*) + _LATE_GLOB(${_DOCS_DIR_GLOB} ${ARCADIA_ROOT}/$DIR/**/* RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET_APPEND(_DOCS_IMPLICIT_SRCS_VALUE \${hide;input:$_DOCS_DIR_GLOB}) # We set the value of var _YFM_DOCS_DIR_DEFAULT_VALUE to some non-existing dir. This value diff --git a/build/conf/go.conf b/build/conf/go.conf index 35cfae4c8a36..388ebbfceb53 100644 --- a/build/conf/go.conf +++ b/build/conf/go.conf @@ -3,7 +3,7 @@ ### ### Recursively collect files for swagger config creation macro COLLECT_GO_SWAGGER_FILES(Varname, Dir) { - _GLOB($Varname $Dir/**/*.go ${ARCADIA_ROOT}/go.mod) + _GLOB($Varname $Dir/**/*.go ${ARCADIA_ROOT}/go.mod RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) } # tag:go-specific @@ -215,6 +215,7 @@ _GO_TOOL_COMMON_FLAGS=\ # tag:go-specific macro _GO_GEN_COVER_GO(GO_FILE, GO_COVER_OUTPUT, VAR_ID) { .CMD=${hide:_GO_FAKEID} ${cwd;rootdir;input:GO_FILE} $GO_TOOLS_ROOT/pkg/tool/$_GO_TC_PATH/cover -mode set -var $VAR_ID -o ${output;suf=.cover.go;noext:GO_COVER_OUTPUT} ${rootrel;input:GO_FILE} ${hide;kv:"p go"} ${hide;kv:"pc light-blue"} + .STRUCT_CMD=yes } # tag:go-specific @@ -390,10 +391,10 @@ _GO_EMBED_INPUTS= macro _GO_EMBED_PATTERN(XTEST?"_xtest":"", PATTERN, IMPORT_PATH) { SET(VAR_SALT1 $XTEST $PATTERN $IMPORT_PATH 1) SET(_PATTERN_GLOB1 uniq_embed_${hash:VAR_SALT1}) - _GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.*) + _GLOB($_PATTERN_GLOB1 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/* EXCLUDE ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/_* ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}/**/.* RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET(VAR_SALT2 $XTEST $PATTERN $IMPORT_PATH 2) SET(_PATTERN_GLOB2 _uniq_embed_${hash:VAR_SALT2}) - _GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN}) + _GLOB($_PATTERN_GLOB2 ${ARCADIA_ROOT}/${IMPORT_PATH}/${PATTERN} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST ${ARCADIA_ROOT}/${IMPORT_PATH} $PATTERN \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2) SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB1 \$$_PATTERN_GLOB2) } @@ -429,7 +430,7 @@ macro GO_XTEST_EMBED_PATTERN(PATTERN) { macro _GO_EMBED_DIR(XTEST?"_xtest":"", DIR, IMPORT_PATH, ALL?"all:":"", EXCLUDES...) { SET(VAR_SALT $XTEST $DIR $IMPORT_PATH) SET(_PATTERN_GLOB uniq_embed_${hash:VAR_SALT}) - _GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${pre=${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/:EXCLUDES}) + _GLOB($_PATTERN_GLOB ${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/* EXCLUDE ${pre=${ARCADIA_ROOT}/${IMPORT_PATH}/${DIR}/**/:EXCLUDES} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET_APPEND(_GO_EMBED_VALUE ++embed$XTEST ${ARCADIA_ROOT}/${IMPORT_PATH} $ALL$DIR \$$_PATTERN_GLOB) SET_APPEND(_GO_EMBED_INPUTS \$$_PATTERN_GLOB) } diff --git a/build/conf/java.conf b/build/conf/java.conf index 117c23fa8ced..04743756c529 100644 --- a/build/conf/java.conf +++ b/build/conf/java.conf @@ -412,6 +412,7 @@ EXT_JAVA_VCS_INFO=no ### By default this is disabled. macro EMBED_JAVA_VCS_INFO() { .SEM=add_vcs_info_to_mf ${hide;output:"VcsInfoMfDummy.java"} + .STRUCT_SEM=yes ENABLE(EXT_JAVA_VCS_INFO) } @@ -492,7 +493,7 @@ macro _JAVA_SRCS(RESOURCES?"yes":"no", SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], SET_APPEND(ALL_SRCDIRS $SRCDIR) SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES) SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT}) - _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE}) + _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET_APPEND(LINT_JAVA_SOURCES \${rootrel;ext=.java;input:${JAR_SRCS_GLOB}}) SET_APPEND(ALL_JAR_SOURCES --jsources ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt --resources ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt --srcdir ${quo:SRCDIR} \${input:${JAR_SRCS_GLOB}} ${pre=\$\{input\:\";suf=\"\}:FILES}) _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt) @@ -519,8 +520,9 @@ macro FULL_JAVA_SRCS(Args...) { # tag:java-specific ### @usage: DEFAULT_JAVA_SRCS_LAYOUT() ### -### DEFAULT_JAVA_SRCS_LAYOUT() declare all source files can be find at maven/gradle standard path src/main/java **/*.java -### and all resources an be find at maven/gradle standard path src/main/resources **/* +### Configures standard Maven/Gradle directory layout for main sources: +### - Java/Kotlin sources: src/main/java/**/*.java (and Kotlin equivalents) +### - Resources: src/main/resources/**/* macro DEFAULT_JAVA_SRCS_LAYOUT() { # Maven default source paths, supported by gradle too # JAVA_SRCS may be alias of FULL_JAVA_SRCS @@ -531,8 +533,14 @@ macro DEFAULT_JAVA_SRCS_LAYOUT() { # tag:java-specific ### @usage: DEFAULT_JUNIT_JAVA_SRCS_LAYOUT() ### -### DEFAULT_JUNIT_JAVA_SRCS_LAYOUT() declare all test source files can be find at maven/gradle standard path src/test/java **/*.java -### and all resources can be find at maven/gradle standard path src/test/resources **/* +### Configures standard Maven/Gradle directory layout for JUnit tests: +### - Java/Kotlin sources: java/**/*.java (and Kotlin equivalents) +### - Test resources: resources/**/* +### +### Note: This macro assumes it's called from within src/test directory context. +### The actual paths will be: +### - Sources: src/test/java/**/*.java +### - Resources: src/test/resources/**/* macro DEFAULT_JUNIT_JAVA_SRCS_LAYOUT() { # Maven default test source paths, supported by gradle too # JAVA_SRCS may be alias of FULL_JAVA_SRCS @@ -569,12 +577,13 @@ macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) { # tag:java-specific # Fill semantic by RUN_JAVA_PROGRAM() macro _DO_2_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq_", IN_DIRS_INPUTS[], IN{input}[], IN_NOPARSE{input}[], IN_DIR[], OUT_NOAUTO{output}[], OUT{output}[], TOOL{tool}[], OUT_DIR[], CLASSPATH[], ADD_SRCS_TO_CLASSPATH?"yes":"no", CWD="${ARCADIA_BUILD_ROOT}", STDOUT="", STDOUT_NOAUTO="", HASH_SUF="hash_suf", Args...) { - _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR}) + _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH) .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR .CMD=${hide;kv:"p RJ"} ${hide;kv:"pc blue"} ${hide:JAVA_FAKEID} ${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/mkdir.py"} ${OUT_DIR} && ${cwd:CWD} $YMAKE_PYTHON3 ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON3 ${input:"build/scripts/stdout2stderr.py"} ${pre=--file=:STDOUT} ${hide;output:STDOUT} ${pre=--file=:STDOUT_NOAUTO} ${hide;noauto;output:STDOUT_NOAUTO} $YMAKE_PYTHON3 ${input:"build/scripts/fix_java_command_file_cp.py"} --build-root ${ARCADIA_BUILD_ROOT} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} ${Args} && $_GENTAR_HELPER(HASH_SUF $HASH_SUF OUT_DIR $OUT_DIR) ${hide;input:IN} ${hide;context=TEXT;input=TEXT:IN_NOPARSE} ${hide;noauto;output:OUT_NOAUTO} ${hide;output:OUT} ${hide;tool:TOOL} ${hide;input:IN_DIRS_INPUTS} .STRUCT_CMD=yes .SEM=runs-ITEM && runs-args ${Args} && runs-classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} && runs-cwd ${CWD} ${hide;cwd:CWD} && runs-in ${IN} ${hide;input:IN} && runs-in_dir ${IN_DIR} && runs-in_noparse ${IN_NOPARSE} ${hide;context=TEXT;input=TEXT:IN_NOPARSE} && runs-out ${OUT} ${hide;output:OUT} ${OUT_NOAUTO} ${hide;noauto;output:OUT_NOAUTO} $_GENTAR_HELPER(HASH_SUF $HASH_SUF OUT_DIR $OUT_DIR) && runs-out_dir ${OUT_DIR} && runs-tool ${tool:TOOL} + .STRUCT_SEM=yes } # tag:java-specific @@ -893,6 +902,7 @@ macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) { } # tag:java-specific +ERROR_PRONE_BASE_CHECKS=-Xep:FunctionalInterfaceMethodChanged:WARN -Xep:ReturnValueIgnored:WARN ERROR_PRONE_JDK16PLUS_ADD_OPENS=-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF ERROR_PRONE_2_3_7_FORCED_OPTS=--should-stop=ifError=FLOW @@ -1273,6 +1283,10 @@ module JAR_LIBRARY: _COMPILABLE_JAR_BASE { PEERDIR+=$ERROR_PRONE_PEERDIR RUN_JAVAC_ARGS=--error-prone $ERROR_PRONE_RESOURCE/error_prone.jar + JAVAC_FLAGS_VALUE+=$ERROR_PRONE_BASE_CHECKS + JAVAC_OPTS+=$ERROR_PRONE_BASE_CHECKS + _JAVAC_SEM+= && javac_flags $ERROR_PRONE_BASE_CHECKS + when ($JDK_REAL_VERSION == "17" || $JDK_REAL_VERSION == "21" || $JDK_REAL_VERSION == "22" || $JDK_REAL_VERSION == "23" || $JDK_REAL_VERSION == "24" || $JDK_REAL_VERSION == "25") { JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS JAVAC_OPTS+=$ERROR_PRONE_JDK16PLUS_ADD_OPENS diff --git a/build/conf/proto.conf b/build/conf/proto.conf index d91051a68e61..6549eee70cff 100644 --- a/build/conf/proto.conf +++ b/build/conf/proto.conf @@ -587,6 +587,7 @@ _PY_EVLOG_CMD_INTERNAL_KV=ext_out_name_for_${suf=__int${_PYTHON_VER}___ev_pb2.py macro _PY_EVLOG_CMD_INTERNAL(File) { .CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_EVLOG_SUFFIXES --input ${rootrel;input:File} --ns /$PROTO_NAMESPACE -- $_PY_EVLOG_CMD_BASE($File __int${_PYTHON_VER}___ev_pb2.py ${hide;kv:_PY_EVLOG_CMD_INTERNAL_KV}) .STRUCT_CMD=yes + .STRUCT_SEM=yes } # tag:java-specific tag:proto diff --git a/build/conf/python.conf b/build/conf/python.conf index 8e9a9eaa90f7..3a6109427f0a 100644 --- a/build/conf/python.conf +++ b/build/conf/python.conf @@ -500,7 +500,7 @@ module PY_ANY_MODULE: DLL_UNIT { # -bundle when ($DARWIN == "yes") { - when ($COMPILER_VERSION == "16" || $COMPILER_VERSION == "18") { + when ($COMPILER_VERSION == "16" || $COMPILER_VERSION == "18" || $COMPILER_VERSION == "20") { # TODO(pg): also check 19 and beyond } otherwise { @@ -1070,7 +1070,7 @@ _ALL_PY_FILES= # tag:python-specific macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", ONLY_TEST_FILES?"test_*.py":"*.py", ONLY_TEST_FILES2?"*_test.py":"***", NO_TEST_FILES?"**/test_*.py **/*_test.py":"", NAMESPACE[], REST[], REST2[], EAT_TAIL[]) { - _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/${ONLY_TEST_FILES}:REST} ${suf=${RECURSIVE}/${ONLY_TEST_FILES2}:REST2} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make ${NO_TEST_FILES}) + _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/${ONLY_TEST_FILES}:REST} ${suf=${RECURSIVE}/${ONLY_TEST_FILES2}:REST2} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make ${NO_TEST_FILES} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) } # tag:python-specific @@ -1116,7 +1116,7 @@ _PY_EXTRA_LINT_FILES_VALUE= # tag:python-specific macro _ALL_PY_EXTRA_LINT_FILES2(Dirs...) { - _GLOB(_ALL_PY_EXTRA_LINT_FILES_VALUE ${suf=/*.py:Dirs}) + _GLOB(_ALL_PY_EXTRA_LINT_FILES_VALUE ${suf=/*.py:Dirs} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) } # tag:python-specific diff --git a/build/conf/swig.conf b/build/conf/swig.conf index c4d0224c5041..504b8f4339ba 100644 --- a/build/conf/swig.conf +++ b/build/conf/swig.conf @@ -29,6 +29,7 @@ when ($USE_SYSTEM_JDK == "yes" || $OS_ANDROID == "yes") { macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) { .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -c++ -python -module ${nopath:DstSubPrefix} -interface ${suf=_swg;nopath:DstSubPrefix} -o ${output;suf=.swg.cpp:DstSubPrefix} ${input:Src} ${hide;noauto;output;suf=.py:DstSubPrefix} ${hide;kv:"p SW"} ${hide;kv:"pc yellow"} .STRUCT_CMD=yes + .STRUCT_SEM=yes .PEERDIR=contrib/tools/swig/Lib/python } @@ -39,6 +40,7 @@ macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) { macro _SWIG_PYTHON_C(Src, DstSubPrefix) { .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -python -module ${nopath:DstSubPrefix} -interface ${suf=_swg;nopath:DstSubPrefix} -o ${output;suf=.swg.c:DstSubPrefix} ${input:Src} ${hide;noauto;output;suf=.py:DstSubPrefix} ${hide;kv:"p SW"} ${hide;kv:"pc yellow"} .STRUCT_CMD=yes + .STRUCT_SEM=yes .PEERDIR=contrib/tools/swig/Lib/python } diff --git a/build/conf/ts/ts.conf b/build/conf/ts/ts.conf index 4c2d95febd86..65f28a6e0882 100644 --- a/build/conf/ts/ts.conf +++ b/build/conf/ts/ts.conf @@ -141,10 +141,10 @@ _TS_LINT_SRCS_VALUE= macro _TS_CONFIG_EPILOGUE() { ### Fill $TS_GLOB_FILES with potential inputs. ### It will be reduced later in _TS_CONFIGURE based on `tsconfig.json` rules. - _GLOB(TS_GLOB_FILES $TS_GLOB_INCLUDE EXCLUDE $TS_GLOB_EXCLUDE) - _GLOB(TS_GLOB_TEST_FILES $TS_GLOB_TESTS) + _GLOB(TS_GLOB_FILES $TS_GLOB_INCLUDE EXCLUDE $TS_GLOB_EXCLUDE RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) + _GLOB(TS_GLOB_TEST_FILES $TS_GLOB_TESTS RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) - _GLOB(_TS_LINT_SRCS_VALUE **/*.(ts|tsx|js|jsx) EXCLUDE $TS_EXCLUDE_DIR_GLOB $TS_COMMON_OUTDIR_GLOB $TS_GLOB_EXCLUDE_ADDITIONAL) + _GLOB(_TS_LINT_SRCS_VALUE **/*.(ts|tsx|js|jsx) EXCLUDE $TS_EXCLUDE_DIR_GLOB $TS_COMMON_OUTDIR_GLOB $TS_GLOB_EXCLUDE_ADDITIONAL RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) _SETUP_BUILD_ENV() } @@ -164,6 +164,7 @@ TSYNDEXER_CMD=${cwd:ARCADIA_BUILD_ROOT} \ ### The macro is called from nots.py plugin in case we have `TS_YNDEXING=yes` flag set. macro _DO_TS_YNDEXING() { .CMD=$TSYNDEXER_CMD + .STRUCT_CMD=yes } # Used as inputs in TS_COMPILE through `$_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES)` @@ -213,7 +214,7 @@ macro TS_FILES(Files...) { ### Adds files to output by glob, e.g. TS_FILES_GLOB(**/*.css) ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-files-glob macro TS_FILES_GLOB(Glob...) { - _GLOB(FILES_BY_GLOB ${Glob}) + _GLOB(FILES_BY_GLOB ${Glob} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) TS_FILES(${FILES_BY_GLOB}) } diff --git a/build/conf/ts/ts_test.conf b/build/conf/ts/ts_test.conf index f5fff8e97fb0..5b778b67a57d 100644 --- a/build/conf/ts/ts_test.conf +++ b/build/conf/ts/ts_test.conf @@ -214,10 +214,10 @@ _TS_TEST_EXTRA_SRCS_VALUE= ### ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/macros#ts-test-srcs macro TS_TEST_SRCS(DIRS...) { - _GLOB(_TS_TEST_SRCS_VALUE ${suf=/**/*.$TS_TEST_EXTENSION:DIRS}) + _GLOB(_TS_TEST_SRCS_VALUE ${suf=/**/*.$TS_TEST_EXTENSION:DIRS} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SRCS($_TS_TEST_SRCS_VALUE) - _GLOB(_TS_TEST_EXTRA_SRCS_VALUE ${suf=$TS_TEST_EXTRA_SRCS_MASK:DIRS}) + _GLOB(_TS_TEST_EXTRA_SRCS_VALUE ${suf=$TS_TEST_EXTRA_SRCS_MASK:DIRS} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SRCS($_TS_TEST_EXTRA_SRCS_VALUE) } @@ -237,7 +237,7 @@ _TS_TEST_DATA_DIRS_RENAME_VALUE= ### It is possible to specify multiple renaming rules in the following format "dir1:dir2;dir3/foo:dir4/bar", where "dir1" and "dir3" folders in curdir. ### - GLOBS... - globs to tests data files, symbolic links will be created to their folders. For example - "tests_data/**/*". macro TS_TEST_DATA(RENAME="", GLOBS...) { - _GLOB(_TS_TEST_DATA_VALUE $GLOBS) + _GLOB(_TS_TEST_DATA_VALUE $GLOBS RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET(_TS_TEST_DATA_DIRS_RENAME_VALUE $RENAME) } @@ -309,5 +309,5 @@ macro TS_STYLELINT(_CONFIG) { ENABLE(_TS_STYLELINT_VALUE) SET(_TS_STYLELINT_CONFIG $_CONFIG) - _GLOB(_TS_STYLELINT_FILES **/*(.css|.scss|.less) EXCLUDE $TS_EXCLUDE_DIR_GLOB $TS_COMMON_OUTDIR_GLOB $TS_GLOB_EXCLUDE_ADDITIONAL) + _GLOB(_TS_STYLELINT_FILES **/*(.css|.scss|.less) EXCLUDE $TS_EXCLUDE_DIR_GLOB $TS_COMMON_OUTDIR_GLOB $TS_GLOB_EXCLUDE_ADDITIONAL RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) } diff --git a/build/export_generators/ide-gradle/codegen_run_java_program.jinja b/build/export_generators/ide-gradle/codegen_run_java_program.jinja index 66ff1185d137..a87cab12f841 100644 --- a/build/export_generators/ide-gradle/codegen_run_java_program.jinja +++ b/build/export_generators/ide-gradle/codegen_run_java_program.jinja @@ -23,14 +23,25 @@ val {{ varprefix }}{{ run['_object_index'] }} = tasks.register("{{ var } classpath = files(classpaths) {%- endfor -%} +{%- endif -%} + +{%- set run_args = run.args|reject('startsWith', '-D')|reject('startsWith', '-X') %} +{%- set run_jvm_args = run.args|reject('in', run_args) -%} +{%- if run_jvm_args|length %} + + jvmArgs = listOf( +{%- for run_jvm_arg in run_jvm_args %} + "{{ run_jvm_arg }}", +{%- endfor %} + ) {%- endif %} - mainClass.set("{{ run.args[0] }}") -{%- if run.args|length > 1 %} + mainClass.set("{{ run_args[0] }}") +{%- if run_args|length > 1 %} args = listOf( -{%- for arg in run.args -%} -{%- if not loop.first %} +{%- for arg in run_args -%} +{%- if not loop.first -%} {%- if (run.out_dir|select("eq", arg)|length) or (run.out_dir[0] == '/' and run.out_dir|select("in", arg)|length) or (run.out|select("eq", arg)|length) or (run.out[0] == '/' and run.out|select("in", arg)|length) -%} {%- if proto_template %} {{ PatchGeneratedProto(arg) }}, diff --git a/build/platform/yfm/resources.json b/build/platform/yfm/resources.json index e1d04c021a7c..ff12926a8629 100644 --- a/build/platform/yfm/resources.json +++ b/build/platform/yfm/resources.json @@ -1,16 +1,16 @@ { "by_platform": { "win32-x86_64": { - "uri": "sbr:10046921916" + "uri": "sbr:10083488108" }, "darwin-x86_64": { - "uri": "sbr:10046919284" + "uri": "sbr:10083484926" }, "linux-x86_64": { - "uri": "sbr:10046916652" + "uri": "sbr:10083480928" }, "darwin-arm64": { - "uri": "sbr:10046919284" + "uri": "sbr:10083484926" } } } diff --git a/build/scripts/build_java_with_error_prone2.py b/build/scripts/build_java_with_error_prone2.py index 8d7330db9e7e..166565a04f62 100644 --- a/build/scripts/build_java_with_error_prone2.py +++ b/build/scripts/build_java_with_error_prone2.py @@ -1,15 +1,9 @@ import sys import os -import re import subprocess import platform -ERROR_PRONE_FLAGS = [ - '-Xep:FunctionalInterfaceMethodChanged:WARN', - '-Xep:ReturnValueIgnored:WARN', -] - JAVA10_EXPORTS = [ '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED', '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED', @@ -46,10 +40,11 @@ def parse_args(argv): def fix_cmd_line(error_prone_tool, cmd): if not error_prone_tool: return cmd + error_prone_flags = [] for f in cmd: if f.startswith('-Xep'): - ERROR_PRONE_FLAGS.append(f) - for f in ERROR_PRONE_FLAGS: + error_prone_flags.append(f) + for f in error_prone_flags: if f in cmd: cmd.remove(f) if '-processor' in cmd: @@ -60,17 +55,18 @@ def fix_cmd_line(error_prone_tool, cmd): cmd + JAVA10_EXPORTS + ['-processorpath', error_prone_tool, '-XDcompilePolicy=byfile'] - + [(' '.join(['-Xplugin:ErrorProne'] + ERROR_PRONE_FLAGS))] + + [(' '.join(['-Xplugin:ErrorProne'] + error_prone_flags))] ) # NOTE: legacy, only for "devtools/ya/jbuild" def just_do_it(argv): java, javac, error_prone_tool, javac_cmd = parse_args(argv) + error_prone_flags = [] for f in javac_cmd: if f.startswith('-Xep'): - ERROR_PRONE_FLAGS.append(f) - for f in ERROR_PRONE_FLAGS: + error_prone_flags.append(f) + for f in error_prone_flags: if f in javac_cmd: javac_cmd.remove(f) if '-processor' in javac_cmd: @@ -81,7 +77,7 @@ def just_do_it(argv): [javac] + JAVA10_EXPORTS + ['-processorpath', error_prone_tool, '-XDcompilePolicy=byfile'] - + [(' '.join(['-Xplugin:ErrorProne'] + ERROR_PRONE_FLAGS))] + + [(' '.join(['-Xplugin:ErrorProne'] + error_prone_flags))] + javac_cmd ) if platform.system() == 'Windows': diff --git a/build/scripts/bundle_output.py b/build/scripts/bundle_output.py new file mode 100644 index 000000000000..8b99eaa21fe8 --- /dev/null +++ b/build/scripts/bundle_output.py @@ -0,0 +1,44 @@ +import argparse +import os +import shutil +import sys + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument('--name', required=True) + parser.add_argument('--output', required=True) + parser.add_argument('--result', required=True) + return parser.parse_args(sys.argv[1:]) + + +def main(): + args = parse_args() + if os.path.basename(args.name) != args.name: + print("Error: --name must be a base name without directory components", file=sys.stderr, flush=True) + sys.exit(1) + result_dir = os.path.dirname(args.result) + src_path = os.path.join(result_dir, args.name) + + if not os.path.exists(src_path): + print(f"Error: Source file '{src_path}' does not exist", file=sys.stderr, flush=True) + sys.exit(1) + if not os.path.isfile(src_path): + print(f"Error: Source path '{src_path}' is not a file", file=sys.stderr, flush=True) + sys.exit(1) + if os.path.isdir(args.output): + print(f"Error: Output path '{args.output}' is a directory", file=sys.stderr, flush=True) + sys.exit(1) + output_dir = os.path.dirname(args.output) + if output_dir: + os.makedirs(output_dir, exist_ok=True) + + try: + shutil.move(src_path, args.output) + except Exception as e: + print(f"Error moving file: {str(e)}", file=sys.stderr, flush=True) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/build/scripts/ya.make b/build/scripts/ya.make index 9236ed569ad2..f5623debda1e 100644 --- a/build/scripts/ya.make +++ b/build/scripts/ya.make @@ -43,6 +43,7 @@ ELSEIF (PYTHON3) build_info_gen.py build_java_codenav_index.py build_java_with_error_prone2.py + bundle_output.py cat.py cgo1_wrapper.py check_config_h.py diff --git a/build/sysincl/misc-win.yml b/build/sysincl/misc-win.yml index c619f3162b75..0849147b25ee 100644 --- a/build/sysincl/misc-win.yml +++ b/build/sysincl/misc-win.yml @@ -18,6 +18,7 @@ - source_filter: "^contrib/libs/libpq/src" includes: - arpa/inet.h: contrib/libs/libpq/src/include/port/win32/arpa/inet.h + - dlfcn.h: contrib/libs/libpq/src/include/port/win32/dlfcn.h - netdb.h: contrib/libs/libpq/src/include/port/win32/netdb.h - netinet/in.h: contrib/libs/libpq/src/include/port/win32/netinet/in.h - netinet/tcp.h: contrib/libs/libpq/src/include/port/win32/netinet/tcp.h diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 2e853fb4b5cf..a4aa41cc7784 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -2797,7 +2797,7 @@ macro _ARF_HELPER(Args...) { ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value ### Note: Wildcards are not allowed neither as Ext nor in Dirs macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) { - _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS}) + _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT}) } @@ -2812,7 +2812,7 @@ macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) { ### Note: This macro can be used only once per ya.make ### Note: Wildcards are not allowed neither as Ext nor in Dirs macro ALL_RESOURCE_FILES_FROM_DIRS(PREFIX="", STRIP="", DIRS...) { - _GLOB(_ALL_RES_DIRS ${suf=/*:DIRS}) + _GLOB(_ALL_RES_DIRS ${suf=/*:DIRS} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${_ALL_RES_DIRS}) } @@ -2821,6 +2821,26 @@ macro _BUNDLE_TARGET(Target, Destination, Suffix) { .STRUCT_CMD=yes # In Cmd use MOVE, but for ya ide gradle this is prebuilt foreign target, and for use it many times, use COPY symlink to bundle .SEM=target_commands-ITEM && target_commands-macro copy_file && target_commands-args ${result:Target}$Suffix ${noauto;output:Destination} && target_commands-flags src_is_depend + .STRUCT_SEM=yes +} + +### @usage: BUNDLE_OUTPUT_IMPL(File Name Output) # internal +### +### `File` - the name of main output of a module +### `Name` - the name of secondary module output to be collected +### `Output` - the resulting output name +macro BUNDLE_OUTPUT_IMPL(TARGET, NAME, OUTPUT, DUMMY...) { + .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/bundle_output.py"} --result ${result:TARGET} --name $NAME --output ${noauto;output:OUTPUT} ${hide;kv:"p BN"} ${hide;kv:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__ + .STRUCT_CMD=yes +} + +### @usage: BUNDLE_OUTPUT(Dir OutputName [RENAME ]) +### +### `Dir` - Path to module +### `OutputName` - the name of module artefact to be collected +### `Rename` - the output name of collected artefact if needed +macro BUNDLE_OUTPUT(TARGET, NAME, RENAME="") { + BUNDLE_OUTPUT_IMPL($TARGET $NAME $RENAME $NAME) } ### @usage: TIMEOUT(TIMEOUT) @@ -3179,7 +3199,8 @@ macro _SRC("s", SRC, SRCFLAGS...) { # tag:src-processing macro _SRC("s79", SRC, SRCFLAGS...) { - .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp) + .CMD=$_SRC_S_ASM($SRC $SRCFLAGS -x assembler-with-cpp) + .STRUCT_CMD=yes } # tag:src-processing @@ -3223,8 +3244,9 @@ macro _SRC("xsyn", SRC, SRCFLAGS...) { # tag:src-processing macro _SRC("rl5", SRC, SRCFLAGS...) { - .CMD=$_SRC(rl $SRC $SRCFLAGS) - #.STRUCT_CMD=yes # TODO overloading support for redirection + # TODO redirection .CMD=$_SRC(rl $SRC $SRCFLAGS) + .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/ragel"} $RAGEL_FLAGS ${SRCFLAGS} -o ${tmp;suf=.tmp:SRC} ${input:SRC} && $RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/rlgen-cd"} $RLGEN_FLAGS -o ${output;defext=.rl5.cpp;nopath;noext:SRC} ${tmp;suf=.tmp:SRC} ${hide;kv:"p R5"} ${hide;kv:"pc yellow"} + .STRUCT_CMD=yes } # tag:src-processing @@ -3251,6 +3273,7 @@ macro _SRC("ev", SRC, SRCFLAGS...) { .CMD=$EVLOG_CMD($SRC) .STRUCT_CMD=yes .SEM=$EVLOG_CMD($SRC) + .STRUCT_SEM=yes } # tag:src-processing @@ -3412,7 +3435,10 @@ macro _SRC("c", SRC, SRCFLAGS...) { # tag:src-processing macro _SRC("m", SRC, SRCFLAGS...) { - .CMD=$_SRC(c $SRC $SRCFLAGS) + # TODO redirection .CMD=$_SRC(c $SRC $SRCFLAGS) + .CMD=$_SRC_c_new($SRC $SRCFLAGS) + .STRUCT_CMD=yes + .PEERDIR=$_SRC_CPP_TOOLCHAIN_INFO_PEER } _MASM_SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} \ @@ -3428,6 +3454,7 @@ _ASM_SEM=target_macroses-ITEM && target_macroses-macro target_yasm_source && tar # tag:src-processing macro _SRC("masm", SRC, SRCFLAGS...) { .CMD=$_SRC_masm($SRC $SRCFLAGS) + .STRUCT_CMD=yes .SEM=$_MASM_SEM } @@ -3448,8 +3475,12 @@ macro _SRC("asm", SRC, SRCFLAGS...) { # tag:src-processing macro _SRC("lua", SRC, SRCFLAGS...) { - .CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${hide;kv:"p LJ"} ${hide;kv:"pc light-cyan"} + .CMD=$_SRC_lua($SRC $SRCFLAGS) .STRUCT_CMD=yes +} + +macro _SRC_lua(SRC, SRCFLAGS...) { + .CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${hide;kv:"p LJ"} ${hide;kv:"pc light-cyan"} .PEERDIR=$LUAJIT_PATH } @@ -3463,8 +3494,9 @@ otherwise { # tag:src-processing macro _SRC("cu", SRC, SRCFLAGS...) { .CMD=$_SRC_CU_CMD - .SEM=target_options-privates-ITEM && target_options-privates-option target_cuda_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} && platform_vars-CMAKE_CUDA_STANDARD ${quo:NVCC_STD_VER} && target_macroses-ITEM && target_macroses-macro target_cuda_flags && target_macroses-args $CUDA_NVCC_FLAGS && target_macroses-ITEM && target_macroses-macro target_cuda_cflags && target_macroses-args $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS .STRUCT_CMD=yes + .SEM=target_options-privates-ITEM && target_options-privates-option target_cuda_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} && platform_vars-CMAKE_CUDA_STANDARD ${quo:NVCC_STD_VER} && target_macroses-ITEM && target_macroses-macro target_cuda_flags && target_macroses-args $CUDA_NVCC_FLAGS && target_macroses-ITEM && target_macroses-macro target_cuda_cflags && target_macroses-args $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS + .STRUCT_SEM=yes .PEERDIR=$_SRC_CU_PEERDIR } @@ -3492,6 +3524,7 @@ macro _SRC("pysrc", SRC, SRCFLAGS...) { # This triggers configure error in attempt to add `ya.make` to SRCS macro or apply automatic processing by extension from codegen macro _SRC("make", SRC, SRCFLAGS...) { .CMD= + .STRUCT_CMD=yes } @import "${CONF_ROOT}/conf/bison_lex.conf" @@ -3609,8 +3642,9 @@ macro _SRC_masm(SRC, SRCFLAGS...) { ### Compile LUA source file to object code using LUA 2.0 ### Optionally override import name which is by default reflects Src name macro COMPILE_LUA(Src, NAME="") { - .CMD=$_SRC(lua $Src ${pre=-n :NAME}) - #.STRUCT_CMD=yes + # TODO redirection .CMD=$_SRC(lua $Src ${pre=-n :NAME}) + .CMD=$_SRC_lua($Src ${pre=-n :NAME}) + .STRUCT_CMD=yes } # tag:lua-specific @@ -3648,6 +3682,7 @@ macro _SRC_lua_openresty(SRC, SRCFLAGS...) { ### Optionally override import name which is by default reflects Src name macro COMPILE_LUA_OPENRESTY(Src, NAME="") { .CMD=$_SRC_lua_openresty($Src, ${pre=-n :NAME}) + .STRUCT_CMD=yes } GETTEXT_KEEP_PATH=no @@ -3983,6 +4018,7 @@ macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) { ### BUILDWITH_CYTHON_CPP without .pyx infix and with cdef public .h file. macro _BUILDWITH_CYTHON_CPP_H(Src, Dep, Options...) { .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${hide;input:Dep} -o ${tobindir;output;suf=.cpp;noext:Src} ${hide;addincl;tobindir;output;suf=.h;noext:Src} ${hide;kv:"p CY"} ${hide;kv:"pc yellow"} + .STRUCT_CMD=yes ADDINCL($_CYTHON_SYS_INCLUDES) } @@ -4642,7 +4678,7 @@ macro GEN_SCHEEME2(ScheemeName, FromFile) { ### Add symlink macro SYMLINK(From, To) { .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/symlink.py"} ${dirallowed;input:From} ${noauto;output:To} ${hide;kv:"p LN"} ${hide;kv:"pc light-cyan"} - #.STRUCT_CMD=yes + .STRUCT_CMD=yes } macro _FMT_INDUCED_DEPS(For, Deps...) { @@ -4680,7 +4716,7 @@ macro _DECL_IN_DIR_GLOB(var_prefix, pattern_suf, SRCDIR="", EXCLBASE="", EXCLUDE _PATTERN=${pre=${SRCDIR};suf=${pattern_suf}:DIRS} _EXCLUDES=${EXCLBASE}**/ya.make ${EXCLBASE}**/a.yaml ${pre=${EXCLBASE}:EXCLUDES} - _LATE_GLOB(_${var_prefix}_FILES ${_PATTERN} EXCLUDE ${_EXCLUDES}) + _LATE_GLOB(_${var_prefix}_FILES ${_PATTERN} EXCLUDE ${_EXCLUDES} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET(${var_prefix}_PATTERN ${_PATTERN}) SET(${var_prefix}_EXCLUDES ${_EXCLUDES}) } @@ -4911,7 +4947,7 @@ macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], I ### Otherwise macro will try to locate .external, parse it retrieve ot during build phase. macro LARGE_FILES(AUTOUPDATED?, Files...) { # This is needed to correctly switch between remote and local modes - _GLOB($LF $Files) + _GLOB($LF $Files RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${suf=.external:Files}) } @@ -4951,7 +4987,8 @@ macro NO_DEBUG_INFO() { ### ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md macro CTEMPLATE_VARNAMES(File) { - .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${addincl;output;nopath;noallext;suf=.varnames.h:File} ${input:File} + .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${addincl;output;suf=.varnames.h;nopath;noallext:File} ${input:File} + .STRUCT_CMD=yes } LLVM_OPTS= @@ -5492,7 +5529,7 @@ module PREBUILT_PROGRAM: _LINK_UNIT { ### This macro collects all jinja and yaml files in the directory specified by second argument and ### stores result in the variable with mane specified by first parameter. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) { - _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml) + _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) } @import "${CONF_ROOT}/conf/go.conf" @@ -5502,11 +5539,13 @@ IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/i STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text macro _SRC("storyboard", SRC, SRCFLAGS...) { .CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compilation-directory $BINDIR ${input:SRC} && $YMAKE_PYTHON3 ${input:"build/scripts/tar_directory.py"} ${tobindir;output;suf=.compiled_storyboard_tar:SRC} $BINDIR/${suf=c;nopath:SRC} $BINDIR/${suf=c;nopath:SRC} + .STRUCT_CMD=yes } # tag:src-processing macro _SRC("xib", SRC, SRCFLAGS...) { .CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compile ${tobindir;output;suf=.nib;nopath;noext:SRC} ${input:SRC} + .STRUCT_CMD=yes } # tag:src-processing @@ -5526,6 +5565,7 @@ ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/i ASSETS_FLAGS=--output-format human-readable-text --notices --warnings macro _IOS_ASSETS(AssetsDir, Content...) { .CMD=$FS_TOOLS md $BINDIR/$REALPRJNAME && $ACTOOL_PATH $ASSETS_FLAGS --export-dependency-info $BINDIR/assetcatalog_dependencies --output-partial-info-plist ${output:"assetcatalog_generated_info.partial_plist"} --product-type com.apple.product-type.application --compile $BINDIR/$REALPRJNAME $AssetsDir ${hide;input:Content} && ${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/tar_directory.py"} ${output;suf=_assetes.resource_tar:REALPRJNAME} $REALPRJNAME $REALPRJNAME + .STRUCT_CMD=yes } # tag:ios-specific @@ -5541,10 +5581,12 @@ macro IOS_APP_ASSETS_FLAGS(Flags...) { macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) { .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON3 ${input:"build/scripts/tar_directory.py"} ${tobindir;output;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR + .STRUCT_CMD=yes } macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) { .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON3 ${input:"build/scripts/tar_directory.py"} ${tobindir;output;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR + .STRUCT_CMD=yes } # tag:ios-specific @@ -5603,14 +5645,14 @@ otherwise { ### ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname macro COLLECT_FRONTEND_FILES(Varname, Dir) { - _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html)) + _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html) RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) } ### @usage: COLLECT_YAML_CONFIG_FILES(Varname, Dir) ### ### Recursively collect YAML files except for system-reserved a.yaml ones from Dir and save the result into Varname variable macro COLLECT_YAML_CONFIG_FILES(Varname, Dir) { - _GLOB($Varname $Dir/**/*.yaml EXCLUDE **/a.yaml) + _GLOB($Varname $Dir/**/*.yaml EXCLUDE **/a.yaml RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) } TEST_TOOL_HOST_LOCAL= @@ -5794,7 +5836,7 @@ macro STYLE_CPP(CONFIG_TYPE="") { macro HEADERS(EXCLUDE[], Dirs...) { SET(_VAR_HEADERS_SALT __Dirs__ ${Dirs} __EXCLUDE__ ${EXCLUDE}) SET(_HEADERS_GLOB uniq_headers_${hash:_VAR_HEADERS_SALT}) - _GLOB(${_HEADERS_GLOB} ${suf=/*.(h|H|hh|hpp|hxx|ipp):Dirs} EXCLUDE ${EXCLUDE}) + _GLOB(${_HEADERS_GLOB} ${suf=/*.(h|H|hh|hpp|hxx|ipp):Dirs} EXCLUDE ${EXCLUDE} RESTRICTIONS MAX_MATCHES 10000 MAX_WATCH_DIRS 5000) SRCS(${${_HEADERS_GLOB}}) } diff --git a/contrib/libs/clang14-rt/.yandex_meta/devtools.copyrights.report b/contrib/libs/clang14-rt/.yandex_meta/devtools.copyrights.report deleted file mode 100644 index c01c748ad880..000000000000 --- a/contrib/libs/clang14-rt/.yandex_meta/devtools.copyrights.report +++ /dev/null @@ -1,98 +0,0 @@ -# File format ($ symbol means the beginning of a line): -# -# $ # this message -# $ # ======================= -# $ # comments (all commentaries should starts with some number of spaces and # symbol) -# ${action} {license id} {license text hash} -# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make -# ${all_file_action} filename -# $ # user commentaries (many lines) -# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) -# ${action} {license spdx} {license text hash} -# $BELONGS ./ya/make/file/relative/path/3/ya.make -# ${all_file_action} filename -# $ # user commentaries -# $ generated description -# $ ... -# -# You can modify action, all_file_action and add commentaries -# Available actions: -# keep - keep license in contrib and use in credits -# skip - skip license -# remove - remove all files with this license -# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file -# -# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) -# We suppose that that files can contain some license info -# Available all file actions: -# FILE_IGNORE - ignore file (do nothing) -# FILE_INCLUDE - include all file data into licenses text file -# ======================= - -KEEP COPYRIGHT_SERVICE_LABEL 4ef7946d23591afdcc1fd9c9984ea3a4 -BELONGS lib/scudo/ya.make - License text: - initCacheMaybe(C); - TransferBatch *B = Allocator->popBatch(this, ClassId); - if (UNLIKELY(!B)) - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - lib/scudo/standalone/local_cache.h [170:172] - -KEEP COPYRIGHT_SERVICE_LABEL b8b2f9fffd684c9e8f615aa7e5b2d107 -BELONGS lib/scudo/ya.make - License text: - // Calling getenv should be fine (c)(tm) at any time. - const char *getEnv(const char *Name) { return getenv(Name); } - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - lib/scudo/standalone/linux.cpp [97:98] - -KEEP COPYRIGHT_SERVICE_LABEL d5cab39d5c14d8220d0131818428faff -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - lib/sanitizer_common/sanitizer_allocator_local_cache.h [243:245] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP COPYRIGHT_SERVICE_LABEL debfce3edcb19585edc08c5b1d986c0b -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make -FILE_INCLUDE CREDITS.TXT found in files: LICENSE.TXT at line 293 - License text: - Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE.TXT [293:293] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP COPYRIGHT_SERVICE_LABEL ebc015cad7377d32e7b2fc0ae5293aa1 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make -FILE_INCLUDE CREDITS.TXT found in files: LICENSE.TXT at line 252 - License text: - Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE.TXT [252:252] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make diff --git a/contrib/libs/clang14-rt/.yandex_meta/devtools.licenses.report b/contrib/libs/clang14-rt/.yandex_meta/devtools.licenses.report deleted file mode 100644 index e7510026be99..000000000000 --- a/contrib/libs/clang14-rt/.yandex_meta/devtools.licenses.report +++ /dev/null @@ -1,2626 +0,0 @@ -# File format ($ symbol means the beginning of a line): -# -# $ # this message -# $ # ======================= -# $ # comments (all commentaries should starts with some number of spaces and # symbol) -# ${action} {license spdx} {license text hash} -# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make -# ${all_file_action} filename -# $ # user commentaries (many lines) -# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) -# ${action} {license spdx} {license text hash} -# $BELONGS ./ya/make/file/relative/path/3/ya.make -# ${all_file_action} filename -# $ # user commentaries -# $ generated description -# $ ... -# -# You can modify action, all_file_action and add commentaries -# Available actions: -# keep - keep license in contrib and use in credits -# skip - skip license -# remove - remove all files with this license -# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file -# -# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) -# We suppose that that files can contain some license info -# Available all file actions: -# FILE_IGNORE - ignore file (do nothing) -# FILE_INCLUDE - include all file data into licenses text file -# ======================= - -KEEP Apache-2.0 WITH LLVM-exception 13ccb04dbdb720576c825193b2c4014c -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - |* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - |* See https://llvm.org/LICENSE.txt for license information. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : NOTICE - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - include/profile/InstrProfData.inc [3:4] - include/profile/MemProfData.inc [5:6] - lib/profile/GCDAProfiling.c [3:4] - lib/profile/InstrProfiling.c [3:4] - lib/profile/InstrProfiling.h [3:4] - lib/profile/InstrProfilingBuffer.c [3:4] - lib/profile/InstrProfilingFile.c [3:4] - lib/profile/InstrProfilingInternal.c [3:4] - lib/profile/InstrProfilingInternal.h [3:4] - lib/profile/InstrProfilingMerge.c [3:4] - lib/profile/InstrProfilingMergeFile.c [3:4] - lib/profile/InstrProfilingNameVar.c [3:4] - lib/profile/InstrProfilingPlatformDarwin.c [3:4] - lib/profile/InstrProfilingPlatformFuchsia.c [3:4] - lib/profile/InstrProfilingPlatformLinux.c [3:4] - lib/profile/InstrProfilingPlatformOther.c [3:4] - lib/profile/InstrProfilingPlatformWindows.c [3:4] - lib/profile/InstrProfilingPort.h [3:4] - lib/profile/InstrProfilingUtil.c [3:4] - lib/profile/InstrProfilingUtil.h [3:4] - lib/profile/InstrProfilingValue.c [3:4] - lib/profile/InstrProfilingVersionVar.c [3:4] - lib/profile/InstrProfilingWriter.c [3:4] - lib/profile/WindowsMMap.h [3:4] - Scancode info: - Original SPDX id: LLVM-exception - Score : 100.00 - Match type : NOTICE - Links : http://llvm.org/foundation/relicensing/LICENSE.txt, https://spdx.org/licenses/LLVM-exception - Files with this license: - include/profile/InstrProfData.inc [3:4] - include/profile/MemProfData.inc [5:6] - lib/profile/GCDAProfiling.c [3:4] - lib/profile/InstrProfiling.c [3:4] - lib/profile/InstrProfiling.h [3:4] - lib/profile/InstrProfilingBuffer.c [3:4] - lib/profile/InstrProfilingFile.c [3:4] - lib/profile/InstrProfilingInternal.c [3:4] - lib/profile/InstrProfilingInternal.h [3:4] - lib/profile/InstrProfilingMerge.c [3:4] - lib/profile/InstrProfilingMergeFile.c [3:4] - lib/profile/InstrProfilingNameVar.c [3:4] - lib/profile/InstrProfilingPlatformDarwin.c [3:4] - lib/profile/InstrProfilingPlatformFuchsia.c [3:4] - lib/profile/InstrProfilingPlatformLinux.c [3:4] - lib/profile/InstrProfilingPlatformOther.c [3:4] - lib/profile/InstrProfilingPlatformWindows.c [3:4] - lib/profile/InstrProfilingPort.h [3:4] - lib/profile/InstrProfilingUtil.c [3:4] - lib/profile/InstrProfilingUtil.h [3:4] - lib/profile/InstrProfilingValue.c [3:4] - lib/profile/InstrProfilingVersionVar.c [3:4] - lib/profile/InstrProfilingWriter.c [3:4] - lib/profile/WindowsMMap.h [3:4] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP NCSA 281d1ec07e86b61c925d7c514deecb25 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - Compiler-RT is open source software. You may freely distribute it under the - terms of the license agreement found in LICENSE.txt. - Scancode info: - Original SPDX id: NCSA - Score : 100.00 - Match type : NOTICE - Links : http://www.otm.illinois.edu/faculty/forms/opensource.asp, https://spdx.org/licenses/NCSA - Files with this license: - README.txt [7:8] - lib/builtins/README.txt [7:8] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -SKIP LicenseRef-scancode-warranty-disclaimer 384445f689b03d412e739da3f7c142a6 -BELONGS lib/memprof/ya.make - License text: - "(WARNING: USE AT YOUR OWN RISK!)") - Scancode info: - Original SPDX id: LicenseRef-scancode-warranty-disclaimer - Score : 100.00 - Match type : TEXT - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/warranty-disclaimer.LICENSE - Files with this license: - lib/memprof/memprof_flags.inc [33:33] - -KEEP NCSA 5a35b4c0d3b3923cac31a5a371332ca2 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - Scancode info: - Original SPDX id: NCSA - Score : 100.00 - Match type : REFERENCE - Links : http://www.otm.illinois.edu/faculty/forms/opensource.asp, https://spdx.org/licenses/NCSA - Files with this license: - LICENSE.TXT [237:237] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP MIT 5debb370f50e1dfd24ff5144233a2ef6 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: MIT - Score : 100.00 - Match type : TEXT - Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT - Files with this license: - LICENSE.TXT [295:311] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP Apache-2.0 WITH LLVM-exception 755ab7da3ff8c5d6ae90bdbebd177e49 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - // See https://llvm.org/LICENSE.txt for license information. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : NOTICE - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - include/sanitizer/allocator_interface.h [3:4] - include/sanitizer/asan_interface.h [3:4] - include/sanitizer/common_interface_defs.h [3:4] - include/sanitizer/coverage_interface.h [3:4] - include/sanitizer/dfsan_interface.h [3:4] - include/sanitizer/hwasan_interface.h [3:4] - include/sanitizer/linux_syscall_hooks.h [3:4] - include/sanitizer/lsan_interface.h [3:4] - include/sanitizer/memprof_interface.h [3:4] - include/sanitizer/msan_interface.h [3:4] - include/sanitizer/netbsd_syscall_hooks.h [3:4] - include/sanitizer/scudo_interface.h [3:4] - include/sanitizer/tsan_interface.h [3:4] - include/sanitizer/tsan_interface_atomic.h [3:4] - include/sanitizer/ubsan_interface.h [3:4] - lib/asan/asan_activation.cpp [3:4] - lib/asan/asan_activation.h [3:4] - lib/asan/asan_activation_flags.inc [3:4] - lib/asan/asan_allocator.cpp [3:4] - lib/asan/asan_allocator.h [3:4] - lib/asan/asan_debugging.cpp [3:4] - lib/asan/asan_descriptions.cpp [3:4] - lib/asan/asan_descriptions.h [3:4] - lib/asan/asan_errors.cpp [3:4] - lib/asan/asan_errors.h [3:4] - lib/asan/asan_fake_stack.cpp [3:4] - lib/asan/asan_fake_stack.h [3:4] - lib/asan/asan_flags.cpp [3:4] - lib/asan/asan_flags.h [3:4] - lib/asan/asan_flags.inc [3:4] - lib/asan/asan_fuchsia.cpp [3:4] - lib/asan/asan_globals.cpp [3:4] - lib/asan/asan_globals_win.cpp [3:4] - lib/asan/asan_init_version.h [3:4] - lib/asan/asan_interceptors.cpp [3:4] - lib/asan/asan_interceptors.h [3:4] - lib/asan/asan_interceptors_memintrinsics.cpp [3:4] - lib/asan/asan_interceptors_memintrinsics.h [3:4] - lib/asan/asan_interface_internal.h [3:4] - lib/asan/asan_internal.h [3:4] - lib/asan/asan_linux.cpp [3:4] - lib/asan/asan_mac.cpp [3:4] - lib/asan/asan_malloc_linux.cpp [3:4] - lib/asan/asan_malloc_mac.cpp [3:4] - lib/asan/asan_malloc_win.cpp [3:4] - lib/asan/asan_mapping.h [3:4] - lib/asan/asan_mapping_sparc64.h [3:4] - lib/asan/asan_memory_profile.cpp [3:4] - lib/asan/asan_new_delete.cpp [3:4] - lib/asan/asan_poisoning.cpp [3:4] - lib/asan/asan_poisoning.h [3:4] - lib/asan/asan_posix.cpp [3:4] - lib/asan/asan_preinit.cpp [3:4] - lib/asan/asan_premap_shadow.cpp [3:4] - lib/asan/asan_premap_shadow.h [3:4] - lib/asan/asan_report.cpp [3:4] - lib/asan/asan_report.h [3:4] - lib/asan/asan_rtl.cpp [3:4] - lib/asan/asan_rtl_static.cpp [3:4] - lib/asan/asan_scariness_score.h [3:4] - lib/asan/asan_shadow_setup.cpp [3:4] - lib/asan/asan_stack.cpp [3:4] - lib/asan/asan_stack.h [3:4] - lib/asan/asan_stats.cpp [3:4] - lib/asan/asan_stats.h [3:4] - lib/asan/asan_suppressions.cpp [3:4] - lib/asan/asan_suppressions.h [3:4] - lib/asan/asan_thread.cpp [3:4] - lib/asan/asan_thread.h [3:4] - lib/asan/asan_win.cpp [3:4] - lib/builtins/assembly.h [3:4] - lib/cfi/cfi.cpp [3:4] - lib/dfsan/dfsan.cpp [3:4] - lib/dfsan/dfsan.h [3:4] - lib/dfsan/dfsan_allocator.cpp [3:4] - lib/dfsan/dfsan_allocator.h [3:4] - lib/dfsan/dfsan_chained_origin_depot.cpp [3:4] - lib/dfsan/dfsan_chained_origin_depot.h [3:4] - lib/dfsan/dfsan_custom.cpp [3:4] - lib/dfsan/dfsan_flags.h [3:4] - lib/dfsan/dfsan_flags.inc [3:4] - lib/dfsan/dfsan_interceptors.cpp [3:4] - lib/dfsan/dfsan_new_delete.cpp [3:4] - lib/dfsan/dfsan_origin.h [3:4] - lib/dfsan/dfsan_platform.h [3:4] - lib/dfsan/dfsan_thread.h [3:4] - lib/gwp_asan/common.cpp [3:4] - lib/gwp_asan/common.h [3:4] - lib/gwp_asan/crash_handler.cpp [3:4] - lib/gwp_asan/crash_handler.h [3:4] - lib/gwp_asan/definitions.h [3:4] - lib/gwp_asan/guarded_pool_allocator.cpp [3:4] - lib/gwp_asan/guarded_pool_allocator.h [3:4] - lib/gwp_asan/mutex.h [3:4] - lib/gwp_asan/optional/backtrace.h [3:4] - lib/gwp_asan/optional/backtrace_linux_libc.cpp [3:4] - lib/gwp_asan/optional/options_parser.cpp [3:4] - lib/gwp_asan/optional/options_parser.h [3:4] - lib/gwp_asan/optional/printf.h [3:4] - lib/gwp_asan/optional/segv_handler.h [3:4] - lib/gwp_asan/optional/segv_handler_posix.cpp [3:4] - lib/gwp_asan/options.h [3:4] - lib/gwp_asan/options.inc [3:4] - lib/gwp_asan/platform_specific/common_posix.cpp [3:4] - lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h [3:4] - lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp [3:4] - lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h [3:4] - lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h [3:4] - lib/gwp_asan/platform_specific/mutex_fuchsia.h [3:4] - lib/gwp_asan/platform_specific/mutex_posix.cpp [3:4] - lib/gwp_asan/platform_specific/mutex_posix.h [3:4] - lib/gwp_asan/platform_specific/utilities_posix.cpp [3:4] - lib/gwp_asan/stack_trace_compressor.cpp [3:4] - lib/gwp_asan/stack_trace_compressor.h [3:4] - lib/gwp_asan/utilities.h [3:4] - lib/hwasan/hwasan.cpp [3:4] - lib/hwasan/hwasan.h [3:4] - lib/hwasan/hwasan_allocation_functions.cpp [3:4] - lib/hwasan/hwasan_allocator.cpp [3:4] - lib/hwasan/hwasan_allocator.h [3:4] - lib/hwasan/hwasan_checks.h [3:4] - lib/hwasan/hwasan_dynamic_shadow.cpp [3:4] - lib/hwasan/hwasan_dynamic_shadow.h [3:4] - lib/hwasan/hwasan_exceptions.cpp [3:4] - lib/hwasan/hwasan_flags.h [3:4] - lib/hwasan/hwasan_flags.inc [3:4] - lib/hwasan/hwasan_fuchsia.cpp [3:4] - lib/hwasan/hwasan_globals.cpp [3:4] - lib/hwasan/hwasan_globals.h [3:4] - lib/hwasan/hwasan_interceptors.cpp [3:4] - lib/hwasan/hwasan_interface_internal.h [3:4] - lib/hwasan/hwasan_linux.cpp [3:4] - lib/hwasan/hwasan_malloc_bisect.h [3:4] - lib/hwasan/hwasan_mapping.h [3:4] - lib/hwasan/hwasan_memintrinsics.cpp [3:4] - lib/hwasan/hwasan_new_delete.cpp [3:4] - lib/hwasan/hwasan_poisoning.cpp [3:4] - lib/hwasan/hwasan_poisoning.h [3:4] - lib/hwasan/hwasan_report.cpp [3:4] - lib/hwasan/hwasan_report.h [3:4] - lib/hwasan/hwasan_setjmp_aarch64.S [3:4] - lib/hwasan/hwasan_setjmp_x86_64.S [3:4] - lib/hwasan/hwasan_thread.h [3:4] - lib/hwasan/hwasan_thread_list.h [3:4] - lib/hwasan/hwasan_type_test.cpp [3:4] - lib/interception/interception.h [3:4] - lib/interception/interception_linux.cpp [3:4] - lib/interception/interception_linux.h [3:4] - lib/interception/interception_mac.cpp [3:4] - lib/interception/interception_mac.h [3:4] - lib/interception/interception_type_test.cpp [3:4] - lib/interception/interception_win.cpp [3:4] - lib/interception/interception_win.h [3:4] - lib/lsan/lsan.cpp [3:4] - lib/lsan/lsan.h [3:4] - lib/lsan/lsan_allocator.cpp [3:4] - lib/lsan/lsan_allocator.h [3:4] - lib/lsan/lsan_common.cpp [3:4] - lib/lsan/lsan_common.h [3:4] - lib/lsan/lsan_common_fuchsia.cpp [3:4] - lib/lsan/lsan_common_linux.cpp [3:4] - lib/lsan/lsan_common_mac.cpp [3:4] - lib/lsan/lsan_flags.inc [3:4] - lib/lsan/lsan_fuchsia.cpp [3:4] - lib/lsan/lsan_fuchsia.h [3:4] - lib/lsan/lsan_interceptors.cpp [3:4] - lib/lsan/lsan_linux.cpp [3:4] - lib/lsan/lsan_mac.cpp [3:4] - lib/lsan/lsan_malloc_mac.cpp [3:4] - lib/lsan/lsan_posix.cpp [3:4] - lib/lsan/lsan_posix.h [3:4] - lib/lsan/lsan_preinit.cpp [3:4] - lib/lsan/lsan_thread.cpp [3:4] - lib/lsan/lsan_thread.h [3:4] - lib/memprof/memprof_allocator.cpp [3:4] - lib/memprof/memprof_allocator.h [3:4] - lib/memprof/memprof_descriptions.cpp [3:4] - lib/memprof/memprof_descriptions.h [3:4] - lib/memprof/memprof_flags.cpp [3:4] - lib/memprof/memprof_flags.h [3:4] - lib/memprof/memprof_flags.inc [3:4] - lib/memprof/memprof_init_version.h [3:4] - lib/memprof/memprof_interceptors.cpp [3:4] - lib/memprof/memprof_interceptors.h [3:4] - lib/memprof/memprof_interceptors_memintrinsics.cpp [3:4] - lib/memprof/memprof_interceptors_memintrinsics.h [3:4] - lib/memprof/memprof_interface_internal.h [3:4] - lib/memprof/memprof_internal.h [3:4] - lib/memprof/memprof_linux.cpp [3:4] - lib/memprof/memprof_malloc_linux.cpp [3:4] - lib/memprof/memprof_mapping.h [3:4] - lib/memprof/memprof_mibmap.cpp [3:4] - lib/memprof/memprof_new_delete.cpp [3:4] - lib/memprof/memprof_posix.cpp [3:4] - lib/memprof/memprof_preinit.cpp [3:4] - lib/memprof/memprof_rtl.cpp [3:4] - lib/memprof/memprof_shadow_setup.cpp [3:4] - lib/memprof/memprof_stack.cpp [3:4] - lib/memprof/memprof_stack.h [3:4] - lib/memprof/memprof_stats.cpp [3:4] - lib/memprof/memprof_stats.h [3:4] - lib/memprof/memprof_thread.cpp [3:4] - lib/memprof/memprof_thread.h [3:4] - lib/msan/msan.cpp [3:4] - lib/msan/msan.h [3:4] - lib/msan/msan_allocator.cpp [3:4] - lib/msan/msan_allocator.h [3:4] - lib/msan/msan_chained_origin_depot.cpp [3:4] - lib/msan/msan_chained_origin_depot.h [3:4] - lib/msan/msan_flags.h [3:4] - lib/msan/msan_flags.inc [3:4] - lib/msan/msan_interceptors.cpp [3:4] - lib/msan/msan_interface_internal.h [3:4] - lib/msan/msan_linux.cpp [3:4] - lib/msan/msan_new_delete.cpp [3:4] - lib/msan/msan_origin.h [3:4] - lib/msan/msan_poisoning.cpp [3:4] - lib/msan/msan_poisoning.h [3:4] - lib/msan/msan_report.cpp [3:4] - lib/msan/msan_report.h [3:4] - lib/msan/msan_thread.h [3:4] - lib/profile/InstrProfilingRuntime.cpp [3:4] - lib/safestack/safestack.cpp [3:4] - lib/safestack/safestack_platform.h [3:4] - lib/safestack/safestack_util.h [3:4] - lib/sanitizer_common/sancov_flags.cpp [3:4] - lib/sanitizer_common/sancov_flags.h [3:4] - lib/sanitizer_common/sancov_flags.inc [3:4] - lib/sanitizer_common/sanitizer_addrhashmap.h [3:4] - lib/sanitizer_common/sanitizer_allocator.cpp [3:4] - lib/sanitizer_common/sanitizer_allocator.h [3:4] - lib/sanitizer_common/sanitizer_allocator_checks.cpp [3:4] - lib/sanitizer_common/sanitizer_allocator_checks.h [3:4] - lib/sanitizer_common/sanitizer_allocator_combined.h [3:4] - lib/sanitizer_common/sanitizer_allocator_dlsym.h [3:4] - lib/sanitizer_common/sanitizer_allocator_interface.h [3:4] - lib/sanitizer_common/sanitizer_allocator_internal.h [3:4] - lib/sanitizer_common/sanitizer_allocator_local_cache.h [3:4] - lib/sanitizer_common/sanitizer_allocator_primary32.h [3:4] - lib/sanitizer_common/sanitizer_allocator_primary64.h [3:4] - lib/sanitizer_common/sanitizer_allocator_report.cpp [3:4] - lib/sanitizer_common/sanitizer_allocator_report.h [3:4] - lib/sanitizer_common/sanitizer_allocator_secondary.h [3:4] - lib/sanitizer_common/sanitizer_allocator_size_class_map.h [3:4] - lib/sanitizer_common/sanitizer_allocator_stats.h [3:4] - lib/sanitizer_common/sanitizer_asm.h [3:4] - lib/sanitizer_common/sanitizer_atomic.h [3:4] - lib/sanitizer_common/sanitizer_atomic_clang.h [3:4] - lib/sanitizer_common/sanitizer_atomic_clang_mips.h [3:4] - lib/sanitizer_common/sanitizer_atomic_clang_other.h [3:4] - lib/sanitizer_common/sanitizer_atomic_clang_x86.h [3:4] - lib/sanitizer_common/sanitizer_atomic_msvc.h [3:4] - lib/sanitizer_common/sanitizer_bitvector.h [3:4] - lib/sanitizer_common/sanitizer_bvgraph.h [3:4] - lib/sanitizer_common/sanitizer_chained_origin_depot.cpp [3:4] - lib/sanitizer_common/sanitizer_chained_origin_depot.h [3:4] - lib/sanitizer_common/sanitizer_common.cpp [3:4] - lib/sanitizer_common/sanitizer_common.h [3:4] - lib/sanitizer_common/sanitizer_common_interceptors.inc [3:4] - lib/sanitizer_common/sanitizer_common_interceptors_format.inc [3:4] - lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc [3:4] - lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc [3:4] - lib/sanitizer_common/sanitizer_common_interface.inc [3:4] - lib/sanitizer_common/sanitizer_common_interface_posix.inc [3:4] - lib/sanitizer_common/sanitizer_common_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_common_syscalls.inc [3:4] - lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp [3:4] - lib/sanitizer_common/sanitizer_coverage_interface.inc [3:4] - lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp [3:4] - lib/sanitizer_common/sanitizer_coverage_win_sections.cpp [3:4] - lib/sanitizer_common/sanitizer_dbghelp.h [3:4] - lib/sanitizer_common/sanitizer_deadlock_detector.h [3:4] - lib/sanitizer_common/sanitizer_deadlock_detector1.cpp [3:4] - lib/sanitizer_common/sanitizer_deadlock_detector2.cpp [3:4] - lib/sanitizer_common/sanitizer_deadlock_detector_interface.h [3:4] - lib/sanitizer_common/sanitizer_dense_map.h [3:4] - lib/sanitizer_common/sanitizer_dense_map_info.h [3:4] - lib/sanitizer_common/sanitizer_errno.cpp [3:4] - lib/sanitizer_common/sanitizer_errno.h [3:4] - lib/sanitizer_common/sanitizer_errno_codes.h [3:4] - lib/sanitizer_common/sanitizer_file.cpp [3:4] - lib/sanitizer_common/sanitizer_file.h [3:4] - lib/sanitizer_common/sanitizer_flag_parser.cpp [3:4] - lib/sanitizer_common/sanitizer_flag_parser.h [3:4] - lib/sanitizer_common/sanitizer_flags.cpp [3:4] - lib/sanitizer_common/sanitizer_flags.h [3:4] - lib/sanitizer_common/sanitizer_flags.inc [3:4] - lib/sanitizer_common/sanitizer_flat_map.h [3:4] - lib/sanitizer_common/sanitizer_freebsd.h [3:4] - lib/sanitizer_common/sanitizer_fuchsia.cpp [3:4] - lib/sanitizer_common/sanitizer_fuchsia.h [3:4] - lib/sanitizer_common/sanitizer_getauxval.h [3:4] - lib/sanitizer_common/sanitizer_glibc_version.h [3:4] - lib/sanitizer_common/sanitizer_hash.h [3:4] - lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc [3:4] - lib/sanitizer_common/sanitizer_interface_internal.h [3:4] - lib/sanitizer_common/sanitizer_internal_defs.h [3:4] - lib/sanitizer_common/sanitizer_leb128.h [3:4] - lib/sanitizer_common/sanitizer_lfstack.h [3:4] - lib/sanitizer_common/sanitizer_libc.cpp [3:4] - lib/sanitizer_common/sanitizer_libc.h [3:4] - lib/sanitizer_common/sanitizer_libignore.cpp [3:4] - lib/sanitizer_common/sanitizer_libignore.h [3:4] - lib/sanitizer_common/sanitizer_linux.cpp [3:4] - lib/sanitizer_common/sanitizer_linux.h [3:4] - lib/sanitizer_common/sanitizer_linux_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_linux_s390.cpp [3:4] - lib/sanitizer_common/sanitizer_list.h [3:4] - lib/sanitizer_common/sanitizer_local_address_space_view.h [3:4] - lib/sanitizer_common/sanitizer_lzw.h [3:4] - lib/sanitizer_common/sanitizer_mac.cpp [3:4] - lib/sanitizer_common/sanitizer_mac.h [3:4] - lib/sanitizer_common/sanitizer_mac_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_malloc_mac.inc [3:4] - lib/sanitizer_common/sanitizer_mutex.cpp [3:4] - lib/sanitizer_common/sanitizer_mutex.h [3:4] - lib/sanitizer_common/sanitizer_netbsd.cpp [3:4] - lib/sanitizer_common/sanitizer_placement_new.h [3:4] - lib/sanitizer_common/sanitizer_platform.h [3:4] - lib/sanitizer_common/sanitizer_platform_interceptors.h [3:4] - lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_freebsd.h [3:4] - lib/sanitizer_common/sanitizer_platform_limits_linux.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_netbsd.h [3:4] - lib/sanitizer_common/sanitizer_platform_limits_posix.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_posix.h [3:4] - lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_solaris.h [3:4] - lib/sanitizer_common/sanitizer_posix.cpp [3:4] - lib/sanitizer_common/sanitizer_posix.h [3:4] - lib/sanitizer_common/sanitizer_posix_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_printf.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps.h [3:4] - lib/sanitizer_common/sanitizer_procmaps_bsd.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps_common.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps_fuchsia.cpp [4:5] - lib/sanitizer_common/sanitizer_procmaps_linux.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps_mac.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps_solaris.cpp [3:4] - lib/sanitizer_common/sanitizer_ptrauth.h [3:4] - lib/sanitizer_common/sanitizer_quarantine.h [3:4] - lib/sanitizer_common/sanitizer_report_decorator.h [3:4] - lib/sanitizer_common/sanitizer_ring_buffer.h [3:4] - lib/sanitizer_common/sanitizer_signal_interceptors.inc [3:4] - lib/sanitizer_common/sanitizer_solaris.cpp [3:4] - lib/sanitizer_common/sanitizer_stack_store.cpp [3:4] - lib/sanitizer_common/sanitizer_stack_store.h [3:4] - lib/sanitizer_common/sanitizer_stackdepot.cpp [3:4] - lib/sanitizer_common/sanitizer_stackdepot.h [3:4] - lib/sanitizer_common/sanitizer_stackdepotbase.h [3:4] - lib/sanitizer_common/sanitizer_stacktrace.cpp [3:4] - lib/sanitizer_common/sanitizer_stacktrace.h [3:4] - lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_stacktrace_printer.cpp [3:4] - lib/sanitizer_common/sanitizer_stacktrace_printer.h [3:4] - lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld.h [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.h [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_win.cpp [3:4] - lib/sanitizer_common/sanitizer_suppressions.cpp [3:4] - lib/sanitizer_common/sanitizer_suppressions.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_internal.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_mac.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_mac.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_markup.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_report.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_win.cpp [3:4] - lib/sanitizer_common/sanitizer_syscall_generic.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_arm.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_hexagon.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_riscv64.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_x86_64.inc [3:4] - lib/sanitizer_common/sanitizer_syscalls_netbsd.inc [3:4] - lib/sanitizer_common/sanitizer_termination.cpp [3:4] - lib/sanitizer_common/sanitizer_thread_registry.cpp [3:4] - lib/sanitizer_common/sanitizer_thread_registry.h [3:4] - lib/sanitizer_common/sanitizer_thread_safety.h [3:4] - lib/sanitizer_common/sanitizer_tls_get_addr.cpp [3:4] - lib/sanitizer_common/sanitizer_tls_get_addr.h [3:4] - lib/sanitizer_common/sanitizer_type_traits.cpp [3:4] - lib/sanitizer_common/sanitizer_type_traits.h [3:4] - lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_unwind_win.cpp [3:4] - lib/sanitizer_common/sanitizer_vector.h [3:4] - lib/sanitizer_common/sanitizer_win.cpp [3:4] - lib/sanitizer_common/sanitizer_win.h [3:4] - lib/sanitizer_common/sanitizer_win_defs.h [3:4] - lib/sanitizer_common/sanitizer_win_dll_thunk.h [3:4] - lib/sanitizer_common/sanitizer_win_weak_interception.h [3:4] - lib/scudo/scudo_allocator.cpp [3:4] - lib/scudo/scudo_allocator.h [3:4] - lib/scudo/scudo_allocator_combined.h [3:4] - lib/scudo/scudo_allocator_secondary.h [3:4] - lib/scudo/scudo_crc32.cpp [3:4] - lib/scudo/scudo_crc32.h [3:4] - lib/scudo/scudo_errors.cpp [3:4] - lib/scudo/scudo_errors.h [3:4] - lib/scudo/scudo_flags.cpp [3:4] - lib/scudo/scudo_flags.h [3:4] - lib/scudo/scudo_flags.inc [3:4] - lib/scudo/scudo_interface_internal.h [3:4] - lib/scudo/scudo_malloc.cpp [3:4] - lib/scudo/scudo_new_delete.cpp [3:4] - lib/scudo/scudo_platform.h [3:4] - lib/scudo/scudo_termination.cpp [3:4] - lib/scudo/scudo_tsd.h [3:4] - lib/scudo/scudo_tsd_exclusive.cpp [3:4] - lib/scudo/scudo_tsd_exclusive.inc [3:4] - lib/scudo/scudo_tsd_shared.cpp [3:4] - lib/scudo/scudo_tsd_shared.inc [3:4] - lib/scudo/scudo_utils.cpp [3:4] - lib/scudo/scudo_utils.h [3:4] - lib/scudo/standalone/allocator_config.h [3:4] - lib/scudo/standalone/atomic_helpers.h [3:4] - lib/scudo/standalone/bytemap.h [3:4] - lib/scudo/standalone/checksum.cpp [3:4] - lib/scudo/standalone/checksum.h [3:4] - lib/scudo/standalone/chunk.h [3:4] - lib/scudo/standalone/combined.h [3:4] - lib/scudo/standalone/common.cpp [3:4] - lib/scudo/standalone/common.h [3:4] - lib/scudo/standalone/crc32_hw.cpp [3:4] - lib/scudo/standalone/flags.cpp [3:4] - lib/scudo/standalone/flags.h [3:4] - lib/scudo/standalone/flags.inc [3:4] - lib/scudo/standalone/flags_parser.cpp [3:4] - lib/scudo/standalone/flags_parser.h [3:4] - lib/scudo/standalone/fuchsia.cpp [3:4] - lib/scudo/standalone/fuchsia.h [3:4] - lib/scudo/standalone/include/scudo/interface.h [3:4] - lib/scudo/standalone/internal_defs.h [3:4] - lib/scudo/standalone/linux.cpp [3:4] - lib/scudo/standalone/linux.h [3:4] - lib/scudo/standalone/list.h [3:4] - lib/scudo/standalone/local_cache.h [3:4] - lib/scudo/standalone/memtag.h [3:4] - lib/scudo/standalone/mutex.h [3:4] - lib/scudo/standalone/options.h [3:4] - lib/scudo/standalone/platform.h [3:4] - lib/scudo/standalone/primary32.h [3:4] - lib/scudo/standalone/primary64.h [3:4] - lib/scudo/standalone/quarantine.h [3:4] - lib/scudo/standalone/release.cpp [3:4] - lib/scudo/standalone/release.h [3:4] - lib/scudo/standalone/report.cpp [3:4] - lib/scudo/standalone/report.h [3:4] - lib/scudo/standalone/secondary.h [3:4] - lib/scudo/standalone/size_class_map.h [3:4] - lib/scudo/standalone/stack_depot.h [3:4] - lib/scudo/standalone/stats.h [3:4] - lib/scudo/standalone/string_utils.cpp [3:4] - lib/scudo/standalone/string_utils.h [3:4] - lib/scudo/standalone/trusty.h [3:4] - lib/scudo/standalone/tsd.h [3:4] - lib/scudo/standalone/tsd_exclusive.h [3:4] - lib/scudo/standalone/tsd_shared.h [3:4] - lib/scudo/standalone/vector.h [3:4] - lib/scudo/standalone/wrappers_c.cpp [3:4] - lib/scudo/standalone/wrappers_c.h [3:4] - lib/scudo/standalone/wrappers_c.inc [3:4] - lib/scudo/standalone/wrappers_c_checks.h [3:4] - lib/scudo/standalone/wrappers_cpp.cpp [3:4] - lib/stats/stats.cpp [3:4] - lib/stats/stats.h [3:4] - lib/stats/stats_client.cpp [3:4] - lib/tsan/dd/dd_interceptors.cpp [3:4] - lib/tsan/dd/dd_rtl.cpp [3:4] - lib/tsan/dd/dd_rtl.h [3:4] - lib/tsan/rtl/tsan_debugging.cpp [3:4] - lib/tsan/rtl/tsan_defs.h [3:4] - lib/tsan/rtl/tsan_dense_alloc.h [3:4] - lib/tsan/rtl/tsan_external.cpp [3:4] - lib/tsan/rtl/tsan_fd.cpp [3:4] - lib/tsan/rtl/tsan_fd.h [3:4] - lib/tsan/rtl/tsan_flags.cpp [3:4] - lib/tsan/rtl/tsan_flags.h [3:4] - lib/tsan/rtl/tsan_flags.inc [3:4] - lib/tsan/rtl/tsan_ignoreset.cpp [3:4] - lib/tsan/rtl/tsan_ignoreset.h [3:4] - lib/tsan/rtl/tsan_ilist.h [3:4] - lib/tsan/rtl/tsan_interceptors_libdispatch.cpp [3:4] - lib/tsan/rtl/tsan_interceptors_mac.cpp [3:4] - lib/tsan/rtl/tsan_interceptors_mach_vm.cpp [3:4] - lib/tsan/rtl/tsan_interceptors_posix.cpp [3:4] - lib/tsan/rtl/tsan_interface.cpp [3:4] - lib/tsan/rtl/tsan_interface.h [3:4] - lib/tsan/rtl/tsan_interface.inc [3:4] - lib/tsan/rtl/tsan_interface_ann.cpp [3:4] - lib/tsan/rtl/tsan_interface_ann.h [3:4] - lib/tsan/rtl/tsan_interface_atomic.cpp [3:4] - lib/tsan/rtl/tsan_interface_java.cpp [3:4] - lib/tsan/rtl/tsan_interface_java.h [3:4] - lib/tsan/rtl/tsan_malloc_mac.cpp [3:4] - lib/tsan/rtl/tsan_md5.cpp [3:4] - lib/tsan/rtl/tsan_mman.cpp [3:4] - lib/tsan/rtl/tsan_mman.h [3:4] - lib/tsan/rtl/tsan_mutexset.cpp [3:4] - lib/tsan/rtl/tsan_mutexset.h [3:4] - lib/tsan/rtl/tsan_new_delete.cpp [3:4] - lib/tsan/rtl/tsan_platform.h [3:4] - lib/tsan/rtl/tsan_platform_linux.cpp [3:4] - lib/tsan/rtl/tsan_platform_mac.cpp [3:4] - lib/tsan/rtl/tsan_platform_posix.cpp [3:4] - lib/tsan/rtl/tsan_platform_windows.cpp [3:4] - lib/tsan/rtl/tsan_preinit.cpp [3:4] - lib/tsan/rtl/tsan_report.cpp [3:4] - lib/tsan/rtl/tsan_report.h [3:4] - lib/tsan/rtl/tsan_rtl.cpp [3:4] - lib/tsan/rtl/tsan_rtl.h [3:4] - lib/tsan/rtl/tsan_rtl_access.cpp [3:4] - lib/tsan/rtl/tsan_rtl_mutex.cpp [3:4] - lib/tsan/rtl/tsan_rtl_proc.cpp [3:4] - lib/tsan/rtl/tsan_rtl_report.cpp [3:4] - lib/tsan/rtl/tsan_rtl_thread.cpp [3:4] - lib/tsan/rtl/tsan_shadow.h [3:4] - lib/tsan/rtl/tsan_stack_trace.cpp [3:4] - lib/tsan/rtl/tsan_stack_trace.h [3:4] - lib/tsan/rtl/tsan_suppressions.cpp [3:4] - lib/tsan/rtl/tsan_suppressions.h [3:4] - lib/tsan/rtl/tsan_symbolize.cpp [3:4] - lib/tsan/rtl/tsan_symbolize.h [3:4] - lib/tsan/rtl/tsan_sync.cpp [3:4] - lib/tsan/rtl/tsan_sync.h [3:4] - lib/tsan/rtl/tsan_trace.h [3:4] - lib/tsan/rtl/tsan_vector_clock.cpp [3:4] - lib/tsan/rtl/tsan_vector_clock.h [3:4] - lib/ubsan/ubsan_checks.inc [3:4] - lib/ubsan/ubsan_diag.cpp [3:4] - lib/ubsan/ubsan_diag.h [3:4] - lib/ubsan/ubsan_diag_standalone.cpp [3:4] - lib/ubsan/ubsan_flags.cpp [3:4] - lib/ubsan/ubsan_flags.h [3:4] - lib/ubsan/ubsan_flags.inc [3:4] - lib/ubsan/ubsan_handlers.cpp [3:4] - lib/ubsan/ubsan_handlers.h [3:4] - lib/ubsan/ubsan_handlers_cxx.cpp [3:4] - lib/ubsan/ubsan_handlers_cxx.h [3:4] - lib/ubsan/ubsan_init.cpp [3:4] - lib/ubsan/ubsan_init.h [3:4] - lib/ubsan/ubsan_init_standalone.cpp [3:4] - lib/ubsan/ubsan_init_standalone_preinit.cpp [3:4] - lib/ubsan/ubsan_monitor.cpp [3:4] - lib/ubsan/ubsan_monitor.h [3:4] - lib/ubsan/ubsan_platform.h [3:4] - lib/ubsan/ubsan_signals_standalone.cpp [3:4] - lib/ubsan/ubsan_signals_standalone.h [4:5] - lib/ubsan/ubsan_type_hash.cpp [3:4] - lib/ubsan/ubsan_type_hash.h [3:4] - lib/ubsan/ubsan_type_hash_itanium.cpp [3:4] - lib/ubsan/ubsan_type_hash_win.cpp [3:4] - lib/ubsan/ubsan_value.cpp [3:4] - lib/ubsan/ubsan_value.h [3:4] - Scancode info: - Original SPDX id: LLVM-exception - Score : 100.00 - Match type : NOTICE - Links : http://llvm.org/foundation/relicensing/LICENSE.txt, https://spdx.org/licenses/LLVM-exception - Files with this license: - include/sanitizer/allocator_interface.h [3:4] - include/sanitizer/asan_interface.h [3:4] - include/sanitizer/common_interface_defs.h [3:4] - include/sanitizer/coverage_interface.h [3:4] - include/sanitizer/dfsan_interface.h [3:4] - include/sanitizer/hwasan_interface.h [3:4] - include/sanitizer/linux_syscall_hooks.h [3:4] - include/sanitizer/lsan_interface.h [3:4] - include/sanitizer/memprof_interface.h [3:4] - include/sanitizer/msan_interface.h [3:4] - include/sanitizer/netbsd_syscall_hooks.h [3:4] - include/sanitizer/scudo_interface.h [3:4] - include/sanitizer/tsan_interface.h [3:4] - include/sanitizer/tsan_interface_atomic.h [3:4] - include/sanitizer/ubsan_interface.h [3:4] - lib/asan/asan_activation.cpp [3:4] - lib/asan/asan_activation.h [3:4] - lib/asan/asan_activation_flags.inc [3:4] - lib/asan/asan_allocator.cpp [3:4] - lib/asan/asan_allocator.h [3:4] - lib/asan/asan_debugging.cpp [3:4] - lib/asan/asan_descriptions.cpp [3:4] - lib/asan/asan_descriptions.h [3:4] - lib/asan/asan_errors.cpp [3:4] - lib/asan/asan_errors.h [3:4] - lib/asan/asan_fake_stack.cpp [3:4] - lib/asan/asan_fake_stack.h [3:4] - lib/asan/asan_flags.cpp [3:4] - lib/asan/asan_flags.h [3:4] - lib/asan/asan_flags.inc [3:4] - lib/asan/asan_fuchsia.cpp [3:4] - lib/asan/asan_globals.cpp [3:4] - lib/asan/asan_globals_win.cpp [3:4] - lib/asan/asan_init_version.h [3:4] - lib/asan/asan_interceptors.cpp [3:4] - lib/asan/asan_interceptors.h [3:4] - lib/asan/asan_interceptors_memintrinsics.cpp [3:4] - lib/asan/asan_interceptors_memintrinsics.h [3:4] - lib/asan/asan_interface_internal.h [3:4] - lib/asan/asan_internal.h [3:4] - lib/asan/asan_linux.cpp [3:4] - lib/asan/asan_mac.cpp [3:4] - lib/asan/asan_malloc_linux.cpp [3:4] - lib/asan/asan_malloc_mac.cpp [3:4] - lib/asan/asan_malloc_win.cpp [3:4] - lib/asan/asan_mapping.h [3:4] - lib/asan/asan_mapping_sparc64.h [3:4] - lib/asan/asan_memory_profile.cpp [3:4] - lib/asan/asan_new_delete.cpp [3:4] - lib/asan/asan_poisoning.cpp [3:4] - lib/asan/asan_poisoning.h [3:4] - lib/asan/asan_posix.cpp [3:4] - lib/asan/asan_preinit.cpp [3:4] - lib/asan/asan_premap_shadow.cpp [3:4] - lib/asan/asan_premap_shadow.h [3:4] - lib/asan/asan_report.cpp [3:4] - lib/asan/asan_report.h [3:4] - lib/asan/asan_rtl.cpp [3:4] - lib/asan/asan_rtl_static.cpp [3:4] - lib/asan/asan_scariness_score.h [3:4] - lib/asan/asan_shadow_setup.cpp [3:4] - lib/asan/asan_stack.cpp [3:4] - lib/asan/asan_stack.h [3:4] - lib/asan/asan_stats.cpp [3:4] - lib/asan/asan_stats.h [3:4] - lib/asan/asan_suppressions.cpp [3:4] - lib/asan/asan_suppressions.h [3:4] - lib/asan/asan_thread.cpp [3:4] - lib/asan/asan_thread.h [3:4] - lib/asan/asan_win.cpp [3:4] - lib/builtins/assembly.h [3:4] - lib/cfi/cfi.cpp [3:4] - lib/dfsan/dfsan.cpp [3:4] - lib/dfsan/dfsan.h [3:4] - lib/dfsan/dfsan_allocator.cpp [3:4] - lib/dfsan/dfsan_allocator.h [3:4] - lib/dfsan/dfsan_chained_origin_depot.cpp [3:4] - lib/dfsan/dfsan_chained_origin_depot.h [3:4] - lib/dfsan/dfsan_custom.cpp [3:4] - lib/dfsan/dfsan_flags.h [3:4] - lib/dfsan/dfsan_flags.inc [3:4] - lib/dfsan/dfsan_interceptors.cpp [3:4] - lib/dfsan/dfsan_new_delete.cpp [3:4] - lib/dfsan/dfsan_origin.h [3:4] - lib/dfsan/dfsan_platform.h [3:4] - lib/dfsan/dfsan_thread.h [3:4] - lib/gwp_asan/common.cpp [3:4] - lib/gwp_asan/common.h [3:4] - lib/gwp_asan/crash_handler.cpp [3:4] - lib/gwp_asan/crash_handler.h [3:4] - lib/gwp_asan/definitions.h [3:4] - lib/gwp_asan/guarded_pool_allocator.cpp [3:4] - lib/gwp_asan/guarded_pool_allocator.h [3:4] - lib/gwp_asan/mutex.h [3:4] - lib/gwp_asan/optional/backtrace.h [3:4] - lib/gwp_asan/optional/backtrace_linux_libc.cpp [3:4] - lib/gwp_asan/optional/options_parser.cpp [3:4] - lib/gwp_asan/optional/options_parser.h [3:4] - lib/gwp_asan/optional/printf.h [3:4] - lib/gwp_asan/optional/segv_handler.h [3:4] - lib/gwp_asan/optional/segv_handler_posix.cpp [3:4] - lib/gwp_asan/options.h [3:4] - lib/gwp_asan/options.inc [3:4] - lib/gwp_asan/platform_specific/common_posix.cpp [3:4] - lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h [3:4] - lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp [3:4] - lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h [3:4] - lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h [3:4] - lib/gwp_asan/platform_specific/mutex_fuchsia.h [3:4] - lib/gwp_asan/platform_specific/mutex_posix.cpp [3:4] - lib/gwp_asan/platform_specific/mutex_posix.h [3:4] - lib/gwp_asan/platform_specific/utilities_posix.cpp [3:4] - lib/gwp_asan/stack_trace_compressor.cpp [3:4] - lib/gwp_asan/stack_trace_compressor.h [3:4] - lib/gwp_asan/utilities.h [3:4] - lib/hwasan/hwasan.cpp [3:4] - lib/hwasan/hwasan.h [3:4] - lib/hwasan/hwasan_allocation_functions.cpp [3:4] - lib/hwasan/hwasan_allocator.cpp [3:4] - lib/hwasan/hwasan_allocator.h [3:4] - lib/hwasan/hwasan_checks.h [3:4] - lib/hwasan/hwasan_dynamic_shadow.cpp [3:4] - lib/hwasan/hwasan_dynamic_shadow.h [3:4] - lib/hwasan/hwasan_exceptions.cpp [3:4] - lib/hwasan/hwasan_flags.h [3:4] - lib/hwasan/hwasan_flags.inc [3:4] - lib/hwasan/hwasan_fuchsia.cpp [3:4] - lib/hwasan/hwasan_globals.cpp [3:4] - lib/hwasan/hwasan_globals.h [3:4] - lib/hwasan/hwasan_interceptors.cpp [3:4] - lib/hwasan/hwasan_interface_internal.h [3:4] - lib/hwasan/hwasan_linux.cpp [3:4] - lib/hwasan/hwasan_malloc_bisect.h [3:4] - lib/hwasan/hwasan_mapping.h [3:4] - lib/hwasan/hwasan_memintrinsics.cpp [3:4] - lib/hwasan/hwasan_new_delete.cpp [3:4] - lib/hwasan/hwasan_poisoning.cpp [3:4] - lib/hwasan/hwasan_poisoning.h [3:4] - lib/hwasan/hwasan_report.cpp [3:4] - lib/hwasan/hwasan_report.h [3:4] - lib/hwasan/hwasan_setjmp_aarch64.S [3:4] - lib/hwasan/hwasan_setjmp_x86_64.S [3:4] - lib/hwasan/hwasan_thread.h [3:4] - lib/hwasan/hwasan_thread_list.h [3:4] - lib/hwasan/hwasan_type_test.cpp [3:4] - lib/interception/interception.h [3:4] - lib/interception/interception_linux.cpp [3:4] - lib/interception/interception_linux.h [3:4] - lib/interception/interception_mac.cpp [3:4] - lib/interception/interception_mac.h [3:4] - lib/interception/interception_type_test.cpp [3:4] - lib/interception/interception_win.cpp [3:4] - lib/interception/interception_win.h [3:4] - lib/lsan/lsan.cpp [3:4] - lib/lsan/lsan.h [3:4] - lib/lsan/lsan_allocator.cpp [3:4] - lib/lsan/lsan_allocator.h [3:4] - lib/lsan/lsan_common.cpp [3:4] - lib/lsan/lsan_common.h [3:4] - lib/lsan/lsan_common_fuchsia.cpp [3:4] - lib/lsan/lsan_common_linux.cpp [3:4] - lib/lsan/lsan_common_mac.cpp [3:4] - lib/lsan/lsan_flags.inc [3:4] - lib/lsan/lsan_fuchsia.cpp [3:4] - lib/lsan/lsan_fuchsia.h [3:4] - lib/lsan/lsan_interceptors.cpp [3:4] - lib/lsan/lsan_linux.cpp [3:4] - lib/lsan/lsan_mac.cpp [3:4] - lib/lsan/lsan_malloc_mac.cpp [3:4] - lib/lsan/lsan_posix.cpp [3:4] - lib/lsan/lsan_posix.h [3:4] - lib/lsan/lsan_preinit.cpp [3:4] - lib/lsan/lsan_thread.cpp [3:4] - lib/lsan/lsan_thread.h [3:4] - lib/memprof/memprof_allocator.cpp [3:4] - lib/memprof/memprof_allocator.h [3:4] - lib/memprof/memprof_descriptions.cpp [3:4] - lib/memprof/memprof_descriptions.h [3:4] - lib/memprof/memprof_flags.cpp [3:4] - lib/memprof/memprof_flags.h [3:4] - lib/memprof/memprof_flags.inc [3:4] - lib/memprof/memprof_init_version.h [3:4] - lib/memprof/memprof_interceptors.cpp [3:4] - lib/memprof/memprof_interceptors.h [3:4] - lib/memprof/memprof_interceptors_memintrinsics.cpp [3:4] - lib/memprof/memprof_interceptors_memintrinsics.h [3:4] - lib/memprof/memprof_interface_internal.h [3:4] - lib/memprof/memprof_internal.h [3:4] - lib/memprof/memprof_linux.cpp [3:4] - lib/memprof/memprof_malloc_linux.cpp [3:4] - lib/memprof/memprof_mapping.h [3:4] - lib/memprof/memprof_mibmap.cpp [3:4] - lib/memprof/memprof_new_delete.cpp [3:4] - lib/memprof/memprof_posix.cpp [3:4] - lib/memprof/memprof_preinit.cpp [3:4] - lib/memprof/memprof_rtl.cpp [3:4] - lib/memprof/memprof_shadow_setup.cpp [3:4] - lib/memprof/memprof_stack.cpp [3:4] - lib/memprof/memprof_stack.h [3:4] - lib/memprof/memprof_stats.cpp [3:4] - lib/memprof/memprof_stats.h [3:4] - lib/memprof/memprof_thread.cpp [3:4] - lib/memprof/memprof_thread.h [3:4] - lib/msan/msan.cpp [3:4] - lib/msan/msan.h [3:4] - lib/msan/msan_allocator.cpp [3:4] - lib/msan/msan_allocator.h [3:4] - lib/msan/msan_chained_origin_depot.cpp [3:4] - lib/msan/msan_chained_origin_depot.h [3:4] - lib/msan/msan_flags.h [3:4] - lib/msan/msan_flags.inc [3:4] - lib/msan/msan_interceptors.cpp [3:4] - lib/msan/msan_interface_internal.h [3:4] - lib/msan/msan_linux.cpp [3:4] - lib/msan/msan_new_delete.cpp [3:4] - lib/msan/msan_origin.h [3:4] - lib/msan/msan_poisoning.cpp [3:4] - lib/msan/msan_poisoning.h [3:4] - lib/msan/msan_report.cpp [3:4] - lib/msan/msan_report.h [3:4] - lib/msan/msan_thread.h [3:4] - lib/profile/InstrProfilingRuntime.cpp [3:4] - lib/safestack/safestack.cpp [3:4] - lib/safestack/safestack_platform.h [3:4] - lib/safestack/safestack_util.h [3:4] - lib/sanitizer_common/sancov_flags.cpp [3:4] - lib/sanitizer_common/sancov_flags.h [3:4] - lib/sanitizer_common/sancov_flags.inc [3:4] - lib/sanitizer_common/sanitizer_addrhashmap.h [3:4] - lib/sanitizer_common/sanitizer_allocator.cpp [3:4] - lib/sanitizer_common/sanitizer_allocator.h [3:4] - lib/sanitizer_common/sanitizer_allocator_checks.cpp [3:4] - lib/sanitizer_common/sanitizer_allocator_checks.h [3:4] - lib/sanitizer_common/sanitizer_allocator_combined.h [3:4] - lib/sanitizer_common/sanitizer_allocator_dlsym.h [3:4] - lib/sanitizer_common/sanitizer_allocator_interface.h [3:4] - lib/sanitizer_common/sanitizer_allocator_internal.h [3:4] - lib/sanitizer_common/sanitizer_allocator_local_cache.h [3:4] - lib/sanitizer_common/sanitizer_allocator_primary32.h [3:4] - lib/sanitizer_common/sanitizer_allocator_primary64.h [3:4] - lib/sanitizer_common/sanitizer_allocator_report.cpp [3:4] - lib/sanitizer_common/sanitizer_allocator_report.h [3:4] - lib/sanitizer_common/sanitizer_allocator_secondary.h [3:4] - lib/sanitizer_common/sanitizer_allocator_size_class_map.h [3:4] - lib/sanitizer_common/sanitizer_allocator_stats.h [3:4] - lib/sanitizer_common/sanitizer_asm.h [3:4] - lib/sanitizer_common/sanitizer_atomic.h [3:4] - lib/sanitizer_common/sanitizer_atomic_clang.h [3:4] - lib/sanitizer_common/sanitizer_atomic_clang_mips.h [3:4] - lib/sanitizer_common/sanitizer_atomic_clang_other.h [3:4] - lib/sanitizer_common/sanitizer_atomic_clang_x86.h [3:4] - lib/sanitizer_common/sanitizer_atomic_msvc.h [3:4] - lib/sanitizer_common/sanitizer_bitvector.h [3:4] - lib/sanitizer_common/sanitizer_bvgraph.h [3:4] - lib/sanitizer_common/sanitizer_chained_origin_depot.cpp [3:4] - lib/sanitizer_common/sanitizer_chained_origin_depot.h [3:4] - lib/sanitizer_common/sanitizer_common.cpp [3:4] - lib/sanitizer_common/sanitizer_common.h [3:4] - lib/sanitizer_common/sanitizer_common_interceptors.inc [3:4] - lib/sanitizer_common/sanitizer_common_interceptors_format.inc [3:4] - lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc [3:4] - lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc [3:4] - lib/sanitizer_common/sanitizer_common_interface.inc [3:4] - lib/sanitizer_common/sanitizer_common_interface_posix.inc [3:4] - lib/sanitizer_common/sanitizer_common_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_common_syscalls.inc [3:4] - lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp [3:4] - lib/sanitizer_common/sanitizer_coverage_interface.inc [3:4] - lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp [3:4] - lib/sanitizer_common/sanitizer_coverage_win_sections.cpp [3:4] - lib/sanitizer_common/sanitizer_dbghelp.h [3:4] - lib/sanitizer_common/sanitizer_deadlock_detector.h [3:4] - lib/sanitizer_common/sanitizer_deadlock_detector1.cpp [3:4] - lib/sanitizer_common/sanitizer_deadlock_detector2.cpp [3:4] - lib/sanitizer_common/sanitizer_deadlock_detector_interface.h [3:4] - lib/sanitizer_common/sanitizer_dense_map.h [3:4] - lib/sanitizer_common/sanitizer_dense_map_info.h [3:4] - lib/sanitizer_common/sanitizer_errno.cpp [3:4] - lib/sanitizer_common/sanitizer_errno.h [3:4] - lib/sanitizer_common/sanitizer_errno_codes.h [3:4] - lib/sanitizer_common/sanitizer_file.cpp [3:4] - lib/sanitizer_common/sanitizer_file.h [3:4] - lib/sanitizer_common/sanitizer_flag_parser.cpp [3:4] - lib/sanitizer_common/sanitizer_flag_parser.h [3:4] - lib/sanitizer_common/sanitizer_flags.cpp [3:4] - lib/sanitizer_common/sanitizer_flags.h [3:4] - lib/sanitizer_common/sanitizer_flags.inc [3:4] - lib/sanitizer_common/sanitizer_flat_map.h [3:4] - lib/sanitizer_common/sanitizer_freebsd.h [3:4] - lib/sanitizer_common/sanitizer_fuchsia.cpp [3:4] - lib/sanitizer_common/sanitizer_fuchsia.h [3:4] - lib/sanitizer_common/sanitizer_getauxval.h [3:4] - lib/sanitizer_common/sanitizer_glibc_version.h [3:4] - lib/sanitizer_common/sanitizer_hash.h [3:4] - lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc [3:4] - lib/sanitizer_common/sanitizer_interface_internal.h [3:4] - lib/sanitizer_common/sanitizer_internal_defs.h [3:4] - lib/sanitizer_common/sanitizer_leb128.h [3:4] - lib/sanitizer_common/sanitizer_lfstack.h [3:4] - lib/sanitizer_common/sanitizer_libc.cpp [3:4] - lib/sanitizer_common/sanitizer_libc.h [3:4] - lib/sanitizer_common/sanitizer_libignore.cpp [3:4] - lib/sanitizer_common/sanitizer_libignore.h [3:4] - lib/sanitizer_common/sanitizer_linux.cpp [3:4] - lib/sanitizer_common/sanitizer_linux.h [3:4] - lib/sanitizer_common/sanitizer_linux_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_linux_s390.cpp [3:4] - lib/sanitizer_common/sanitizer_list.h [3:4] - lib/sanitizer_common/sanitizer_local_address_space_view.h [3:4] - lib/sanitizer_common/sanitizer_lzw.h [3:4] - lib/sanitizer_common/sanitizer_mac.cpp [3:4] - lib/sanitizer_common/sanitizer_mac.h [3:4] - lib/sanitizer_common/sanitizer_mac_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_malloc_mac.inc [3:4] - lib/sanitizer_common/sanitizer_mutex.cpp [3:4] - lib/sanitizer_common/sanitizer_mutex.h [3:4] - lib/sanitizer_common/sanitizer_netbsd.cpp [3:4] - lib/sanitizer_common/sanitizer_placement_new.h [3:4] - lib/sanitizer_common/sanitizer_platform.h [3:4] - lib/sanitizer_common/sanitizer_platform_interceptors.h [3:4] - lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_freebsd.h [3:4] - lib/sanitizer_common/sanitizer_platform_limits_linux.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_netbsd.h [3:4] - lib/sanitizer_common/sanitizer_platform_limits_posix.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_posix.h [3:4] - lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp [3:4] - lib/sanitizer_common/sanitizer_platform_limits_solaris.h [3:4] - lib/sanitizer_common/sanitizer_posix.cpp [3:4] - lib/sanitizer_common/sanitizer_posix.h [3:4] - lib/sanitizer_common/sanitizer_posix_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_printf.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps.h [3:4] - lib/sanitizer_common/sanitizer_procmaps_bsd.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps_common.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps_fuchsia.cpp [4:5] - lib/sanitizer_common/sanitizer_procmaps_linux.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps_mac.cpp [3:4] - lib/sanitizer_common/sanitizer_procmaps_solaris.cpp [3:4] - lib/sanitizer_common/sanitizer_ptrauth.h [3:4] - lib/sanitizer_common/sanitizer_quarantine.h [3:4] - lib/sanitizer_common/sanitizer_report_decorator.h [3:4] - lib/sanitizer_common/sanitizer_ring_buffer.h [3:4] - lib/sanitizer_common/sanitizer_signal_interceptors.inc [3:4] - lib/sanitizer_common/sanitizer_solaris.cpp [3:4] - lib/sanitizer_common/sanitizer_stack_store.cpp [3:4] - lib/sanitizer_common/sanitizer_stack_store.h [3:4] - lib/sanitizer_common/sanitizer_stackdepot.cpp [3:4] - lib/sanitizer_common/sanitizer_stackdepot.h [3:4] - lib/sanitizer_common/sanitizer_stackdepotbase.h [3:4] - lib/sanitizer_common/sanitizer_stacktrace.cpp [3:4] - lib/sanitizer_common/sanitizer_stacktrace.h [3:4] - lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_stacktrace_printer.cpp [3:4] - lib/sanitizer_common/sanitizer_stacktrace_printer.h [3:4] - lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld.h [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.h [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_stoptheworld_win.cpp [3:4] - lib/sanitizer_common/sanitizer_suppressions.cpp [3:4] - lib/sanitizer_common/sanitizer_suppressions.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_internal.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_mac.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_mac.h [3:4] - lib/sanitizer_common/sanitizer_symbolizer_markup.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_report.cpp [3:4] - lib/sanitizer_common/sanitizer_symbolizer_win.cpp [3:4] - lib/sanitizer_common/sanitizer_syscall_generic.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_arm.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_hexagon.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_riscv64.inc [3:4] - lib/sanitizer_common/sanitizer_syscall_linux_x86_64.inc [3:4] - lib/sanitizer_common/sanitizer_syscalls_netbsd.inc [3:4] - lib/sanitizer_common/sanitizer_termination.cpp [3:4] - lib/sanitizer_common/sanitizer_thread_registry.cpp [3:4] - lib/sanitizer_common/sanitizer_thread_registry.h [3:4] - lib/sanitizer_common/sanitizer_thread_safety.h [3:4] - lib/sanitizer_common/sanitizer_tls_get_addr.cpp [3:4] - lib/sanitizer_common/sanitizer_tls_get_addr.h [3:4] - lib/sanitizer_common/sanitizer_type_traits.cpp [3:4] - lib/sanitizer_common/sanitizer_type_traits.h [3:4] - lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp [3:4] - lib/sanitizer_common/sanitizer_unwind_win.cpp [3:4] - lib/sanitizer_common/sanitizer_vector.h [3:4] - lib/sanitizer_common/sanitizer_win.cpp [3:4] - lib/sanitizer_common/sanitizer_win.h [3:4] - lib/sanitizer_common/sanitizer_win_defs.h [3:4] - lib/sanitizer_common/sanitizer_win_dll_thunk.h [3:4] - lib/sanitizer_common/sanitizer_win_weak_interception.h [3:4] - lib/scudo/scudo_allocator.cpp [3:4] - lib/scudo/scudo_allocator.h [3:4] - lib/scudo/scudo_allocator_combined.h [3:4] - lib/scudo/scudo_allocator_secondary.h [3:4] - lib/scudo/scudo_crc32.cpp [3:4] - lib/scudo/scudo_crc32.h [3:4] - lib/scudo/scudo_errors.cpp [3:4] - lib/scudo/scudo_errors.h [3:4] - lib/scudo/scudo_flags.cpp [3:4] - lib/scudo/scudo_flags.h [3:4] - lib/scudo/scudo_flags.inc [3:4] - lib/scudo/scudo_interface_internal.h [3:4] - lib/scudo/scudo_malloc.cpp [3:4] - lib/scudo/scudo_new_delete.cpp [3:4] - lib/scudo/scudo_platform.h [3:4] - lib/scudo/scudo_termination.cpp [3:4] - lib/scudo/scudo_tsd.h [3:4] - lib/scudo/scudo_tsd_exclusive.cpp [3:4] - lib/scudo/scudo_tsd_exclusive.inc [3:4] - lib/scudo/scudo_tsd_shared.cpp [3:4] - lib/scudo/scudo_tsd_shared.inc [3:4] - lib/scudo/scudo_utils.cpp [3:4] - lib/scudo/scudo_utils.h [3:4] - lib/scudo/standalone/allocator_config.h [3:4] - lib/scudo/standalone/atomic_helpers.h [3:4] - lib/scudo/standalone/bytemap.h [3:4] - lib/scudo/standalone/checksum.cpp [3:4] - lib/scudo/standalone/checksum.h [3:4] - lib/scudo/standalone/chunk.h [3:4] - lib/scudo/standalone/combined.h [3:4] - lib/scudo/standalone/common.cpp [3:4] - lib/scudo/standalone/common.h [3:4] - lib/scudo/standalone/crc32_hw.cpp [3:4] - lib/scudo/standalone/flags.cpp [3:4] - lib/scudo/standalone/flags.h [3:4] - lib/scudo/standalone/flags.inc [3:4] - lib/scudo/standalone/flags_parser.cpp [3:4] - lib/scudo/standalone/flags_parser.h [3:4] - lib/scudo/standalone/fuchsia.cpp [3:4] - lib/scudo/standalone/fuchsia.h [3:4] - lib/scudo/standalone/include/scudo/interface.h [3:4] - lib/scudo/standalone/internal_defs.h [3:4] - lib/scudo/standalone/linux.cpp [3:4] - lib/scudo/standalone/linux.h [3:4] - lib/scudo/standalone/list.h [3:4] - lib/scudo/standalone/local_cache.h [3:4] - lib/scudo/standalone/memtag.h [3:4] - lib/scudo/standalone/mutex.h [3:4] - lib/scudo/standalone/options.h [3:4] - lib/scudo/standalone/platform.h [3:4] - lib/scudo/standalone/primary32.h [3:4] - lib/scudo/standalone/primary64.h [3:4] - lib/scudo/standalone/quarantine.h [3:4] - lib/scudo/standalone/release.cpp [3:4] - lib/scudo/standalone/release.h [3:4] - lib/scudo/standalone/report.cpp [3:4] - lib/scudo/standalone/report.h [3:4] - lib/scudo/standalone/secondary.h [3:4] - lib/scudo/standalone/size_class_map.h [3:4] - lib/scudo/standalone/stack_depot.h [3:4] - lib/scudo/standalone/stats.h [3:4] - lib/scudo/standalone/string_utils.cpp [3:4] - lib/scudo/standalone/string_utils.h [3:4] - lib/scudo/standalone/trusty.h [3:4] - lib/scudo/standalone/tsd.h [3:4] - lib/scudo/standalone/tsd_exclusive.h [3:4] - lib/scudo/standalone/tsd_shared.h [3:4] - lib/scudo/standalone/vector.h [3:4] - lib/scudo/standalone/wrappers_c.cpp [3:4] - lib/scudo/standalone/wrappers_c.h [3:4] - lib/scudo/standalone/wrappers_c.inc [3:4] - lib/scudo/standalone/wrappers_c_checks.h [3:4] - lib/scudo/standalone/wrappers_cpp.cpp [3:4] - lib/stats/stats.cpp [3:4] - lib/stats/stats.h [3:4] - lib/stats/stats_client.cpp [3:4] - lib/tsan/dd/dd_interceptors.cpp [3:4] - lib/tsan/dd/dd_rtl.cpp [3:4] - lib/tsan/dd/dd_rtl.h [3:4] - lib/tsan/rtl/tsan_debugging.cpp [3:4] - lib/tsan/rtl/tsan_defs.h [3:4] - lib/tsan/rtl/tsan_dense_alloc.h [3:4] - lib/tsan/rtl/tsan_external.cpp [3:4] - lib/tsan/rtl/tsan_fd.cpp [3:4] - lib/tsan/rtl/tsan_fd.h [3:4] - lib/tsan/rtl/tsan_flags.cpp [3:4] - lib/tsan/rtl/tsan_flags.h [3:4] - lib/tsan/rtl/tsan_flags.inc [3:4] - lib/tsan/rtl/tsan_ignoreset.cpp [3:4] - lib/tsan/rtl/tsan_ignoreset.h [3:4] - lib/tsan/rtl/tsan_ilist.h [3:4] - lib/tsan/rtl/tsan_interceptors_libdispatch.cpp [3:4] - lib/tsan/rtl/tsan_interceptors_mac.cpp [3:4] - lib/tsan/rtl/tsan_interceptors_mach_vm.cpp [3:4] - lib/tsan/rtl/tsan_interceptors_posix.cpp [3:4] - lib/tsan/rtl/tsan_interface.cpp [3:4] - lib/tsan/rtl/tsan_interface.h [3:4] - lib/tsan/rtl/tsan_interface.inc [3:4] - lib/tsan/rtl/tsan_interface_ann.cpp [3:4] - lib/tsan/rtl/tsan_interface_ann.h [3:4] - lib/tsan/rtl/tsan_interface_atomic.cpp [3:4] - lib/tsan/rtl/tsan_interface_java.cpp [3:4] - lib/tsan/rtl/tsan_interface_java.h [3:4] - lib/tsan/rtl/tsan_malloc_mac.cpp [3:4] - lib/tsan/rtl/tsan_md5.cpp [3:4] - lib/tsan/rtl/tsan_mman.cpp [3:4] - lib/tsan/rtl/tsan_mman.h [3:4] - lib/tsan/rtl/tsan_mutexset.cpp [3:4] - lib/tsan/rtl/tsan_mutexset.h [3:4] - lib/tsan/rtl/tsan_new_delete.cpp [3:4] - lib/tsan/rtl/tsan_platform.h [3:4] - lib/tsan/rtl/tsan_platform_linux.cpp [3:4] - lib/tsan/rtl/tsan_platform_mac.cpp [3:4] - lib/tsan/rtl/tsan_platform_posix.cpp [3:4] - lib/tsan/rtl/tsan_platform_windows.cpp [3:4] - lib/tsan/rtl/tsan_preinit.cpp [3:4] - lib/tsan/rtl/tsan_report.cpp [3:4] - lib/tsan/rtl/tsan_report.h [3:4] - lib/tsan/rtl/tsan_rtl.cpp [3:4] - lib/tsan/rtl/tsan_rtl.h [3:4] - lib/tsan/rtl/tsan_rtl_access.cpp [3:4] - lib/tsan/rtl/tsan_rtl_mutex.cpp [3:4] - lib/tsan/rtl/tsan_rtl_proc.cpp [3:4] - lib/tsan/rtl/tsan_rtl_report.cpp [3:4] - lib/tsan/rtl/tsan_rtl_thread.cpp [3:4] - lib/tsan/rtl/tsan_shadow.h [3:4] - lib/tsan/rtl/tsan_stack_trace.cpp [3:4] - lib/tsan/rtl/tsan_stack_trace.h [3:4] - lib/tsan/rtl/tsan_suppressions.cpp [3:4] - lib/tsan/rtl/tsan_suppressions.h [3:4] - lib/tsan/rtl/tsan_symbolize.cpp [3:4] - lib/tsan/rtl/tsan_symbolize.h [3:4] - lib/tsan/rtl/tsan_sync.cpp [3:4] - lib/tsan/rtl/tsan_sync.h [3:4] - lib/tsan/rtl/tsan_trace.h [3:4] - lib/tsan/rtl/tsan_vector_clock.cpp [3:4] - lib/tsan/rtl/tsan_vector_clock.h [3:4] - lib/ubsan/ubsan_checks.inc [3:4] - lib/ubsan/ubsan_diag.cpp [3:4] - lib/ubsan/ubsan_diag.h [3:4] - lib/ubsan/ubsan_diag_standalone.cpp [3:4] - lib/ubsan/ubsan_flags.cpp [3:4] - lib/ubsan/ubsan_flags.h [3:4] - lib/ubsan/ubsan_flags.inc [3:4] - lib/ubsan/ubsan_handlers.cpp [3:4] - lib/ubsan/ubsan_handlers.h [3:4] - lib/ubsan/ubsan_handlers_cxx.cpp [3:4] - lib/ubsan/ubsan_handlers_cxx.h [3:4] - lib/ubsan/ubsan_init.cpp [3:4] - lib/ubsan/ubsan_init.h [3:4] - lib/ubsan/ubsan_init_standalone.cpp [3:4] - lib/ubsan/ubsan_init_standalone_preinit.cpp [3:4] - lib/ubsan/ubsan_monitor.cpp [3:4] - lib/ubsan/ubsan_monitor.h [3:4] - lib/ubsan/ubsan_platform.h [3:4] - lib/ubsan/ubsan_signals_standalone.cpp [3:4] - lib/ubsan/ubsan_signals_standalone.h [4:5] - lib/ubsan/ubsan_type_hash.cpp [3:4] - lib/ubsan/ubsan_type_hash.h [3:4] - lib/ubsan/ubsan_type_hash_itanium.cpp [3:4] - lib/ubsan/ubsan_type_hash_win.cpp [3:4] - lib/ubsan/ubsan_value.cpp [3:4] - lib/ubsan/ubsan_value.h [3:4] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/memprof-preinit/ya.make lib/memprof_cxx/ya.make lib/msan_cxx/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats_client/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP Apache-2.0 WITH LLVM-exception 8494a9caed330d9a4f40e19cce7dc770 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: LLVM-exception - Score : 100.00 - Match type : TEXT - Links : http://llvm.org/foundation/relicensing/LICENSE.txt, https://spdx.org/licenses/LLVM-exception - Files with this license: - LICENSE.TXT [208:222] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP Apache-2.0 WITH LLVM-exception 8a58f39345a246b9ca05473930feef83 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : TAG - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - include/profile/InstrProfData.inc [5:5] - include/profile/MemProfData.inc [7:7] - lib/profile/GCDAProfiling.c [5:5] - lib/profile/InstrProfiling.c [5:5] - lib/profile/InstrProfiling.h [5:5] - lib/profile/InstrProfilingBuffer.c [5:5] - lib/profile/InstrProfilingFile.c [5:5] - lib/profile/InstrProfilingInternal.c [5:5] - lib/profile/InstrProfilingInternal.h [5:5] - lib/profile/InstrProfilingMerge.c [5:5] - lib/profile/InstrProfilingMergeFile.c [5:5] - lib/profile/InstrProfilingNameVar.c [5:5] - lib/profile/InstrProfilingPlatformDarwin.c [5:5] - lib/profile/InstrProfilingPlatformFuchsia.c [5:5] - lib/profile/InstrProfilingPlatformLinux.c [5:5] - lib/profile/InstrProfilingPlatformOther.c [5:5] - lib/profile/InstrProfilingPlatformWindows.c [5:5] - lib/profile/InstrProfilingPort.h [5:5] - lib/profile/InstrProfilingUtil.c [5:5] - lib/profile/InstrProfilingUtil.h [5:5] - lib/profile/InstrProfilingValue.c [5:5] - lib/profile/InstrProfilingVersionVar.c [5:5] - lib/profile/InstrProfilingWriter.c [5:5] - lib/profile/WindowsMMap.h [5:5] - Scancode info: - Original SPDX id: LLVM-exception - Score : 100.00 - Match type : TAG - Links : http://llvm.org/foundation/relicensing/LICENSE.txt, https://spdx.org/licenses/LLVM-exception - Files with this license: - include/profile/InstrProfData.inc [5:5] - include/profile/MemProfData.inc [7:7] - lib/profile/GCDAProfiling.c [5:5] - lib/profile/InstrProfiling.c [5:5] - lib/profile/InstrProfiling.h [5:5] - lib/profile/InstrProfilingBuffer.c [5:5] - lib/profile/InstrProfilingFile.c [5:5] - lib/profile/InstrProfilingInternal.c [5:5] - lib/profile/InstrProfilingInternal.h [5:5] - lib/profile/InstrProfilingMerge.c [5:5] - lib/profile/InstrProfilingMergeFile.c [5:5] - lib/profile/InstrProfilingNameVar.c [5:5] - lib/profile/InstrProfilingPlatformDarwin.c [5:5] - lib/profile/InstrProfilingPlatformFuchsia.c [5:5] - lib/profile/InstrProfilingPlatformLinux.c [5:5] - lib/profile/InstrProfilingPlatformOther.c [5:5] - lib/profile/InstrProfilingPlatformWindows.c [5:5] - lib/profile/InstrProfilingPort.h [5:5] - lib/profile/InstrProfilingUtil.c [5:5] - lib/profile/InstrProfilingUtil.h [5:5] - lib/profile/InstrProfilingValue.c [5:5] - lib/profile/InstrProfilingVersionVar.c [5:5] - lib/profile/InstrProfilingWriter.c [5:5] - lib/profile/WindowsMMap.h [5:5] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -SKIP LicenseRef-scancode-warranty-disclaimer 9859678dbf968262a249b27e6bf5dfec -BELONGS lib/asan/ya.make - License text: - "(WARNING: USE AT YOUR OWN RISK!)") - Scancode info: - Original SPDX id: LicenseRef-scancode-warranty-disclaimer - Score : 100.00 - Match type : TEXT - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/warranty-disclaimer.LICENSE - Files with this license: - lib/asan/asan_flags.inc [152:152] - -KEEP Apache-2.0 9ac77f65a898755c7eed97099caded94 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : TEXT - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - LICENSE.TXT [5:205] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP NCSA AND MIT acaf5a1ddffd6829f7ebecb9e50c6c5f -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: NCSA - Score : 100.00 - Match type : NOTICE - Links : http://www.otm.illinois.edu/faculty/forms/opensource.asp, https://spdx.org/licenses/NCSA - Files with this license: - LICENSE.TXT [240:245] - Scancode info: - Original SPDX id: MIT - Score : 100.00 - Match type : NOTICE - Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT - Files with this license: - LICENSE.TXT [240:245] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP NCSA b160d8bd561da097b0edd40b062e1c84 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: NCSA - Score : 100.00 - Match type : TEXT - Links : http://www.otm.illinois.edu/faculty/forms/opensource.asp, https://spdx.org/licenses/NCSA - Files with this license: - LICENSE.TXT [264:289] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP Apache-2.0 WITH LLVM-exception b7566a1930e050e1090162bf1d543650 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : TAG - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - include/sanitizer/allocator_interface.h [5:5] - include/sanitizer/asan_interface.h [5:5] - include/sanitizer/common_interface_defs.h [5:5] - include/sanitizer/coverage_interface.h [5:5] - include/sanitizer/dfsan_interface.h [5:5] - include/sanitizer/hwasan_interface.h [5:5] - include/sanitizer/linux_syscall_hooks.h [5:5] - include/sanitizer/lsan_interface.h [5:5] - include/sanitizer/memprof_interface.h [5:5] - include/sanitizer/msan_interface.h [5:5] - include/sanitizer/netbsd_syscall_hooks.h [5:5] - include/sanitizer/scudo_interface.h [5:5] - include/sanitizer/tsan_interface.h [5:5] - include/sanitizer/tsan_interface_atomic.h [5:5] - include/sanitizer/ubsan_interface.h [5:5] - lib/asan/asan_activation.cpp [5:5] - lib/asan/asan_activation.h [5:5] - lib/asan/asan_activation_flags.inc [5:5] - lib/asan/asan_allocator.cpp [5:5] - lib/asan/asan_allocator.h [5:5] - lib/asan/asan_debugging.cpp [5:5] - lib/asan/asan_descriptions.cpp [5:5] - lib/asan/asan_descriptions.h [5:5] - lib/asan/asan_errors.cpp [5:5] - lib/asan/asan_errors.h [5:5] - lib/asan/asan_fake_stack.cpp [5:5] - lib/asan/asan_fake_stack.h [5:5] - lib/asan/asan_flags.cpp [5:5] - lib/asan/asan_flags.h [5:5] - lib/asan/asan_flags.inc [5:5] - lib/asan/asan_fuchsia.cpp [5:5] - lib/asan/asan_globals.cpp [5:5] - lib/asan/asan_globals_win.cpp [5:5] - lib/asan/asan_init_version.h [5:5] - lib/asan/asan_interceptors.cpp [5:5] - lib/asan/asan_interceptors.h [5:5] - lib/asan/asan_interceptors_memintrinsics.cpp [5:5] - lib/asan/asan_interceptors_memintrinsics.h [5:5] - lib/asan/asan_interface_internal.h [5:5] - lib/asan/asan_internal.h [5:5] - lib/asan/asan_linux.cpp [5:5] - lib/asan/asan_mac.cpp [5:5] - lib/asan/asan_malloc_linux.cpp [5:5] - lib/asan/asan_malloc_mac.cpp [5:5] - lib/asan/asan_malloc_win.cpp [5:5] - lib/asan/asan_mapping.h [5:5] - lib/asan/asan_mapping_sparc64.h [5:5] - lib/asan/asan_memory_profile.cpp [5:5] - lib/asan/asan_new_delete.cpp [5:5] - lib/asan/asan_poisoning.cpp [5:5] - lib/asan/asan_poisoning.h [5:5] - lib/asan/asan_posix.cpp [5:5] - lib/asan/asan_preinit.cpp [5:5] - lib/asan/asan_premap_shadow.cpp [5:5] - lib/asan/asan_premap_shadow.h [5:5] - lib/asan/asan_report.cpp [5:5] - lib/asan/asan_report.h [5:5] - lib/asan/asan_rtl.cpp [5:5] - lib/asan/asan_rtl_static.cpp [5:5] - lib/asan/asan_scariness_score.h [5:5] - lib/asan/asan_shadow_setup.cpp [5:5] - lib/asan/asan_stack.cpp [5:5] - lib/asan/asan_stack.h [5:5] - lib/asan/asan_stats.cpp [5:5] - lib/asan/asan_stats.h [5:5] - lib/asan/asan_suppressions.cpp [5:5] - lib/asan/asan_suppressions.h [5:5] - lib/asan/asan_thread.cpp [5:5] - lib/asan/asan_thread.h [5:5] - lib/asan/asan_win.cpp [5:5] - lib/builtins/assembly.h [5:5] - lib/cfi/cfi.cpp [5:5] - lib/dfsan/dfsan.cpp [5:5] - lib/dfsan/dfsan.h [5:5] - lib/dfsan/dfsan_allocator.cpp [5:5] - lib/dfsan/dfsan_allocator.h [5:5] - lib/dfsan/dfsan_chained_origin_depot.cpp [5:5] - lib/dfsan/dfsan_chained_origin_depot.h [5:5] - lib/dfsan/dfsan_custom.cpp [5:5] - lib/dfsan/dfsan_flags.h [5:5] - lib/dfsan/dfsan_flags.inc [5:5] - lib/dfsan/dfsan_interceptors.cpp [5:5] - lib/dfsan/dfsan_new_delete.cpp [5:5] - lib/dfsan/dfsan_origin.h [5:5] - lib/dfsan/dfsan_platform.h [5:5] - lib/dfsan/dfsan_thread.h [5:5] - lib/gwp_asan/common.cpp [5:5] - lib/gwp_asan/common.h [5:5] - lib/gwp_asan/crash_handler.cpp [5:5] - lib/gwp_asan/crash_handler.h [5:5] - lib/gwp_asan/definitions.h [5:5] - lib/gwp_asan/guarded_pool_allocator.cpp [5:5] - lib/gwp_asan/guarded_pool_allocator.h [5:5] - lib/gwp_asan/mutex.h [5:5] - lib/gwp_asan/optional/backtrace.h [5:5] - lib/gwp_asan/optional/backtrace_linux_libc.cpp [5:5] - lib/gwp_asan/optional/options_parser.cpp [5:5] - lib/gwp_asan/optional/options_parser.h [5:5] - lib/gwp_asan/optional/printf.h [5:5] - lib/gwp_asan/optional/segv_handler.h [5:5] - lib/gwp_asan/optional/segv_handler_posix.cpp [5:5] - lib/gwp_asan/options.h [5:5] - lib/gwp_asan/options.inc [5:5] - lib/gwp_asan/platform_specific/common_posix.cpp [5:5] - lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h [5:5] - lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp [5:5] - lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h [5:5] - lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h [5:5] - lib/gwp_asan/platform_specific/mutex_fuchsia.h [5:5] - lib/gwp_asan/platform_specific/mutex_posix.cpp [5:5] - lib/gwp_asan/platform_specific/mutex_posix.h [5:5] - lib/gwp_asan/platform_specific/utilities_posix.cpp [5:5] - lib/gwp_asan/stack_trace_compressor.cpp [5:5] - lib/gwp_asan/stack_trace_compressor.h [5:5] - lib/gwp_asan/utilities.h [5:5] - lib/hwasan/hwasan.cpp [5:5] - lib/hwasan/hwasan.h [5:5] - lib/hwasan/hwasan_allocation_functions.cpp [5:5] - lib/hwasan/hwasan_allocator.cpp [5:5] - lib/hwasan/hwasan_allocator.h [5:5] - lib/hwasan/hwasan_checks.h [5:5] - lib/hwasan/hwasan_dynamic_shadow.cpp [5:5] - lib/hwasan/hwasan_dynamic_shadow.h [5:5] - lib/hwasan/hwasan_exceptions.cpp [5:5] - lib/hwasan/hwasan_flags.h [5:5] - lib/hwasan/hwasan_flags.inc [5:5] - lib/hwasan/hwasan_fuchsia.cpp [5:5] - lib/hwasan/hwasan_globals.cpp [5:5] - lib/hwasan/hwasan_globals.h [5:5] - lib/hwasan/hwasan_interceptors.cpp [5:5] - lib/hwasan/hwasan_interface_internal.h [5:5] - lib/hwasan/hwasan_linux.cpp [5:5] - lib/hwasan/hwasan_malloc_bisect.h [5:5] - lib/hwasan/hwasan_mapping.h [5:5] - lib/hwasan/hwasan_memintrinsics.cpp [5:5] - lib/hwasan/hwasan_new_delete.cpp [5:5] - lib/hwasan/hwasan_poisoning.cpp [5:5] - lib/hwasan/hwasan_poisoning.h [5:5] - lib/hwasan/hwasan_report.cpp [5:5] - lib/hwasan/hwasan_report.h [5:5] - lib/hwasan/hwasan_setjmp_aarch64.S [5:5] - lib/hwasan/hwasan_setjmp_x86_64.S [5:5] - lib/hwasan/hwasan_thread.h [5:5] - lib/hwasan/hwasan_thread_list.h [5:5] - lib/hwasan/hwasan_type_test.cpp [5:5] - lib/interception/interception.h [5:5] - lib/interception/interception_linux.cpp [5:5] - lib/interception/interception_linux.h [5:5] - lib/interception/interception_mac.cpp [5:5] - lib/interception/interception_mac.h [5:5] - lib/interception/interception_type_test.cpp [5:5] - lib/interception/interception_win.cpp [5:5] - lib/interception/interception_win.h [5:5] - lib/lsan/lsan.cpp [5:5] - lib/lsan/lsan.h [5:5] - lib/lsan/lsan_allocator.cpp [5:5] - lib/lsan/lsan_allocator.h [5:5] - lib/lsan/lsan_common.cpp [5:5] - lib/lsan/lsan_common.h [5:5] - lib/lsan/lsan_common_fuchsia.cpp [5:5] - lib/lsan/lsan_common_linux.cpp [5:5] - lib/lsan/lsan_common_mac.cpp [5:5] - lib/lsan/lsan_flags.inc [5:5] - lib/lsan/lsan_fuchsia.cpp [5:5] - lib/lsan/lsan_fuchsia.h [5:5] - lib/lsan/lsan_interceptors.cpp [5:5] - lib/lsan/lsan_linux.cpp [5:5] - lib/lsan/lsan_mac.cpp [5:5] - lib/lsan/lsan_malloc_mac.cpp [5:5] - lib/lsan/lsan_posix.cpp [5:5] - lib/lsan/lsan_posix.h [5:5] - lib/lsan/lsan_preinit.cpp [5:5] - lib/lsan/lsan_thread.cpp [5:5] - lib/lsan/lsan_thread.h [5:5] - lib/memprof/memprof_allocator.cpp [5:5] - lib/memprof/memprof_allocator.h [5:5] - lib/memprof/memprof_descriptions.cpp [5:5] - lib/memprof/memprof_descriptions.h [5:5] - lib/memprof/memprof_flags.cpp [5:5] - lib/memprof/memprof_flags.h [5:5] - lib/memprof/memprof_flags.inc [5:5] - lib/memprof/memprof_init_version.h [5:5] - lib/memprof/memprof_interceptors.cpp [5:5] - lib/memprof/memprof_interceptors.h [5:5] - lib/memprof/memprof_interceptors_memintrinsics.cpp [5:5] - lib/memprof/memprof_interceptors_memintrinsics.h [5:5] - lib/memprof/memprof_interface_internal.h [5:5] - lib/memprof/memprof_internal.h [5:5] - lib/memprof/memprof_linux.cpp [5:5] - lib/memprof/memprof_malloc_linux.cpp [5:5] - lib/memprof/memprof_mapping.h [5:5] - lib/memprof/memprof_mibmap.cpp [5:5] - lib/memprof/memprof_new_delete.cpp [5:5] - lib/memprof/memprof_posix.cpp [5:5] - lib/memprof/memprof_preinit.cpp [5:5] - lib/memprof/memprof_rtl.cpp [5:5] - lib/memprof/memprof_shadow_setup.cpp [5:5] - lib/memprof/memprof_stack.cpp [5:5] - lib/memprof/memprof_stack.h [5:5] - lib/memprof/memprof_stats.cpp [5:5] - lib/memprof/memprof_stats.h [5:5] - lib/memprof/memprof_thread.cpp [5:5] - lib/memprof/memprof_thread.h [5:5] - lib/msan/msan.cpp [5:5] - lib/msan/msan.h [5:5] - lib/msan/msan_allocator.cpp [5:5] - lib/msan/msan_allocator.h [5:5] - lib/msan/msan_chained_origin_depot.cpp [5:5] - lib/msan/msan_chained_origin_depot.h [5:5] - lib/msan/msan_flags.h [5:5] - lib/msan/msan_flags.inc [5:5] - lib/msan/msan_interceptors.cpp [5:5] - lib/msan/msan_interface_internal.h [5:5] - lib/msan/msan_linux.cpp [5:5] - lib/msan/msan_new_delete.cpp [5:5] - lib/msan/msan_origin.h [5:5] - lib/msan/msan_poisoning.cpp [5:5] - lib/msan/msan_poisoning.h [5:5] - lib/msan/msan_report.cpp [5:5] - lib/msan/msan_report.h [5:5] - lib/msan/msan_thread.h [5:5] - lib/profile/InstrProfilingRuntime.cpp [5:5] - lib/safestack/safestack.cpp [5:5] - lib/safestack/safestack_platform.h [5:5] - lib/safestack/safestack_util.h [5:5] - lib/sanitizer_common/sancov_flags.cpp [5:5] - lib/sanitizer_common/sancov_flags.h [5:5] - lib/sanitizer_common/sancov_flags.inc [5:5] - lib/sanitizer_common/sanitizer_addrhashmap.h [5:5] - lib/sanitizer_common/sanitizer_allocator.cpp [5:5] - lib/sanitizer_common/sanitizer_allocator.h [5:5] - lib/sanitizer_common/sanitizer_allocator_checks.cpp [5:5] - lib/sanitizer_common/sanitizer_allocator_checks.h [5:5] - lib/sanitizer_common/sanitizer_allocator_combined.h [5:5] - lib/sanitizer_common/sanitizer_allocator_dlsym.h [5:5] - lib/sanitizer_common/sanitizer_allocator_interface.h [5:5] - lib/sanitizer_common/sanitizer_allocator_internal.h [5:5] - lib/sanitizer_common/sanitizer_allocator_local_cache.h [5:5] - lib/sanitizer_common/sanitizer_allocator_primary32.h [5:5] - lib/sanitizer_common/sanitizer_allocator_primary64.h [5:5] - lib/sanitizer_common/sanitizer_allocator_report.cpp [5:5] - lib/sanitizer_common/sanitizer_allocator_report.h [5:5] - lib/sanitizer_common/sanitizer_allocator_secondary.h [5:5] - lib/sanitizer_common/sanitizer_allocator_size_class_map.h [5:5] - lib/sanitizer_common/sanitizer_allocator_stats.h [5:5] - lib/sanitizer_common/sanitizer_asm.h [5:5] - lib/sanitizer_common/sanitizer_atomic.h [5:5] - lib/sanitizer_common/sanitizer_atomic_clang.h [5:5] - lib/sanitizer_common/sanitizer_atomic_clang_mips.h [5:5] - lib/sanitizer_common/sanitizer_atomic_clang_other.h [5:5] - lib/sanitizer_common/sanitizer_atomic_clang_x86.h [5:5] - lib/sanitizer_common/sanitizer_atomic_msvc.h [5:5] - lib/sanitizer_common/sanitizer_bitvector.h [5:5] - lib/sanitizer_common/sanitizer_bvgraph.h [5:5] - lib/sanitizer_common/sanitizer_chained_origin_depot.cpp [5:5] - lib/sanitizer_common/sanitizer_chained_origin_depot.h [5:5] - lib/sanitizer_common/sanitizer_common.cpp [5:5] - lib/sanitizer_common/sanitizer_common.h [5:5] - lib/sanitizer_common/sanitizer_common_interceptors.inc [5:5] - lib/sanitizer_common/sanitizer_common_interceptors_format.inc [5:5] - lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc [5:5] - lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc [5:5] - lib/sanitizer_common/sanitizer_common_interface.inc [5:5] - lib/sanitizer_common/sanitizer_common_interface_posix.inc [5:5] - lib/sanitizer_common/sanitizer_common_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_common_syscalls.inc [5:5] - lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp [5:5] - lib/sanitizer_common/sanitizer_coverage_interface.inc [5:5] - lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp [5:5] - lib/sanitizer_common/sanitizer_coverage_win_sections.cpp [5:5] - lib/sanitizer_common/sanitizer_dbghelp.h [5:5] - lib/sanitizer_common/sanitizer_deadlock_detector.h [5:5] - lib/sanitizer_common/sanitizer_deadlock_detector1.cpp [5:5] - lib/sanitizer_common/sanitizer_deadlock_detector2.cpp [5:5] - lib/sanitizer_common/sanitizer_deadlock_detector_interface.h [5:5] - lib/sanitizer_common/sanitizer_dense_map.h [5:5] - lib/sanitizer_common/sanitizer_dense_map_info.h [5:5] - lib/sanitizer_common/sanitizer_errno.cpp [5:5] - lib/sanitizer_common/sanitizer_errno.h [5:5] - lib/sanitizer_common/sanitizer_errno_codes.h [5:5] - lib/sanitizer_common/sanitizer_file.cpp [5:5] - lib/sanitizer_common/sanitizer_file.h [5:5] - lib/sanitizer_common/sanitizer_flag_parser.cpp [5:5] - lib/sanitizer_common/sanitizer_flag_parser.h [5:5] - lib/sanitizer_common/sanitizer_flags.cpp [5:5] - lib/sanitizer_common/sanitizer_flags.h [5:5] - lib/sanitizer_common/sanitizer_flags.inc [5:5] - lib/sanitizer_common/sanitizer_flat_map.h [5:5] - lib/sanitizer_common/sanitizer_freebsd.h [5:5] - lib/sanitizer_common/sanitizer_fuchsia.cpp [5:5] - lib/sanitizer_common/sanitizer_fuchsia.h [5:5] - lib/sanitizer_common/sanitizer_getauxval.h [5:5] - lib/sanitizer_common/sanitizer_glibc_version.h [5:5] - lib/sanitizer_common/sanitizer_hash.h [5:5] - lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc [5:5] - lib/sanitizer_common/sanitizer_interface_internal.h [5:5] - lib/sanitizer_common/sanitizer_internal_defs.h [5:5] - lib/sanitizer_common/sanitizer_leb128.h [5:5] - lib/sanitizer_common/sanitizer_lfstack.h [5:5] - lib/sanitizer_common/sanitizer_libc.cpp [5:5] - lib/sanitizer_common/sanitizer_libc.h [5:5] - lib/sanitizer_common/sanitizer_libignore.cpp [5:5] - lib/sanitizer_common/sanitizer_libignore.h [5:5] - lib/sanitizer_common/sanitizer_linux.cpp [5:5] - lib/sanitizer_common/sanitizer_linux.h [5:5] - lib/sanitizer_common/sanitizer_linux_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_linux_s390.cpp [5:5] - lib/sanitizer_common/sanitizer_list.h [5:5] - lib/sanitizer_common/sanitizer_local_address_space_view.h [5:5] - lib/sanitizer_common/sanitizer_lzw.h [5:5] - lib/sanitizer_common/sanitizer_mac.cpp [5:5] - lib/sanitizer_common/sanitizer_mac.h [5:5] - lib/sanitizer_common/sanitizer_mac_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_malloc_mac.inc [5:5] - lib/sanitizer_common/sanitizer_mutex.cpp [5:5] - lib/sanitizer_common/sanitizer_mutex.h [5:5] - lib/sanitizer_common/sanitizer_netbsd.cpp [5:5] - lib/sanitizer_common/sanitizer_placement_new.h [5:5] - lib/sanitizer_common/sanitizer_platform.h [5:5] - lib/sanitizer_common/sanitizer_platform_interceptors.h [5:5] - lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_freebsd.h [5:5] - lib/sanitizer_common/sanitizer_platform_limits_linux.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_netbsd.h [5:5] - lib/sanitizer_common/sanitizer_platform_limits_posix.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_posix.h [5:5] - lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_solaris.h [5:5] - lib/sanitizer_common/sanitizer_posix.cpp [5:5] - lib/sanitizer_common/sanitizer_posix.h [5:5] - lib/sanitizer_common/sanitizer_posix_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_printf.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps.h [5:5] - lib/sanitizer_common/sanitizer_procmaps_bsd.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps_common.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps_fuchsia.cpp [6:6] - lib/sanitizer_common/sanitizer_procmaps_linux.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps_mac.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps_solaris.cpp [5:5] - lib/sanitizer_common/sanitizer_ptrauth.h [5:5] - lib/sanitizer_common/sanitizer_quarantine.h [5:5] - lib/sanitizer_common/sanitizer_report_decorator.h [5:5] - lib/sanitizer_common/sanitizer_ring_buffer.h [5:5] - lib/sanitizer_common/sanitizer_signal_interceptors.inc [5:5] - lib/sanitizer_common/sanitizer_solaris.cpp [5:5] - lib/sanitizer_common/sanitizer_stack_store.cpp [5:5] - lib/sanitizer_common/sanitizer_stack_store.h [5:5] - lib/sanitizer_common/sanitizer_stackdepot.cpp [5:5] - lib/sanitizer_common/sanitizer_stackdepot.h [5:5] - lib/sanitizer_common/sanitizer_stackdepotbase.h [5:5] - lib/sanitizer_common/sanitizer_stacktrace.cpp [5:5] - lib/sanitizer_common/sanitizer_stacktrace.h [5:5] - lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_stacktrace_printer.cpp [5:5] - lib/sanitizer_common/sanitizer_stacktrace_printer.h [5:5] - lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld.h [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.h [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_win.cpp [5:5] - lib/sanitizer_common/sanitizer_suppressions.cpp [5:5] - lib/sanitizer_common/sanitizer_suppressions.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_internal.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_mac.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_mac.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_markup.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_report.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_win.cpp [5:5] - lib/sanitizer_common/sanitizer_syscall_generic.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_arm.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_hexagon.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_riscv64.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_x86_64.inc [5:5] - lib/sanitizer_common/sanitizer_syscalls_netbsd.inc [5:5] - lib/sanitizer_common/sanitizer_termination.cpp [5:5] - lib/sanitizer_common/sanitizer_thread_registry.cpp [5:5] - lib/sanitizer_common/sanitizer_thread_registry.h [5:5] - lib/sanitizer_common/sanitizer_thread_safety.h [5:5] - lib/sanitizer_common/sanitizer_tls_get_addr.cpp [5:5] - lib/sanitizer_common/sanitizer_tls_get_addr.h [5:5] - lib/sanitizer_common/sanitizer_type_traits.cpp [5:5] - lib/sanitizer_common/sanitizer_type_traits.h [5:5] - lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_unwind_win.cpp [5:5] - lib/sanitizer_common/sanitizer_vector.h [5:5] - lib/sanitizer_common/sanitizer_win.cpp [5:5] - lib/sanitizer_common/sanitizer_win.h [5:5] - lib/sanitizer_common/sanitizer_win_defs.h [5:5] - lib/sanitizer_common/sanitizer_win_dll_thunk.h [5:5] - lib/sanitizer_common/sanitizer_win_weak_interception.h [5:5] - lib/scudo/scudo_allocator.cpp [5:5] - lib/scudo/scudo_allocator.h [5:5] - lib/scudo/scudo_allocator_combined.h [5:5] - lib/scudo/scudo_allocator_secondary.h [5:5] - lib/scudo/scudo_crc32.cpp [5:5] - lib/scudo/scudo_crc32.h [5:5] - lib/scudo/scudo_errors.cpp [5:5] - lib/scudo/scudo_errors.h [5:5] - lib/scudo/scudo_flags.cpp [5:5] - lib/scudo/scudo_flags.h [5:5] - lib/scudo/scudo_flags.inc [5:5] - lib/scudo/scudo_interface_internal.h [5:5] - lib/scudo/scudo_malloc.cpp [5:5] - lib/scudo/scudo_new_delete.cpp [5:5] - lib/scudo/scudo_platform.h [5:5] - lib/scudo/scudo_termination.cpp [5:5] - lib/scudo/scudo_tsd.h [5:5] - lib/scudo/scudo_tsd_exclusive.cpp [5:5] - lib/scudo/scudo_tsd_exclusive.inc [5:5] - lib/scudo/scudo_tsd_shared.cpp [5:5] - lib/scudo/scudo_tsd_shared.inc [5:5] - lib/scudo/scudo_utils.cpp [5:5] - lib/scudo/scudo_utils.h [5:5] - lib/scudo/standalone/allocator_config.h [5:5] - lib/scudo/standalone/atomic_helpers.h [5:5] - lib/scudo/standalone/bytemap.h [5:5] - lib/scudo/standalone/checksum.cpp [5:5] - lib/scudo/standalone/checksum.h [5:5] - lib/scudo/standalone/chunk.h [5:5] - lib/scudo/standalone/combined.h [5:5] - lib/scudo/standalone/common.cpp [5:5] - lib/scudo/standalone/common.h [5:5] - lib/scudo/standalone/crc32_hw.cpp [5:5] - lib/scudo/standalone/flags.cpp [5:5] - lib/scudo/standalone/flags.h [5:5] - lib/scudo/standalone/flags.inc [5:5] - lib/scudo/standalone/flags_parser.cpp [5:5] - lib/scudo/standalone/flags_parser.h [5:5] - lib/scudo/standalone/fuchsia.cpp [5:5] - lib/scudo/standalone/fuchsia.h [5:5] - lib/scudo/standalone/include/scudo/interface.h [5:5] - lib/scudo/standalone/internal_defs.h [5:5] - lib/scudo/standalone/linux.cpp [5:5] - lib/scudo/standalone/linux.h [5:5] - lib/scudo/standalone/list.h [5:5] - lib/scudo/standalone/local_cache.h [5:5] - lib/scudo/standalone/memtag.h [5:5] - lib/scudo/standalone/mutex.h [5:5] - lib/scudo/standalone/options.h [5:5] - lib/scudo/standalone/platform.h [5:5] - lib/scudo/standalone/primary32.h [5:5] - lib/scudo/standalone/primary64.h [5:5] - lib/scudo/standalone/quarantine.h [5:5] - lib/scudo/standalone/release.cpp [5:5] - lib/scudo/standalone/release.h [5:5] - lib/scudo/standalone/report.cpp [5:5] - lib/scudo/standalone/report.h [5:5] - lib/scudo/standalone/secondary.h [5:5] - lib/scudo/standalone/size_class_map.h [5:5] - lib/scudo/standalone/stack_depot.h [5:5] - lib/scudo/standalone/stats.h [5:5] - lib/scudo/standalone/string_utils.cpp [5:5] - lib/scudo/standalone/string_utils.h [5:5] - lib/scudo/standalone/trusty.h [5:5] - lib/scudo/standalone/tsd.h [5:5] - lib/scudo/standalone/tsd_exclusive.h [5:5] - lib/scudo/standalone/tsd_shared.h [5:5] - lib/scudo/standalone/vector.h [5:5] - lib/scudo/standalone/wrappers_c.cpp [5:5] - lib/scudo/standalone/wrappers_c.h [5:5] - lib/scudo/standalone/wrappers_c.inc [5:5] - lib/scudo/standalone/wrappers_c_checks.h [5:5] - lib/scudo/standalone/wrappers_cpp.cpp [5:5] - lib/stats/stats.cpp [5:5] - lib/stats/stats.h [5:5] - lib/stats/stats_client.cpp [5:5] - lib/tsan/dd/dd_interceptors.cpp [5:5] - lib/tsan/dd/dd_rtl.cpp [5:5] - lib/tsan/dd/dd_rtl.h [5:5] - lib/tsan/rtl/tsan_debugging.cpp [5:5] - lib/tsan/rtl/tsan_defs.h [5:5] - lib/tsan/rtl/tsan_dense_alloc.h [5:5] - lib/tsan/rtl/tsan_external.cpp [5:5] - lib/tsan/rtl/tsan_fd.cpp [5:5] - lib/tsan/rtl/tsan_fd.h [5:5] - lib/tsan/rtl/tsan_flags.cpp [5:5] - lib/tsan/rtl/tsan_flags.h [5:5] - lib/tsan/rtl/tsan_flags.inc [5:5] - lib/tsan/rtl/tsan_ignoreset.cpp [5:5] - lib/tsan/rtl/tsan_ignoreset.h [5:5] - lib/tsan/rtl/tsan_ilist.h [5:5] - lib/tsan/rtl/tsan_interceptors_libdispatch.cpp [5:5] - lib/tsan/rtl/tsan_interceptors_mac.cpp [5:5] - lib/tsan/rtl/tsan_interceptors_mach_vm.cpp [5:5] - lib/tsan/rtl/tsan_interceptors_posix.cpp [5:5] - lib/tsan/rtl/tsan_interface.cpp [5:5] - lib/tsan/rtl/tsan_interface.h [5:5] - lib/tsan/rtl/tsan_interface.inc [5:5] - lib/tsan/rtl/tsan_interface_ann.cpp [5:5] - lib/tsan/rtl/tsan_interface_ann.h [5:5] - lib/tsan/rtl/tsan_interface_atomic.cpp [5:5] - lib/tsan/rtl/tsan_interface_java.cpp [5:5] - lib/tsan/rtl/tsan_interface_java.h [5:5] - lib/tsan/rtl/tsan_malloc_mac.cpp [5:5] - lib/tsan/rtl/tsan_md5.cpp [5:5] - lib/tsan/rtl/tsan_mman.cpp [5:5] - lib/tsan/rtl/tsan_mman.h [5:5] - lib/tsan/rtl/tsan_mutexset.cpp [5:5] - lib/tsan/rtl/tsan_mutexset.h [5:5] - lib/tsan/rtl/tsan_new_delete.cpp [5:5] - lib/tsan/rtl/tsan_platform.h [5:5] - lib/tsan/rtl/tsan_platform_linux.cpp [5:5] - lib/tsan/rtl/tsan_platform_mac.cpp [5:5] - lib/tsan/rtl/tsan_platform_posix.cpp [5:5] - lib/tsan/rtl/tsan_platform_windows.cpp [5:5] - lib/tsan/rtl/tsan_preinit.cpp [5:5] - lib/tsan/rtl/tsan_report.cpp [5:5] - lib/tsan/rtl/tsan_report.h [5:5] - lib/tsan/rtl/tsan_rtl.cpp [5:5] - lib/tsan/rtl/tsan_rtl.h [5:5] - lib/tsan/rtl/tsan_rtl_access.cpp [5:5] - lib/tsan/rtl/tsan_rtl_mutex.cpp [5:5] - lib/tsan/rtl/tsan_rtl_proc.cpp [5:5] - lib/tsan/rtl/tsan_rtl_report.cpp [5:5] - lib/tsan/rtl/tsan_rtl_thread.cpp [5:5] - lib/tsan/rtl/tsan_shadow.h [5:5] - lib/tsan/rtl/tsan_stack_trace.cpp [5:5] - lib/tsan/rtl/tsan_stack_trace.h [5:5] - lib/tsan/rtl/tsan_suppressions.cpp [5:5] - lib/tsan/rtl/tsan_suppressions.h [5:5] - lib/tsan/rtl/tsan_symbolize.cpp [5:5] - lib/tsan/rtl/tsan_symbolize.h [5:5] - lib/tsan/rtl/tsan_sync.cpp [5:5] - lib/tsan/rtl/tsan_sync.h [5:5] - lib/tsan/rtl/tsan_trace.h [5:5] - lib/tsan/rtl/tsan_vector_clock.cpp [5:5] - lib/tsan/rtl/tsan_vector_clock.h [5:5] - lib/ubsan/ubsan_checks.inc [5:5] - lib/ubsan/ubsan_diag.cpp [5:5] - lib/ubsan/ubsan_diag.h [5:5] - lib/ubsan/ubsan_diag_standalone.cpp [5:5] - lib/ubsan/ubsan_flags.cpp [5:5] - lib/ubsan/ubsan_flags.h [5:5] - lib/ubsan/ubsan_flags.inc [5:5] - lib/ubsan/ubsan_handlers.cpp [5:5] - lib/ubsan/ubsan_handlers.h [5:5] - lib/ubsan/ubsan_handlers_cxx.cpp [5:5] - lib/ubsan/ubsan_handlers_cxx.h [5:5] - lib/ubsan/ubsan_init.cpp [5:5] - lib/ubsan/ubsan_init.h [5:5] - lib/ubsan/ubsan_init_standalone.cpp [5:5] - lib/ubsan/ubsan_init_standalone_preinit.cpp [5:5] - lib/ubsan/ubsan_monitor.cpp [5:5] - lib/ubsan/ubsan_monitor.h [5:5] - lib/ubsan/ubsan_platform.h [5:5] - lib/ubsan/ubsan_signals_standalone.cpp [5:5] - lib/ubsan/ubsan_signals_standalone.h [6:6] - lib/ubsan/ubsan_type_hash.cpp [5:5] - lib/ubsan/ubsan_type_hash.h [5:5] - lib/ubsan/ubsan_type_hash_itanium.cpp [5:5] - lib/ubsan/ubsan_type_hash_win.cpp [5:5] - lib/ubsan/ubsan_value.cpp [5:5] - lib/ubsan/ubsan_value.h [5:5] - Scancode info: - Original SPDX id: LLVM-exception - Score : 100.00 - Match type : TAG - Links : http://llvm.org/foundation/relicensing/LICENSE.txt, https://spdx.org/licenses/LLVM-exception - Files with this license: - include/sanitizer/allocator_interface.h [5:5] - include/sanitizer/asan_interface.h [5:5] - include/sanitizer/common_interface_defs.h [5:5] - include/sanitizer/coverage_interface.h [5:5] - include/sanitizer/dfsan_interface.h [5:5] - include/sanitizer/hwasan_interface.h [5:5] - include/sanitizer/linux_syscall_hooks.h [5:5] - include/sanitizer/lsan_interface.h [5:5] - include/sanitizer/memprof_interface.h [5:5] - include/sanitizer/msan_interface.h [5:5] - include/sanitizer/netbsd_syscall_hooks.h [5:5] - include/sanitizer/scudo_interface.h [5:5] - include/sanitizer/tsan_interface.h [5:5] - include/sanitizer/tsan_interface_atomic.h [5:5] - include/sanitizer/ubsan_interface.h [5:5] - lib/asan/asan_activation.cpp [5:5] - lib/asan/asan_activation.h [5:5] - lib/asan/asan_activation_flags.inc [5:5] - lib/asan/asan_allocator.cpp [5:5] - lib/asan/asan_allocator.h [5:5] - lib/asan/asan_debugging.cpp [5:5] - lib/asan/asan_descriptions.cpp [5:5] - lib/asan/asan_descriptions.h [5:5] - lib/asan/asan_errors.cpp [5:5] - lib/asan/asan_errors.h [5:5] - lib/asan/asan_fake_stack.cpp [5:5] - lib/asan/asan_fake_stack.h [5:5] - lib/asan/asan_flags.cpp [5:5] - lib/asan/asan_flags.h [5:5] - lib/asan/asan_flags.inc [5:5] - lib/asan/asan_fuchsia.cpp [5:5] - lib/asan/asan_globals.cpp [5:5] - lib/asan/asan_globals_win.cpp [5:5] - lib/asan/asan_init_version.h [5:5] - lib/asan/asan_interceptors.cpp [5:5] - lib/asan/asan_interceptors.h [5:5] - lib/asan/asan_interceptors_memintrinsics.cpp [5:5] - lib/asan/asan_interceptors_memintrinsics.h [5:5] - lib/asan/asan_interface_internal.h [5:5] - lib/asan/asan_internal.h [5:5] - lib/asan/asan_linux.cpp [5:5] - lib/asan/asan_mac.cpp [5:5] - lib/asan/asan_malloc_linux.cpp [5:5] - lib/asan/asan_malloc_mac.cpp [5:5] - lib/asan/asan_malloc_win.cpp [5:5] - lib/asan/asan_mapping.h [5:5] - lib/asan/asan_mapping_sparc64.h [5:5] - lib/asan/asan_memory_profile.cpp [5:5] - lib/asan/asan_new_delete.cpp [5:5] - lib/asan/asan_poisoning.cpp [5:5] - lib/asan/asan_poisoning.h [5:5] - lib/asan/asan_posix.cpp [5:5] - lib/asan/asan_preinit.cpp [5:5] - lib/asan/asan_premap_shadow.cpp [5:5] - lib/asan/asan_premap_shadow.h [5:5] - lib/asan/asan_report.cpp [5:5] - lib/asan/asan_report.h [5:5] - lib/asan/asan_rtl.cpp [5:5] - lib/asan/asan_rtl_static.cpp [5:5] - lib/asan/asan_scariness_score.h [5:5] - lib/asan/asan_shadow_setup.cpp [5:5] - lib/asan/asan_stack.cpp [5:5] - lib/asan/asan_stack.h [5:5] - lib/asan/asan_stats.cpp [5:5] - lib/asan/asan_stats.h [5:5] - lib/asan/asan_suppressions.cpp [5:5] - lib/asan/asan_suppressions.h [5:5] - lib/asan/asan_thread.cpp [5:5] - lib/asan/asan_thread.h [5:5] - lib/asan/asan_win.cpp [5:5] - lib/builtins/assembly.h [5:5] - lib/cfi/cfi.cpp [5:5] - lib/dfsan/dfsan.cpp [5:5] - lib/dfsan/dfsan.h [5:5] - lib/dfsan/dfsan_allocator.cpp [5:5] - lib/dfsan/dfsan_allocator.h [5:5] - lib/dfsan/dfsan_chained_origin_depot.cpp [5:5] - lib/dfsan/dfsan_chained_origin_depot.h [5:5] - lib/dfsan/dfsan_custom.cpp [5:5] - lib/dfsan/dfsan_flags.h [5:5] - lib/dfsan/dfsan_flags.inc [5:5] - lib/dfsan/dfsan_interceptors.cpp [5:5] - lib/dfsan/dfsan_new_delete.cpp [5:5] - lib/dfsan/dfsan_origin.h [5:5] - lib/dfsan/dfsan_platform.h [5:5] - lib/dfsan/dfsan_thread.h [5:5] - lib/gwp_asan/common.cpp [5:5] - lib/gwp_asan/common.h [5:5] - lib/gwp_asan/crash_handler.cpp [5:5] - lib/gwp_asan/crash_handler.h [5:5] - lib/gwp_asan/definitions.h [5:5] - lib/gwp_asan/guarded_pool_allocator.cpp [5:5] - lib/gwp_asan/guarded_pool_allocator.h [5:5] - lib/gwp_asan/mutex.h [5:5] - lib/gwp_asan/optional/backtrace.h [5:5] - lib/gwp_asan/optional/backtrace_linux_libc.cpp [5:5] - lib/gwp_asan/optional/options_parser.cpp [5:5] - lib/gwp_asan/optional/options_parser.h [5:5] - lib/gwp_asan/optional/printf.h [5:5] - lib/gwp_asan/optional/segv_handler.h [5:5] - lib/gwp_asan/optional/segv_handler_posix.cpp [5:5] - lib/gwp_asan/options.h [5:5] - lib/gwp_asan/options.inc [5:5] - lib/gwp_asan/platform_specific/common_posix.cpp [5:5] - lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h [5:5] - lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp [5:5] - lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h [5:5] - lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h [5:5] - lib/gwp_asan/platform_specific/mutex_fuchsia.h [5:5] - lib/gwp_asan/platform_specific/mutex_posix.cpp [5:5] - lib/gwp_asan/platform_specific/mutex_posix.h [5:5] - lib/gwp_asan/platform_specific/utilities_posix.cpp [5:5] - lib/gwp_asan/stack_trace_compressor.cpp [5:5] - lib/gwp_asan/stack_trace_compressor.h [5:5] - lib/gwp_asan/utilities.h [5:5] - lib/hwasan/hwasan.cpp [5:5] - lib/hwasan/hwasan.h [5:5] - lib/hwasan/hwasan_allocation_functions.cpp [5:5] - lib/hwasan/hwasan_allocator.cpp [5:5] - lib/hwasan/hwasan_allocator.h [5:5] - lib/hwasan/hwasan_checks.h [5:5] - lib/hwasan/hwasan_dynamic_shadow.cpp [5:5] - lib/hwasan/hwasan_dynamic_shadow.h [5:5] - lib/hwasan/hwasan_exceptions.cpp [5:5] - lib/hwasan/hwasan_flags.h [5:5] - lib/hwasan/hwasan_flags.inc [5:5] - lib/hwasan/hwasan_fuchsia.cpp [5:5] - lib/hwasan/hwasan_globals.cpp [5:5] - lib/hwasan/hwasan_globals.h [5:5] - lib/hwasan/hwasan_interceptors.cpp [5:5] - lib/hwasan/hwasan_interface_internal.h [5:5] - lib/hwasan/hwasan_linux.cpp [5:5] - lib/hwasan/hwasan_malloc_bisect.h [5:5] - lib/hwasan/hwasan_mapping.h [5:5] - lib/hwasan/hwasan_memintrinsics.cpp [5:5] - lib/hwasan/hwasan_new_delete.cpp [5:5] - lib/hwasan/hwasan_poisoning.cpp [5:5] - lib/hwasan/hwasan_poisoning.h [5:5] - lib/hwasan/hwasan_report.cpp [5:5] - lib/hwasan/hwasan_report.h [5:5] - lib/hwasan/hwasan_setjmp_aarch64.S [5:5] - lib/hwasan/hwasan_setjmp_x86_64.S [5:5] - lib/hwasan/hwasan_thread.h [5:5] - lib/hwasan/hwasan_thread_list.h [5:5] - lib/hwasan/hwasan_type_test.cpp [5:5] - lib/interception/interception.h [5:5] - lib/interception/interception_linux.cpp [5:5] - lib/interception/interception_linux.h [5:5] - lib/interception/interception_mac.cpp [5:5] - lib/interception/interception_mac.h [5:5] - lib/interception/interception_type_test.cpp [5:5] - lib/interception/interception_win.cpp [5:5] - lib/interception/interception_win.h [5:5] - lib/lsan/lsan.cpp [5:5] - lib/lsan/lsan.h [5:5] - lib/lsan/lsan_allocator.cpp [5:5] - lib/lsan/lsan_allocator.h [5:5] - lib/lsan/lsan_common.cpp [5:5] - lib/lsan/lsan_common.h [5:5] - lib/lsan/lsan_common_fuchsia.cpp [5:5] - lib/lsan/lsan_common_linux.cpp [5:5] - lib/lsan/lsan_common_mac.cpp [5:5] - lib/lsan/lsan_flags.inc [5:5] - lib/lsan/lsan_fuchsia.cpp [5:5] - lib/lsan/lsan_fuchsia.h [5:5] - lib/lsan/lsan_interceptors.cpp [5:5] - lib/lsan/lsan_linux.cpp [5:5] - lib/lsan/lsan_mac.cpp [5:5] - lib/lsan/lsan_malloc_mac.cpp [5:5] - lib/lsan/lsan_posix.cpp [5:5] - lib/lsan/lsan_posix.h [5:5] - lib/lsan/lsan_preinit.cpp [5:5] - lib/lsan/lsan_thread.cpp [5:5] - lib/lsan/lsan_thread.h [5:5] - lib/memprof/memprof_allocator.cpp [5:5] - lib/memprof/memprof_allocator.h [5:5] - lib/memprof/memprof_descriptions.cpp [5:5] - lib/memprof/memprof_descriptions.h [5:5] - lib/memprof/memprof_flags.cpp [5:5] - lib/memprof/memprof_flags.h [5:5] - lib/memprof/memprof_flags.inc [5:5] - lib/memprof/memprof_init_version.h [5:5] - lib/memprof/memprof_interceptors.cpp [5:5] - lib/memprof/memprof_interceptors.h [5:5] - lib/memprof/memprof_interceptors_memintrinsics.cpp [5:5] - lib/memprof/memprof_interceptors_memintrinsics.h [5:5] - lib/memprof/memprof_interface_internal.h [5:5] - lib/memprof/memprof_internal.h [5:5] - lib/memprof/memprof_linux.cpp [5:5] - lib/memprof/memprof_malloc_linux.cpp [5:5] - lib/memprof/memprof_mapping.h [5:5] - lib/memprof/memprof_mibmap.cpp [5:5] - lib/memprof/memprof_new_delete.cpp [5:5] - lib/memprof/memprof_posix.cpp [5:5] - lib/memprof/memprof_preinit.cpp [5:5] - lib/memprof/memprof_rtl.cpp [5:5] - lib/memprof/memprof_shadow_setup.cpp [5:5] - lib/memprof/memprof_stack.cpp [5:5] - lib/memprof/memprof_stack.h [5:5] - lib/memprof/memprof_stats.cpp [5:5] - lib/memprof/memprof_stats.h [5:5] - lib/memprof/memprof_thread.cpp [5:5] - lib/memprof/memprof_thread.h [5:5] - lib/msan/msan.cpp [5:5] - lib/msan/msan.h [5:5] - lib/msan/msan_allocator.cpp [5:5] - lib/msan/msan_allocator.h [5:5] - lib/msan/msan_chained_origin_depot.cpp [5:5] - lib/msan/msan_chained_origin_depot.h [5:5] - lib/msan/msan_flags.h [5:5] - lib/msan/msan_flags.inc [5:5] - lib/msan/msan_interceptors.cpp [5:5] - lib/msan/msan_interface_internal.h [5:5] - lib/msan/msan_linux.cpp [5:5] - lib/msan/msan_new_delete.cpp [5:5] - lib/msan/msan_origin.h [5:5] - lib/msan/msan_poisoning.cpp [5:5] - lib/msan/msan_poisoning.h [5:5] - lib/msan/msan_report.cpp [5:5] - lib/msan/msan_report.h [5:5] - lib/msan/msan_thread.h [5:5] - lib/profile/InstrProfilingRuntime.cpp [5:5] - lib/safestack/safestack.cpp [5:5] - lib/safestack/safestack_platform.h [5:5] - lib/safestack/safestack_util.h [5:5] - lib/sanitizer_common/sancov_flags.cpp [5:5] - lib/sanitizer_common/sancov_flags.h [5:5] - lib/sanitizer_common/sancov_flags.inc [5:5] - lib/sanitizer_common/sanitizer_addrhashmap.h [5:5] - lib/sanitizer_common/sanitizer_allocator.cpp [5:5] - lib/sanitizer_common/sanitizer_allocator.h [5:5] - lib/sanitizer_common/sanitizer_allocator_checks.cpp [5:5] - lib/sanitizer_common/sanitizer_allocator_checks.h [5:5] - lib/sanitizer_common/sanitizer_allocator_combined.h [5:5] - lib/sanitizer_common/sanitizer_allocator_dlsym.h [5:5] - lib/sanitizer_common/sanitizer_allocator_interface.h [5:5] - lib/sanitizer_common/sanitizer_allocator_internal.h [5:5] - lib/sanitizer_common/sanitizer_allocator_local_cache.h [5:5] - lib/sanitizer_common/sanitizer_allocator_primary32.h [5:5] - lib/sanitizer_common/sanitizer_allocator_primary64.h [5:5] - lib/sanitizer_common/sanitizer_allocator_report.cpp [5:5] - lib/sanitizer_common/sanitizer_allocator_report.h [5:5] - lib/sanitizer_common/sanitizer_allocator_secondary.h [5:5] - lib/sanitizer_common/sanitizer_allocator_size_class_map.h [5:5] - lib/sanitizer_common/sanitizer_allocator_stats.h [5:5] - lib/sanitizer_common/sanitizer_asm.h [5:5] - lib/sanitizer_common/sanitizer_atomic.h [5:5] - lib/sanitizer_common/sanitizer_atomic_clang.h [5:5] - lib/sanitizer_common/sanitizer_atomic_clang_mips.h [5:5] - lib/sanitizer_common/sanitizer_atomic_clang_other.h [5:5] - lib/sanitizer_common/sanitizer_atomic_clang_x86.h [5:5] - lib/sanitizer_common/sanitizer_atomic_msvc.h [5:5] - lib/sanitizer_common/sanitizer_bitvector.h [5:5] - lib/sanitizer_common/sanitizer_bvgraph.h [5:5] - lib/sanitizer_common/sanitizer_chained_origin_depot.cpp [5:5] - lib/sanitizer_common/sanitizer_chained_origin_depot.h [5:5] - lib/sanitizer_common/sanitizer_common.cpp [5:5] - lib/sanitizer_common/sanitizer_common.h [5:5] - lib/sanitizer_common/sanitizer_common_interceptors.inc [5:5] - lib/sanitizer_common/sanitizer_common_interceptors_format.inc [5:5] - lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc [5:5] - lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc [5:5] - lib/sanitizer_common/sanitizer_common_interface.inc [5:5] - lib/sanitizer_common/sanitizer_common_interface_posix.inc [5:5] - lib/sanitizer_common/sanitizer_common_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_common_syscalls.inc [5:5] - lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp [5:5] - lib/sanitizer_common/sanitizer_coverage_interface.inc [5:5] - lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp [5:5] - lib/sanitizer_common/sanitizer_coverage_win_sections.cpp [5:5] - lib/sanitizer_common/sanitizer_dbghelp.h [5:5] - lib/sanitizer_common/sanitizer_deadlock_detector.h [5:5] - lib/sanitizer_common/sanitizer_deadlock_detector1.cpp [5:5] - lib/sanitizer_common/sanitizer_deadlock_detector2.cpp [5:5] - lib/sanitizer_common/sanitizer_deadlock_detector_interface.h [5:5] - lib/sanitizer_common/sanitizer_dense_map.h [5:5] - lib/sanitizer_common/sanitizer_dense_map_info.h [5:5] - lib/sanitizer_common/sanitizer_errno.cpp [5:5] - lib/sanitizer_common/sanitizer_errno.h [5:5] - lib/sanitizer_common/sanitizer_errno_codes.h [5:5] - lib/sanitizer_common/sanitizer_file.cpp [5:5] - lib/sanitizer_common/sanitizer_file.h [5:5] - lib/sanitizer_common/sanitizer_flag_parser.cpp [5:5] - lib/sanitizer_common/sanitizer_flag_parser.h [5:5] - lib/sanitizer_common/sanitizer_flags.cpp [5:5] - lib/sanitizer_common/sanitizer_flags.h [5:5] - lib/sanitizer_common/sanitizer_flags.inc [5:5] - lib/sanitizer_common/sanitizer_flat_map.h [5:5] - lib/sanitizer_common/sanitizer_freebsd.h [5:5] - lib/sanitizer_common/sanitizer_fuchsia.cpp [5:5] - lib/sanitizer_common/sanitizer_fuchsia.h [5:5] - lib/sanitizer_common/sanitizer_getauxval.h [5:5] - lib/sanitizer_common/sanitizer_glibc_version.h [5:5] - lib/sanitizer_common/sanitizer_hash.h [5:5] - lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc [5:5] - lib/sanitizer_common/sanitizer_interface_internal.h [5:5] - lib/sanitizer_common/sanitizer_internal_defs.h [5:5] - lib/sanitizer_common/sanitizer_leb128.h [5:5] - lib/sanitizer_common/sanitizer_lfstack.h [5:5] - lib/sanitizer_common/sanitizer_libc.cpp [5:5] - lib/sanitizer_common/sanitizer_libc.h [5:5] - lib/sanitizer_common/sanitizer_libignore.cpp [5:5] - lib/sanitizer_common/sanitizer_libignore.h [5:5] - lib/sanitizer_common/sanitizer_linux.cpp [5:5] - lib/sanitizer_common/sanitizer_linux.h [5:5] - lib/sanitizer_common/sanitizer_linux_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_linux_s390.cpp [5:5] - lib/sanitizer_common/sanitizer_list.h [5:5] - lib/sanitizer_common/sanitizer_local_address_space_view.h [5:5] - lib/sanitizer_common/sanitizer_lzw.h [5:5] - lib/sanitizer_common/sanitizer_mac.cpp [5:5] - lib/sanitizer_common/sanitizer_mac.h [5:5] - lib/sanitizer_common/sanitizer_mac_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_malloc_mac.inc [5:5] - lib/sanitizer_common/sanitizer_mutex.cpp [5:5] - lib/sanitizer_common/sanitizer_mutex.h [5:5] - lib/sanitizer_common/sanitizer_netbsd.cpp [5:5] - lib/sanitizer_common/sanitizer_placement_new.h [5:5] - lib/sanitizer_common/sanitizer_platform.h [5:5] - lib/sanitizer_common/sanitizer_platform_interceptors.h [5:5] - lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_freebsd.h [5:5] - lib/sanitizer_common/sanitizer_platform_limits_linux.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_netbsd.h [5:5] - lib/sanitizer_common/sanitizer_platform_limits_posix.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_posix.h [5:5] - lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp [5:5] - lib/sanitizer_common/sanitizer_platform_limits_solaris.h [5:5] - lib/sanitizer_common/sanitizer_posix.cpp [5:5] - lib/sanitizer_common/sanitizer_posix.h [5:5] - lib/sanitizer_common/sanitizer_posix_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_printf.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps.h [5:5] - lib/sanitizer_common/sanitizer_procmaps_bsd.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps_common.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps_fuchsia.cpp [6:6] - lib/sanitizer_common/sanitizer_procmaps_linux.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps_mac.cpp [5:5] - lib/sanitizer_common/sanitizer_procmaps_solaris.cpp [5:5] - lib/sanitizer_common/sanitizer_ptrauth.h [5:5] - lib/sanitizer_common/sanitizer_quarantine.h [5:5] - lib/sanitizer_common/sanitizer_report_decorator.h [5:5] - lib/sanitizer_common/sanitizer_ring_buffer.h [5:5] - lib/sanitizer_common/sanitizer_signal_interceptors.inc [5:5] - lib/sanitizer_common/sanitizer_solaris.cpp [5:5] - lib/sanitizer_common/sanitizer_stack_store.cpp [5:5] - lib/sanitizer_common/sanitizer_stack_store.h [5:5] - lib/sanitizer_common/sanitizer_stackdepot.cpp [5:5] - lib/sanitizer_common/sanitizer_stackdepot.h [5:5] - lib/sanitizer_common/sanitizer_stackdepotbase.h [5:5] - lib/sanitizer_common/sanitizer_stacktrace.cpp [5:5] - lib/sanitizer_common/sanitizer_stacktrace.h [5:5] - lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_stacktrace_printer.cpp [5:5] - lib/sanitizer_common/sanitizer_stacktrace_printer.h [5:5] - lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld.h [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.h [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_stoptheworld_win.cpp [5:5] - lib/sanitizer_common/sanitizer_suppressions.cpp [5:5] - lib/sanitizer_common/sanitizer_suppressions.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_internal.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_mac.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_mac.h [5:5] - lib/sanitizer_common/sanitizer_symbolizer_markup.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_report.cpp [5:5] - lib/sanitizer_common/sanitizer_symbolizer_win.cpp [5:5] - lib/sanitizer_common/sanitizer_syscall_generic.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_arm.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_hexagon.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_riscv64.inc [5:5] - lib/sanitizer_common/sanitizer_syscall_linux_x86_64.inc [5:5] - lib/sanitizer_common/sanitizer_syscalls_netbsd.inc [5:5] - lib/sanitizer_common/sanitizer_termination.cpp [5:5] - lib/sanitizer_common/sanitizer_thread_registry.cpp [5:5] - lib/sanitizer_common/sanitizer_thread_registry.h [5:5] - lib/sanitizer_common/sanitizer_thread_safety.h [5:5] - lib/sanitizer_common/sanitizer_tls_get_addr.cpp [5:5] - lib/sanitizer_common/sanitizer_tls_get_addr.h [5:5] - lib/sanitizer_common/sanitizer_type_traits.cpp [5:5] - lib/sanitizer_common/sanitizer_type_traits.h [5:5] - lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp [5:5] - lib/sanitizer_common/sanitizer_unwind_win.cpp [5:5] - lib/sanitizer_common/sanitizer_vector.h [5:5] - lib/sanitizer_common/sanitizer_win.cpp [5:5] - lib/sanitizer_common/sanitizer_win.h [5:5] - lib/sanitizer_common/sanitizer_win_defs.h [5:5] - lib/sanitizer_common/sanitizer_win_dll_thunk.h [5:5] - lib/sanitizer_common/sanitizer_win_weak_interception.h [5:5] - lib/scudo/scudo_allocator.cpp [5:5] - lib/scudo/scudo_allocator.h [5:5] - lib/scudo/scudo_allocator_combined.h [5:5] - lib/scudo/scudo_allocator_secondary.h [5:5] - lib/scudo/scudo_crc32.cpp [5:5] - lib/scudo/scudo_crc32.h [5:5] - lib/scudo/scudo_errors.cpp [5:5] - lib/scudo/scudo_errors.h [5:5] - lib/scudo/scudo_flags.cpp [5:5] - lib/scudo/scudo_flags.h [5:5] - lib/scudo/scudo_flags.inc [5:5] - lib/scudo/scudo_interface_internal.h [5:5] - lib/scudo/scudo_malloc.cpp [5:5] - lib/scudo/scudo_new_delete.cpp [5:5] - lib/scudo/scudo_platform.h [5:5] - lib/scudo/scudo_termination.cpp [5:5] - lib/scudo/scudo_tsd.h [5:5] - lib/scudo/scudo_tsd_exclusive.cpp [5:5] - lib/scudo/scudo_tsd_exclusive.inc [5:5] - lib/scudo/scudo_tsd_shared.cpp [5:5] - lib/scudo/scudo_tsd_shared.inc [5:5] - lib/scudo/scudo_utils.cpp [5:5] - lib/scudo/scudo_utils.h [5:5] - lib/scudo/standalone/allocator_config.h [5:5] - lib/scudo/standalone/atomic_helpers.h [5:5] - lib/scudo/standalone/bytemap.h [5:5] - lib/scudo/standalone/checksum.cpp [5:5] - lib/scudo/standalone/checksum.h [5:5] - lib/scudo/standalone/chunk.h [5:5] - lib/scudo/standalone/combined.h [5:5] - lib/scudo/standalone/common.cpp [5:5] - lib/scudo/standalone/common.h [5:5] - lib/scudo/standalone/crc32_hw.cpp [5:5] - lib/scudo/standalone/flags.cpp [5:5] - lib/scudo/standalone/flags.h [5:5] - lib/scudo/standalone/flags.inc [5:5] - lib/scudo/standalone/flags_parser.cpp [5:5] - lib/scudo/standalone/flags_parser.h [5:5] - lib/scudo/standalone/fuchsia.cpp [5:5] - lib/scudo/standalone/fuchsia.h [5:5] - lib/scudo/standalone/include/scudo/interface.h [5:5] - lib/scudo/standalone/internal_defs.h [5:5] - lib/scudo/standalone/linux.cpp [5:5] - lib/scudo/standalone/linux.h [5:5] - lib/scudo/standalone/list.h [5:5] - lib/scudo/standalone/local_cache.h [5:5] - lib/scudo/standalone/memtag.h [5:5] - lib/scudo/standalone/mutex.h [5:5] - lib/scudo/standalone/options.h [5:5] - lib/scudo/standalone/platform.h [5:5] - lib/scudo/standalone/primary32.h [5:5] - lib/scudo/standalone/primary64.h [5:5] - lib/scudo/standalone/quarantine.h [5:5] - lib/scudo/standalone/release.cpp [5:5] - lib/scudo/standalone/release.h [5:5] - lib/scudo/standalone/report.cpp [5:5] - lib/scudo/standalone/report.h [5:5] - lib/scudo/standalone/secondary.h [5:5] - lib/scudo/standalone/size_class_map.h [5:5] - lib/scudo/standalone/stack_depot.h [5:5] - lib/scudo/standalone/stats.h [5:5] - lib/scudo/standalone/string_utils.cpp [5:5] - lib/scudo/standalone/string_utils.h [5:5] - lib/scudo/standalone/trusty.h [5:5] - lib/scudo/standalone/tsd.h [5:5] - lib/scudo/standalone/tsd_exclusive.h [5:5] - lib/scudo/standalone/tsd_shared.h [5:5] - lib/scudo/standalone/vector.h [5:5] - lib/scudo/standalone/wrappers_c.cpp [5:5] - lib/scudo/standalone/wrappers_c.h [5:5] - lib/scudo/standalone/wrappers_c.inc [5:5] - lib/scudo/standalone/wrappers_c_checks.h [5:5] - lib/scudo/standalone/wrappers_cpp.cpp [5:5] - lib/stats/stats.cpp [5:5] - lib/stats/stats.h [5:5] - lib/stats/stats_client.cpp [5:5] - lib/tsan/dd/dd_interceptors.cpp [5:5] - lib/tsan/dd/dd_rtl.cpp [5:5] - lib/tsan/dd/dd_rtl.h [5:5] - lib/tsan/rtl/tsan_debugging.cpp [5:5] - lib/tsan/rtl/tsan_defs.h [5:5] - lib/tsan/rtl/tsan_dense_alloc.h [5:5] - lib/tsan/rtl/tsan_external.cpp [5:5] - lib/tsan/rtl/tsan_fd.cpp [5:5] - lib/tsan/rtl/tsan_fd.h [5:5] - lib/tsan/rtl/tsan_flags.cpp [5:5] - lib/tsan/rtl/tsan_flags.h [5:5] - lib/tsan/rtl/tsan_flags.inc [5:5] - lib/tsan/rtl/tsan_ignoreset.cpp [5:5] - lib/tsan/rtl/tsan_ignoreset.h [5:5] - lib/tsan/rtl/tsan_ilist.h [5:5] - lib/tsan/rtl/tsan_interceptors_libdispatch.cpp [5:5] - lib/tsan/rtl/tsan_interceptors_mac.cpp [5:5] - lib/tsan/rtl/tsan_interceptors_mach_vm.cpp [5:5] - lib/tsan/rtl/tsan_interceptors_posix.cpp [5:5] - lib/tsan/rtl/tsan_interface.cpp [5:5] - lib/tsan/rtl/tsan_interface.h [5:5] - lib/tsan/rtl/tsan_interface.inc [5:5] - lib/tsan/rtl/tsan_interface_ann.cpp [5:5] - lib/tsan/rtl/tsan_interface_ann.h [5:5] - lib/tsan/rtl/tsan_interface_atomic.cpp [5:5] - lib/tsan/rtl/tsan_interface_java.cpp [5:5] - lib/tsan/rtl/tsan_interface_java.h [5:5] - lib/tsan/rtl/tsan_malloc_mac.cpp [5:5] - lib/tsan/rtl/tsan_md5.cpp [5:5] - lib/tsan/rtl/tsan_mman.cpp [5:5] - lib/tsan/rtl/tsan_mman.h [5:5] - lib/tsan/rtl/tsan_mutexset.cpp [5:5] - lib/tsan/rtl/tsan_mutexset.h [5:5] - lib/tsan/rtl/tsan_new_delete.cpp [5:5] - lib/tsan/rtl/tsan_platform.h [5:5] - lib/tsan/rtl/tsan_platform_linux.cpp [5:5] - lib/tsan/rtl/tsan_platform_mac.cpp [5:5] - lib/tsan/rtl/tsan_platform_posix.cpp [5:5] - lib/tsan/rtl/tsan_platform_windows.cpp [5:5] - lib/tsan/rtl/tsan_preinit.cpp [5:5] - lib/tsan/rtl/tsan_report.cpp [5:5] - lib/tsan/rtl/tsan_report.h [5:5] - lib/tsan/rtl/tsan_rtl.cpp [5:5] - lib/tsan/rtl/tsan_rtl.h [5:5] - lib/tsan/rtl/tsan_rtl_access.cpp [5:5] - lib/tsan/rtl/tsan_rtl_mutex.cpp [5:5] - lib/tsan/rtl/tsan_rtl_proc.cpp [5:5] - lib/tsan/rtl/tsan_rtl_report.cpp [5:5] - lib/tsan/rtl/tsan_rtl_thread.cpp [5:5] - lib/tsan/rtl/tsan_shadow.h [5:5] - lib/tsan/rtl/tsan_stack_trace.cpp [5:5] - lib/tsan/rtl/tsan_stack_trace.h [5:5] - lib/tsan/rtl/tsan_suppressions.cpp [5:5] - lib/tsan/rtl/tsan_suppressions.h [5:5] - lib/tsan/rtl/tsan_symbolize.cpp [5:5] - lib/tsan/rtl/tsan_symbolize.h [5:5] - lib/tsan/rtl/tsan_sync.cpp [5:5] - lib/tsan/rtl/tsan_sync.h [5:5] - lib/tsan/rtl/tsan_trace.h [5:5] - lib/tsan/rtl/tsan_vector_clock.cpp [5:5] - lib/tsan/rtl/tsan_vector_clock.h [5:5] - lib/ubsan/ubsan_checks.inc [5:5] - lib/ubsan/ubsan_diag.cpp [5:5] - lib/ubsan/ubsan_diag.h [5:5] - lib/ubsan/ubsan_diag_standalone.cpp [5:5] - lib/ubsan/ubsan_flags.cpp [5:5] - lib/ubsan/ubsan_flags.h [5:5] - lib/ubsan/ubsan_flags.inc [5:5] - lib/ubsan/ubsan_handlers.cpp [5:5] - lib/ubsan/ubsan_handlers.h [5:5] - lib/ubsan/ubsan_handlers_cxx.cpp [5:5] - lib/ubsan/ubsan_handlers_cxx.h [5:5] - lib/ubsan/ubsan_init.cpp [5:5] - lib/ubsan/ubsan_init.h [5:5] - lib/ubsan/ubsan_init_standalone.cpp [5:5] - lib/ubsan/ubsan_init_standalone_preinit.cpp [5:5] - lib/ubsan/ubsan_monitor.cpp [5:5] - lib/ubsan/ubsan_monitor.h [5:5] - lib/ubsan/ubsan_platform.h [5:5] - lib/ubsan/ubsan_signals_standalone.cpp [5:5] - lib/ubsan/ubsan_signals_standalone.h [6:6] - lib/ubsan/ubsan_type_hash.cpp [5:5] - lib/ubsan/ubsan_type_hash.h [5:5] - lib/ubsan/ubsan_type_hash_itanium.cpp [5:5] - lib/ubsan/ubsan_type_hash_win.cpp [5:5] - lib/ubsan/ubsan_value.cpp [5:5] - lib/ubsan/ubsan_value.h [5:5] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/memprof-preinit/ya.make lib/memprof_cxx/ya.make lib/msan_cxx/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats_client/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP NCSA c26d0b72f92421989c4471ae0acbc943 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - University of Illinois/NCSA - Open Source License - Scancode info: - Original SPDX id: NCSA - Score : 100.00 - Match type : REFERENCE - Links : http://www.otm.illinois.edu/faculty/forms/opensource.asp, https://spdx.org/licenses/NCSA - Files with this license: - LICENSE.TXT [249:250] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - -KEEP Apache-2.0 WITH LLVM-exception df18889e552d44a4679aff552267f802 -BELONGS lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make - License text: - The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - Scancode info: - Original SPDX id: Apache-2.0 - Score : 100.00 - Match type : NOTICE - Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 - Files with this license: - LICENSE.TXT [2:2] - Scancode info: - Original SPDX id: LLVM-exception - Score : 100.00 - Match type : NOTICE - Links : http://llvm.org/foundation/relicensing/LICENSE.txt, https://spdx.org/licenses/LLVM-exception - Files with this license: - LICENSE.TXT [2:2] - Belongs difference: - + lib/asan-preinit/ya.make lib/asan/ya.make lib/asan_cxx/ya.make lib/asan_static/ya.make lib/cfi/ya.make lib/cfi_diag/ya.make lib/dd/ya.make lib/dfsan/ya.make lib/gwp_asan/ya.make lib/hwasan/ya.make lib/hwasan_aliases/ya.make lib/hwasan_aliases_cxx/ya.make lib/hwasan_cxx/ya.make lib/lsan/ya.make lib/memprof-preinit/ya.make lib/memprof/ya.make lib/memprof_cxx/ya.make lib/msan/ya.make lib/msan_cxx/ya.make lib/profile/ya.make lib/safestack/ya.make lib/scudo/ya.make lib/scudo_cxx/ya.make lib/scudo_cxx_minimal/ya.make lib/scudo_minimal/ya.make lib/scudo_standalone/ya.make lib/scudo_standalone_cxx/ya.make lib/stats/ya.make lib/stats_client/ya.make lib/tsan/ya.make lib/tsan_cxx/ya.make lib/ubsan_minimal/ya.make lib/ubsan_standalone/ya.make lib/ubsan_standalone_cxx/ya.make diff --git a/contrib/libs/clang14-rt/CODE_OWNERS.TXT b/contrib/libs/clang14-rt/CODE_OWNERS.TXT deleted file mode 100644 index 125487816bcd..000000000000 --- a/contrib/libs/clang14-rt/CODE_OWNERS.TXT +++ /dev/null @@ -1,53 +0,0 @@ -This file is a list of the people responsible for ensuring that patches for a -particular part of compiler-rt are reviewed, either by themself or by -someone else. They are also the gatekeepers for their part of compiler-rt, with -the final word on what goes in or not. - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Peter Collingbourne -E: peter@pcc.me.uk -D: DataFlowSanitizer - -N: Daniel Dunbar -E: daniel@zuster.org -D: Makefile build - -N: Timur Iskhodzhanov -E: timurrrr@google.com -D: AddressSanitizer for Windows - -N: Howard Hinnant -E: howard.hinnant@gmail.com -D: builtins library - -N: Alexander Potapenko -E: glider@google.com -D: MacOS/iOS port of sanitizers - -N: Alexey Samsonov -E: samsonov@google.com -D: CMake build, test suite - -N: Kostya Serebryany -E: kcc@google.com -D: AddressSanitizer, sanitizer_common, porting sanitizers to another platforms, LeakSanitizer - -N: Richard Smith -E: richard-llvm@metafoo.co.uk -D: UndefinedBehaviorSanitizer - -N: Evgeniy Stepanov -E: eugenis@google.com -D: MemorySanitizer, Android port of sanitizers - -N: Dmitry Vyukov -E: dvyukov@google.com -D: ThreadSanitizer - -N: Bill Wendling -E: isanbard@gmail.com -D: Profile runtime library diff --git a/contrib/libs/clang14-rt/CREDITS.TXT b/contrib/libs/clang14-rt/CREDITS.TXT deleted file mode 100644 index 6964eba020b8..000000000000 --- a/contrib/libs/clang14-rt/CREDITS.TXT +++ /dev/null @@ -1,36 +0,0 @@ -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. diff --git a/contrib/libs/clang14-rt/LICENSE.TXT b/contrib/libs/clang14-rt/LICENSE.TXT deleted file mode 100644 index 5a79a1b9d5cb..000000000000 --- a/contrib/libs/clang14-rt/LICENSE.TXT +++ /dev/null @@ -1,311 +0,0 @@ -============================================================================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: -============================================================================== - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - -============================================================================== -Software from third parties included in the LLVM Project: -============================================================================== -The LLVM Project contains third party software which is under different license -terms. All such code will be identified clearly using at least one of two -mechanisms: -1) It will be in a separate directory tree with its own `LICENSE.txt` or - `LICENSE` file at the top containing the specific license and restrictions - which apply to that software, or -2) It will contain specific license and restriction terms at the top of every - file. - -============================================================================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): -============================================================================== - -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. - -============================================================================== - -University of Illinois/NCSA -Open Source License - -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - -All rights reserved. - -Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - -============================================================================== - -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/contrib/libs/clang14-rt/README.txt b/contrib/libs/clang14-rt/README.txt deleted file mode 100644 index fc8843246e25..000000000000 --- a/contrib/libs/clang14-rt/README.txt +++ /dev/null @@ -1,11 +0,0 @@ -Compiler-RT -================================ - -This directory and its subdirectories contain source code for the compiler -support routines. - -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - -================================ - diff --git a/contrib/libs/clang14-rt/include/profile/InstrProfData.inc b/contrib/libs/clang14-rt/include/profile/InstrProfData.inc deleted file mode 100644 index 62054a6a3df5..000000000000 --- a/contrib/libs/clang14-rt/include/profile/InstrProfData.inc +++ /dev/null @@ -1,905 +0,0 @@ -/*===-- InstrProfData.inc - instr profiling runtime structures -*- C++ -*-=== *\ -|* -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -|* -\*===----------------------------------------------------------------------===*/ -/* - * This is the main file that defines all the data structure, signature, - * constant literals that are shared across profiling runtime library, - * compiler (instrumentation), and host tools (reader/writer). The entities - * defined in this file affect the profile runtime ABI, the raw profile format, - * or both. - * - * The file has two identical copies. The primary copy lives in LLVM and - * the other one sits in compiler-rt/lib/profile directory. To make changes - * in this file, first modify the primary copy and copy it over to compiler-rt. - * Testing of any change in this file can start only after the two copies are - * synced up. - * - * The first part of the file includes macros that defines types, names, and - * initializers for the member fields of the core data structures. The field - * declarations for one structure is enabled by defining the field activation - * macro associated with that structure. Only one field activation record - * can be defined at one time and the rest definitions will be filtered out by - * the preprocessor. - * - * Examples of how the template is used to instantiate structure definition: - * 1. To declare a structure: - * - * struct ProfData { - * #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \ - * Type Name; - * #include "llvm/ProfileData/InstrProfData.inc" - * }; - * - * 2. To construct LLVM type arrays for the struct type: - * - * Type *DataTypes[] = { - * #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \ - * LLVMType, - * #include "llvm/ProfileData/InstrProfData.inc" - * }; - * - * 4. To construct constant array for the initializers: - * #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \ - * Initializer, - * Constant *ConstantVals[] = { - * #include "llvm/ProfileData/InstrProfData.inc" - * }; - * - * - * The second part of the file includes definitions all other entities that - * are related to runtime ABI and format. When no field activation macro is - * defined, this file can be included to introduce the definitions. - * -\*===----------------------------------------------------------------------===*/ - -/* Functions marked with INSTR_PROF_VISIBILITY must have hidden visibility in - * the compiler runtime. */ -#ifndef INSTR_PROF_VISIBILITY -#define INSTR_PROF_VISIBILITY -#endif - -/* INSTR_PROF_DATA start. */ -/* Definition of member fields of the per-function control structure. */ -#ifndef INSTR_PROF_DATA -#define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) -#else -#define INSTR_PROF_DATA_DEFINED -#endif -INSTR_PROF_DATA(const uint64_t, llvm::Type::getInt64Ty(Ctx), NameRef, \ - ConstantInt::get(llvm::Type::getInt64Ty(Ctx), \ - IndexedInstrProf::ComputeHash(getPGOFuncNameVarInitializer(Inc->getName())))) -INSTR_PROF_DATA(const uint64_t, llvm::Type::getInt64Ty(Ctx), FuncHash, \ - ConstantInt::get(llvm::Type::getInt64Ty(Ctx), \ - Inc->getHash()->getZExtValue())) -INSTR_PROF_DATA(const IntPtrT, IntPtrTy, CounterPtr, RelativeCounterPtr) -/* This is used to map function pointers for the indirect call targets to - * function name hashes during the conversion from raw to merged profile - * data. - */ -INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), FunctionPointer, \ - FunctionAddr) -INSTR_PROF_DATA(IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, \ - ValuesPtrExpr) -INSTR_PROF_DATA(const uint32_t, llvm::Type::getInt32Ty(Ctx), NumCounters, \ - ConstantInt::get(llvm::Type::getInt32Ty(Ctx), NumCounters)) -INSTR_PROF_DATA(const uint16_t, Int16ArrayTy, NumValueSites[IPVK_Last+1], \ - ConstantArray::get(Int16ArrayTy, Int16ArrayVals)) -#undef INSTR_PROF_DATA -/* INSTR_PROF_DATA end. */ - - -/* This is an internal data structure used by value profiler. It - * is defined here to allow serialization code sharing by LLVM - * to be used in unit test. - * - * typedef struct ValueProfNode { - * // InstrProfValueData VData; - * uint64_t Value; - * uint64_t Count; - * struct ValueProfNode *Next; - * } ValueProfNode; - */ -/* INSTR_PROF_VALUE_NODE start. */ -#ifndef INSTR_PROF_VALUE_NODE -#define INSTR_PROF_VALUE_NODE(Type, LLVMType, Name, Initializer) -#else -#define INSTR_PROF_DATA_DEFINED -#endif -INSTR_PROF_VALUE_NODE(uint64_t, llvm::Type::getInt64Ty(Ctx), Value, \ - ConstantInt::get(llvm::Type::GetInt64Ty(Ctx), 0)) -INSTR_PROF_VALUE_NODE(uint64_t, llvm::Type::getInt64Ty(Ctx), Count, \ - ConstantInt::get(llvm::Type::GetInt64Ty(Ctx), 0)) -INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next, \ - ConstantInt::get(llvm::Type::GetInt8PtrTy(Ctx), 0)) -#undef INSTR_PROF_VALUE_NODE -/* INSTR_PROF_VALUE_NODE end. */ - -/* INSTR_PROF_RAW_HEADER start */ -/* Definition of member fields of the raw profile header data structure. */ -#ifndef INSTR_PROF_RAW_HEADER -#define INSTR_PROF_RAW_HEADER(Type, Name, Initializer) -#else -#define INSTR_PROF_DATA_DEFINED -#endif -INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic()) -INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version()) -INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL)) -/* FIXME: A more accurate name is NumData */ -INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize) -INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesBeforeCounters, PaddingBytesBeforeCounters) -/* FIXME: A more accurate name is NumCounters */ -INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize) -INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesAfterCounters, PaddingBytesAfterCounters) -INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize) -INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, - (uintptr_t)CountersBegin - (uintptr_t)DataBegin) -INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin) -INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last) -#undef INSTR_PROF_RAW_HEADER -/* INSTR_PROF_RAW_HEADER end */ - -/* VALUE_PROF_FUNC_PARAM start */ -/* Definition of parameter types of the runtime API used to do value profiling - * for a given value site. - */ -#ifndef VALUE_PROF_FUNC_PARAM -#define VALUE_PROF_FUNC_PARAM(ArgType, ArgName, ArgLLVMType) -#define INSTR_PROF_COMMA -#else -#define INSTR_PROF_DATA_DEFINED -#define INSTR_PROF_COMMA , -#endif -VALUE_PROF_FUNC_PARAM(uint64_t, TargetValue, Type::getInt64Ty(Ctx)) \ - INSTR_PROF_COMMA -VALUE_PROF_FUNC_PARAM(void *, Data, Type::getInt8PtrTy(Ctx)) INSTR_PROF_COMMA -VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx)) -#undef VALUE_PROF_FUNC_PARAM -#undef INSTR_PROF_COMMA -/* VALUE_PROF_FUNC_PARAM end */ - -/* VALUE_PROF_KIND start */ -#ifndef VALUE_PROF_KIND -#define VALUE_PROF_KIND(Enumerator, Value, Descr) -#else -#define INSTR_PROF_DATA_DEFINED -#endif -/* For indirect function call value profiling, the addresses of the target - * functions are profiled by the instrumented code. The target addresses are - * written in the raw profile data and converted to target function name's MD5 - * hash by the profile reader during deserialization. Typically, this happens - * when the raw profile data is read during profile merging. - * - * For this remapping the ProfData is used. ProfData contains both the function - * name hash and the function address. - */ -VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0, "indirect call target") -/* For memory intrinsic functions size profiling. */ -VALUE_PROF_KIND(IPVK_MemOPSize, 1, "memory intrinsic functions size") -/* These two kinds must be the last to be - * declared. This is to make sure the string - * array created with the template can be - * indexed with the kind value. - */ -VALUE_PROF_KIND(IPVK_First, IPVK_IndirectCallTarget, "first") -VALUE_PROF_KIND(IPVK_Last, IPVK_MemOPSize, "last") - -#undef VALUE_PROF_KIND -/* VALUE_PROF_KIND end */ - -#undef COVMAP_V2_OR_V3 -#ifdef COVMAP_V2 -#define COVMAP_V2_OR_V3 -#endif -#ifdef COVMAP_V3 -#define COVMAP_V2_OR_V3 -#endif - -/* COVMAP_FUNC_RECORD start */ -/* Definition of member fields of the function record structure in coverage - * map. - */ -#ifndef COVMAP_FUNC_RECORD -#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Initializer) -#else -#define INSTR_PROF_DATA_DEFINED -#endif -#ifdef COVMAP_V1 -COVMAP_FUNC_RECORD(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), \ - NamePtr, llvm::ConstantExpr::getBitCast(NamePtr, \ - llvm::Type::getInt8PtrTy(Ctx))) -COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), NameSize, \ - llvm::ConstantInt::get(llvm::Type::getInt32Ty(Ctx), \ - NameValue.size())) -#endif -#ifdef COVMAP_V2_OR_V3 -COVMAP_FUNC_RECORD(const int64_t, llvm::Type::getInt64Ty(Ctx), NameRef, \ - llvm::ConstantInt::get( \ - llvm::Type::getInt64Ty(Ctx), NameHash)) -#endif -COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), DataSize, \ - llvm::ConstantInt::get( \ - llvm::Type::getInt32Ty(Ctx), CoverageMapping.size())) -COVMAP_FUNC_RECORD(const uint64_t, llvm::Type::getInt64Ty(Ctx), FuncHash, \ - llvm::ConstantInt::get( \ - llvm::Type::getInt64Ty(Ctx), FuncHash)) -#ifdef COVMAP_V3 -COVMAP_FUNC_RECORD(const uint64_t, llvm::Type::getInt64Ty(Ctx), FilenamesRef, \ - llvm::ConstantInt::get( \ - llvm::Type::getInt64Ty(Ctx), FilenamesRef)) -COVMAP_FUNC_RECORD(const char, \ - llvm::ArrayType::get(llvm::Type::getInt8Ty(Ctx), \ - CoverageMapping.size()), \ - CoverageMapping, - llvm::ConstantDataArray::getRaw( \ - CoverageMapping, CoverageMapping.size(), \ - llvm::Type::getInt8Ty(Ctx))) -#endif -#undef COVMAP_FUNC_RECORD -/* COVMAP_FUNC_RECORD end. */ - -/* COVMAP_HEADER start */ -/* Definition of member fields of coverage map header. - */ -#ifndef COVMAP_HEADER -#define COVMAP_HEADER(Type, LLVMType, Name, Initializer) -#else -#define INSTR_PROF_DATA_DEFINED -#endif -COVMAP_HEADER(uint32_t, Int32Ty, NRecords, \ - llvm::ConstantInt::get(Int32Ty, NRecords)) -COVMAP_HEADER(uint32_t, Int32Ty, FilenamesSize, \ - llvm::ConstantInt::get(Int32Ty, FilenamesSize)) -COVMAP_HEADER(uint32_t, Int32Ty, CoverageSize, \ - llvm::ConstantInt::get(Int32Ty, CoverageMappingSize)) -COVMAP_HEADER(uint32_t, Int32Ty, Version, \ - llvm::ConstantInt::get(Int32Ty, CovMapVersion::CurrentVersion)) -#undef COVMAP_HEADER -/* COVMAP_HEADER end. */ - - -#ifdef INSTR_PROF_SECT_ENTRY -#define INSTR_PROF_DATA_DEFINED -INSTR_PROF_SECT_ENTRY(IPSK_data, \ - INSTR_PROF_QUOTE(INSTR_PROF_DATA_COMMON), \ - INSTR_PROF_DATA_COFF, "__DATA,") -INSTR_PROF_SECT_ENTRY(IPSK_cnts, \ - INSTR_PROF_QUOTE(INSTR_PROF_CNTS_COMMON), \ - INSTR_PROF_CNTS_COFF, "__DATA,") -INSTR_PROF_SECT_ENTRY(IPSK_name, \ - INSTR_PROF_QUOTE(INSTR_PROF_NAME_COMMON), \ - INSTR_PROF_NAME_COFF, "__DATA,") -INSTR_PROF_SECT_ENTRY(IPSK_vals, \ - INSTR_PROF_QUOTE(INSTR_PROF_VALS_COMMON), \ - INSTR_PROF_VALS_COFF, "__DATA,") -INSTR_PROF_SECT_ENTRY(IPSK_vnodes, \ - INSTR_PROF_QUOTE(INSTR_PROF_VNODES_COMMON), \ - INSTR_PROF_VNODES_COFF, "__DATA,") -INSTR_PROF_SECT_ENTRY(IPSK_covmap, \ - INSTR_PROF_QUOTE(INSTR_PROF_COVMAP_COMMON), \ - INSTR_PROF_COVMAP_COFF, "__LLVM_COV,") -INSTR_PROF_SECT_ENTRY(IPSK_covfun, \ - INSTR_PROF_QUOTE(INSTR_PROF_COVFUN_COMMON), \ - INSTR_PROF_COVFUN_COFF, "__LLVM_COV,") -INSTR_PROF_SECT_ENTRY(IPSK_orderfile, \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COMMON), \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COFF), "__DATA,") - -#undef INSTR_PROF_SECT_ENTRY -#endif - - -#ifdef INSTR_PROF_VALUE_PROF_DATA -#define INSTR_PROF_DATA_DEFINED - -#define INSTR_PROF_MAX_NUM_VAL_PER_SITE 255 -/*! - * This is the header of the data structure that defines the on-disk - * layout of the value profile data of a particular kind for one function. - */ -typedef struct ValueProfRecord { - /* The kind of the value profile record. */ - uint32_t Kind; - /* - * The number of value profile sites. It is guaranteed to be non-zero; - * otherwise the record for this kind won't be emitted. - */ - uint32_t NumValueSites; - /* - * The first element of the array that stores the number of profiled - * values for each value site. The size of the array is NumValueSites. - * Since NumValueSites is greater than zero, there is at least one - * element in the array. - */ - uint8_t SiteCountArray[1]; - - /* - * The fake declaration is for documentation purpose only. - * Align the start of next field to be on 8 byte boundaries. - uint8_t Padding[X]; - */ - - /* The array of value profile data. The size of the array is the sum - * of all elements in SiteCountArray[]. - InstrProfValueData ValueData[]; - */ - -#ifdef __cplusplus - /*! - * Return the number of value sites. - */ - uint32_t getNumValueSites() const { return NumValueSites; } - /*! - * Read data from this record and save it to Record. - */ - void deserializeTo(InstrProfRecord &Record, - InstrProfSymtab *SymTab); - /* - * In-place byte swap: - * Do byte swap for this instance. \c Old is the original order before - * the swap, and \c New is the New byte order. - */ - void swapBytes(support::endianness Old, support::endianness New); -#endif -} ValueProfRecord; - -/*! - * Per-function header/control data structure for value profiling - * data in indexed format. - */ -typedef struct ValueProfData { - /* - * Total size in bytes including this field. It must be a multiple - * of sizeof(uint64_t). - */ - uint32_t TotalSize; - /* - *The number of value profile kinds that has value profile data. - * In this implementation, a value profile kind is considered to - * have profile data if the number of value profile sites for the - * kind is not zero. More aggressively, the implementation can - * choose to check the actual data value: if none of the value sites - * has any profiled values, the kind can be skipped. - */ - uint32_t NumValueKinds; - - /* - * Following are a sequence of variable length records. The prefix/header - * of each record is defined by ValueProfRecord type. The number of - * records is NumValueKinds. - * ValueProfRecord Record_1; - * ValueProfRecord Record_N; - */ - -#if __cplusplus - /*! - * Return the total size in bytes of the on-disk value profile data - * given the data stored in Record. - */ - static uint32_t getSize(const InstrProfRecord &Record); - /*! - * Return a pointer to \c ValueProfData instance ready to be streamed. - */ - static std::unique_ptr - serializeFrom(const InstrProfRecord &Record); - /*! - * Check the integrity of the record. - */ - Error checkIntegrity(); - /*! - * Return a pointer to \c ValueProfileData instance ready to be read. - * All data in the instance are properly byte swapped. The input - * data is assumed to be in little endian order. - */ - static Expected> - getValueProfData(const unsigned char *SrcBuffer, - const unsigned char *const SrcBufferEnd, - support::endianness SrcDataEndianness); - /*! - * Swap byte order from \c Endianness order to host byte order. - */ - void swapBytesToHost(support::endianness Endianness); - /*! - * Swap byte order from host byte order to \c Endianness order. - */ - void swapBytesFromHost(support::endianness Endianness); - /*! - * Return the total size of \c ValueProfileData. - */ - uint32_t getSize() const { return TotalSize; } - /*! - * Read data from this data and save it to \c Record. - */ - void deserializeTo(InstrProfRecord &Record, - InstrProfSymtab *SymTab); - void operator delete(void *ptr) { ::operator delete(ptr); } -#endif -} ValueProfData; - -/* - * The closure is designed to abstact away two types of value profile data: - * - InstrProfRecord which is the primary data structure used to - * represent profile data in host tools (reader, writer, and profile-use) - * - value profile runtime data structure suitable to be used by C - * runtime library. - * - * Both sources of data need to serialize to disk/memory-buffer in common - * format: ValueProfData. The abstraction allows compiler-rt's raw profiler - * writer to share the same format and code with indexed profile writer. - * - * For documentation of the member methods below, refer to corresponding methods - * in class InstrProfRecord. - */ -typedef struct ValueProfRecordClosure { - const void *Record; - uint32_t (*GetNumValueKinds)(const void *Record); - uint32_t (*GetNumValueSites)(const void *Record, uint32_t VKind); - uint32_t (*GetNumValueData)(const void *Record, uint32_t VKind); - uint32_t (*GetNumValueDataForSite)(const void *R, uint32_t VK, uint32_t S); - - /* - * After extracting the value profile data from the value profile record, - * this method is used to map the in-memory value to on-disk value. If - * the method is null, value will be written out untranslated. - */ - uint64_t (*RemapValueData)(uint32_t, uint64_t Value); - void (*GetValueForSite)(const void *R, InstrProfValueData *Dst, uint32_t K, - uint32_t S); - ValueProfData *(*AllocValueProfData)(size_t TotalSizeInBytes); -} ValueProfRecordClosure; - -INSTR_PROF_VISIBILITY ValueProfRecord * -getFirstValueProfRecord(ValueProfData *VPD); -INSTR_PROF_VISIBILITY ValueProfRecord * -getValueProfRecordNext(ValueProfRecord *VPR); -INSTR_PROF_VISIBILITY InstrProfValueData * -getValueProfRecordValueData(ValueProfRecord *VPR); -INSTR_PROF_VISIBILITY uint32_t -getValueProfRecordHeaderSize(uint32_t NumValueSites); - -#undef INSTR_PROF_VALUE_PROF_DATA -#endif /* INSTR_PROF_VALUE_PROF_DATA */ - - -#ifdef INSTR_PROF_COMMON_API_IMPL -#define INSTR_PROF_DATA_DEFINED -#ifdef __cplusplus -#define INSTR_PROF_INLINE inline -#define INSTR_PROF_NULLPTR nullptr -#else -#define INSTR_PROF_INLINE -#define INSTR_PROF_NULLPTR NULL -#endif - -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - -/*! - * Return the \c ValueProfRecord header size including the - * padding bytes. - */ -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -uint32_t getValueProfRecordHeaderSize(uint32_t NumValueSites) { - uint32_t Size = offsetof(ValueProfRecord, SiteCountArray) + - sizeof(uint8_t) * NumValueSites; - /* Round the size to multiple of 8 bytes. */ - Size = (Size + 7) & ~7; - return Size; -} - -/*! - * Return the total size of the value profile record including the - * header and the value data. - */ -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -uint32_t getValueProfRecordSize(uint32_t NumValueSites, - uint32_t NumValueData) { - return getValueProfRecordHeaderSize(NumValueSites) + - sizeof(InstrProfValueData) * NumValueData; -} - -/*! - * Return the pointer to the start of value data array. - */ -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -InstrProfValueData *getValueProfRecordValueData(ValueProfRecord *This) { - return (InstrProfValueData *)((char *)This + getValueProfRecordHeaderSize( - This->NumValueSites)); -} - -/*! - * Return the total number of value data for \c This record. - */ -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -uint32_t getValueProfRecordNumValueData(ValueProfRecord *This) { - uint32_t NumValueData = 0; - uint32_t I; - for (I = 0; I < This->NumValueSites; I++) - NumValueData += This->SiteCountArray[I]; - return NumValueData; -} - -/*! - * Use this method to advance to the next \c This \c ValueProfRecord. - */ -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -ValueProfRecord *getValueProfRecordNext(ValueProfRecord *This) { - uint32_t NumValueData = getValueProfRecordNumValueData(This); - return (ValueProfRecord *)((char *)This + - getValueProfRecordSize(This->NumValueSites, - NumValueData)); -} - -/*! - * Return the first \c ValueProfRecord instance. - */ -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -ValueProfRecord *getFirstValueProfRecord(ValueProfData *This) { - return (ValueProfRecord *)((char *)This + sizeof(ValueProfData)); -} - -/* Closure based interfaces. */ - -/*! - * Return the total size in bytes of the on-disk value profile data - * given the data stored in Record. - */ -INSTR_PROF_VISIBILITY uint32_t -getValueProfDataSize(ValueProfRecordClosure *Closure) { - uint32_t Kind; - uint32_t TotalSize = sizeof(ValueProfData); - const void *Record = Closure->Record; - - for (Kind = IPVK_First; Kind <= IPVK_Last; Kind++) { - uint32_t NumValueSites = Closure->GetNumValueSites(Record, Kind); - if (!NumValueSites) - continue; - TotalSize += getValueProfRecordSize(NumValueSites, - Closure->GetNumValueData(Record, Kind)); - } - return TotalSize; -} - -/*! - * Extract value profile data of a function for the profile kind \c ValueKind - * from the \c Closure and serialize the data into \c This record instance. - */ -INSTR_PROF_VISIBILITY void -serializeValueProfRecordFrom(ValueProfRecord *This, - ValueProfRecordClosure *Closure, - uint32_t ValueKind, uint32_t NumValueSites) { - uint32_t S; - const void *Record = Closure->Record; - This->Kind = ValueKind; - This->NumValueSites = NumValueSites; - InstrProfValueData *DstVD = getValueProfRecordValueData(This); - - for (S = 0; S < NumValueSites; S++) { - uint32_t ND = Closure->GetNumValueDataForSite(Record, ValueKind, S); - This->SiteCountArray[S] = ND; - Closure->GetValueForSite(Record, DstVD, ValueKind, S); - DstVD += ND; - } -} - -/*! - * Extract value profile data of a function from the \c Closure - * and serialize the data into \c DstData if it is not NULL or heap - * memory allocated by the \c Closure's allocator method. If \c - * DstData is not null, the caller is expected to set the TotalSize - * in DstData. - */ -INSTR_PROF_VISIBILITY ValueProfData * -serializeValueProfDataFrom(ValueProfRecordClosure *Closure, - ValueProfData *DstData) { - uint32_t Kind; - uint32_t TotalSize = - DstData ? DstData->TotalSize : getValueProfDataSize(Closure); - - ValueProfData *VPD = - DstData ? DstData : Closure->AllocValueProfData(TotalSize); - - VPD->TotalSize = TotalSize; - VPD->NumValueKinds = Closure->GetNumValueKinds(Closure->Record); - ValueProfRecord *VR = getFirstValueProfRecord(VPD); - for (Kind = IPVK_First; Kind <= IPVK_Last; Kind++) { - uint32_t NumValueSites = Closure->GetNumValueSites(Closure->Record, Kind); - if (!NumValueSites) - continue; - serializeValueProfRecordFrom(VR, Closure, Kind, NumValueSites); - VR = getValueProfRecordNext(VR); - } - return VPD; -} - -#undef INSTR_PROF_COMMON_API_IMPL -#endif /* INSTR_PROF_COMMON_API_IMPL */ - -/*============================================================================*/ - -#ifndef INSTR_PROF_DATA_DEFINED - -#ifndef INSTR_PROF_DATA_INC -#define INSTR_PROF_DATA_INC - -/* Helper macros. */ -#define INSTR_PROF_SIMPLE_QUOTE(x) #x -#define INSTR_PROF_QUOTE(x) INSTR_PROF_SIMPLE_QUOTE(x) -#define INSTR_PROF_SIMPLE_CONCAT(x,y) x ## y -#define INSTR_PROF_CONCAT(x,y) INSTR_PROF_SIMPLE_CONCAT(x,y) - -/* Magic number to detect file format and endianness. - * Use 255 at one end, since no UTF-8 file can use that character. Avoid 0, - * so that utilities, like strings, don't grab it as a string. 129 is also - * invalid UTF-8, and high enough to be interesting. - * Use "lprofr" in the centre to stand for "LLVM Profile Raw", or "lprofR" - * for 32-bit platforms. - */ -#define INSTR_PROF_RAW_MAGIC_64 (uint64_t)255 << 56 | (uint64_t)'l' << 48 | \ - (uint64_t)'p' << 40 | (uint64_t)'r' << 32 | (uint64_t)'o' << 24 | \ - (uint64_t)'f' << 16 | (uint64_t)'r' << 8 | (uint64_t)129 -#define INSTR_PROF_RAW_MAGIC_32 (uint64_t)255 << 56 | (uint64_t)'l' << 48 | \ - (uint64_t)'p' << 40 | (uint64_t)'r' << 32 | (uint64_t)'o' << 24 | \ - (uint64_t)'f' << 16 | (uint64_t)'R' << 8 | (uint64_t)129 - -/* FIXME: Please remedy the fixme in the header before bumping the version. */ -/* Raw profile format version (start from 1). */ -#define INSTR_PROF_RAW_VERSION 8 -/* Indexed profile format version (start from 1). */ -#define INSTR_PROF_INDEX_VERSION 7 -/* Coverage mapping format version (start from 0). */ -#define INSTR_PROF_COVMAP_VERSION 5 - -/* Profile version is always of type uint64_t. Reserve the upper 8 bits in the - * version for other variants of profile. We set the lowest bit of the upper 8 - * bits (i.e. bit 56) to 1 to indicate if this is an IR-level instrumentation - * generated profile, and 0 if this is a Clang FE generated profile. - * 1 in bit 57 indicates there are context-sensitive records in the profile. - * The 59th bit indicates whether to use debug info to correlate profiles. - * The 60th bit indicates single byte coverage instrumentation. - * The 61st bit indicates function entry instrumentation only. - */ -#define VARIANT_MASKS_ALL 0xff00000000000000ULL -#define GET_VERSION(V) ((V) & ~VARIANT_MASKS_ALL) -#define VARIANT_MASK_IR_PROF (0x1ULL << 56) -#define VARIANT_MASK_CSIR_PROF (0x1ULL << 57) -#define VARIANT_MASK_INSTR_ENTRY (0x1ULL << 58) -#define VARIANT_MASK_DBG_CORRELATE (0x1ULL << 59) -#define VARIANT_MASK_BYTE_COVERAGE (0x1ULL << 60) -#define VARIANT_MASK_FUNCTION_ENTRY_ONLY (0x1ULL << 61) -#define INSTR_PROF_RAW_VERSION_VAR __llvm_profile_raw_version -#define INSTR_PROF_PROFILE_RUNTIME_VAR __llvm_profile_runtime -#define INSTR_PROF_PROFILE_COUNTER_BIAS_VAR __llvm_profile_counter_bias - -/* The variable that holds the name of the profile data - * specified via command line. */ -#define INSTR_PROF_PROFILE_NAME_VAR __llvm_profile_filename - -/* section name strings common to all targets other - than WIN32 */ -#define INSTR_PROF_DATA_COMMON __llvm_prf_data -#define INSTR_PROF_NAME_COMMON __llvm_prf_names -#define INSTR_PROF_CNTS_COMMON __llvm_prf_cnts -#define INSTR_PROF_VALS_COMMON __llvm_prf_vals -#define INSTR_PROF_VNODES_COMMON __llvm_prf_vnds -#define INSTR_PROF_COVMAP_COMMON __llvm_covmap -#define INSTR_PROF_COVFUN_COMMON __llvm_covfun -#define INSTR_PROF_ORDERFILE_COMMON __llvm_orderfile -/* Windows section names. Because these section names contain dollar characters, - * they must be quoted. - */ -#define INSTR_PROF_DATA_COFF ".lprfd$M" -#define INSTR_PROF_NAME_COFF ".lprfn$M" -#define INSTR_PROF_CNTS_COFF ".lprfc$M" -#define INSTR_PROF_VALS_COFF ".lprfv$M" -#define INSTR_PROF_VNODES_COFF ".lprfnd$M" -#define INSTR_PROF_COVMAP_COFF ".lcovmap$M" -#define INSTR_PROF_COVFUN_COFF ".lcovfun$M" -#define INSTR_PROF_ORDERFILE_COFF ".lorderfile$M" - -#ifdef _WIN32 -/* Runtime section names and name strings. */ -#define INSTR_PROF_DATA_SECT_NAME INSTR_PROF_DATA_COFF -#define INSTR_PROF_NAME_SECT_NAME INSTR_PROF_NAME_COFF -#define INSTR_PROF_CNTS_SECT_NAME INSTR_PROF_CNTS_COFF -/* Array of pointers. Each pointer points to a list - * of value nodes associated with one value site. - */ -#define INSTR_PROF_VALS_SECT_NAME INSTR_PROF_VALS_COFF -/* Value profile nodes section. */ -#define INSTR_PROF_VNODES_SECT_NAME INSTR_PROF_VNODES_COFF -#define INSTR_PROF_COVMAP_SECT_NAME INSTR_PROF_COVMAP_COFF -#define INSTR_PROF_COVFUN_SECT_NAME INSTR_PROF_COVFUN_COFF -#define INSTR_PROF_ORDERFILE_SECT_NAME INSTR_PROF_ORDERFILE_COFF -#else -/* Runtime section names and name strings. */ -#define INSTR_PROF_DATA_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_DATA_COMMON) -#define INSTR_PROF_NAME_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_NAME_COMMON) -#define INSTR_PROF_CNTS_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_CNTS_COMMON) -/* Array of pointers. Each pointer points to a list - * of value nodes associated with one value site. - */ -#define INSTR_PROF_VALS_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_VALS_COMMON) -/* Value profile nodes section. */ -#define INSTR_PROF_VNODES_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_VNODES_COMMON) -#define INSTR_PROF_COVMAP_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_COVMAP_COMMON) -#define INSTR_PROF_COVFUN_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_COVFUN_COMMON) -/* Order file instrumentation. */ -#define INSTR_PROF_ORDERFILE_SECT_NAME \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COMMON) -#endif - -#define INSTR_PROF_ORDERFILE_BUFFER_NAME _llvm_order_file_buffer -#define INSTR_PROF_ORDERFILE_BUFFER_NAME_STR \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_BUFFER_NAME) -#define INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME _llvm_order_file_buffer_idx -#define INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME_STR \ - INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME) - -/* Macros to define start/stop section symbol for a given - * section on Linux. For instance - * INSTR_PROF_SECT_START(INSTR_PROF_DATA_SECT_NAME) will - * expand to __start___llvm_prof_data - */ -#define INSTR_PROF_SECT_START(Sect) \ - INSTR_PROF_CONCAT(__start_,Sect) -#define INSTR_PROF_SECT_STOP(Sect) \ - INSTR_PROF_CONCAT(__stop_,Sect) - -/* Value Profiling API linkage name. */ -#define INSTR_PROF_VALUE_PROF_FUNC __llvm_profile_instrument_target -#define INSTR_PROF_VALUE_PROF_FUNC_STR \ - INSTR_PROF_QUOTE(INSTR_PROF_VALUE_PROF_FUNC) -#define INSTR_PROF_VALUE_PROF_MEMOP_FUNC __llvm_profile_instrument_memop -#define INSTR_PROF_VALUE_PROF_MEMOP_FUNC_STR \ - INSTR_PROF_QUOTE(INSTR_PROF_VALUE_PROF_MEMOP_FUNC) - -/* InstrProfile per-function control data alignment. */ -#define INSTR_PROF_DATA_ALIGNMENT 8 - -/* The data structure that represents a tracked value by the - * value profiler. - */ -typedef struct InstrProfValueData { - /* Profiled value. */ - uint64_t Value; - /* Number of times the value appears in the training run. */ - uint64_t Count; -} InstrProfValueData; - -#endif /* INSTR_PROF_DATA_INC */ - -#ifndef INSTR_ORDER_FILE_INC -/* The maximal # of functions: 128*1024 (the buffer size will be 128*4 KB). */ -#define INSTR_ORDER_FILE_BUFFER_SIZE 131072 -#define INSTR_ORDER_FILE_BUFFER_BITS 17 -#define INSTR_ORDER_FILE_BUFFER_MASK 0x1ffff -#endif /* INSTR_ORDER_FILE_INC */ -#else -#undef INSTR_PROF_DATA_DEFINED -#endif - -#undef COVMAP_V2_OR_V3 - -#ifdef INSTR_PROF_VALUE_PROF_MEMOP_API - -#ifdef __cplusplus -#define INSTR_PROF_INLINE inline -#else -#define INSTR_PROF_INLINE -#endif - -/* The value range buckets (22 buckets) for the memop size value profiling looks - * like: - * - * [0, 0] - * [1, 1] - * [2, 2] - * [3, 3] - * [4, 4] - * [5, 5] - * [6, 6] - * [7, 7] - * [8, 8] - * [9, 15] - * [16, 16] - * [17, 31] - * [32, 32] - * [33, 63] - * [64, 64] - * [65, 127] - * [128, 128] - * [129, 255] - * [256, 256] - * [257, 511] - * [512, 512] - * [513, UINT64_MAX] - * - * Each range has a 'representative value' which is the lower end value of the - * range and used to store in the runtime profile data records and the VP - * metadata. For example, it's 2 for [2, 2] and 64 for [65, 127]. - */ -#define INSTR_PROF_NUM_BUCKETS 22 - -/* - * Clz and Popcount. This code was copied from - * compiler-rt/lib/fuzzer/{FuzzerBuiltins.h,FuzzerBuiltinsMsvc.h} and - * llvm/include/llvm/Support/MathExtras.h. - */ -#if defined(_MSC_VER) && !defined(__clang__) - -#include -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -int InstProfClzll(unsigned long long X) { - unsigned long LeadZeroIdx = 0; -#if !defined(_M_ARM64) && !defined(_M_X64) - // Scan the high 32 bits. - if (_BitScanReverse(&LeadZeroIdx, (unsigned long)(X >> 32))) - return (int)(63 - (LeadZeroIdx + 32)); // Create a bit offset - // from the MSB. - // Scan the low 32 bits. - if (_BitScanReverse(&LeadZeroIdx, (unsigned long)(X))) - return (int)(63 - LeadZeroIdx); -#else - if (_BitScanReverse64(&LeadZeroIdx, X)) return 63 - LeadZeroIdx; -#endif - return 64; -} -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -int InstProfPopcountll(unsigned long long X) { - // This code originates from https://reviews.llvm.org/rG30626254510f. - unsigned long long v = X; - v = v - ((v >> 1) & 0x5555555555555555ULL); - v = (v & 0x3333333333333333ULL) + ((v >> 2) & 0x3333333333333333ULL); - v = (v + (v >> 4)) & 0x0F0F0F0F0F0F0F0FULL; - return (int)((unsigned long long)(v * 0x0101010101010101ULL) >> 56); -} - -#else - -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -int InstProfClzll(unsigned long long X) { return __builtin_clzll(X); } -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE -int InstProfPopcountll(unsigned long long X) { return __builtin_popcountll(X); } - -#endif /* defined(_MSC_VER) && !defined(__clang__) */ - -/* Map an (observed) memop size value to the representative value of its range. - * For example, 5 -> 5, 22 -> 17, 99 -> 65, 256 -> 256, 1001 -> 513. */ -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE uint64_t -InstrProfGetRangeRepValue(uint64_t Value) { - if (Value <= 8) - // The first ranges are individually tracked. Use the value as is. - return Value; - else if (Value >= 513) - // The last range is mapped to its lowest value. - return 513; - else if (InstProfPopcountll(Value) == 1) - // If it's a power of two, use it as is. - return Value; - else - // Otherwise, take to the previous power of two + 1. - return (UINT64_C(1) << (64 - InstProfClzll(Value) - 1)) + 1; -} - -/* Return true if the range that an (observed) memop size value belongs to has - * only a single value in the range. For example, 0 -> true, 8 -> true, 10 -> - * false, 64 -> true, 100 -> false, 513 -> false. */ -INSTR_PROF_VISIBILITY INSTR_PROF_INLINE unsigned -InstrProfIsSingleValRange(uint64_t Value) { - if (Value <= 8) - // The first ranges are individually tracked. - return 1; - else if (InstProfPopcountll(Value) == 1) - // If it's a power of two, there's only one value. - return 1; - else - // Otherwise, there's more than one value in the range. - return 0; -} - -#endif /* INSTR_PROF_VALUE_PROF_MEMOP_API */ diff --git a/contrib/libs/clang14-rt/include/profile/MemProfData.inc b/contrib/libs/clang14-rt/include/profile/MemProfData.inc deleted file mode 100644 index 20f8308645c1..000000000000 --- a/contrib/libs/clang14-rt/include/profile/MemProfData.inc +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef MEMPROF_DATA_INC -#define MEMPROF_DATA_INC -/*===-- MemProfData.inc - MemProf profiling runtime structures -*- C++ -*-=== *\ -|* -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -|* -\*===----------------------------------------------------------------------===*/ -/* - * This is the main file that defines all the data structure, signature, - * constant literals that are shared across profiling runtime library, - * and host tools (reader/writer). - * - * This file has two identical copies. The primary copy lives in LLVM and - * the other one sits in compiler-rt/include/profile directory. To make changes - * in this file, first modify the primary copy and copy it over to compiler-rt. - * Testing of any change in this file can start only after the two copies are - * synced up. - * -\*===----------------------------------------------------------------------===*/ - -#ifdef _MSC_VER -#define PACKED(...) __pragma(pack(push,1)) __VA_ARGS__ __pragma(pack(pop)) -#else -#define PACKED(...) __VA_ARGS__ __attribute__((__packed__)) -#endif - -// A 64-bit magic number to uniquely identify the raw binary memprof profile file. -#define MEMPROF_RAW_MAGIC_64 \ - ((uint64_t)255 << 56 | (uint64_t)'m' << 48 | (uint64_t)'p' << 40 | (uint64_t)'r' << 32 | \ - (uint64_t)'o' << 24 | (uint64_t)'f' << 16 | (uint64_t)'r' << 8 | (uint64_t)129) - -// The version number of the raw binary format. -#define MEMPROF_RAW_VERSION 1ULL - -namespace llvm { -namespace memprof { -// A struct describing the header used for the raw binary memprof profile format. -PACKED(struct Header { - uint64_t Magic; - uint64_t Version; - uint64_t TotalSize; - uint64_t SegmentOffset; - uint64_t MIBOffset; - uint64_t StackOffset; -}); - - -// A struct describing the information necessary to describe a /proc/maps -// segment entry for a particular binary/library identified by its build id. -PACKED(struct SegmentEntry { - uint64_t Start; - uint64_t End; - uint64_t Offset; - // This field is unused until sanitizer procmaps support for build ids for - // Linux-Elf is implemented. - uint8_t BuildId[32] = {0}; - - SegmentEntry(uint64_t S, uint64_t E, uint64_t O) : - Start(S), End(E), Offset(O) {} - - SegmentEntry(const SegmentEntry& S) { - Start = S.Start; - End = S.End; - Offset = S.Offset; - } - - SegmentEntry& operator=(const SegmentEntry& S) { - Start = S.Start; - End = S.End; - Offset = S.Offset; - return *this; - } - - bool operator==(const SegmentEntry& S) const { - return Start == S.Start && - End == S.End && - Offset == S.Offset; - } -}); - -// A struct representing the heap allocation characteristics of a particular -// runtime context. This struct is shared between the compiler-rt runtime and -// the raw profile reader. The indexed format uses a separate, self-describing -// backwards compatible format. -PACKED(struct MemInfoBlock { - uint32_t alloc_count; - uint64_t total_access_count, min_access_count, max_access_count; - uint64_t total_size; - uint32_t min_size, max_size; - uint32_t alloc_timestamp, dealloc_timestamp; - uint64_t total_lifetime; - uint32_t min_lifetime, max_lifetime; - uint32_t alloc_cpu_id, dealloc_cpu_id; - uint32_t num_migrated_cpu; - - // Only compared to prior deallocated object currently. - uint32_t num_lifetime_overlaps; - uint32_t num_same_alloc_cpu; - uint32_t num_same_dealloc_cpu; - - uint64_t data_type_id; // TODO: hash of type name - - MemInfoBlock() : alloc_count(0) {} - - MemInfoBlock(uint32_t size, uint64_t access_count, uint32_t alloc_timestamp, - uint32_t dealloc_timestamp, uint32_t alloc_cpu, uint32_t dealloc_cpu) - : alloc_count(1), total_access_count(access_count), - min_access_count(access_count), max_access_count(access_count), - total_size(size), min_size(size), max_size(size), - alloc_timestamp(alloc_timestamp), dealloc_timestamp(dealloc_timestamp), - total_lifetime(dealloc_timestamp - alloc_timestamp), - min_lifetime(total_lifetime), max_lifetime(total_lifetime), - alloc_cpu_id(alloc_cpu), dealloc_cpu_id(dealloc_cpu), - num_lifetime_overlaps(0), num_same_alloc_cpu(0), - num_same_dealloc_cpu(0) { - num_migrated_cpu = alloc_cpu_id != dealloc_cpu_id; - } - - void Merge(const MemInfoBlock &newMIB) { - alloc_count += newMIB.alloc_count; - - total_access_count += newMIB.total_access_count; - min_access_count = newMIB.min_access_count < min_access_count ? newMIB.min_access_count : min_access_count; - max_access_count = newMIB.max_access_count < max_access_count ? newMIB.max_access_count : max_access_count; - - total_size += newMIB.total_size; - min_size = newMIB.min_size < min_size ? newMIB.min_size : min_size; - max_size = newMIB.max_size < max_size ? newMIB.max_size : max_size; - - total_lifetime += newMIB.total_lifetime; - min_lifetime = newMIB.min_lifetime < min_lifetime ? newMIB.min_lifetime : min_lifetime; - max_lifetime = newMIB.max_lifetime > max_lifetime ? newMIB.max_lifetime : max_lifetime; - - // We know newMIB was deallocated later, so just need to check if it was - // allocated before last one deallocated. - num_lifetime_overlaps += newMIB.alloc_timestamp < dealloc_timestamp; - alloc_timestamp = newMIB.alloc_timestamp; - dealloc_timestamp = newMIB.dealloc_timestamp; - - num_same_alloc_cpu += alloc_cpu_id == newMIB.alloc_cpu_id; - num_same_dealloc_cpu += dealloc_cpu_id == newMIB.dealloc_cpu_id; - alloc_cpu_id = newMIB.alloc_cpu_id; - dealloc_cpu_id = newMIB.dealloc_cpu_id; - } -}); - -} // namespace memprof -} // namespace llvm - -#endif diff --git a/contrib/libs/clang14-rt/include/sanitizer/allocator_interface.h b/contrib/libs/clang14-rt/include/sanitizer/allocator_interface.h deleted file mode 100644 index 6226135ef84b..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/allocator_interface.h +++ /dev/null @@ -1,88 +0,0 @@ -//===-- allocator_interface.h ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Public interface header for allocator used in sanitizers (ASan/TSan/MSan). -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_ALLOCATOR_INTERFACE_H -#define SANITIZER_ALLOCATOR_INTERFACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - /* Returns the estimated number of bytes that will be reserved by allocator - for request of "size" bytes. If allocator can't allocate that much - memory, returns the maximal possible allocation size, otherwise returns - "size". */ - size_t __sanitizer_get_estimated_allocated_size(size_t size); - - /* Returns true if p was returned by the allocator and - is not yet freed. */ - int __sanitizer_get_ownership(const volatile void *p); - - /* Returns the number of bytes reserved for the pointer p. - Requires (get_ownership(p) == true) or (p == 0). */ - size_t __sanitizer_get_allocated_size(const volatile void *p); - - /* Number of bytes, allocated and not yet freed by the application. */ - size_t __sanitizer_get_current_allocated_bytes(void); - - /* Number of bytes, mmaped by the allocator to fulfill allocation requests. - Generally, for request of X bytes, allocator can reserve and add to free - lists a large number of chunks of size X to use them for future requests. - All these chunks count toward the heap size. Currently, allocator never - releases memory to OS (instead, it just puts freed chunks to free - lists). */ - size_t __sanitizer_get_heap_size(void); - - /* Number of bytes, mmaped by the allocator, which can be used to fulfill - allocation requests. When a user program frees memory chunk, it can first - fall into quarantine and will count toward __sanitizer_get_free_bytes() - later. */ - size_t __sanitizer_get_free_bytes(void); - - /* Number of bytes in unmapped pages, that are released to OS. Currently, - always returns 0. */ - size_t __sanitizer_get_unmapped_bytes(void); - - /* Malloc hooks that may be optionally provided by user. - __sanitizer_malloc_hook(ptr, size) is called immediately after - allocation of "size" bytes, which returned "ptr". - __sanitizer_free_hook(ptr) is called immediately before - deallocation of "ptr". */ - void __sanitizer_malloc_hook(const volatile void *ptr, size_t size); - void __sanitizer_free_hook(const volatile void *ptr); - - /* Installs a pair of hooks for malloc/free. - Several (currently, 5) hook pairs may be installed, they are executed - in the order they were installed and after calling - __sanitizer_malloc_hook/__sanitizer_free_hook. - Unlike __sanitizer_malloc_hook/__sanitizer_free_hook these hooks can be - chained and do not rely on weak symbols working on the platform, but - require __sanitizer_install_malloc_and_free_hooks to be called at startup - and thus will not be called on malloc/free very early in the process. - Returns the number of hooks currently installed or 0 on failure. - Not thread-safe, should be called in the main thread before starting - other threads. - */ - int __sanitizer_install_malloc_and_free_hooks( - void (*malloc_hook)(const volatile void *, size_t), - void (*free_hook)(const volatile void *)); - - /* Drains allocator quarantines (calling thread's and global ones), returns - freed memory back to OS and releases other non-essential internal allocator - resources in attempt to reduce process RSS. - Currently available with ASan only. - */ - void __sanitizer_purge_allocator(void); -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/contrib/libs/clang14-rt/include/sanitizer/asan_interface.h b/contrib/libs/clang14-rt/include/sanitizer/asan_interface.h deleted file mode 100644 index 9bff21c117b3..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/asan_interface.h +++ /dev/null @@ -1,326 +0,0 @@ -//===-- sanitizer/asan_interface.h ------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer (ASan). -// -// Public interface header. -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_ASAN_INTERFACE_H -#define SANITIZER_ASAN_INTERFACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif -/// Marks a memory region ([addr, addr+size)) as unaddressable. -/// -/// This memory must be previously allocated by your program. Instrumented -/// code is forbidden from accessing addresses in this region until it is -/// unpoisoned. This function is not guaranteed to poison the entire region - -/// it could poison only a subregion of [addr, addr+size) due to ASan -/// alignment restrictions. -/// -/// \note This function is not thread-safe because no two threads can poison or -/// unpoison memory in the same memory region simultaneously. -/// -/// \param addr Start of memory region. -/// \param size Size of memory region. -void __asan_poison_memory_region(void const volatile *addr, size_t size); - -/// Marks a memory region ([addr, addr+size)) as addressable. -/// -/// This memory must be previously allocated by your program. Accessing -/// addresses in this region is allowed until this region is poisoned again. -/// This function could unpoison a super-region of [addr, addr+size) due -/// to ASan alignment restrictions. -/// -/// \note This function is not thread-safe because no two threads can -/// poison or unpoison memory in the same memory region simultaneously. -/// -/// \param addr Start of memory region. -/// \param size Size of memory region. -void __asan_unpoison_memory_region(void const volatile *addr, size_t size); - -// Macros provided for convenience. -#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) -/// Marks a memory region as unaddressable. -/// -/// \note Macro provided for convenience; defined as a no-op if ASan is not -/// enabled. -/// -/// \param addr Start of memory region. -/// \param size Size of memory region. -#define ASAN_POISON_MEMORY_REGION(addr, size) \ - __asan_poison_memory_region((addr), (size)) - -/// Marks a memory region as addressable. -/// -/// \note Macro provided for convenience; defined as a no-op if ASan is not -/// enabled. -/// -/// \param addr Start of memory region. -/// \param size Size of memory region. -#define ASAN_UNPOISON_MEMORY_REGION(addr, size) \ - __asan_unpoison_memory_region((addr), (size)) -#else -#define ASAN_POISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) -#define ASAN_UNPOISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) -#endif - -/// Checks if an address is poisoned. -/// -/// Returns 1 if addr is poisoned (that is, 1-byte read/write -/// access to this address would result in an error report from ASan). -/// Otherwise returns 0. -/// -/// \param addr Address to check. -/// -/// \retval 1 Address is poisoned. -/// \retval 0 Address is not poisoned. -int __asan_address_is_poisoned(void const volatile *addr); - -/// Checks if a region is poisoned. -/// -/// If at least one byte in [beg, beg+size) is poisoned, returns the -/// address of the first such byte. Otherwise returns 0. -/// -/// \param beg Start of memory region. -/// \param size Start of memory region. -/// \returns Address of first poisoned byte. -void *__asan_region_is_poisoned(void *beg, size_t size); - -/// Describes an address (useful for calling from the debugger). -/// -/// Prints the description of addr. -/// -/// \param addr Address to describe. -void __asan_describe_address(void *addr); - -/// Checks if an error has been or is being reported (useful for calling from -/// the debugger to get information about an ASan error). -/// -/// Returns 1 if an error has been (or is being) reported. Otherwise returns 0. -/// -/// \returns 1 if an error has been (or is being) reported. Otherwise returns -/// 0. -int __asan_report_present(void); - -/// Gets the PC (program counter) register value of an ASan error (useful for -/// calling from the debugger). -/// -/// Returns PC if an error has been (or is being) reported. -/// Otherwise returns 0. -/// -/// \returns PC value. -void *__asan_get_report_pc(void); - -/// Gets the BP (base pointer) register value of an ASan error (useful for -/// calling from the debugger). -/// -/// Returns BP if an error has been (or is being) reported. -/// Otherwise returns 0. -/// -/// \returns BP value. -void *__asan_get_report_bp(void); - -/// Gets the SP (stack pointer) register value of an ASan error (useful for -/// calling from the debugger). -/// -/// If an error has been (or is being) reported, returns SP. -/// Otherwise returns 0. -/// -/// \returns SP value. -void *__asan_get_report_sp(void); - -/// Gets the address of the report buffer of an ASan error (useful for calling -/// from the debugger). -/// -/// Returns the address of the report buffer if an error has been (or is being) -/// reported. Otherwise returns 0. -/// -/// \returns Address of report buffer. -void *__asan_get_report_address(void); - -/// Gets access type of an ASan error (useful for calling from the debugger). -/// -/// Returns access type (read or write) if an error has been (or is being) -/// reported. Otherwise returns 0. -/// -/// \returns Access type (0 = read, 1 = write). -int __asan_get_report_access_type(void); - -/// Gets access size of an ASan error (useful for calling from the debugger). -/// -/// Returns access size if an error has been (or is being) reported. Otherwise -/// returns 0. -/// -/// \returns Access size in bytes. -size_t __asan_get_report_access_size(void); - -/// Gets the bug description of an ASan error (useful for calling from a -/// debugger). -/// -/// \returns Returns a bug description if an error has been (or is being) -/// reported - for example, "heap-use-after-free". Otherwise returns an empty -/// string. -const char *__asan_get_report_description(void); - -/// Gets information about a pointer (useful for calling from the debugger). -/// -/// Returns the category of the given pointer as a constant string. -/// Possible return values are global, stack, stack-fake, -/// heap, heap-invalid, shadow-low, shadow-gap, -/// shadow-high, and unknown. -/// -/// If the return value is global or stack, tries to also return -/// the variable name, address, and size. If the return value is heap, -/// tries to return the chunk address and size. name should point -/// to an allocated buffer of size name_size. -/// -/// \param addr Address to locate. -/// \param name Buffer to store the variable's name. -/// \param name_size Size in bytes of the variable's name buffer. -/// \param[out] region_address Address of the region. -/// \param[out] region_size Size of the region in bytes. -/// -/// \returns Returns the category of the given pointer as a constant string. -const char *__asan_locate_address(void *addr, char *name, size_t name_size, - void **region_address, size_t *region_size); - -/// Gets the allocation stack trace and thread ID for a heap address (useful -/// for calling from the debugger). -/// -/// Stores up to size frames in trace. Returns -/// the number of stored frames or 0 on error. -/// -/// \param addr A heap address. -/// \param trace A buffer to store the stack trace. -/// \param size Size in bytes of the trace buffer. -/// \param[out] thread_id The thread ID of the address. -/// -/// \returns Returns the number of stored frames or 0 on error. -size_t __asan_get_alloc_stack(void *addr, void **trace, size_t size, - int *thread_id); - -/// Gets the free stack trace and thread ID for a heap address (useful for -/// calling from the debugger). -/// -/// Stores up to size frames in trace. Returns -/// the number of stored frames or 0 on error. -/// -/// \param addr A heap address. -/// \param trace A buffer to store the stack trace. -/// \param size Size in bytes of the trace buffer. -/// \param[out] thread_id The thread ID of the address. -/// -/// \returns Returns the number of stored frames or 0 on error. -size_t __asan_get_free_stack(void *addr, void **trace, size_t size, - int *thread_id); - -/// Gets the current shadow memory mapping (useful for calling from the -/// debugger). -/// -/// \param[out] shadow_scale Shadow scale value. -/// \param[out] shadow_offset Offset value. -void __asan_get_shadow_mapping(size_t *shadow_scale, size_t *shadow_offset); - -/// This is an internal function that is called to report an error. However, -/// it is still a part of the interface because you might want to set a -/// breakpoint on this function in the debugger. -/// -/// \param pc pc value of the ASan error. -/// \param bp bp value of the ASan error. -/// \param sp sp value of the ASan error. -/// \param addr Address of the ASan error. -/// \param is_write True if the error is a write error; false otherwise. -/// \param access_size Size of the memory access of the ASan error. -void __asan_report_error(void *pc, void *bp, void *sp, - void *addr, int is_write, size_t access_size); - -// Deprecated. Call __sanitizer_set_death_callback instead. -void __asan_set_death_callback(void (*callback)(void)); - -/// Sets the callback function to be called during ASan error reporting. -/// -/// The callback provides a string pointer to the report. -/// -/// \param callback User-provided function. -void __asan_set_error_report_callback(void (*callback)(const char *)); - -/// User-provided callback on ASan errors. -/// -/// You can provide a function that would be called immediately when ASan -/// detects an error. This is useful in cases when ASan detects an error but -/// your program crashes before the ASan report is printed. -void __asan_on_error(void); - -/// Prints accumulated statistics to stderr (useful for calling from the -/// debugger). -void __asan_print_accumulated_stats(void); - -/// User-provided default option settings. -/// -/// You can provide your own implementation of this function to return a string -/// containing ASan runtime options (for example, -/// verbosity=1:halt_on_error=0). -/// -/// \returns Default options string. -const char* __asan_default_options(void); - -// The following two functions facilitate garbage collection in presence of -// ASan's fake stack. - -/// Gets an opaque handler to the current thread's fake stack. -/// -/// Returns an opaque handler to be used by -/// __asan_addr_is_in_fake_stack(). Returns NULL if the current thread -/// does not have a fake stack. -/// -/// \returns An opaque handler to the fake stack or NULL. -void *__asan_get_current_fake_stack(void); - -/// Checks if an address belongs to a given fake stack. -/// -/// If fake_stack is non-NULL and addr belongs to a -/// fake frame in fake_stack, returns the address of the real -/// stack that corresponds to the fake frame and sets beg and -/// end to the boundaries of this fake frame. Otherwise returns -/// NULL and does not touch beg and end. -/// -/// If beg or end are NULL, they are not touched. -/// -/// \note This function can be called from a thread other than the owner of -/// fake_stack, but the owner thread needs to be alive. -/// -/// \param fake_stack An opaque handler to a fake stack. -/// \param addr Address to test. -/// \param[out] beg Beginning of fake frame. -/// \param[out] end End of fake frame. -/// \returns Stack address or NULL. -void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg, - void **end); - -/// Performs shadow memory cleanup of the current thread's stack before a -/// function marked with the [[noreturn]] attribute is called. -/// -/// To avoid false positives on the stack, must be called before no-return -/// functions like _exit() and execl(). -void __asan_handle_no_return(void); - -/// Update allocation stack trace for the given allocation to the current stack -/// trace. Returns 1 if successful, 0 if not. -int __asan_update_allocation_context(void* addr); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_ASAN_INTERFACE_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/common_interface_defs.h b/contrib/libs/clang14-rt/include/sanitizer/common_interface_defs.h deleted file mode 100644 index ba58ad46f32d..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/common_interface_defs.h +++ /dev/null @@ -1,366 +0,0 @@ -//===-- sanitizer/common_interface_defs.h -----------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Common part of the public sanitizer interface. -//===----------------------------------------------------------------------===// - -#ifndef SANITIZER_COMMON_INTERFACE_DEFS_H -#define SANITIZER_COMMON_INTERFACE_DEFS_H - -#include -#include - -// GCC does not understand __has_feature. -#if !defined(__has_feature) -#define __has_feature(x) 0 -#endif - -#ifdef __cplusplus -extern "C" { -#endif -// Arguments for __sanitizer_sandbox_on_notify() below. -typedef struct { - // Enable sandbox support in sanitizer coverage. - int coverage_sandboxed; - // File descriptor to write coverage data to. If -1 is passed, a file will - // be pre-opened by __sanitizer_sandbox_on_notify(). This field has no - // effect if coverage_sandboxed == 0. - intptr_t coverage_fd; - // If non-zero, split the coverage data into well-formed blocks. This is - // useful when coverage_fd is a socket descriptor. Each block will contain - // a header, allowing data from multiple processes to be sent over the same - // socket. - unsigned int coverage_max_block_size; -} __sanitizer_sandbox_arguments; - -// Tell the tools to write their reports to "path." instead of stderr. -void __sanitizer_set_report_path(const char *path); -// Tell the tools to write their reports to the provided file descriptor -// (casted to void *). -void __sanitizer_set_report_fd(void *fd); -// Get the current full report file path, if a path was specified by -// an earlier call to __sanitizer_set_report_path. Returns null otherwise. -const char *__sanitizer_get_report_path(); - -// Notify the tools that the sandbox is going to be turned on. The reserved -// parameter will be used in the future to hold a structure with functions -// that the tools may call to bypass the sandbox. -void __sanitizer_sandbox_on_notify(__sanitizer_sandbox_arguments *args); - -// This function is called by the tool when it has just finished reporting -// an error. 'error_summary' is a one-line string that summarizes -// the error message. This function can be overridden by the client. -void __sanitizer_report_error_summary(const char *error_summary); - -// Some of the sanitizers (for example ASan/TSan) could miss bugs that happen -// in unaligned loads/stores. To find such bugs reliably, you need to replace -// plain unaligned loads/stores with these calls. - -/// Loads a 16-bit unaligned value. -/// -/// \param p Pointer to unaligned memory. -/// -/// \returns Loaded value. -uint16_t __sanitizer_unaligned_load16(const void *p); - -/// Loads a 32-bit unaligned value. -/// -/// \param p Pointer to unaligned memory. -/// -/// \returns Loaded value. -uint32_t __sanitizer_unaligned_load32(const void *p); - -/// Loads a 64-bit unaligned value. -/// -/// \param p Pointer to unaligned memory. -/// -/// \returns Loaded value. -uint64_t __sanitizer_unaligned_load64(const void *p); - -/// Stores a 16-bit unaligned value. -/// -/// \param p Pointer to unaligned memory. -/// \param x 16-bit value to store. -void __sanitizer_unaligned_store16(void *p, uint16_t x); - -/// Stores a 32-bit unaligned value. -/// -/// \param p Pointer to unaligned memory. -/// \param x 32-bit value to store. -void __sanitizer_unaligned_store32(void *p, uint32_t x); - -/// Stores a 64-bit unaligned value. -/// -/// \param p Pointer to unaligned memory. -/// \param x 64-bit value to store. -void __sanitizer_unaligned_store64(void *p, uint64_t x); - -// Returns 1 on the first call, then returns 0 thereafter. Called by the tool -// to ensure only one report is printed when multiple errors occur -// simultaneously. -int __sanitizer_acquire_crash_state(); - -/// Annotates the current state of a contiguous container, such as -/// std::vector, std::string, or similar. -/// -/// A contiguous container is a container that keeps all of its elements -/// in a contiguous region of memory. The container owns the region of memory -/// [beg, end); the memory [beg, mid) is used to store the -/// current elements, and the memory [mid, end) is reserved for future -/// elements (beg <= mid <= end). For example, in -/// std::vector<> v: -/// -/// \code -/// beg = &v[0]; -/// end = beg + v.capacity() * sizeof(v[0]); -/// mid = beg + v.size() * sizeof(v[0]); -/// \endcode -/// -/// This annotation tells the Sanitizer tool about the current state of the -/// container so that the tool can report errors when memory from -/// [mid, end) is accessed. Insert this annotation into methods like -/// push_back() or pop_back(). Supply the old and new values of -/// mid(old_mid and new_mid). In the initial -/// state mid == end, so that should be the final state when the -/// container is destroyed or when the container reallocates the storage. -/// -/// For ASan, beg should be 8-aligned and end -/// should be either 8-aligned or it should point to the end of a separate -/// heap-, stack-, or global-allocated buffer. So the following example will -/// not work: -/// -/// \code -/// int64_t x[2]; // 16 bytes, 8-aligned -/// char *beg = (char *)&x[0]; -/// char *end = beg + 12; // Not 8-aligned, not the end of the buffer -/// \endcode -/// -/// The following, however, will work: -/// \code -/// int32_t x[3]; // 12 bytes, but 8-aligned under ASan. -/// char *beg = (char*)&x[0]; -/// char *end = beg + 12; // Not 8-aligned, but is the end of the buffer -/// \endcode -/// -/// \note Use this function with caution and do not use for anything other -/// than vector-like classes. -/// -/// \param beg Beginning of memory region. -/// \param end End of memory region. -/// \param old_mid Old middle of memory region. -/// \param new_mid New middle of memory region. -void __sanitizer_annotate_contiguous_container(const void *beg, - const void *end, - const void *old_mid, - const void *new_mid); - -/// Returns true if the contiguous container [beg, end) is properly -/// poisoned. -/// -/// Proper poisoning could occur, for example, with -/// __sanitizer_annotate_contiguous_container), that is, if -/// [beg, mid) is addressable and [mid, end) is unaddressable. -/// Full verification requires O (end - beg) time; this function tries -/// to avoid such complexity by touching only parts of the container around -/// beg, mid, and end. -/// -/// \param beg Beginning of memory region. -/// \param mid Middle of memory region. -/// \param end Old end of memory region. -/// -/// \returns True if the contiguous container [beg, end) is properly -/// poisoned. -int __sanitizer_verify_contiguous_container(const void *beg, const void *mid, - const void *end); - -/// Similar to __sanitizer_verify_contiguous_container() but also -/// returns the address of the first improperly poisoned byte. -/// -/// Returns NULL if the area is poisoned properly. -/// -/// \param beg Beginning of memory region. -/// \param mid Middle of memory region. -/// \param end Old end of memory region. -/// -/// \returns The bad address or NULL. -const void *__sanitizer_contiguous_container_find_bad_address(const void *beg, - const void *mid, - const void *end); - -/// Prints the stack trace leading to this call (useful for calling from the -/// debugger). -void __sanitizer_print_stack_trace(void); - -// Symbolizes the supplied 'pc' using the format string 'fmt'. -// Outputs at most 'out_buf_size' bytes into 'out_buf'. -// If 'out_buf' is not empty then output is zero or more non empty C strings -// followed by single empty C string. Multiple strings can be returned if PC -// corresponds to inlined function. Inlined frames are printed in the order -// from "most-inlined" to the "least-inlined", so the last frame should be the -// not inlined function. -// Inlined frames can be removed with 'symbolize_inline_frames=0'. -// The format syntax is described in -// lib/sanitizer_common/sanitizer_stacktrace_printer.h. -void __sanitizer_symbolize_pc(void *pc, const char *fmt, char *out_buf, - size_t out_buf_size); -// Same as __sanitizer_symbolize_pc, but for data section (i.e. globals). -void __sanitizer_symbolize_global(void *data_ptr, const char *fmt, - char *out_buf, size_t out_buf_size); -// Determine the return address. -#if !defined(_MSC_VER) || defined(__clang__) -#define __sanitizer_return_address() \ - __builtin_extract_return_addr(__builtin_return_address(0)) -#else -extern "C" void *_ReturnAddress(void); -#pragma intrinsic(_ReturnAddress) -#define __sanitizer_return_address() _ReturnAddress() -#endif - -/// Sets the callback to be called immediately before death on error. -/// -/// Passing 0 will unset the callback. -/// -/// \param callback User-provided callback. -void __sanitizer_set_death_callback(void (*callback)(void)); - - -// Interceptor hooks. -// Whenever a libc function interceptor is called, it checks if the -// corresponding weak hook is defined, and calls it if it is indeed defined. -// The primary use-case is data-flow-guided fuzzing, where the fuzzer needs -// to know what is being passed to libc functions (for example memcmp). -// FIXME: implement more hooks. - -/// Interceptor hook for memcmp(). -/// -/// \param called_pc PC (program counter) address of the original call. -/// \param s1 Pointer to block of memory. -/// \param s2 Pointer to block of memory. -/// \param n Number of bytes to compare. -/// \param result Value returned by the intercepted function. -void __sanitizer_weak_hook_memcmp(void *called_pc, const void *s1, - const void *s2, size_t n, int result); - -/// Interceptor hook for strncmp(). -/// -/// \param called_pc PC (program counter) address of the original call. -/// \param s1 Pointer to block of memory. -/// \param s2 Pointer to block of memory. -/// \param n Number of bytes to compare. -/// \param result Value returned by the intercepted function. -void __sanitizer_weak_hook_strncmp(void *called_pc, const char *s1, - const char *s2, size_t n, int result); - -/// Interceptor hook for strncasecmp(). -/// -/// \param called_pc PC (program counter) address of the original call. -/// \param s1 Pointer to block of memory. -/// \param s2 Pointer to block of memory. -/// \param n Number of bytes to compare. -/// \param result Value returned by the intercepted function. -void __sanitizer_weak_hook_strncasecmp(void *called_pc, const char *s1, - const char *s2, size_t n, int result); - -/// Interceptor hook for strcmp(). -/// -/// \param called_pc PC (program counter) address of the original call. -/// \param s1 Pointer to block of memory. -/// \param s2 Pointer to block of memory. -/// \param result Value returned by the intercepted function. -void __sanitizer_weak_hook_strcmp(void *called_pc, const char *s1, - const char *s2, int result); - -/// Interceptor hook for strcasecmp(). -/// -/// \param called_pc PC (program counter) address of the original call. -/// \param s1 Pointer to block of memory. -/// \param s2 Pointer to block of memory. -/// \param result Value returned by the intercepted function. -void __sanitizer_weak_hook_strcasecmp(void *called_pc, const char *s1, - const char *s2, int result); - -/// Interceptor hook for strstr(). -/// -/// \param called_pc PC (program counter) address of the original call. -/// \param s1 Pointer to block of memory. -/// \param s2 Pointer to block of memory. -/// \param result Value returned by the intercepted function. -void __sanitizer_weak_hook_strstr(void *called_pc, const char *s1, - const char *s2, char *result); - -void __sanitizer_weak_hook_strcasestr(void *called_pc, const char *s1, - const char *s2, char *result); - -void __sanitizer_weak_hook_memmem(void *called_pc, - const void *s1, size_t len1, - const void *s2, size_t len2, void *result); - -// Prints stack traces for all live heap allocations ordered by total -// allocation size until top_percent of total live heap is shown. top_percent -// should be between 1 and 100. At most max_number_of_contexts contexts -// (stack traces) are printed. -// Experimental feature currently available only with ASan on Linux/x86_64. -void __sanitizer_print_memory_profile(size_t top_percent, - size_t max_number_of_contexts); - -/// Notify ASan that a fiber switch has started (required only if implementing -/// your own fiber library). -/// -/// Before switching to a different stack, you must call -/// __sanitizer_start_switch_fiber() with a pointer to the bottom of the -/// destination stack and with its size. When code starts running on the new -/// stack, it must call __sanitizer_finish_switch_fiber() to finalize -/// the switch. The __sanitizer_start_switch_fiber() function takes a -/// void** pointer argument to store the current fake stack if there is -/// one (it is necessary when the runtime option -/// detect_stack_use_after_return is enabled). -/// -/// When restoring a stack, this void** pointer must be given to the -/// __sanitizer_finish_switch_fiber() function. In most cases, this -/// pointer can be stored on the stack immediately before switching. When -/// leaving a fiber definitely, NULL must be passed as the first argument to -/// the __sanitizer_start_switch_fiber() function so that the fake stack -/// is destroyed. If your program does not need stack use-after-return -/// detection, you can always pass NULL to these two functions. -/// -/// \note The fake stack mechanism is disabled during fiber switch, so if a -/// signal callback runs during the switch, it will not benefit from stack -/// use-after-return detection. -/// -/// \param[out] fake_stack_save Fake stack save location. -/// \param bottom Bottom address of stack. -/// \param size Size of stack in bytes. -void __sanitizer_start_switch_fiber(void **fake_stack_save, - const void *bottom, size_t size); - -/// Notify ASan that a fiber switch has completed (required only if -/// implementing your own fiber library). -/// -/// When code starts running on the new stack, it must call -/// __sanitizer_finish_switch_fiber() to finalize -/// the switch. For usage details, see the description of -/// __sanitizer_start_switch_fiber(). -/// -/// \param fake_stack_save Fake stack save location. -/// \param[out] bottom_old Bottom address of old stack. -/// \param[out] size_old Size of old stack in bytes. -void __sanitizer_finish_switch_fiber(void *fake_stack_save, - const void **bottom_old, - size_t *size_old); - -// Get full module name and calculate pc offset within it. -// Returns 1 if pc belongs to some module, 0 if module was not found. -int __sanitizer_get_module_and_offset_for_pc(void *pc, char *module_path, - size_t module_path_len, - void **pc_offset); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_COMMON_INTERFACE_DEFS_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/coverage_interface.h b/contrib/libs/clang14-rt/include/sanitizer/coverage_interface.h deleted file mode 100644 index c063cfe60c5b..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/coverage_interface.h +++ /dev/null @@ -1,35 +0,0 @@ -//===-- sanitizer/coverage_interface.h --------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Public interface for sanitizer coverage. -//===----------------------------------------------------------------------===// - -#ifndef SANITIZER_COVERAG_INTERFACE_H -#define SANITIZER_COVERAG_INTERFACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - // Record and dump coverage info. - void __sanitizer_cov_dump(void); - - // Clear collected coverage info. - void __sanitizer_cov_reset(void); - - // Dump collected coverage info. Sorts pcs by module into individual .sancov - // files. - void __sanitizer_dump_coverage(const uintptr_t *pcs, uintptr_t len); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_COVERAG_INTERFACE_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/dfsan_interface.h b/contrib/libs/clang14-rt/include/sanitizer/dfsan_interface.h deleted file mode 100644 index 8e581a67572d..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/dfsan_interface.h +++ /dev/null @@ -1,187 +0,0 @@ -//===-- dfsan_interface.h -------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// Public interface header. -//===----------------------------------------------------------------------===// -#ifndef DFSAN_INTERFACE_H -#define DFSAN_INTERFACE_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef uint8_t dfsan_label; -typedef uint32_t dfsan_origin; - -/// Signature of the callback argument to dfsan_set_write_callback(). -typedef void (*dfsan_write_callback_t)(int fd, const void *buf, size_t count); - -/// Signature of the callback argument to dfsan_set_conditional_callback(). -typedef void (*dfsan_conditional_callback_t)(dfsan_label label, - dfsan_origin origin); - -/// Computes the union of \c l1 and \c l2, resulting in a union label. -dfsan_label dfsan_union(dfsan_label l1, dfsan_label l2); - -/// Sets the label for each address in [addr,addr+size) to \c label. -void dfsan_set_label(dfsan_label label, void *addr, size_t size); - -/// Sets the label for each address in [addr,addr+size) to the union of the -/// current label for that address and \c label. -void dfsan_add_label(dfsan_label label, void *addr, size_t size); - -/// Retrieves the label associated with the given data. -/// -/// The type of 'data' is arbitrary. The function accepts a value of any type, -/// which can be truncated or extended (implicitly or explicitly) as necessary. -/// The truncation/extension operations will preserve the label of the original -/// value. -dfsan_label dfsan_get_label(long data); - -/// Retrieves the immediate origin associated with the given data. The returned -/// origin may point to another origin. -/// -/// The type of 'data' is arbitrary. -dfsan_origin dfsan_get_origin(long data); - -/// Retrieves the label associated with the data at the given address. -dfsan_label dfsan_read_label(const void *addr, size_t size); - -/// Return the origin associated with the first taint byte in the size bytes -/// from the address addr. -dfsan_origin dfsan_read_origin_of_first_taint(const void *addr, size_t size); - -/// Returns whether the given label label contains the label elem. -int dfsan_has_label(dfsan_label label, dfsan_label elem); - -/// Flushes the DFSan shadow, i.e. forgets about all labels currently associated -/// with the application memory. Use this call to start over the taint tracking -/// within the same process. -/// -/// Note: If another thread is working with tainted data during the flush, that -/// taint could still be written to shadow after the flush. -void dfsan_flush(void); - -/// Sets a callback to be invoked on calls to write(). The callback is invoked -/// before the write is done. The write is not guaranteed to succeed when the -/// callback executes. Pass in NULL to remove any callback. -void dfsan_set_write_callback(dfsan_write_callback_t labeled_write_callback); - -/// Sets a callback to be invoked on any conditional expressions which have a -/// taint label set. This can be used to find where tainted data influences -/// the behavior of the program. -/// These callbacks will only be added when -dfsan-conditional-callbacks=true. -void dfsan_set_conditional_callback(dfsan_conditional_callback_t callback); - -/// Conditional expressions occur during signal handlers. -/// Making callbacks that handle signals well is tricky, so when -/// -dfsan-conditional-callbacks=true, conditional expressions used in signal -/// handlers will add the labels they see into a global (bitwise-or together). -/// This function returns all label bits seen in signal handler conditions. -dfsan_label dfsan_get_labels_in_signal_conditional(); - -/// Interceptor hooks. -/// Whenever a dfsan's custom function is called the corresponding -/// hook is called it non-zero. The hooks should be defined by the user. -/// The primary use case is taint-guided fuzzing, where the fuzzer -/// needs to see the parameters of the function and the labels. -/// FIXME: implement more hooks. -void dfsan_weak_hook_memcmp(void *caller_pc, const void *s1, const void *s2, - size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label); -void dfsan_weak_hook_strncmp(void *caller_pc, const char *s1, const char *s2, - size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label); - -/// Prints the origin trace of the label at the address addr to stderr. It also -/// prints description at the beginning of the trace. If origin tracking is not -/// on, or the address is not labeled, it prints nothing. -void dfsan_print_origin_trace(const void *addr, const char *description); -/// As above, but use an origin id from dfsan_get_origin() instead of address. -/// Does not include header line with taint label and address information. -void dfsan_print_origin_id_trace(dfsan_origin origin); - -/// Prints the origin trace of the label at the address \p addr to a -/// pre-allocated output buffer. If origin tracking is not on, or the address is -/// not labeled, it prints nothing. -/// -/// Typical usage: -/// \code -/// char kDescription[] = "..."; -/// char buf[1024]; -/// dfsan_sprint_origin_trace(&tainted_var, kDescription, buf, sizeof(buf)); -/// \endcode -/// -/// Typical usage that handles truncation: -/// \code -/// char buf[1024]; -/// int len = dfsan_sprint_origin_trace(&var, nullptr, buf, sizeof(buf)); -/// -/// if (len < sizeof(buf)) { -/// ProcessOriginTrace(buf); -/// } else { -/// char *tmpbuf = new char[len + 1]; -/// dfsan_sprint_origin_trace(&var, nullptr, tmpbuf, len + 1); -/// ProcessOriginTrace(tmpbuf); -/// delete[] tmpbuf; -/// } -/// \endcode -/// -/// \param addr The tainted memory address whose origin we are printing. -/// \param description A description printed at the beginning of the trace. -/// \param [out] out_buf The output buffer to write the results to. -/// \param out_buf_size The size of \p out_buf. -/// -/// \returns The number of symbols that should have been written to \p out_buf -/// (not including trailing null byte '\0'). Thus, the string is truncated iff -/// return value is not less than \p out_buf_size. -size_t dfsan_sprint_origin_trace(const void *addr, const char *description, - char *out_buf, size_t out_buf_size); -/// As above, but use an origin id from dfsan_get_origin() instead of address. -/// Does not include header line with taint label and address information. -size_t dfsan_sprint_origin_id_trace(dfsan_origin origin, char *out_buf, - size_t out_buf_size); - -/// Prints the stack trace leading to this call to a pre-allocated output -/// buffer. -/// -/// For usage examples, see dfsan_sprint_origin_trace. -/// -/// \param [out] out_buf The output buffer to write the results to. -/// \param out_buf_size The size of \p out_buf. -/// -/// \returns The number of symbols that should have been written to \p out_buf -/// (not including trailing null byte '\0'). Thus, the string is truncated iff -/// return value is not less than \p out_buf_size. -size_t dfsan_sprint_stack_trace(char *out_buf, size_t out_buf_size); - -/// Retrieves the very first origin associated with the data at the given -/// address. -dfsan_origin dfsan_get_init_origin(const void *addr); - -/// Returns the value of -dfsan-track-origins. -/// * 0: do not track origins. -/// * 1: track origins at memory store operations. -/// * 2: track origins at memory load and store operations. -int dfsan_get_track_origins(void); -#ifdef __cplusplus -} // extern "C" - -template void dfsan_set_label(dfsan_label label, T &data) { - dfsan_set_label(label, (void *)&data, sizeof(T)); -} - -#endif - -#endif // DFSAN_INTERFACE_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/hwasan_interface.h b/contrib/libs/clang14-rt/include/sanitizer/hwasan_interface.h deleted file mode 100644 index 14035c05c635..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/hwasan_interface.h +++ /dev/null @@ -1,99 +0,0 @@ -//===-- sanitizer/asan_interface.h ------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Public interface header. -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_HWASAN_INTERFACE_H -#define SANITIZER_HWASAN_INTERFACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - // Libc hook for program startup in statically linked executables. - // Initializes enough of the runtime to run instrumented code. This function - // should only be called in statically linked executables because it modifies - // the GOT, which won't work in regular binaries because RELRO will already - // have been applied by the time the function is called. This also means that - // the function should be called before libc applies RELRO. - // Does not call libc unless there is an error. - // Can be called multiple times. - void __hwasan_init_static(void); - - // This function may be optionally provided by user and should return - // a string containing HWASan runtime options. See asan_flags.h for details. - const char* __hwasan_default_options(void); - - void __hwasan_enable_allocator_tagging(void); - void __hwasan_disable_allocator_tagging(void); - - // Mark region of memory with the given tag. Both address and size need to be - // 16-byte aligned. - void __hwasan_tag_memory(const volatile void *p, unsigned char tag, - size_t size); - - /// Set pointer tag. Previous tag is lost. - void *__hwasan_tag_pointer(const volatile void *p, unsigned char tag); - - // Set memory tag from the current SP address to the given address to zero. - // This is meant to annotate longjmp and other non-local jumps. - // This function needs to know the (almost) exact destination frame address; - // clearing shadow for the entire thread stack like __asan_handle_no_return - // does would cause false reports. - void __hwasan_handle_longjmp(const void *sp_dst); - - // Set memory tag for the part of the current thread stack below sp_dst to - // zero. Call this in vfork() before returning in the parent process. - void __hwasan_handle_vfork(const void *sp_dst); - - // Libc hook for thread creation. Should be called in the child thread before - // any instrumented code. - void __hwasan_thread_enter(); - - // Libc hook for thread destruction. No instrumented code should run after - // this call. - void __hwasan_thread_exit(); - - // Print shadow and origin for the memory range to stderr in a human-readable - // format. - void __hwasan_print_shadow(const volatile void *x, size_t size); - - // Print one-line report about the memory usage of the current process. - void __hwasan_print_memory_usage(); - - /* Returns the offset of the first byte in the memory range that can not be - * accessed through the pointer in x, or -1 if the whole range is good. */ - intptr_t __hwasan_test_shadow(const volatile void *x, size_t size); - - /* Sets the callback function to be called during HWASan error reporting. */ - void __hwasan_set_error_report_callback(void (*callback)(const char *)); - - int __sanitizer_posix_memalign(void **memptr, size_t alignment, size_t size); - void * __sanitizer_memalign(size_t alignment, size_t size); - void * __sanitizer_aligned_alloc(size_t alignment, size_t size); - void * __sanitizer___libc_memalign(size_t alignment, size_t size); - void * __sanitizer_valloc(size_t size); - void * __sanitizer_pvalloc(size_t size); - void __sanitizer_free(void *ptr); - void __sanitizer_cfree(void *ptr); - size_t __sanitizer_malloc_usable_size(const void *ptr); - struct mallinfo __sanitizer_mallinfo(); - int __sanitizer_mallopt(int cmd, int value); - void __sanitizer_malloc_stats(void); - void * __sanitizer_calloc(size_t nmemb, size_t size); - void * __sanitizer_realloc(void *ptr, size_t size); - void * __sanitizer_reallocarray(void *ptr, size_t nmemb, size_t size); - void * __sanitizer_malloc(size_t size); -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_HWASAN_INTERFACE_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/linux_syscall_hooks.h b/contrib/libs/clang14-rt/include/sanitizer/linux_syscall_hooks.h deleted file mode 100644 index 3f3f1e78dfb8..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/linux_syscall_hooks.h +++ /dev/null @@ -1,3100 +0,0 @@ -//===-- linux_syscall_hooks.h ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of public sanitizer interface. -// -// System call handlers. -// -// Interface methods declared in this header implement pre- and post- syscall -// actions for the active sanitizer. -// Usage: -// __sanitizer_syscall_pre_getfoo(...args...); -// long res = syscall(__NR_getfoo, ...args...); -// __sanitizer_syscall_post_getfoo(res, ...args...); -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_LINUX_SYSCALL_HOOKS_H -#define SANITIZER_LINUX_SYSCALL_HOOKS_H - -#define __sanitizer_syscall_pre_time(tloc) \ - __sanitizer_syscall_pre_impl_time((long)(tloc)) -#define __sanitizer_syscall_post_time(res, tloc) \ - __sanitizer_syscall_post_impl_time(res, (long)(tloc)) -#define __sanitizer_syscall_pre_stime(tptr) \ - __sanitizer_syscall_pre_impl_stime((long)(tptr)) -#define __sanitizer_syscall_post_stime(res, tptr) \ - __sanitizer_syscall_post_impl_stime(res, (long)(tptr)) -#define __sanitizer_syscall_pre_gettimeofday(tv, tz) \ - __sanitizer_syscall_pre_impl_gettimeofday((long)(tv), (long)(tz)) -#define __sanitizer_syscall_post_gettimeofday(res, tv, tz) \ - __sanitizer_syscall_post_impl_gettimeofday(res, (long)(tv), (long)(tz)) -#define __sanitizer_syscall_pre_settimeofday(tv, tz) \ - __sanitizer_syscall_pre_impl_settimeofday((long)(tv), (long)(tz)) -#define __sanitizer_syscall_post_settimeofday(res, tv, tz) \ - __sanitizer_syscall_post_impl_settimeofday(res, (long)(tv), (long)(tz)) -#define __sanitizer_syscall_pre_adjtimex(txc_p) \ - __sanitizer_syscall_pre_impl_adjtimex((long)(txc_p)) -#define __sanitizer_syscall_post_adjtimex(res, txc_p) \ - __sanitizer_syscall_post_impl_adjtimex(res, (long)(txc_p)) -#define __sanitizer_syscall_pre_times(tbuf) \ - __sanitizer_syscall_pre_impl_times((long)(tbuf)) -#define __sanitizer_syscall_post_times(res, tbuf) \ - __sanitizer_syscall_post_impl_times(res, (long)(tbuf)) -#define __sanitizer_syscall_pre_gettid() __sanitizer_syscall_pre_impl_gettid() -#define __sanitizer_syscall_post_gettid(res) \ - __sanitizer_syscall_post_impl_gettid(res) -#define __sanitizer_syscall_pre_nanosleep(rqtp, rmtp) \ - __sanitizer_syscall_pre_impl_nanosleep((long)(rqtp), (long)(rmtp)) -#define __sanitizer_syscall_post_nanosleep(res, rqtp, rmtp) \ - __sanitizer_syscall_post_impl_nanosleep(res, (long)(rqtp), (long)(rmtp)) -#define __sanitizer_syscall_pre_alarm(seconds) \ - __sanitizer_syscall_pre_impl_alarm((long)(seconds)) -#define __sanitizer_syscall_post_alarm(res, seconds) \ - __sanitizer_syscall_post_impl_alarm(res, (long)(seconds)) -#define __sanitizer_syscall_pre_getpid() __sanitizer_syscall_pre_impl_getpid() -#define __sanitizer_syscall_post_getpid(res) \ - __sanitizer_syscall_post_impl_getpid(res) -#define __sanitizer_syscall_pre_getppid() __sanitizer_syscall_pre_impl_getppid() -#define __sanitizer_syscall_post_getppid(res) \ - __sanitizer_syscall_post_impl_getppid(res) -#define __sanitizer_syscall_pre_getuid() __sanitizer_syscall_pre_impl_getuid() -#define __sanitizer_syscall_post_getuid(res) \ - __sanitizer_syscall_post_impl_getuid(res) -#define __sanitizer_syscall_pre_geteuid() __sanitizer_syscall_pre_impl_geteuid() -#define __sanitizer_syscall_post_geteuid(res) \ - __sanitizer_syscall_post_impl_geteuid(res) -#define __sanitizer_syscall_pre_getgid() __sanitizer_syscall_pre_impl_getgid() -#define __sanitizer_syscall_post_getgid(res) \ - __sanitizer_syscall_post_impl_getgid(res) -#define __sanitizer_syscall_pre_getegid() __sanitizer_syscall_pre_impl_getegid() -#define __sanitizer_syscall_post_getegid(res) \ - __sanitizer_syscall_post_impl_getegid(res) -#define __sanitizer_syscall_pre_getresuid(ruid, euid, suid) \ - __sanitizer_syscall_pre_impl_getresuid((long)(ruid), (long)(euid), \ - (long)(suid)) -#define __sanitizer_syscall_post_getresuid(res, ruid, euid, suid) \ - __sanitizer_syscall_post_impl_getresuid(res, (long)(ruid), (long)(euid), \ - (long)(suid)) -#define __sanitizer_syscall_pre_getresgid(rgid, egid, sgid) \ - __sanitizer_syscall_pre_impl_getresgid((long)(rgid), (long)(egid), \ - (long)(sgid)) -#define __sanitizer_syscall_post_getresgid(res, rgid, egid, sgid) \ - __sanitizer_syscall_post_impl_getresgid(res, (long)(rgid), (long)(egid), \ - (long)(sgid)) -#define __sanitizer_syscall_pre_getpgid(pid) \ - __sanitizer_syscall_pre_impl_getpgid((long)(pid)) -#define __sanitizer_syscall_post_getpgid(res, pid) \ - __sanitizer_syscall_post_impl_getpgid(res, (long)(pid)) -#define __sanitizer_syscall_pre_getpgrp() __sanitizer_syscall_pre_impl_getpgrp() -#define __sanitizer_syscall_post_getpgrp(res) \ - __sanitizer_syscall_post_impl_getpgrp(res) -#define __sanitizer_syscall_pre_getsid(pid) \ - __sanitizer_syscall_pre_impl_getsid((long)(pid)) -#define __sanitizer_syscall_post_getsid(res, pid) \ - __sanitizer_syscall_post_impl_getsid(res, (long)(pid)) -#define __sanitizer_syscall_pre_getgroups(gidsetsize, grouplist) \ - __sanitizer_syscall_pre_impl_getgroups((long)(gidsetsize), (long)(grouplist)) -#define __sanitizer_syscall_post_getgroups(res, gidsetsize, grouplist) \ - __sanitizer_syscall_post_impl_getgroups(res, (long)(gidsetsize), \ - (long)(grouplist)) -#define __sanitizer_syscall_pre_setregid(rgid, egid) \ - __sanitizer_syscall_pre_impl_setregid((long)(rgid), (long)(egid)) -#define __sanitizer_syscall_post_setregid(res, rgid, egid) \ - __sanitizer_syscall_post_impl_setregid(res, (long)(rgid), (long)(egid)) -#define __sanitizer_syscall_pre_setgid(gid) \ - __sanitizer_syscall_pre_impl_setgid((long)(gid)) -#define __sanitizer_syscall_post_setgid(res, gid) \ - __sanitizer_syscall_post_impl_setgid(res, (long)(gid)) -#define __sanitizer_syscall_pre_setreuid(ruid, euid) \ - __sanitizer_syscall_pre_impl_setreuid((long)(ruid), (long)(euid)) -#define __sanitizer_syscall_post_setreuid(res, ruid, euid) \ - __sanitizer_syscall_post_impl_setreuid(res, (long)(ruid), (long)(euid)) -#define __sanitizer_syscall_pre_setuid(uid) \ - __sanitizer_syscall_pre_impl_setuid((long)(uid)) -#define __sanitizer_syscall_post_setuid(res, uid) \ - __sanitizer_syscall_post_impl_setuid(res, (long)(uid)) -#define __sanitizer_syscall_pre_setresuid(ruid, euid, suid) \ - __sanitizer_syscall_pre_impl_setresuid((long)(ruid), (long)(euid), \ - (long)(suid)) -#define __sanitizer_syscall_post_setresuid(res, ruid, euid, suid) \ - __sanitizer_syscall_post_impl_setresuid(res, (long)(ruid), (long)(euid), \ - (long)(suid)) -#define __sanitizer_syscall_pre_setresgid(rgid, egid, sgid) \ - __sanitizer_syscall_pre_impl_setresgid((long)(rgid), (long)(egid), \ - (long)(sgid)) -#define __sanitizer_syscall_post_setresgid(res, rgid, egid, sgid) \ - __sanitizer_syscall_post_impl_setresgid(res, (long)(rgid), (long)(egid), \ - (long)(sgid)) -#define __sanitizer_syscall_pre_setfsuid(uid) \ - __sanitizer_syscall_pre_impl_setfsuid((long)(uid)) -#define __sanitizer_syscall_post_setfsuid(res, uid) \ - __sanitizer_syscall_post_impl_setfsuid(res, (long)(uid)) -#define __sanitizer_syscall_pre_setfsgid(gid) \ - __sanitizer_syscall_pre_impl_setfsgid((long)(gid)) -#define __sanitizer_syscall_post_setfsgid(res, gid) \ - __sanitizer_syscall_post_impl_setfsgid(res, (long)(gid)) -#define __sanitizer_syscall_pre_setpgid(pid, pgid) \ - __sanitizer_syscall_pre_impl_setpgid((long)(pid), (long)(pgid)) -#define __sanitizer_syscall_post_setpgid(res, pid, pgid) \ - __sanitizer_syscall_post_impl_setpgid(res, (long)(pid), (long)(pgid)) -#define __sanitizer_syscall_pre_setsid() __sanitizer_syscall_pre_impl_setsid() -#define __sanitizer_syscall_post_setsid(res) \ - __sanitizer_syscall_post_impl_setsid(res) -#define __sanitizer_syscall_pre_setgroups(gidsetsize, grouplist) \ - __sanitizer_syscall_pre_impl_setgroups((long)(gidsetsize), (long)(grouplist)) -#define __sanitizer_syscall_post_setgroups(res, gidsetsize, grouplist) \ - __sanitizer_syscall_post_impl_setgroups(res, (long)(gidsetsize), \ - (long)(grouplist)) -#define __sanitizer_syscall_pre_acct(name) \ - __sanitizer_syscall_pre_impl_acct((long)(name)) -#define __sanitizer_syscall_post_acct(res, name) \ - __sanitizer_syscall_post_impl_acct(res, (long)(name)) -#define __sanitizer_syscall_pre_capget(header, dataptr) \ - __sanitizer_syscall_pre_impl_capget((long)(header), (long)(dataptr)) -#define __sanitizer_syscall_post_capget(res, header, dataptr) \ - __sanitizer_syscall_post_impl_capget(res, (long)(header), (long)(dataptr)) -#define __sanitizer_syscall_pre_capset(header, data) \ - __sanitizer_syscall_pre_impl_capset((long)(header), (long)(data)) -#define __sanitizer_syscall_post_capset(res, header, data) \ - __sanitizer_syscall_post_impl_capset(res, (long)(header), (long)(data)) -#define __sanitizer_syscall_pre_personality(personality) \ - __sanitizer_syscall_pre_impl_personality((long)(personality)) -#define __sanitizer_syscall_post_personality(res, personality) \ - __sanitizer_syscall_post_impl_personality(res, (long)(personality)) -#define __sanitizer_syscall_pre_sigpending(set) \ - __sanitizer_syscall_pre_impl_sigpending((long)(set)) -#define __sanitizer_syscall_post_sigpending(res, set) \ - __sanitizer_syscall_post_impl_sigpending(res, (long)(set)) -#define __sanitizer_syscall_pre_sigprocmask(how, set, oset) \ - __sanitizer_syscall_pre_impl_sigprocmask((long)(how), (long)(set), \ - (long)(oset)) -#define __sanitizer_syscall_post_sigprocmask(res, how, set, oset) \ - __sanitizer_syscall_post_impl_sigprocmask(res, (long)(how), (long)(set), \ - (long)(oset)) -#define __sanitizer_syscall_pre_getitimer(which, value) \ - __sanitizer_syscall_pre_impl_getitimer((long)(which), (long)(value)) -#define __sanitizer_syscall_post_getitimer(res, which, value) \ - __sanitizer_syscall_post_impl_getitimer(res, (long)(which), (long)(value)) -#define __sanitizer_syscall_pre_setitimer(which, value, ovalue) \ - __sanitizer_syscall_pre_impl_setitimer((long)(which), (long)(value), \ - (long)(ovalue)) -#define __sanitizer_syscall_post_setitimer(res, which, value, ovalue) \ - __sanitizer_syscall_post_impl_setitimer(res, (long)(which), (long)(value), \ - (long)(ovalue)) -#define __sanitizer_syscall_pre_timer_create(which_clock, timer_event_spec, \ - created_timer_id) \ - __sanitizer_syscall_pre_impl_timer_create( \ - (long)(which_clock), (long)(timer_event_spec), (long)(created_timer_id)) -#define __sanitizer_syscall_post_timer_create( \ - res, which_clock, timer_event_spec, created_timer_id) \ - __sanitizer_syscall_post_impl_timer_create(res, (long)(which_clock), \ - (long)(timer_event_spec), \ - (long)(created_timer_id)) -#define __sanitizer_syscall_pre_timer_gettime(timer_id, setting) \ - __sanitizer_syscall_pre_impl_timer_gettime((long)(timer_id), (long)(setting)) -#define __sanitizer_syscall_post_timer_gettime(res, timer_id, setting) \ - __sanitizer_syscall_post_impl_timer_gettime(res, (long)(timer_id), \ - (long)(setting)) -#define __sanitizer_syscall_pre_timer_getoverrun(timer_id) \ - __sanitizer_syscall_pre_impl_timer_getoverrun((long)(timer_id)) -#define __sanitizer_syscall_post_timer_getoverrun(res, timer_id) \ - __sanitizer_syscall_post_impl_timer_getoverrun(res, (long)(timer_id)) -#define __sanitizer_syscall_pre_timer_settime(timer_id, flags, new_setting, \ - old_setting) \ - __sanitizer_syscall_pre_impl_timer_settime((long)(timer_id), (long)(flags), \ - (long)(new_setting), \ - (long)(old_setting)) -#define __sanitizer_syscall_post_timer_settime(res, timer_id, flags, \ - new_setting, old_setting) \ - __sanitizer_syscall_post_impl_timer_settime( \ - res, (long)(timer_id), (long)(flags), (long)(new_setting), \ - (long)(old_setting)) -#define __sanitizer_syscall_pre_timer_delete(timer_id) \ - __sanitizer_syscall_pre_impl_timer_delete((long)(timer_id)) -#define __sanitizer_syscall_post_timer_delete(res, timer_id) \ - __sanitizer_syscall_post_impl_timer_delete(res, (long)(timer_id)) -#define __sanitizer_syscall_pre_clock_settime(which_clock, tp) \ - __sanitizer_syscall_pre_impl_clock_settime((long)(which_clock), (long)(tp)) -#define __sanitizer_syscall_post_clock_settime(res, which_clock, tp) \ - __sanitizer_syscall_post_impl_clock_settime(res, (long)(which_clock), \ - (long)(tp)) -#define __sanitizer_syscall_pre_clock_gettime(which_clock, tp) \ - __sanitizer_syscall_pre_impl_clock_gettime((long)(which_clock), (long)(tp)) -#define __sanitizer_syscall_post_clock_gettime(res, which_clock, tp) \ - __sanitizer_syscall_post_impl_clock_gettime(res, (long)(which_clock), \ - (long)(tp)) -#define __sanitizer_syscall_pre_clock_adjtime(which_clock, tx) \ - __sanitizer_syscall_pre_impl_clock_adjtime((long)(which_clock), (long)(tx)) -#define __sanitizer_syscall_post_clock_adjtime(res, which_clock, tx) \ - __sanitizer_syscall_post_impl_clock_adjtime(res, (long)(which_clock), \ - (long)(tx)) -#define __sanitizer_syscall_pre_clock_getres(which_clock, tp) \ - __sanitizer_syscall_pre_impl_clock_getres((long)(which_clock), (long)(tp)) -#define __sanitizer_syscall_post_clock_getres(res, which_clock, tp) \ - __sanitizer_syscall_post_impl_clock_getres(res, (long)(which_clock), \ - (long)(tp)) -#define __sanitizer_syscall_pre_clock_nanosleep(which_clock, flags, rqtp, \ - rmtp) \ - __sanitizer_syscall_pre_impl_clock_nanosleep( \ - (long)(which_clock), (long)(flags), (long)(rqtp), (long)(rmtp)) -#define __sanitizer_syscall_post_clock_nanosleep(res, which_clock, flags, \ - rqtp, rmtp) \ - __sanitizer_syscall_post_impl_clock_nanosleep( \ - res, (long)(which_clock), (long)(flags), (long)(rqtp), (long)(rmtp)) -#define __sanitizer_syscall_pre_nice(increment) \ - __sanitizer_syscall_pre_impl_nice((long)(increment)) -#define __sanitizer_syscall_post_nice(res, increment) \ - __sanitizer_syscall_post_impl_nice(res, (long)(increment)) -#define __sanitizer_syscall_pre_sched_setscheduler(pid, policy, param) \ - __sanitizer_syscall_pre_impl_sched_setscheduler((long)(pid), (long)(policy), \ - (long)(param)) -#define __sanitizer_syscall_post_sched_setscheduler(res, pid, policy, param) \ - __sanitizer_syscall_post_impl_sched_setscheduler( \ - res, (long)(pid), (long)(policy), (long)(param)) -#define __sanitizer_syscall_pre_sched_setparam(pid, param) \ - __sanitizer_syscall_pre_impl_sched_setparam((long)(pid), (long)(param)) -#define __sanitizer_syscall_post_sched_setparam(res, pid, param) \ - __sanitizer_syscall_post_impl_sched_setparam(res, (long)(pid), (long)(param)) -#define __sanitizer_syscall_pre_sched_getscheduler(pid) \ - __sanitizer_syscall_pre_impl_sched_getscheduler((long)(pid)) -#define __sanitizer_syscall_post_sched_getscheduler(res, pid) \ - __sanitizer_syscall_post_impl_sched_getscheduler(res, (long)(pid)) -#define __sanitizer_syscall_pre_sched_getparam(pid, param) \ - __sanitizer_syscall_pre_impl_sched_getparam((long)(pid), (long)(param)) -#define __sanitizer_syscall_post_sched_getparam(res, pid, param) \ - __sanitizer_syscall_post_impl_sched_getparam(res, (long)(pid), (long)(param)) -#define __sanitizer_syscall_pre_sched_setaffinity(pid, len, user_mask_ptr) \ - __sanitizer_syscall_pre_impl_sched_setaffinity((long)(pid), (long)(len), \ - (long)(user_mask_ptr)) -#define __sanitizer_syscall_post_sched_setaffinity(res, pid, len, \ - user_mask_ptr) \ - __sanitizer_syscall_post_impl_sched_setaffinity( \ - res, (long)(pid), (long)(len), (long)(user_mask_ptr)) -#define __sanitizer_syscall_pre_sched_getaffinity(pid, len, user_mask_ptr) \ - __sanitizer_syscall_pre_impl_sched_getaffinity((long)(pid), (long)(len), \ - (long)(user_mask_ptr)) -#define __sanitizer_syscall_post_sched_getaffinity(res, pid, len, \ - user_mask_ptr) \ - __sanitizer_syscall_post_impl_sched_getaffinity( \ - res, (long)(pid), (long)(len), (long)(user_mask_ptr)) -#define __sanitizer_syscall_pre_sched_yield() \ - __sanitizer_syscall_pre_impl_sched_yield() -#define __sanitizer_syscall_post_sched_yield(res) \ - __sanitizer_syscall_post_impl_sched_yield(res) -#define __sanitizer_syscall_pre_sched_get_priority_max(policy) \ - __sanitizer_syscall_pre_impl_sched_get_priority_max((long)(policy)) -#define __sanitizer_syscall_post_sched_get_priority_max(res, policy) \ - __sanitizer_syscall_post_impl_sched_get_priority_max(res, (long)(policy)) -#define __sanitizer_syscall_pre_sched_get_priority_min(policy) \ - __sanitizer_syscall_pre_impl_sched_get_priority_min((long)(policy)) -#define __sanitizer_syscall_post_sched_get_priority_min(res, policy) \ - __sanitizer_syscall_post_impl_sched_get_priority_min(res, (long)(policy)) -#define __sanitizer_syscall_pre_sched_rr_get_interval(pid, interval) \ - __sanitizer_syscall_pre_impl_sched_rr_get_interval((long)(pid), \ - (long)(interval)) -#define __sanitizer_syscall_post_sched_rr_get_interval(res, pid, interval) \ - __sanitizer_syscall_post_impl_sched_rr_get_interval(res, (long)(pid), \ - (long)(interval)) -#define __sanitizer_syscall_pre_setpriority(which, who, niceval) \ - __sanitizer_syscall_pre_impl_setpriority((long)(which), (long)(who), \ - (long)(niceval)) -#define __sanitizer_syscall_post_setpriority(res, which, who, niceval) \ - __sanitizer_syscall_post_impl_setpriority(res, (long)(which), (long)(who), \ - (long)(niceval)) -#define __sanitizer_syscall_pre_getpriority(which, who) \ - __sanitizer_syscall_pre_impl_getpriority((long)(which), (long)(who)) -#define __sanitizer_syscall_post_getpriority(res, which, who) \ - __sanitizer_syscall_post_impl_getpriority(res, (long)(which), (long)(who)) -#define __sanitizer_syscall_pre_shutdown(arg0, arg1) \ - __sanitizer_syscall_pre_impl_shutdown((long)(arg0), (long)(arg1)) -#define __sanitizer_syscall_post_shutdown(res, arg0, arg1) \ - __sanitizer_syscall_post_impl_shutdown(res, (long)(arg0), (long)(arg1)) -#define __sanitizer_syscall_pre_reboot(magic1, magic2, cmd, arg) \ - __sanitizer_syscall_pre_impl_reboot((long)(magic1), (long)(magic2), \ - (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_post_reboot(res, magic1, magic2, cmd, arg) \ - __sanitizer_syscall_post_impl_reboot(res, (long)(magic1), (long)(magic2), \ - (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_pre_restart_syscall() \ - __sanitizer_syscall_pre_impl_restart_syscall() -#define __sanitizer_syscall_post_restart_syscall(res) \ - __sanitizer_syscall_post_impl_restart_syscall(res) -#define __sanitizer_syscall_pre_kexec_load(entry, nr_segments, segments, \ - flags) \ - __sanitizer_syscall_pre_impl_kexec_load((long)(entry), (long)(nr_segments), \ - (long)(segments), (long)(flags)) -#define __sanitizer_syscall_post_kexec_load(res, entry, nr_segments, segments, \ - flags) \ - __sanitizer_syscall_post_impl_kexec_load(res, (long)(entry), \ - (long)(nr_segments), \ - (long)(segments), (long)(flags)) -#define __sanitizer_syscall_pre_exit(error_code) \ - __sanitizer_syscall_pre_impl_exit((long)(error_code)) -#define __sanitizer_syscall_post_exit(res, error_code) \ - __sanitizer_syscall_post_impl_exit(res, (long)(error_code)) -#define __sanitizer_syscall_pre_exit_group(error_code) \ - __sanitizer_syscall_pre_impl_exit_group((long)(error_code)) -#define __sanitizer_syscall_post_exit_group(res, error_code) \ - __sanitizer_syscall_post_impl_exit_group(res, (long)(error_code)) -#define __sanitizer_syscall_pre_wait4(pid, stat_addr, options, ru) \ - __sanitizer_syscall_pre_impl_wait4((long)(pid), (long)(stat_addr), \ - (long)(options), (long)(ru)) -#define __sanitizer_syscall_post_wait4(res, pid, stat_addr, options, ru) \ - __sanitizer_syscall_post_impl_wait4(res, (long)(pid), (long)(stat_addr), \ - (long)(options), (long)(ru)) -#define __sanitizer_syscall_pre_waitid(which, pid, infop, options, ru) \ - __sanitizer_syscall_pre_impl_waitid( \ - (long)(which), (long)(pid), (long)(infop), (long)(options), (long)(ru)) -#define __sanitizer_syscall_post_waitid(res, which, pid, infop, options, ru) \ - __sanitizer_syscall_post_impl_waitid(res, (long)(which), (long)(pid), \ - (long)(infop), (long)(options), \ - (long)(ru)) -#define __sanitizer_syscall_pre_waitpid(pid, stat_addr, options) \ - __sanitizer_syscall_pre_impl_waitpid((long)(pid), (long)(stat_addr), \ - (long)(options)) -#define __sanitizer_syscall_post_waitpid(res, pid, stat_addr, options) \ - __sanitizer_syscall_post_impl_waitpid(res, (long)(pid), (long)(stat_addr), \ - (long)(options)) -#define __sanitizer_syscall_pre_set_tid_address(tidptr) \ - __sanitizer_syscall_pre_impl_set_tid_address((long)(tidptr)) -#define __sanitizer_syscall_post_set_tid_address(res, tidptr) \ - __sanitizer_syscall_post_impl_set_tid_address(res, (long)(tidptr)) -#define __sanitizer_syscall_pre_init_module(umod, len, uargs) \ - __sanitizer_syscall_pre_impl_init_module((long)(umod), (long)(len), \ - (long)(uargs)) -#define __sanitizer_syscall_post_init_module(res, umod, len, uargs) \ - __sanitizer_syscall_post_impl_init_module(res, (long)(umod), (long)(len), \ - (long)(uargs)) -#define __sanitizer_syscall_pre_delete_module(name_user, flags) \ - __sanitizer_syscall_pre_impl_delete_module((long)(name_user), (long)(flags)) -#define __sanitizer_syscall_post_delete_module(res, name_user, flags) \ - __sanitizer_syscall_post_impl_delete_module(res, (long)(name_user), \ - (long)(flags)) -#define __sanitizer_syscall_pre_rt_sigprocmask(how, set, oset, sigsetsize) \ - __sanitizer_syscall_pre_impl_rt_sigprocmask( \ - (long)(how), (long)(set), (long)(oset), (long)(sigsetsize)) -#define __sanitizer_syscall_post_rt_sigprocmask(res, how, set, oset, \ - sigsetsize) \ - __sanitizer_syscall_post_impl_rt_sigprocmask( \ - res, (long)(how), (long)(set), (long)(oset), (long)(sigsetsize)) -#define __sanitizer_syscall_pre_rt_sigpending(set, sigsetsize) \ - __sanitizer_syscall_pre_impl_rt_sigpending((long)(set), (long)(sigsetsize)) -#define __sanitizer_syscall_post_rt_sigpending(res, set, sigsetsize) \ - __sanitizer_syscall_post_impl_rt_sigpending(res, (long)(set), \ - (long)(sigsetsize)) -#define __sanitizer_syscall_pre_rt_sigtimedwait(uthese, uinfo, uts, \ - sigsetsize) \ - __sanitizer_syscall_pre_impl_rt_sigtimedwait( \ - (long)(uthese), (long)(uinfo), (long)(uts), (long)(sigsetsize)) -#define __sanitizer_syscall_post_rt_sigtimedwait(res, uthese, uinfo, uts, \ - sigsetsize) \ - __sanitizer_syscall_post_impl_rt_sigtimedwait( \ - res, (long)(uthese), (long)(uinfo), (long)(uts), (long)(sigsetsize)) -#define __sanitizer_syscall_pre_rt_tgsigqueueinfo(tgid, pid, sig, uinfo) \ - __sanitizer_syscall_pre_impl_rt_tgsigqueueinfo((long)(tgid), (long)(pid), \ - (long)(sig), (long)(uinfo)) -#define __sanitizer_syscall_post_rt_tgsigqueueinfo(res, tgid, pid, sig, uinfo) \ - __sanitizer_syscall_post_impl_rt_tgsigqueueinfo( \ - res, (long)(tgid), (long)(pid), (long)(sig), (long)(uinfo)) -#define __sanitizer_syscall_pre_kill(pid, sig) \ - __sanitizer_syscall_pre_impl_kill((long)(pid), (long)(sig)) -#define __sanitizer_syscall_post_kill(res, pid, sig) \ - __sanitizer_syscall_post_impl_kill(res, (long)(pid), (long)(sig)) -#define __sanitizer_syscall_pre_tgkill(tgid, pid, sig) \ - __sanitizer_syscall_pre_impl_tgkill((long)(tgid), (long)(pid), (long)(sig)) -#define __sanitizer_syscall_post_tgkill(res, tgid, pid, sig) \ - __sanitizer_syscall_post_impl_tgkill(res, (long)(tgid), (long)(pid), \ - (long)(sig)) -#define __sanitizer_syscall_pre_tkill(pid, sig) \ - __sanitizer_syscall_pre_impl_tkill((long)(pid), (long)(sig)) -#define __sanitizer_syscall_post_tkill(res, pid, sig) \ - __sanitizer_syscall_post_impl_tkill(res, (long)(pid), (long)(sig)) -#define __sanitizer_syscall_pre_rt_sigqueueinfo(pid, sig, uinfo) \ - __sanitizer_syscall_pre_impl_rt_sigqueueinfo((long)(pid), (long)(sig), \ - (long)(uinfo)) -#define __sanitizer_syscall_post_rt_sigqueueinfo(res, pid, sig, uinfo) \ - __sanitizer_syscall_post_impl_rt_sigqueueinfo(res, (long)(pid), (long)(sig), \ - (long)(uinfo)) -#define __sanitizer_syscall_pre_sgetmask() \ - __sanitizer_syscall_pre_impl_sgetmask() -#define __sanitizer_syscall_post_sgetmask(res) \ - __sanitizer_syscall_post_impl_sgetmask(res) -#define __sanitizer_syscall_pre_ssetmask(newmask) \ - __sanitizer_syscall_pre_impl_ssetmask((long)(newmask)) -#define __sanitizer_syscall_post_ssetmask(res, newmask) \ - __sanitizer_syscall_post_impl_ssetmask(res, (long)(newmask)) -#define __sanitizer_syscall_pre_signal(sig, handler) \ - __sanitizer_syscall_pre_impl_signal((long)(sig), (long)(handler)) -#define __sanitizer_syscall_post_signal(res, sig, handler) \ - __sanitizer_syscall_post_impl_signal(res, (long)(sig), (long)(handler)) -#define __sanitizer_syscall_pre_pause() __sanitizer_syscall_pre_impl_pause() -#define __sanitizer_syscall_post_pause(res) \ - __sanitizer_syscall_post_impl_pause(res) -#define __sanitizer_syscall_pre_sync() __sanitizer_syscall_pre_impl_sync() -#define __sanitizer_syscall_post_sync(res) \ - __sanitizer_syscall_post_impl_sync(res) -#define __sanitizer_syscall_pre_fsync(fd) \ - __sanitizer_syscall_pre_impl_fsync((long)(fd)) -#define __sanitizer_syscall_post_fsync(res, fd) \ - __sanitizer_syscall_post_impl_fsync(res, (long)(fd)) -#define __sanitizer_syscall_pre_fdatasync(fd) \ - __sanitizer_syscall_pre_impl_fdatasync((long)(fd)) -#define __sanitizer_syscall_post_fdatasync(res, fd) \ - __sanitizer_syscall_post_impl_fdatasync(res, (long)(fd)) -#define __sanitizer_syscall_pre_bdflush(func, data) \ - __sanitizer_syscall_pre_impl_bdflush((long)(func), (long)(data)) -#define __sanitizer_syscall_post_bdflush(res, func, data) \ - __sanitizer_syscall_post_impl_bdflush(res, (long)(func), (long)(data)) -#define __sanitizer_syscall_pre_mount(dev_name, dir_name, type, flags, data) \ - __sanitizer_syscall_pre_impl_mount((long)(dev_name), (long)(dir_name), \ - (long)(type), (long)(flags), \ - (long)(data)) -#define __sanitizer_syscall_post_mount(res, dev_name, dir_name, type, flags, \ - data) \ - __sanitizer_syscall_post_impl_mount(res, (long)(dev_name), (long)(dir_name), \ - (long)(type), (long)(flags), \ - (long)(data)) -#define __sanitizer_syscall_pre_umount(name, flags) \ - __sanitizer_syscall_pre_impl_umount((long)(name), (long)(flags)) -#define __sanitizer_syscall_post_umount(res, name, flags) \ - __sanitizer_syscall_post_impl_umount(res, (long)(name), (long)(flags)) -#define __sanitizer_syscall_pre_oldumount(name) \ - __sanitizer_syscall_pre_impl_oldumount((long)(name)) -#define __sanitizer_syscall_post_oldumount(res, name) \ - __sanitizer_syscall_post_impl_oldumount(res, (long)(name)) -#define __sanitizer_syscall_pre_truncate(path, length) \ - __sanitizer_syscall_pre_impl_truncate((long)(path), (long)(length)) -#define __sanitizer_syscall_post_truncate(res, path, length) \ - __sanitizer_syscall_post_impl_truncate(res, (long)(path), (long)(length)) -#define __sanitizer_syscall_pre_ftruncate(fd, length) \ - __sanitizer_syscall_pre_impl_ftruncate((long)(fd), (long)(length)) -#define __sanitizer_syscall_post_ftruncate(res, fd, length) \ - __sanitizer_syscall_post_impl_ftruncate(res, (long)(fd), (long)(length)) -#define __sanitizer_syscall_pre_stat(filename, statbuf) \ - __sanitizer_syscall_pre_impl_stat((long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_post_stat(res, filename, statbuf) \ - __sanitizer_syscall_post_impl_stat(res, (long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_pre_statfs(path, buf) \ - __sanitizer_syscall_pre_impl_statfs((long)(path), (long)(buf)) -#define __sanitizer_syscall_post_statfs(res, path, buf) \ - __sanitizer_syscall_post_impl_statfs(res, (long)(path), (long)(buf)) -#define __sanitizer_syscall_pre_statfs64(path, sz, buf) \ - __sanitizer_syscall_pre_impl_statfs64((long)(path), (long)(sz), (long)(buf)) -#define __sanitizer_syscall_post_statfs64(res, path, sz, buf) \ - __sanitizer_syscall_post_impl_statfs64(res, (long)(path), (long)(sz), \ - (long)(buf)) -#define __sanitizer_syscall_pre_fstatfs(fd, buf) \ - __sanitizer_syscall_pre_impl_fstatfs((long)(fd), (long)(buf)) -#define __sanitizer_syscall_post_fstatfs(res, fd, buf) \ - __sanitizer_syscall_post_impl_fstatfs(res, (long)(fd), (long)(buf)) -#define __sanitizer_syscall_pre_fstatfs64(fd, sz, buf) \ - __sanitizer_syscall_pre_impl_fstatfs64((long)(fd), (long)(sz), (long)(buf)) -#define __sanitizer_syscall_post_fstatfs64(res, fd, sz, buf) \ - __sanitizer_syscall_post_impl_fstatfs64(res, (long)(fd), (long)(sz), \ - (long)(buf)) -#define __sanitizer_syscall_pre_lstat(filename, statbuf) \ - __sanitizer_syscall_pre_impl_lstat((long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_post_lstat(res, filename, statbuf) \ - __sanitizer_syscall_post_impl_lstat(res, (long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_pre_fstat(fd, statbuf) \ - __sanitizer_syscall_pre_impl_fstat((long)(fd), (long)(statbuf)) -#define __sanitizer_syscall_post_fstat(res, fd, statbuf) \ - __sanitizer_syscall_post_impl_fstat(res, (long)(fd), (long)(statbuf)) -#define __sanitizer_syscall_pre_newstat(filename, statbuf) \ - __sanitizer_syscall_pre_impl_newstat((long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_post_newstat(res, filename, statbuf) \ - __sanitizer_syscall_post_impl_newstat(res, (long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_pre_newlstat(filename, statbuf) \ - __sanitizer_syscall_pre_impl_newlstat((long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_post_newlstat(res, filename, statbuf) \ - __sanitizer_syscall_post_impl_newlstat(res, (long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_pre_newfstat(fd, statbuf) \ - __sanitizer_syscall_pre_impl_newfstat((long)(fd), (long)(statbuf)) -#define __sanitizer_syscall_post_newfstat(res, fd, statbuf) \ - __sanitizer_syscall_post_impl_newfstat(res, (long)(fd), (long)(statbuf)) -#define __sanitizer_syscall_pre_ustat(dev, ubuf) \ - __sanitizer_syscall_pre_impl_ustat((long)(dev), (long)(ubuf)) -#define __sanitizer_syscall_post_ustat(res, dev, ubuf) \ - __sanitizer_syscall_post_impl_ustat(res, (long)(dev), (long)(ubuf)) -#define __sanitizer_syscall_pre_stat64(filename, statbuf) \ - __sanitizer_syscall_pre_impl_stat64((long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_post_stat64(res, filename, statbuf) \ - __sanitizer_syscall_post_impl_stat64(res, (long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_pre_fstat64(fd, statbuf) \ - __sanitizer_syscall_pre_impl_fstat64((long)(fd), (long)(statbuf)) -#define __sanitizer_syscall_post_fstat64(res, fd, statbuf) \ - __sanitizer_syscall_post_impl_fstat64(res, (long)(fd), (long)(statbuf)) -#define __sanitizer_syscall_pre_lstat64(filename, statbuf) \ - __sanitizer_syscall_pre_impl_lstat64((long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_post_lstat64(res, filename, statbuf) \ - __sanitizer_syscall_post_impl_lstat64(res, (long)(filename), (long)(statbuf)) -#define __sanitizer_syscall_pre_setxattr(path, name, value, size, flags) \ - __sanitizer_syscall_pre_impl_setxattr( \ - (long)(path), (long)(name), (long)(value), (long)(size), (long)(flags)) -#define __sanitizer_syscall_post_setxattr(res, path, name, value, size, flags) \ - __sanitizer_syscall_post_impl_setxattr(res, (long)(path), (long)(name), \ - (long)(value), (long)(size), \ - (long)(flags)) -#define __sanitizer_syscall_pre_lsetxattr(path, name, value, size, flags) \ - __sanitizer_syscall_pre_impl_lsetxattr( \ - (long)(path), (long)(name), (long)(value), (long)(size), (long)(flags)) -#define __sanitizer_syscall_post_lsetxattr(res, path, name, value, size, \ - flags) \ - __sanitizer_syscall_post_impl_lsetxattr(res, (long)(path), (long)(name), \ - (long)(value), (long)(size), \ - (long)(flags)) -#define __sanitizer_syscall_pre_fsetxattr(fd, name, value, size, flags) \ - __sanitizer_syscall_pre_impl_fsetxattr( \ - (long)(fd), (long)(name), (long)(value), (long)(size), (long)(flags)) -#define __sanitizer_syscall_post_fsetxattr(res, fd, name, value, size, flags) \ - __sanitizer_syscall_post_impl_fsetxattr(res, (long)(fd), (long)(name), \ - (long)(value), (long)(size), \ - (long)(flags)) -#define __sanitizer_syscall_pre_getxattr(path, name, value, size) \ - __sanitizer_syscall_pre_impl_getxattr((long)(path), (long)(name), \ - (long)(value), (long)(size)) -#define __sanitizer_syscall_post_getxattr(res, path, name, value, size) \ - __sanitizer_syscall_post_impl_getxattr(res, (long)(path), (long)(name), \ - (long)(value), (long)(size)) -#define __sanitizer_syscall_pre_lgetxattr(path, name, value, size) \ - __sanitizer_syscall_pre_impl_lgetxattr((long)(path), (long)(name), \ - (long)(value), (long)(size)) -#define __sanitizer_syscall_post_lgetxattr(res, path, name, value, size) \ - __sanitizer_syscall_post_impl_lgetxattr(res, (long)(path), (long)(name), \ - (long)(value), (long)(size)) -#define __sanitizer_syscall_pre_fgetxattr(fd, name, value, size) \ - __sanitizer_syscall_pre_impl_fgetxattr((long)(fd), (long)(name), \ - (long)(value), (long)(size)) -#define __sanitizer_syscall_post_fgetxattr(res, fd, name, value, size) \ - __sanitizer_syscall_post_impl_fgetxattr(res, (long)(fd), (long)(name), \ - (long)(value), (long)(size)) -#define __sanitizer_syscall_pre_listxattr(path, list, size) \ - __sanitizer_syscall_pre_impl_listxattr((long)(path), (long)(list), \ - (long)(size)) -#define __sanitizer_syscall_post_listxattr(res, path, list, size) \ - __sanitizer_syscall_post_impl_listxattr(res, (long)(path), (long)(list), \ - (long)(size)) -#define __sanitizer_syscall_pre_llistxattr(path, list, size) \ - __sanitizer_syscall_pre_impl_llistxattr((long)(path), (long)(list), \ - (long)(size)) -#define __sanitizer_syscall_post_llistxattr(res, path, list, size) \ - __sanitizer_syscall_post_impl_llistxattr(res, (long)(path), (long)(list), \ - (long)(size)) -#define __sanitizer_syscall_pre_flistxattr(fd, list, size) \ - __sanitizer_syscall_pre_impl_flistxattr((long)(fd), (long)(list), \ - (long)(size)) -#define __sanitizer_syscall_post_flistxattr(res, fd, list, size) \ - __sanitizer_syscall_post_impl_flistxattr(res, (long)(fd), (long)(list), \ - (long)(size)) -#define __sanitizer_syscall_pre_removexattr(path, name) \ - __sanitizer_syscall_pre_impl_removexattr((long)(path), (long)(name)) -#define __sanitizer_syscall_post_removexattr(res, path, name) \ - __sanitizer_syscall_post_impl_removexattr(res, (long)(path), (long)(name)) -#define __sanitizer_syscall_pre_lremovexattr(path, name) \ - __sanitizer_syscall_pre_impl_lremovexattr((long)(path), (long)(name)) -#define __sanitizer_syscall_post_lremovexattr(res, path, name) \ - __sanitizer_syscall_post_impl_lremovexattr(res, (long)(path), (long)(name)) -#define __sanitizer_syscall_pre_fremovexattr(fd, name) \ - __sanitizer_syscall_pre_impl_fremovexattr((long)(fd), (long)(name)) -#define __sanitizer_syscall_post_fremovexattr(res, fd, name) \ - __sanitizer_syscall_post_impl_fremovexattr(res, (long)(fd), (long)(name)) -#define __sanitizer_syscall_pre_brk(brk) \ - __sanitizer_syscall_pre_impl_brk((long)(brk)) -#define __sanitizer_syscall_post_brk(res, brk) \ - __sanitizer_syscall_post_impl_brk(res, (long)(brk)) -#define __sanitizer_syscall_pre_mprotect(start, len, prot) \ - __sanitizer_syscall_pre_impl_mprotect((long)(start), (long)(len), \ - (long)(prot)) -#define __sanitizer_syscall_post_mprotect(res, start, len, prot) \ - __sanitizer_syscall_post_impl_mprotect(res, (long)(start), (long)(len), \ - (long)(prot)) -#define __sanitizer_syscall_pre_mremap(addr, old_len, new_len, flags, \ - new_addr) \ - __sanitizer_syscall_pre_impl_mremap((long)(addr), (long)(old_len), \ - (long)(new_len), (long)(flags), \ - (long)(new_addr)) -#define __sanitizer_syscall_post_mremap(res, addr, old_len, new_len, flags, \ - new_addr) \ - __sanitizer_syscall_post_impl_mremap(res, (long)(addr), (long)(old_len), \ - (long)(new_len), (long)(flags), \ - (long)(new_addr)) -#define __sanitizer_syscall_pre_remap_file_pages(start, size, prot, pgoff, \ - flags) \ - __sanitizer_syscall_pre_impl_remap_file_pages( \ - (long)(start), (long)(size), (long)(prot), (long)(pgoff), (long)(flags)) -#define __sanitizer_syscall_post_remap_file_pages(res, start, size, prot, \ - pgoff, flags) \ - __sanitizer_syscall_post_impl_remap_file_pages(res, (long)(start), \ - (long)(size), (long)(prot), \ - (long)(pgoff), (long)(flags)) -#define __sanitizer_syscall_pre_msync(start, len, flags) \ - __sanitizer_syscall_pre_impl_msync((long)(start), (long)(len), (long)(flags)) -#define __sanitizer_syscall_post_msync(res, start, len, flags) \ - __sanitizer_syscall_post_impl_msync(res, (long)(start), (long)(len), \ - (long)(flags)) -#define __sanitizer_syscall_pre_munmap(addr, len) \ - __sanitizer_syscall_pre_impl_munmap((long)(addr), (long)(len)) -#define __sanitizer_syscall_post_munmap(res, addr, len) \ - __sanitizer_syscall_post_impl_munmap(res, (long)(addr), (long)(len)) -#define __sanitizer_syscall_pre_mlock(start, len) \ - __sanitizer_syscall_pre_impl_mlock((long)(start), (long)(len)) -#define __sanitizer_syscall_post_mlock(res, start, len) \ - __sanitizer_syscall_post_impl_mlock(res, (long)(start), (long)(len)) -#define __sanitizer_syscall_pre_munlock(start, len) \ - __sanitizer_syscall_pre_impl_munlock((long)(start), (long)(len)) -#define __sanitizer_syscall_post_munlock(res, start, len) \ - __sanitizer_syscall_post_impl_munlock(res, (long)(start), (long)(len)) -#define __sanitizer_syscall_pre_mlockall(flags) \ - __sanitizer_syscall_pre_impl_mlockall((long)(flags)) -#define __sanitizer_syscall_post_mlockall(res, flags) \ - __sanitizer_syscall_post_impl_mlockall(res, (long)(flags)) -#define __sanitizer_syscall_pre_munlockall() \ - __sanitizer_syscall_pre_impl_munlockall() -#define __sanitizer_syscall_post_munlockall(res) \ - __sanitizer_syscall_post_impl_munlockall(res) -#define __sanitizer_syscall_pre_madvise(start, len, behavior) \ - __sanitizer_syscall_pre_impl_madvise((long)(start), (long)(len), \ - (long)(behavior)) -#define __sanitizer_syscall_post_madvise(res, start, len, behavior) \ - __sanitizer_syscall_post_impl_madvise(res, (long)(start), (long)(len), \ - (long)(behavior)) -#define __sanitizer_syscall_pre_mincore(start, len, vec) \ - __sanitizer_syscall_pre_impl_mincore((long)(start), (long)(len), (long)(vec)) -#define __sanitizer_syscall_post_mincore(res, start, len, vec) \ - __sanitizer_syscall_post_impl_mincore(res, (long)(start), (long)(len), \ - (long)(vec)) -#define __sanitizer_syscall_pre_pivot_root(new_root, put_old) \ - __sanitizer_syscall_pre_impl_pivot_root((long)(new_root), (long)(put_old)) -#define __sanitizer_syscall_post_pivot_root(res, new_root, put_old) \ - __sanitizer_syscall_post_impl_pivot_root(res, (long)(new_root), \ - (long)(put_old)) -#define __sanitizer_syscall_pre_chroot(filename) \ - __sanitizer_syscall_pre_impl_chroot((long)(filename)) -#define __sanitizer_syscall_post_chroot(res, filename) \ - __sanitizer_syscall_post_impl_chroot(res, (long)(filename)) -#define __sanitizer_syscall_pre_mknod(filename, mode, dev) \ - __sanitizer_syscall_pre_impl_mknod((long)(filename), (long)(mode), \ - (long)(dev)) -#define __sanitizer_syscall_post_mknod(res, filename, mode, dev) \ - __sanitizer_syscall_post_impl_mknod(res, (long)(filename), (long)(mode), \ - (long)(dev)) -#define __sanitizer_syscall_pre_link(oldname, newname) \ - __sanitizer_syscall_pre_impl_link((long)(oldname), (long)(newname)) -#define __sanitizer_syscall_post_link(res, oldname, newname) \ - __sanitizer_syscall_post_impl_link(res, (long)(oldname), (long)(newname)) -#define __sanitizer_syscall_pre_symlink(old, new_) \ - __sanitizer_syscall_pre_impl_symlink((long)(old), (long)(new_)) -#define __sanitizer_syscall_post_symlink(res, old, new_) \ - __sanitizer_syscall_post_impl_symlink(res, (long)(old), (long)(new_)) -#define __sanitizer_syscall_pre_unlink(pathname) \ - __sanitizer_syscall_pre_impl_unlink((long)(pathname)) -#define __sanitizer_syscall_post_unlink(res, pathname) \ - __sanitizer_syscall_post_impl_unlink(res, (long)(pathname)) -#define __sanitizer_syscall_pre_rename(oldname, newname) \ - __sanitizer_syscall_pre_impl_rename((long)(oldname), (long)(newname)) -#define __sanitizer_syscall_post_rename(res, oldname, newname) \ - __sanitizer_syscall_post_impl_rename(res, (long)(oldname), (long)(newname)) -#define __sanitizer_syscall_pre_chmod(filename, mode) \ - __sanitizer_syscall_pre_impl_chmod((long)(filename), (long)(mode)) -#define __sanitizer_syscall_post_chmod(res, filename, mode) \ - __sanitizer_syscall_post_impl_chmod(res, (long)(filename), (long)(mode)) -#define __sanitizer_syscall_pre_fchmod(fd, mode) \ - __sanitizer_syscall_pre_impl_fchmod((long)(fd), (long)(mode)) -#define __sanitizer_syscall_post_fchmod(res, fd, mode) \ - __sanitizer_syscall_post_impl_fchmod(res, (long)(fd), (long)(mode)) -#define __sanitizer_syscall_pre_fcntl(fd, cmd, arg) \ - __sanitizer_syscall_pre_impl_fcntl((long)(fd), (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_post_fcntl(res, fd, cmd, arg) \ - __sanitizer_syscall_post_impl_fcntl(res, (long)(fd), (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_pre_fcntl64(fd, cmd, arg) \ - __sanitizer_syscall_pre_impl_fcntl64((long)(fd), (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_post_fcntl64(res, fd, cmd, arg) \ - __sanitizer_syscall_post_impl_fcntl64(res, (long)(fd), (long)(cmd), \ - (long)(arg)) -#define __sanitizer_syscall_pre_pipe(fildes) \ - __sanitizer_syscall_pre_impl_pipe((long)(fildes)) -#define __sanitizer_syscall_post_pipe(res, fildes) \ - __sanitizer_syscall_post_impl_pipe(res, (long)(fildes)) -#define __sanitizer_syscall_pre_pipe2(fildes, flags) \ - __sanitizer_syscall_pre_impl_pipe2((long)(fildes), (long)(flags)) -#define __sanitizer_syscall_post_pipe2(res, fildes, flags) \ - __sanitizer_syscall_post_impl_pipe2(res, (long)(fildes), (long)(flags)) -#define __sanitizer_syscall_pre_dup(fildes) \ - __sanitizer_syscall_pre_impl_dup((long)(fildes)) -#define __sanitizer_syscall_post_dup(res, fildes) \ - __sanitizer_syscall_post_impl_dup(res, (long)(fildes)) -#define __sanitizer_syscall_pre_dup2(oldfd, newfd) \ - __sanitizer_syscall_pre_impl_dup2((long)(oldfd), (long)(newfd)) -#define __sanitizer_syscall_post_dup2(res, oldfd, newfd) \ - __sanitizer_syscall_post_impl_dup2(res, (long)(oldfd), (long)(newfd)) -#define __sanitizer_syscall_pre_dup3(oldfd, newfd, flags) \ - __sanitizer_syscall_pre_impl_dup3((long)(oldfd), (long)(newfd), (long)(flags)) -#define __sanitizer_syscall_post_dup3(res, oldfd, newfd, flags) \ - __sanitizer_syscall_post_impl_dup3(res, (long)(oldfd), (long)(newfd), \ - (long)(flags)) -#define __sanitizer_syscall_pre_ioperm(from, num, on) \ - __sanitizer_syscall_pre_impl_ioperm((long)(from), (long)(num), (long)(on)) -#define __sanitizer_syscall_post_ioperm(res, from, num, on) \ - __sanitizer_syscall_post_impl_ioperm(res, (long)(from), (long)(num), \ - (long)(on)) -#define __sanitizer_syscall_pre_ioctl(fd, cmd, arg) \ - __sanitizer_syscall_pre_impl_ioctl((long)(fd), (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_post_ioctl(res, fd, cmd, arg) \ - __sanitizer_syscall_post_impl_ioctl(res, (long)(fd), (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_pre_flock(fd, cmd) \ - __sanitizer_syscall_pre_impl_flock((long)(fd), (long)(cmd)) -#define __sanitizer_syscall_post_flock(res, fd, cmd) \ - __sanitizer_syscall_post_impl_flock(res, (long)(fd), (long)(cmd)) -#define __sanitizer_syscall_pre_io_setup(nr_reqs, ctx) \ - __sanitizer_syscall_pre_impl_io_setup((long)(nr_reqs), (long)(ctx)) -#define __sanitizer_syscall_post_io_setup(res, nr_reqs, ctx) \ - __sanitizer_syscall_post_impl_io_setup(res, (long)(nr_reqs), (long)(ctx)) -#define __sanitizer_syscall_pre_io_destroy(ctx) \ - __sanitizer_syscall_pre_impl_io_destroy((long)(ctx)) -#define __sanitizer_syscall_post_io_destroy(res, ctx) \ - __sanitizer_syscall_post_impl_io_destroy(res, (long)(ctx)) -#define __sanitizer_syscall_pre_io_getevents(ctx_id, min_nr, nr, events, \ - timeout) \ - __sanitizer_syscall_pre_impl_io_getevents((long)(ctx_id), (long)(min_nr), \ - (long)(nr), (long)(events), \ - (long)(timeout)) -#define __sanitizer_syscall_post_io_getevents(res, ctx_id, min_nr, nr, events, \ - timeout) \ - __sanitizer_syscall_post_impl_io_getevents(res, (long)(ctx_id), \ - (long)(min_nr), (long)(nr), \ - (long)(events), (long)(timeout)) -#define __sanitizer_syscall_pre_io_submit(ctx_id, arg1, arg2) \ - __sanitizer_syscall_pre_impl_io_submit((long)(ctx_id), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_post_io_submit(res, ctx_id, arg1, arg2) \ - __sanitizer_syscall_post_impl_io_submit(res, (long)(ctx_id), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_io_cancel(ctx_id, iocb, result) \ - __sanitizer_syscall_pre_impl_io_cancel((long)(ctx_id), (long)(iocb), \ - (long)(result)) -#define __sanitizer_syscall_post_io_cancel(res, ctx_id, iocb, result) \ - __sanitizer_syscall_post_impl_io_cancel(res, (long)(ctx_id), (long)(iocb), \ - (long)(result)) -#define __sanitizer_syscall_pre_sendfile(out_fd, in_fd, offset, count) \ - __sanitizer_syscall_pre_impl_sendfile((long)(out_fd), (long)(in_fd), \ - (long)(offset), (long)(count)) -#define __sanitizer_syscall_post_sendfile(res, out_fd, in_fd, offset, count) \ - __sanitizer_syscall_post_impl_sendfile(res, (long)(out_fd), (long)(in_fd), \ - (long)(offset), (long)(count)) -#define __sanitizer_syscall_pre_sendfile64(out_fd, in_fd, offset, count) \ - __sanitizer_syscall_pre_impl_sendfile64((long)(out_fd), (long)(in_fd), \ - (long)(offset), (long)(count)) -#define __sanitizer_syscall_post_sendfile64(res, out_fd, in_fd, offset, count) \ - __sanitizer_syscall_post_impl_sendfile64(res, (long)(out_fd), (long)(in_fd), \ - (long)(offset), (long)(count)) -#define __sanitizer_syscall_pre_readlink(path, buf, bufsiz) \ - __sanitizer_syscall_pre_impl_readlink((long)(path), (long)(buf), \ - (long)(bufsiz)) -#define __sanitizer_syscall_post_readlink(res, path, buf, bufsiz) \ - __sanitizer_syscall_post_impl_readlink(res, (long)(path), (long)(buf), \ - (long)(bufsiz)) -#define __sanitizer_syscall_pre_creat(pathname, mode) \ - __sanitizer_syscall_pre_impl_creat((long)(pathname), (long)(mode)) -#define __sanitizer_syscall_post_creat(res, pathname, mode) \ - __sanitizer_syscall_post_impl_creat(res, (long)(pathname), (long)(mode)) -#define __sanitizer_syscall_pre_open(filename, flags, mode) \ - __sanitizer_syscall_pre_impl_open((long)(filename), (long)(flags), \ - (long)(mode)) -#define __sanitizer_syscall_post_open(res, filename, flags, mode) \ - __sanitizer_syscall_post_impl_open(res, (long)(filename), (long)(flags), \ - (long)(mode)) -#define __sanitizer_syscall_pre_close(fd) \ - __sanitizer_syscall_pre_impl_close((long)(fd)) -#define __sanitizer_syscall_post_close(res, fd) \ - __sanitizer_syscall_post_impl_close(res, (long)(fd)) -#define __sanitizer_syscall_pre_access(filename, mode) \ - __sanitizer_syscall_pre_impl_access((long)(filename), (long)(mode)) -#define __sanitizer_syscall_post_access(res, filename, mode) \ - __sanitizer_syscall_post_impl_access(res, (long)(filename), (long)(mode)) -#define __sanitizer_syscall_pre_vhangup() __sanitizer_syscall_pre_impl_vhangup() -#define __sanitizer_syscall_post_vhangup(res) \ - __sanitizer_syscall_post_impl_vhangup(res) -#define __sanitizer_syscall_pre_chown(filename, user, group) \ - __sanitizer_syscall_pre_impl_chown((long)(filename), (long)(user), \ - (long)(group)) -#define __sanitizer_syscall_post_chown(res, filename, user, group) \ - __sanitizer_syscall_post_impl_chown(res, (long)(filename), (long)(user), \ - (long)(group)) -#define __sanitizer_syscall_pre_lchown(filename, user, group) \ - __sanitizer_syscall_pre_impl_lchown((long)(filename), (long)(user), \ - (long)(group)) -#define __sanitizer_syscall_post_lchown(res, filename, user, group) \ - __sanitizer_syscall_post_impl_lchown(res, (long)(filename), (long)(user), \ - (long)(group)) -#define __sanitizer_syscall_pre_fchown(fd, user, group) \ - __sanitizer_syscall_pre_impl_fchown((long)(fd), (long)(user), (long)(group)) -#define __sanitizer_syscall_post_fchown(res, fd, user, group) \ - __sanitizer_syscall_post_impl_fchown(res, (long)(fd), (long)(user), \ - (long)(group)) -#define __sanitizer_syscall_pre_chown16(filename, user, group) \ - __sanitizer_syscall_pre_impl_chown16((long)(filename), (long)user, \ - (long)group) -#define __sanitizer_syscall_post_chown16(res, filename, user, group) \ - __sanitizer_syscall_post_impl_chown16(res, (long)(filename), (long)user, \ - (long)group) -#define __sanitizer_syscall_pre_lchown16(filename, user, group) \ - __sanitizer_syscall_pre_impl_lchown16((long)(filename), (long)user, \ - (long)group) -#define __sanitizer_syscall_post_lchown16(res, filename, user, group) \ - __sanitizer_syscall_post_impl_lchown16(res, (long)(filename), (long)user, \ - (long)group) -#define __sanitizer_syscall_pre_fchown16(fd, user, group) \ - __sanitizer_syscall_pre_impl_fchown16((long)(fd), (long)user, (long)group) -#define __sanitizer_syscall_post_fchown16(res, fd, user, group) \ - __sanitizer_syscall_post_impl_fchown16(res, (long)(fd), (long)user, \ - (long)group) -#define __sanitizer_syscall_pre_setregid16(rgid, egid) \ - __sanitizer_syscall_pre_impl_setregid16((long)rgid, (long)egid) -#define __sanitizer_syscall_post_setregid16(res, rgid, egid) \ - __sanitizer_syscall_post_impl_setregid16(res, (long)rgid, (long)egid) -#define __sanitizer_syscall_pre_setgid16(gid) \ - __sanitizer_syscall_pre_impl_setgid16((long)gid) -#define __sanitizer_syscall_post_setgid16(res, gid) \ - __sanitizer_syscall_post_impl_setgid16(res, (long)gid) -#define __sanitizer_syscall_pre_setreuid16(ruid, euid) \ - __sanitizer_syscall_pre_impl_setreuid16((long)ruid, (long)euid) -#define __sanitizer_syscall_post_setreuid16(res, ruid, euid) \ - __sanitizer_syscall_post_impl_setreuid16(res, (long)ruid, (long)euid) -#define __sanitizer_syscall_pre_setuid16(uid) \ - __sanitizer_syscall_pre_impl_setuid16((long)uid) -#define __sanitizer_syscall_post_setuid16(res, uid) \ - __sanitizer_syscall_post_impl_setuid16(res, (long)uid) -#define __sanitizer_syscall_pre_setresuid16(ruid, euid, suid) \ - __sanitizer_syscall_pre_impl_setresuid16((long)ruid, (long)euid, (long)suid) -#define __sanitizer_syscall_post_setresuid16(res, ruid, euid, suid) \ - __sanitizer_syscall_post_impl_setresuid16(res, (long)ruid, (long)euid, \ - (long)suid) -#define __sanitizer_syscall_pre_getresuid16(ruid, euid, suid) \ - __sanitizer_syscall_pre_impl_getresuid16((long)(ruid), (long)(euid), \ - (long)(suid)) -#define __sanitizer_syscall_post_getresuid16(res, ruid, euid, suid) \ - __sanitizer_syscall_post_impl_getresuid16(res, (long)(ruid), (long)(euid), \ - (long)(suid)) -#define __sanitizer_syscall_pre_setresgid16(rgid, egid, sgid) \ - __sanitizer_syscall_pre_impl_setresgid16((long)rgid, (long)egid, (long)sgid) -#define __sanitizer_syscall_post_setresgid16(res, rgid, egid, sgid) \ - __sanitizer_syscall_post_impl_setresgid16(res, (long)rgid, (long)egid, \ - (long)sgid) -#define __sanitizer_syscall_pre_getresgid16(rgid, egid, sgid) \ - __sanitizer_syscall_pre_impl_getresgid16((long)(rgid), (long)(egid), \ - (long)(sgid)) -#define __sanitizer_syscall_post_getresgid16(res, rgid, egid, sgid) \ - __sanitizer_syscall_post_impl_getresgid16(res, (long)(rgid), (long)(egid), \ - (long)(sgid)) -#define __sanitizer_syscall_pre_setfsuid16(uid) \ - __sanitizer_syscall_pre_impl_setfsuid16((long)uid) -#define __sanitizer_syscall_post_setfsuid16(res, uid) \ - __sanitizer_syscall_post_impl_setfsuid16(res, (long)uid) -#define __sanitizer_syscall_pre_setfsgid16(gid) \ - __sanitizer_syscall_pre_impl_setfsgid16((long)gid) -#define __sanitizer_syscall_post_setfsgid16(res, gid) \ - __sanitizer_syscall_post_impl_setfsgid16(res, (long)gid) -#define __sanitizer_syscall_pre_getgroups16(gidsetsize, grouplist) \ - __sanitizer_syscall_pre_impl_getgroups16((long)(gidsetsize), \ - (long)(grouplist)) -#define __sanitizer_syscall_post_getgroups16(res, gidsetsize, grouplist) \ - __sanitizer_syscall_post_impl_getgroups16(res, (long)(gidsetsize), \ - (long)(grouplist)) -#define __sanitizer_syscall_pre_setgroups16(gidsetsize, grouplist) \ - __sanitizer_syscall_pre_impl_setgroups16((long)(gidsetsize), \ - (long)(grouplist)) -#define __sanitizer_syscall_post_setgroups16(res, gidsetsize, grouplist) \ - __sanitizer_syscall_post_impl_setgroups16(res, (long)(gidsetsize), \ - (long)(grouplist)) -#define __sanitizer_syscall_pre_getuid16() \ - __sanitizer_syscall_pre_impl_getuid16() -#define __sanitizer_syscall_post_getuid16(res) \ - __sanitizer_syscall_post_impl_getuid16(res) -#define __sanitizer_syscall_pre_geteuid16() \ - __sanitizer_syscall_pre_impl_geteuid16() -#define __sanitizer_syscall_post_geteuid16(res) \ - __sanitizer_syscall_post_impl_geteuid16(res) -#define __sanitizer_syscall_pre_getgid16() \ - __sanitizer_syscall_pre_impl_getgid16() -#define __sanitizer_syscall_post_getgid16(res) \ - __sanitizer_syscall_post_impl_getgid16(res) -#define __sanitizer_syscall_pre_getegid16() \ - __sanitizer_syscall_pre_impl_getegid16() -#define __sanitizer_syscall_post_getegid16(res) \ - __sanitizer_syscall_post_impl_getegid16(res) -#define __sanitizer_syscall_pre_utime(filename, times) \ - __sanitizer_syscall_pre_impl_utime((long)(filename), (long)(times)) -#define __sanitizer_syscall_post_utime(res, filename, times) \ - __sanitizer_syscall_post_impl_utime(res, (long)(filename), (long)(times)) -#define __sanitizer_syscall_pre_utimes(filename, utimes) \ - __sanitizer_syscall_pre_impl_utimes((long)(filename), (long)(utimes)) -#define __sanitizer_syscall_post_utimes(res, filename, utimes) \ - __sanitizer_syscall_post_impl_utimes(res, (long)(filename), (long)(utimes)) -#define __sanitizer_syscall_pre_lseek(fd, offset, origin) \ - __sanitizer_syscall_pre_impl_lseek((long)(fd), (long)(offset), (long)(origin)) -#define __sanitizer_syscall_post_lseek(res, fd, offset, origin) \ - __sanitizer_syscall_post_impl_lseek(res, (long)(fd), (long)(offset), \ - (long)(origin)) -#define __sanitizer_syscall_pre_llseek(fd, offset_high, offset_low, result, \ - origin) \ - __sanitizer_syscall_pre_impl_llseek((long)(fd), (long)(offset_high), \ - (long)(offset_low), (long)(result), \ - (long)(origin)) -#define __sanitizer_syscall_post_llseek(res, fd, offset_high, offset_low, \ - result, origin) \ - __sanitizer_syscall_post_impl_llseek(res, (long)(fd), (long)(offset_high), \ - (long)(offset_low), (long)(result), \ - (long)(origin)) -#define __sanitizer_syscall_pre_read(fd, buf, count) \ - __sanitizer_syscall_pre_impl_read((long)(fd), (long)(buf), (long)(count)) -#define __sanitizer_syscall_post_read(res, fd, buf, count) \ - __sanitizer_syscall_post_impl_read(res, (long)(fd), (long)(buf), \ - (long)(count)) -#define __sanitizer_syscall_pre_readv(fd, vec, vlen) \ - __sanitizer_syscall_pre_impl_readv((long)(fd), (long)(vec), (long)(vlen)) -#define __sanitizer_syscall_post_readv(res, fd, vec, vlen) \ - __sanitizer_syscall_post_impl_readv(res, (long)(fd), (long)(vec), \ - (long)(vlen)) -#define __sanitizer_syscall_pre_write(fd, buf, count) \ - __sanitizer_syscall_pre_impl_write((long)(fd), (long)(buf), (long)(count)) -#define __sanitizer_syscall_post_write(res, fd, buf, count) \ - __sanitizer_syscall_post_impl_write(res, (long)(fd), (long)(buf), \ - (long)(count)) -#define __sanitizer_syscall_pre_writev(fd, vec, vlen) \ - __sanitizer_syscall_pre_impl_writev((long)(fd), (long)(vec), (long)(vlen)) -#define __sanitizer_syscall_post_writev(res, fd, vec, vlen) \ - __sanitizer_syscall_post_impl_writev(res, (long)(fd), (long)(vec), \ - (long)(vlen)) - -#ifdef _LP64 -#define __sanitizer_syscall_pre_pread64(fd, buf, count, pos) \ - __sanitizer_syscall_pre_impl_pread64((long)(fd), (long)(buf), (long)(count), \ - (long)(pos)) -#define __sanitizer_syscall_post_pread64(res, fd, buf, count, pos) \ - __sanitizer_syscall_post_impl_pread64(res, (long)(fd), (long)(buf), \ - (long)(count), (long)(pos)) -#define __sanitizer_syscall_pre_pwrite64(fd, buf, count, pos) \ - __sanitizer_syscall_pre_impl_pwrite64((long)(fd), (long)(buf), \ - (long)(count), (long)(pos)) -#define __sanitizer_syscall_post_pwrite64(res, fd, buf, count, pos) \ - __sanitizer_syscall_post_impl_pwrite64(res, (long)(fd), (long)(buf), \ - (long)(count), (long)(pos)) -#else -#define __sanitizer_syscall_pre_pread64(fd, buf, count, pos0, pos1) \ - __sanitizer_syscall_pre_impl_pread64((long)(fd), (long)(buf), (long)(count), \ - (long)(pos0), (long)(pos1)) -#define __sanitizer_syscall_post_pread64(res, fd, buf, count, pos0, pos1) \ - __sanitizer_syscall_post_impl_pread64( \ - res, (long)(fd), (long)(buf), (long)(count), (long)(pos0), (long)(pos1)) -#define __sanitizer_syscall_pre_pwrite64(fd, buf, count, pos0, pos1) \ - __sanitizer_syscall_pre_impl_pwrite64( \ - (long)(fd), (long)(buf), (long)(count), (long)(pos0), (long)(pos1)) -#define __sanitizer_syscall_post_pwrite64(res, fd, buf, count, pos0, pos1) \ - __sanitizer_syscall_post_impl_pwrite64( \ - res, (long)(fd), (long)(buf), (long)(count), (long)(pos0), (long)(pos1)) -#endif - -#define __sanitizer_syscall_pre_preadv(fd, vec, vlen, pos_l, pos_h) \ - __sanitizer_syscall_pre_impl_preadv((long)(fd), (long)(vec), (long)(vlen), \ - (long)(pos_l), (long)(pos_h)) -#define __sanitizer_syscall_post_preadv(res, fd, vec, vlen, pos_l, pos_h) \ - __sanitizer_syscall_post_impl_preadv(res, (long)(fd), (long)(vec), \ - (long)(vlen), (long)(pos_l), \ - (long)(pos_h)) -#define __sanitizer_syscall_pre_pwritev(fd, vec, vlen, pos_l, pos_h) \ - __sanitizer_syscall_pre_impl_pwritev((long)(fd), (long)(vec), (long)(vlen), \ - (long)(pos_l), (long)(pos_h)) -#define __sanitizer_syscall_post_pwritev(res, fd, vec, vlen, pos_l, pos_h) \ - __sanitizer_syscall_post_impl_pwritev(res, (long)(fd), (long)(vec), \ - (long)(vlen), (long)(pos_l), \ - (long)(pos_h)) -#define __sanitizer_syscall_pre_getcwd(buf, size) \ - __sanitizer_syscall_pre_impl_getcwd((long)(buf), (long)(size)) -#define __sanitizer_syscall_post_getcwd(res, buf, size) \ - __sanitizer_syscall_post_impl_getcwd(res, (long)(buf), (long)(size)) -#define __sanitizer_syscall_pre_mkdir(pathname, mode) \ - __sanitizer_syscall_pre_impl_mkdir((long)(pathname), (long)(mode)) -#define __sanitizer_syscall_post_mkdir(res, pathname, mode) \ - __sanitizer_syscall_post_impl_mkdir(res, (long)(pathname), (long)(mode)) -#define __sanitizer_syscall_pre_chdir(filename) \ - __sanitizer_syscall_pre_impl_chdir((long)(filename)) -#define __sanitizer_syscall_post_chdir(res, filename) \ - __sanitizer_syscall_post_impl_chdir(res, (long)(filename)) -#define __sanitizer_syscall_pre_fchdir(fd) \ - __sanitizer_syscall_pre_impl_fchdir((long)(fd)) -#define __sanitizer_syscall_post_fchdir(res, fd) \ - __sanitizer_syscall_post_impl_fchdir(res, (long)(fd)) -#define __sanitizer_syscall_pre_rmdir(pathname) \ - __sanitizer_syscall_pre_impl_rmdir((long)(pathname)) -#define __sanitizer_syscall_post_rmdir(res, pathname) \ - __sanitizer_syscall_post_impl_rmdir(res, (long)(pathname)) -#define __sanitizer_syscall_pre_lookup_dcookie(cookie64, buf, len) \ - __sanitizer_syscall_pre_impl_lookup_dcookie((long)(cookie64), (long)(buf), \ - (long)(len)) -#define __sanitizer_syscall_post_lookup_dcookie(res, cookie64, buf, len) \ - __sanitizer_syscall_post_impl_lookup_dcookie(res, (long)(cookie64), \ - (long)(buf), (long)(len)) -#define __sanitizer_syscall_pre_quotactl(cmd, special, id, addr) \ - __sanitizer_syscall_pre_impl_quotactl((long)(cmd), (long)(special), \ - (long)(id), (long)(addr)) -#define __sanitizer_syscall_post_quotactl(res, cmd, special, id, addr) \ - __sanitizer_syscall_post_impl_quotactl(res, (long)(cmd), (long)(special), \ - (long)(id), (long)(addr)) -#define __sanitizer_syscall_pre_getdents(fd, dirent, count) \ - __sanitizer_syscall_pre_impl_getdents((long)(fd), (long)(dirent), \ - (long)(count)) -#define __sanitizer_syscall_post_getdents(res, fd, dirent, count) \ - __sanitizer_syscall_post_impl_getdents(res, (long)(fd), (long)(dirent), \ - (long)(count)) -#define __sanitizer_syscall_pre_getdents64(fd, dirent, count) \ - __sanitizer_syscall_pre_impl_getdents64((long)(fd), (long)(dirent), \ - (long)(count)) -#define __sanitizer_syscall_post_getdents64(res, fd, dirent, count) \ - __sanitizer_syscall_post_impl_getdents64(res, (long)(fd), (long)(dirent), \ - (long)(count)) -#define __sanitizer_syscall_pre_setsockopt(fd, level, optname, optval, optlen) \ - __sanitizer_syscall_pre_impl_setsockopt((long)(fd), (long)(level), \ - (long)(optname), (long)(optval), \ - (long)(optlen)) -#define __sanitizer_syscall_post_setsockopt(res, fd, level, optname, optval, \ - optlen) \ - __sanitizer_syscall_post_impl_setsockopt(res, (long)(fd), (long)(level), \ - (long)(optname), (long)(optval), \ - (long)(optlen)) -#define __sanitizer_syscall_pre_getsockopt(fd, level, optname, optval, optlen) \ - __sanitizer_syscall_pre_impl_getsockopt((long)(fd), (long)(level), \ - (long)(optname), (long)(optval), \ - (long)(optlen)) -#define __sanitizer_syscall_post_getsockopt(res, fd, level, optname, optval, \ - optlen) \ - __sanitizer_syscall_post_impl_getsockopt(res, (long)(fd), (long)(level), \ - (long)(optname), (long)(optval), \ - (long)(optlen)) -#define __sanitizer_syscall_pre_bind(arg0, arg1, arg2) \ - __sanitizer_syscall_pre_impl_bind((long)(arg0), (long)(arg1), (long)(arg2)) -#define __sanitizer_syscall_post_bind(res, arg0, arg1, arg2) \ - __sanitizer_syscall_post_impl_bind(res, (long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_connect(arg0, arg1, arg2) \ - __sanitizer_syscall_pre_impl_connect((long)(arg0), (long)(arg1), (long)(arg2)) -#define __sanitizer_syscall_post_connect(res, arg0, arg1, arg2) \ - __sanitizer_syscall_post_impl_connect(res, (long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_accept(arg0, arg1, arg2) \ - __sanitizer_syscall_pre_impl_accept((long)(arg0), (long)(arg1), (long)(arg2)) -#define __sanitizer_syscall_post_accept(res, arg0, arg1, arg2) \ - __sanitizer_syscall_post_impl_accept(res, (long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_accept4(arg0, arg1, arg2, arg3) \ - __sanitizer_syscall_pre_impl_accept4((long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3)) -#define __sanitizer_syscall_post_accept4(res, arg0, arg1, arg2, arg3) \ - __sanitizer_syscall_post_impl_accept4(res, (long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3)) -#define __sanitizer_syscall_pre_getsockname(arg0, arg1, arg2) \ - __sanitizer_syscall_pre_impl_getsockname((long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_post_getsockname(res, arg0, arg1, arg2) \ - __sanitizer_syscall_post_impl_getsockname(res, (long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_getpeername(arg0, arg1, arg2) \ - __sanitizer_syscall_pre_impl_getpeername((long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_post_getpeername(res, arg0, arg1, arg2) \ - __sanitizer_syscall_post_impl_getpeername(res, (long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_send(arg0, arg1, arg2, arg3) \ - __sanitizer_syscall_pre_impl_send((long)(arg0), (long)(arg1), (long)(arg2), \ - (long)(arg3)) -#define __sanitizer_syscall_post_send(res, arg0, arg1, arg2, arg3) \ - __sanitizer_syscall_post_impl_send(res, (long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3)) -#define __sanitizer_syscall_pre_sendto(arg0, arg1, arg2, arg3, arg4, arg5) \ - __sanitizer_syscall_pre_impl_sendto((long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3), \ - (long)(arg4), (long)(arg5)) -#define __sanitizer_syscall_post_sendto(res, arg0, arg1, arg2, arg3, arg4, \ - arg5) \ - __sanitizer_syscall_post_impl_sendto(res, (long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3), \ - (long)(arg4), (long)(arg5)) -#define __sanitizer_syscall_pre_sendmsg(fd, msg, flags) \ - __sanitizer_syscall_pre_impl_sendmsg((long)(fd), (long)(msg), (long)(flags)) -#define __sanitizer_syscall_post_sendmsg(res, fd, msg, flags) \ - __sanitizer_syscall_post_impl_sendmsg(res, (long)(fd), (long)(msg), \ - (long)(flags)) -#define __sanitizer_syscall_pre_sendmmsg(fd, msg, vlen, flags) \ - __sanitizer_syscall_pre_impl_sendmmsg((long)(fd), (long)(msg), (long)(vlen), \ - (long)(flags)) -#define __sanitizer_syscall_post_sendmmsg(res, fd, msg, vlen, flags) \ - __sanitizer_syscall_post_impl_sendmmsg(res, (long)(fd), (long)(msg), \ - (long)(vlen), (long)(flags)) -#define __sanitizer_syscall_pre_recv(arg0, arg1, arg2, arg3) \ - __sanitizer_syscall_pre_impl_recv((long)(arg0), (long)(arg1), (long)(arg2), \ - (long)(arg3)) -#define __sanitizer_syscall_post_recv(res, arg0, arg1, arg2, arg3) \ - __sanitizer_syscall_post_impl_recv(res, (long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3)) -#define __sanitizer_syscall_pre_recvfrom(arg0, arg1, arg2, arg3, arg4, arg5) \ - __sanitizer_syscall_pre_impl_recvfrom((long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3), \ - (long)(arg4), (long)(arg5)) -#define __sanitizer_syscall_post_recvfrom(res, arg0, arg1, arg2, arg3, arg4, \ - arg5) \ - __sanitizer_syscall_post_impl_recvfrom(res, (long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3), \ - (long)(arg4), (long)(arg5)) -#define __sanitizer_syscall_pre_recvmsg(fd, msg, flags) \ - __sanitizer_syscall_pre_impl_recvmsg((long)(fd), (long)(msg), (long)(flags)) -#define __sanitizer_syscall_post_recvmsg(res, fd, msg, flags) \ - __sanitizer_syscall_post_impl_recvmsg(res, (long)(fd), (long)(msg), \ - (long)(flags)) -#define __sanitizer_syscall_pre_recvmmsg(fd, msg, vlen, flags, timeout) \ - __sanitizer_syscall_pre_impl_recvmmsg((long)(fd), (long)(msg), (long)(vlen), \ - (long)(flags), (long)(timeout)) -#define __sanitizer_syscall_post_recvmmsg(res, fd, msg, vlen, flags, timeout) \ - __sanitizer_syscall_post_impl_recvmmsg(res, (long)(fd), (long)(msg), \ - (long)(vlen), (long)(flags), \ - (long)(timeout)) -#define __sanitizer_syscall_pre_socket(arg0, arg1, arg2) \ - __sanitizer_syscall_pre_impl_socket((long)(arg0), (long)(arg1), (long)(arg2)) -#define __sanitizer_syscall_post_socket(res, arg0, arg1, arg2) \ - __sanitizer_syscall_post_impl_socket(res, (long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_socketpair(arg0, arg1, arg2, arg3) \ - __sanitizer_syscall_pre_impl_socketpair((long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3)) -#define __sanitizer_syscall_post_socketpair(res, arg0, arg1, arg2, arg3) \ - __sanitizer_syscall_post_impl_socketpair(res, (long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3)) -#define __sanitizer_syscall_pre_socketcall(call, args) \ - __sanitizer_syscall_pre_impl_socketcall((long)(call), (long)(args)) -#define __sanitizer_syscall_post_socketcall(res, call, args) \ - __sanitizer_syscall_post_impl_socketcall(res, (long)(call), (long)(args)) -#define __sanitizer_syscall_pre_listen(arg0, arg1) \ - __sanitizer_syscall_pre_impl_listen((long)(arg0), (long)(arg1)) -#define __sanitizer_syscall_post_listen(res, arg0, arg1) \ - __sanitizer_syscall_post_impl_listen(res, (long)(arg0), (long)(arg1)) -#define __sanitizer_syscall_pre_poll(ufds, nfds, timeout) \ - __sanitizer_syscall_pre_impl_poll((long)(ufds), (long)(nfds), (long)(timeout)) -#define __sanitizer_syscall_post_poll(res, ufds, nfds, timeout) \ - __sanitizer_syscall_post_impl_poll(res, (long)(ufds), (long)(nfds), \ - (long)(timeout)) -#define __sanitizer_syscall_pre_select(n, inp, outp, exp, tvp) \ - __sanitizer_syscall_pre_impl_select((long)(n), (long)(inp), (long)(outp), \ - (long)(exp), (long)(tvp)) -#define __sanitizer_syscall_post_select(res, n, inp, outp, exp, tvp) \ - __sanitizer_syscall_post_impl_select(res, (long)(n), (long)(inp), \ - (long)(outp), (long)(exp), (long)(tvp)) -#define __sanitizer_syscall_pre_old_select(arg) \ - __sanitizer_syscall_pre_impl_old_select((long)(arg)) -#define __sanitizer_syscall_post_old_select(res, arg) \ - __sanitizer_syscall_post_impl_old_select(res, (long)(arg)) -#define __sanitizer_syscall_pre_epoll_create(size) \ - __sanitizer_syscall_pre_impl_epoll_create((long)(size)) -#define __sanitizer_syscall_post_epoll_create(res, size) \ - __sanitizer_syscall_post_impl_epoll_create(res, (long)(size)) -#define __sanitizer_syscall_pre_epoll_create1(flags) \ - __sanitizer_syscall_pre_impl_epoll_create1((long)(flags)) -#define __sanitizer_syscall_post_epoll_create1(res, flags) \ - __sanitizer_syscall_post_impl_epoll_create1(res, (long)(flags)) -#define __sanitizer_syscall_pre_epoll_ctl(epfd, op, fd, event) \ - __sanitizer_syscall_pre_impl_epoll_ctl((long)(epfd), (long)(op), (long)(fd), \ - (long)(event)) -#define __sanitizer_syscall_post_epoll_ctl(res, epfd, op, fd, event) \ - __sanitizer_syscall_post_impl_epoll_ctl(res, (long)(epfd), (long)(op), \ - (long)(fd), (long)(event)) -#define __sanitizer_syscall_pre_epoll_wait(epfd, events, maxevents, timeout) \ - __sanitizer_syscall_pre_impl_epoll_wait((long)(epfd), (long)(events), \ - (long)(maxevents), (long)(timeout)) -#define __sanitizer_syscall_post_epoll_wait(res, epfd, events, maxevents, \ - timeout) \ - __sanitizer_syscall_post_impl_epoll_wait(res, (long)(epfd), (long)(events), \ - (long)(maxevents), (long)(timeout)) -#define __sanitizer_syscall_pre_epoll_pwait(epfd, events, maxevents, timeout, \ - sigmask, sigsetsize) \ - __sanitizer_syscall_pre_impl_epoll_pwait( \ - (long)(epfd), (long)(events), (long)(maxevents), (long)(timeout), \ - (long)(sigmask), (long)(sigsetsize)) -#define __sanitizer_syscall_post_epoll_pwait(res, epfd, events, maxevents, \ - timeout, sigmask, sigsetsize) \ - __sanitizer_syscall_post_impl_epoll_pwait( \ - res, (long)(epfd), (long)(events), (long)(maxevents), (long)(timeout), \ - (long)(sigmask), (long)(sigsetsize)) -#define __sanitizer_syscall_pre_epoll_pwait2(epfd, events, maxevents, timeout, \ - sigmask, sigsetsize) \ - __sanitizer_syscall_pre_impl_epoll_pwait2( \ - (long)(epfd), (long)(events), (long)(maxevents), (long)(timeout), \ - (long)(sigmask), (long)(sigsetsize)) -#define __sanitizer_syscall_post_epoll_pwait2(res, epfd, events, maxevents, \ - timeout, sigmask, sigsetsize) \ - __sanitizer_syscall_post_impl_epoll_pwait2( \ - res, (long)(epfd), (long)(events), (long)(maxevents), (long)(timeout), \ - (long)(sigmask), (long)(sigsetsize)) -#define __sanitizer_syscall_pre_gethostname(name, len) \ - __sanitizer_syscall_pre_impl_gethostname((long)(name), (long)(len)) -#define __sanitizer_syscall_post_gethostname(res, name, len) \ - __sanitizer_syscall_post_impl_gethostname(res, (long)(name), (long)(len)) -#define __sanitizer_syscall_pre_sethostname(name, len) \ - __sanitizer_syscall_pre_impl_sethostname((long)(name), (long)(len)) -#define __sanitizer_syscall_post_sethostname(res, name, len) \ - __sanitizer_syscall_post_impl_sethostname(res, (long)(name), (long)(len)) -#define __sanitizer_syscall_pre_setdomainname(name, len) \ - __sanitizer_syscall_pre_impl_setdomainname((long)(name), (long)(len)) -#define __sanitizer_syscall_post_setdomainname(res, name, len) \ - __sanitizer_syscall_post_impl_setdomainname(res, (long)(name), (long)(len)) -#define __sanitizer_syscall_pre_newuname(name) \ - __sanitizer_syscall_pre_impl_newuname((long)(name)) -#define __sanitizer_syscall_post_newuname(res, name) \ - __sanitizer_syscall_post_impl_newuname(res, (long)(name)) -#define __sanitizer_syscall_pre_uname(arg0) \ - __sanitizer_syscall_pre_impl_uname((long)(arg0)) -#define __sanitizer_syscall_post_uname(res, arg0) \ - __sanitizer_syscall_post_impl_uname(res, (long)(arg0)) -#define __sanitizer_syscall_pre_olduname(arg0) \ - __sanitizer_syscall_pre_impl_olduname((long)(arg0)) -#define __sanitizer_syscall_post_olduname(res, arg0) \ - __sanitizer_syscall_post_impl_olduname(res, (long)(arg0)) -#define __sanitizer_syscall_pre_getrlimit(resource, rlim) \ - __sanitizer_syscall_pre_impl_getrlimit((long)(resource), (long)(rlim)) -#define __sanitizer_syscall_post_getrlimit(res, resource, rlim) \ - __sanitizer_syscall_post_impl_getrlimit(res, (long)(resource), (long)(rlim)) -#define __sanitizer_syscall_pre_old_getrlimit(resource, rlim) \ - __sanitizer_syscall_pre_impl_old_getrlimit((long)(resource), (long)(rlim)) -#define __sanitizer_syscall_post_old_getrlimit(res, resource, rlim) \ - __sanitizer_syscall_post_impl_old_getrlimit(res, (long)(resource), \ - (long)(rlim)) -#define __sanitizer_syscall_pre_setrlimit(resource, rlim) \ - __sanitizer_syscall_pre_impl_setrlimit((long)(resource), (long)(rlim)) -#define __sanitizer_syscall_post_setrlimit(res, resource, rlim) \ - __sanitizer_syscall_post_impl_setrlimit(res, (long)(resource), (long)(rlim)) -#define __sanitizer_syscall_pre_prlimit64(pid, resource, new_rlim, old_rlim) \ - __sanitizer_syscall_pre_impl_prlimit64((long)(pid), (long)(resource), \ - (long)(new_rlim), (long)(old_rlim)) -#define __sanitizer_syscall_post_prlimit64(res, pid, resource, new_rlim, \ - old_rlim) \ - __sanitizer_syscall_post_impl_prlimit64(res, (long)(pid), (long)(resource), \ - (long)(new_rlim), (long)(old_rlim)) -#define __sanitizer_syscall_pre_getrusage(who, ru) \ - __sanitizer_syscall_pre_impl_getrusage((long)(who), (long)(ru)) -#define __sanitizer_syscall_post_getrusage(res, who, ru) \ - __sanitizer_syscall_post_impl_getrusage(res, (long)(who), (long)(ru)) -#define __sanitizer_syscall_pre_umask(mask) \ - __sanitizer_syscall_pre_impl_umask((long)(mask)) -#define __sanitizer_syscall_post_umask(res, mask) \ - __sanitizer_syscall_post_impl_umask(res, (long)(mask)) -#define __sanitizer_syscall_pre_msgget(key, msgflg) \ - __sanitizer_syscall_pre_impl_msgget((long)(key), (long)(msgflg)) -#define __sanitizer_syscall_post_msgget(res, key, msgflg) \ - __sanitizer_syscall_post_impl_msgget(res, (long)(key), (long)(msgflg)) -#define __sanitizer_syscall_pre_msgsnd(msqid, msgp, msgsz, msgflg) \ - __sanitizer_syscall_pre_impl_msgsnd((long)(msqid), (long)(msgp), \ - (long)(msgsz), (long)(msgflg)) -#define __sanitizer_syscall_post_msgsnd(res, msqid, msgp, msgsz, msgflg) \ - __sanitizer_syscall_post_impl_msgsnd(res, (long)(msqid), (long)(msgp), \ - (long)(msgsz), (long)(msgflg)) -#define __sanitizer_syscall_pre_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg) \ - __sanitizer_syscall_pre_impl_msgrcv((long)(msqid), (long)(msgp), \ - (long)(msgsz), (long)(msgtyp), \ - (long)(msgflg)) -#define __sanitizer_syscall_post_msgrcv(res, msqid, msgp, msgsz, msgtyp, \ - msgflg) \ - __sanitizer_syscall_post_impl_msgrcv(res, (long)(msqid), (long)(msgp), \ - (long)(msgsz), (long)(msgtyp), \ - (long)(msgflg)) -#define __sanitizer_syscall_pre_msgctl(msqid, cmd, buf) \ - __sanitizer_syscall_pre_impl_msgctl((long)(msqid), (long)(cmd), (long)(buf)) -#define __sanitizer_syscall_post_msgctl(res, msqid, cmd, buf) \ - __sanitizer_syscall_post_impl_msgctl(res, (long)(msqid), (long)(cmd), \ - (long)(buf)) -#define __sanitizer_syscall_pre_semget(key, nsems, semflg) \ - __sanitizer_syscall_pre_impl_semget((long)(key), (long)(nsems), \ - (long)(semflg)) -#define __sanitizer_syscall_post_semget(res, key, nsems, semflg) \ - __sanitizer_syscall_post_impl_semget(res, (long)(key), (long)(nsems), \ - (long)(semflg)) -#define __sanitizer_syscall_pre_semop(semid, sops, nsops) \ - __sanitizer_syscall_pre_impl_semop((long)(semid), (long)(sops), (long)(nsops)) -#define __sanitizer_syscall_post_semop(res, semid, sops, nsops) \ - __sanitizer_syscall_post_impl_semop(res, (long)(semid), (long)(sops), \ - (long)(nsops)) -#define __sanitizer_syscall_pre_semctl(semid, semnum, cmd, arg) \ - __sanitizer_syscall_pre_impl_semctl((long)(semid), (long)(semnum), \ - (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_post_semctl(res, semid, semnum, cmd, arg) \ - __sanitizer_syscall_post_impl_semctl(res, (long)(semid), (long)(semnum), \ - (long)(cmd), (long)(arg)) -#define __sanitizer_syscall_pre_semtimedop(semid, sops, nsops, timeout) \ - __sanitizer_syscall_pre_impl_semtimedop((long)(semid), (long)(sops), \ - (long)(nsops), (long)(timeout)) -#define __sanitizer_syscall_post_semtimedop(res, semid, sops, nsops, timeout) \ - __sanitizer_syscall_post_impl_semtimedop(res, (long)(semid), (long)(sops), \ - (long)(nsops), (long)(timeout)) -#define __sanitizer_syscall_pre_shmat(shmid, shmaddr, shmflg) \ - __sanitizer_syscall_pre_impl_shmat((long)(shmid), (long)(shmaddr), \ - (long)(shmflg)) -#define __sanitizer_syscall_post_shmat(res, shmid, shmaddr, shmflg) \ - __sanitizer_syscall_post_impl_shmat(res, (long)(shmid), (long)(shmaddr), \ - (long)(shmflg)) -#define __sanitizer_syscall_pre_shmget(key, size, flag) \ - __sanitizer_syscall_pre_impl_shmget((long)(key), (long)(size), (long)(flag)) -#define __sanitizer_syscall_post_shmget(res, key, size, flag) \ - __sanitizer_syscall_post_impl_shmget(res, (long)(key), (long)(size), \ - (long)(flag)) -#define __sanitizer_syscall_pre_shmdt(shmaddr) \ - __sanitizer_syscall_pre_impl_shmdt((long)(shmaddr)) -#define __sanitizer_syscall_post_shmdt(res, shmaddr) \ - __sanitizer_syscall_post_impl_shmdt(res, (long)(shmaddr)) -#define __sanitizer_syscall_pre_shmctl(shmid, cmd, buf) \ - __sanitizer_syscall_pre_impl_shmctl((long)(shmid), (long)(cmd), (long)(buf)) -#define __sanitizer_syscall_post_shmctl(res, shmid, cmd, buf) \ - __sanitizer_syscall_post_impl_shmctl(res, (long)(shmid), (long)(cmd), \ - (long)(buf)) -#define __sanitizer_syscall_pre_ipc(call, first, second, third, ptr, fifth) \ - __sanitizer_syscall_pre_impl_ipc((long)(call), (long)(first), \ - (long)(second), (long)(third), (long)(ptr), \ - (long)(fifth)) -#define __sanitizer_syscall_post_ipc(res, call, first, second, third, ptr, \ - fifth) \ - __sanitizer_syscall_post_impl_ipc(res, (long)(call), (long)(first), \ - (long)(second), (long)(third), \ - (long)(ptr), (long)(fifth)) -#define __sanitizer_syscall_pre_mq_open(name, oflag, mode, attr) \ - __sanitizer_syscall_pre_impl_mq_open((long)(name), (long)(oflag), \ - (long)(mode), (long)(attr)) -#define __sanitizer_syscall_post_mq_open(res, name, oflag, mode, attr) \ - __sanitizer_syscall_post_impl_mq_open(res, (long)(name), (long)(oflag), \ - (long)(mode), (long)(attr)) -#define __sanitizer_syscall_pre_mq_unlink(name) \ - __sanitizer_syscall_pre_impl_mq_unlink((long)(name)) -#define __sanitizer_syscall_post_mq_unlink(res, name) \ - __sanitizer_syscall_post_impl_mq_unlink(res, (long)(name)) -#define __sanitizer_syscall_pre_mq_timedsend(mqdes, msg_ptr, msg_len, \ - msg_prio, abs_timeout) \ - __sanitizer_syscall_pre_impl_mq_timedsend((long)(mqdes), (long)(msg_ptr), \ - (long)(msg_len), (long)(msg_prio), \ - (long)(abs_timeout)) -#define __sanitizer_syscall_post_mq_timedsend(res, mqdes, msg_ptr, msg_len, \ - msg_prio, abs_timeout) \ - __sanitizer_syscall_post_impl_mq_timedsend( \ - res, (long)(mqdes), (long)(msg_ptr), (long)(msg_len), (long)(msg_prio), \ - (long)(abs_timeout)) -#define __sanitizer_syscall_pre_mq_timedreceive(mqdes, msg_ptr, msg_len, \ - msg_prio, abs_timeout) \ - __sanitizer_syscall_pre_impl_mq_timedreceive( \ - (long)(mqdes), (long)(msg_ptr), (long)(msg_len), (long)(msg_prio), \ - (long)(abs_timeout)) -#define __sanitizer_syscall_post_mq_timedreceive(res, mqdes, msg_ptr, msg_len, \ - msg_prio, abs_timeout) \ - __sanitizer_syscall_post_impl_mq_timedreceive( \ - res, (long)(mqdes), (long)(msg_ptr), (long)(msg_len), (long)(msg_prio), \ - (long)(abs_timeout)) -#define __sanitizer_syscall_pre_mq_notify(mqdes, notification) \ - __sanitizer_syscall_pre_impl_mq_notify((long)(mqdes), (long)(notification)) -#define __sanitizer_syscall_post_mq_notify(res, mqdes, notification) \ - __sanitizer_syscall_post_impl_mq_notify(res, (long)(mqdes), \ - (long)(notification)) -#define __sanitizer_syscall_pre_mq_getsetattr(mqdes, mqstat, omqstat) \ - __sanitizer_syscall_pre_impl_mq_getsetattr((long)(mqdes), (long)(mqstat), \ - (long)(omqstat)) -#define __sanitizer_syscall_post_mq_getsetattr(res, mqdes, mqstat, omqstat) \ - __sanitizer_syscall_post_impl_mq_getsetattr(res, (long)(mqdes), \ - (long)(mqstat), (long)(omqstat)) -#define __sanitizer_syscall_pre_pciconfig_iobase(which, bus, devfn) \ - __sanitizer_syscall_pre_impl_pciconfig_iobase((long)(which), (long)(bus), \ - (long)(devfn)) -#define __sanitizer_syscall_post_pciconfig_iobase(res, which, bus, devfn) \ - __sanitizer_syscall_post_impl_pciconfig_iobase(res, (long)(which), \ - (long)(bus), (long)(devfn)) -#define __sanitizer_syscall_pre_pciconfig_read(bus, dfn, off, len, buf) \ - __sanitizer_syscall_pre_impl_pciconfig_read( \ - (long)(bus), (long)(dfn), (long)(off), (long)(len), (long)(buf)) -#define __sanitizer_syscall_post_pciconfig_read(res, bus, dfn, off, len, buf) \ - __sanitizer_syscall_post_impl_pciconfig_read( \ - res, (long)(bus), (long)(dfn), (long)(off), (long)(len), (long)(buf)) -#define __sanitizer_syscall_pre_pciconfig_write(bus, dfn, off, len, buf) \ - __sanitizer_syscall_pre_impl_pciconfig_write( \ - (long)(bus), (long)(dfn), (long)(off), (long)(len), (long)(buf)) -#define __sanitizer_syscall_post_pciconfig_write(res, bus, dfn, off, len, buf) \ - __sanitizer_syscall_post_impl_pciconfig_write( \ - res, (long)(bus), (long)(dfn), (long)(off), (long)(len), (long)(buf)) -#define __sanitizer_syscall_pre_swapon(specialfile, swap_flags) \ - __sanitizer_syscall_pre_impl_swapon((long)(specialfile), (long)(swap_flags)) -#define __sanitizer_syscall_post_swapon(res, specialfile, swap_flags) \ - __sanitizer_syscall_post_impl_swapon(res, (long)(specialfile), \ - (long)(swap_flags)) -#define __sanitizer_syscall_pre_swapoff(specialfile) \ - __sanitizer_syscall_pre_impl_swapoff((long)(specialfile)) -#define __sanitizer_syscall_post_swapoff(res, specialfile) \ - __sanitizer_syscall_post_impl_swapoff(res, (long)(specialfile)) -#define __sanitizer_syscall_pre_sysctl(args) \ - __sanitizer_syscall_pre_impl_sysctl((long)(args)) -#define __sanitizer_syscall_post_sysctl(res, args) \ - __sanitizer_syscall_post_impl_sysctl(res, (long)(args)) -#define __sanitizer_syscall_pre_sysinfo(info) \ - __sanitizer_syscall_pre_impl_sysinfo((long)(info)) -#define __sanitizer_syscall_post_sysinfo(res, info) \ - __sanitizer_syscall_post_impl_sysinfo(res, (long)(info)) -#define __sanitizer_syscall_pre_sysfs(option, arg1, arg2) \ - __sanitizer_syscall_pre_impl_sysfs((long)(option), (long)(arg1), (long)(arg2)) -#define __sanitizer_syscall_post_sysfs(res, option, arg1, arg2) \ - __sanitizer_syscall_post_impl_sysfs(res, (long)(option), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_syslog(type, buf, len) \ - __sanitizer_syscall_pre_impl_syslog((long)(type), (long)(buf), (long)(len)) -#define __sanitizer_syscall_post_syslog(res, type, buf, len) \ - __sanitizer_syscall_post_impl_syslog(res, (long)(type), (long)(buf), \ - (long)(len)) -#define __sanitizer_syscall_pre_uselib(library) \ - __sanitizer_syscall_pre_impl_uselib((long)(library)) -#define __sanitizer_syscall_post_uselib(res, library) \ - __sanitizer_syscall_post_impl_uselib(res, (long)(library)) -#define __sanitizer_syscall_pre_ni_syscall() \ - __sanitizer_syscall_pre_impl_ni_syscall() -#define __sanitizer_syscall_post_ni_syscall(res) \ - __sanitizer_syscall_post_impl_ni_syscall(res) -#define __sanitizer_syscall_pre_ptrace(request, pid, addr, data) \ - __sanitizer_syscall_pre_impl_ptrace((long)(request), (long)(pid), \ - (long)(addr), (long)(data)) -#define __sanitizer_syscall_post_ptrace(res, request, pid, addr, data) \ - __sanitizer_syscall_post_impl_ptrace(res, (long)(request), (long)(pid), \ - (long)(addr), (long)(data)) -#define __sanitizer_syscall_pre_add_key(_type, _description, _payload, plen, \ - destringid) \ - __sanitizer_syscall_pre_impl_add_key((long)(_type), (long)(_description), \ - (long)(_payload), (long)(plen), \ - (long)(destringid)) -#define __sanitizer_syscall_post_add_key(res, _type, _description, _payload, \ - plen, destringid) \ - __sanitizer_syscall_post_impl_add_key( \ - res, (long)(_type), (long)(_description), (long)(_payload), \ - (long)(plen), (long)(destringid)) -#define __sanitizer_syscall_pre_request_key(_type, _description, \ - _callout_info, destringid) \ - __sanitizer_syscall_pre_impl_request_key( \ - (long)(_type), (long)(_description), (long)(_callout_info), \ - (long)(destringid)) -#define __sanitizer_syscall_post_request_key(res, _type, _description, \ - _callout_info, destringid) \ - __sanitizer_syscall_post_impl_request_key( \ - res, (long)(_type), (long)(_description), (long)(_callout_info), \ - (long)(destringid)) -#define __sanitizer_syscall_pre_keyctl(cmd, arg2, arg3, arg4, arg5) \ - __sanitizer_syscall_pre_impl_keyctl((long)(cmd), (long)(arg2), (long)(arg3), \ - (long)(arg4), (long)(arg5)) -#define __sanitizer_syscall_post_keyctl(res, cmd, arg2, arg3, arg4, arg5) \ - __sanitizer_syscall_post_impl_keyctl(res, (long)(cmd), (long)(arg2), \ - (long)(arg3), (long)(arg4), \ - (long)(arg5)) -#define __sanitizer_syscall_pre_ioprio_set(which, who, ioprio) \ - __sanitizer_syscall_pre_impl_ioprio_set((long)(which), (long)(who), \ - (long)(ioprio)) -#define __sanitizer_syscall_post_ioprio_set(res, which, who, ioprio) \ - __sanitizer_syscall_post_impl_ioprio_set(res, (long)(which), (long)(who), \ - (long)(ioprio)) -#define __sanitizer_syscall_pre_ioprio_get(which, who) \ - __sanitizer_syscall_pre_impl_ioprio_get((long)(which), (long)(who)) -#define __sanitizer_syscall_post_ioprio_get(res, which, who) \ - __sanitizer_syscall_post_impl_ioprio_get(res, (long)(which), (long)(who)) -#define __sanitizer_syscall_pre_set_mempolicy(mode, nmask, maxnode) \ - __sanitizer_syscall_pre_impl_set_mempolicy((long)(mode), (long)(nmask), \ - (long)(maxnode)) -#define __sanitizer_syscall_post_set_mempolicy(res, mode, nmask, maxnode) \ - __sanitizer_syscall_post_impl_set_mempolicy(res, (long)(mode), \ - (long)(nmask), (long)(maxnode)) -#define __sanitizer_syscall_pre_migrate_pages(pid, maxnode, from, to) \ - __sanitizer_syscall_pre_impl_migrate_pages((long)(pid), (long)(maxnode), \ - (long)(from), (long)(to)) -#define __sanitizer_syscall_post_migrate_pages(res, pid, maxnode, from, to) \ - __sanitizer_syscall_post_impl_migrate_pages( \ - res, (long)(pid), (long)(maxnode), (long)(from), (long)(to)) -#define __sanitizer_syscall_pre_move_pages(pid, nr_pages, pages, nodes, \ - status, flags) \ - __sanitizer_syscall_pre_impl_move_pages((long)(pid), (long)(nr_pages), \ - (long)(pages), (long)(nodes), \ - (long)(status), (long)(flags)) -#define __sanitizer_syscall_post_move_pages(res, pid, nr_pages, pages, nodes, \ - status, flags) \ - __sanitizer_syscall_post_impl_move_pages(res, (long)(pid), (long)(nr_pages), \ - (long)(pages), (long)(nodes), \ - (long)(status), (long)(flags)) -#define __sanitizer_syscall_pre_mbind(start, len, mode, nmask, maxnode, flags) \ - __sanitizer_syscall_pre_impl_mbind((long)(start), (long)(len), (long)(mode), \ - (long)(nmask), (long)(maxnode), \ - (long)(flags)) -#define __sanitizer_syscall_post_mbind(res, start, len, mode, nmask, maxnode, \ - flags) \ - __sanitizer_syscall_post_impl_mbind(res, (long)(start), (long)(len), \ - (long)(mode), (long)(nmask), \ - (long)(maxnode), (long)(flags)) -#define __sanitizer_syscall_pre_get_mempolicy(policy, nmask, maxnode, addr, \ - flags) \ - __sanitizer_syscall_pre_impl_get_mempolicy((long)(policy), (long)(nmask), \ - (long)(maxnode), (long)(addr), \ - (long)(flags)) -#define __sanitizer_syscall_post_get_mempolicy(res, policy, nmask, maxnode, \ - addr, flags) \ - __sanitizer_syscall_post_impl_get_mempolicy(res, (long)(policy), \ - (long)(nmask), (long)(maxnode), \ - (long)(addr), (long)(flags)) -#define __sanitizer_syscall_pre_inotify_init() \ - __sanitizer_syscall_pre_impl_inotify_init() -#define __sanitizer_syscall_post_inotify_init(res) \ - __sanitizer_syscall_post_impl_inotify_init(res) -#define __sanitizer_syscall_pre_inotify_init1(flags) \ - __sanitizer_syscall_pre_impl_inotify_init1((long)(flags)) -#define __sanitizer_syscall_post_inotify_init1(res, flags) \ - __sanitizer_syscall_post_impl_inotify_init1(res, (long)(flags)) -#define __sanitizer_syscall_pre_inotify_add_watch(fd, path, mask) \ - __sanitizer_syscall_pre_impl_inotify_add_watch((long)(fd), (long)(path), \ - (long)(mask)) -#define __sanitizer_syscall_post_inotify_add_watch(res, fd, path, mask) \ - __sanitizer_syscall_post_impl_inotify_add_watch(res, (long)(fd), \ - (long)(path), (long)(mask)) -#define __sanitizer_syscall_pre_inotify_rm_watch(fd, wd) \ - __sanitizer_syscall_pre_impl_inotify_rm_watch((long)(fd), (long)(wd)) -#define __sanitizer_syscall_post_inotify_rm_watch(res, fd, wd) \ - __sanitizer_syscall_post_impl_inotify_rm_watch(res, (long)(fd), (long)(wd)) -#define __sanitizer_syscall_pre_spu_run(fd, unpc, ustatus) \ - __sanitizer_syscall_pre_impl_spu_run((long)(fd), (long)(unpc), \ - (long)(ustatus)) -#define __sanitizer_syscall_post_spu_run(res, fd, unpc, ustatus) \ - __sanitizer_syscall_post_impl_spu_run(res, (long)(fd), (long)(unpc), \ - (long)(ustatus)) -#define __sanitizer_syscall_pre_spu_create(name, flags, mode, fd) \ - __sanitizer_syscall_pre_impl_spu_create((long)(name), (long)(flags), \ - (long)(mode), (long)(fd)) -#define __sanitizer_syscall_post_spu_create(res, name, flags, mode, fd) \ - __sanitizer_syscall_post_impl_spu_create(res, (long)(name), (long)(flags), \ - (long)(mode), (long)(fd)) -#define __sanitizer_syscall_pre_mknodat(dfd, filename, mode, dev) \ - __sanitizer_syscall_pre_impl_mknodat((long)(dfd), (long)(filename), \ - (long)(mode), (long)(dev)) -#define __sanitizer_syscall_post_mknodat(res, dfd, filename, mode, dev) \ - __sanitizer_syscall_post_impl_mknodat(res, (long)(dfd), (long)(filename), \ - (long)(mode), (long)(dev)) -#define __sanitizer_syscall_pre_mkdirat(dfd, pathname, mode) \ - __sanitizer_syscall_pre_impl_mkdirat((long)(dfd), (long)(pathname), \ - (long)(mode)) -#define __sanitizer_syscall_post_mkdirat(res, dfd, pathname, mode) \ - __sanitizer_syscall_post_impl_mkdirat(res, (long)(dfd), (long)(pathname), \ - (long)(mode)) -#define __sanitizer_syscall_pre_unlinkat(dfd, pathname, flag) \ - __sanitizer_syscall_pre_impl_unlinkat((long)(dfd), (long)(pathname), \ - (long)(flag)) -#define __sanitizer_syscall_post_unlinkat(res, dfd, pathname, flag) \ - __sanitizer_syscall_post_impl_unlinkat(res, (long)(dfd), (long)(pathname), \ - (long)(flag)) -#define __sanitizer_syscall_pre_symlinkat(oldname, newdfd, newname) \ - __sanitizer_syscall_pre_impl_symlinkat((long)(oldname), (long)(newdfd), \ - (long)(newname)) -#define __sanitizer_syscall_post_symlinkat(res, oldname, newdfd, newname) \ - __sanitizer_syscall_post_impl_symlinkat(res, (long)(oldname), \ - (long)(newdfd), (long)(newname)) -#define __sanitizer_syscall_pre_linkat(olddfd, oldname, newdfd, newname, \ - flags) \ - __sanitizer_syscall_pre_impl_linkat((long)(olddfd), (long)(oldname), \ - (long)(newdfd), (long)(newname), \ - (long)(flags)) -#define __sanitizer_syscall_post_linkat(res, olddfd, oldname, newdfd, newname, \ - flags) \ - __sanitizer_syscall_post_impl_linkat(res, (long)(olddfd), (long)(oldname), \ - (long)(newdfd), (long)(newname), \ - (long)(flags)) -#define __sanitizer_syscall_pre_renameat(olddfd, oldname, newdfd, newname) \ - __sanitizer_syscall_pre_impl_renameat((long)(olddfd), (long)(oldname), \ - (long)(newdfd), (long)(newname)) -#define __sanitizer_syscall_post_renameat(res, olddfd, oldname, newdfd, \ - newname) \ - __sanitizer_syscall_post_impl_renameat(res, (long)(olddfd), (long)(oldname), \ - (long)(newdfd), (long)(newname)) -#define __sanitizer_syscall_pre_futimesat(dfd, filename, utimes) \ - __sanitizer_syscall_pre_impl_futimesat((long)(dfd), (long)(filename), \ - (long)(utimes)) -#define __sanitizer_syscall_post_futimesat(res, dfd, filename, utimes) \ - __sanitizer_syscall_post_impl_futimesat(res, (long)(dfd), (long)(filename), \ - (long)(utimes)) -#define __sanitizer_syscall_pre_faccessat(dfd, filename, mode) \ - __sanitizer_syscall_pre_impl_faccessat((long)(dfd), (long)(filename), \ - (long)(mode)) -#define __sanitizer_syscall_post_faccessat(res, dfd, filename, mode) \ - __sanitizer_syscall_post_impl_faccessat(res, (long)(dfd), (long)(filename), \ - (long)(mode)) -#define __sanitizer_syscall_pre_fchmodat(dfd, filename, mode) \ - __sanitizer_syscall_pre_impl_fchmodat((long)(dfd), (long)(filename), \ - (long)(mode)) -#define __sanitizer_syscall_post_fchmodat(res, dfd, filename, mode) \ - __sanitizer_syscall_post_impl_fchmodat(res, (long)(dfd), (long)(filename), \ - (long)(mode)) -#define __sanitizer_syscall_pre_fchownat(dfd, filename, user, group, flag) \ - __sanitizer_syscall_pre_impl_fchownat((long)(dfd), (long)(filename), \ - (long)(user), (long)(group), \ - (long)(flag)) -#define __sanitizer_syscall_post_fchownat(res, dfd, filename, user, group, \ - flag) \ - __sanitizer_syscall_post_impl_fchownat(res, (long)(dfd), (long)(filename), \ - (long)(user), (long)(group), \ - (long)(flag)) -#define __sanitizer_syscall_pre_openat(dfd, filename, flags, mode) \ - __sanitizer_syscall_pre_impl_openat((long)(dfd), (long)(filename), \ - (long)(flags), (long)(mode)) -#define __sanitizer_syscall_post_openat(res, dfd, filename, flags, mode) \ - __sanitizer_syscall_post_impl_openat(res, (long)(dfd), (long)(filename), \ - (long)(flags), (long)(mode)) -#define __sanitizer_syscall_pre_newfstatat(dfd, filename, statbuf, flag) \ - __sanitizer_syscall_pre_impl_newfstatat((long)(dfd), (long)(filename), \ - (long)(statbuf), (long)(flag)) -#define __sanitizer_syscall_post_newfstatat(res, dfd, filename, statbuf, flag) \ - __sanitizer_syscall_post_impl_newfstatat(res, (long)(dfd), (long)(filename), \ - (long)(statbuf), (long)(flag)) -#define __sanitizer_syscall_pre_fstatat64(dfd, filename, statbuf, flag) \ - __sanitizer_syscall_pre_impl_fstatat64((long)(dfd), (long)(filename), \ - (long)(statbuf), (long)(flag)) -#define __sanitizer_syscall_post_fstatat64(res, dfd, filename, statbuf, flag) \ - __sanitizer_syscall_post_impl_fstatat64(res, (long)(dfd), (long)(filename), \ - (long)(statbuf), (long)(flag)) -#define __sanitizer_syscall_pre_readlinkat(dfd, path, buf, bufsiz) \ - __sanitizer_syscall_pre_impl_readlinkat((long)(dfd), (long)(path), \ - (long)(buf), (long)(bufsiz)) -#define __sanitizer_syscall_post_readlinkat(res, dfd, path, buf, bufsiz) \ - __sanitizer_syscall_post_impl_readlinkat(res, (long)(dfd), (long)(path), \ - (long)(buf), (long)(bufsiz)) -#define __sanitizer_syscall_pre_utimensat(dfd, filename, utimes, flags) \ - __sanitizer_syscall_pre_impl_utimensat((long)(dfd), (long)(filename), \ - (long)(utimes), (long)(flags)) -#define __sanitizer_syscall_post_utimensat(res, dfd, filename, utimes, flags) \ - __sanitizer_syscall_post_impl_utimensat(res, (long)(dfd), (long)(filename), \ - (long)(utimes), (long)(flags)) -#define __sanitizer_syscall_pre_unshare(unshare_flags) \ - __sanitizer_syscall_pre_impl_unshare((long)(unshare_flags)) -#define __sanitizer_syscall_post_unshare(res, unshare_flags) \ - __sanitizer_syscall_post_impl_unshare(res, (long)(unshare_flags)) -#define __sanitizer_syscall_pre_splice(fd_in, off_in, fd_out, off_out, len, \ - flags) \ - __sanitizer_syscall_pre_impl_splice((long)(fd_in), (long)(off_in), \ - (long)(fd_out), (long)(off_out), \ - (long)(len), (long)(flags)) -#define __sanitizer_syscall_post_splice(res, fd_in, off_in, fd_out, off_out, \ - len, flags) \ - __sanitizer_syscall_post_impl_splice(res, (long)(fd_in), (long)(off_in), \ - (long)(fd_out), (long)(off_out), \ - (long)(len), (long)(flags)) -#define __sanitizer_syscall_pre_vmsplice(fd, iov, nr_segs, flags) \ - __sanitizer_syscall_pre_impl_vmsplice((long)(fd), (long)(iov), \ - (long)(nr_segs), (long)(flags)) -#define __sanitizer_syscall_post_vmsplice(res, fd, iov, nr_segs, flags) \ - __sanitizer_syscall_post_impl_vmsplice(res, (long)(fd), (long)(iov), \ - (long)(nr_segs), (long)(flags)) -#define __sanitizer_syscall_pre_tee(fdin, fdout, len, flags) \ - __sanitizer_syscall_pre_impl_tee((long)(fdin), (long)(fdout), (long)(len), \ - (long)(flags)) -#define __sanitizer_syscall_post_tee(res, fdin, fdout, len, flags) \ - __sanitizer_syscall_post_impl_tee(res, (long)(fdin), (long)(fdout), \ - (long)(len), (long)(flags)) -#define __sanitizer_syscall_pre_get_robust_list(pid, head_ptr, len_ptr) \ - __sanitizer_syscall_pre_impl_get_robust_list((long)(pid), (long)(head_ptr), \ - (long)(len_ptr)) -#define __sanitizer_syscall_post_get_robust_list(res, pid, head_ptr, len_ptr) \ - __sanitizer_syscall_post_impl_get_robust_list( \ - res, (long)(pid), (long)(head_ptr), (long)(len_ptr)) -#define __sanitizer_syscall_pre_set_robust_list(head, len) \ - __sanitizer_syscall_pre_impl_set_robust_list((long)(head), (long)(len)) -#define __sanitizer_syscall_post_set_robust_list(res, head, len) \ - __sanitizer_syscall_post_impl_set_robust_list(res, (long)(head), (long)(len)) -#define __sanitizer_syscall_pre_getcpu(cpu, node, cache) \ - __sanitizer_syscall_pre_impl_getcpu((long)(cpu), (long)(node), (long)(cache)) -#define __sanitizer_syscall_post_getcpu(res, cpu, node, cache) \ - __sanitizer_syscall_post_impl_getcpu(res, (long)(cpu), (long)(node), \ - (long)(cache)) -#define __sanitizer_syscall_pre_signalfd(ufd, user_mask, sizemask) \ - __sanitizer_syscall_pre_impl_signalfd((long)(ufd), (long)(user_mask), \ - (long)(sizemask)) -#define __sanitizer_syscall_post_signalfd(res, ufd, user_mask, sizemask) \ - __sanitizer_syscall_post_impl_signalfd(res, (long)(ufd), (long)(user_mask), \ - (long)(sizemask)) -#define __sanitizer_syscall_pre_signalfd4(ufd, user_mask, sizemask, flags) \ - __sanitizer_syscall_pre_impl_signalfd4((long)(ufd), (long)(user_mask), \ - (long)(sizemask), (long)(flags)) -#define __sanitizer_syscall_post_signalfd4(res, ufd, user_mask, sizemask, \ - flags) \ - __sanitizer_syscall_post_impl_signalfd4(res, (long)(ufd), (long)(user_mask), \ - (long)(sizemask), (long)(flags)) -#define __sanitizer_syscall_pre_timerfd_create(clockid, flags) \ - __sanitizer_syscall_pre_impl_timerfd_create((long)(clockid), (long)(flags)) -#define __sanitizer_syscall_post_timerfd_create(res, clockid, flags) \ - __sanitizer_syscall_post_impl_timerfd_create(res, (long)(clockid), \ - (long)(flags)) -#define __sanitizer_syscall_pre_timerfd_settime(ufd, flags, utmr, otmr) \ - __sanitizer_syscall_pre_impl_timerfd_settime((long)(ufd), (long)(flags), \ - (long)(utmr), (long)(otmr)) -#define __sanitizer_syscall_post_timerfd_settime(res, ufd, flags, utmr, otmr) \ - __sanitizer_syscall_post_impl_timerfd_settime( \ - res, (long)(ufd), (long)(flags), (long)(utmr), (long)(otmr)) -#define __sanitizer_syscall_pre_timerfd_gettime(ufd, otmr) \ - __sanitizer_syscall_pre_impl_timerfd_gettime((long)(ufd), (long)(otmr)) -#define __sanitizer_syscall_post_timerfd_gettime(res, ufd, otmr) \ - __sanitizer_syscall_post_impl_timerfd_gettime(res, (long)(ufd), (long)(otmr)) -#define __sanitizer_syscall_pre_eventfd(count) \ - __sanitizer_syscall_pre_impl_eventfd((long)(count)) -#define __sanitizer_syscall_post_eventfd(res, count) \ - __sanitizer_syscall_post_impl_eventfd(res, (long)(count)) -#define __sanitizer_syscall_pre_eventfd2(count, flags) \ - __sanitizer_syscall_pre_impl_eventfd2((long)(count), (long)(flags)) -#define __sanitizer_syscall_post_eventfd2(res, count, flags) \ - __sanitizer_syscall_post_impl_eventfd2(res, (long)(count), (long)(flags)) -#define __sanitizer_syscall_pre_old_readdir(arg0, arg1, arg2) \ - __sanitizer_syscall_pre_impl_old_readdir((long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_post_old_readdir(res, arg0, arg1, arg2) \ - __sanitizer_syscall_post_impl_old_readdir(res, (long)(arg0), (long)(arg1), \ - (long)(arg2)) -#define __sanitizer_syscall_pre_pselect6(arg0, arg1, arg2, arg3, arg4, arg5) \ - __sanitizer_syscall_pre_impl_pselect6((long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3), \ - (long)(arg4), (long)(arg5)) -#define __sanitizer_syscall_post_pselect6(res, arg0, arg1, arg2, arg3, arg4, \ - arg5) \ - __sanitizer_syscall_post_impl_pselect6(res, (long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3), \ - (long)(arg4), (long)(arg5)) -#define __sanitizer_syscall_pre_ppoll(arg0, arg1, arg2, arg3, arg4) \ - __sanitizer_syscall_pre_impl_ppoll((long)(arg0), (long)(arg1), (long)(arg2), \ - (long)(arg3), (long)(arg4)) -#define __sanitizer_syscall_post_ppoll(res, arg0, arg1, arg2, arg3, arg4) \ - __sanitizer_syscall_post_impl_ppoll(res, (long)(arg0), (long)(arg1), \ - (long)(arg2), (long)(arg3), \ - (long)(arg4)) -#define __sanitizer_syscall_pre_syncfs(fd) \ - __sanitizer_syscall_pre_impl_syncfs((long)(fd)) -#define __sanitizer_syscall_post_syncfs(res, fd) \ - __sanitizer_syscall_post_impl_syncfs(res, (long)(fd)) -#define __sanitizer_syscall_pre_perf_event_open(attr_uptr, pid, cpu, group_fd, \ - flags) \ - __sanitizer_syscall_pre_impl_perf_event_open((long)(attr_uptr), (long)(pid), \ - (long)(cpu), (long)(group_fd), \ - (long)(flags)) -#define __sanitizer_syscall_post_perf_event_open(res, attr_uptr, pid, cpu, \ - group_fd, flags) \ - __sanitizer_syscall_post_impl_perf_event_open( \ - res, (long)(attr_uptr), (long)(pid), (long)(cpu), (long)(group_fd), \ - (long)(flags)) -#define __sanitizer_syscall_pre_mmap_pgoff(addr, len, prot, flags, fd, pgoff) \ - __sanitizer_syscall_pre_impl_mmap_pgoff((long)(addr), (long)(len), \ - (long)(prot), (long)(flags), \ - (long)(fd), (long)(pgoff)) -#define __sanitizer_syscall_post_mmap_pgoff(res, addr, len, prot, flags, fd, \ - pgoff) \ - __sanitizer_syscall_post_impl_mmap_pgoff(res, (long)(addr), (long)(len), \ - (long)(prot), (long)(flags), \ - (long)(fd), (long)(pgoff)) -#define __sanitizer_syscall_pre_old_mmap(arg) \ - __sanitizer_syscall_pre_impl_old_mmap((long)(arg)) -#define __sanitizer_syscall_post_old_mmap(res, arg) \ - __sanitizer_syscall_post_impl_old_mmap(res, (long)(arg)) -#define __sanitizer_syscall_pre_name_to_handle_at(dfd, name, handle, mnt_id, \ - flag) \ - __sanitizer_syscall_pre_impl_name_to_handle_at( \ - (long)(dfd), (long)(name), (long)(handle), (long)(mnt_id), (long)(flag)) -#define __sanitizer_syscall_post_name_to_handle_at(res, dfd, name, handle, \ - mnt_id, flag) \ - __sanitizer_syscall_post_impl_name_to_handle_at( \ - res, (long)(dfd), (long)(name), (long)(handle), (long)(mnt_id), \ - (long)(flag)) -#define __sanitizer_syscall_pre_open_by_handle_at(mountdirfd, handle, flags) \ - __sanitizer_syscall_pre_impl_open_by_handle_at( \ - (long)(mountdirfd), (long)(handle), (long)(flags)) -#define __sanitizer_syscall_post_open_by_handle_at(res, mountdirfd, handle, \ - flags) \ - __sanitizer_syscall_post_impl_open_by_handle_at( \ - res, (long)(mountdirfd), (long)(handle), (long)(flags)) -#define __sanitizer_syscall_pre_setns(fd, nstype) \ - __sanitizer_syscall_pre_impl_setns((long)(fd), (long)(nstype)) -#define __sanitizer_syscall_post_setns(res, fd, nstype) \ - __sanitizer_syscall_post_impl_setns(res, (long)(fd), (long)(nstype)) -#define __sanitizer_syscall_pre_process_vm_readv(pid, lvec, liovcnt, rvec, \ - riovcnt, flags) \ - __sanitizer_syscall_pre_impl_process_vm_readv( \ - (long)(pid), (long)(lvec), (long)(liovcnt), (long)(rvec), \ - (long)(riovcnt), (long)(flags)) -#define __sanitizer_syscall_post_process_vm_readv(res, pid, lvec, liovcnt, \ - rvec, riovcnt, flags) \ - __sanitizer_syscall_post_impl_process_vm_readv( \ - res, (long)(pid), (long)(lvec), (long)(liovcnt), (long)(rvec), \ - (long)(riovcnt), (long)(flags)) -#define __sanitizer_syscall_pre_process_vm_writev(pid, lvec, liovcnt, rvec, \ - riovcnt, flags) \ - __sanitizer_syscall_pre_impl_process_vm_writev( \ - (long)(pid), (long)(lvec), (long)(liovcnt), (long)(rvec), \ - (long)(riovcnt), (long)(flags)) -#define __sanitizer_syscall_post_process_vm_writev(res, pid, lvec, liovcnt, \ - rvec, riovcnt, flags) \ - __sanitizer_syscall_post_impl_process_vm_writev( \ - res, (long)(pid), (long)(lvec), (long)(liovcnt), (long)(rvec), \ - (long)(riovcnt), (long)(flags)) -#define __sanitizer_syscall_pre_fork() __sanitizer_syscall_pre_impl_fork() -#define __sanitizer_syscall_post_fork(res) \ - __sanitizer_syscall_post_impl_fork(res) -#define __sanitizer_syscall_pre_vfork() __sanitizer_syscall_pre_impl_vfork() -#define __sanitizer_syscall_post_vfork(res) \ - __sanitizer_syscall_post_impl_vfork(res) -#define __sanitizer_syscall_pre_sigaction(signum, act, oldact) \ - __sanitizer_syscall_pre_impl_sigaction((long)signum, (long)act, (long)oldact) -#define __sanitizer_syscall_post_sigaction(res, signum, act, oldact) \ - __sanitizer_syscall_post_impl_sigaction(res, (long)signum, (long)act, \ - (long)oldact) -#define __sanitizer_syscall_pre_rt_sigaction(signum, act, oldact, sz) \ - __sanitizer_syscall_pre_impl_rt_sigaction((long)signum, (long)act, \ - (long)oldact, (long)sz) -#define __sanitizer_syscall_post_rt_sigaction(res, signum, act, oldact, sz) \ - __sanitizer_syscall_post_impl_rt_sigaction(res, (long)signum, (long)act, \ - (long)oldact, (long)sz) -#define __sanitizer_syscall_pre_sigaltstack(ss, oss) \ - __sanitizer_syscall_pre_impl_sigaltstack((long)ss, (long)oss) -#define __sanitizer_syscall_post_sigaltstack(res, ss, oss) \ - __sanitizer_syscall_post_impl_sigaltstack(res, (long)ss, (long)oss) - -// And now a few syscalls we don't handle yet. -#define __sanitizer_syscall_pre_afs_syscall(...) -#define __sanitizer_syscall_pre_arch_prctl(...) -#define __sanitizer_syscall_pre_break(...) -#define __sanitizer_syscall_pre_chown32(...) -#define __sanitizer_syscall_pre_clone(...) -#define __sanitizer_syscall_pre_create_module(...) -#define __sanitizer_syscall_pre_epoll_ctl_old(...) -#define __sanitizer_syscall_pre_epoll_wait_old(...) -#define __sanitizer_syscall_pre_execve(...) -#define __sanitizer_syscall_pre_fadvise64(...) -#define __sanitizer_syscall_pre_fadvise64_64(...) -#define __sanitizer_syscall_pre_fallocate(...) -#define __sanitizer_syscall_pre_fanotify_init(...) -#define __sanitizer_syscall_pre_fanotify_mark(...) -#define __sanitizer_syscall_pre_fchown32(...) -#define __sanitizer_syscall_pre_ftime(...) -#define __sanitizer_syscall_pre_ftruncate64(...) -#define __sanitizer_syscall_pre_futex(...) -#define __sanitizer_syscall_pre_getegid32(...) -#define __sanitizer_syscall_pre_geteuid32(...) -#define __sanitizer_syscall_pre_getgid32(...) -#define __sanitizer_syscall_pre_getgroups32(...) -#define __sanitizer_syscall_pre_get_kernel_syms(...) -#define __sanitizer_syscall_pre_getpmsg(...) -#define __sanitizer_syscall_pre_getresgid32(...) -#define __sanitizer_syscall_pre_getresuid32(...) -#define __sanitizer_syscall_pre_get_thread_area(...) -#define __sanitizer_syscall_pre_getuid32(...) -#define __sanitizer_syscall_pre_gtty(...) -#define __sanitizer_syscall_pre_idle(...) -#define __sanitizer_syscall_pre_iopl(...) -#define __sanitizer_syscall_pre_lchown32(...) -#define __sanitizer_syscall_pre__llseek(...) -#define __sanitizer_syscall_pre_lock(...) -#define __sanitizer_syscall_pre_madvise1(...) -#define __sanitizer_syscall_pre_mmap(...) -#define __sanitizer_syscall_pre_mmap2(...) -#define __sanitizer_syscall_pre_modify_ldt(...) -#define __sanitizer_syscall_pre_mpx(...) -#define __sanitizer_syscall_pre__newselect(...) -#define __sanitizer_syscall_pre_nfsservctl(...) -#define __sanitizer_syscall_pre_oldfstat(...) -#define __sanitizer_syscall_pre_oldlstat(...) -#define __sanitizer_syscall_pre_oldolduname(...) -#define __sanitizer_syscall_pre_oldstat(...) -#define __sanitizer_syscall_pre_prctl(...) -#define __sanitizer_syscall_pre_prof(...) -#define __sanitizer_syscall_pre_profil(...) -#define __sanitizer_syscall_pre_putpmsg(...) -#define __sanitizer_syscall_pre_query_module(...) -#define __sanitizer_syscall_pre_readahead(...) -#define __sanitizer_syscall_pre_readdir(...) -#define __sanitizer_syscall_pre_rt_sigreturn(...) -#define __sanitizer_syscall_pre_rt_sigsuspend(...) -#define __sanitizer_syscall_pre_security(...) -#define __sanitizer_syscall_pre_setfsgid32(...) -#define __sanitizer_syscall_pre_setfsuid32(...) -#define __sanitizer_syscall_pre_setgid32(...) -#define __sanitizer_syscall_pre_setgroups32(...) -#define __sanitizer_syscall_pre_setregid32(...) -#define __sanitizer_syscall_pre_setresgid32(...) -#define __sanitizer_syscall_pre_setresuid32(...) -#define __sanitizer_syscall_pre_setreuid32(...) -#define __sanitizer_syscall_pre_set_thread_area(...) -#define __sanitizer_syscall_pre_setuid32(...) -#define __sanitizer_syscall_pre_sigreturn(...) -#define __sanitizer_syscall_pre_sigsuspend(...) -#define __sanitizer_syscall_pre_stty(...) -#define __sanitizer_syscall_pre_sync_file_range(...) -#define __sanitizer_syscall_pre__sysctl(...) -#define __sanitizer_syscall_pre_truncate64(...) -#define __sanitizer_syscall_pre_tuxcall(...) -#define __sanitizer_syscall_pre_ugetrlimit(...) -#define __sanitizer_syscall_pre_ulimit(...) -#define __sanitizer_syscall_pre_umount2(...) -#define __sanitizer_syscall_pre_vm86(...) -#define __sanitizer_syscall_pre_vm86old(...) -#define __sanitizer_syscall_pre_vserver(...) - -#define __sanitizer_syscall_post_afs_syscall(res, ...) -#define __sanitizer_syscall_post_arch_prctl(res, ...) -#define __sanitizer_syscall_post_break(res, ...) -#define __sanitizer_syscall_post_chown32(res, ...) -#define __sanitizer_syscall_post_clone(res, ...) -#define __sanitizer_syscall_post_create_module(res, ...) -#define __sanitizer_syscall_post_epoll_ctl_old(res, ...) -#define __sanitizer_syscall_post_epoll_wait_old(res, ...) -#define __sanitizer_syscall_post_execve(res, ...) -#define __sanitizer_syscall_post_fadvise64(res, ...) -#define __sanitizer_syscall_post_fadvise64_64(res, ...) -#define __sanitizer_syscall_post_fallocate(res, ...) -#define __sanitizer_syscall_post_fanotify_init(res, ...) -#define __sanitizer_syscall_post_fanotify_mark(res, ...) -#define __sanitizer_syscall_post_fchown32(res, ...) -#define __sanitizer_syscall_post_ftime(res, ...) -#define __sanitizer_syscall_post_ftruncate64(res, ...) -#define __sanitizer_syscall_post_futex(res, ...) -#define __sanitizer_syscall_post_getegid32(res, ...) -#define __sanitizer_syscall_post_geteuid32(res, ...) -#define __sanitizer_syscall_post_getgid32(res, ...) -#define __sanitizer_syscall_post_getgroups32(res, ...) -#define __sanitizer_syscall_post_get_kernel_syms(res, ...) -#define __sanitizer_syscall_post_getpmsg(res, ...) -#define __sanitizer_syscall_post_getresgid32(res, ...) -#define __sanitizer_syscall_post_getresuid32(res, ...) -#define __sanitizer_syscall_post_get_thread_area(res, ...) -#define __sanitizer_syscall_post_getuid32(res, ...) -#define __sanitizer_syscall_post_gtty(res, ...) -#define __sanitizer_syscall_post_idle(res, ...) -#define __sanitizer_syscall_post_iopl(res, ...) -#define __sanitizer_syscall_post_lchown32(res, ...) -#define __sanitizer_syscall_post__llseek(res, ...) -#define __sanitizer_syscall_post_lock(res, ...) -#define __sanitizer_syscall_post_madvise1(res, ...) -#define __sanitizer_syscall_post_mmap2(res, ...) -#define __sanitizer_syscall_post_mmap(res, ...) -#define __sanitizer_syscall_post_modify_ldt(res, ...) -#define __sanitizer_syscall_post_mpx(res, ...) -#define __sanitizer_syscall_post__newselect(res, ...) -#define __sanitizer_syscall_post_nfsservctl(res, ...) -#define __sanitizer_syscall_post_oldfstat(res, ...) -#define __sanitizer_syscall_post_oldlstat(res, ...) -#define __sanitizer_syscall_post_oldolduname(res, ...) -#define __sanitizer_syscall_post_oldstat(res, ...) -#define __sanitizer_syscall_post_prctl(res, ...) -#define __sanitizer_syscall_post_profil(res, ...) -#define __sanitizer_syscall_post_prof(res, ...) -#define __sanitizer_syscall_post_putpmsg(res, ...) -#define __sanitizer_syscall_post_query_module(res, ...) -#define __sanitizer_syscall_post_readahead(res, ...) -#define __sanitizer_syscall_post_readdir(res, ...) -#define __sanitizer_syscall_post_rt_sigreturn(res, ...) -#define __sanitizer_syscall_post_rt_sigsuspend(res, ...) -#define __sanitizer_syscall_post_security(res, ...) -#define __sanitizer_syscall_post_setfsgid32(res, ...) -#define __sanitizer_syscall_post_setfsuid32(res, ...) -#define __sanitizer_syscall_post_setgid32(res, ...) -#define __sanitizer_syscall_post_setgroups32(res, ...) -#define __sanitizer_syscall_post_setregid32(res, ...) -#define __sanitizer_syscall_post_setresgid32(res, ...) -#define __sanitizer_syscall_post_setresuid32(res, ...) -#define __sanitizer_syscall_post_setreuid32(res, ...) -#define __sanitizer_syscall_post_set_thread_area(res, ...) -#define __sanitizer_syscall_post_setuid32(res, ...) -#define __sanitizer_syscall_post_sigreturn(res, ...) -#define __sanitizer_syscall_post_sigsuspend(res, ...) -#define __sanitizer_syscall_post_stty(res, ...) -#define __sanitizer_syscall_post_sync_file_range(res, ...) -#define __sanitizer_syscall_post__sysctl(res, ...) -#define __sanitizer_syscall_post_truncate64(res, ...) -#define __sanitizer_syscall_post_tuxcall(res, ...) -#define __sanitizer_syscall_post_ugetrlimit(res, ...) -#define __sanitizer_syscall_post_ulimit(res, ...) -#define __sanitizer_syscall_post_umount2(res, ...) -#define __sanitizer_syscall_post_vm86old(res, ...) -#define __sanitizer_syscall_post_vm86(res, ...) -#define __sanitizer_syscall_post_vserver(res, ...) - -#ifdef __cplusplus -extern "C" { -#endif - -// Private declarations. Do not call directly from user code. Use macros above. -void __sanitizer_syscall_pre_impl_time(long tloc); -void __sanitizer_syscall_post_impl_time(long res, long tloc); -void __sanitizer_syscall_pre_impl_stime(long tptr); -void __sanitizer_syscall_post_impl_stime(long res, long tptr); -void __sanitizer_syscall_pre_impl_gettimeofday(long tv, long tz); -void __sanitizer_syscall_post_impl_gettimeofday(long res, long tv, long tz); -void __sanitizer_syscall_pre_impl_settimeofday(long tv, long tz); -void __sanitizer_syscall_post_impl_settimeofday(long res, long tv, long tz); -void __sanitizer_syscall_pre_impl_adjtimex(long txc_p); -void __sanitizer_syscall_post_impl_adjtimex(long res, long txc_p); -void __sanitizer_syscall_pre_impl_times(long tbuf); -void __sanitizer_syscall_post_impl_times(long res, long tbuf); -void __sanitizer_syscall_pre_impl_gettid(); -void __sanitizer_syscall_post_impl_gettid(long res); -void __sanitizer_syscall_pre_impl_nanosleep(long rqtp, long rmtp); -void __sanitizer_syscall_post_impl_nanosleep(long res, long rqtp, long rmtp); -void __sanitizer_syscall_pre_impl_alarm(long seconds); -void __sanitizer_syscall_post_impl_alarm(long res, long seconds); -void __sanitizer_syscall_pre_impl_getpid(); -void __sanitizer_syscall_post_impl_getpid(long res); -void __sanitizer_syscall_pre_impl_getppid(); -void __sanitizer_syscall_post_impl_getppid(long res); -void __sanitizer_syscall_pre_impl_getuid(); -void __sanitizer_syscall_post_impl_getuid(long res); -void __sanitizer_syscall_pre_impl_geteuid(); -void __sanitizer_syscall_post_impl_geteuid(long res); -void __sanitizer_syscall_pre_impl_getgid(); -void __sanitizer_syscall_post_impl_getgid(long res); -void __sanitizer_syscall_pre_impl_getegid(); -void __sanitizer_syscall_post_impl_getegid(long res); -void __sanitizer_syscall_pre_impl_getresuid(long ruid, long euid, long suid); -void __sanitizer_syscall_post_impl_getresuid(long res, long ruid, long euid, - long suid); -void __sanitizer_syscall_pre_impl_getresgid(long rgid, long egid, long sgid); -void __sanitizer_syscall_post_impl_getresgid(long res, long rgid, long egid, - long sgid); -void __sanitizer_syscall_pre_impl_getpgid(long pid); -void __sanitizer_syscall_post_impl_getpgid(long res, long pid); -void __sanitizer_syscall_pre_impl_getpgrp(); -void __sanitizer_syscall_post_impl_getpgrp(long res); -void __sanitizer_syscall_pre_impl_getsid(long pid); -void __sanitizer_syscall_post_impl_getsid(long res, long pid); -void __sanitizer_syscall_pre_impl_getgroups(long gidsetsize, long grouplist); -void __sanitizer_syscall_post_impl_getgroups(long res, long gidsetsize, - long grouplist); -void __sanitizer_syscall_pre_impl_setregid(long rgid, long egid); -void __sanitizer_syscall_post_impl_setregid(long res, long rgid, long egid); -void __sanitizer_syscall_pre_impl_setgid(long gid); -void __sanitizer_syscall_post_impl_setgid(long res, long gid); -void __sanitizer_syscall_pre_impl_setreuid(long ruid, long euid); -void __sanitizer_syscall_post_impl_setreuid(long res, long ruid, long euid); -void __sanitizer_syscall_pre_impl_setuid(long uid); -void __sanitizer_syscall_post_impl_setuid(long res, long uid); -void __sanitizer_syscall_pre_impl_setresuid(long ruid, long euid, long suid); -void __sanitizer_syscall_post_impl_setresuid(long res, long ruid, long euid, - long suid); -void __sanitizer_syscall_pre_impl_setresgid(long rgid, long egid, long sgid); -void __sanitizer_syscall_post_impl_setresgid(long res, long rgid, long egid, - long sgid); -void __sanitizer_syscall_pre_impl_setfsuid(long uid); -void __sanitizer_syscall_post_impl_setfsuid(long res, long uid); -void __sanitizer_syscall_pre_impl_setfsgid(long gid); -void __sanitizer_syscall_post_impl_setfsgid(long res, long gid); -void __sanitizer_syscall_pre_impl_setpgid(long pid, long pgid); -void __sanitizer_syscall_post_impl_setpgid(long res, long pid, long pgid); -void __sanitizer_syscall_pre_impl_setsid(); -void __sanitizer_syscall_post_impl_setsid(long res); -void __sanitizer_syscall_pre_impl_setgroups(long gidsetsize, long grouplist); -void __sanitizer_syscall_post_impl_setgroups(long res, long gidsetsize, - long grouplist); -void __sanitizer_syscall_pre_impl_acct(long name); -void __sanitizer_syscall_post_impl_acct(long res, long name); -void __sanitizer_syscall_pre_impl_capget(long header, long dataptr); -void __sanitizer_syscall_post_impl_capget(long res, long header, long dataptr); -void __sanitizer_syscall_pre_impl_capset(long header, long data); -void __sanitizer_syscall_post_impl_capset(long res, long header, long data); -void __sanitizer_syscall_pre_impl_personality(long personality); -void __sanitizer_syscall_post_impl_personality(long res, long personality); -void __sanitizer_syscall_pre_impl_sigpending(long set); -void __sanitizer_syscall_post_impl_sigpending(long res, long set); -void __sanitizer_syscall_pre_impl_sigprocmask(long how, long set, long oset); -void __sanitizer_syscall_post_impl_sigprocmask(long res, long how, long set, - long oset); -void __sanitizer_syscall_pre_impl_getitimer(long which, long value); -void __sanitizer_syscall_post_impl_getitimer(long res, long which, long value); -void __sanitizer_syscall_pre_impl_setitimer(long which, long value, - long ovalue); -void __sanitizer_syscall_post_impl_setitimer(long res, long which, long value, - long ovalue); -void __sanitizer_syscall_pre_impl_timer_create(long which_clock, - long timer_event_spec, - long created_timer_id); -void __sanitizer_syscall_post_impl_timer_create(long res, long which_clock, - long timer_event_spec, - long created_timer_id); -void __sanitizer_syscall_pre_impl_timer_gettime(long timer_id, long setting); -void __sanitizer_syscall_post_impl_timer_gettime(long res, long timer_id, - long setting); -void __sanitizer_syscall_pre_impl_timer_getoverrun(long timer_id); -void __sanitizer_syscall_post_impl_timer_getoverrun(long res, long timer_id); -void __sanitizer_syscall_pre_impl_timer_settime(long timer_id, long flags, - long new_setting, - long old_setting); -void __sanitizer_syscall_post_impl_timer_settime(long res, long timer_id, - long flags, long new_setting, - long old_setting); -void __sanitizer_syscall_pre_impl_timer_delete(long timer_id); -void __sanitizer_syscall_post_impl_timer_delete(long res, long timer_id); -void __sanitizer_syscall_pre_impl_clock_settime(long which_clock, long tp); -void __sanitizer_syscall_post_impl_clock_settime(long res, long which_clock, - long tp); -void __sanitizer_syscall_pre_impl_clock_gettime(long which_clock, long tp); -void __sanitizer_syscall_post_impl_clock_gettime(long res, long which_clock, - long tp); -void __sanitizer_syscall_pre_impl_clock_adjtime(long which_clock, long tx); -void __sanitizer_syscall_post_impl_clock_adjtime(long res, long which_clock, - long tx); -void __sanitizer_syscall_pre_impl_clock_getres(long which_clock, long tp); -void __sanitizer_syscall_post_impl_clock_getres(long res, long which_clock, - long tp); -void __sanitizer_syscall_pre_impl_clock_nanosleep(long which_clock, long flags, - long rqtp, long rmtp); -void __sanitizer_syscall_post_impl_clock_nanosleep(long res, long which_clock, - long flags, long rqtp, - long rmtp); -void __sanitizer_syscall_pre_impl_nice(long increment); -void __sanitizer_syscall_post_impl_nice(long res, long increment); -void __sanitizer_syscall_pre_impl_sched_setscheduler(long pid, long policy, - long param); -void __sanitizer_syscall_post_impl_sched_setscheduler(long res, long pid, - long policy, long param); -void __sanitizer_syscall_pre_impl_sched_setparam(long pid, long param); -void __sanitizer_syscall_post_impl_sched_setparam(long res, long pid, - long param); -void __sanitizer_syscall_pre_impl_sched_getscheduler(long pid); -void __sanitizer_syscall_post_impl_sched_getscheduler(long res, long pid); -void __sanitizer_syscall_pre_impl_sched_getparam(long pid, long param); -void __sanitizer_syscall_post_impl_sched_getparam(long res, long pid, - long param); -void __sanitizer_syscall_pre_impl_sched_setaffinity(long pid, long len, - long user_mask_ptr); -void __sanitizer_syscall_post_impl_sched_setaffinity(long res, long pid, - long len, - long user_mask_ptr); -void __sanitizer_syscall_pre_impl_sched_getaffinity(long pid, long len, - long user_mask_ptr); -void __sanitizer_syscall_post_impl_sched_getaffinity(long res, long pid, - long len, - long user_mask_ptr); -void __sanitizer_syscall_pre_impl_sched_yield(); -void __sanitizer_syscall_post_impl_sched_yield(long res); -void __sanitizer_syscall_pre_impl_sched_get_priority_max(long policy); -void __sanitizer_syscall_post_impl_sched_get_priority_max(long res, - long policy); -void __sanitizer_syscall_pre_impl_sched_get_priority_min(long policy); -void __sanitizer_syscall_post_impl_sched_get_priority_min(long res, - long policy); -void __sanitizer_syscall_pre_impl_sched_rr_get_interval(long pid, - long interval); -void __sanitizer_syscall_post_impl_sched_rr_get_interval(long res, long pid, - long interval); -void __sanitizer_syscall_pre_impl_setpriority(long which, long who, - long niceval); -void __sanitizer_syscall_post_impl_setpriority(long res, long which, long who, - long niceval); -void __sanitizer_syscall_pre_impl_getpriority(long which, long who); -void __sanitizer_syscall_post_impl_getpriority(long res, long which, long who); -void __sanitizer_syscall_pre_impl_shutdown(long arg0, long arg1); -void __sanitizer_syscall_post_impl_shutdown(long res, long arg0, long arg1); -void __sanitizer_syscall_pre_impl_reboot(long magic1, long magic2, long cmd, - long arg); -void __sanitizer_syscall_post_impl_reboot(long res, long magic1, long magic2, - long cmd, long arg); -void __sanitizer_syscall_pre_impl_restart_syscall(); -void __sanitizer_syscall_post_impl_restart_syscall(long res); -void __sanitizer_syscall_pre_impl_kexec_load(long entry, long nr_segments, - long segments, long flags); -void __sanitizer_syscall_post_impl_kexec_load(long res, long entry, - long nr_segments, long segments, - long flags); -void __sanitizer_syscall_pre_impl_exit(long error_code); -void __sanitizer_syscall_post_impl_exit(long res, long error_code); -void __sanitizer_syscall_pre_impl_exit_group(long error_code); -void __sanitizer_syscall_post_impl_exit_group(long res, long error_code); -void __sanitizer_syscall_pre_impl_wait4(long pid, long stat_addr, long options, - long ru); -void __sanitizer_syscall_post_impl_wait4(long res, long pid, long stat_addr, - long options, long ru); -void __sanitizer_syscall_pre_impl_waitid(long which, long pid, long infop, - long options, long ru); -void __sanitizer_syscall_post_impl_waitid(long res, long which, long pid, - long infop, long options, long ru); -void __sanitizer_syscall_pre_impl_waitpid(long pid, long stat_addr, - long options); -void __sanitizer_syscall_post_impl_waitpid(long res, long pid, long stat_addr, - long options); -void __sanitizer_syscall_pre_impl_set_tid_address(long tidptr); -void __sanitizer_syscall_post_impl_set_tid_address(long res, long tidptr); -void __sanitizer_syscall_pre_impl_init_module(long umod, long len, long uargs); -void __sanitizer_syscall_post_impl_init_module(long res, long umod, long len, - long uargs); -void __sanitizer_syscall_pre_impl_delete_module(long name_user, long flags); -void __sanitizer_syscall_post_impl_delete_module(long res, long name_user, - long flags); -void __sanitizer_syscall_pre_impl_rt_sigprocmask(long how, long set, long oset, - long sigsetsize); -void __sanitizer_syscall_post_impl_rt_sigprocmask(long res, long how, long set, - long oset, long sigsetsize); -void __sanitizer_syscall_pre_impl_rt_sigpending(long set, long sigsetsize); -void __sanitizer_syscall_post_impl_rt_sigpending(long res, long set, - long sigsetsize); -void __sanitizer_syscall_pre_impl_rt_sigtimedwait(long uthese, long uinfo, - long uts, long sigsetsize); -void __sanitizer_syscall_post_impl_rt_sigtimedwait(long res, long uthese, - long uinfo, long uts, - long sigsetsize); -void __sanitizer_syscall_pre_impl_rt_tgsigqueueinfo(long tgid, long pid, - long sig, long uinfo); -void __sanitizer_syscall_post_impl_rt_tgsigqueueinfo(long res, long tgid, - long pid, long sig, - long uinfo); -void __sanitizer_syscall_pre_impl_kill(long pid, long sig); -void __sanitizer_syscall_post_impl_kill(long res, long pid, long sig); -void __sanitizer_syscall_pre_impl_tgkill(long tgid, long pid, long sig); -void __sanitizer_syscall_post_impl_tgkill(long res, long tgid, long pid, - long sig); -void __sanitizer_syscall_pre_impl_tkill(long pid, long sig); -void __sanitizer_syscall_post_impl_tkill(long res, long pid, long sig); -void __sanitizer_syscall_pre_impl_rt_sigqueueinfo(long pid, long sig, - long uinfo); -void __sanitizer_syscall_post_impl_rt_sigqueueinfo(long res, long pid, long sig, - long uinfo); -void __sanitizer_syscall_pre_impl_sgetmask(); -void __sanitizer_syscall_post_impl_sgetmask(long res); -void __sanitizer_syscall_pre_impl_ssetmask(long newmask); -void __sanitizer_syscall_post_impl_ssetmask(long res, long newmask); -void __sanitizer_syscall_pre_impl_signal(long sig, long handler); -void __sanitizer_syscall_post_impl_signal(long res, long sig, long handler); -void __sanitizer_syscall_pre_impl_pause(); -void __sanitizer_syscall_post_impl_pause(long res); -void __sanitizer_syscall_pre_impl_sync(); -void __sanitizer_syscall_post_impl_sync(long res); -void __sanitizer_syscall_pre_impl_fsync(long fd); -void __sanitizer_syscall_post_impl_fsync(long res, long fd); -void __sanitizer_syscall_pre_impl_fdatasync(long fd); -void __sanitizer_syscall_post_impl_fdatasync(long res, long fd); -void __sanitizer_syscall_pre_impl_bdflush(long func, long data); -void __sanitizer_syscall_post_impl_bdflush(long res, long func, long data); -void __sanitizer_syscall_pre_impl_mount(long dev_name, long dir_name, long type, - long flags, long data); -void __sanitizer_syscall_post_impl_mount(long res, long dev_name, long dir_name, - long type, long flags, long data); -void __sanitizer_syscall_pre_impl_umount(long name, long flags); -void __sanitizer_syscall_post_impl_umount(long res, long name, long flags); -void __sanitizer_syscall_pre_impl_oldumount(long name); -void __sanitizer_syscall_post_impl_oldumount(long res, long name); -void __sanitizer_syscall_pre_impl_truncate(long path, long length); -void __sanitizer_syscall_post_impl_truncate(long res, long path, long length); -void __sanitizer_syscall_pre_impl_ftruncate(long fd, long length); -void __sanitizer_syscall_post_impl_ftruncate(long res, long fd, long length); -void __sanitizer_syscall_pre_impl_stat(long filename, long statbuf); -void __sanitizer_syscall_post_impl_stat(long res, long filename, long statbuf); -void __sanitizer_syscall_pre_impl_statfs(long path, long buf); -void __sanitizer_syscall_post_impl_statfs(long res, long path, long buf); -void __sanitizer_syscall_pre_impl_statfs64(long path, long sz, long buf); -void __sanitizer_syscall_post_impl_statfs64(long res, long path, long sz, - long buf); -void __sanitizer_syscall_pre_impl_fstatfs(long fd, long buf); -void __sanitizer_syscall_post_impl_fstatfs(long res, long fd, long buf); -void __sanitizer_syscall_pre_impl_fstatfs64(long fd, long sz, long buf); -void __sanitizer_syscall_post_impl_fstatfs64(long res, long fd, long sz, - long buf); -void __sanitizer_syscall_pre_impl_lstat(long filename, long statbuf); -void __sanitizer_syscall_post_impl_lstat(long res, long filename, long statbuf); -void __sanitizer_syscall_pre_impl_fstat(long fd, long statbuf); -void __sanitizer_syscall_post_impl_fstat(long res, long fd, long statbuf); -void __sanitizer_syscall_pre_impl_newstat(long filename, long statbuf); -void __sanitizer_syscall_post_impl_newstat(long res, long filename, - long statbuf); -void __sanitizer_syscall_pre_impl_newlstat(long filename, long statbuf); -void __sanitizer_syscall_post_impl_newlstat(long res, long filename, - long statbuf); -void __sanitizer_syscall_pre_impl_newfstat(long fd, long statbuf); -void __sanitizer_syscall_post_impl_newfstat(long res, long fd, long statbuf); -void __sanitizer_syscall_pre_impl_ustat(long dev, long ubuf); -void __sanitizer_syscall_post_impl_ustat(long res, long dev, long ubuf); -void __sanitizer_syscall_pre_impl_stat64(long filename, long statbuf); -void __sanitizer_syscall_post_impl_stat64(long res, long filename, - long statbuf); -void __sanitizer_syscall_pre_impl_fstat64(long fd, long statbuf); -void __sanitizer_syscall_post_impl_fstat64(long res, long fd, long statbuf); -void __sanitizer_syscall_pre_impl_lstat64(long filename, long statbuf); -void __sanitizer_syscall_post_impl_lstat64(long res, long filename, - long statbuf); -void __sanitizer_syscall_pre_impl_setxattr(long path, long name, long value, - long size, long flags); -void __sanitizer_syscall_post_impl_setxattr(long res, long path, long name, - long value, long size, long flags); -void __sanitizer_syscall_pre_impl_lsetxattr(long path, long name, long value, - long size, long flags); -void __sanitizer_syscall_post_impl_lsetxattr(long res, long path, long name, - long value, long size, long flags); -void __sanitizer_syscall_pre_impl_fsetxattr(long fd, long name, long value, - long size, long flags); -void __sanitizer_syscall_post_impl_fsetxattr(long res, long fd, long name, - long value, long size, long flags); -void __sanitizer_syscall_pre_impl_getxattr(long path, long name, long value, - long size); -void __sanitizer_syscall_post_impl_getxattr(long res, long path, long name, - long value, long size); -void __sanitizer_syscall_pre_impl_lgetxattr(long path, long name, long value, - long size); -void __sanitizer_syscall_post_impl_lgetxattr(long res, long path, long name, - long value, long size); -void __sanitizer_syscall_pre_impl_fgetxattr(long fd, long name, long value, - long size); -void __sanitizer_syscall_post_impl_fgetxattr(long res, long fd, long name, - long value, long size); -void __sanitizer_syscall_pre_impl_listxattr(long path, long list, long size); -void __sanitizer_syscall_post_impl_listxattr(long res, long path, long list, - long size); -void __sanitizer_syscall_pre_impl_llistxattr(long path, long list, long size); -void __sanitizer_syscall_post_impl_llistxattr(long res, long path, long list, - long size); -void __sanitizer_syscall_pre_impl_flistxattr(long fd, long list, long size); -void __sanitizer_syscall_post_impl_flistxattr(long res, long fd, long list, - long size); -void __sanitizer_syscall_pre_impl_removexattr(long path, long name); -void __sanitizer_syscall_post_impl_removexattr(long res, long path, long name); -void __sanitizer_syscall_pre_impl_lremovexattr(long path, long name); -void __sanitizer_syscall_post_impl_lremovexattr(long res, long path, long name); -void __sanitizer_syscall_pre_impl_fremovexattr(long fd, long name); -void __sanitizer_syscall_post_impl_fremovexattr(long res, long fd, long name); -void __sanitizer_syscall_pre_impl_brk(long brk); -void __sanitizer_syscall_post_impl_brk(long res, long brk); -void __sanitizer_syscall_pre_impl_mprotect(long start, long len, long prot); -void __sanitizer_syscall_post_impl_mprotect(long res, long start, long len, - long prot); -void __sanitizer_syscall_pre_impl_mremap(long addr, long old_len, long new_len, - long flags, long new_addr); -void __sanitizer_syscall_post_impl_mremap(long res, long addr, long old_len, - long new_len, long flags, - long new_addr); -void __sanitizer_syscall_pre_impl_remap_file_pages(long start, long size, - long prot, long pgoff, - long flags); -void __sanitizer_syscall_post_impl_remap_file_pages(long res, long start, - long size, long prot, - long pgoff, long flags); -void __sanitizer_syscall_pre_impl_msync(long start, long len, long flags); -void __sanitizer_syscall_post_impl_msync(long res, long start, long len, - long flags); -void __sanitizer_syscall_pre_impl_munmap(long addr, long len); -void __sanitizer_syscall_post_impl_munmap(long res, long addr, long len); -void __sanitizer_syscall_pre_impl_mlock(long start, long len); -void __sanitizer_syscall_post_impl_mlock(long res, long start, long len); -void __sanitizer_syscall_pre_impl_munlock(long start, long len); -void __sanitizer_syscall_post_impl_munlock(long res, long start, long len); -void __sanitizer_syscall_pre_impl_mlockall(long flags); -void __sanitizer_syscall_post_impl_mlockall(long res, long flags); -void __sanitizer_syscall_pre_impl_munlockall(); -void __sanitizer_syscall_post_impl_munlockall(long res); -void __sanitizer_syscall_pre_impl_madvise(long start, long len, long behavior); -void __sanitizer_syscall_post_impl_madvise(long res, long start, long len, - long behavior); -void __sanitizer_syscall_pre_impl_mincore(long start, long len, long vec); -void __sanitizer_syscall_post_impl_mincore(long res, long start, long len, - long vec); -void __sanitizer_syscall_pre_impl_pivot_root(long new_root, long put_old); -void __sanitizer_syscall_post_impl_pivot_root(long res, long new_root, - long put_old); -void __sanitizer_syscall_pre_impl_chroot(long filename); -void __sanitizer_syscall_post_impl_chroot(long res, long filename); -void __sanitizer_syscall_pre_impl_mknod(long filename, long mode, long dev); -void __sanitizer_syscall_post_impl_mknod(long res, long filename, long mode, - long dev); -void __sanitizer_syscall_pre_impl_link(long oldname, long newname); -void __sanitizer_syscall_post_impl_link(long res, long oldname, long newname); -void __sanitizer_syscall_pre_impl_symlink(long old, long new_); -void __sanitizer_syscall_post_impl_symlink(long res, long old, long new_); -void __sanitizer_syscall_pre_impl_unlink(long pathname); -void __sanitizer_syscall_post_impl_unlink(long res, long pathname); -void __sanitizer_syscall_pre_impl_rename(long oldname, long newname); -void __sanitizer_syscall_post_impl_rename(long res, long oldname, long newname); -void __sanitizer_syscall_pre_impl_chmod(long filename, long mode); -void __sanitizer_syscall_post_impl_chmod(long res, long filename, long mode); -void __sanitizer_syscall_pre_impl_fchmod(long fd, long mode); -void __sanitizer_syscall_post_impl_fchmod(long res, long fd, long mode); -void __sanitizer_syscall_pre_impl_fcntl(long fd, long cmd, long arg); -void __sanitizer_syscall_post_impl_fcntl(long res, long fd, long cmd, long arg); -void __sanitizer_syscall_pre_impl_fcntl64(long fd, long cmd, long arg); -void __sanitizer_syscall_post_impl_fcntl64(long res, long fd, long cmd, - long arg); -void __sanitizer_syscall_pre_impl_pipe(long fildes); -void __sanitizer_syscall_post_impl_pipe(long res, long fildes); -void __sanitizer_syscall_pre_impl_pipe2(long fildes, long flags); -void __sanitizer_syscall_post_impl_pipe2(long res, long fildes, long flags); -void __sanitizer_syscall_pre_impl_dup(long fildes); -void __sanitizer_syscall_post_impl_dup(long res, long fildes); -void __sanitizer_syscall_pre_impl_dup2(long oldfd, long newfd); -void __sanitizer_syscall_post_impl_dup2(long res, long oldfd, long newfd); -void __sanitizer_syscall_pre_impl_dup3(long oldfd, long newfd, long flags); -void __sanitizer_syscall_post_impl_dup3(long res, long oldfd, long newfd, - long flags); -void __sanitizer_syscall_pre_impl_ioperm(long from, long num, long on); -void __sanitizer_syscall_post_impl_ioperm(long res, long from, long num, - long on); -void __sanitizer_syscall_pre_impl_ioctl(long fd, long cmd, long arg); -void __sanitizer_syscall_post_impl_ioctl(long res, long fd, long cmd, long arg); -void __sanitizer_syscall_pre_impl_flock(long fd, long cmd); -void __sanitizer_syscall_post_impl_flock(long res, long fd, long cmd); -void __sanitizer_syscall_pre_impl_io_setup(long nr_reqs, long ctx); -void __sanitizer_syscall_post_impl_io_setup(long res, long nr_reqs, long ctx); -void __sanitizer_syscall_pre_impl_io_destroy(long ctx); -void __sanitizer_syscall_post_impl_io_destroy(long res, long ctx); -void __sanitizer_syscall_pre_impl_io_getevents(long ctx_id, long min_nr, - long nr, long events, - long timeout); -void __sanitizer_syscall_post_impl_io_getevents(long res, long ctx_id, - long min_nr, long nr, - long events, long timeout); -void __sanitizer_syscall_pre_impl_io_submit(long ctx_id, long arg1, long arg2); -void __sanitizer_syscall_post_impl_io_submit(long res, long ctx_id, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_io_cancel(long ctx_id, long iocb, - long result); -void __sanitizer_syscall_post_impl_io_cancel(long res, long ctx_id, long iocb, - long result); -void __sanitizer_syscall_pre_impl_sendfile(long out_fd, long in_fd, long offset, - long count); -void __sanitizer_syscall_post_impl_sendfile(long res, long out_fd, long in_fd, - long offset, long count); -void __sanitizer_syscall_pre_impl_sendfile64(long out_fd, long in_fd, - long offset, long count); -void __sanitizer_syscall_post_impl_sendfile64(long res, long out_fd, long in_fd, - long offset, long count); -void __sanitizer_syscall_pre_impl_readlink(long path, long buf, long bufsiz); -void __sanitizer_syscall_post_impl_readlink(long res, long path, long buf, - long bufsiz); -void __sanitizer_syscall_pre_impl_creat(long pathname, long mode); -void __sanitizer_syscall_post_impl_creat(long res, long pathname, long mode); -void __sanitizer_syscall_pre_impl_open(long filename, long flags, long mode); -void __sanitizer_syscall_post_impl_open(long res, long filename, long flags, - long mode); -void __sanitizer_syscall_pre_impl_close(long fd); -void __sanitizer_syscall_post_impl_close(long res, long fd); -void __sanitizer_syscall_pre_impl_access(long filename, long mode); -void __sanitizer_syscall_post_impl_access(long res, long filename, long mode); -void __sanitizer_syscall_pre_impl_vhangup(); -void __sanitizer_syscall_post_impl_vhangup(long res); -void __sanitizer_syscall_pre_impl_chown(long filename, long user, long group); -void __sanitizer_syscall_post_impl_chown(long res, long filename, long user, - long group); -void __sanitizer_syscall_pre_impl_lchown(long filename, long user, long group); -void __sanitizer_syscall_post_impl_lchown(long res, long filename, long user, - long group); -void __sanitizer_syscall_pre_impl_fchown(long fd, long user, long group); -void __sanitizer_syscall_post_impl_fchown(long res, long fd, long user, - long group); -void __sanitizer_syscall_pre_impl_chown16(long filename, long user, long group); -void __sanitizer_syscall_post_impl_chown16(long res, long filename, long user, - long group); -void __sanitizer_syscall_pre_impl_lchown16(long filename, long user, - long group); -void __sanitizer_syscall_post_impl_lchown16(long res, long filename, long user, - long group); -void __sanitizer_syscall_pre_impl_fchown16(long fd, long user, long group); -void __sanitizer_syscall_post_impl_fchown16(long res, long fd, long user, - long group); -void __sanitizer_syscall_pre_impl_setregid16(long rgid, long egid); -void __sanitizer_syscall_post_impl_setregid16(long res, long rgid, long egid); -void __sanitizer_syscall_pre_impl_setgid16(long gid); -void __sanitizer_syscall_post_impl_setgid16(long res, long gid); -void __sanitizer_syscall_pre_impl_setreuid16(long ruid, long euid); -void __sanitizer_syscall_post_impl_setreuid16(long res, long ruid, long euid); -void __sanitizer_syscall_pre_impl_setuid16(long uid); -void __sanitizer_syscall_post_impl_setuid16(long res, long uid); -void __sanitizer_syscall_pre_impl_setresuid16(long ruid, long euid, long suid); -void __sanitizer_syscall_post_impl_setresuid16(long res, long ruid, long euid, - long suid); -void __sanitizer_syscall_pre_impl_getresuid16(long ruid, long euid, long suid); -void __sanitizer_syscall_post_impl_getresuid16(long res, long ruid, long euid, - long suid); -void __sanitizer_syscall_pre_impl_setresgid16(long rgid, long egid, long sgid); -void __sanitizer_syscall_post_impl_setresgid16(long res, long rgid, long egid, - long sgid); -void __sanitizer_syscall_pre_impl_getresgid16(long rgid, long egid, long sgid); -void __sanitizer_syscall_post_impl_getresgid16(long res, long rgid, long egid, - long sgid); -void __sanitizer_syscall_pre_impl_setfsuid16(long uid); -void __sanitizer_syscall_post_impl_setfsuid16(long res, long uid); -void __sanitizer_syscall_pre_impl_setfsgid16(long gid); -void __sanitizer_syscall_post_impl_setfsgid16(long res, long gid); -void __sanitizer_syscall_pre_impl_getgroups16(long gidsetsize, long grouplist); -void __sanitizer_syscall_post_impl_getgroups16(long res, long gidsetsize, - long grouplist); -void __sanitizer_syscall_pre_impl_setgroups16(long gidsetsize, long grouplist); -void __sanitizer_syscall_post_impl_setgroups16(long res, long gidsetsize, - long grouplist); -void __sanitizer_syscall_pre_impl_getuid16(); -void __sanitizer_syscall_post_impl_getuid16(long res); -void __sanitizer_syscall_pre_impl_geteuid16(); -void __sanitizer_syscall_post_impl_geteuid16(long res); -void __sanitizer_syscall_pre_impl_getgid16(); -void __sanitizer_syscall_post_impl_getgid16(long res); -void __sanitizer_syscall_pre_impl_getegid16(); -void __sanitizer_syscall_post_impl_getegid16(long res); -void __sanitizer_syscall_pre_impl_utime(long filename, long times); -void __sanitizer_syscall_post_impl_utime(long res, long filename, long times); -void __sanitizer_syscall_pre_impl_utimes(long filename, long utimes); -void __sanitizer_syscall_post_impl_utimes(long res, long filename, long utimes); -void __sanitizer_syscall_pre_impl_lseek(long fd, long offset, long origin); -void __sanitizer_syscall_post_impl_lseek(long res, long fd, long offset, - long origin); -void __sanitizer_syscall_pre_impl_llseek(long fd, long offset_high, - long offset_low, long result, - long origin); -void __sanitizer_syscall_post_impl_llseek(long res, long fd, long offset_high, - long offset_low, long result, - long origin); -void __sanitizer_syscall_pre_impl_read(long fd, long buf, long count); -void __sanitizer_syscall_post_impl_read(long res, long fd, long buf, - long count); -void __sanitizer_syscall_pre_impl_readv(long fd, long vec, long vlen); -void __sanitizer_syscall_post_impl_readv(long res, long fd, long vec, - long vlen); -void __sanitizer_syscall_pre_impl_write(long fd, long buf, long count); -void __sanitizer_syscall_post_impl_write(long res, long fd, long buf, - long count); -void __sanitizer_syscall_pre_impl_writev(long fd, long vec, long vlen); -void __sanitizer_syscall_post_impl_writev(long res, long fd, long vec, - long vlen); - -#ifdef _LP64 -void __sanitizer_syscall_pre_impl_pread64(long fd, long buf, long count, - long pos); -void __sanitizer_syscall_post_impl_pread64(long res, long fd, long buf, - long count, long pos); -void __sanitizer_syscall_pre_impl_pwrite64(long fd, long buf, long count, - long pos); -void __sanitizer_syscall_post_impl_pwrite64(long res, long fd, long buf, - long count, long pos); -#else -void __sanitizer_syscall_pre_impl_pread64(long fd, long buf, long count, - long pos0, long pos1); -void __sanitizer_syscall_post_impl_pread64(long res, long fd, long buf, - long count, long pos0, long pos1); -void __sanitizer_syscall_pre_impl_pwrite64(long fd, long buf, long count, - long pos0, long pos1); -void __sanitizer_syscall_post_impl_pwrite64(long res, long fd, long buf, - long count, long pos0, long pos1); -#endif - -void __sanitizer_syscall_pre_impl_preadv(long fd, long vec, long vlen, - long pos_l, long pos_h); -void __sanitizer_syscall_post_impl_preadv(long res, long fd, long vec, - long vlen, long pos_l, long pos_h); -void __sanitizer_syscall_pre_impl_pwritev(long fd, long vec, long vlen, - long pos_l, long pos_h); -void __sanitizer_syscall_post_impl_pwritev(long res, long fd, long vec, - long vlen, long pos_l, long pos_h); -void __sanitizer_syscall_pre_impl_getcwd(long buf, long size); -void __sanitizer_syscall_post_impl_getcwd(long res, long buf, long size); -void __sanitizer_syscall_pre_impl_mkdir(long pathname, long mode); -void __sanitizer_syscall_post_impl_mkdir(long res, long pathname, long mode); -void __sanitizer_syscall_pre_impl_chdir(long filename); -void __sanitizer_syscall_post_impl_chdir(long res, long filename); -void __sanitizer_syscall_pre_impl_fchdir(long fd); -void __sanitizer_syscall_post_impl_fchdir(long res, long fd); -void __sanitizer_syscall_pre_impl_rmdir(long pathname); -void __sanitizer_syscall_post_impl_rmdir(long res, long pathname); -void __sanitizer_syscall_pre_impl_lookup_dcookie(long cookie64, long buf, - long len); -void __sanitizer_syscall_post_impl_lookup_dcookie(long res, long cookie64, - long buf, long len); -void __sanitizer_syscall_pre_impl_quotactl(long cmd, long special, long id, - long addr); -void __sanitizer_syscall_post_impl_quotactl(long res, long cmd, long special, - long id, long addr); -void __sanitizer_syscall_pre_impl_getdents(long fd, long dirent, long count); -void __sanitizer_syscall_post_impl_getdents(long res, long fd, long dirent, - long count); -void __sanitizer_syscall_pre_impl_getdents64(long fd, long dirent, long count); -void __sanitizer_syscall_post_impl_getdents64(long res, long fd, long dirent, - long count); -void __sanitizer_syscall_pre_impl_setsockopt(long fd, long level, long optname, - long optval, long optlen); -void __sanitizer_syscall_post_impl_setsockopt(long res, long fd, long level, - long optname, long optval, - long optlen); -void __sanitizer_syscall_pre_impl_getsockopt(long fd, long level, long optname, - long optval, long optlen); -void __sanitizer_syscall_post_impl_getsockopt(long res, long fd, long level, - long optname, long optval, - long optlen); -void __sanitizer_syscall_pre_impl_bind(long arg0, long arg1, long arg2); -void __sanitizer_syscall_post_impl_bind(long res, long arg0, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_connect(long arg0, long arg1, long arg2); -void __sanitizer_syscall_post_impl_connect(long res, long arg0, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_accept(long arg0, long arg1, long arg2); -void __sanitizer_syscall_post_impl_accept(long res, long arg0, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_accept4(long arg0, long arg1, long arg2, - long arg3); -void __sanitizer_syscall_post_impl_accept4(long res, long arg0, long arg1, - long arg2, long arg3); -void __sanitizer_syscall_pre_impl_getsockname(long arg0, long arg1, long arg2); -void __sanitizer_syscall_post_impl_getsockname(long res, long arg0, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_getpeername(long arg0, long arg1, long arg2); -void __sanitizer_syscall_post_impl_getpeername(long res, long arg0, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_send(long arg0, long arg1, long arg2, - long arg3); -void __sanitizer_syscall_post_impl_send(long res, long arg0, long arg1, - long arg2, long arg3); -void __sanitizer_syscall_pre_impl_sendto(long arg0, long arg1, long arg2, - long arg3, long arg4, long arg5); -void __sanitizer_syscall_post_impl_sendto(long res, long arg0, long arg1, - long arg2, long arg3, long arg4, - long arg5); -void __sanitizer_syscall_pre_impl_sendmsg(long fd, long msg, long flags); -void __sanitizer_syscall_post_impl_sendmsg(long res, long fd, long msg, - long flags); -void __sanitizer_syscall_pre_impl_sendmmsg(long fd, long msg, long vlen, - long flags); -void __sanitizer_syscall_post_impl_sendmmsg(long res, long fd, long msg, - long vlen, long flags); -void __sanitizer_syscall_pre_impl_recv(long arg0, long arg1, long arg2, - long arg3); -void __sanitizer_syscall_post_impl_recv(long res, long arg0, long arg1, - long arg2, long arg3); -void __sanitizer_syscall_pre_impl_recvfrom(long arg0, long arg1, long arg2, - long arg3, long arg4, long arg5); -void __sanitizer_syscall_post_impl_recvfrom(long res, long arg0, long arg1, - long arg2, long arg3, long arg4, - long arg5); -void __sanitizer_syscall_pre_impl_recvmsg(long fd, long msg, long flags); -void __sanitizer_syscall_post_impl_recvmsg(long res, long fd, long msg, - long flags); -void __sanitizer_syscall_pre_impl_recvmmsg(long fd, long msg, long vlen, - long flags, long timeout); -void __sanitizer_syscall_post_impl_recvmmsg(long res, long fd, long msg, - long vlen, long flags, - long timeout); -void __sanitizer_syscall_pre_impl_socket(long arg0, long arg1, long arg2); -void __sanitizer_syscall_post_impl_socket(long res, long arg0, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_socketpair(long arg0, long arg1, long arg2, - long arg3); -void __sanitizer_syscall_post_impl_socketpair(long res, long arg0, long arg1, - long arg2, long arg3); -void __sanitizer_syscall_pre_impl_socketcall(long call, long args); -void __sanitizer_syscall_post_impl_socketcall(long res, long call, long args); -void __sanitizer_syscall_pre_impl_listen(long arg0, long arg1); -void __sanitizer_syscall_post_impl_listen(long res, long arg0, long arg1); -void __sanitizer_syscall_pre_impl_poll(long ufds, long nfds, long timeout); -void __sanitizer_syscall_post_impl_poll(long res, long ufds, long nfds, - long timeout); -void __sanitizer_syscall_pre_impl_select(long n, long inp, long outp, long exp, - long tvp); -void __sanitizer_syscall_post_impl_select(long res, long n, long inp, long outp, - long exp, long tvp); -void __sanitizer_syscall_pre_impl_old_select(long arg); -void __sanitizer_syscall_post_impl_old_select(long res, long arg); -void __sanitizer_syscall_pre_impl_epoll_create(long size); -void __sanitizer_syscall_post_impl_epoll_create(long res, long size); -void __sanitizer_syscall_pre_impl_epoll_create1(long flags); -void __sanitizer_syscall_post_impl_epoll_create1(long res, long flags); -void __sanitizer_syscall_pre_impl_epoll_ctl(long epfd, long op, long fd, - long event); -void __sanitizer_syscall_post_impl_epoll_ctl(long res, long epfd, long op, - long fd, long event); -void __sanitizer_syscall_pre_impl_epoll_wait(long epfd, long events, - long maxevents, long timeout); -void __sanitizer_syscall_post_impl_epoll_wait(long res, long epfd, long events, - long maxevents, long timeout); -void __sanitizer_syscall_pre_impl_epoll_pwait(long epfd, long events, - long maxevents, long timeout, - long sigmask, long sigsetsize); -void __sanitizer_syscall_post_impl_epoll_pwait(long res, long epfd, long events, - long maxevents, long timeout, - long sigmask, long sigsetsize); -void __sanitizer_syscall_pre_impl_epoll_pwait2(long epfd, long events, - long maxevents, long timeout, - long sigmask, long sigsetsize); -void __sanitizer_syscall_post_impl_epoll_pwait2(long res, long epfd, - long events, long maxevents, - long timeout, long sigmask, - long sigsetsize); -void __sanitizer_syscall_pre_impl_gethostname(long name, long len); -void __sanitizer_syscall_post_impl_gethostname(long res, long name, long len); -void __sanitizer_syscall_pre_impl_sethostname(long name, long len); -void __sanitizer_syscall_post_impl_sethostname(long res, long name, long len); -void __sanitizer_syscall_pre_impl_setdomainname(long name, long len); -void __sanitizer_syscall_post_impl_setdomainname(long res, long name, long len); -void __sanitizer_syscall_pre_impl_newuname(long name); -void __sanitizer_syscall_post_impl_newuname(long res, long name); -void __sanitizer_syscall_pre_impl_uname(long arg0); -void __sanitizer_syscall_post_impl_uname(long res, long arg0); -void __sanitizer_syscall_pre_impl_olduname(long arg0); -void __sanitizer_syscall_post_impl_olduname(long res, long arg0); -void __sanitizer_syscall_pre_impl_getrlimit(long resource, long rlim); -void __sanitizer_syscall_post_impl_getrlimit(long res, long resource, - long rlim); -void __sanitizer_syscall_pre_impl_old_getrlimit(long resource, long rlim); -void __sanitizer_syscall_post_impl_old_getrlimit(long res, long resource, - long rlim); -void __sanitizer_syscall_pre_impl_setrlimit(long resource, long rlim); -void __sanitizer_syscall_post_impl_setrlimit(long res, long resource, - long rlim); -void __sanitizer_syscall_pre_impl_prlimit64(long pid, long resource, - long new_rlim, long old_rlim); -void __sanitizer_syscall_post_impl_prlimit64(long res, long pid, long resource, - long new_rlim, long old_rlim); -void __sanitizer_syscall_pre_impl_getrusage(long who, long ru); -void __sanitizer_syscall_post_impl_getrusage(long res, long who, long ru); -void __sanitizer_syscall_pre_impl_umask(long mask); -void __sanitizer_syscall_post_impl_umask(long res, long mask); -void __sanitizer_syscall_pre_impl_msgget(long key, long msgflg); -void __sanitizer_syscall_post_impl_msgget(long res, long key, long msgflg); -void __sanitizer_syscall_pre_impl_msgsnd(long msqid, long msgp, long msgsz, - long msgflg); -void __sanitizer_syscall_post_impl_msgsnd(long res, long msqid, long msgp, - long msgsz, long msgflg); -void __sanitizer_syscall_pre_impl_msgrcv(long msqid, long msgp, long msgsz, - long msgtyp, long msgflg); -void __sanitizer_syscall_post_impl_msgrcv(long res, long msqid, long msgp, - long msgsz, long msgtyp, long msgflg); -void __sanitizer_syscall_pre_impl_msgctl(long msqid, long cmd, long buf); -void __sanitizer_syscall_post_impl_msgctl(long res, long msqid, long cmd, - long buf); -void __sanitizer_syscall_pre_impl_semget(long key, long nsems, long semflg); -void __sanitizer_syscall_post_impl_semget(long res, long key, long nsems, - long semflg); -void __sanitizer_syscall_pre_impl_semop(long semid, long sops, long nsops); -void __sanitizer_syscall_post_impl_semop(long res, long semid, long sops, - long nsops); -void __sanitizer_syscall_pre_impl_semctl(long semid, long semnum, long cmd, - long arg); -void __sanitizer_syscall_post_impl_semctl(long res, long semid, long semnum, - long cmd, long arg); -void __sanitizer_syscall_pre_impl_semtimedop(long semid, long sops, long nsops, - long timeout); -void __sanitizer_syscall_post_impl_semtimedop(long res, long semid, long sops, - long nsops, long timeout); -void __sanitizer_syscall_pre_impl_shmat(long shmid, long shmaddr, long shmflg); -void __sanitizer_syscall_post_impl_shmat(long res, long shmid, long shmaddr, - long shmflg); -void __sanitizer_syscall_pre_impl_shmget(long key, long size, long flag); -void __sanitizer_syscall_post_impl_shmget(long res, long key, long size, - long flag); -void __sanitizer_syscall_pre_impl_shmdt(long shmaddr); -void __sanitizer_syscall_post_impl_shmdt(long res, long shmaddr); -void __sanitizer_syscall_pre_impl_shmctl(long shmid, long cmd, long buf); -void __sanitizer_syscall_post_impl_shmctl(long res, long shmid, long cmd, - long buf); -void __sanitizer_syscall_pre_impl_ipc(long call, long first, long second, - long third, long ptr, long fifth); -void __sanitizer_syscall_post_impl_ipc(long res, long call, long first, - long second, long third, long ptr, - long fifth); -void __sanitizer_syscall_pre_impl_mq_open(long name, long oflag, long mode, - long attr); -void __sanitizer_syscall_post_impl_mq_open(long res, long name, long oflag, - long mode, long attr); -void __sanitizer_syscall_pre_impl_mq_unlink(long name); -void __sanitizer_syscall_post_impl_mq_unlink(long res, long name); -void __sanitizer_syscall_pre_impl_mq_timedsend(long mqdes, long msg_ptr, - long msg_len, long msg_prio, - long abs_timeout); -void __sanitizer_syscall_post_impl_mq_timedsend(long res, long mqdes, - long msg_ptr, long msg_len, - long msg_prio, - long abs_timeout); -void __sanitizer_syscall_pre_impl_mq_timedreceive(long mqdes, long msg_ptr, - long msg_len, long msg_prio, - long abs_timeout); -void __sanitizer_syscall_post_impl_mq_timedreceive(long res, long mqdes, - long msg_ptr, long msg_len, - long msg_prio, - long abs_timeout); -void __sanitizer_syscall_pre_impl_mq_notify(long mqdes, long notification); -void __sanitizer_syscall_post_impl_mq_notify(long res, long mqdes, - long notification); -void __sanitizer_syscall_pre_impl_mq_getsetattr(long mqdes, long mqstat, - long omqstat); -void __sanitizer_syscall_post_impl_mq_getsetattr(long res, long mqdes, - long mqstat, long omqstat); -void __sanitizer_syscall_pre_impl_pciconfig_iobase(long which, long bus, - long devfn); -void __sanitizer_syscall_post_impl_pciconfig_iobase(long res, long which, - long bus, long devfn); -void __sanitizer_syscall_pre_impl_pciconfig_read(long bus, long dfn, long off, - long len, long buf); -void __sanitizer_syscall_post_impl_pciconfig_read(long res, long bus, long dfn, - long off, long len, long buf); -void __sanitizer_syscall_pre_impl_pciconfig_write(long bus, long dfn, long off, - long len, long buf); -void __sanitizer_syscall_post_impl_pciconfig_write(long res, long bus, long dfn, - long off, long len, - long buf); -void __sanitizer_syscall_pre_impl_swapon(long specialfile, long swap_flags); -void __sanitizer_syscall_post_impl_swapon(long res, long specialfile, - long swap_flags); -void __sanitizer_syscall_pre_impl_swapoff(long specialfile); -void __sanitizer_syscall_post_impl_swapoff(long res, long specialfile); -void __sanitizer_syscall_pre_impl_sysctl(long args); -void __sanitizer_syscall_post_impl_sysctl(long res, long args); -void __sanitizer_syscall_pre_impl_sysinfo(long info); -void __sanitizer_syscall_post_impl_sysinfo(long res, long info); -void __sanitizer_syscall_pre_impl_sysfs(long option, long arg1, long arg2); -void __sanitizer_syscall_post_impl_sysfs(long res, long option, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_syslog(long type, long buf, long len); -void __sanitizer_syscall_post_impl_syslog(long res, long type, long buf, - long len); -void __sanitizer_syscall_pre_impl_uselib(long library); -void __sanitizer_syscall_post_impl_uselib(long res, long library); -void __sanitizer_syscall_pre_impl_ni_syscall(); -void __sanitizer_syscall_post_impl_ni_syscall(long res); -void __sanitizer_syscall_pre_impl_ptrace(long request, long pid, long addr, - long data); -void __sanitizer_syscall_post_impl_ptrace(long res, long request, long pid, - long addr, long data); -void __sanitizer_syscall_pre_impl_add_key(long _type, long _description, - long _payload, long plen, - long destringid); -void __sanitizer_syscall_post_impl_add_key(long res, long _type, - long _description, long _payload, - long plen, long destringid); -void __sanitizer_syscall_pre_impl_request_key(long _type, long _description, - long _callout_info, - long destringid); -void __sanitizer_syscall_post_impl_request_key(long res, long _type, - long _description, - long _callout_info, - long destringid); -void __sanitizer_syscall_pre_impl_keyctl(long cmd, long arg2, long arg3, - long arg4, long arg5); -void __sanitizer_syscall_post_impl_keyctl(long res, long cmd, long arg2, - long arg3, long arg4, long arg5); -void __sanitizer_syscall_pre_impl_ioprio_set(long which, long who, long ioprio); -void __sanitizer_syscall_post_impl_ioprio_set(long res, long which, long who, - long ioprio); -void __sanitizer_syscall_pre_impl_ioprio_get(long which, long who); -void __sanitizer_syscall_post_impl_ioprio_get(long res, long which, long who); -void __sanitizer_syscall_pre_impl_set_mempolicy(long mode, long nmask, - long maxnode); -void __sanitizer_syscall_post_impl_set_mempolicy(long res, long mode, - long nmask, long maxnode); -void __sanitizer_syscall_pre_impl_migrate_pages(long pid, long maxnode, - long from, long to); -void __sanitizer_syscall_post_impl_migrate_pages(long res, long pid, - long maxnode, long from, - long to); -void __sanitizer_syscall_pre_impl_move_pages(long pid, long nr_pages, - long pages, long nodes, - long status, long flags); -void __sanitizer_syscall_post_impl_move_pages(long res, long pid, long nr_pages, - long pages, long nodes, - long status, long flags); -void __sanitizer_syscall_pre_impl_mbind(long start, long len, long mode, - long nmask, long maxnode, long flags); -void __sanitizer_syscall_post_impl_mbind(long res, long start, long len, - long mode, long nmask, long maxnode, - long flags); -void __sanitizer_syscall_pre_impl_get_mempolicy(long policy, long nmask, - long maxnode, long addr, - long flags); -void __sanitizer_syscall_post_impl_get_mempolicy(long res, long policy, - long nmask, long maxnode, - long addr, long flags); -void __sanitizer_syscall_pre_impl_inotify_init(); -void __sanitizer_syscall_post_impl_inotify_init(long res); -void __sanitizer_syscall_pre_impl_inotify_init1(long flags); -void __sanitizer_syscall_post_impl_inotify_init1(long res, long flags); -void __sanitizer_syscall_pre_impl_inotify_add_watch(long fd, long path, - long mask); -void __sanitizer_syscall_post_impl_inotify_add_watch(long res, long fd, - long path, long mask); -void __sanitizer_syscall_pre_impl_inotify_rm_watch(long fd, long wd); -void __sanitizer_syscall_post_impl_inotify_rm_watch(long res, long fd, long wd); -void __sanitizer_syscall_pre_impl_spu_run(long fd, long unpc, long ustatus); -void __sanitizer_syscall_post_impl_spu_run(long res, long fd, long unpc, - long ustatus); -void __sanitizer_syscall_pre_impl_spu_create(long name, long flags, long mode, - long fd); -void __sanitizer_syscall_post_impl_spu_create(long res, long name, long flags, - long mode, long fd); -void __sanitizer_syscall_pre_impl_mknodat(long dfd, long filename, long mode, - long dev); -void __sanitizer_syscall_post_impl_mknodat(long res, long dfd, long filename, - long mode, long dev); -void __sanitizer_syscall_pre_impl_mkdirat(long dfd, long pathname, long mode); -void __sanitizer_syscall_post_impl_mkdirat(long res, long dfd, long pathname, - long mode); -void __sanitizer_syscall_pre_impl_unlinkat(long dfd, long pathname, long flag); -void __sanitizer_syscall_post_impl_unlinkat(long res, long dfd, long pathname, - long flag); -void __sanitizer_syscall_pre_impl_symlinkat(long oldname, long newdfd, - long newname); -void __sanitizer_syscall_post_impl_symlinkat(long res, long oldname, - long newdfd, long newname); -void __sanitizer_syscall_pre_impl_linkat(long olddfd, long oldname, long newdfd, - long newname, long flags); -void __sanitizer_syscall_post_impl_linkat(long res, long olddfd, long oldname, - long newdfd, long newname, - long flags); -void __sanitizer_syscall_pre_impl_renameat(long olddfd, long oldname, - long newdfd, long newname); -void __sanitizer_syscall_post_impl_renameat(long res, long olddfd, long oldname, - long newdfd, long newname); -void __sanitizer_syscall_pre_impl_futimesat(long dfd, long filename, - long utimes); -void __sanitizer_syscall_post_impl_futimesat(long res, long dfd, long filename, - long utimes); -void __sanitizer_syscall_pre_impl_faccessat(long dfd, long filename, long mode); -void __sanitizer_syscall_post_impl_faccessat(long res, long dfd, long filename, - long mode); -void __sanitizer_syscall_pre_impl_fchmodat(long dfd, long filename, long mode); -void __sanitizer_syscall_post_impl_fchmodat(long res, long dfd, long filename, - long mode); -void __sanitizer_syscall_pre_impl_fchownat(long dfd, long filename, long user, - long group, long flag); -void __sanitizer_syscall_post_impl_fchownat(long res, long dfd, long filename, - long user, long group, long flag); -void __sanitizer_syscall_pre_impl_openat(long dfd, long filename, long flags, - long mode); -void __sanitizer_syscall_post_impl_openat(long res, long dfd, long filename, - long flags, long mode); -void __sanitizer_syscall_pre_impl_newfstatat(long dfd, long filename, - long statbuf, long flag); -void __sanitizer_syscall_post_impl_newfstatat(long res, long dfd, long filename, - long statbuf, long flag); -void __sanitizer_syscall_pre_impl_fstatat64(long dfd, long filename, - long statbuf, long flag); -void __sanitizer_syscall_post_impl_fstatat64(long res, long dfd, long filename, - long statbuf, long flag); -void __sanitizer_syscall_pre_impl_readlinkat(long dfd, long path, long buf, - long bufsiz); -void __sanitizer_syscall_post_impl_readlinkat(long res, long dfd, long path, - long buf, long bufsiz); -void __sanitizer_syscall_pre_impl_utimensat(long dfd, long filename, - long utimes, long flags); -void __sanitizer_syscall_post_impl_utimensat(long res, long dfd, long filename, - long utimes, long flags); -void __sanitizer_syscall_pre_impl_unshare(long unshare_flags); -void __sanitizer_syscall_post_impl_unshare(long res, long unshare_flags); -void __sanitizer_syscall_pre_impl_splice(long fd_in, long off_in, long fd_out, - long off_out, long len, long flags); -void __sanitizer_syscall_post_impl_splice(long res, long fd_in, long off_in, - long fd_out, long off_out, long len, - long flags); -void __sanitizer_syscall_pre_impl_vmsplice(long fd, long iov, long nr_segs, - long flags); -void __sanitizer_syscall_post_impl_vmsplice(long res, long fd, long iov, - long nr_segs, long flags); -void __sanitizer_syscall_pre_impl_tee(long fdin, long fdout, long len, - long flags); -void __sanitizer_syscall_post_impl_tee(long res, long fdin, long fdout, - long len, long flags); -void __sanitizer_syscall_pre_impl_get_robust_list(long pid, long head_ptr, - long len_ptr); -void __sanitizer_syscall_post_impl_get_robust_list(long res, long pid, - long head_ptr, long len_ptr); -void __sanitizer_syscall_pre_impl_set_robust_list(long head, long len); -void __sanitizer_syscall_post_impl_set_robust_list(long res, long head, - long len); -void __sanitizer_syscall_pre_impl_getcpu(long cpu, long node, long cache); -void __sanitizer_syscall_post_impl_getcpu(long res, long cpu, long node, - long cache); -void __sanitizer_syscall_pre_impl_signalfd(long ufd, long user_mask, - long sizemask); -void __sanitizer_syscall_post_impl_signalfd(long res, long ufd, long user_mask, - long sizemask); -void __sanitizer_syscall_pre_impl_signalfd4(long ufd, long user_mask, - long sizemask, long flags); -void __sanitizer_syscall_post_impl_signalfd4(long res, long ufd, long user_mask, - long sizemask, long flags); -void __sanitizer_syscall_pre_impl_timerfd_create(long clockid, long flags); -void __sanitizer_syscall_post_impl_timerfd_create(long res, long clockid, - long flags); -void __sanitizer_syscall_pre_impl_timerfd_settime(long ufd, long flags, - long utmr, long otmr); -void __sanitizer_syscall_post_impl_timerfd_settime(long res, long ufd, - long flags, long utmr, - long otmr); -void __sanitizer_syscall_pre_impl_timerfd_gettime(long ufd, long otmr); -void __sanitizer_syscall_post_impl_timerfd_gettime(long res, long ufd, - long otmr); -void __sanitizer_syscall_pre_impl_eventfd(long count); -void __sanitizer_syscall_post_impl_eventfd(long res, long count); -void __sanitizer_syscall_pre_impl_eventfd2(long count, long flags); -void __sanitizer_syscall_post_impl_eventfd2(long res, long count, long flags); -void __sanitizer_syscall_pre_impl_old_readdir(long arg0, long arg1, long arg2); -void __sanitizer_syscall_post_impl_old_readdir(long res, long arg0, long arg1, - long arg2); -void __sanitizer_syscall_pre_impl_pselect6(long arg0, long arg1, long arg2, - long arg3, long arg4, long arg5); -void __sanitizer_syscall_post_impl_pselect6(long res, long arg0, long arg1, - long arg2, long arg3, long arg4, - long arg5); -void __sanitizer_syscall_pre_impl_ppoll(long arg0, long arg1, long arg2, - long arg3, long arg4); -void __sanitizer_syscall_post_impl_ppoll(long res, long arg0, long arg1, - long arg2, long arg3, long arg4); -void __sanitizer_syscall_pre_impl_fanotify_init(long flags, long event_f_flags); -void __sanitizer_syscall_post_impl_fanotify_init(long res, long flags, - long event_f_flags); -void __sanitizer_syscall_pre_impl_fanotify_mark(long fanotify_fd, long flags, - long mask, long fd, - long pathname); -void __sanitizer_syscall_post_impl_fanotify_mark(long res, long fanotify_fd, - long flags, long mask, long fd, - long pathname); -void __sanitizer_syscall_pre_impl_syncfs(long fd); -void __sanitizer_syscall_post_impl_syncfs(long res, long fd); -void __sanitizer_syscall_pre_impl_perf_event_open(long attr_uptr, long pid, - long cpu, long group_fd, - long flags); -void __sanitizer_syscall_post_impl_perf_event_open(long res, long attr_uptr, - long pid, long cpu, - long group_fd, long flags); -void __sanitizer_syscall_pre_impl_mmap_pgoff(long addr, long len, long prot, - long flags, long fd, long pgoff); -void __sanitizer_syscall_post_impl_mmap_pgoff(long res, long addr, long len, - long prot, long flags, long fd, - long pgoff); -void __sanitizer_syscall_pre_impl_old_mmap(long arg); -void __sanitizer_syscall_post_impl_old_mmap(long res, long arg); -void __sanitizer_syscall_pre_impl_name_to_handle_at(long dfd, long name, - long handle, long mnt_id, - long flag); -void __sanitizer_syscall_post_impl_name_to_handle_at(long res, long dfd, - long name, long handle, - long mnt_id, long flag); -void __sanitizer_syscall_pre_impl_open_by_handle_at(long mountdirfd, - long handle, long flags); -void __sanitizer_syscall_post_impl_open_by_handle_at(long res, long mountdirfd, - long handle, long flags); -void __sanitizer_syscall_pre_impl_setns(long fd, long nstype); -void __sanitizer_syscall_post_impl_setns(long res, long fd, long nstype); -void __sanitizer_syscall_pre_impl_process_vm_readv(long pid, long lvec, - long liovcnt, long rvec, - long riovcnt, long flags); -void __sanitizer_syscall_post_impl_process_vm_readv(long res, long pid, - long lvec, long liovcnt, - long rvec, long riovcnt, - long flags); -void __sanitizer_syscall_pre_impl_process_vm_writev(long pid, long lvec, - long liovcnt, long rvec, - long riovcnt, long flags); -void __sanitizer_syscall_post_impl_process_vm_writev(long res, long pid, - long lvec, long liovcnt, - long rvec, long riovcnt, - long flags); -void __sanitizer_syscall_pre_impl_fork(); -void __sanitizer_syscall_post_impl_fork(long res); -void __sanitizer_syscall_pre_impl_vfork(); -void __sanitizer_syscall_post_impl_vfork(long res); -void __sanitizer_syscall_pre_impl_sigaction(long signum, long act, long oldact); -void __sanitizer_syscall_post_impl_sigaction(long res, long signum, long act, - long oldact); -void __sanitizer_syscall_pre_impl_rt_sigaction(long signum, long act, - long oldact, long sz); -void __sanitizer_syscall_post_impl_rt_sigaction(long res, long signum, long act, - long oldact, long sz); -void __sanitizer_syscall_pre_impl_sigaltstack(long ss, long oss); -void __sanitizer_syscall_post_impl_sigaltstack(long res, long ss, long oss); -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_LINUX_SYSCALL_HOOKS_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/lsan_interface.h b/contrib/libs/clang14-rt/include/sanitizer/lsan_interface.h deleted file mode 100644 index 2bb992672f2e..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/lsan_interface.h +++ /dev/null @@ -1,89 +0,0 @@ -//===-- sanitizer/lsan_interface.h ------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of LeakSanitizer. -// -// Public interface header. -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_LSAN_INTERFACE_H -#define SANITIZER_LSAN_INTERFACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - // Allocations made between calls to __lsan_disable() and __lsan_enable() will - // be treated as non-leaks. Disable/enable pairs may be nested. - void __lsan_disable(void); - void __lsan_enable(void); - - // The heap object into which p points will be treated as a non-leak. - void __lsan_ignore_object(const void *p); - - // Memory regions registered through this interface will be treated as sources - // of live pointers during leak checking. Useful if you store pointers in - // mapped memory. - // Points of note: - // - __lsan_unregister_root_region() must be called with the same pointer and - // size that have earlier been passed to __lsan_register_root_region() - // - LSan will skip any inaccessible memory when scanning a root region. E.g., - // if you map memory within a larger region that you have mprotect'ed, you can - // register the entire large region. - // - the implementation is not optimized for performance. This interface is - // intended to be used for a small number of relatively static regions. - void __lsan_register_root_region(const void *p, size_t size); - void __lsan_unregister_root_region(const void *p, size_t size); - - // Check for leaks now. This function behaves identically to the default - // end-of-process leak check. In particular, it will terminate the process if - // leaks are found and the exitcode runtime flag is non-zero. - // Subsequent calls to this function will have no effect and end-of-process - // leak check will not run. Effectively, end-of-process leak check is moved to - // the time of first invocation of this function. - // By calling this function early during process shutdown, you can instruct - // LSan to ignore shutdown-only leaks which happen later on. - void __lsan_do_leak_check(void); - - // Check for leaks now. Returns zero if no leaks have been found or if leak - // detection is disabled, non-zero otherwise. - // This function may be called repeatedly, e.g. to periodically check a - // long-running process. It prints a leak report if appropriate, but does not - // terminate the process. It does not affect the behavior of - // __lsan_do_leak_check() or the end-of-process leak check, and is not - // affected by them. - int __lsan_do_recoverable_leak_check(void); - - // The user may optionally provide this function to disallow leak checking - // for the program it is linked into (if the return value is non-zero). This - // function must be defined as returning a constant value; any behavior beyond - // that is unsupported. - // To avoid dead stripping, you may need to define this function with - // __attribute__((used)) - int __lsan_is_turned_off(void); - - // This function may be optionally provided by user and should return - // a string containing LSan runtime options. See lsan_flags.inc for details. - const char *__lsan_default_options(void); - - // This function may be optionally provided by the user and should return - // a string containing LSan suppressions. - const char *__lsan_default_suppressions(void); -#ifdef __cplusplus -} // extern "C" - -namespace __lsan { -class ScopedDisabler { - public: - ScopedDisabler() { __lsan_disable(); } - ~ScopedDisabler() { __lsan_enable(); } -}; -} // namespace __lsan -#endif - -#endif // SANITIZER_LSAN_INTERFACE_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/memprof_interface.h b/contrib/libs/clang14-rt/include/sanitizer/memprof_interface.h deleted file mode 100644 index 76031de4014c..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/memprof_interface.h +++ /dev/null @@ -1,65 +0,0 @@ -//===-- sanitizer/memprof_interface.h --------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of MemProfiler (MemProf). -// -// Public interface header. -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_MEMPROF_INTERFACE_H -#define SANITIZER_MEMPROF_INTERFACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif -/// Records access to a memory region ([addr, addr+size)). -/// -/// This memory must be previously allocated by your program. -/// -/// \param addr Start of memory region. -/// \param size Size of memory region. -void __memprof_record_access_range(void const volatile *addr, size_t size); - -/// Records access to a memory address addr. -/// -/// This memory must be previously allocated by your program. -/// -/// \param addr Accessed memory address -void __memprof_record_access(void const volatile *addr); - -/// User-provided callback on MemProf errors. -/// -/// You can provide a function that would be called immediately when MemProf -/// detects an error. This is useful in cases when MemProf detects an error but -/// your program crashes before the MemProf report is printed. -void __memprof_on_error(void); - -/// Prints accumulated statistics to stderr (useful for calling from the -/// debugger). -void __memprof_print_accumulated_stats(void); - -/// User-provided default option settings. -/// -/// You can provide your own implementation of this function to return a string -/// containing MemProf runtime options (for example, -/// verbosity=1:print_stats=1). -/// -/// \returns Default options string. -const char *__memprof_default_options(void); - -/// Prints the memory profile to the current profile file. -/// -/// \returns 0 on success. -int __memprof_profile_dump(void); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_MEMPROF_INTERFACE_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/msan_interface.h b/contrib/libs/clang14-rt/include/sanitizer/msan_interface.h deleted file mode 100644 index eeb39fbed8b4..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/msan_interface.h +++ /dev/null @@ -1,124 +0,0 @@ -//===-- msan_interface.h --------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of MemorySanitizer. -// -// Public interface header. -//===----------------------------------------------------------------------===// -#ifndef MSAN_INTERFACE_H -#define MSAN_INTERFACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - /* Set raw origin for the memory range. */ - void __msan_set_origin(const volatile void *a, size_t size, uint32_t origin); - - /* Get raw origin for an address. */ - uint32_t __msan_get_origin(const volatile void *a); - - /* Test that this_id is a descendant of prev_id (or they are simply equal). - * "descendant" here means they are part of the same chain, created with - * __msan_chain_origin. */ - int __msan_origin_is_descendant_or_same(uint32_t this_id, uint32_t prev_id); - - /* Returns non-zero if tracking origins. */ - int __msan_get_track_origins(void); - - /* Returns the origin id of the latest UMR in the calling thread. */ - uint32_t __msan_get_umr_origin(void); - - /* Make memory region fully initialized (without changing its contents). */ - void __msan_unpoison(const volatile void *a, size_t size); - - /* Make a null-terminated string fully initialized (without changing its - contents). */ - void __msan_unpoison_string(const volatile char *a); - - /* Make first n parameters of the next function call fully initialized. */ - void __msan_unpoison_param(size_t n); - - /* Make memory region fully uninitialized (without changing its contents). - This is a legacy interface that does not update origin information. Use - __msan_allocated_memory() instead. */ - void __msan_poison(const volatile void *a, size_t size); - - /* Make memory region partially uninitialized (without changing its contents). - */ - void __msan_partial_poison(const volatile void *data, void *shadow, - size_t size); - - /* Returns the offset of the first (at least partially) poisoned byte in the - memory range, or -1 if the whole range is good. */ - intptr_t __msan_test_shadow(const volatile void *x, size_t size); - - /* Checks that memory range is fully initialized, and reports an error if it - * is not. */ - void __msan_check_mem_is_initialized(const volatile void *x, size_t size); - - /* For testing: - __msan_set_expect_umr(1); - ... some buggy code ... - __msan_set_expect_umr(0); - The last line will verify that a UMR happened. */ - void __msan_set_expect_umr(int expect_umr); - - /* Change the value of keep_going flag. Non-zero value means don't terminate - program execution when an error is detected. This will not affect error in - modules that were compiled without the corresponding compiler flag. */ - void __msan_set_keep_going(int keep_going); - - /* Print shadow and origin for the memory range to stderr in a human-readable - format. */ - void __msan_print_shadow(const volatile void *x, size_t size); - - /* Print shadow for the memory range to stderr in a minimalistic - human-readable format. */ - void __msan_dump_shadow(const volatile void *x, size_t size); - - /* Returns true if running under a dynamic tool (DynamoRio-based). */ - int __msan_has_dynamic_component(void); - - /* Tell MSan about newly allocated memory (ex.: custom allocator). - Memory will be marked uninitialized, with origin at the call site. */ - void __msan_allocated_memory(const volatile void* data, size_t size); - - /* Tell MSan about newly destroyed memory. Mark memory as uninitialized. */ - void __sanitizer_dtor_callback(const volatile void* data, size_t size); - - /* This function may be optionally provided by user and should return - a string containing Msan runtime options. See msan_flags.h for details. */ - const char* __msan_default_options(void); - - /* Deprecated. Call __sanitizer_set_death_callback instead. */ - void __msan_set_death_callback(void (*callback)(void)); - - /* Update shadow for the application copy of size bytes from src to dst. - Src and dst are application addresses. This function does not copy the - actual application memory, it only updates shadow and origin for such - copy. Source and destination regions can overlap. */ - void __msan_copy_shadow(const volatile void *dst, const volatile void *src, - size_t size); - - /* Disables uninitialized memory checks in interceptors. */ - void __msan_scoped_disable_interceptor_checks(void); - - /* Re-enables uninitialized memory checks in interceptors after a previous - call to __msan_scoped_disable_interceptor_checks. */ - void __msan_scoped_enable_interceptor_checks(void); - - void __msan_start_switch_fiber(const void *bottom, size_t size); - void __msan_finish_switch_fiber(const void **bottom_old, size_t *size_old); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/contrib/libs/clang14-rt/include/sanitizer/netbsd_syscall_hooks.h b/contrib/libs/clang14-rt/include/sanitizer/netbsd_syscall_hooks.h deleted file mode 100644 index f661152ccbac..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/netbsd_syscall_hooks.h +++ /dev/null @@ -1,5005 +0,0 @@ -//===-- netbsd_syscall_hooks.h --------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of public sanitizer interface. -// -// System call handlers. -// -// Interface methods declared in this header implement pre- and post- syscall -// actions for the active sanitizer. -// Usage: -// __sanitizer_syscall_pre_getfoo(...args...); -// long long res = syscall(SYS_getfoo, ...args...); -// __sanitizer_syscall_post_getfoo(res, ...args...); -// -// DO NOT EDIT! THIS FILE HAS BEEN GENERATED! -// -// Generated with: generate_netbsd_syscalls.awk -// Generated date: 2020-09-10 -// Generated from: syscalls.master,v 1.306 2020/08/14 00:53:16 riastradh Exp -// -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_NETBSD_SYSCALL_HOOKS_H -#define SANITIZER_NETBSD_SYSCALL_HOOKS_H - -#define __sanitizer_syscall_pre_syscall(code, arg0, arg1, arg2, arg3, arg4, \ - arg5, arg6, arg7) \ - __sanitizer_syscall_pre_impl_syscall( \ - (long long)(code), (long long)(arg0), (long long)(arg1), \ - (long long)(arg2), (long long)(arg3), (long long)(arg4), \ - (long long)(arg5), (long long)(arg6), (long long)(arg7)) -#define __sanitizer_syscall_post_syscall(res, code, arg0, arg1, arg2, arg3, \ - arg4, arg5, arg6, arg7) \ - __sanitizer_syscall_post_impl_syscall( \ - res, (long long)(code), (long long)(arg0), (long long)(arg1), \ - (long long)(arg2), (long long)(arg3), (long long)(arg4), \ - (long long)(arg5), (long long)(arg6), (long long)(arg7)) -#define __sanitizer_syscall_pre_exit(rval) \ - __sanitizer_syscall_pre_impl_exit((long long)(rval)) -#define __sanitizer_syscall_post_exit(res, rval) \ - __sanitizer_syscall_post_impl_exit(res, (long long)(rval)) -#define __sanitizer_syscall_pre_fork() __sanitizer_syscall_pre_impl_fork() -#define __sanitizer_syscall_post_fork(res) \ - __sanitizer_syscall_post_impl_fork(res) -#define __sanitizer_syscall_pre_read(fd, buf, nbyte) \ - __sanitizer_syscall_pre_impl_read((long long)(fd), (long long)(buf), \ - (long long)(nbyte)) -#define __sanitizer_syscall_post_read(res, fd, buf, nbyte) \ - __sanitizer_syscall_post_impl_read(res, (long long)(fd), (long long)(buf), \ - (long long)(nbyte)) -#define __sanitizer_syscall_pre_write(fd, buf, nbyte) \ - __sanitizer_syscall_pre_impl_write((long long)(fd), (long long)(buf), \ - (long long)(nbyte)) -#define __sanitizer_syscall_post_write(res, fd, buf, nbyte) \ - __sanitizer_syscall_post_impl_write(res, (long long)(fd), (long long)(buf), \ - (long long)(nbyte)) -#define __sanitizer_syscall_pre_open(path, flags, mode) \ - __sanitizer_syscall_pre_impl_open((long long)(path), (long long)(flags), \ - (long long)(mode)) -#define __sanitizer_syscall_post_open(res, path, flags, mode) \ - __sanitizer_syscall_post_impl_open(res, (long long)(path), \ - (long long)(flags), (long long)(mode)) -#define __sanitizer_syscall_pre_close(fd) \ - __sanitizer_syscall_pre_impl_close((long long)(fd)) -#define __sanitizer_syscall_post_close(res, fd) \ - __sanitizer_syscall_post_impl_close(res, (long long)(fd)) -#define __sanitizer_syscall_pre_compat_50_wait4(pid, status, options, rusage) \ - __sanitizer_syscall_pre_impl_compat_50_wait4( \ - (long long)(pid), (long long)(status), (long long)(options), \ - (long long)(rusage)) -#define __sanitizer_syscall_post_compat_50_wait4(res, pid, status, options, \ - rusage) \ - __sanitizer_syscall_post_impl_compat_50_wait4( \ - res, (long long)(pid), (long long)(status), (long long)(options), \ - (long long)(rusage)) -#define __sanitizer_syscall_pre_compat_43_ocreat(path, mode) \ - __sanitizer_syscall_pre_impl_compat_43_ocreat((long long)(path), \ - (long long)(mode)) -#define __sanitizer_syscall_post_compat_43_ocreat(res, path, mode) \ - __sanitizer_syscall_post_impl_compat_43_ocreat(res, (long long)(path), \ - (long long)(mode)) -#define __sanitizer_syscall_pre_link(path, link) \ - __sanitizer_syscall_pre_impl_link((long long)(path), (long long)(link)) -#define __sanitizer_syscall_post_link(res, path, link) \ - __sanitizer_syscall_post_impl_link(res, (long long)(path), (long long)(link)) -#define __sanitizer_syscall_pre_unlink(path) \ - __sanitizer_syscall_pre_impl_unlink((long long)(path)) -#define __sanitizer_syscall_post_unlink(res, path) \ - __sanitizer_syscall_post_impl_unlink(res, (long long)(path)) -/* syscall 11 has been skipped */ -#define __sanitizer_syscall_pre_chdir(path) \ - __sanitizer_syscall_pre_impl_chdir((long long)(path)) -#define __sanitizer_syscall_post_chdir(res, path) \ - __sanitizer_syscall_post_impl_chdir(res, (long long)(path)) -#define __sanitizer_syscall_pre_fchdir(fd) \ - __sanitizer_syscall_pre_impl_fchdir((long long)(fd)) -#define __sanitizer_syscall_post_fchdir(res, fd) \ - __sanitizer_syscall_post_impl_fchdir(res, (long long)(fd)) -#define __sanitizer_syscall_pre_compat_50_mknod(path, mode, dev) \ - __sanitizer_syscall_pre_impl_compat_50_mknod( \ - (long long)(path), (long long)(mode), (long long)(dev)) -#define __sanitizer_syscall_post_compat_50_mknod(res, path, mode, dev) \ - __sanitizer_syscall_post_impl_compat_50_mknod( \ - res, (long long)(path), (long long)(mode), (long long)(dev)) -#define __sanitizer_syscall_pre_chmod(path, mode) \ - __sanitizer_syscall_pre_impl_chmod((long long)(path), (long long)(mode)) -#define __sanitizer_syscall_post_chmod(res, path, mode) \ - __sanitizer_syscall_post_impl_chmod(res, (long long)(path), (long long)(mode)) -#define __sanitizer_syscall_pre_chown(path, uid, gid) \ - __sanitizer_syscall_pre_impl_chown((long long)(path), (long long)(uid), \ - (long long)(gid)) -#define __sanitizer_syscall_post_chown(res, path, uid, gid) \ - __sanitizer_syscall_post_impl_chown(res, (long long)(path), \ - (long long)(uid), (long long)(gid)) -#define __sanitizer_syscall_pre_break(nsize) \ - __sanitizer_syscall_pre_impl_break((long long)(nsize)) -#define __sanitizer_syscall_post_break(res, nsize) \ - __sanitizer_syscall_post_impl_break(res, (long long)(nsize)) -#define __sanitizer_syscall_pre_compat_20_getfsstat(buf, bufsize, flags) \ - __sanitizer_syscall_pre_impl_compat_20_getfsstat( \ - (long long)(buf), (long long)(bufsize), (long long)(flags)) -#define __sanitizer_syscall_post_compat_20_getfsstat(res, buf, bufsize, flags) \ - __sanitizer_syscall_post_impl_compat_20_getfsstat( \ - res, (long long)(buf), (long long)(bufsize), (long long)(flags)) -#define __sanitizer_syscall_pre_compat_43_olseek(fd, offset, whence) \ - __sanitizer_syscall_pre_impl_compat_43_olseek( \ - (long long)(fd), (long long)(offset), (long long)(whence)) -#define __sanitizer_syscall_post_compat_43_olseek(res, fd, offset, whence) \ - __sanitizer_syscall_post_impl_compat_43_olseek( \ - res, (long long)(fd), (long long)(offset), (long long)(whence)) -#define __sanitizer_syscall_pre_getpid() __sanitizer_syscall_pre_impl_getpid() -#define __sanitizer_syscall_post_getpid(res) \ - __sanitizer_syscall_post_impl_getpid(res) -#define __sanitizer_syscall_pre_compat_40_mount(type, path, flags, data) \ - __sanitizer_syscall_pre_impl_compat_40_mount( \ - (long long)(type), (long long)(path), (long long)(flags), \ - (long long)(data)) -#define __sanitizer_syscall_post_compat_40_mount(res, type, path, flags, data) \ - __sanitizer_syscall_post_impl_compat_40_mount( \ - res, (long long)(type), (long long)(path), (long long)(flags), \ - (long long)(data)) -#define __sanitizer_syscall_pre_unmount(path, flags) \ - __sanitizer_syscall_pre_impl_unmount((long long)(path), (long long)(flags)) -#define __sanitizer_syscall_post_unmount(res, path, flags) \ - __sanitizer_syscall_post_impl_unmount(res, (long long)(path), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_setuid(uid) \ - __sanitizer_syscall_pre_impl_setuid((long long)(uid)) -#define __sanitizer_syscall_post_setuid(res, uid) \ - __sanitizer_syscall_post_impl_setuid(res, (long long)(uid)) -#define __sanitizer_syscall_pre_getuid() __sanitizer_syscall_pre_impl_getuid() -#define __sanitizer_syscall_post_getuid(res) \ - __sanitizer_syscall_post_impl_getuid(res) -#define __sanitizer_syscall_pre_geteuid() __sanitizer_syscall_pre_impl_geteuid() -#define __sanitizer_syscall_post_geteuid(res) \ - __sanitizer_syscall_post_impl_geteuid(res) -#define __sanitizer_syscall_pre_ptrace(req, pid, addr, data) \ - __sanitizer_syscall_pre_impl_ptrace((long long)(req), (long long)(pid), \ - (long long)(addr), (long long)(data)) -#define __sanitizer_syscall_post_ptrace(res, req, pid, addr, data) \ - __sanitizer_syscall_post_impl_ptrace(res, (long long)(req), \ - (long long)(pid), (long long)(addr), \ - (long long)(data)) -#define __sanitizer_syscall_pre_recvmsg(s, msg, flags) \ - __sanitizer_syscall_pre_impl_recvmsg((long long)(s), (long long)(msg), \ - (long long)(flags)) -#define __sanitizer_syscall_post_recvmsg(res, s, msg, flags) \ - __sanitizer_syscall_post_impl_recvmsg(res, (long long)(s), (long long)(msg), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_sendmsg(s, msg, flags) \ - __sanitizer_syscall_pre_impl_sendmsg((long long)(s), (long long)(msg), \ - (long long)(flags)) -#define __sanitizer_syscall_post_sendmsg(res, s, msg, flags) \ - __sanitizer_syscall_post_impl_sendmsg(res, (long long)(s), (long long)(msg), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_recvfrom(s, buf, len, flags, from, \ - fromlenaddr) \ - __sanitizer_syscall_pre_impl_recvfrom( \ - (long long)(s), (long long)(buf), (long long)(len), (long long)(flags), \ - (long long)(from), (long long)(fromlenaddr)) -#define __sanitizer_syscall_post_recvfrom(res, s, buf, len, flags, from, \ - fromlenaddr) \ - __sanitizer_syscall_post_impl_recvfrom( \ - res, (long long)(s), (long long)(buf), (long long)(len), \ - (long long)(flags), (long long)(from), (long long)(fromlenaddr)) -#define __sanitizer_syscall_pre_accept(s, name, anamelen) \ - __sanitizer_syscall_pre_impl_accept((long long)(s), (long long)(name), \ - (long long)(anamelen)) -#define __sanitizer_syscall_post_accept(res, s, name, anamelen) \ - __sanitizer_syscall_post_impl_accept(res, (long long)(s), (long long)(name), \ - (long long)(anamelen)) -#define __sanitizer_syscall_pre_getpeername(fdes, asa, alen) \ - __sanitizer_syscall_pre_impl_getpeername( \ - (long long)(fdes), (long long)(asa), (long long)(alen)) -#define __sanitizer_syscall_post_getpeername(res, fdes, asa, alen) \ - __sanitizer_syscall_post_impl_getpeername( \ - res, (long long)(fdes), (long long)(asa), (long long)(alen)) -#define __sanitizer_syscall_pre_getsockname(fdes, asa, alen) \ - __sanitizer_syscall_pre_impl_getsockname( \ - (long long)(fdes), (long long)(asa), (long long)(alen)) -#define __sanitizer_syscall_post_getsockname(res, fdes, asa, alen) \ - __sanitizer_syscall_post_impl_getsockname( \ - res, (long long)(fdes), (long long)(asa), (long long)(alen)) -#define __sanitizer_syscall_pre_access(path, flags) \ - __sanitizer_syscall_pre_impl_access((long long)(path), (long long)(flags)) -#define __sanitizer_syscall_post_access(res, path, flags) \ - __sanitizer_syscall_post_impl_access(res, (long long)(path), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_chflags(path, flags) \ - __sanitizer_syscall_pre_impl_chflags((long long)(path), (long long)(flags)) -#define __sanitizer_syscall_post_chflags(res, path, flags) \ - __sanitizer_syscall_post_impl_chflags(res, (long long)(path), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_fchflags(fd, flags) \ - __sanitizer_syscall_pre_impl_fchflags((long long)(fd), (long long)(flags)) -#define __sanitizer_syscall_post_fchflags(res, fd, flags) \ - __sanitizer_syscall_post_impl_fchflags(res, (long long)(fd), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_sync() __sanitizer_syscall_pre_impl_sync() -#define __sanitizer_syscall_post_sync(res) \ - __sanitizer_syscall_post_impl_sync(res) -#define __sanitizer_syscall_pre_kill(pid, signum) \ - __sanitizer_syscall_pre_impl_kill((long long)(pid), (long long)(signum)) -#define __sanitizer_syscall_post_kill(res, pid, signum) \ - __sanitizer_syscall_post_impl_kill(res, (long long)(pid), (long long)(signum)) -#define __sanitizer_syscall_pre_compat_43_stat43(path, ub) \ - __sanitizer_syscall_pre_impl_compat_43_stat43((long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_post_compat_43_stat43(res, path, ub) \ - __sanitizer_syscall_post_impl_compat_43_stat43(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre_getppid() __sanitizer_syscall_pre_impl_getppid() -#define __sanitizer_syscall_post_getppid(res) \ - __sanitizer_syscall_post_impl_getppid(res) -#define __sanitizer_syscall_pre_compat_43_lstat43(path, ub) \ - __sanitizer_syscall_pre_impl_compat_43_lstat43((long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_post_compat_43_lstat43(res, path, ub) \ - __sanitizer_syscall_post_impl_compat_43_lstat43(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre_dup(fd) \ - __sanitizer_syscall_pre_impl_dup((long long)(fd)) -#define __sanitizer_syscall_post_dup(res, fd) \ - __sanitizer_syscall_post_impl_dup(res, (long long)(fd)) -#define __sanitizer_syscall_pre_pipe() __sanitizer_syscall_pre_impl_pipe() -#define __sanitizer_syscall_post_pipe(res) \ - __sanitizer_syscall_post_impl_pipe(res) -#define __sanitizer_syscall_pre_getegid() __sanitizer_syscall_pre_impl_getegid() -#define __sanitizer_syscall_post_getegid(res) \ - __sanitizer_syscall_post_impl_getegid(res) -#define __sanitizer_syscall_pre_profil(samples, size, offset, scale) \ - __sanitizer_syscall_pre_impl_profil((long long)(samples), (long long)(size), \ - (long long)(offset), (long long)(scale)) -#define __sanitizer_syscall_post_profil(res, samples, size, offset, scale) \ - __sanitizer_syscall_post_impl_profil(res, (long long)(samples), \ - (long long)(size), (long long)(offset), \ - (long long)(scale)) -#define __sanitizer_syscall_pre_ktrace(fname, ops, facs, pid) \ - __sanitizer_syscall_pre_impl_ktrace((long long)(fname), (long long)(ops), \ - (long long)(facs), (long long)(pid)) -#define __sanitizer_syscall_post_ktrace(res, fname, ops, facs, pid) \ - __sanitizer_syscall_post_impl_ktrace(res, (long long)(fname), \ - (long long)(ops), (long long)(facs), \ - (long long)(pid)) -#define __sanitizer_syscall_pre_compat_13_sigaction13(signum, nsa, osa) \ - __sanitizer_syscall_pre_impl_compat_13_sigaction13( \ - (long long)(signum), (long long)(nsa), (long long)(osa)) -#define __sanitizer_syscall_post_compat_13_sigaction13(res, signum, nsa, osa) \ - __sanitizer_syscall_post_impl_compat_13_sigaction13( \ - res, (long long)(signum), (long long)(nsa), (long long)(osa)) -#define __sanitizer_syscall_pre_getgid() __sanitizer_syscall_pre_impl_getgid() -#define __sanitizer_syscall_post_getgid(res) \ - __sanitizer_syscall_post_impl_getgid(res) -#define __sanitizer_syscall_pre_compat_13_sigprocmask13(how, mask) \ - __sanitizer_syscall_pre_impl_compat_13_sigprocmask13((long long)(how), \ - (long long)(mask)) -#define __sanitizer_syscall_post_compat_13_sigprocmask13(res, how, mask) \ - __sanitizer_syscall_post_impl_compat_13_sigprocmask13(res, (long long)(how), \ - (long long)(mask)) -#define __sanitizer_syscall_pre___getlogin(namebuf, namelen) \ - __sanitizer_syscall_pre_impl___getlogin((long long)(namebuf), \ - (long long)(namelen)) -#define __sanitizer_syscall_post___getlogin(res, namebuf, namelen) \ - __sanitizer_syscall_post_impl___getlogin(res, (long long)(namebuf), \ - (long long)(namelen)) -#define __sanitizer_syscall_pre___setlogin(namebuf) \ - __sanitizer_syscall_pre_impl___setlogin((long long)(namebuf)) -#define __sanitizer_syscall_post___setlogin(res, namebuf) \ - __sanitizer_syscall_post_impl___setlogin(res, (long long)(namebuf)) -#define __sanitizer_syscall_pre_acct(path) \ - __sanitizer_syscall_pre_impl_acct((long long)(path)) -#define __sanitizer_syscall_post_acct(res, path) \ - __sanitizer_syscall_post_impl_acct(res, (long long)(path)) -#define __sanitizer_syscall_pre_compat_13_sigpending13() \ - __sanitizer_syscall_pre_impl_compat_13_sigpending13() -#define __sanitizer_syscall_post_compat_13_sigpending13(res) \ - __sanitizer_syscall_post_impl_compat_13_sigpending13(res) -#define __sanitizer_syscall_pre_compat_13_sigaltstack13(nss, oss) \ - __sanitizer_syscall_pre_impl_compat_13_sigaltstack13((long long)(nss), \ - (long long)(oss)) -#define __sanitizer_syscall_post_compat_13_sigaltstack13(res, nss, oss) \ - __sanitizer_syscall_post_impl_compat_13_sigaltstack13(res, (long long)(nss), \ - (long long)(oss)) -#define __sanitizer_syscall_pre_ioctl(fd, com, data) \ - __sanitizer_syscall_pre_impl_ioctl((long long)(fd), (long long)(com), \ - (long long)(data)) -#define __sanitizer_syscall_post_ioctl(res, fd, com, data) \ - __sanitizer_syscall_post_impl_ioctl(res, (long long)(fd), (long long)(com), \ - (long long)(data)) -#define __sanitizer_syscall_pre_compat_12_oreboot(opt) \ - __sanitizer_syscall_pre_impl_compat_12_oreboot((long long)(opt)) -#define __sanitizer_syscall_post_compat_12_oreboot(res, opt) \ - __sanitizer_syscall_post_impl_compat_12_oreboot(res, (long long)(opt)) -#define __sanitizer_syscall_pre_revoke(path) \ - __sanitizer_syscall_pre_impl_revoke((long long)(path)) -#define __sanitizer_syscall_post_revoke(res, path) \ - __sanitizer_syscall_post_impl_revoke(res, (long long)(path)) -#define __sanitizer_syscall_pre_symlink(path, link) \ - __sanitizer_syscall_pre_impl_symlink((long long)(path), (long long)(link)) -#define __sanitizer_syscall_post_symlink(res, path, link) \ - __sanitizer_syscall_post_impl_symlink(res, (long long)(path), \ - (long long)(link)) -#define __sanitizer_syscall_pre_readlink(path, buf, count) \ - __sanitizer_syscall_pre_impl_readlink((long long)(path), (long long)(buf), \ - (long long)(count)) -#define __sanitizer_syscall_post_readlink(res, path, buf, count) \ - __sanitizer_syscall_post_impl_readlink(res, (long long)(path), \ - (long long)(buf), (long long)(count)) -#define __sanitizer_syscall_pre_execve(path, argp, envp) \ - __sanitizer_syscall_pre_impl_execve((long long)(path), (long long)(argp), \ - (long long)(envp)) -#define __sanitizer_syscall_post_execve(res, path, argp, envp) \ - __sanitizer_syscall_post_impl_execve(res, (long long)(path), \ - (long long)(argp), (long long)(envp)) -#define __sanitizer_syscall_pre_umask(newmask) \ - __sanitizer_syscall_pre_impl_umask((long long)(newmask)) -#define __sanitizer_syscall_post_umask(res, newmask) \ - __sanitizer_syscall_post_impl_umask(res, (long long)(newmask)) -#define __sanitizer_syscall_pre_chroot(path) \ - __sanitizer_syscall_pre_impl_chroot((long long)(path)) -#define __sanitizer_syscall_post_chroot(res, path) \ - __sanitizer_syscall_post_impl_chroot(res, (long long)(path)) -#define __sanitizer_syscall_pre_compat_43_fstat43(fd, sb) \ - __sanitizer_syscall_pre_impl_compat_43_fstat43((long long)(fd), \ - (long long)(sb)) -#define __sanitizer_syscall_post_compat_43_fstat43(res, fd, sb) \ - __sanitizer_syscall_post_impl_compat_43_fstat43(res, (long long)(fd), \ - (long long)(sb)) -#define __sanitizer_syscall_pre_compat_43_ogetkerninfo(op, where, size, arg) \ - __sanitizer_syscall_pre_impl_compat_43_ogetkerninfo( \ - (long long)(op), (long long)(where), (long long)(size), \ - (long long)(arg)) -#define __sanitizer_syscall_post_compat_43_ogetkerninfo(res, op, where, size, \ - arg) \ - __sanitizer_syscall_post_impl_compat_43_ogetkerninfo( \ - res, (long long)(op), (long long)(where), (long long)(size), \ - (long long)(arg)) -#define __sanitizer_syscall_pre_compat_43_ogetpagesize() \ - __sanitizer_syscall_pre_impl_compat_43_ogetpagesize() -#define __sanitizer_syscall_post_compat_43_ogetpagesize(res) \ - __sanitizer_syscall_post_impl_compat_43_ogetpagesize(res) -#define __sanitizer_syscall_pre_compat_12_msync(addr, len) \ - __sanitizer_syscall_pre_impl_compat_12_msync((long long)(addr), \ - (long long)(len)) -#define __sanitizer_syscall_post_compat_12_msync(res, addr, len) \ - __sanitizer_syscall_post_impl_compat_12_msync(res, (long long)(addr), \ - (long long)(len)) -#define __sanitizer_syscall_pre_vfork() __sanitizer_syscall_pre_impl_vfork() -#define __sanitizer_syscall_post_vfork(res) \ - __sanitizer_syscall_post_impl_vfork(res) -/* syscall 67 has been skipped */ -/* syscall 68 has been skipped */ -/* syscall 69 has been skipped */ -/* syscall 70 has been skipped */ -#define __sanitizer_syscall_pre_compat_43_ommap(addr, len, prot, flags, fd, \ - pos) \ - __sanitizer_syscall_pre_impl_compat_43_ommap( \ - (long long)(addr), (long long)(len), (long long)(prot), \ - (long long)(flags), (long long)(fd), (long long)(pos)) -#define __sanitizer_syscall_post_compat_43_ommap(res, addr, len, prot, flags, \ - fd, pos) \ - __sanitizer_syscall_post_impl_compat_43_ommap( \ - res, (long long)(addr), (long long)(len), (long long)(prot), \ - (long long)(flags), (long long)(fd), (long long)(pos)) -#define __sanitizer_syscall_pre_vadvise(anom) \ - __sanitizer_syscall_pre_impl_vadvise((long long)(anom)) -#define __sanitizer_syscall_post_vadvise(res, anom) \ - __sanitizer_syscall_post_impl_vadvise(res, (long long)(anom)) -#define __sanitizer_syscall_pre_munmap(addr, len) \ - __sanitizer_syscall_pre_impl_munmap((long long)(addr), (long long)(len)) -#define __sanitizer_syscall_post_munmap(res, addr, len) \ - __sanitizer_syscall_post_impl_munmap(res, (long long)(addr), (long long)(len)) -#define __sanitizer_syscall_pre_mprotect(addr, len, prot) \ - __sanitizer_syscall_pre_impl_mprotect((long long)(addr), (long long)(len), \ - (long long)(prot)) -#define __sanitizer_syscall_post_mprotect(res, addr, len, prot) \ - __sanitizer_syscall_post_impl_mprotect(res, (long long)(addr), \ - (long long)(len), (long long)(prot)) -#define __sanitizer_syscall_pre_madvise(addr, len, behav) \ - __sanitizer_syscall_pre_impl_madvise((long long)(addr), (long long)(len), \ - (long long)(behav)) -#define __sanitizer_syscall_post_madvise(res, addr, len, behav) \ - __sanitizer_syscall_post_impl_madvise(res, (long long)(addr), \ - (long long)(len), (long long)(behav)) -/* syscall 76 has been skipped */ -/* syscall 77 has been skipped */ -#define __sanitizer_syscall_pre_mincore(addr, len, vec) \ - __sanitizer_syscall_pre_impl_mincore((long long)(addr), (long long)(len), \ - (long long)(vec)) -#define __sanitizer_syscall_post_mincore(res, addr, len, vec) \ - __sanitizer_syscall_post_impl_mincore(res, (long long)(addr), \ - (long long)(len), (long long)(vec)) -#define __sanitizer_syscall_pre_getgroups(gidsetsize, gidset) \ - __sanitizer_syscall_pre_impl_getgroups((long long)(gidsetsize), \ - (long long)(gidset)) -#define __sanitizer_syscall_post_getgroups(res, gidsetsize, gidset) \ - __sanitizer_syscall_post_impl_getgroups(res, (long long)(gidsetsize), \ - (long long)(gidset)) -#define __sanitizer_syscall_pre_setgroups(gidsetsize, gidset) \ - __sanitizer_syscall_pre_impl_setgroups((long long)(gidsetsize), \ - (long long)(gidset)) -#define __sanitizer_syscall_post_setgroups(res, gidsetsize, gidset) \ - __sanitizer_syscall_post_impl_setgroups(res, (long long)(gidsetsize), \ - (long long)(gidset)) -#define __sanitizer_syscall_pre_getpgrp() __sanitizer_syscall_pre_impl_getpgrp() -#define __sanitizer_syscall_post_getpgrp(res) \ - __sanitizer_syscall_post_impl_getpgrp(res) -#define __sanitizer_syscall_pre_setpgid(pid, pgid) \ - __sanitizer_syscall_pre_impl_setpgid((long long)(pid), (long long)(pgid)) -#define __sanitizer_syscall_post_setpgid(res, pid, pgid) \ - __sanitizer_syscall_post_impl_setpgid(res, (long long)(pid), \ - (long long)(pgid)) -#define __sanitizer_syscall_pre_compat_50_setitimer(which, itv, oitv) \ - __sanitizer_syscall_pre_impl_compat_50_setitimer( \ - (long long)(which), (long long)(itv), (long long)(oitv)) -#define __sanitizer_syscall_post_compat_50_setitimer(res, which, itv, oitv) \ - __sanitizer_syscall_post_impl_compat_50_setitimer( \ - res, (long long)(which), (long long)(itv), (long long)(oitv)) -#define __sanitizer_syscall_pre_compat_43_owait() \ - __sanitizer_syscall_pre_impl_compat_43_owait() -#define __sanitizer_syscall_post_compat_43_owait(res) \ - __sanitizer_syscall_post_impl_compat_43_owait(res) -#define __sanitizer_syscall_pre_compat_12_oswapon(name) \ - __sanitizer_syscall_pre_impl_compat_12_oswapon((long long)(name)) -#define __sanitizer_syscall_post_compat_12_oswapon(res, name) \ - __sanitizer_syscall_post_impl_compat_12_oswapon(res, (long long)(name)) -#define __sanitizer_syscall_pre_compat_50_getitimer(which, itv) \ - __sanitizer_syscall_pre_impl_compat_50_getitimer((long long)(which), \ - (long long)(itv)) -#define __sanitizer_syscall_post_compat_50_getitimer(res, which, itv) \ - __sanitizer_syscall_post_impl_compat_50_getitimer(res, (long long)(which), \ - (long long)(itv)) -#define __sanitizer_syscall_pre_compat_43_ogethostname(hostname, len) \ - __sanitizer_syscall_pre_impl_compat_43_ogethostname((long long)(hostname), \ - (long long)(len)) -#define __sanitizer_syscall_post_compat_43_ogethostname(res, hostname, len) \ - __sanitizer_syscall_post_impl_compat_43_ogethostname( \ - res, (long long)(hostname), (long long)(len)) -#define __sanitizer_syscall_pre_compat_43_osethostname(hostname, len) \ - __sanitizer_syscall_pre_impl_compat_43_osethostname((long long)(hostname), \ - (long long)(len)) -#define __sanitizer_syscall_post_compat_43_osethostname(res, hostname, len) \ - __sanitizer_syscall_post_impl_compat_43_osethostname( \ - res, (long long)(hostname), (long long)(len)) -#define __sanitizer_syscall_pre_compat_43_ogetdtablesize() \ - __sanitizer_syscall_pre_impl_compat_43_ogetdtablesize() -#define __sanitizer_syscall_post_compat_43_ogetdtablesize(res) \ - __sanitizer_syscall_post_impl_compat_43_ogetdtablesize(res) -#define __sanitizer_syscall_pre_dup2(from, to) \ - __sanitizer_syscall_pre_impl_dup2((long long)(from), (long long)(to)) -#define __sanitizer_syscall_post_dup2(res, from, to) \ - __sanitizer_syscall_post_impl_dup2(res, (long long)(from), (long long)(to)) -#define __sanitizer_syscall_pre_getrandom(buf, buflen, flags) \ - __sanitizer_syscall_pre_impl_getrandom( \ - (long long)(buf), (long long)(buflen), (long long)(flags)) -#define __sanitizer_syscall_post_getrandom(res, buf, buflen, flags) \ - __sanitizer_syscall_post_impl_getrandom( \ - res, (long long)(buf), (long long)(buflen), (long long)(flags)) -#define __sanitizer_syscall_pre_fcntl(fd, cmd, arg) \ - __sanitizer_syscall_pre_impl_fcntl((long long)(fd), (long long)(cmd), \ - (long long)(arg)) -#define __sanitizer_syscall_post_fcntl(res, fd, cmd, arg) \ - __sanitizer_syscall_post_impl_fcntl(res, (long long)(fd), (long long)(cmd), \ - (long long)(arg)) -#define __sanitizer_syscall_pre_compat_50_select(nd, in, ou, ex, tv) \ - __sanitizer_syscall_pre_impl_compat_50_select( \ - (long long)(nd), (long long)(in), (long long)(ou), (long long)(ex), \ - (long long)(tv)) -#define __sanitizer_syscall_post_compat_50_select(res, nd, in, ou, ex, tv) \ - __sanitizer_syscall_post_impl_compat_50_select( \ - res, (long long)(nd), (long long)(in), (long long)(ou), (long long)(ex), \ - (long long)(tv)) -/* syscall 94 has been skipped */ -#define __sanitizer_syscall_pre_fsync(fd) \ - __sanitizer_syscall_pre_impl_fsync((long long)(fd)) -#define __sanitizer_syscall_post_fsync(res, fd) \ - __sanitizer_syscall_post_impl_fsync(res, (long long)(fd)) -#define __sanitizer_syscall_pre_setpriority(which, who, prio) \ - __sanitizer_syscall_pre_impl_setpriority( \ - (long long)(which), (long long)(who), (long long)(prio)) -#define __sanitizer_syscall_post_setpriority(res, which, who, prio) \ - __sanitizer_syscall_post_impl_setpriority( \ - res, (long long)(which), (long long)(who), (long long)(prio)) -#define __sanitizer_syscall_pre_compat_30_socket(domain, type, protocol) \ - __sanitizer_syscall_pre_impl_compat_30_socket( \ - (long long)(domain), (long long)(type), (long long)(protocol)) -#define __sanitizer_syscall_post_compat_30_socket(res, domain, type, protocol) \ - __sanitizer_syscall_post_impl_compat_30_socket( \ - res, (long long)(domain), (long long)(type), (long long)(protocol)) -#define __sanitizer_syscall_pre_connect(s, name, namelen) \ - __sanitizer_syscall_pre_impl_connect((long long)(s), (long long)(name), \ - (long long)(namelen)) -#define __sanitizer_syscall_post_connect(res, s, name, namelen) \ - __sanitizer_syscall_post_impl_connect( \ - res, (long long)(s), (long long)(name), (long long)(namelen)) -#define __sanitizer_syscall_pre_compat_43_oaccept(s, name, anamelen) \ - __sanitizer_syscall_pre_impl_compat_43_oaccept( \ - (long long)(s), (long long)(name), (long long)(anamelen)) -#define __sanitizer_syscall_post_compat_43_oaccept(res, s, name, anamelen) \ - __sanitizer_syscall_post_impl_compat_43_oaccept( \ - res, (long long)(s), (long long)(name), (long long)(anamelen)) -#define __sanitizer_syscall_pre_getpriority(which, who) \ - __sanitizer_syscall_pre_impl_getpriority((long long)(which), (long long)(who)) -#define __sanitizer_syscall_post_getpriority(res, which, who) \ - __sanitizer_syscall_post_impl_getpriority(res, (long long)(which), \ - (long long)(who)) -#define __sanitizer_syscall_pre_compat_43_osend(s, buf, len, flags) \ - __sanitizer_syscall_pre_impl_compat_43_osend( \ - (long long)(s), (long long)(buf), (long long)(len), (long long)(flags)) -#define __sanitizer_syscall_post_compat_43_osend(res, s, buf, len, flags) \ - __sanitizer_syscall_post_impl_compat_43_osend( \ - res, (long long)(s), (long long)(buf), (long long)(len), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_compat_43_orecv(s, buf, len, flags) \ - __sanitizer_syscall_pre_impl_compat_43_orecv( \ - (long long)(s), (long long)(buf), (long long)(len), (long long)(flags)) -#define __sanitizer_syscall_post_compat_43_orecv(res, s, buf, len, flags) \ - __sanitizer_syscall_post_impl_compat_43_orecv( \ - res, (long long)(s), (long long)(buf), (long long)(len), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_compat_13_sigreturn13(sigcntxp) \ - __sanitizer_syscall_pre_impl_compat_13_sigreturn13((long long)(sigcntxp)) -#define __sanitizer_syscall_post_compat_13_sigreturn13(res, sigcntxp) \ - __sanitizer_syscall_post_impl_compat_13_sigreturn13(res, \ - (long long)(sigcntxp)) -#define __sanitizer_syscall_pre_bind(s, name, namelen) \ - __sanitizer_syscall_pre_impl_bind((long long)(s), (long long)(name), \ - (long long)(namelen)) -#define __sanitizer_syscall_post_bind(res, s, name, namelen) \ - __sanitizer_syscall_post_impl_bind(res, (long long)(s), (long long)(name), \ - (long long)(namelen)) -#define __sanitizer_syscall_pre_setsockopt(s, level, name, val, valsize) \ - __sanitizer_syscall_pre_impl_setsockopt((long long)(s), (long long)(level), \ - (long long)(name), (long long)(val), \ - (long long)(valsize)) -#define __sanitizer_syscall_post_setsockopt(res, s, level, name, val, valsize) \ - __sanitizer_syscall_post_impl_setsockopt( \ - res, (long long)(s), (long long)(level), (long long)(name), \ - (long long)(val), (long long)(valsize)) -#define __sanitizer_syscall_pre_listen(s, backlog) \ - __sanitizer_syscall_pre_impl_listen((long long)(s), (long long)(backlog)) -#define __sanitizer_syscall_post_listen(res, s, backlog) \ - __sanitizer_syscall_post_impl_listen(res, (long long)(s), \ - (long long)(backlog)) -/* syscall 107 has been skipped */ -#define __sanitizer_syscall_pre_compat_43_osigvec(signum, nsv, osv) \ - __sanitizer_syscall_pre_impl_compat_43_osigvec( \ - (long long)(signum), (long long)(nsv), (long long)(osv)) -#define __sanitizer_syscall_post_compat_43_osigvec(res, signum, nsv, osv) \ - __sanitizer_syscall_post_impl_compat_43_osigvec( \ - res, (long long)(signum), (long long)(nsv), (long long)(osv)) -#define __sanitizer_syscall_pre_compat_43_osigblock(mask) \ - __sanitizer_syscall_pre_impl_compat_43_osigblock((long long)(mask)) -#define __sanitizer_syscall_post_compat_43_osigblock(res, mask) \ - __sanitizer_syscall_post_impl_compat_43_osigblock(res, (long long)(mask)) -#define __sanitizer_syscall_pre_compat_43_osigsetmask(mask) \ - __sanitizer_syscall_pre_impl_compat_43_osigsetmask((long long)(mask)) -#define __sanitizer_syscall_post_compat_43_osigsetmask(res, mask) \ - __sanitizer_syscall_post_impl_compat_43_osigsetmask(res, (long long)(mask)) -#define __sanitizer_syscall_pre_compat_13_sigsuspend13(mask) \ - __sanitizer_syscall_pre_impl_compat_13_sigsuspend13((long long)(mask)) -#define __sanitizer_syscall_post_compat_13_sigsuspend13(res, mask) \ - __sanitizer_syscall_post_impl_compat_13_sigsuspend13(res, (long long)(mask)) -#define __sanitizer_syscall_pre_compat_43_osigstack(nss, oss) \ - __sanitizer_syscall_pre_impl_compat_43_osigstack((long long)(nss), \ - (long long)(oss)) -#define __sanitizer_syscall_post_compat_43_osigstack(res, nss, oss) \ - __sanitizer_syscall_post_impl_compat_43_osigstack(res, (long long)(nss), \ - (long long)(oss)) -#define __sanitizer_syscall_pre_compat_43_orecvmsg(s, msg, flags) \ - __sanitizer_syscall_pre_impl_compat_43_orecvmsg( \ - (long long)(s), (long long)(msg), (long long)(flags)) -#define __sanitizer_syscall_post_compat_43_orecvmsg(res, s, msg, flags) \ - __sanitizer_syscall_post_impl_compat_43_orecvmsg( \ - res, (long long)(s), (long long)(msg), (long long)(flags)) -#define __sanitizer_syscall_pre_compat_43_osendmsg(s, msg, flags) \ - __sanitizer_syscall_pre_impl_compat_43_osendmsg( \ - (long long)(s), (long long)(msg), (long long)(flags)) -#define __sanitizer_syscall_post_compat_43_osendmsg(res, s, msg, flags) \ - __sanitizer_syscall_post_impl_compat_43_osendmsg( \ - res, (long long)(s), (long long)(msg), (long long)(flags)) -/* syscall 115 has been skipped */ -#define __sanitizer_syscall_pre_compat_50_gettimeofday(tp, tzp) \ - __sanitizer_syscall_pre_impl_compat_50_gettimeofday((long long)(tp), \ - (long long)(tzp)) -#define __sanitizer_syscall_post_compat_50_gettimeofday(res, tp, tzp) \ - __sanitizer_syscall_post_impl_compat_50_gettimeofday(res, (long long)(tp), \ - (long long)(tzp)) -#define __sanitizer_syscall_pre_compat_50_getrusage(who, rusage) \ - __sanitizer_syscall_pre_impl_compat_50_getrusage((long long)(who), \ - (long long)(rusage)) -#define __sanitizer_syscall_post_compat_50_getrusage(res, who, rusage) \ - __sanitizer_syscall_post_impl_compat_50_getrusage(res, (long long)(who), \ - (long long)(rusage)) -#define __sanitizer_syscall_pre_getsockopt(s, level, name, val, avalsize) \ - __sanitizer_syscall_pre_impl_getsockopt((long long)(s), (long long)(level), \ - (long long)(name), (long long)(val), \ - (long long)(avalsize)) -#define __sanitizer_syscall_post_getsockopt(res, s, level, name, val, \ - avalsize) \ - __sanitizer_syscall_post_impl_getsockopt( \ - res, (long long)(s), (long long)(level), (long long)(name), \ - (long long)(val), (long long)(avalsize)) -/* syscall 119 has been skipped */ -#define __sanitizer_syscall_pre_readv(fd, iovp, iovcnt) \ - __sanitizer_syscall_pre_impl_readv((long long)(fd), (long long)(iovp), \ - (long long)(iovcnt)) -#define __sanitizer_syscall_post_readv(res, fd, iovp, iovcnt) \ - __sanitizer_syscall_post_impl_readv(res, (long long)(fd), (long long)(iovp), \ - (long long)(iovcnt)) -#define __sanitizer_syscall_pre_writev(fd, iovp, iovcnt) \ - __sanitizer_syscall_pre_impl_writev((long long)(fd), (long long)(iovp), \ - (long long)(iovcnt)) -#define __sanitizer_syscall_post_writev(res, fd, iovp, iovcnt) \ - __sanitizer_syscall_post_impl_writev(res, (long long)(fd), \ - (long long)(iovp), (long long)(iovcnt)) -#define __sanitizer_syscall_pre_compat_50_settimeofday(tv, tzp) \ - __sanitizer_syscall_pre_impl_compat_50_settimeofday((long long)(tv), \ - (long long)(tzp)) -#define __sanitizer_syscall_post_compat_50_settimeofday(res, tv, tzp) \ - __sanitizer_syscall_post_impl_compat_50_settimeofday(res, (long long)(tv), \ - (long long)(tzp)) -#define __sanitizer_syscall_pre_fchown(fd, uid, gid) \ - __sanitizer_syscall_pre_impl_fchown((long long)(fd), (long long)(uid), \ - (long long)(gid)) -#define __sanitizer_syscall_post_fchown(res, fd, uid, gid) \ - __sanitizer_syscall_post_impl_fchown(res, (long long)(fd), (long long)(uid), \ - (long long)(gid)) -#define __sanitizer_syscall_pre_fchmod(fd, mode) \ - __sanitizer_syscall_pre_impl_fchmod((long long)(fd), (long long)(mode)) -#define __sanitizer_syscall_post_fchmod(res, fd, mode) \ - __sanitizer_syscall_post_impl_fchmod(res, (long long)(fd), (long long)(mode)) -#define __sanitizer_syscall_pre_compat_43_orecvfrom(s, buf, len, flags, from, \ - fromlenaddr) \ - __sanitizer_syscall_pre_impl_compat_43_orecvfrom( \ - (long long)(s), (long long)(buf), (long long)(len), (long long)(flags), \ - (long long)(from), (long long)(fromlenaddr)) -#define __sanitizer_syscall_post_compat_43_orecvfrom(res, s, buf, len, flags, \ - from, fromlenaddr) \ - __sanitizer_syscall_post_impl_compat_43_orecvfrom( \ - res, (long long)(s), (long long)(buf), (long long)(len), \ - (long long)(flags), (long long)(from), (long long)(fromlenaddr)) -#define __sanitizer_syscall_pre_setreuid(ruid, euid) \ - __sanitizer_syscall_pre_impl_setreuid((long long)(ruid), (long long)(euid)) -#define __sanitizer_syscall_post_setreuid(res, ruid, euid) \ - __sanitizer_syscall_post_impl_setreuid(res, (long long)(ruid), \ - (long long)(euid)) -#define __sanitizer_syscall_pre_setregid(rgid, egid) \ - __sanitizer_syscall_pre_impl_setregid((long long)(rgid), (long long)(egid)) -#define __sanitizer_syscall_post_setregid(res, rgid, egid) \ - __sanitizer_syscall_post_impl_setregid(res, (long long)(rgid), \ - (long long)(egid)) -#define __sanitizer_syscall_pre_rename(from, to) \ - __sanitizer_syscall_pre_impl_rename((long long)(from), (long long)(to)) -#define __sanitizer_syscall_post_rename(res, from, to) \ - __sanitizer_syscall_post_impl_rename(res, (long long)(from), (long long)(to)) -#define __sanitizer_syscall_pre_compat_43_otruncate(path, length) \ - __sanitizer_syscall_pre_impl_compat_43_otruncate((long long)(path), \ - (long long)(length)) -#define __sanitizer_syscall_post_compat_43_otruncate(res, path, length) \ - __sanitizer_syscall_post_impl_compat_43_otruncate(res, (long long)(path), \ - (long long)(length)) -#define __sanitizer_syscall_pre_compat_43_oftruncate(fd, length) \ - __sanitizer_syscall_pre_impl_compat_43_oftruncate((long long)(fd), \ - (long long)(length)) -#define __sanitizer_syscall_post_compat_43_oftruncate(res, fd, length) \ - __sanitizer_syscall_post_impl_compat_43_oftruncate(res, (long long)(fd), \ - (long long)(length)) -#define __sanitizer_syscall_pre_flock(fd, how) \ - __sanitizer_syscall_pre_impl_flock((long long)(fd), (long long)(how)) -#define __sanitizer_syscall_post_flock(res, fd, how) \ - __sanitizer_syscall_post_impl_flock(res, (long long)(fd), (long long)(how)) -#define __sanitizer_syscall_pre_mkfifo(path, mode) \ - __sanitizer_syscall_pre_impl_mkfifo((long long)(path), (long long)(mode)) -#define __sanitizer_syscall_post_mkfifo(res, path, mode) \ - __sanitizer_syscall_post_impl_mkfifo(res, (long long)(path), \ - (long long)(mode)) -#define __sanitizer_syscall_pre_sendto(s, buf, len, flags, to, tolen) \ - __sanitizer_syscall_pre_impl_sendto((long long)(s), (long long)(buf), \ - (long long)(len), (long long)(flags), \ - (long long)(to), (long long)(tolen)) -#define __sanitizer_syscall_post_sendto(res, s, buf, len, flags, to, tolen) \ - __sanitizer_syscall_post_impl_sendto(res, (long long)(s), (long long)(buf), \ - (long long)(len), (long long)(flags), \ - (long long)(to), (long long)(tolen)) -#define __sanitizer_syscall_pre_shutdown(s, how) \ - __sanitizer_syscall_pre_impl_shutdown((long long)(s), (long long)(how)) -#define __sanitizer_syscall_post_shutdown(res, s, how) \ - __sanitizer_syscall_post_impl_shutdown(res, (long long)(s), (long long)(how)) -#define __sanitizer_syscall_pre_socketpair(domain, type, protocol, rsv) \ - __sanitizer_syscall_pre_impl_socketpair( \ - (long long)(domain), (long long)(type), (long long)(protocol), \ - (long long)(rsv)) -#define __sanitizer_syscall_post_socketpair(res, domain, type, protocol, rsv) \ - __sanitizer_syscall_post_impl_socketpair( \ - res, (long long)(domain), (long long)(type), (long long)(protocol), \ - (long long)(rsv)) -#define __sanitizer_syscall_pre_mkdir(path, mode) \ - __sanitizer_syscall_pre_impl_mkdir((long long)(path), (long long)(mode)) -#define __sanitizer_syscall_post_mkdir(res, path, mode) \ - __sanitizer_syscall_post_impl_mkdir(res, (long long)(path), (long long)(mode)) -#define __sanitizer_syscall_pre_rmdir(path) \ - __sanitizer_syscall_pre_impl_rmdir((long long)(path)) -#define __sanitizer_syscall_post_rmdir(res, path) \ - __sanitizer_syscall_post_impl_rmdir(res, (long long)(path)) -#define __sanitizer_syscall_pre_compat_50_utimes(path, tptr) \ - __sanitizer_syscall_pre_impl_compat_50_utimes((long long)(path), \ - (long long)(tptr)) -#define __sanitizer_syscall_post_compat_50_utimes(res, path, tptr) \ - __sanitizer_syscall_post_impl_compat_50_utimes(res, (long long)(path), \ - (long long)(tptr)) -/* syscall 139 has been skipped */ -#define __sanitizer_syscall_pre_compat_50_adjtime(delta, olddelta) \ - __sanitizer_syscall_pre_impl_compat_50_adjtime((long long)(delta), \ - (long long)(olddelta)) -#define __sanitizer_syscall_post_compat_50_adjtime(res, delta, olddelta) \ - __sanitizer_syscall_post_impl_compat_50_adjtime(res, (long long)(delta), \ - (long long)(olddelta)) -#define __sanitizer_syscall_pre_compat_43_ogetpeername(fdes, asa, alen) \ - __sanitizer_syscall_pre_impl_compat_43_ogetpeername( \ - (long long)(fdes), (long long)(asa), (long long)(alen)) -#define __sanitizer_syscall_post_compat_43_ogetpeername(res, fdes, asa, alen) \ - __sanitizer_syscall_post_impl_compat_43_ogetpeername( \ - res, (long long)(fdes), (long long)(asa), (long long)(alen)) -#define __sanitizer_syscall_pre_compat_43_ogethostid() \ - __sanitizer_syscall_pre_impl_compat_43_ogethostid() -#define __sanitizer_syscall_post_compat_43_ogethostid(res) \ - __sanitizer_syscall_post_impl_compat_43_ogethostid(res) -#define __sanitizer_syscall_pre_compat_43_osethostid(hostid) \ - __sanitizer_syscall_pre_impl_compat_43_osethostid((long long)(hostid)) -#define __sanitizer_syscall_post_compat_43_osethostid(res, hostid) \ - __sanitizer_syscall_post_impl_compat_43_osethostid(res, (long long)(hostid)) -#define __sanitizer_syscall_pre_compat_43_ogetrlimit(which, rlp) \ - __sanitizer_syscall_pre_impl_compat_43_ogetrlimit((long long)(which), \ - (long long)(rlp)) -#define __sanitizer_syscall_post_compat_43_ogetrlimit(res, which, rlp) \ - __sanitizer_syscall_post_impl_compat_43_ogetrlimit(res, (long long)(which), \ - (long long)(rlp)) -#define __sanitizer_syscall_pre_compat_43_osetrlimit(which, rlp) \ - __sanitizer_syscall_pre_impl_compat_43_osetrlimit((long long)(which), \ - (long long)(rlp)) -#define __sanitizer_syscall_post_compat_43_osetrlimit(res, which, rlp) \ - __sanitizer_syscall_post_impl_compat_43_osetrlimit(res, (long long)(which), \ - (long long)(rlp)) -#define __sanitizer_syscall_pre_compat_43_okillpg(pgid, signum) \ - __sanitizer_syscall_pre_impl_compat_43_okillpg((long long)(pgid), \ - (long long)(signum)) -#define __sanitizer_syscall_post_compat_43_okillpg(res, pgid, signum) \ - __sanitizer_syscall_post_impl_compat_43_okillpg(res, (long long)(pgid), \ - (long long)(signum)) -#define __sanitizer_syscall_pre_setsid() __sanitizer_syscall_pre_impl_setsid() -#define __sanitizer_syscall_post_setsid(res) \ - __sanitizer_syscall_post_impl_setsid(res) -#define __sanitizer_syscall_pre_compat_50_quotactl(path, cmd, uid, arg) \ - __sanitizer_syscall_pre_impl_compat_50_quotactl( \ - (long long)(path), (long long)(cmd), (long long)(uid), (long long)(arg)) -#define __sanitizer_syscall_post_compat_50_quotactl(res, path, cmd, uid, arg) \ - __sanitizer_syscall_post_impl_compat_50_quotactl( \ - res, (long long)(path), (long long)(cmd), (long long)(uid), \ - (long long)(arg)) -#define __sanitizer_syscall_pre_compat_43_oquota() \ - __sanitizer_syscall_pre_impl_compat_43_oquota() -#define __sanitizer_syscall_post_compat_43_oquota(res) \ - __sanitizer_syscall_post_impl_compat_43_oquota(res) -#define __sanitizer_syscall_pre_compat_43_ogetsockname(fdec, asa, alen) \ - __sanitizer_syscall_pre_impl_compat_43_ogetsockname( \ - (long long)(fdec), (long long)(asa), (long long)(alen)) -#define __sanitizer_syscall_post_compat_43_ogetsockname(res, fdec, asa, alen) \ - __sanitizer_syscall_post_impl_compat_43_ogetsockname( \ - res, (long long)(fdec), (long long)(asa), (long long)(alen)) -/* syscall 151 has been skipped */ -/* syscall 152 has been skipped */ -/* syscall 153 has been skipped */ -/* syscall 154 has been skipped */ -#define __sanitizer_syscall_pre_nfssvc(flag, argp) \ - __sanitizer_syscall_pre_impl_nfssvc((long long)(flag), (long long)(argp)) -#define __sanitizer_syscall_post_nfssvc(res, flag, argp) \ - __sanitizer_syscall_post_impl_nfssvc(res, (long long)(flag), \ - (long long)(argp)) -#define __sanitizer_syscall_pre_compat_43_ogetdirentries(fd, buf, count, \ - basep) \ - __sanitizer_syscall_pre_impl_compat_43_ogetdirentries( \ - (long long)(fd), (long long)(buf), (long long)(count), \ - (long long)(basep)) -#define __sanitizer_syscall_post_compat_43_ogetdirentries(res, fd, buf, count, \ - basep) \ - __sanitizer_syscall_post_impl_compat_43_ogetdirentries( \ - res, (long long)(fd), (long long)(buf), (long long)(count), \ - (long long)(basep)) -#define __sanitizer_syscall_pre_compat_20_statfs(path, buf) \ - __sanitizer_syscall_pre_impl_compat_20_statfs((long long)(path), \ - (long long)(buf)) -#define __sanitizer_syscall_post_compat_20_statfs(res, path, buf) \ - __sanitizer_syscall_post_impl_compat_20_statfs(res, (long long)(path), \ - (long long)(buf)) -#define __sanitizer_syscall_pre_compat_20_fstatfs(fd, buf) \ - __sanitizer_syscall_pre_impl_compat_20_fstatfs((long long)(fd), \ - (long long)(buf)) -#define __sanitizer_syscall_post_compat_20_fstatfs(res, fd, buf) \ - __sanitizer_syscall_post_impl_compat_20_fstatfs(res, (long long)(fd), \ - (long long)(buf)) -/* syscall 159 has been skipped */ -/* syscall 160 has been skipped */ -#define __sanitizer_syscall_pre_compat_30_getfh(fname, fhp) \ - __sanitizer_syscall_pre_impl_compat_30_getfh((long long)(fname), \ - (long long)(fhp)) -#define __sanitizer_syscall_post_compat_30_getfh(res, fname, fhp) \ - __sanitizer_syscall_post_impl_compat_30_getfh(res, (long long)(fname), \ - (long long)(fhp)) -#define __sanitizer_syscall_pre_compat_09_ogetdomainname(domainname, len) \ - __sanitizer_syscall_pre_impl_compat_09_ogetdomainname( \ - (long long)(domainname), (long long)(len)) -#define __sanitizer_syscall_post_compat_09_ogetdomainname(res, domainname, \ - len) \ - __sanitizer_syscall_post_impl_compat_09_ogetdomainname( \ - res, (long long)(domainname), (long long)(len)) -#define __sanitizer_syscall_pre_compat_09_osetdomainname(domainname, len) \ - __sanitizer_syscall_pre_impl_compat_09_osetdomainname( \ - (long long)(domainname), (long long)(len)) -#define __sanitizer_syscall_post_compat_09_osetdomainname(res, domainname, \ - len) \ - __sanitizer_syscall_post_impl_compat_09_osetdomainname( \ - res, (long long)(domainname), (long long)(len)) -#define __sanitizer_syscall_pre_compat_09_ouname(name) \ - __sanitizer_syscall_pre_impl_compat_09_ouname((long long)(name)) -#define __sanitizer_syscall_post_compat_09_ouname(res, name) \ - __sanitizer_syscall_post_impl_compat_09_ouname(res, (long long)(name)) -#define __sanitizer_syscall_pre_sysarch(op, parms) \ - __sanitizer_syscall_pre_impl_sysarch((long long)(op), (long long)(parms)) -#define __sanitizer_syscall_post_sysarch(res, op, parms) \ - __sanitizer_syscall_post_impl_sysarch(res, (long long)(op), \ - (long long)(parms)) -#define __sanitizer_syscall_pre___futex(uaddr, op, val, timeout, uaddr2, val2, \ - val3) \ - __sanitizer_syscall_pre_impl___futex((long long)(uaddr), (long long)(op), \ - (long long)(val), (long long)(timeout), \ - (long long)(uaddr2), (long long)(val2), \ - (long long)(val3)) -#define __sanitizer_syscall_post___futex(res, uaddr, op, val, timeout, uaddr2, \ - val2, val3) \ - __sanitizer_syscall_post_impl___futex( \ - res, (long long)(uaddr), (long long)(op), (long long)(val), \ - (long long)(timeout), (long long)(uaddr2), (long long)(val2), \ - (long long)(val3)) -#define __sanitizer_syscall_pre___futex_set_robust_list(head, len) \ - __sanitizer_syscall_pre_impl___futex_set_robust_list((long long)(head), \ - (long long)(len)) -#define __sanitizer_syscall_post___futex_set_robust_list(res, head, len) \ - __sanitizer_syscall_post_impl___futex_set_robust_list( \ - res, (long long)(head), (long long)(len)) -#define __sanitizer_syscall_pre___futex_get_robust_list(lwpid, headp, lenp) \ - __sanitizer_syscall_pre_impl___futex_get_robust_list( \ - (long long)(lwpid), (long long)(headp), (long long)(lenp)) -#define __sanitizer_syscall_post___futex_get_robust_list(res, lwpid, headp, \ - lenp) \ - __sanitizer_syscall_post_impl___futex_get_robust_list( \ - res, (long long)(lwpid), (long long)(headp), (long long)(lenp)) -#if !defined(_LP64) -#define __sanitizer_syscall_pre_compat_10_osemsys(which, a2, a3, a4, a5) \ - __sanitizer_syscall_pre_impl_compat_10_osemsys( \ - (long long)(which), (long long)(a2), (long long)(a3), (long long)(a4), \ - (long long)(a5)) -#define __sanitizer_syscall_post_compat_10_osemsys(res, which, a2, a3, a4, a5) \ - __sanitizer_syscall_post_impl_compat_10_osemsys( \ - res, (long long)(which), (long long)(a2), (long long)(a3), \ - (long long)(a4), (long long)(a5)) -#else -/* syscall 169 has been skipped */ -#endif -#if !defined(_LP64) -#define __sanitizer_syscall_pre_compat_10_omsgsys(which, a2, a3, a4, a5, a6) \ - __sanitizer_syscall_pre_impl_compat_10_omsgsys( \ - (long long)(which), (long long)(a2), (long long)(a3), (long long)(a4), \ - (long long)(a5), (long long)(a6)) -#define __sanitizer_syscall_post_compat_10_omsgsys(res, which, a2, a3, a4, a5, \ - a6) \ - __sanitizer_syscall_post_impl_compat_10_omsgsys( \ - res, (long long)(which), (long long)(a2), (long long)(a3), \ - (long long)(a4), (long long)(a5), (long long)(a6)) -#else -/* syscall 170 has been skipped */ -#endif -#if !defined(_LP64) -#define __sanitizer_syscall_pre_compat_10_oshmsys(which, a2, a3, a4) \ - __sanitizer_syscall_pre_impl_compat_10_oshmsys( \ - (long long)(which), (long long)(a2), (long long)(a3), (long long)(a4)) -#define __sanitizer_syscall_post_compat_10_oshmsys(res, which, a2, a3, a4) \ - __sanitizer_syscall_post_impl_compat_10_oshmsys( \ - res, (long long)(which), (long long)(a2), (long long)(a3), \ - (long long)(a4)) -#else -/* syscall 171 has been skipped */ -#endif -/* syscall 172 has been skipped */ -#define __sanitizer_syscall_pre_pread(fd, buf, nbyte, PAD, offset) \ - __sanitizer_syscall_pre_impl_pread((long long)(fd), (long long)(buf), \ - (long long)(nbyte), (long long)(PAD), \ - (long long)(offset)) -#define __sanitizer_syscall_post_pread(res, fd, buf, nbyte, PAD, offset) \ - __sanitizer_syscall_post_impl_pread(res, (long long)(fd), (long long)(buf), \ - (long long)(nbyte), (long long)(PAD), \ - (long long)(offset)) -#define __sanitizer_syscall_pre_pwrite(fd, buf, nbyte, PAD, offset) \ - __sanitizer_syscall_pre_impl_pwrite((long long)(fd), (long long)(buf), \ - (long long)(nbyte), (long long)(PAD), \ - (long long)(offset)) -#define __sanitizer_syscall_post_pwrite(res, fd, buf, nbyte, PAD, offset) \ - __sanitizer_syscall_post_impl_pwrite(res, (long long)(fd), (long long)(buf), \ - (long long)(nbyte), (long long)(PAD), \ - (long long)(offset)) -#define __sanitizer_syscall_pre_compat_30_ntp_gettime(ntvp) \ - __sanitizer_syscall_pre_impl_compat_30_ntp_gettime((long long)(ntvp)) -#define __sanitizer_syscall_post_compat_30_ntp_gettime(res, ntvp) \ - __sanitizer_syscall_post_impl_compat_30_ntp_gettime(res, (long long)(ntvp)) -#if defined(NTP) || !defined(_KERNEL_OPT) -#define __sanitizer_syscall_pre_ntp_adjtime(tp) \ - __sanitizer_syscall_pre_impl_ntp_adjtime((long long)(tp)) -#define __sanitizer_syscall_post_ntp_adjtime(res, tp) \ - __sanitizer_syscall_post_impl_ntp_adjtime(res, (long long)(tp)) -#else -/* syscall 176 has been skipped */ -#endif -/* syscall 177 has been skipped */ -/* syscall 178 has been skipped */ -/* syscall 179 has been skipped */ -/* syscall 180 has been skipped */ -#define __sanitizer_syscall_pre_setgid(gid) \ - __sanitizer_syscall_pre_impl_setgid((long long)(gid)) -#define __sanitizer_syscall_post_setgid(res, gid) \ - __sanitizer_syscall_post_impl_setgid(res, (long long)(gid)) -#define __sanitizer_syscall_pre_setegid(egid) \ - __sanitizer_syscall_pre_impl_setegid((long long)(egid)) -#define __sanitizer_syscall_post_setegid(res, egid) \ - __sanitizer_syscall_post_impl_setegid(res, (long long)(egid)) -#define __sanitizer_syscall_pre_seteuid(euid) \ - __sanitizer_syscall_pre_impl_seteuid((long long)(euid)) -#define __sanitizer_syscall_post_seteuid(res, euid) \ - __sanitizer_syscall_post_impl_seteuid(res, (long long)(euid)) -#define __sanitizer_syscall_pre_lfs_bmapv(fsidp, blkiov, blkcnt) \ - __sanitizer_syscall_pre_impl_lfs_bmapv( \ - (long long)(fsidp), (long long)(blkiov), (long long)(blkcnt)) -#define __sanitizer_syscall_post_lfs_bmapv(res, fsidp, blkiov, blkcnt) \ - __sanitizer_syscall_post_impl_lfs_bmapv( \ - res, (long long)(fsidp), (long long)(blkiov), (long long)(blkcnt)) -#define __sanitizer_syscall_pre_lfs_markv(fsidp, blkiov, blkcnt) \ - __sanitizer_syscall_pre_impl_lfs_markv( \ - (long long)(fsidp), (long long)(blkiov), (long long)(blkcnt)) -#define __sanitizer_syscall_post_lfs_markv(res, fsidp, blkiov, blkcnt) \ - __sanitizer_syscall_post_impl_lfs_markv( \ - res, (long long)(fsidp), (long long)(blkiov), (long long)(blkcnt)) -#define __sanitizer_syscall_pre_lfs_segclean(fsidp, segment) \ - __sanitizer_syscall_pre_impl_lfs_segclean((long long)(fsidp), \ - (long long)(segment)) -#define __sanitizer_syscall_post_lfs_segclean(res, fsidp, segment) \ - __sanitizer_syscall_post_impl_lfs_segclean(res, (long long)(fsidp), \ - (long long)(segment)) -#define __sanitizer_syscall_pre_compat_50_lfs_segwait(fsidp, tv) \ - __sanitizer_syscall_pre_impl_compat_50_lfs_segwait((long long)(fsidp), \ - (long long)(tv)) -#define __sanitizer_syscall_post_compat_50_lfs_segwait(res, fsidp, tv) \ - __sanitizer_syscall_post_impl_compat_50_lfs_segwait(res, (long long)(fsidp), \ - (long long)(tv)) -#define __sanitizer_syscall_pre_compat_12_stat12(path, ub) \ - __sanitizer_syscall_pre_impl_compat_12_stat12((long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_post_compat_12_stat12(res, path, ub) \ - __sanitizer_syscall_post_impl_compat_12_stat12(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre_compat_12_fstat12(fd, sb) \ - __sanitizer_syscall_pre_impl_compat_12_fstat12((long long)(fd), \ - (long long)(sb)) -#define __sanitizer_syscall_post_compat_12_fstat12(res, fd, sb) \ - __sanitizer_syscall_post_impl_compat_12_fstat12(res, (long long)(fd), \ - (long long)(sb)) -#define __sanitizer_syscall_pre_compat_12_lstat12(path, ub) \ - __sanitizer_syscall_pre_impl_compat_12_lstat12((long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_post_compat_12_lstat12(res, path, ub) \ - __sanitizer_syscall_post_impl_compat_12_lstat12(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre_pathconf(path, name) \ - __sanitizer_syscall_pre_impl_pathconf((long long)(path), (long long)(name)) -#define __sanitizer_syscall_post_pathconf(res, path, name) \ - __sanitizer_syscall_post_impl_pathconf(res, (long long)(path), \ - (long long)(name)) -#define __sanitizer_syscall_pre_fpathconf(fd, name) \ - __sanitizer_syscall_pre_impl_fpathconf((long long)(fd), (long long)(name)) -#define __sanitizer_syscall_post_fpathconf(res, fd, name) \ - __sanitizer_syscall_post_impl_fpathconf(res, (long long)(fd), \ - (long long)(name)) -#define __sanitizer_syscall_pre_getsockopt2(s, level, name, val, avalsize) \ - __sanitizer_syscall_pre_impl_getsockopt2( \ - (long long)(s), (long long)(level), (long long)(name), (long long)(val), \ - (long long)(avalsize)) -#define __sanitizer_syscall_post_getsockopt2(res, s, level, name, val, \ - avalsize) \ - __sanitizer_syscall_post_impl_getsockopt2( \ - res, (long long)(s), (long long)(level), (long long)(name), \ - (long long)(val), (long long)(avalsize)) -#define __sanitizer_syscall_pre_getrlimit(which, rlp) \ - __sanitizer_syscall_pre_impl_getrlimit((long long)(which), (long long)(rlp)) -#define __sanitizer_syscall_post_getrlimit(res, which, rlp) \ - __sanitizer_syscall_post_impl_getrlimit(res, (long long)(which), \ - (long long)(rlp)) -#define __sanitizer_syscall_pre_setrlimit(which, rlp) \ - __sanitizer_syscall_pre_impl_setrlimit((long long)(which), (long long)(rlp)) -#define __sanitizer_syscall_post_setrlimit(res, which, rlp) \ - __sanitizer_syscall_post_impl_setrlimit(res, (long long)(which), \ - (long long)(rlp)) -#define __sanitizer_syscall_pre_compat_12_getdirentries(fd, buf, count, basep) \ - __sanitizer_syscall_pre_impl_compat_12_getdirentries( \ - (long long)(fd), (long long)(buf), (long long)(count), \ - (long long)(basep)) -#define __sanitizer_syscall_post_compat_12_getdirentries(res, fd, buf, count, \ - basep) \ - __sanitizer_syscall_post_impl_compat_12_getdirentries( \ - res, (long long)(fd), (long long)(buf), (long long)(count), \ - (long long)(basep)) -#define __sanitizer_syscall_pre_mmap(addr, len, prot, flags, fd, PAD, pos) \ - __sanitizer_syscall_pre_impl_mmap( \ - (long long)(addr), (long long)(len), (long long)(prot), \ - (long long)(flags), (long long)(fd), (long long)(PAD), (long long)(pos)) -#define __sanitizer_syscall_post_mmap(res, addr, len, prot, flags, fd, PAD, \ - pos) \ - __sanitizer_syscall_post_impl_mmap( \ - res, (long long)(addr), (long long)(len), (long long)(prot), \ - (long long)(flags), (long long)(fd), (long long)(PAD), (long long)(pos)) -#define __sanitizer_syscall_pre___syscall(code, arg0, arg1, arg2, arg3, arg4, \ - arg5, arg6, arg7) \ - __sanitizer_syscall_pre_impl___syscall( \ - (long long)(code), (long long)(arg0), (long long)(arg1), \ - (long long)(arg2), (long long)(arg3), (long long)(arg4), \ - (long long)(arg5), (long long)(arg6), (long long)(arg7)) -#define __sanitizer_syscall_post___syscall(res, code, arg0, arg1, arg2, arg3, \ - arg4, arg5, arg6, arg7) \ - __sanitizer_syscall_post_impl___syscall( \ - res, (long long)(code), (long long)(arg0), (long long)(arg1), \ - (long long)(arg2), (long long)(arg3), (long long)(arg4), \ - (long long)(arg5), (long long)(arg6), (long long)(arg7)) -#define __sanitizer_syscall_pre_lseek(fd, PAD, offset, whence) \ - __sanitizer_syscall_pre_impl_lseek((long long)(fd), (long long)(PAD), \ - (long long)(offset), (long long)(whence)) -#define __sanitizer_syscall_post_lseek(res, fd, PAD, offset, whence) \ - __sanitizer_syscall_post_impl_lseek(res, (long long)(fd), (long long)(PAD), \ - (long long)(offset), \ - (long long)(whence)) -#define __sanitizer_syscall_pre_truncate(path, PAD, length) \ - __sanitizer_syscall_pre_impl_truncate((long long)(path), (long long)(PAD), \ - (long long)(length)) -#define __sanitizer_syscall_post_truncate(res, path, PAD, length) \ - __sanitizer_syscall_post_impl_truncate( \ - res, (long long)(path), (long long)(PAD), (long long)(length)) -#define __sanitizer_syscall_pre_ftruncate(fd, PAD, length) \ - __sanitizer_syscall_pre_impl_ftruncate((long long)(fd), (long long)(PAD), \ - (long long)(length)) -#define __sanitizer_syscall_post_ftruncate(res, fd, PAD, length) \ - __sanitizer_syscall_post_impl_ftruncate( \ - res, (long long)(fd), (long long)(PAD), (long long)(length)) -#define __sanitizer_syscall_pre___sysctl(name, namelen, oldv, oldlenp, newv, \ - newlen) \ - __sanitizer_syscall_pre_impl___sysctl( \ - (long long)(name), (long long)(namelen), (long long)(oldv), \ - (long long)(oldlenp), (long long)(newv), (long long)(newlen)) -#define __sanitizer_syscall_post___sysctl(res, name, namelen, oldv, oldlenp, \ - newv, newlen) \ - __sanitizer_syscall_post_impl___sysctl( \ - res, (long long)(name), (long long)(namelen), (long long)(oldv), \ - (long long)(oldlenp), (long long)(newv), (long long)(newlen)) -#define __sanitizer_syscall_pre_mlock(addr, len) \ - __sanitizer_syscall_pre_impl_mlock((long long)(addr), (long long)(len)) -#define __sanitizer_syscall_post_mlock(res, addr, len) \ - __sanitizer_syscall_post_impl_mlock(res, (long long)(addr), (long long)(len)) -#define __sanitizer_syscall_pre_munlock(addr, len) \ - __sanitizer_syscall_pre_impl_munlock((long long)(addr), (long long)(len)) -#define __sanitizer_syscall_post_munlock(res, addr, len) \ - __sanitizer_syscall_post_impl_munlock(res, (long long)(addr), \ - (long long)(len)) -#define __sanitizer_syscall_pre_undelete(path) \ - __sanitizer_syscall_pre_impl_undelete((long long)(path)) -#define __sanitizer_syscall_post_undelete(res, path) \ - __sanitizer_syscall_post_impl_undelete(res, (long long)(path)) -#define __sanitizer_syscall_pre_compat_50_futimes(fd, tptr) \ - __sanitizer_syscall_pre_impl_compat_50_futimes((long long)(fd), \ - (long long)(tptr)) -#define __sanitizer_syscall_post_compat_50_futimes(res, fd, tptr) \ - __sanitizer_syscall_post_impl_compat_50_futimes(res, (long long)(fd), \ - (long long)(tptr)) -#define __sanitizer_syscall_pre_getpgid(pid) \ - __sanitizer_syscall_pre_impl_getpgid((long long)(pid)) -#define __sanitizer_syscall_post_getpgid(res, pid) \ - __sanitizer_syscall_post_impl_getpgid(res, (long long)(pid)) -#define __sanitizer_syscall_pre_reboot(opt, bootstr) \ - __sanitizer_syscall_pre_impl_reboot((long long)(opt), (long long)(bootstr)) -#define __sanitizer_syscall_post_reboot(res, opt, bootstr) \ - __sanitizer_syscall_post_impl_reboot(res, (long long)(opt), \ - (long long)(bootstr)) -#define __sanitizer_syscall_pre_poll(fds, nfds, timeout) \ - __sanitizer_syscall_pre_impl_poll((long long)(fds), (long long)(nfds), \ - (long long)(timeout)) -#define __sanitizer_syscall_post_poll(res, fds, nfds, timeout) \ - __sanitizer_syscall_post_impl_poll(res, (long long)(fds), (long long)(nfds), \ - (long long)(timeout)) -#define __sanitizer_syscall_pre_afssys(id, a1, a2, a3, a4, a5, a6) \ - __sanitizer_syscall_pre_impl_afssys( \ - (long long)(id), (long long)(a1), (long long)(a2), (long long)(a3), \ - (long long)(a4), (long long)(a5), (long long)(a6)) -#define __sanitizer_syscall_post_afssys(res, id, a1, a2, a3, a4, a5, a6) \ - __sanitizer_syscall_post_impl_afssys( \ - res, (long long)(id), (long long)(a1), (long long)(a2), (long long)(a3), \ - (long long)(a4), (long long)(a5), (long long)(a6)) -/* syscall 211 has been skipped */ -/* syscall 212 has been skipped */ -/* syscall 213 has been skipped */ -/* syscall 214 has been skipped */ -/* syscall 215 has been skipped */ -/* syscall 216 has been skipped */ -/* syscall 217 has been skipped */ -/* syscall 218 has been skipped */ -/* syscall 219 has been skipped */ -#define __sanitizer_syscall_pre_compat_14___semctl(semid, semnum, cmd, arg) \ - __sanitizer_syscall_pre_impl_compat_14___semctl( \ - (long long)(semid), (long long)(semnum), (long long)(cmd), \ - (long long)(arg)) -#define __sanitizer_syscall_post_compat_14___semctl(res, semid, semnum, cmd, \ - arg) \ - __sanitizer_syscall_post_impl_compat_14___semctl( \ - res, (long long)(semid), (long long)(semnum), (long long)(cmd), \ - (long long)(arg)) -#define __sanitizer_syscall_pre_semget(key, nsems, semflg) \ - __sanitizer_syscall_pre_impl_semget((long long)(key), (long long)(nsems), \ - (long long)(semflg)) -#define __sanitizer_syscall_post_semget(res, key, nsems, semflg) \ - __sanitizer_syscall_post_impl_semget( \ - res, (long long)(key), (long long)(nsems), (long long)(semflg)) -#define __sanitizer_syscall_pre_semop(semid, sops, nsops) \ - __sanitizer_syscall_pre_impl_semop((long long)(semid), (long long)(sops), \ - (long long)(nsops)) -#define __sanitizer_syscall_post_semop(res, semid, sops, nsops) \ - __sanitizer_syscall_post_impl_semop(res, (long long)(semid), \ - (long long)(sops), (long long)(nsops)) -#define __sanitizer_syscall_pre_semconfig(flag) \ - __sanitizer_syscall_pre_impl_semconfig((long long)(flag)) -#define __sanitizer_syscall_post_semconfig(res, flag) \ - __sanitizer_syscall_post_impl_semconfig(res, (long long)(flag)) -#define __sanitizer_syscall_pre_compat_14_msgctl(msqid, cmd, buf) \ - __sanitizer_syscall_pre_impl_compat_14_msgctl( \ - (long long)(msqid), (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_post_compat_14_msgctl(res, msqid, cmd, buf) \ - __sanitizer_syscall_post_impl_compat_14_msgctl( \ - res, (long long)(msqid), (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_pre_msgget(key, msgflg) \ - __sanitizer_syscall_pre_impl_msgget((long long)(key), (long long)(msgflg)) -#define __sanitizer_syscall_post_msgget(res, key, msgflg) \ - __sanitizer_syscall_post_impl_msgget(res, (long long)(key), \ - (long long)(msgflg)) -#define __sanitizer_syscall_pre_msgsnd(msqid, msgp, msgsz, msgflg) \ - __sanitizer_syscall_pre_impl_msgsnd((long long)(msqid), (long long)(msgp), \ - (long long)(msgsz), (long long)(msgflg)) -#define __sanitizer_syscall_post_msgsnd(res, msqid, msgp, msgsz, msgflg) \ - __sanitizer_syscall_post_impl_msgsnd(res, (long long)(msqid), \ - (long long)(msgp), (long long)(msgsz), \ - (long long)(msgflg)) -#define __sanitizer_syscall_pre_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg) \ - __sanitizer_syscall_pre_impl_msgrcv((long long)(msqid), (long long)(msgp), \ - (long long)(msgsz), (long long)(msgtyp), \ - (long long)(msgflg)) -#define __sanitizer_syscall_post_msgrcv(res, msqid, msgp, msgsz, msgtyp, \ - msgflg) \ - __sanitizer_syscall_post_impl_msgrcv( \ - res, (long long)(msqid), (long long)(msgp), (long long)(msgsz), \ - (long long)(msgtyp), (long long)(msgflg)) -#define __sanitizer_syscall_pre_shmat(shmid, shmaddr, shmflg) \ - __sanitizer_syscall_pre_impl_shmat((long long)(shmid), (long long)(shmaddr), \ - (long long)(shmflg)) -#define __sanitizer_syscall_post_shmat(res, shmid, shmaddr, shmflg) \ - __sanitizer_syscall_post_impl_shmat( \ - res, (long long)(shmid), (long long)(shmaddr), (long long)(shmflg)) -#define __sanitizer_syscall_pre_compat_14_shmctl(shmid, cmd, buf) \ - __sanitizer_syscall_pre_impl_compat_14_shmctl( \ - (long long)(shmid), (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_post_compat_14_shmctl(res, shmid, cmd, buf) \ - __sanitizer_syscall_post_impl_compat_14_shmctl( \ - res, (long long)(shmid), (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_pre_shmdt(shmaddr) \ - __sanitizer_syscall_pre_impl_shmdt((long long)(shmaddr)) -#define __sanitizer_syscall_post_shmdt(res, shmaddr) \ - __sanitizer_syscall_post_impl_shmdt(res, (long long)(shmaddr)) -#define __sanitizer_syscall_pre_shmget(key, size, shmflg) \ - __sanitizer_syscall_pre_impl_shmget((long long)(key), (long long)(size), \ - (long long)(shmflg)) -#define __sanitizer_syscall_post_shmget(res, key, size, shmflg) \ - __sanitizer_syscall_post_impl_shmget(res, (long long)(key), \ - (long long)(size), (long long)(shmflg)) -#define __sanitizer_syscall_pre_compat_50_clock_gettime(clock_id, tp) \ - __sanitizer_syscall_pre_impl_compat_50_clock_gettime((long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_post_compat_50_clock_gettime(res, clock_id, tp) \ - __sanitizer_syscall_post_impl_compat_50_clock_gettime( \ - res, (long long)(clock_id), (long long)(tp)) -#define __sanitizer_syscall_pre_compat_50_clock_settime(clock_id, tp) \ - __sanitizer_syscall_pre_impl_compat_50_clock_settime((long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_post_compat_50_clock_settime(res, clock_id, tp) \ - __sanitizer_syscall_post_impl_compat_50_clock_settime( \ - res, (long long)(clock_id), (long long)(tp)) -#define __sanitizer_syscall_pre_compat_50_clock_getres(clock_id, tp) \ - __sanitizer_syscall_pre_impl_compat_50_clock_getres((long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_post_compat_50_clock_getres(res, clock_id, tp) \ - __sanitizer_syscall_post_impl_compat_50_clock_getres( \ - res, (long long)(clock_id), (long long)(tp)) -#define __sanitizer_syscall_pre_timer_create(clock_id, evp, timerid) \ - __sanitizer_syscall_pre_impl_timer_create( \ - (long long)(clock_id), (long long)(evp), (long long)(timerid)) -#define __sanitizer_syscall_post_timer_create(res, clock_id, evp, timerid) \ - __sanitizer_syscall_post_impl_timer_create( \ - res, (long long)(clock_id), (long long)(evp), (long long)(timerid)) -#define __sanitizer_syscall_pre_timer_delete(timerid) \ - __sanitizer_syscall_pre_impl_timer_delete((long long)(timerid)) -#define __sanitizer_syscall_post_timer_delete(res, timerid) \ - __sanitizer_syscall_post_impl_timer_delete(res, (long long)(timerid)) -#define __sanitizer_syscall_pre_compat_50_timer_settime(timerid, flags, value, \ - ovalue) \ - __sanitizer_syscall_pre_impl_compat_50_timer_settime( \ - (long long)(timerid), (long long)(flags), (long long)(value), \ - (long long)(ovalue)) -#define __sanitizer_syscall_post_compat_50_timer_settime(res, timerid, flags, \ - value, ovalue) \ - __sanitizer_syscall_post_impl_compat_50_timer_settime( \ - res, (long long)(timerid), (long long)(flags), (long long)(value), \ - (long long)(ovalue)) -#define __sanitizer_syscall_pre_compat_50_timer_gettime(timerid, value) \ - __sanitizer_syscall_pre_impl_compat_50_timer_gettime((long long)(timerid), \ - (long long)(value)) -#define __sanitizer_syscall_post_compat_50_timer_gettime(res, timerid, value) \ - __sanitizer_syscall_post_impl_compat_50_timer_gettime( \ - res, (long long)(timerid), (long long)(value)) -#define __sanitizer_syscall_pre_timer_getoverrun(timerid) \ - __sanitizer_syscall_pre_impl_timer_getoverrun((long long)(timerid)) -#define __sanitizer_syscall_post_timer_getoverrun(res, timerid) \ - __sanitizer_syscall_post_impl_timer_getoverrun(res, (long long)(timerid)) -#define __sanitizer_syscall_pre_compat_50_nanosleep(rqtp, rmtp) \ - __sanitizer_syscall_pre_impl_compat_50_nanosleep((long long)(rqtp), \ - (long long)(rmtp)) -#define __sanitizer_syscall_post_compat_50_nanosleep(res, rqtp, rmtp) \ - __sanitizer_syscall_post_impl_compat_50_nanosleep(res, (long long)(rqtp), \ - (long long)(rmtp)) -#define __sanitizer_syscall_pre_fdatasync(fd) \ - __sanitizer_syscall_pre_impl_fdatasync((long long)(fd)) -#define __sanitizer_syscall_post_fdatasync(res, fd) \ - __sanitizer_syscall_post_impl_fdatasync(res, (long long)(fd)) -#define __sanitizer_syscall_pre_mlockall(flags) \ - __sanitizer_syscall_pre_impl_mlockall((long long)(flags)) -#define __sanitizer_syscall_post_mlockall(res, flags) \ - __sanitizer_syscall_post_impl_mlockall(res, (long long)(flags)) -#define __sanitizer_syscall_pre_munlockall() \ - __sanitizer_syscall_pre_impl_munlockall() -#define __sanitizer_syscall_post_munlockall(res) \ - __sanitizer_syscall_post_impl_munlockall(res) -#define __sanitizer_syscall_pre_compat_50___sigtimedwait(set, info, timeout) \ - __sanitizer_syscall_pre_impl_compat_50___sigtimedwait( \ - (long long)(set), (long long)(info), (long long)(timeout)) -#define __sanitizer_syscall_post_compat_50___sigtimedwait(res, set, info, \ - timeout) \ - __sanitizer_syscall_post_impl_compat_50___sigtimedwait( \ - res, (long long)(set), (long long)(info), (long long)(timeout)) -#define __sanitizer_syscall_pre_sigqueueinfo(pid, info) \ - __sanitizer_syscall_pre_impl_sigqueueinfo((long long)(pid), (long long)(info)) -#define __sanitizer_syscall_post_sigqueueinfo(res, pid, info) \ - __sanitizer_syscall_post_impl_sigqueueinfo(res, (long long)(pid), \ - (long long)(info)) -#define __sanitizer_syscall_pre_modctl(cmd, arg) \ - __sanitizer_syscall_pre_impl_modctl((long long)(cmd), (long long)(arg)) -#define __sanitizer_syscall_post_modctl(res, cmd, arg) \ - __sanitizer_syscall_post_impl_modctl(res, (long long)(cmd), (long long)(arg)) -#define __sanitizer_syscall_pre__ksem_init(value, idp) \ - __sanitizer_syscall_pre_impl__ksem_init((long long)(value), (long long)(idp)) -#define __sanitizer_syscall_post__ksem_init(res, value, idp) \ - __sanitizer_syscall_post_impl__ksem_init(res, (long long)(value), \ - (long long)(idp)) -#define __sanitizer_syscall_pre__ksem_open(name, oflag, mode, value, idp) \ - __sanitizer_syscall_pre_impl__ksem_open( \ - (long long)(name), (long long)(oflag), (long long)(mode), \ - (long long)(value), (long long)(idp)) -#define __sanitizer_syscall_post__ksem_open(res, name, oflag, mode, value, \ - idp) \ - __sanitizer_syscall_post_impl__ksem_open( \ - res, (long long)(name), (long long)(oflag), (long long)(mode), \ - (long long)(value), (long long)(idp)) -#define __sanitizer_syscall_pre__ksem_unlink(name) \ - __sanitizer_syscall_pre_impl__ksem_unlink((long long)(name)) -#define __sanitizer_syscall_post__ksem_unlink(res, name) \ - __sanitizer_syscall_post_impl__ksem_unlink(res, (long long)(name)) -#define __sanitizer_syscall_pre__ksem_close(id) \ - __sanitizer_syscall_pre_impl__ksem_close((long long)(id)) -#define __sanitizer_syscall_post__ksem_close(res, id) \ - __sanitizer_syscall_post_impl__ksem_close(res, (long long)(id)) -#define __sanitizer_syscall_pre__ksem_post(id) \ - __sanitizer_syscall_pre_impl__ksem_post((long long)(id)) -#define __sanitizer_syscall_post__ksem_post(res, id) \ - __sanitizer_syscall_post_impl__ksem_post(res, (long long)(id)) -#define __sanitizer_syscall_pre__ksem_wait(id) \ - __sanitizer_syscall_pre_impl__ksem_wait((long long)(id)) -#define __sanitizer_syscall_post__ksem_wait(res, id) \ - __sanitizer_syscall_post_impl__ksem_wait(res, (long long)(id)) -#define __sanitizer_syscall_pre__ksem_trywait(id) \ - __sanitizer_syscall_pre_impl__ksem_trywait((long long)(id)) -#define __sanitizer_syscall_post__ksem_trywait(res, id) \ - __sanitizer_syscall_post_impl__ksem_trywait(res, (long long)(id)) -#define __sanitizer_syscall_pre__ksem_getvalue(id, value) \ - __sanitizer_syscall_pre_impl__ksem_getvalue((long long)(id), \ - (long long)(value)) -#define __sanitizer_syscall_post__ksem_getvalue(res, id, value) \ - __sanitizer_syscall_post_impl__ksem_getvalue(res, (long long)(id), \ - (long long)(value)) -#define __sanitizer_syscall_pre__ksem_destroy(id) \ - __sanitizer_syscall_pre_impl__ksem_destroy((long long)(id)) -#define __sanitizer_syscall_post__ksem_destroy(res, id) \ - __sanitizer_syscall_post_impl__ksem_destroy(res, (long long)(id)) -#define __sanitizer_syscall_pre__ksem_timedwait(id, abstime) \ - __sanitizer_syscall_pre_impl__ksem_timedwait((long long)(id), \ - (long long)(abstime)) -#define __sanitizer_syscall_post__ksem_timedwait(res, id, abstime) \ - __sanitizer_syscall_post_impl__ksem_timedwait(res, (long long)(id), \ - (long long)(abstime)) -#define __sanitizer_syscall_pre_mq_open(name, oflag, mode, attr) \ - __sanitizer_syscall_pre_impl_mq_open((long long)(name), (long long)(oflag), \ - (long long)(mode), (long long)(attr)) -#define __sanitizer_syscall_post_mq_open(res, name, oflag, mode, attr) \ - __sanitizer_syscall_post_impl_mq_open(res, (long long)(name), \ - (long long)(oflag), (long long)(mode), \ - (long long)(attr)) -#define __sanitizer_syscall_pre_mq_close(mqdes) \ - __sanitizer_syscall_pre_impl_mq_close((long long)(mqdes)) -#define __sanitizer_syscall_post_mq_close(res, mqdes) \ - __sanitizer_syscall_post_impl_mq_close(res, (long long)(mqdes)) -#define __sanitizer_syscall_pre_mq_unlink(name) \ - __sanitizer_syscall_pre_impl_mq_unlink((long long)(name)) -#define __sanitizer_syscall_post_mq_unlink(res, name) \ - __sanitizer_syscall_post_impl_mq_unlink(res, (long long)(name)) -#define __sanitizer_syscall_pre_mq_getattr(mqdes, mqstat) \ - __sanitizer_syscall_pre_impl_mq_getattr((long long)(mqdes), \ - (long long)(mqstat)) -#define __sanitizer_syscall_post_mq_getattr(res, mqdes, mqstat) \ - __sanitizer_syscall_post_impl_mq_getattr(res, (long long)(mqdes), \ - (long long)(mqstat)) -#define __sanitizer_syscall_pre_mq_setattr(mqdes, mqstat, omqstat) \ - __sanitizer_syscall_pre_impl_mq_setattr( \ - (long long)(mqdes), (long long)(mqstat), (long long)(omqstat)) -#define __sanitizer_syscall_post_mq_setattr(res, mqdes, mqstat, omqstat) \ - __sanitizer_syscall_post_impl_mq_setattr( \ - res, (long long)(mqdes), (long long)(mqstat), (long long)(omqstat)) -#define __sanitizer_syscall_pre_mq_notify(mqdes, notification) \ - __sanitizer_syscall_pre_impl_mq_notify((long long)(mqdes), \ - (long long)(notification)) -#define __sanitizer_syscall_post_mq_notify(res, mqdes, notification) \ - __sanitizer_syscall_post_impl_mq_notify(res, (long long)(mqdes), \ - (long long)(notification)) -#define __sanitizer_syscall_pre_mq_send(mqdes, msg_ptr, msg_len, msg_prio) \ - __sanitizer_syscall_pre_impl_mq_send( \ - (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio)) -#define __sanitizer_syscall_post_mq_send(res, mqdes, msg_ptr, msg_len, \ - msg_prio) \ - __sanitizer_syscall_post_impl_mq_send( \ - res, (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio)) -#define __sanitizer_syscall_pre_mq_receive(mqdes, msg_ptr, msg_len, msg_prio) \ - __sanitizer_syscall_pre_impl_mq_receive( \ - (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio)) -#define __sanitizer_syscall_post_mq_receive(res, mqdes, msg_ptr, msg_len, \ - msg_prio) \ - __sanitizer_syscall_post_impl_mq_receive( \ - res, (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio)) -#define __sanitizer_syscall_pre_compat_50_mq_timedsend( \ - mqdes, msg_ptr, msg_len, msg_prio, abs_timeout) \ - __sanitizer_syscall_pre_impl_compat_50_mq_timedsend( \ - (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio), (long long)(abs_timeout)) -#define __sanitizer_syscall_post_compat_50_mq_timedsend( \ - res, mqdes, msg_ptr, msg_len, msg_prio, abs_timeout) \ - __sanitizer_syscall_post_impl_compat_50_mq_timedsend( \ - res, (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio), (long long)(abs_timeout)) -#define __sanitizer_syscall_pre_compat_50_mq_timedreceive( \ - mqdes, msg_ptr, msg_len, msg_prio, abs_timeout) \ - __sanitizer_syscall_pre_impl_compat_50_mq_timedreceive( \ - (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio), (long long)(abs_timeout)) -#define __sanitizer_syscall_post_compat_50_mq_timedreceive( \ - res, mqdes, msg_ptr, msg_len, msg_prio, abs_timeout) \ - __sanitizer_syscall_post_impl_compat_50_mq_timedreceive( \ - res, (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio), (long long)(abs_timeout)) -/* syscall 267 has been skipped */ -/* syscall 268 has been skipped */ -/* syscall 269 has been skipped */ -#define __sanitizer_syscall_pre___posix_rename(from, to) \ - __sanitizer_syscall_pre_impl___posix_rename((long long)(from), \ - (long long)(to)) -#define __sanitizer_syscall_post___posix_rename(res, from, to) \ - __sanitizer_syscall_post_impl___posix_rename(res, (long long)(from), \ - (long long)(to)) -#define __sanitizer_syscall_pre_swapctl(cmd, arg, misc) \ - __sanitizer_syscall_pre_impl_swapctl((long long)(cmd), (long long)(arg), \ - (long long)(misc)) -#define __sanitizer_syscall_post_swapctl(res, cmd, arg, misc) \ - __sanitizer_syscall_post_impl_swapctl(res, (long long)(cmd), \ - (long long)(arg), (long long)(misc)) -#define __sanitizer_syscall_pre_compat_30_getdents(fd, buf, count) \ - __sanitizer_syscall_pre_impl_compat_30_getdents( \ - (long long)(fd), (long long)(buf), (long long)(count)) -#define __sanitizer_syscall_post_compat_30_getdents(res, fd, buf, count) \ - __sanitizer_syscall_post_impl_compat_30_getdents( \ - res, (long long)(fd), (long long)(buf), (long long)(count)) -#define __sanitizer_syscall_pre_minherit(addr, len, inherit) \ - __sanitizer_syscall_pre_impl_minherit((long long)(addr), (long long)(len), \ - (long long)(inherit)) -#define __sanitizer_syscall_post_minherit(res, addr, len, inherit) \ - __sanitizer_syscall_post_impl_minherit( \ - res, (long long)(addr), (long long)(len), (long long)(inherit)) -#define __sanitizer_syscall_pre_lchmod(path, mode) \ - __sanitizer_syscall_pre_impl_lchmod((long long)(path), (long long)(mode)) -#define __sanitizer_syscall_post_lchmod(res, path, mode) \ - __sanitizer_syscall_post_impl_lchmod(res, (long long)(path), \ - (long long)(mode)) -#define __sanitizer_syscall_pre_lchown(path, uid, gid) \ - __sanitizer_syscall_pre_impl_lchown((long long)(path), (long long)(uid), \ - (long long)(gid)) -#define __sanitizer_syscall_post_lchown(res, path, uid, gid) \ - __sanitizer_syscall_post_impl_lchown(res, (long long)(path), \ - (long long)(uid), (long long)(gid)) -#define __sanitizer_syscall_pre_compat_50_lutimes(path, tptr) \ - __sanitizer_syscall_pre_impl_compat_50_lutimes((long long)(path), \ - (long long)(tptr)) -#define __sanitizer_syscall_post_compat_50_lutimes(res, path, tptr) \ - __sanitizer_syscall_post_impl_compat_50_lutimes(res, (long long)(path), \ - (long long)(tptr)) -#define __sanitizer_syscall_pre___msync13(addr, len, flags) \ - __sanitizer_syscall_pre_impl___msync13((long long)(addr), (long long)(len), \ - (long long)(flags)) -#define __sanitizer_syscall_post___msync13(res, addr, len, flags) \ - __sanitizer_syscall_post_impl___msync13( \ - res, (long long)(addr), (long long)(len), (long long)(flags)) -#define __sanitizer_syscall_pre_compat_30___stat13(path, ub) \ - __sanitizer_syscall_pre_impl_compat_30___stat13((long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_post_compat_30___stat13(res, path, ub) \ - __sanitizer_syscall_post_impl_compat_30___stat13(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre_compat_30___fstat13(fd, sb) \ - __sanitizer_syscall_pre_impl_compat_30___fstat13((long long)(fd), \ - (long long)(sb)) -#define __sanitizer_syscall_post_compat_30___fstat13(res, fd, sb) \ - __sanitizer_syscall_post_impl_compat_30___fstat13(res, (long long)(fd), \ - (long long)(sb)) -#define __sanitizer_syscall_pre_compat_30___lstat13(path, ub) \ - __sanitizer_syscall_pre_impl_compat_30___lstat13((long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_post_compat_30___lstat13(res, path, ub) \ - __sanitizer_syscall_post_impl_compat_30___lstat13(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre___sigaltstack14(nss, oss) \ - __sanitizer_syscall_pre_impl___sigaltstack14((long long)(nss), \ - (long long)(oss)) -#define __sanitizer_syscall_post___sigaltstack14(res, nss, oss) \ - __sanitizer_syscall_post_impl___sigaltstack14(res, (long long)(nss), \ - (long long)(oss)) -#define __sanitizer_syscall_pre___vfork14() \ - __sanitizer_syscall_pre_impl___vfork14() -#define __sanitizer_syscall_post___vfork14(res) \ - __sanitizer_syscall_post_impl___vfork14(res) -#define __sanitizer_syscall_pre___posix_chown(path, uid, gid) \ - __sanitizer_syscall_pre_impl___posix_chown( \ - (long long)(path), (long long)(uid), (long long)(gid)) -#define __sanitizer_syscall_post___posix_chown(res, path, uid, gid) \ - __sanitizer_syscall_post_impl___posix_chown( \ - res, (long long)(path), (long long)(uid), (long long)(gid)) -#define __sanitizer_syscall_pre___posix_fchown(fd, uid, gid) \ - __sanitizer_syscall_pre_impl___posix_fchown( \ - (long long)(fd), (long long)(uid), (long long)(gid)) -#define __sanitizer_syscall_post___posix_fchown(res, fd, uid, gid) \ - __sanitizer_syscall_post_impl___posix_fchown( \ - res, (long long)(fd), (long long)(uid), (long long)(gid)) -#define __sanitizer_syscall_pre___posix_lchown(path, uid, gid) \ - __sanitizer_syscall_pre_impl___posix_lchown( \ - (long long)(path), (long long)(uid), (long long)(gid)) -#define __sanitizer_syscall_post___posix_lchown(res, path, uid, gid) \ - __sanitizer_syscall_post_impl___posix_lchown( \ - res, (long long)(path), (long long)(uid), (long long)(gid)) -#define __sanitizer_syscall_pre_getsid(pid) \ - __sanitizer_syscall_pre_impl_getsid((long long)(pid)) -#define __sanitizer_syscall_post_getsid(res, pid) \ - __sanitizer_syscall_post_impl_getsid(res, (long long)(pid)) -#define __sanitizer_syscall_pre___clone(flags, stack) \ - __sanitizer_syscall_pre_impl___clone((long long)(flags), (long long)(stack)) -#define __sanitizer_syscall_post___clone(res, flags, stack) \ - __sanitizer_syscall_post_impl___clone(res, (long long)(flags), \ - (long long)(stack)) -#define __sanitizer_syscall_pre_fktrace(fd, ops, facs, pid) \ - __sanitizer_syscall_pre_impl_fktrace((long long)(fd), (long long)(ops), \ - (long long)(facs), (long long)(pid)) -#define __sanitizer_syscall_post_fktrace(res, fd, ops, facs, pid) \ - __sanitizer_syscall_post_impl_fktrace(res, (long long)(fd), \ - (long long)(ops), (long long)(facs), \ - (long long)(pid)) -#define __sanitizer_syscall_pre_preadv(fd, iovp, iovcnt, PAD, offset) \ - __sanitizer_syscall_pre_impl_preadv((long long)(fd), (long long)(iovp), \ - (long long)(iovcnt), (long long)(PAD), \ - (long long)(offset)) -#define __sanitizer_syscall_post_preadv(res, fd, iovp, iovcnt, PAD, offset) \ - __sanitizer_syscall_post_impl_preadv(res, (long long)(fd), \ - (long long)(iovp), (long long)(iovcnt), \ - (long long)(PAD), (long long)(offset)) -#define __sanitizer_syscall_pre_pwritev(fd, iovp, iovcnt, PAD, offset) \ - __sanitizer_syscall_pre_impl_pwritev((long long)(fd), (long long)(iovp), \ - (long long)(iovcnt), (long long)(PAD), \ - (long long)(offset)) -#define __sanitizer_syscall_post_pwritev(res, fd, iovp, iovcnt, PAD, offset) \ - __sanitizer_syscall_post_impl_pwritev( \ - res, (long long)(fd), (long long)(iovp), (long long)(iovcnt), \ - (long long)(PAD), (long long)(offset)) -#define __sanitizer_syscall_pre_compat_16___sigaction14(signum, nsa, osa) \ - __sanitizer_syscall_pre_impl_compat_16___sigaction14( \ - (long long)(signum), (long long)(nsa), (long long)(osa)) -#define __sanitizer_syscall_post_compat_16___sigaction14(res, signum, nsa, \ - osa) \ - __sanitizer_syscall_post_impl_compat_16___sigaction14( \ - res, (long long)(signum), (long long)(nsa), (long long)(osa)) -#define __sanitizer_syscall_pre___sigpending14(set) \ - __sanitizer_syscall_pre_impl___sigpending14((long long)(set)) -#define __sanitizer_syscall_post___sigpending14(res, set) \ - __sanitizer_syscall_post_impl___sigpending14(res, (long long)(set)) -#define __sanitizer_syscall_pre___sigprocmask14(how, set, oset) \ - __sanitizer_syscall_pre_impl___sigprocmask14( \ - (long long)(how), (long long)(set), (long long)(oset)) -#define __sanitizer_syscall_post___sigprocmask14(res, how, set, oset) \ - __sanitizer_syscall_post_impl___sigprocmask14( \ - res, (long long)(how), (long long)(set), (long long)(oset)) -#define __sanitizer_syscall_pre___sigsuspend14(set) \ - __sanitizer_syscall_pre_impl___sigsuspend14((long long)(set)) -#define __sanitizer_syscall_post___sigsuspend14(res, set) \ - __sanitizer_syscall_post_impl___sigsuspend14(res, (long long)(set)) -#define __sanitizer_syscall_pre_compat_16___sigreturn14(sigcntxp) \ - __sanitizer_syscall_pre_impl_compat_16___sigreturn14((long long)(sigcntxp)) -#define __sanitizer_syscall_post_compat_16___sigreturn14(res, sigcntxp) \ - __sanitizer_syscall_post_impl_compat_16___sigreturn14(res, \ - (long long)(sigcntxp)) -#define __sanitizer_syscall_pre___getcwd(bufp, length) \ - __sanitizer_syscall_pre_impl___getcwd((long long)(bufp), (long long)(length)) -#define __sanitizer_syscall_post___getcwd(res, bufp, length) \ - __sanitizer_syscall_post_impl___getcwd(res, (long long)(bufp), \ - (long long)(length)) -#define __sanitizer_syscall_pre_fchroot(fd) \ - __sanitizer_syscall_pre_impl_fchroot((long long)(fd)) -#define __sanitizer_syscall_post_fchroot(res, fd) \ - __sanitizer_syscall_post_impl_fchroot(res, (long long)(fd)) -#define __sanitizer_syscall_pre_compat_30_fhopen(fhp, flags) \ - __sanitizer_syscall_pre_impl_compat_30_fhopen((long long)(fhp), \ - (long long)(flags)) -#define __sanitizer_syscall_post_compat_30_fhopen(res, fhp, flags) \ - __sanitizer_syscall_post_impl_compat_30_fhopen(res, (long long)(fhp), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_compat_30_fhstat(fhp, sb) \ - __sanitizer_syscall_pre_impl_compat_30_fhstat((long long)(fhp), \ - (long long)(sb)) -#define __sanitizer_syscall_post_compat_30_fhstat(res, fhp, sb) \ - __sanitizer_syscall_post_impl_compat_30_fhstat(res, (long long)(fhp), \ - (long long)(sb)) -#define __sanitizer_syscall_pre_compat_20_fhstatfs(fhp, buf) \ - __sanitizer_syscall_pre_impl_compat_20_fhstatfs((long long)(fhp), \ - (long long)(buf)) -#define __sanitizer_syscall_post_compat_20_fhstatfs(res, fhp, buf) \ - __sanitizer_syscall_post_impl_compat_20_fhstatfs(res, (long long)(fhp), \ - (long long)(buf)) -#define __sanitizer_syscall_pre_compat_50_____semctl13(semid, semnum, cmd, \ - arg) \ - __sanitizer_syscall_pre_impl_compat_50_____semctl13( \ - (long long)(semid), (long long)(semnum), (long long)(cmd), \ - (long long)(arg)) -#define __sanitizer_syscall_post_compat_50_____semctl13(res, semid, semnum, \ - cmd, arg) \ - __sanitizer_syscall_post_impl_compat_50_____semctl13( \ - res, (long long)(semid), (long long)(semnum), (long long)(cmd), \ - (long long)(arg)) -#define __sanitizer_syscall_pre_compat_50___msgctl13(msqid, cmd, buf) \ - __sanitizer_syscall_pre_impl_compat_50___msgctl13( \ - (long long)(msqid), (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_post_compat_50___msgctl13(res, msqid, cmd, buf) \ - __sanitizer_syscall_post_impl_compat_50___msgctl13( \ - res, (long long)(msqid), (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_pre_compat_50___shmctl13(shmid, cmd, buf) \ - __sanitizer_syscall_pre_impl_compat_50___shmctl13( \ - (long long)(shmid), (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_post_compat_50___shmctl13(res, shmid, cmd, buf) \ - __sanitizer_syscall_post_impl_compat_50___shmctl13( \ - res, (long long)(shmid), (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_pre_lchflags(path, flags) \ - __sanitizer_syscall_pre_impl_lchflags((long long)(path), (long long)(flags)) -#define __sanitizer_syscall_post_lchflags(res, path, flags) \ - __sanitizer_syscall_post_impl_lchflags(res, (long long)(path), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_issetugid() \ - __sanitizer_syscall_pre_impl_issetugid() -#define __sanitizer_syscall_post_issetugid(res) \ - __sanitizer_syscall_post_impl_issetugid(res) -#define __sanitizer_syscall_pre_utrace(label, addr, len) \ - __sanitizer_syscall_pre_impl_utrace((long long)(label), (long long)(addr), \ - (long long)(len)) -#define __sanitizer_syscall_post_utrace(res, label, addr, len) \ - __sanitizer_syscall_post_impl_utrace(res, (long long)(label), \ - (long long)(addr), (long long)(len)) -#define __sanitizer_syscall_pre_getcontext(ucp) \ - __sanitizer_syscall_pre_impl_getcontext((long long)(ucp)) -#define __sanitizer_syscall_post_getcontext(res, ucp) \ - __sanitizer_syscall_post_impl_getcontext(res, (long long)(ucp)) -#define __sanitizer_syscall_pre_setcontext(ucp) \ - __sanitizer_syscall_pre_impl_setcontext((long long)(ucp)) -#define __sanitizer_syscall_post_setcontext(res, ucp) \ - __sanitizer_syscall_post_impl_setcontext(res, (long long)(ucp)) -#define __sanitizer_syscall_pre__lwp_create(ucp, flags, new_lwp) \ - __sanitizer_syscall_pre_impl__lwp_create( \ - (long long)(ucp), (long long)(flags), (long long)(new_lwp)) -#define __sanitizer_syscall_post__lwp_create(res, ucp, flags, new_lwp) \ - __sanitizer_syscall_post_impl__lwp_create( \ - res, (long long)(ucp), (long long)(flags), (long long)(new_lwp)) -#define __sanitizer_syscall_pre__lwp_exit() \ - __sanitizer_syscall_pre_impl__lwp_exit() -#define __sanitizer_syscall_post__lwp_exit(res) \ - __sanitizer_syscall_post_impl__lwp_exit(res) -#define __sanitizer_syscall_pre__lwp_self() \ - __sanitizer_syscall_pre_impl__lwp_self() -#define __sanitizer_syscall_post__lwp_self(res) \ - __sanitizer_syscall_post_impl__lwp_self(res) -#define __sanitizer_syscall_pre__lwp_wait(wait_for, departed) \ - __sanitizer_syscall_pre_impl__lwp_wait((long long)(wait_for), \ - (long long)(departed)) -#define __sanitizer_syscall_post__lwp_wait(res, wait_for, departed) \ - __sanitizer_syscall_post_impl__lwp_wait(res, (long long)(wait_for), \ - (long long)(departed)) -#define __sanitizer_syscall_pre__lwp_suspend(target) \ - __sanitizer_syscall_pre_impl__lwp_suspend((long long)(target)) -#define __sanitizer_syscall_post__lwp_suspend(res, target) \ - __sanitizer_syscall_post_impl__lwp_suspend(res, (long long)(target)) -#define __sanitizer_syscall_pre__lwp_continue(target) \ - __sanitizer_syscall_pre_impl__lwp_continue((long long)(target)) -#define __sanitizer_syscall_post__lwp_continue(res, target) \ - __sanitizer_syscall_post_impl__lwp_continue(res, (long long)(target)) -#define __sanitizer_syscall_pre__lwp_wakeup(target) \ - __sanitizer_syscall_pre_impl__lwp_wakeup((long long)(target)) -#define __sanitizer_syscall_post__lwp_wakeup(res, target) \ - __sanitizer_syscall_post_impl__lwp_wakeup(res, (long long)(target)) -#define __sanitizer_syscall_pre__lwp_getprivate() \ - __sanitizer_syscall_pre_impl__lwp_getprivate() -#define __sanitizer_syscall_post__lwp_getprivate(res) \ - __sanitizer_syscall_post_impl__lwp_getprivate(res) -#define __sanitizer_syscall_pre__lwp_setprivate(ptr) \ - __sanitizer_syscall_pre_impl__lwp_setprivate((long long)(ptr)) -#define __sanitizer_syscall_post__lwp_setprivate(res, ptr) \ - __sanitizer_syscall_post_impl__lwp_setprivate(res, (long long)(ptr)) -#define __sanitizer_syscall_pre__lwp_kill(target, signo) \ - __sanitizer_syscall_pre_impl__lwp_kill((long long)(target), \ - (long long)(signo)) -#define __sanitizer_syscall_post__lwp_kill(res, target, signo) \ - __sanitizer_syscall_post_impl__lwp_kill(res, (long long)(target), \ - (long long)(signo)) -#define __sanitizer_syscall_pre__lwp_detach(target) \ - __sanitizer_syscall_pre_impl__lwp_detach((long long)(target)) -#define __sanitizer_syscall_post__lwp_detach(res, target) \ - __sanitizer_syscall_post_impl__lwp_detach(res, (long long)(target)) -#define __sanitizer_syscall_pre_compat_50__lwp_park(ts, unpark, hint, \ - unparkhint) \ - __sanitizer_syscall_pre_impl_compat_50__lwp_park( \ - (long long)(ts), (long long)(unpark), (long long)(hint), \ - (long long)(unparkhint)) -#define __sanitizer_syscall_post_compat_50__lwp_park(res, ts, unpark, hint, \ - unparkhint) \ - __sanitizer_syscall_post_impl_compat_50__lwp_park( \ - res, (long long)(ts), (long long)(unpark), (long long)(hint), \ - (long long)(unparkhint)) -#define __sanitizer_syscall_pre__lwp_unpark(target, hint) \ - __sanitizer_syscall_pre_impl__lwp_unpark((long long)(target), \ - (long long)(hint)) -#define __sanitizer_syscall_post__lwp_unpark(res, target, hint) \ - __sanitizer_syscall_post_impl__lwp_unpark(res, (long long)(target), \ - (long long)(hint)) -#define __sanitizer_syscall_pre__lwp_unpark_all(targets, ntargets, hint) \ - __sanitizer_syscall_pre_impl__lwp_unpark_all( \ - (long long)(targets), (long long)(ntargets), (long long)(hint)) -#define __sanitizer_syscall_post__lwp_unpark_all(res, targets, ntargets, hint) \ - __sanitizer_syscall_post_impl__lwp_unpark_all( \ - res, (long long)(targets), (long long)(ntargets), (long long)(hint)) -#define __sanitizer_syscall_pre__lwp_setname(target, name) \ - __sanitizer_syscall_pre_impl__lwp_setname((long long)(target), \ - (long long)(name)) -#define __sanitizer_syscall_post__lwp_setname(res, target, name) \ - __sanitizer_syscall_post_impl__lwp_setname(res, (long long)(target), \ - (long long)(name)) -#define __sanitizer_syscall_pre__lwp_getname(target, name, len) \ - __sanitizer_syscall_pre_impl__lwp_getname( \ - (long long)(target), (long long)(name), (long long)(len)) -#define __sanitizer_syscall_post__lwp_getname(res, target, name, len) \ - __sanitizer_syscall_post_impl__lwp_getname( \ - res, (long long)(target), (long long)(name), (long long)(len)) -#define __sanitizer_syscall_pre__lwp_ctl(features, address) \ - __sanitizer_syscall_pre_impl__lwp_ctl((long long)(features), \ - (long long)(address)) -#define __sanitizer_syscall_post__lwp_ctl(res, features, address) \ - __sanitizer_syscall_post_impl__lwp_ctl(res, (long long)(features), \ - (long long)(address)) -/* syscall 326 has been skipped */ -/* syscall 327 has been skipped */ -/* syscall 328 has been skipped */ -/* syscall 329 has been skipped */ -#define __sanitizer_syscall_pre_compat_60_sa_register(newv, oldv, flags, \ - stackinfo_offset) \ - __sanitizer_syscall_pre_impl_compat_60_sa_register( \ - (long long)(newv), (long long)(oldv), (long long)(flags), \ - (long long)(stackinfo_offset)) -#define __sanitizer_syscall_post_compat_60_sa_register(res, newv, oldv, flags, \ - stackinfo_offset) \ - __sanitizer_syscall_post_impl_compat_60_sa_register( \ - res, (long long)(newv), (long long)(oldv), (long long)(flags), \ - (long long)(stackinfo_offset)) -#define __sanitizer_syscall_pre_compat_60_sa_stacks(num, stacks) \ - __sanitizer_syscall_pre_impl_compat_60_sa_stacks((long long)(num), \ - (long long)(stacks)) -#define __sanitizer_syscall_post_compat_60_sa_stacks(res, num, stacks) \ - __sanitizer_syscall_post_impl_compat_60_sa_stacks(res, (long long)(num), \ - (long long)(stacks)) -#define __sanitizer_syscall_pre_compat_60_sa_enable() \ - __sanitizer_syscall_pre_impl_compat_60_sa_enable() -#define __sanitizer_syscall_post_compat_60_sa_enable(res) \ - __sanitizer_syscall_post_impl_compat_60_sa_enable(res) -#define __sanitizer_syscall_pre_compat_60_sa_setconcurrency(concurrency) \ - __sanitizer_syscall_pre_impl_compat_60_sa_setconcurrency( \ - (long long)(concurrency)) -#define __sanitizer_syscall_post_compat_60_sa_setconcurrency(res, concurrency) \ - __sanitizer_syscall_post_impl_compat_60_sa_setconcurrency( \ - res, (long long)(concurrency)) -#define __sanitizer_syscall_pre_compat_60_sa_yield() \ - __sanitizer_syscall_pre_impl_compat_60_sa_yield() -#define __sanitizer_syscall_post_compat_60_sa_yield(res) \ - __sanitizer_syscall_post_impl_compat_60_sa_yield(res) -#define __sanitizer_syscall_pre_compat_60_sa_preempt(sa_id) \ - __sanitizer_syscall_pre_impl_compat_60_sa_preempt((long long)(sa_id)) -#define __sanitizer_syscall_post_compat_60_sa_preempt(res, sa_id) \ - __sanitizer_syscall_post_impl_compat_60_sa_preempt(res, (long long)(sa_id)) -/* syscall 336 has been skipped */ -/* syscall 337 has been skipped */ -/* syscall 338 has been skipped */ -/* syscall 339 has been skipped */ -#define __sanitizer_syscall_pre___sigaction_sigtramp(signum, nsa, osa, tramp, \ - vers) \ - __sanitizer_syscall_pre_impl___sigaction_sigtramp( \ - (long long)(signum), (long long)(nsa), (long long)(osa), \ - (long long)(tramp), (long long)(vers)) -#define __sanitizer_syscall_post___sigaction_sigtramp(res, signum, nsa, osa, \ - tramp, vers) \ - __sanitizer_syscall_post_impl___sigaction_sigtramp( \ - res, (long long)(signum), (long long)(nsa), (long long)(osa), \ - (long long)(tramp), (long long)(vers)) -/* syscall 341 has been skipped */ -/* syscall 342 has been skipped */ -#define __sanitizer_syscall_pre_rasctl(addr, len, op) \ - __sanitizer_syscall_pre_impl_rasctl((long long)(addr), (long long)(len), \ - (long long)(op)) -#define __sanitizer_syscall_post_rasctl(res, addr, len, op) \ - __sanitizer_syscall_post_impl_rasctl(res, (long long)(addr), \ - (long long)(len), (long long)(op)) -#define __sanitizer_syscall_pre_kqueue() __sanitizer_syscall_pre_impl_kqueue() -#define __sanitizer_syscall_post_kqueue(res) \ - __sanitizer_syscall_post_impl_kqueue(res) -#define __sanitizer_syscall_pre_compat_50_kevent(fd, changelist, nchanges, \ - eventlist, nevents, timeout) \ - __sanitizer_syscall_pre_impl_compat_50_kevent( \ - (long long)(fd), (long long)(changelist), (long long)(nchanges), \ - (long long)(eventlist), (long long)(nevents), (long long)(timeout)) -#define __sanitizer_syscall_post_compat_50_kevent( \ - res, fd, changelist, nchanges, eventlist, nevents, timeout) \ - __sanitizer_syscall_post_impl_compat_50_kevent( \ - res, (long long)(fd), (long long)(changelist), (long long)(nchanges), \ - (long long)(eventlist), (long long)(nevents), (long long)(timeout)) -#define __sanitizer_syscall_pre__sched_setparam(pid, lid, policy, params) \ - __sanitizer_syscall_pre_impl__sched_setparam( \ - (long long)(pid), (long long)(lid), (long long)(policy), \ - (long long)(params)) -#define __sanitizer_syscall_post__sched_setparam(res, pid, lid, policy, \ - params) \ - __sanitizer_syscall_post_impl__sched_setparam( \ - res, (long long)(pid), (long long)(lid), (long long)(policy), \ - (long long)(params)) -#define __sanitizer_syscall_pre__sched_getparam(pid, lid, policy, params) \ - __sanitizer_syscall_pre_impl__sched_getparam( \ - (long long)(pid), (long long)(lid), (long long)(policy), \ - (long long)(params)) -#define __sanitizer_syscall_post__sched_getparam(res, pid, lid, policy, \ - params) \ - __sanitizer_syscall_post_impl__sched_getparam( \ - res, (long long)(pid), (long long)(lid), (long long)(policy), \ - (long long)(params)) -#define __sanitizer_syscall_pre__sched_setaffinity(pid, lid, size, cpuset) \ - __sanitizer_syscall_pre_impl__sched_setaffinity( \ - (long long)(pid), (long long)(lid), (long long)(size), \ - (long long)(cpuset)) -#define __sanitizer_syscall_post__sched_setaffinity(res, pid, lid, size, \ - cpuset) \ - __sanitizer_syscall_post_impl__sched_setaffinity( \ - res, (long long)(pid), (long long)(lid), (long long)(size), \ - (long long)(cpuset)) -#define __sanitizer_syscall_pre__sched_getaffinity(pid, lid, size, cpuset) \ - __sanitizer_syscall_pre_impl__sched_getaffinity( \ - (long long)(pid), (long long)(lid), (long long)(size), \ - (long long)(cpuset)) -#define __sanitizer_syscall_post__sched_getaffinity(res, pid, lid, size, \ - cpuset) \ - __sanitizer_syscall_post_impl__sched_getaffinity( \ - res, (long long)(pid), (long long)(lid), (long long)(size), \ - (long long)(cpuset)) -#define __sanitizer_syscall_pre_sched_yield() \ - __sanitizer_syscall_pre_impl_sched_yield() -#define __sanitizer_syscall_post_sched_yield(res) \ - __sanitizer_syscall_post_impl_sched_yield(res) -#define __sanitizer_syscall_pre__sched_protect(priority) \ - __sanitizer_syscall_pre_impl__sched_protect((long long)(priority)) -#define __sanitizer_syscall_post__sched_protect(res, priority) \ - __sanitizer_syscall_post_impl__sched_protect(res, (long long)(priority)) -/* syscall 352 has been skipped */ -/* syscall 353 has been skipped */ -#define __sanitizer_syscall_pre_fsync_range(fd, flags, start, length) \ - __sanitizer_syscall_pre_impl_fsync_range( \ - (long long)(fd), (long long)(flags), (long long)(start), \ - (long long)(length)) -#define __sanitizer_syscall_post_fsync_range(res, fd, flags, start, length) \ - __sanitizer_syscall_post_impl_fsync_range( \ - res, (long long)(fd), (long long)(flags), (long long)(start), \ - (long long)(length)) -#define __sanitizer_syscall_pre_uuidgen(store, count) \ - __sanitizer_syscall_pre_impl_uuidgen((long long)(store), (long long)(count)) -#define __sanitizer_syscall_post_uuidgen(res, store, count) \ - __sanitizer_syscall_post_impl_uuidgen(res, (long long)(store), \ - (long long)(count)) -#define __sanitizer_syscall_pre_compat_90_getvfsstat(buf, bufsize, flags) \ - __sanitizer_syscall_pre_impl_compat_90_getvfsstat( \ - (long long)(buf), (long long)(bufsize), (long long)(flags)) -#define __sanitizer_syscall_post_compat_90_getvfsstat(res, buf, bufsize, \ - flags) \ - __sanitizer_syscall_post_impl_compat_90_getvfsstat( \ - res, (long long)(buf), (long long)(bufsize), (long long)(flags)) -#define __sanitizer_syscall_pre_compat_90_statvfs1(path, buf, flags) \ - __sanitizer_syscall_pre_impl_compat_90_statvfs1( \ - (long long)(path), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_post_compat_90_statvfs1(res, path, buf, flags) \ - __sanitizer_syscall_post_impl_compat_90_statvfs1( \ - res, (long long)(path), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_pre_compat_90_fstatvfs1(fd, buf, flags) \ - __sanitizer_syscall_pre_impl_compat_90_fstatvfs1( \ - (long long)(fd), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_post_compat_90_fstatvfs1(res, fd, buf, flags) \ - __sanitizer_syscall_post_impl_compat_90_fstatvfs1( \ - res, (long long)(fd), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_pre_compat_30_fhstatvfs1(fhp, buf, flags) \ - __sanitizer_syscall_pre_impl_compat_30_fhstatvfs1( \ - (long long)(fhp), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_post_compat_30_fhstatvfs1(res, fhp, buf, flags) \ - __sanitizer_syscall_post_impl_compat_30_fhstatvfs1( \ - res, (long long)(fhp), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_pre_extattrctl(path, cmd, filename, attrnamespace, \ - attrname) \ - __sanitizer_syscall_pre_impl_extattrctl( \ - (long long)(path), (long long)(cmd), (long long)(filename), \ - (long long)(attrnamespace), (long long)(attrname)) -#define __sanitizer_syscall_post_extattrctl(res, path, cmd, filename, \ - attrnamespace, attrname) \ - __sanitizer_syscall_post_impl_extattrctl( \ - res, (long long)(path), (long long)(cmd), (long long)(filename), \ - (long long)(attrnamespace), (long long)(attrname)) -#define __sanitizer_syscall_pre_extattr_set_file(path, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_pre_impl_extattr_set_file( \ - (long long)(path), (long long)(attrnamespace), (long long)(attrname), \ - (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_set_file(res, path, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_post_impl_extattr_set_file( \ - res, (long long)(path), (long long)(attrnamespace), \ - (long long)(attrname), (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_pre_extattr_get_file(path, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_pre_impl_extattr_get_file( \ - (long long)(path), (long long)(attrnamespace), (long long)(attrname), \ - (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_get_file(res, path, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_post_impl_extattr_get_file( \ - res, (long long)(path), (long long)(attrnamespace), \ - (long long)(attrname), (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_pre_extattr_delete_file(path, attrnamespace, \ - attrname) \ - __sanitizer_syscall_pre_impl_extattr_delete_file( \ - (long long)(path), (long long)(attrnamespace), (long long)(attrname)) -#define __sanitizer_syscall_post_extattr_delete_file(res, path, attrnamespace, \ - attrname) \ - __sanitizer_syscall_post_impl_extattr_delete_file( \ - res, (long long)(path), (long long)(attrnamespace), \ - (long long)(attrname)) -#define __sanitizer_syscall_pre_extattr_set_fd(fd, attrnamespace, attrname, \ - data, nbytes) \ - __sanitizer_syscall_pre_impl_extattr_set_fd( \ - (long long)(fd), (long long)(attrnamespace), (long long)(attrname), \ - (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_set_fd(res, fd, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_post_impl_extattr_set_fd( \ - res, (long long)(fd), (long long)(attrnamespace), (long long)(attrname), \ - (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_pre_extattr_get_fd(fd, attrnamespace, attrname, \ - data, nbytes) \ - __sanitizer_syscall_pre_impl_extattr_get_fd( \ - (long long)(fd), (long long)(attrnamespace), (long long)(attrname), \ - (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_get_fd(res, fd, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_post_impl_extattr_get_fd( \ - res, (long long)(fd), (long long)(attrnamespace), (long long)(attrname), \ - (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_pre_extattr_delete_fd(fd, attrnamespace, attrname) \ - __sanitizer_syscall_pre_impl_extattr_delete_fd( \ - (long long)(fd), (long long)(attrnamespace), (long long)(attrname)) -#define __sanitizer_syscall_post_extattr_delete_fd(res, fd, attrnamespace, \ - attrname) \ - __sanitizer_syscall_post_impl_extattr_delete_fd( \ - res, (long long)(fd), (long long)(attrnamespace), (long long)(attrname)) -#define __sanitizer_syscall_pre_extattr_set_link(path, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_pre_impl_extattr_set_link( \ - (long long)(path), (long long)(attrnamespace), (long long)(attrname), \ - (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_set_link(res, path, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_post_impl_extattr_set_link( \ - res, (long long)(path), (long long)(attrnamespace), \ - (long long)(attrname), (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_pre_extattr_get_link(path, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_pre_impl_extattr_get_link( \ - (long long)(path), (long long)(attrnamespace), (long long)(attrname), \ - (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_get_link(res, path, attrnamespace, \ - attrname, data, nbytes) \ - __sanitizer_syscall_post_impl_extattr_get_link( \ - res, (long long)(path), (long long)(attrnamespace), \ - (long long)(attrname), (long long)(data), (long long)(nbytes)) -#define __sanitizer_syscall_pre_extattr_delete_link(path, attrnamespace, \ - attrname) \ - __sanitizer_syscall_pre_impl_extattr_delete_link( \ - (long long)(path), (long long)(attrnamespace), (long long)(attrname)) -#define __sanitizer_syscall_post_extattr_delete_link(res, path, attrnamespace, \ - attrname) \ - __sanitizer_syscall_post_impl_extattr_delete_link( \ - res, (long long)(path), (long long)(attrnamespace), \ - (long long)(attrname)) -#define __sanitizer_syscall_pre_extattr_list_fd(fd, attrnamespace, data, \ - nbytes) \ - __sanitizer_syscall_pre_impl_extattr_list_fd( \ - (long long)(fd), (long long)(attrnamespace), (long long)(data), \ - (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_list_fd(res, fd, attrnamespace, data, \ - nbytes) \ - __sanitizer_syscall_post_impl_extattr_list_fd( \ - res, (long long)(fd), (long long)(attrnamespace), (long long)(data), \ - (long long)(nbytes)) -#define __sanitizer_syscall_pre_extattr_list_file(path, attrnamespace, data, \ - nbytes) \ - __sanitizer_syscall_pre_impl_extattr_list_file( \ - (long long)(path), (long long)(attrnamespace), (long long)(data), \ - (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_list_file(res, path, attrnamespace, \ - data, nbytes) \ - __sanitizer_syscall_post_impl_extattr_list_file( \ - res, (long long)(path), (long long)(attrnamespace), (long long)(data), \ - (long long)(nbytes)) -#define __sanitizer_syscall_pre_extattr_list_link(path, attrnamespace, data, \ - nbytes) \ - __sanitizer_syscall_pre_impl_extattr_list_link( \ - (long long)(path), (long long)(attrnamespace), (long long)(data), \ - (long long)(nbytes)) -#define __sanitizer_syscall_post_extattr_list_link(res, path, attrnamespace, \ - data, nbytes) \ - __sanitizer_syscall_post_impl_extattr_list_link( \ - res, (long long)(path), (long long)(attrnamespace), (long long)(data), \ - (long long)(nbytes)) -#define __sanitizer_syscall_pre_compat_50_pselect(nd, in, ou, ex, ts, mask) \ - __sanitizer_syscall_pre_impl_compat_50_pselect( \ - (long long)(nd), (long long)(in), (long long)(ou), (long long)(ex), \ - (long long)(ts), (long long)(mask)) -#define __sanitizer_syscall_post_compat_50_pselect(res, nd, in, ou, ex, ts, \ - mask) \ - __sanitizer_syscall_post_impl_compat_50_pselect( \ - res, (long long)(nd), (long long)(in), (long long)(ou), (long long)(ex), \ - (long long)(ts), (long long)(mask)) -#define __sanitizer_syscall_pre_compat_50_pollts(fds, nfds, ts, mask) \ - __sanitizer_syscall_pre_impl_compat_50_pollts( \ - (long long)(fds), (long long)(nfds), (long long)(ts), (long long)(mask)) -#define __sanitizer_syscall_post_compat_50_pollts(res, fds, nfds, ts, mask) \ - __sanitizer_syscall_post_impl_compat_50_pollts( \ - res, (long long)(fds), (long long)(nfds), (long long)(ts), \ - (long long)(mask)) -#define __sanitizer_syscall_pre_setxattr(path, name, value, size, flags) \ - __sanitizer_syscall_pre_impl_setxattr((long long)(path), (long long)(name), \ - (long long)(value), (long long)(size), \ - (long long)(flags)) -#define __sanitizer_syscall_post_setxattr(res, path, name, value, size, flags) \ - __sanitizer_syscall_post_impl_setxattr( \ - res, (long long)(path), (long long)(name), (long long)(value), \ - (long long)(size), (long long)(flags)) -#define __sanitizer_syscall_pre_lsetxattr(path, name, value, size, flags) \ - __sanitizer_syscall_pre_impl_lsetxattr( \ - (long long)(path), (long long)(name), (long long)(value), \ - (long long)(size), (long long)(flags)) -#define __sanitizer_syscall_post_lsetxattr(res, path, name, value, size, \ - flags) \ - __sanitizer_syscall_post_impl_lsetxattr( \ - res, (long long)(path), (long long)(name), (long long)(value), \ - (long long)(size), (long long)(flags)) -#define __sanitizer_syscall_pre_fsetxattr(fd, name, value, size, flags) \ - __sanitizer_syscall_pre_impl_fsetxattr( \ - (long long)(fd), (long long)(name), (long long)(value), \ - (long long)(size), (long long)(flags)) -#define __sanitizer_syscall_post_fsetxattr(res, fd, name, value, size, flags) \ - __sanitizer_syscall_post_impl_fsetxattr( \ - res, (long long)(fd), (long long)(name), (long long)(value), \ - (long long)(size), (long long)(flags)) -#define __sanitizer_syscall_pre_getxattr(path, name, value, size) \ - __sanitizer_syscall_pre_impl_getxattr((long long)(path), (long long)(name), \ - (long long)(value), (long long)(size)) -#define __sanitizer_syscall_post_getxattr(res, path, name, value, size) \ - __sanitizer_syscall_post_impl_getxattr( \ - res, (long long)(path), (long long)(name), (long long)(value), \ - (long long)(size)) -#define __sanitizer_syscall_pre_lgetxattr(path, name, value, size) \ - __sanitizer_syscall_pre_impl_lgetxattr((long long)(path), (long long)(name), \ - (long long)(value), \ - (long long)(size)) -#define __sanitizer_syscall_post_lgetxattr(res, path, name, value, size) \ - __sanitizer_syscall_post_impl_lgetxattr( \ - res, (long long)(path), (long long)(name), (long long)(value), \ - (long long)(size)) -#define __sanitizer_syscall_pre_fgetxattr(fd, name, value, size) \ - __sanitizer_syscall_pre_impl_fgetxattr((long long)(fd), (long long)(name), \ - (long long)(value), \ - (long long)(size)) -#define __sanitizer_syscall_post_fgetxattr(res, fd, name, value, size) \ - __sanitizer_syscall_post_impl_fgetxattr( \ - res, (long long)(fd), (long long)(name), (long long)(value), \ - (long long)(size)) -#define __sanitizer_syscall_pre_listxattr(path, list, size) \ - __sanitizer_syscall_pre_impl_listxattr((long long)(path), (long long)(list), \ - (long long)(size)) -#define __sanitizer_syscall_post_listxattr(res, path, list, size) \ - __sanitizer_syscall_post_impl_listxattr( \ - res, (long long)(path), (long long)(list), (long long)(size)) -#define __sanitizer_syscall_pre_llistxattr(path, list, size) \ - __sanitizer_syscall_pre_impl_llistxattr( \ - (long long)(path), (long long)(list), (long long)(size)) -#define __sanitizer_syscall_post_llistxattr(res, path, list, size) \ - __sanitizer_syscall_post_impl_llistxattr( \ - res, (long long)(path), (long long)(list), (long long)(size)) -#define __sanitizer_syscall_pre_flistxattr(fd, list, size) \ - __sanitizer_syscall_pre_impl_flistxattr((long long)(fd), (long long)(list), \ - (long long)(size)) -#define __sanitizer_syscall_post_flistxattr(res, fd, list, size) \ - __sanitizer_syscall_post_impl_flistxattr( \ - res, (long long)(fd), (long long)(list), (long long)(size)) -#define __sanitizer_syscall_pre_removexattr(path, name) \ - __sanitizer_syscall_pre_impl_removexattr((long long)(path), (long long)(name)) -#define __sanitizer_syscall_post_removexattr(res, path, name) \ - __sanitizer_syscall_post_impl_removexattr(res, (long long)(path), \ - (long long)(name)) -#define __sanitizer_syscall_pre_lremovexattr(path, name) \ - __sanitizer_syscall_pre_impl_lremovexattr((long long)(path), \ - (long long)(name)) -#define __sanitizer_syscall_post_lremovexattr(res, path, name) \ - __sanitizer_syscall_post_impl_lremovexattr(res, (long long)(path), \ - (long long)(name)) -#define __sanitizer_syscall_pre_fremovexattr(fd, name) \ - __sanitizer_syscall_pre_impl_fremovexattr((long long)(fd), (long long)(name)) -#define __sanitizer_syscall_post_fremovexattr(res, fd, name) \ - __sanitizer_syscall_post_impl_fremovexattr(res, (long long)(fd), \ - (long long)(name)) -#define __sanitizer_syscall_pre_compat_50___stat30(path, ub) \ - __sanitizer_syscall_pre_impl_compat_50___stat30((long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_post_compat_50___stat30(res, path, ub) \ - __sanitizer_syscall_post_impl_compat_50___stat30(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre_compat_50___fstat30(fd, sb) \ - __sanitizer_syscall_pre_impl_compat_50___fstat30((long long)(fd), \ - (long long)(sb)) -#define __sanitizer_syscall_post_compat_50___fstat30(res, fd, sb) \ - __sanitizer_syscall_post_impl_compat_50___fstat30(res, (long long)(fd), \ - (long long)(sb)) -#define __sanitizer_syscall_pre_compat_50___lstat30(path, ub) \ - __sanitizer_syscall_pre_impl_compat_50___lstat30((long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_post_compat_50___lstat30(res, path, ub) \ - __sanitizer_syscall_post_impl_compat_50___lstat30(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre___getdents30(fd, buf, count) \ - __sanitizer_syscall_pre_impl___getdents30((long long)(fd), (long long)(buf), \ - (long long)(count)) -#define __sanitizer_syscall_post___getdents30(res, fd, buf, count) \ - __sanitizer_syscall_post_impl___getdents30( \ - res, (long long)(fd), (long long)(buf), (long long)(count)) -#define __sanitizer_syscall_pre_posix_fadvise() \ - __sanitizer_syscall_pre_impl_posix_fadvise((long long)()) -#define __sanitizer_syscall_post_posix_fadvise(res) \ - __sanitizer_syscall_post_impl_posix_fadvise(res, (long long)()) -#define __sanitizer_syscall_pre_compat_30___fhstat30(fhp, sb) \ - __sanitizer_syscall_pre_impl_compat_30___fhstat30((long long)(fhp), \ - (long long)(sb)) -#define __sanitizer_syscall_post_compat_30___fhstat30(res, fhp, sb) \ - __sanitizer_syscall_post_impl_compat_30___fhstat30(res, (long long)(fhp), \ - (long long)(sb)) -#define __sanitizer_syscall_pre_compat_50___ntp_gettime30(ntvp) \ - __sanitizer_syscall_pre_impl_compat_50___ntp_gettime30((long long)(ntvp)) -#define __sanitizer_syscall_post_compat_50___ntp_gettime30(res, ntvp) \ - __sanitizer_syscall_post_impl_compat_50___ntp_gettime30(res, \ - (long long)(ntvp)) -#define __sanitizer_syscall_pre___socket30(domain, type, protocol) \ - __sanitizer_syscall_pre_impl___socket30( \ - (long long)(domain), (long long)(type), (long long)(protocol)) -#define __sanitizer_syscall_post___socket30(res, domain, type, protocol) \ - __sanitizer_syscall_post_impl___socket30( \ - res, (long long)(domain), (long long)(type), (long long)(protocol)) -#define __sanitizer_syscall_pre___getfh30(fname, fhp, fh_size) \ - __sanitizer_syscall_pre_impl___getfh30((long long)(fname), (long long)(fhp), \ - (long long)(fh_size)) -#define __sanitizer_syscall_post___getfh30(res, fname, fhp, fh_size) \ - __sanitizer_syscall_post_impl___getfh30( \ - res, (long long)(fname), (long long)(fhp), (long long)(fh_size)) -#define __sanitizer_syscall_pre___fhopen40(fhp, fh_size, flags) \ - __sanitizer_syscall_pre_impl___fhopen40( \ - (long long)(fhp), (long long)(fh_size), (long long)(flags)) -#define __sanitizer_syscall_post___fhopen40(res, fhp, fh_size, flags) \ - __sanitizer_syscall_post_impl___fhopen40( \ - res, (long long)(fhp), (long long)(fh_size), (long long)(flags)) -#define __sanitizer_syscall_pre_compat_90_fhstatvfs1(fhp, fh_size, buf, flags) \ - __sanitizer_syscall_pre_impl_compat_90_fhstatvfs1( \ - (long long)(fhp), (long long)(fh_size), (long long)(buf), \ - (long long)(flags)) -#define __sanitizer_syscall_post_compat_90_fhstatvfs1(res, fhp, fh_size, buf, \ - flags) \ - __sanitizer_syscall_post_impl_compat_90_fhstatvfs1( \ - res, (long long)(fhp), (long long)(fh_size), (long long)(buf), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_compat_50___fhstat40(fhp, fh_size, sb) \ - __sanitizer_syscall_pre_impl_compat_50___fhstat40( \ - (long long)(fhp), (long long)(fh_size), (long long)(sb)) -#define __sanitizer_syscall_post_compat_50___fhstat40(res, fhp, fh_size, sb) \ - __sanitizer_syscall_post_impl_compat_50___fhstat40( \ - res, (long long)(fhp), (long long)(fh_size), (long long)(sb)) -#define __sanitizer_syscall_pre_aio_cancel(fildes, aiocbp) \ - __sanitizer_syscall_pre_impl_aio_cancel((long long)(fildes), \ - (long long)(aiocbp)) -#define __sanitizer_syscall_post_aio_cancel(res, fildes, aiocbp) \ - __sanitizer_syscall_post_impl_aio_cancel(res, (long long)(fildes), \ - (long long)(aiocbp)) -#define __sanitizer_syscall_pre_aio_error(aiocbp) \ - __sanitizer_syscall_pre_impl_aio_error((long long)(aiocbp)) -#define __sanitizer_syscall_post_aio_error(res, aiocbp) \ - __sanitizer_syscall_post_impl_aio_error(res, (long long)(aiocbp)) -#define __sanitizer_syscall_pre_aio_fsync(op, aiocbp) \ - __sanitizer_syscall_pre_impl_aio_fsync((long long)(op), (long long)(aiocbp)) -#define __sanitizer_syscall_post_aio_fsync(res, op, aiocbp) \ - __sanitizer_syscall_post_impl_aio_fsync(res, (long long)(op), \ - (long long)(aiocbp)) -#define __sanitizer_syscall_pre_aio_read(aiocbp) \ - __sanitizer_syscall_pre_impl_aio_read((long long)(aiocbp)) -#define __sanitizer_syscall_post_aio_read(res, aiocbp) \ - __sanitizer_syscall_post_impl_aio_read(res, (long long)(aiocbp)) -#define __sanitizer_syscall_pre_aio_return(aiocbp) \ - __sanitizer_syscall_pre_impl_aio_return((long long)(aiocbp)) -#define __sanitizer_syscall_post_aio_return(res, aiocbp) \ - __sanitizer_syscall_post_impl_aio_return(res, (long long)(aiocbp)) -#define __sanitizer_syscall_pre_compat_50_aio_suspend(list, nent, timeout) \ - __sanitizer_syscall_pre_impl_compat_50_aio_suspend( \ - (long long)(list), (long long)(nent), (long long)(timeout)) -#define __sanitizer_syscall_post_compat_50_aio_suspend(res, list, nent, \ - timeout) \ - __sanitizer_syscall_post_impl_compat_50_aio_suspend( \ - res, (long long)(list), (long long)(nent), (long long)(timeout)) -#define __sanitizer_syscall_pre_aio_write(aiocbp) \ - __sanitizer_syscall_pre_impl_aio_write((long long)(aiocbp)) -#define __sanitizer_syscall_post_aio_write(res, aiocbp) \ - __sanitizer_syscall_post_impl_aio_write(res, (long long)(aiocbp)) -#define __sanitizer_syscall_pre_lio_listio(mode, list, nent, sig) \ - __sanitizer_syscall_pre_impl_lio_listio((long long)(mode), \ - (long long)(list), \ - (long long)(nent), (long long)(sig)) -#define __sanitizer_syscall_post_lio_listio(res, mode, list, nent, sig) \ - __sanitizer_syscall_post_impl_lio_listio( \ - res, (long long)(mode), (long long)(list), (long long)(nent), \ - (long long)(sig)) -/* syscall 407 has been skipped */ -/* syscall 408 has been skipped */ -/* syscall 409 has been skipped */ -#define __sanitizer_syscall_pre___mount50(type, path, flags, data, data_len) \ - __sanitizer_syscall_pre_impl___mount50( \ - (long long)(type), (long long)(path), (long long)(flags), \ - (long long)(data), (long long)(data_len)) -#define __sanitizer_syscall_post___mount50(res, type, path, flags, data, \ - data_len) \ - __sanitizer_syscall_post_impl___mount50( \ - res, (long long)(type), (long long)(path), (long long)(flags), \ - (long long)(data), (long long)(data_len)) -#define __sanitizer_syscall_pre_mremap(old_address, old_size, new_address, \ - new_size, flags) \ - __sanitizer_syscall_pre_impl_mremap( \ - (long long)(old_address), (long long)(old_size), \ - (long long)(new_address), (long long)(new_size), (long long)(flags)) -#define __sanitizer_syscall_post_mremap(res, old_address, old_size, \ - new_address, new_size, flags) \ - __sanitizer_syscall_post_impl_mremap( \ - res, (long long)(old_address), (long long)(old_size), \ - (long long)(new_address), (long long)(new_size), (long long)(flags)) -#define __sanitizer_syscall_pre_pset_create(psid) \ - __sanitizer_syscall_pre_impl_pset_create((long long)(psid)) -#define __sanitizer_syscall_post_pset_create(res, psid) \ - __sanitizer_syscall_post_impl_pset_create(res, (long long)(psid)) -#define __sanitizer_syscall_pre_pset_destroy(psid) \ - __sanitizer_syscall_pre_impl_pset_destroy((long long)(psid)) -#define __sanitizer_syscall_post_pset_destroy(res, psid) \ - __sanitizer_syscall_post_impl_pset_destroy(res, (long long)(psid)) -#define __sanitizer_syscall_pre_pset_assign(psid, cpuid, opsid) \ - __sanitizer_syscall_pre_impl_pset_assign( \ - (long long)(psid), (long long)(cpuid), (long long)(opsid)) -#define __sanitizer_syscall_post_pset_assign(res, psid, cpuid, opsid) \ - __sanitizer_syscall_post_impl_pset_assign( \ - res, (long long)(psid), (long long)(cpuid), (long long)(opsid)) -#define __sanitizer_syscall_pre__pset_bind(idtype, first_id, second_id, psid, \ - opsid) \ - __sanitizer_syscall_pre_impl__pset_bind( \ - (long long)(idtype), (long long)(first_id), (long long)(second_id), \ - (long long)(psid), (long long)(opsid)) -#define __sanitizer_syscall_post__pset_bind(res, idtype, first_id, second_id, \ - psid, opsid) \ - __sanitizer_syscall_post_impl__pset_bind( \ - res, (long long)(idtype), (long long)(first_id), (long long)(second_id), \ - (long long)(psid), (long long)(opsid)) -#define __sanitizer_syscall_pre___posix_fadvise50(fd, PAD, offset, len, \ - advice) \ - __sanitizer_syscall_pre_impl___posix_fadvise50( \ - (long long)(fd), (long long)(PAD), (long long)(offset), \ - (long long)(len), (long long)(advice)) -#define __sanitizer_syscall_post___posix_fadvise50(res, fd, PAD, offset, len, \ - advice) \ - __sanitizer_syscall_post_impl___posix_fadvise50( \ - res, (long long)(fd), (long long)(PAD), (long long)(offset), \ - (long long)(len), (long long)(advice)) -#define __sanitizer_syscall_pre___select50(nd, in, ou, ex, tv) \ - __sanitizer_syscall_pre_impl___select50((long long)(nd), (long long)(in), \ - (long long)(ou), (long long)(ex), \ - (long long)(tv)) -#define __sanitizer_syscall_post___select50(res, nd, in, ou, ex, tv) \ - __sanitizer_syscall_post_impl___select50(res, (long long)(nd), \ - (long long)(in), (long long)(ou), \ - (long long)(ex), (long long)(tv)) -#define __sanitizer_syscall_pre___gettimeofday50(tp, tzp) \ - __sanitizer_syscall_pre_impl___gettimeofday50((long long)(tp), \ - (long long)(tzp)) -#define __sanitizer_syscall_post___gettimeofday50(res, tp, tzp) \ - __sanitizer_syscall_post_impl___gettimeofday50(res, (long long)(tp), \ - (long long)(tzp)) -#define __sanitizer_syscall_pre___settimeofday50(tv, tzp) \ - __sanitizer_syscall_pre_impl___settimeofday50((long long)(tv), \ - (long long)(tzp)) -#define __sanitizer_syscall_post___settimeofday50(res, tv, tzp) \ - __sanitizer_syscall_post_impl___settimeofday50(res, (long long)(tv), \ - (long long)(tzp)) -#define __sanitizer_syscall_pre___utimes50(path, tptr) \ - __sanitizer_syscall_pre_impl___utimes50((long long)(path), (long long)(tptr)) -#define __sanitizer_syscall_post___utimes50(res, path, tptr) \ - __sanitizer_syscall_post_impl___utimes50(res, (long long)(path), \ - (long long)(tptr)) -#define __sanitizer_syscall_pre___adjtime50(delta, olddelta) \ - __sanitizer_syscall_pre_impl___adjtime50((long long)(delta), \ - (long long)(olddelta)) -#define __sanitizer_syscall_post___adjtime50(res, delta, olddelta) \ - __sanitizer_syscall_post_impl___adjtime50(res, (long long)(delta), \ - (long long)(olddelta)) -#define __sanitizer_syscall_pre___lfs_segwait50(fsidp, tv) \ - __sanitizer_syscall_pre_impl___lfs_segwait50((long long)(fsidp), \ - (long long)(tv)) -#define __sanitizer_syscall_post___lfs_segwait50(res, fsidp, tv) \ - __sanitizer_syscall_post_impl___lfs_segwait50(res, (long long)(fsidp), \ - (long long)(tv)) -#define __sanitizer_syscall_pre___futimes50(fd, tptr) \ - __sanitizer_syscall_pre_impl___futimes50((long long)(fd), (long long)(tptr)) -#define __sanitizer_syscall_post___futimes50(res, fd, tptr) \ - __sanitizer_syscall_post_impl___futimes50(res, (long long)(fd), \ - (long long)(tptr)) -#define __sanitizer_syscall_pre___lutimes50(path, tptr) \ - __sanitizer_syscall_pre_impl___lutimes50((long long)(path), (long long)(tptr)) -#define __sanitizer_syscall_post___lutimes50(res, path, tptr) \ - __sanitizer_syscall_post_impl___lutimes50(res, (long long)(path), \ - (long long)(tptr)) -#define __sanitizer_syscall_pre___setitimer50(which, itv, oitv) \ - __sanitizer_syscall_pre_impl___setitimer50( \ - (long long)(which), (long long)(itv), (long long)(oitv)) -#define __sanitizer_syscall_post___setitimer50(res, which, itv, oitv) \ - __sanitizer_syscall_post_impl___setitimer50( \ - res, (long long)(which), (long long)(itv), (long long)(oitv)) -#define __sanitizer_syscall_pre___getitimer50(which, itv) \ - __sanitizer_syscall_pre_impl___getitimer50((long long)(which), \ - (long long)(itv)) -#define __sanitizer_syscall_post___getitimer50(res, which, itv) \ - __sanitizer_syscall_post_impl___getitimer50(res, (long long)(which), \ - (long long)(itv)) -#define __sanitizer_syscall_pre___clock_gettime50(clock_id, tp) \ - __sanitizer_syscall_pre_impl___clock_gettime50((long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_post___clock_gettime50(res, clock_id, tp) \ - __sanitizer_syscall_post_impl___clock_gettime50(res, (long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_pre___clock_settime50(clock_id, tp) \ - __sanitizer_syscall_pre_impl___clock_settime50((long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_post___clock_settime50(res, clock_id, tp) \ - __sanitizer_syscall_post_impl___clock_settime50(res, (long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_pre___clock_getres50(clock_id, tp) \ - __sanitizer_syscall_pre_impl___clock_getres50((long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_post___clock_getres50(res, clock_id, tp) \ - __sanitizer_syscall_post_impl___clock_getres50(res, (long long)(clock_id), \ - (long long)(tp)) -#define __sanitizer_syscall_pre___nanosleep50(rqtp, rmtp) \ - __sanitizer_syscall_pre_impl___nanosleep50((long long)(rqtp), \ - (long long)(rmtp)) -#define __sanitizer_syscall_post___nanosleep50(res, rqtp, rmtp) \ - __sanitizer_syscall_post_impl___nanosleep50(res, (long long)(rqtp), \ - (long long)(rmtp)) -#define __sanitizer_syscall_pre_____sigtimedwait50(set, info, timeout) \ - __sanitizer_syscall_pre_impl_____sigtimedwait50( \ - (long long)(set), (long long)(info), (long long)(timeout)) -#define __sanitizer_syscall_post_____sigtimedwait50(res, set, info, timeout) \ - __sanitizer_syscall_post_impl_____sigtimedwait50( \ - res, (long long)(set), (long long)(info), (long long)(timeout)) -#define __sanitizer_syscall_pre___mq_timedsend50(mqdes, msg_ptr, msg_len, \ - msg_prio, abs_timeout) \ - __sanitizer_syscall_pre_impl___mq_timedsend50( \ - (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio), (long long)(abs_timeout)) -#define __sanitizer_syscall_post___mq_timedsend50( \ - res, mqdes, msg_ptr, msg_len, msg_prio, abs_timeout) \ - __sanitizer_syscall_post_impl___mq_timedsend50( \ - res, (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio), (long long)(abs_timeout)) -#define __sanitizer_syscall_pre___mq_timedreceive50(mqdes, msg_ptr, msg_len, \ - msg_prio, abs_timeout) \ - __sanitizer_syscall_pre_impl___mq_timedreceive50( \ - (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio), (long long)(abs_timeout)) -#define __sanitizer_syscall_post___mq_timedreceive50( \ - res, mqdes, msg_ptr, msg_len, msg_prio, abs_timeout) \ - __sanitizer_syscall_post_impl___mq_timedreceive50( \ - res, (long long)(mqdes), (long long)(msg_ptr), (long long)(msg_len), \ - (long long)(msg_prio), (long long)(abs_timeout)) -#define __sanitizer_syscall_pre_compat_60__lwp_park(ts, unpark, hint, \ - unparkhint) \ - __sanitizer_syscall_pre_impl_compat_60__lwp_park( \ - (long long)(ts), (long long)(unpark), (long long)(hint), \ - (long long)(unparkhint)) -#define __sanitizer_syscall_post_compat_60__lwp_park(res, ts, unpark, hint, \ - unparkhint) \ - __sanitizer_syscall_post_impl_compat_60__lwp_park( \ - res, (long long)(ts), (long long)(unpark), (long long)(hint), \ - (long long)(unparkhint)) -#define __sanitizer_syscall_pre___kevent50(fd, changelist, nchanges, \ - eventlist, nevents, timeout) \ - __sanitizer_syscall_pre_impl___kevent50( \ - (long long)(fd), (long long)(changelist), (long long)(nchanges), \ - (long long)(eventlist), (long long)(nevents), (long long)(timeout)) -#define __sanitizer_syscall_post___kevent50(res, fd, changelist, nchanges, \ - eventlist, nevents, timeout) \ - __sanitizer_syscall_post_impl___kevent50( \ - res, (long long)(fd), (long long)(changelist), (long long)(nchanges), \ - (long long)(eventlist), (long long)(nevents), (long long)(timeout)) -#define __sanitizer_syscall_pre___pselect50(nd, in, ou, ex, ts, mask) \ - __sanitizer_syscall_pre_impl___pselect50((long long)(nd), (long long)(in), \ - (long long)(ou), (long long)(ex), \ - (long long)(ts), (long long)(mask)) -#define __sanitizer_syscall_post___pselect50(res, nd, in, ou, ex, ts, mask) \ - __sanitizer_syscall_post_impl___pselect50( \ - res, (long long)(nd), (long long)(in), (long long)(ou), (long long)(ex), \ - (long long)(ts), (long long)(mask)) -#define __sanitizer_syscall_pre___pollts50(fds, nfds, ts, mask) \ - __sanitizer_syscall_pre_impl___pollts50((long long)(fds), (long long)(nfds), \ - (long long)(ts), (long long)(mask)) -#define __sanitizer_syscall_post___pollts50(res, fds, nfds, ts, mask) \ - __sanitizer_syscall_post_impl___pollts50(res, (long long)(fds), \ - (long long)(nfds), (long long)(ts), \ - (long long)(mask)) -#define __sanitizer_syscall_pre___aio_suspend50(list, nent, timeout) \ - __sanitizer_syscall_pre_impl___aio_suspend50( \ - (long long)(list), (long long)(nent), (long long)(timeout)) -#define __sanitizer_syscall_post___aio_suspend50(res, list, nent, timeout) \ - __sanitizer_syscall_post_impl___aio_suspend50( \ - res, (long long)(list), (long long)(nent), (long long)(timeout)) -#define __sanitizer_syscall_pre___stat50(path, ub) \ - __sanitizer_syscall_pre_impl___stat50((long long)(path), (long long)(ub)) -#define __sanitizer_syscall_post___stat50(res, path, ub) \ - __sanitizer_syscall_post_impl___stat50(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre___fstat50(fd, sb) \ - __sanitizer_syscall_pre_impl___fstat50((long long)(fd), (long long)(sb)) -#define __sanitizer_syscall_post___fstat50(res, fd, sb) \ - __sanitizer_syscall_post_impl___fstat50(res, (long long)(fd), (long long)(sb)) -#define __sanitizer_syscall_pre___lstat50(path, ub) \ - __sanitizer_syscall_pre_impl___lstat50((long long)(path), (long long)(ub)) -#define __sanitizer_syscall_post___lstat50(res, path, ub) \ - __sanitizer_syscall_post_impl___lstat50(res, (long long)(path), \ - (long long)(ub)) -#define __sanitizer_syscall_pre_____semctl50(semid, semnum, cmd, arg) \ - __sanitizer_syscall_pre_impl_____semctl50( \ - (long long)(semid), (long long)(semnum), (long long)(cmd), \ - (long long)(arg)) -#define __sanitizer_syscall_post_____semctl50(res, semid, semnum, cmd, arg) \ - __sanitizer_syscall_post_impl_____semctl50( \ - res, (long long)(semid), (long long)(semnum), (long long)(cmd), \ - (long long)(arg)) -#define __sanitizer_syscall_pre___shmctl50(shmid, cmd, buf) \ - __sanitizer_syscall_pre_impl___shmctl50((long long)(shmid), \ - (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_post___shmctl50(res, shmid, cmd, buf) \ - __sanitizer_syscall_post_impl___shmctl50(res, (long long)(shmid), \ - (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_pre___msgctl50(msqid, cmd, buf) \ - __sanitizer_syscall_pre_impl___msgctl50((long long)(msqid), \ - (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_post___msgctl50(res, msqid, cmd, buf) \ - __sanitizer_syscall_post_impl___msgctl50(res, (long long)(msqid), \ - (long long)(cmd), (long long)(buf)) -#define __sanitizer_syscall_pre___getrusage50(who, rusage) \ - __sanitizer_syscall_pre_impl___getrusage50((long long)(who), \ - (long long)(rusage)) -#define __sanitizer_syscall_post___getrusage50(res, who, rusage) \ - __sanitizer_syscall_post_impl___getrusage50(res, (long long)(who), \ - (long long)(rusage)) -#define __sanitizer_syscall_pre___timer_settime50(timerid, flags, value, \ - ovalue) \ - __sanitizer_syscall_pre_impl___timer_settime50( \ - (long long)(timerid), (long long)(flags), (long long)(value), \ - (long long)(ovalue)) -#define __sanitizer_syscall_post___timer_settime50(res, timerid, flags, value, \ - ovalue) \ - __sanitizer_syscall_post_impl___timer_settime50( \ - res, (long long)(timerid), (long long)(flags), (long long)(value), \ - (long long)(ovalue)) -#define __sanitizer_syscall_pre___timer_gettime50(timerid, value) \ - __sanitizer_syscall_pre_impl___timer_gettime50((long long)(timerid), \ - (long long)(value)) -#define __sanitizer_syscall_post___timer_gettime50(res, timerid, value) \ - __sanitizer_syscall_post_impl___timer_gettime50(res, (long long)(timerid), \ - (long long)(value)) -#if defined(NTP) || !defined(_KERNEL_OPT) -#define __sanitizer_syscall_pre___ntp_gettime50(ntvp) \ - __sanitizer_syscall_pre_impl___ntp_gettime50((long long)(ntvp)) -#define __sanitizer_syscall_post___ntp_gettime50(res, ntvp) \ - __sanitizer_syscall_post_impl___ntp_gettime50(res, (long long)(ntvp)) -#else -/* syscall 448 has been skipped */ -#endif -#define __sanitizer_syscall_pre___wait450(pid, status, options, rusage) \ - __sanitizer_syscall_pre_impl___wait450( \ - (long long)(pid), (long long)(status), (long long)(options), \ - (long long)(rusage)) -#define __sanitizer_syscall_post___wait450(res, pid, status, options, rusage) \ - __sanitizer_syscall_post_impl___wait450( \ - res, (long long)(pid), (long long)(status), (long long)(options), \ - (long long)(rusage)) -#define __sanitizer_syscall_pre___mknod50(path, mode, dev) \ - __sanitizer_syscall_pre_impl___mknod50((long long)(path), (long long)(mode), \ - (long long)(dev)) -#define __sanitizer_syscall_post___mknod50(res, path, mode, dev) \ - __sanitizer_syscall_post_impl___mknod50(res, (long long)(path), \ - (long long)(mode), (long long)(dev)) -#define __sanitizer_syscall_pre___fhstat50(fhp, fh_size, sb) \ - __sanitizer_syscall_pre_impl___fhstat50( \ - (long long)(fhp), (long long)(fh_size), (long long)(sb)) -#define __sanitizer_syscall_post___fhstat50(res, fhp, fh_size, sb) \ - __sanitizer_syscall_post_impl___fhstat50( \ - res, (long long)(fhp), (long long)(fh_size), (long long)(sb)) -/* syscall 452 has been skipped */ -#define __sanitizer_syscall_pre_pipe2(fildes, flags) \ - __sanitizer_syscall_pre_impl_pipe2((long long)(fildes), (long long)(flags)) -#define __sanitizer_syscall_post_pipe2(res, fildes, flags) \ - __sanitizer_syscall_post_impl_pipe2(res, (long long)(fildes), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_dup3(from, to, flags) \ - __sanitizer_syscall_pre_impl_dup3((long long)(from), (long long)(to), \ - (long long)(flags)) -#define __sanitizer_syscall_post_dup3(res, from, to, flags) \ - __sanitizer_syscall_post_impl_dup3(res, (long long)(from), (long long)(to), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_kqueue1(flags) \ - __sanitizer_syscall_pre_impl_kqueue1((long long)(flags)) -#define __sanitizer_syscall_post_kqueue1(res, flags) \ - __sanitizer_syscall_post_impl_kqueue1(res, (long long)(flags)) -#define __sanitizer_syscall_pre_paccept(s, name, anamelen, mask, flags) \ - __sanitizer_syscall_pre_impl_paccept((long long)(s), (long long)(name), \ - (long long)(anamelen), \ - (long long)(mask), (long long)(flags)) -#define __sanitizer_syscall_post_paccept(res, s, name, anamelen, mask, flags) \ - __sanitizer_syscall_post_impl_paccept( \ - res, (long long)(s), (long long)(name), (long long)(anamelen), \ - (long long)(mask), (long long)(flags)) -#define __sanitizer_syscall_pre_linkat(fd1, name1, fd2, name2, flags) \ - __sanitizer_syscall_pre_impl_linkat((long long)(fd1), (long long)(name1), \ - (long long)(fd2), (long long)(name2), \ - (long long)(flags)) -#define __sanitizer_syscall_post_linkat(res, fd1, name1, fd2, name2, flags) \ - __sanitizer_syscall_post_impl_linkat(res, (long long)(fd1), \ - (long long)(name1), (long long)(fd2), \ - (long long)(name2), (long long)(flags)) -#define __sanitizer_syscall_pre_renameat(fromfd, from, tofd, to) \ - __sanitizer_syscall_pre_impl_renameat((long long)(fromfd), \ - (long long)(from), (long long)(tofd), \ - (long long)(to)) -#define __sanitizer_syscall_post_renameat(res, fromfd, from, tofd, to) \ - __sanitizer_syscall_post_impl_renameat(res, (long long)(fromfd), \ - (long long)(from), (long long)(tofd), \ - (long long)(to)) -#define __sanitizer_syscall_pre_mkfifoat(fd, path, mode) \ - __sanitizer_syscall_pre_impl_mkfifoat((long long)(fd), (long long)(path), \ - (long long)(mode)) -#define __sanitizer_syscall_post_mkfifoat(res, fd, path, mode) \ - __sanitizer_syscall_post_impl_mkfifoat(res, (long long)(fd), \ - (long long)(path), (long long)(mode)) -#define __sanitizer_syscall_pre_mknodat(fd, path, mode, PAD, dev) \ - __sanitizer_syscall_pre_impl_mknodat((long long)(fd), (long long)(path), \ - (long long)(mode), (long long)(PAD), \ - (long long)(dev)) -#define __sanitizer_syscall_post_mknodat(res, fd, path, mode, PAD, dev) \ - __sanitizer_syscall_post_impl_mknodat(res, (long long)(fd), \ - (long long)(path), (long long)(mode), \ - (long long)(PAD), (long long)(dev)) -#define __sanitizer_syscall_pre_mkdirat(fd, path, mode) \ - __sanitizer_syscall_pre_impl_mkdirat((long long)(fd), (long long)(path), \ - (long long)(mode)) -#define __sanitizer_syscall_post_mkdirat(res, fd, path, mode) \ - __sanitizer_syscall_post_impl_mkdirat(res, (long long)(fd), \ - (long long)(path), (long long)(mode)) -#define __sanitizer_syscall_pre_faccessat(fd, path, amode, flag) \ - __sanitizer_syscall_pre_impl_faccessat((long long)(fd), (long long)(path), \ - (long long)(amode), \ - (long long)(flag)) -#define __sanitizer_syscall_post_faccessat(res, fd, path, amode, flag) \ - __sanitizer_syscall_post_impl_faccessat( \ - res, (long long)(fd), (long long)(path), (long long)(amode), \ - (long long)(flag)) -#define __sanitizer_syscall_pre_fchmodat(fd, path, mode, flag) \ - __sanitizer_syscall_pre_impl_fchmodat((long long)(fd), (long long)(path), \ - (long long)(mode), (long long)(flag)) -#define __sanitizer_syscall_post_fchmodat(res, fd, path, mode, flag) \ - __sanitizer_syscall_post_impl_fchmodat(res, (long long)(fd), \ - (long long)(path), (long long)(mode), \ - (long long)(flag)) -#define __sanitizer_syscall_pre_fchownat(fd, path, owner, group, flag) \ - __sanitizer_syscall_pre_impl_fchownat((long long)(fd), (long long)(path), \ - (long long)(owner), \ - (long long)(group), (long long)(flag)) -#define __sanitizer_syscall_post_fchownat(res, fd, path, owner, group, flag) \ - __sanitizer_syscall_post_impl_fchownat( \ - res, (long long)(fd), (long long)(path), (long long)(owner), \ - (long long)(group), (long long)(flag)) -#define __sanitizer_syscall_pre_fexecve(fd, argp, envp) \ - __sanitizer_syscall_pre_impl_fexecve((long long)(fd), (long long)(argp), \ - (long long)(envp)) -#define __sanitizer_syscall_post_fexecve(res, fd, argp, envp) \ - __sanitizer_syscall_post_impl_fexecve(res, (long long)(fd), \ - (long long)(argp), (long long)(envp)) -#define __sanitizer_syscall_pre_fstatat(fd, path, buf, flag) \ - __sanitizer_syscall_pre_impl_fstatat((long long)(fd), (long long)(path), \ - (long long)(buf), (long long)(flag)) -#define __sanitizer_syscall_post_fstatat(res, fd, path, buf, flag) \ - __sanitizer_syscall_post_impl_fstatat(res, (long long)(fd), \ - (long long)(path), (long long)(buf), \ - (long long)(flag)) -#define __sanitizer_syscall_pre_utimensat(fd, path, tptr, flag) \ - __sanitizer_syscall_pre_impl_utimensat((long long)(fd), (long long)(path), \ - (long long)(tptr), (long long)(flag)) -#define __sanitizer_syscall_post_utimensat(res, fd, path, tptr, flag) \ - __sanitizer_syscall_post_impl_utimensat( \ - res, (long long)(fd), (long long)(path), (long long)(tptr), \ - (long long)(flag)) -#define __sanitizer_syscall_pre_openat(fd, path, oflags, mode) \ - __sanitizer_syscall_pre_impl_openat((long long)(fd), (long long)(path), \ - (long long)(oflags), (long long)(mode)) -#define __sanitizer_syscall_post_openat(res, fd, path, oflags, mode) \ - __sanitizer_syscall_post_impl_openat(res, (long long)(fd), \ - (long long)(path), (long long)(oflags), \ - (long long)(mode)) -#define __sanitizer_syscall_pre_readlinkat(fd, path, buf, bufsize) \ - __sanitizer_syscall_pre_impl_readlinkat((long long)(fd), (long long)(path), \ - (long long)(buf), \ - (long long)(bufsize)) -#define __sanitizer_syscall_post_readlinkat(res, fd, path, buf, bufsize) \ - __sanitizer_syscall_post_impl_readlinkat( \ - res, (long long)(fd), (long long)(path), (long long)(buf), \ - (long long)(bufsize)) -#define __sanitizer_syscall_pre_symlinkat(path1, fd, path2) \ - __sanitizer_syscall_pre_impl_symlinkat((long long)(path1), (long long)(fd), \ - (long long)(path2)) -#define __sanitizer_syscall_post_symlinkat(res, path1, fd, path2) \ - __sanitizer_syscall_post_impl_symlinkat(res, (long long)(path1), \ - (long long)(fd), (long long)(path2)) -#define __sanitizer_syscall_pre_unlinkat(fd, path, flag) \ - __sanitizer_syscall_pre_impl_unlinkat((long long)(fd), (long long)(path), \ - (long long)(flag)) -#define __sanitizer_syscall_post_unlinkat(res, fd, path, flag) \ - __sanitizer_syscall_post_impl_unlinkat(res, (long long)(fd), \ - (long long)(path), (long long)(flag)) -#define __sanitizer_syscall_pre_futimens(fd, tptr) \ - __sanitizer_syscall_pre_impl_futimens((long long)(fd), (long long)(tptr)) -#define __sanitizer_syscall_post_futimens(res, fd, tptr) \ - __sanitizer_syscall_post_impl_futimens(res, (long long)(fd), \ - (long long)(tptr)) -#define __sanitizer_syscall_pre___quotactl(path, args) \ - __sanitizer_syscall_pre_impl___quotactl((long long)(path), (long long)(args)) -#define __sanitizer_syscall_post___quotactl(res, path, args) \ - __sanitizer_syscall_post_impl___quotactl(res, (long long)(path), \ - (long long)(args)) -#define __sanitizer_syscall_pre_posix_spawn(pid, path, file_actions, attrp, \ - argv, envp) \ - __sanitizer_syscall_pre_impl_posix_spawn( \ - (long long)(pid), (long long)(path), (long long)(file_actions), \ - (long long)(attrp), (long long)(argv), (long long)(envp)) -#define __sanitizer_syscall_post_posix_spawn(res, pid, path, file_actions, \ - attrp, argv, envp) \ - __sanitizer_syscall_post_impl_posix_spawn( \ - res, (long long)(pid), (long long)(path), (long long)(file_actions), \ - (long long)(attrp), (long long)(argv), (long long)(envp)) -#define __sanitizer_syscall_pre_recvmmsg(s, mmsg, vlen, flags, timeout) \ - __sanitizer_syscall_pre_impl_recvmmsg((long long)(s), (long long)(mmsg), \ - (long long)(vlen), (long long)(flags), \ - (long long)(timeout)) -#define __sanitizer_syscall_post_recvmmsg(res, s, mmsg, vlen, flags, timeout) \ - __sanitizer_syscall_post_impl_recvmmsg( \ - res, (long long)(s), (long long)(mmsg), (long long)(vlen), \ - (long long)(flags), (long long)(timeout)) -#define __sanitizer_syscall_pre_sendmmsg(s, mmsg, vlen, flags) \ - __sanitizer_syscall_pre_impl_sendmmsg((long long)(s), (long long)(mmsg), \ - (long long)(vlen), (long long)(flags)) -#define __sanitizer_syscall_post_sendmmsg(res, s, mmsg, vlen, flags) \ - __sanitizer_syscall_post_impl_sendmmsg(res, (long long)(s), \ - (long long)(mmsg), (long long)(vlen), \ - (long long)(flags)) -#define __sanitizer_syscall_pre_clock_nanosleep(clock_id, flags, rqtp, rmtp) \ - __sanitizer_syscall_pre_impl_clock_nanosleep( \ - (long long)(clock_id), (long long)(flags), (long long)(rqtp), \ - (long long)(rmtp)) -#define __sanitizer_syscall_post_clock_nanosleep(res, clock_id, flags, rqtp, \ - rmtp) \ - __sanitizer_syscall_post_impl_clock_nanosleep( \ - res, (long long)(clock_id), (long long)(flags), (long long)(rqtp), \ - (long long)(rmtp)) -#define __sanitizer_syscall_pre____lwp_park60(clock_id, flags, ts, unpark, \ - hint, unparkhint) \ - __sanitizer_syscall_pre_impl____lwp_park60( \ - (long long)(clock_id), (long long)(flags), (long long)(ts), \ - (long long)(unpark), (long long)(hint), (long long)(unparkhint)) -#define __sanitizer_syscall_post____lwp_park60(res, clock_id, flags, ts, \ - unpark, hint, unparkhint) \ - __sanitizer_syscall_post_impl____lwp_park60( \ - res, (long long)(clock_id), (long long)(flags), (long long)(ts), \ - (long long)(unpark), (long long)(hint), (long long)(unparkhint)) -#define __sanitizer_syscall_pre_posix_fallocate(fd, PAD, pos, len) \ - __sanitizer_syscall_pre_impl_posix_fallocate( \ - (long long)(fd), (long long)(PAD), (long long)(pos), (long long)(len)) -#define __sanitizer_syscall_post_posix_fallocate(res, fd, PAD, pos, len) \ - __sanitizer_syscall_post_impl_posix_fallocate( \ - res, (long long)(fd), (long long)(PAD), (long long)(pos), \ - (long long)(len)) -#define __sanitizer_syscall_pre_fdiscard(fd, PAD, pos, len) \ - __sanitizer_syscall_pre_impl_fdiscard((long long)(fd), (long long)(PAD), \ - (long long)(pos), (long long)(len)) -#define __sanitizer_syscall_post_fdiscard(res, fd, PAD, pos, len) \ - __sanitizer_syscall_post_impl_fdiscard(res, (long long)(fd), \ - (long long)(PAD), (long long)(pos), \ - (long long)(len)) -#define __sanitizer_syscall_pre_wait6(idtype, id, status, options, wru, info) \ - __sanitizer_syscall_pre_impl_wait6( \ - (long long)(idtype), (long long)(id), (long long)(status), \ - (long long)(options), (long long)(wru), (long long)(info)) -#define __sanitizer_syscall_post_wait6(res, idtype, id, status, options, wru, \ - info) \ - __sanitizer_syscall_post_impl_wait6( \ - res, (long long)(idtype), (long long)(id), (long long)(status), \ - (long long)(options), (long long)(wru), (long long)(info)) -#define __sanitizer_syscall_pre_clock_getcpuclockid2(idtype, id, clock_id) \ - __sanitizer_syscall_pre_impl_clock_getcpuclockid2( \ - (long long)(idtype), (long long)(id), (long long)(clock_id)) -#define __sanitizer_syscall_post_clock_getcpuclockid2(res, idtype, id, \ - clock_id) \ - __sanitizer_syscall_post_impl_clock_getcpuclockid2( \ - res, (long long)(idtype), (long long)(id), (long long)(clock_id)) -#define __sanitizer_syscall_pre___getvfsstat90(buf, bufsize, flags) \ - __sanitizer_syscall_pre_impl___getvfsstat90( \ - (long long)(buf), (long long)(bufsize), (long long)(flags)) -#define __sanitizer_syscall_post___getvfsstat90(res, buf, bufsize, flags) \ - __sanitizer_syscall_post_impl___getvfsstat90( \ - res, (long long)(buf), (long long)(bufsize), (long long)(flags)) -#define __sanitizer_syscall_pre___statvfs190(path, buf, flags) \ - __sanitizer_syscall_pre_impl___statvfs190( \ - (long long)(path), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_post___statvfs190(res, path, buf, flags) \ - __sanitizer_syscall_post_impl___statvfs190( \ - res, (long long)(path), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_pre___fstatvfs190(fd, buf, flags) \ - __sanitizer_syscall_pre_impl___fstatvfs190( \ - (long long)(fd), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_post___fstatvfs190(res, fd, buf, flags) \ - __sanitizer_syscall_post_impl___fstatvfs190( \ - res, (long long)(fd), (long long)(buf), (long long)(flags)) -#define __sanitizer_syscall_pre___fhstatvfs190(fhp, fh_size, buf, flags) \ - __sanitizer_syscall_pre_impl___fhstatvfs190( \ - (long long)(fhp), (long long)(fh_size), (long long)(buf), \ - (long long)(flags)) -#define __sanitizer_syscall_post___fhstatvfs190(res, fhp, fh_size, buf, flags) \ - __sanitizer_syscall_post_impl___fhstatvfs190( \ - res, (long long)(fhp), (long long)(fh_size), (long long)(buf), \ - (long long)(flags)) -#define __sanitizer_syscall_pre___acl_get_link(path, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_get_link( \ - (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_get_link(res, path, type, aclp) \ - __sanitizer_syscall_post_impl___acl_get_link( \ - res, (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre___acl_set_link(path, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_set_link( \ - (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_set_link(res, path, type, aclp) \ - __sanitizer_syscall_post_impl___acl_set_link( \ - res, (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre___acl_delete_link(path, type) \ - __sanitizer_syscall_pre_impl___acl_delete_link((long long)(path), \ - (long long)(type)) -#define __sanitizer_syscall_post___acl_delete_link(res, path, type) \ - __sanitizer_syscall_post_impl___acl_delete_link(res, (long long)(path), \ - (long long)(type)) -#define __sanitizer_syscall_pre___acl_aclcheck_link(path, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_aclcheck_link( \ - (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_aclcheck_link(res, path, type, aclp) \ - __sanitizer_syscall_post_impl___acl_aclcheck_link( \ - res, (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre___acl_get_file(path, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_get_file( \ - (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_get_file(res, path, type, aclp) \ - __sanitizer_syscall_post_impl___acl_get_file( \ - res, (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre___acl_set_file(path, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_set_file( \ - (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_set_file(res, path, type, aclp) \ - __sanitizer_syscall_post_impl___acl_set_file( \ - res, (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre___acl_get_fd(filedes, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_get_fd( \ - (long long)(filedes), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_get_fd(res, filedes, type, aclp) \ - __sanitizer_syscall_post_impl___acl_get_fd( \ - res, (long long)(filedes), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre___acl_set_fd(filedes, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_set_fd( \ - (long long)(filedes), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_set_fd(res, filedes, type, aclp) \ - __sanitizer_syscall_post_impl___acl_set_fd( \ - res, (long long)(filedes), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre___acl_delete_file(path, type) \ - __sanitizer_syscall_pre_impl___acl_delete_file((long long)(path), \ - (long long)(type)) -#define __sanitizer_syscall_post___acl_delete_file(res, path, type) \ - __sanitizer_syscall_post_impl___acl_delete_file(res, (long long)(path), \ - (long long)(type)) -#define __sanitizer_syscall_pre___acl_delete_fd(filedes, type) \ - __sanitizer_syscall_pre_impl___acl_delete_fd((long long)(filedes), \ - (long long)(type)) -#define __sanitizer_syscall_post___acl_delete_fd(res, filedes, type) \ - __sanitizer_syscall_post_impl___acl_delete_fd(res, (long long)(filedes), \ - (long long)(type)) -#define __sanitizer_syscall_pre___acl_aclcheck_file(path, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_aclcheck_file( \ - (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_aclcheck_file(res, path, type, aclp) \ - __sanitizer_syscall_post_impl___acl_aclcheck_file( \ - res, (long long)(path), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre___acl_aclcheck_fd(filedes, type, aclp) \ - __sanitizer_syscall_pre_impl___acl_aclcheck_fd( \ - (long long)(filedes), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_post___acl_aclcheck_fd(res, filedes, type, aclp) \ - __sanitizer_syscall_post_impl___acl_aclcheck_fd( \ - res, (long long)(filedes), (long long)(type), (long long)(aclp)) -#define __sanitizer_syscall_pre_lpathconf(path, name) \ - __sanitizer_syscall_pre_impl_lpathconf((long long)(path), (long long)(name)) -#define __sanitizer_syscall_post_lpathconf(res, path, name) \ - __sanitizer_syscall_post_impl_lpathconf(res, (long long)(path), \ - (long long)(name)) - -/* Compat with older releases */ -#define __sanitizer_syscall_pre_getvfsstat \ - __sanitizer_syscall_pre_compat_90_getvfsstat -#define __sanitizer_syscall_post_getvfsstat \ - __sanitizer_syscall_post_compat_90_getvfsstat - -#define __sanitizer_syscall_pre_statvfs1 \ - __sanitizer_syscall_pre_compat_90_statvfs1 -#define __sanitizer_syscall_post_statvfs1 \ - __sanitizer_syscall_post_compat_90_statvfs1 - -#define __sanitizer_syscall_pre_fstatvfs1 \ - __sanitizer_syscall_pre_compat_90_fstatvfs1 -#define __sanitizer_syscall_post_fstatvfs1 \ - __sanitizer_syscall_post_compat_90_fstatvfs1 - -#define __sanitizer_syscall_pre___fhstatvfs140 \ - __sanitizer_syscall_pre_compat_90_fhstatvfs1 -#define __sanitizer_syscall_post___fhstatvfs140 \ - __sanitizer_syscall_post_compat_90_fhstatvfs1 - -#ifdef __cplusplus -extern "C" { -#endif - -// Private declarations. Do not call directly from user code. Use macros above. - -// DO NOT EDIT! THIS FILE HAS BEEN GENERATED! - -void __sanitizer_syscall_pre_impl_syscall(long long code, long long arg0, - long long arg1, long long arg2, - long long arg3, long long arg4, - long long arg5, long long arg6, - long long arg7); -void __sanitizer_syscall_post_impl_syscall(long long res, long long code, - long long arg0, long long arg1, - long long arg2, long long arg3, - long long arg4, long long arg5, - long long arg6, long long arg7); -void __sanitizer_syscall_pre_impl_exit(long long rval); -void __sanitizer_syscall_post_impl_exit(long long res, long long rval); -void __sanitizer_syscall_pre_impl_fork(void); -void __sanitizer_syscall_post_impl_fork(long long res); -void __sanitizer_syscall_pre_impl_read(long long fd, long long buf, - long long nbyte); -void __sanitizer_syscall_post_impl_read(long long res, long long fd, - long long buf, long long nbyte); -void __sanitizer_syscall_pre_impl_write(long long fd, long long buf, - long long nbyte); -void __sanitizer_syscall_post_impl_write(long long res, long long fd, - long long buf, long long nbyte); -void __sanitizer_syscall_pre_impl_open(long long path, long long flags, - long long mode); -void __sanitizer_syscall_post_impl_open(long long res, long long path, - long long flags, long long mode); -void __sanitizer_syscall_pre_impl_close(long long fd); -void __sanitizer_syscall_post_impl_close(long long res, long long fd); -void __sanitizer_syscall_pre_impl_compat_50_wait4(long long pid, - long long status, - long long options, - long long rusage); -void __sanitizer_syscall_post_impl_compat_50_wait4(long long res, long long pid, - long long status, - long long options, - long long rusage); -void __sanitizer_syscall_pre_impl_compat_43_ocreat(long long path, - long long mode); -void __sanitizer_syscall_post_impl_compat_43_ocreat(long long res, - long long path, - long long mode); -void __sanitizer_syscall_pre_impl_link(long long path, long long link); -void __sanitizer_syscall_post_impl_link(long long res, long long path, - long long link); -void __sanitizer_syscall_pre_impl_unlink(long long path); -void __sanitizer_syscall_post_impl_unlink(long long res, long long path); -/* syscall 11 has been skipped */ -void __sanitizer_syscall_pre_impl_chdir(long long path); -void __sanitizer_syscall_post_impl_chdir(long long res, long long path); -void __sanitizer_syscall_pre_impl_fchdir(long long fd); -void __sanitizer_syscall_post_impl_fchdir(long long res, long long fd); -void __sanitizer_syscall_pre_impl_compat_50_mknod(long long path, - long long mode, - long long dev); -void __sanitizer_syscall_post_impl_compat_50_mknod(long long res, - long long path, - long long mode, - long long dev); -void __sanitizer_syscall_pre_impl_chmod(long long path, long long mode); -void __sanitizer_syscall_post_impl_chmod(long long res, long long path, - long long mode); -void __sanitizer_syscall_pre_impl_chown(long long path, long long uid, - long long gid); -void __sanitizer_syscall_post_impl_chown(long long res, long long path, - long long uid, long long gid); -void __sanitizer_syscall_pre_impl_break(long long nsize); -void __sanitizer_syscall_post_impl_break(long long res, long long nsize); -void __sanitizer_syscall_pre_impl_compat_20_getfsstat(long long buf, - long long bufsize, - long long flags); -void __sanitizer_syscall_post_impl_compat_20_getfsstat(long long res, - long long buf, - long long bufsize, - long long flags); -void __sanitizer_syscall_pre_impl_compat_43_olseek(long long fd, - long long offset, - long long whence); -void __sanitizer_syscall_post_impl_compat_43_olseek(long long res, long long fd, - long long offset, - long long whence); -void __sanitizer_syscall_pre_impl_getpid(void); -void __sanitizer_syscall_post_impl_getpid(long long res); -void __sanitizer_syscall_pre_impl_compat_40_mount(long long type, - long long path, - long long flags, - long long data); -void __sanitizer_syscall_post_impl_compat_40_mount(long long res, - long long type, - long long path, - long long flags, - long long data); -void __sanitizer_syscall_pre_impl_unmount(long long path, long long flags); -void __sanitizer_syscall_post_impl_unmount(long long res, long long path, - long long flags); -void __sanitizer_syscall_pre_impl_setuid(long long uid); -void __sanitizer_syscall_post_impl_setuid(long long res, long long uid); -void __sanitizer_syscall_pre_impl_getuid(void); -void __sanitizer_syscall_post_impl_getuid(long long res); -void __sanitizer_syscall_pre_impl_geteuid(void); -void __sanitizer_syscall_post_impl_geteuid(long long res); -void __sanitizer_syscall_pre_impl_ptrace(long long req, long long pid, - long long addr, long long data); -void __sanitizer_syscall_post_impl_ptrace(long long res, long long req, - long long pid, long long addr, - long long data); -void __sanitizer_syscall_pre_impl_recvmsg(long long s, long long msg, - long long flags); -void __sanitizer_syscall_post_impl_recvmsg(long long res, long long s, - long long msg, long long flags); -void __sanitizer_syscall_pre_impl_sendmsg(long long s, long long msg, - long long flags); -void __sanitizer_syscall_post_impl_sendmsg(long long res, long long s, - long long msg, long long flags); -void __sanitizer_syscall_pre_impl_recvfrom(long long s, long long buf, - long long len, long long flags, - long long from, - long long fromlenaddr); -void __sanitizer_syscall_post_impl_recvfrom(long long res, long long s, - long long buf, long long len, - long long flags, long long from, - long long fromlenaddr); -void __sanitizer_syscall_pre_impl_accept(long long s, long long name, - long long anamelen); -void __sanitizer_syscall_post_impl_accept(long long res, long long s, - long long name, long long anamelen); -void __sanitizer_syscall_pre_impl_getpeername(long long fdes, long long asa, - long long alen); -void __sanitizer_syscall_post_impl_getpeername(long long res, long long fdes, - long long asa, long long alen); -void __sanitizer_syscall_pre_impl_getsockname(long long fdes, long long asa, - long long alen); -void __sanitizer_syscall_post_impl_getsockname(long long res, long long fdes, - long long asa, long long alen); -void __sanitizer_syscall_pre_impl_access(long long path, long long flags); -void __sanitizer_syscall_post_impl_access(long long res, long long path, - long long flags); -void __sanitizer_syscall_pre_impl_chflags(long long path, long long flags); -void __sanitizer_syscall_post_impl_chflags(long long res, long long path, - long long flags); -void __sanitizer_syscall_pre_impl_fchflags(long long fd, long long flags); -void __sanitizer_syscall_post_impl_fchflags(long long res, long long fd, - long long flags); -void __sanitizer_syscall_pre_impl_sync(void); -void __sanitizer_syscall_post_impl_sync(long long res); -void __sanitizer_syscall_pre_impl_kill(long long pid, long long signum); -void __sanitizer_syscall_post_impl_kill(long long res, long long pid, - long long signum); -void __sanitizer_syscall_pre_impl_compat_43_stat43(long long path, - long long ub); -void __sanitizer_syscall_post_impl_compat_43_stat43(long long res, - long long path, - long long ub); -void __sanitizer_syscall_pre_impl_getppid(void); -void __sanitizer_syscall_post_impl_getppid(long long res); -void __sanitizer_syscall_pre_impl_compat_43_lstat43(long long path, - long long ub); -void __sanitizer_syscall_post_impl_compat_43_lstat43(long long res, - long long path, - long long ub); -void __sanitizer_syscall_pre_impl_dup(long long fd); -void __sanitizer_syscall_post_impl_dup(long long res, long long fd); -void __sanitizer_syscall_pre_impl_pipe(void); -void __sanitizer_syscall_post_impl_pipe(long long res); -void __sanitizer_syscall_pre_impl_getegid(void); -void __sanitizer_syscall_post_impl_getegid(long long res); -void __sanitizer_syscall_pre_impl_profil(long long samples, long long size, - long long offset, long long scale); -void __sanitizer_syscall_post_impl_profil(long long res, long long samples, - long long size, long long offset, - long long scale); -void __sanitizer_syscall_pre_impl_ktrace(long long fname, long long ops, - long long facs, long long pid); -void __sanitizer_syscall_post_impl_ktrace(long long res, long long fname, - long long ops, long long facs, - long long pid); -void __sanitizer_syscall_pre_impl_compat_13_sigaction13(long long signum, - long long nsa, - long long osa); -void __sanitizer_syscall_post_impl_compat_13_sigaction13(long long res, - long long signum, - long long nsa, - long long osa); -void __sanitizer_syscall_pre_impl_getgid(void); -void __sanitizer_syscall_post_impl_getgid(long long res); -void __sanitizer_syscall_pre_impl_compat_13_sigprocmask13(long long how, - long long mask); -void __sanitizer_syscall_post_impl_compat_13_sigprocmask13(long long res, - long long how, - long long mask); -void __sanitizer_syscall_pre_impl___getlogin(long long namebuf, - long long namelen); -void __sanitizer_syscall_post_impl___getlogin(long long res, long long namebuf, - long long namelen); -void __sanitizer_syscall_pre_impl___setlogin(long long namebuf); -void __sanitizer_syscall_post_impl___setlogin(long long res, long long namebuf); -void __sanitizer_syscall_pre_impl_acct(long long path); -void __sanitizer_syscall_post_impl_acct(long long res, long long path); -void __sanitizer_syscall_pre_impl_compat_13_sigpending13(void); -void __sanitizer_syscall_post_impl_compat_13_sigpending13(long long res); -void __sanitizer_syscall_pre_impl_compat_13_sigaltstack13(long long nss, - long long oss); -void __sanitizer_syscall_post_impl_compat_13_sigaltstack13(long long res, - long long nss, - long long oss); -void __sanitizer_syscall_pre_impl_ioctl(long long fd, long long com, - long long data); -void __sanitizer_syscall_post_impl_ioctl(long long res, long long fd, - long long com, long long data); -void __sanitizer_syscall_pre_impl_compat_12_oreboot(long long opt); -void __sanitizer_syscall_post_impl_compat_12_oreboot(long long res, - long long opt); -void __sanitizer_syscall_pre_impl_revoke(long long path); -void __sanitizer_syscall_post_impl_revoke(long long res, long long path); -void __sanitizer_syscall_pre_impl_symlink(long long path, long long link); -void __sanitizer_syscall_post_impl_symlink(long long res, long long path, - long long link); -void __sanitizer_syscall_pre_impl_readlink(long long path, long long buf, - long long count); -void __sanitizer_syscall_post_impl_readlink(long long res, long long path, - long long buf, long long count); -void __sanitizer_syscall_pre_impl_execve(long long path, long long argp, - long long envp); -void __sanitizer_syscall_post_impl_execve(long long res, long long path, - long long argp, long long envp); -void __sanitizer_syscall_pre_impl_umask(long long newmask); -void __sanitizer_syscall_post_impl_umask(long long res, long long newmask); -void __sanitizer_syscall_pre_impl_chroot(long long path); -void __sanitizer_syscall_post_impl_chroot(long long res, long long path); -void __sanitizer_syscall_pre_impl_compat_43_fstat43(long long fd, long long sb); -void __sanitizer_syscall_post_impl_compat_43_fstat43(long long res, - long long fd, - long long sb); -void __sanitizer_syscall_pre_impl_compat_43_ogetkerninfo(long long op, - long long where, - long long size, - long long arg); -void __sanitizer_syscall_post_impl_compat_43_ogetkerninfo(long long res, - long long op, - long long where, - long long size, - long long arg); -void __sanitizer_syscall_pre_impl_compat_43_ogetpagesize(void); -void __sanitizer_syscall_post_impl_compat_43_ogetpagesize(long long res); -void __sanitizer_syscall_pre_impl_compat_12_msync(long long addr, - long long len); -void __sanitizer_syscall_post_impl_compat_12_msync(long long res, - long long addr, - long long len); -void __sanitizer_syscall_pre_impl_vfork(void); -void __sanitizer_syscall_post_impl_vfork(long long res); -/* syscall 67 has been skipped */ -/* syscall 68 has been skipped */ -/* syscall 69 has been skipped */ -/* syscall 70 has been skipped */ -void __sanitizer_syscall_pre_impl_compat_43_ommap(long long addr, long long len, - long long prot, - long long flags, long long fd, - long long pos); -void __sanitizer_syscall_post_impl_compat_43_ommap( - long long res, long long addr, long long len, long long prot, - long long flags, long long fd, long long pos); -void __sanitizer_syscall_pre_impl_vadvise(long long anom); -void __sanitizer_syscall_post_impl_vadvise(long long res, long long anom); -void __sanitizer_syscall_pre_impl_munmap(long long addr, long long len); -void __sanitizer_syscall_post_impl_munmap(long long res, long long addr, - long long len); -void __sanitizer_syscall_pre_impl_mprotect(long long addr, long long len, - long long prot); -void __sanitizer_syscall_post_impl_mprotect(long long res, long long addr, - long long len, long long prot); -void __sanitizer_syscall_pre_impl_madvise(long long addr, long long len, - long long behav); -void __sanitizer_syscall_post_impl_madvise(long long res, long long addr, - long long len, long long behav); -/* syscall 76 has been skipped */ -/* syscall 77 has been skipped */ -void __sanitizer_syscall_pre_impl_mincore(long long addr, long long len, - long long vec); -void __sanitizer_syscall_post_impl_mincore(long long res, long long addr, - long long len, long long vec); -void __sanitizer_syscall_pre_impl_getgroups(long long gidsetsize, - long long gidset); -void __sanitizer_syscall_post_impl_getgroups(long long res, - long long gidsetsize, - long long gidset); -void __sanitizer_syscall_pre_impl_setgroups(long long gidsetsize, - long long gidset); -void __sanitizer_syscall_post_impl_setgroups(long long res, - long long gidsetsize, - long long gidset); -void __sanitizer_syscall_pre_impl_getpgrp(void); -void __sanitizer_syscall_post_impl_getpgrp(long long res); -void __sanitizer_syscall_pre_impl_setpgid(long long pid, long long pgid); -void __sanitizer_syscall_post_impl_setpgid(long long res, long long pid, - long long pgid); -void __sanitizer_syscall_pre_impl_compat_50_setitimer(long long which, - long long itv, - long long oitv); -void __sanitizer_syscall_post_impl_compat_50_setitimer(long long res, - long long which, - long long itv, - long long oitv); -void __sanitizer_syscall_pre_impl_compat_43_owait(void); -void __sanitizer_syscall_post_impl_compat_43_owait(long long res); -void __sanitizer_syscall_pre_impl_compat_12_oswapon(long long name); -void __sanitizer_syscall_post_impl_compat_12_oswapon(long long res, - long long name); -void __sanitizer_syscall_pre_impl_compat_50_getitimer(long long which, - long long itv); -void __sanitizer_syscall_post_impl_compat_50_getitimer(long long res, - long long which, - long long itv); -void __sanitizer_syscall_pre_impl_compat_43_ogethostname(long long hostname, - long long len); -void __sanitizer_syscall_post_impl_compat_43_ogethostname(long long res, - long long hostname, - long long len); -void __sanitizer_syscall_pre_impl_compat_43_osethostname(long long hostname, - long long len); -void __sanitizer_syscall_post_impl_compat_43_osethostname(long long res, - long long hostname, - long long len); -void __sanitizer_syscall_pre_impl_compat_43_ogetdtablesize(void); -void __sanitizer_syscall_post_impl_compat_43_ogetdtablesize(long long res); -void __sanitizer_syscall_pre_impl_dup2(long long from, long long to); -void __sanitizer_syscall_post_impl_dup2(long long res, long long from, - long long to); -void __sanitizer_syscall_pre_impl_getrandom(long long buf, long long buflen, - long long flags); -void __sanitizer_syscall_post_impl_getrandom(long long res, long long buf, - long long buflen, long long flags); -void __sanitizer_syscall_pre_impl_fcntl(long long fd, long long cmd, - long long arg); -void __sanitizer_syscall_post_impl_fcntl(long long res, long long fd, - long long cmd, long long arg); -void __sanitizer_syscall_pre_impl_compat_50_select(long long nd, long long in, - long long ou, long long ex, - long long tv); -void __sanitizer_syscall_post_impl_compat_50_select(long long res, long long nd, - long long in, long long ou, - long long ex, long long tv); -/* syscall 94 has been skipped */ -void __sanitizer_syscall_pre_impl_fsync(long long fd); -void __sanitizer_syscall_post_impl_fsync(long long res, long long fd); -void __sanitizer_syscall_pre_impl_setpriority(long long which, long long who, - long long prio); -void __sanitizer_syscall_post_impl_setpriority(long long res, long long which, - long long who, long long prio); -void __sanitizer_syscall_pre_impl_compat_30_socket(long long domain, - long long type, - long long protocol); -void __sanitizer_syscall_post_impl_compat_30_socket(long long res, - long long domain, - long long type, - long long protocol); -void __sanitizer_syscall_pre_impl_connect(long long s, long long name, - long long namelen); -void __sanitizer_syscall_post_impl_connect(long long res, long long s, - long long name, long long namelen); -void __sanitizer_syscall_pre_impl_compat_43_oaccept(long long s, long long name, - long long anamelen); -void __sanitizer_syscall_post_impl_compat_43_oaccept(long long res, long long s, - long long name, - long long anamelen); -void __sanitizer_syscall_pre_impl_getpriority(long long which, long long who); -void __sanitizer_syscall_post_impl_getpriority(long long res, long long which, - long long who); -void __sanitizer_syscall_pre_impl_compat_43_osend(long long s, long long buf, - long long len, - long long flags); -void __sanitizer_syscall_post_impl_compat_43_osend(long long res, long long s, - long long buf, long long len, - long long flags); -void __sanitizer_syscall_pre_impl_compat_43_orecv(long long s, long long buf, - long long len, - long long flags); -void __sanitizer_syscall_post_impl_compat_43_orecv(long long res, long long s, - long long buf, long long len, - long long flags); -void __sanitizer_syscall_pre_impl_compat_13_sigreturn13(long long sigcntxp); -void __sanitizer_syscall_post_impl_compat_13_sigreturn13(long long res, - long long sigcntxp); -void __sanitizer_syscall_pre_impl_bind(long long s, long long name, - long long namelen); -void __sanitizer_syscall_post_impl_bind(long long res, long long s, - long long name, long long namelen); -void __sanitizer_syscall_pre_impl_setsockopt(long long s, long long level, - long long name, long long val, - long long valsize); -void __sanitizer_syscall_post_impl_setsockopt(long long res, long long s, - long long level, long long name, - long long val, long long valsize); -void __sanitizer_syscall_pre_impl_listen(long long s, long long backlog); -void __sanitizer_syscall_post_impl_listen(long long res, long long s, - long long backlog); -/* syscall 107 has been skipped */ -void __sanitizer_syscall_pre_impl_compat_43_osigvec(long long signum, - long long nsv, - long long osv); -void __sanitizer_syscall_post_impl_compat_43_osigvec(long long res, - long long signum, - long long nsv, - long long osv); -void __sanitizer_syscall_pre_impl_compat_43_osigblock(long long mask); -void __sanitizer_syscall_post_impl_compat_43_osigblock(long long res, - long long mask); -void __sanitizer_syscall_pre_impl_compat_43_osigsetmask(long long mask); -void __sanitizer_syscall_post_impl_compat_43_osigsetmask(long long res, - long long mask); -void __sanitizer_syscall_pre_impl_compat_13_sigsuspend13(long long mask); -void __sanitizer_syscall_post_impl_compat_13_sigsuspend13(long long res, - long long mask); -void __sanitizer_syscall_pre_impl_compat_43_osigstack(long long nss, - long long oss); -void __sanitizer_syscall_post_impl_compat_43_osigstack(long long res, - long long nss, - long long oss); -void __sanitizer_syscall_pre_impl_compat_43_orecvmsg(long long s, long long msg, - long long flags); -void __sanitizer_syscall_post_impl_compat_43_orecvmsg(long long res, - long long s, - long long msg, - long long flags); -void __sanitizer_syscall_pre_impl_compat_43_osendmsg(long long s, long long msg, - long long flags); -void __sanitizer_syscall_post_impl_compat_43_osendmsg(long long res, - long long s, - long long msg, - long long flags); -/* syscall 115 has been skipped */ -void __sanitizer_syscall_pre_impl_compat_50_gettimeofday(long long tp, - long long tzp); -void __sanitizer_syscall_post_impl_compat_50_gettimeofday(long long res, - long long tp, - long long tzp); -void __sanitizer_syscall_pre_impl_compat_50_getrusage(long long who, - long long rusage); -void __sanitizer_syscall_post_impl_compat_50_getrusage(long long res, - long long who, - long long rusage); -void __sanitizer_syscall_pre_impl_getsockopt(long long s, long long level, - long long name, long long val, - long long avalsize); -void __sanitizer_syscall_post_impl_getsockopt(long long res, long long s, - long long level, long long name, - long long val, - long long avalsize); -/* syscall 119 has been skipped */ -void __sanitizer_syscall_pre_impl_readv(long long fd, long long iovp, - long long iovcnt); -void __sanitizer_syscall_post_impl_readv(long long res, long long fd, - long long iovp, long long iovcnt); -void __sanitizer_syscall_pre_impl_writev(long long fd, long long iovp, - long long iovcnt); -void __sanitizer_syscall_post_impl_writev(long long res, long long fd, - long long iovp, long long iovcnt); -void __sanitizer_syscall_pre_impl_compat_50_settimeofday(long long tv, - long long tzp); -void __sanitizer_syscall_post_impl_compat_50_settimeofday(long long res, - long long tv, - long long tzp); -void __sanitizer_syscall_pre_impl_fchown(long long fd, long long uid, - long long gid); -void __sanitizer_syscall_post_impl_fchown(long long res, long long fd, - long long uid, long long gid); -void __sanitizer_syscall_pre_impl_fchmod(long long fd, long long mode); -void __sanitizer_syscall_post_impl_fchmod(long long res, long long fd, - long long mode); -void __sanitizer_syscall_pre_impl_compat_43_orecvfrom( - long long s, long long buf, long long len, long long flags, long long from, - long long fromlenaddr); -void __sanitizer_syscall_post_impl_compat_43_orecvfrom( - long long res, long long s, long long buf, long long len, long long flags, - long long from, long long fromlenaddr); -void __sanitizer_syscall_pre_impl_setreuid(long long ruid, long long euid); -void __sanitizer_syscall_post_impl_setreuid(long long res, long long ruid, - long long euid); -void __sanitizer_syscall_pre_impl_setregid(long long rgid, long long egid); -void __sanitizer_syscall_post_impl_setregid(long long res, long long rgid, - long long egid); -void __sanitizer_syscall_pre_impl_rename(long long from, long long to); -void __sanitizer_syscall_post_impl_rename(long long res, long long from, - long long to); -void __sanitizer_syscall_pre_impl_compat_43_otruncate(long long path, - long long length); -void __sanitizer_syscall_post_impl_compat_43_otruncate(long long res, - long long path, - long long length); -void __sanitizer_syscall_pre_impl_compat_43_oftruncate(long long fd, - long long length); -void __sanitizer_syscall_post_impl_compat_43_oftruncate(long long res, - long long fd, - long long length); -void __sanitizer_syscall_pre_impl_flock(long long fd, long long how); -void __sanitizer_syscall_post_impl_flock(long long res, long long fd, - long long how); -void __sanitizer_syscall_pre_impl_mkfifo(long long path, long long mode); -void __sanitizer_syscall_post_impl_mkfifo(long long res, long long path, - long long mode); -void __sanitizer_syscall_pre_impl_sendto(long long s, long long buf, - long long len, long long flags, - long long to, long long tolen); -void __sanitizer_syscall_post_impl_sendto(long long res, long long s, - long long buf, long long len, - long long flags, long long to, - long long tolen); -void __sanitizer_syscall_pre_impl_shutdown(long long s, long long how); -void __sanitizer_syscall_post_impl_shutdown(long long res, long long s, - long long how); -void __sanitizer_syscall_pre_impl_socketpair(long long domain, long long type, - long long protocol, long long rsv); -void __sanitizer_syscall_post_impl_socketpair(long long res, long long domain, - long long type, - long long protocol, - long long rsv); -void __sanitizer_syscall_pre_impl_mkdir(long long path, long long mode); -void __sanitizer_syscall_post_impl_mkdir(long long res, long long path, - long long mode); -void __sanitizer_syscall_pre_impl_rmdir(long long path); -void __sanitizer_syscall_post_impl_rmdir(long long res, long long path); -void __sanitizer_syscall_pre_impl_compat_50_utimes(long long path, - long long tptr); -void __sanitizer_syscall_post_impl_compat_50_utimes(long long res, - long long path, - long long tptr); -/* syscall 139 has been skipped */ -void __sanitizer_syscall_pre_impl_compat_50_adjtime(long long delta, - long long olddelta); -void __sanitizer_syscall_post_impl_compat_50_adjtime(long long res, - long long delta, - long long olddelta); -void __sanitizer_syscall_pre_impl_compat_43_ogetpeername(long long fdes, - long long asa, - long long alen); -void __sanitizer_syscall_post_impl_compat_43_ogetpeername(long long res, - long long fdes, - long long asa, - long long alen); -void __sanitizer_syscall_pre_impl_compat_43_ogethostid(void); -void __sanitizer_syscall_post_impl_compat_43_ogethostid(long long res); -void __sanitizer_syscall_pre_impl_compat_43_osethostid(long long hostid); -void __sanitizer_syscall_post_impl_compat_43_osethostid(long long res, - long long hostid); -void __sanitizer_syscall_pre_impl_compat_43_ogetrlimit(long long which, - long long rlp); -void __sanitizer_syscall_post_impl_compat_43_ogetrlimit(long long res, - long long which, - long long rlp); -void __sanitizer_syscall_pre_impl_compat_43_osetrlimit(long long which, - long long rlp); -void __sanitizer_syscall_post_impl_compat_43_osetrlimit(long long res, - long long which, - long long rlp); -void __sanitizer_syscall_pre_impl_compat_43_okillpg(long long pgid, - long long signum); -void __sanitizer_syscall_post_impl_compat_43_okillpg(long long res, - long long pgid, - long long signum); -void __sanitizer_syscall_pre_impl_setsid(void); -void __sanitizer_syscall_post_impl_setsid(long long res); -void __sanitizer_syscall_pre_impl_compat_50_quotactl(long long path, - long long cmd, - long long uid, - long long arg); -void __sanitizer_syscall_post_impl_compat_50_quotactl( - long long res, long long path, long long cmd, long long uid, long long arg); -void __sanitizer_syscall_pre_impl_compat_43_oquota(void); -void __sanitizer_syscall_post_impl_compat_43_oquota(long long res); -void __sanitizer_syscall_pre_impl_compat_43_ogetsockname(long long fdec, - long long asa, - long long alen); -void __sanitizer_syscall_post_impl_compat_43_ogetsockname(long long res, - long long fdec, - long long asa, - long long alen); -/* syscall 151 has been skipped */ -/* syscall 152 has been skipped */ -/* syscall 153 has been skipped */ -/* syscall 154 has been skipped */ -void __sanitizer_syscall_pre_impl_nfssvc(long long flag, long long argp); -void __sanitizer_syscall_post_impl_nfssvc(long long res, long long flag, - long long argp); -void __sanitizer_syscall_pre_impl_compat_43_ogetdirentries(long long fd, - long long buf, - long long count, - long long basep); -void __sanitizer_syscall_post_impl_compat_43_ogetdirentries(long long res, - long long fd, - long long buf, - long long count, - long long basep); -void __sanitizer_syscall_pre_impl_compat_20_statfs(long long path, - long long buf); -void __sanitizer_syscall_post_impl_compat_20_statfs(long long res, - long long path, - long long buf); -void __sanitizer_syscall_pre_impl_compat_20_fstatfs(long long fd, - long long buf); -void __sanitizer_syscall_post_impl_compat_20_fstatfs(long long res, - long long fd, - long long buf); -/* syscall 159 has been skipped */ -/* syscall 160 has been skipped */ -void __sanitizer_syscall_pre_impl_compat_30_getfh(long long fname, - long long fhp); -void __sanitizer_syscall_post_impl_compat_30_getfh(long long res, - long long fname, - long long fhp); -void __sanitizer_syscall_pre_impl_compat_09_ogetdomainname(long long domainname, - long long len); -void __sanitizer_syscall_post_impl_compat_09_ogetdomainname( - long long res, long long domainname, long long len); -void __sanitizer_syscall_pre_impl_compat_09_osetdomainname(long long domainname, - long long len); -void __sanitizer_syscall_post_impl_compat_09_osetdomainname( - long long res, long long domainname, long long len); -void __sanitizer_syscall_pre_impl_compat_09_ouname(long long name); -void __sanitizer_syscall_post_impl_compat_09_ouname(long long res, - long long name); -void __sanitizer_syscall_pre_impl_sysarch(long long op, long long parms); -void __sanitizer_syscall_post_impl_sysarch(long long res, long long op, - long long parms); -void __sanitizer_syscall_pre_impl___futex(long long uaddr, long long op, - long long val, long long timeout, - long long uaddr2, long long val2, - long long val3); -void __sanitizer_syscall_post_impl___futex(long long res, long long uaddr, - long long op, long long val, - long long timeout, long long uaddr2, - long long val2, long long val3); -void __sanitizer_syscall_pre_impl___futex_set_robust_list(long long head, - long long len); -void __sanitizer_syscall_post_impl___futex_set_robust_list(long long res, - long long head, - long long len); -void __sanitizer_syscall_pre_impl___futex_get_robust_list(long long lwpid, - long long headp, - long long lenp); -void __sanitizer_syscall_post_impl___futex_get_robust_list(long long res, - long long lwpid, - long long headp, - long long lenp); -#if !defined(_LP64) -void __sanitizer_syscall_pre_impl_compat_10_osemsys(long long which, - long long a2, long long a3, - long long a4, long long a5); -void __sanitizer_syscall_post_impl_compat_10_osemsys(long long res, - long long which, - long long a2, long long a3, - long long a4, - long long a5); -#else -/* syscall 169 has been skipped */ -#endif -#if !defined(_LP64) -void __sanitizer_syscall_pre_impl_compat_10_omsgsys(long long which, - long long a2, long long a3, - long long a4, long long a5, - long long a6); -void __sanitizer_syscall_post_impl_compat_10_omsgsys(long long res, - long long which, - long long a2, long long a3, - long long a4, long long a5, - long long a6); -#else -/* syscall 170 has been skipped */ -#endif -#if !defined(_LP64) -void __sanitizer_syscall_pre_impl_compat_10_oshmsys(long long which, - long long a2, long long a3, - long long a4); -void __sanitizer_syscall_post_impl_compat_10_oshmsys(long long res, - long long which, - long long a2, long long a3, - long long a4); -#else -/* syscall 171 has been skipped */ -#endif -/* syscall 172 has been skipped */ -void __sanitizer_syscall_pre_impl_pread(long long fd, long long buf, - long long nbyte, long long PAD, - long long offset); -void __sanitizer_syscall_post_impl_pread(long long res, long long fd, - long long buf, long long nbyte, - long long PAD, long long offset); -void __sanitizer_syscall_pre_impl_pwrite(long long fd, long long buf, - long long nbyte, long long PAD, - long long offset); -void __sanitizer_syscall_post_impl_pwrite(long long res, long long fd, - long long buf, long long nbyte, - long long PAD, long long offset); -void __sanitizer_syscall_pre_impl_compat_30_ntp_gettime(long long ntvp); -void __sanitizer_syscall_post_impl_compat_30_ntp_gettime(long long res, - long long ntvp); -#if defined(NTP) || !defined(_KERNEL_OPT) -void __sanitizer_syscall_pre_impl_ntp_adjtime(long long tp); -void __sanitizer_syscall_post_impl_ntp_adjtime(long long res, long long tp); -#else -/* syscall 176 has been skipped */ -#endif -/* syscall 177 has been skipped */ -/* syscall 178 has been skipped */ -/* syscall 179 has been skipped */ -/* syscall 180 has been skipped */ -void __sanitizer_syscall_pre_impl_setgid(long long gid); -void __sanitizer_syscall_post_impl_setgid(long long res, long long gid); -void __sanitizer_syscall_pre_impl_setegid(long long egid); -void __sanitizer_syscall_post_impl_setegid(long long res, long long egid); -void __sanitizer_syscall_pre_impl_seteuid(long long euid); -void __sanitizer_syscall_post_impl_seteuid(long long res, long long euid); -void __sanitizer_syscall_pre_impl_lfs_bmapv(long long fsidp, long long blkiov, - long long blkcnt); -void __sanitizer_syscall_post_impl_lfs_bmapv(long long res, long long fsidp, - long long blkiov, - long long blkcnt); -void __sanitizer_syscall_pre_impl_lfs_markv(long long fsidp, long long blkiov, - long long blkcnt); -void __sanitizer_syscall_post_impl_lfs_markv(long long res, long long fsidp, - long long blkiov, - long long blkcnt); -void __sanitizer_syscall_pre_impl_lfs_segclean(long long fsidp, - long long segment); -void __sanitizer_syscall_post_impl_lfs_segclean(long long res, long long fsidp, - long long segment); -void __sanitizer_syscall_pre_impl_compat_50_lfs_segwait(long long fsidp, - long long tv); -void __sanitizer_syscall_post_impl_compat_50_lfs_segwait(long long res, - long long fsidp, - long long tv); -void __sanitizer_syscall_pre_impl_compat_12_stat12(long long path, - long long ub); -void __sanitizer_syscall_post_impl_compat_12_stat12(long long res, - long long path, - long long ub); -void __sanitizer_syscall_pre_impl_compat_12_fstat12(long long fd, long long sb); -void __sanitizer_syscall_post_impl_compat_12_fstat12(long long res, - long long fd, - long long sb); -void __sanitizer_syscall_pre_impl_compat_12_lstat12(long long path, - long long ub); -void __sanitizer_syscall_post_impl_compat_12_lstat12(long long res, - long long path, - long long ub); -void __sanitizer_syscall_pre_impl_pathconf(long long path, long long name); -void __sanitizer_syscall_post_impl_pathconf(long long res, long long path, - long long name); -void __sanitizer_syscall_pre_impl_fpathconf(long long fd, long long name); -void __sanitizer_syscall_post_impl_fpathconf(long long res, long long fd, - long long name); -void __sanitizer_syscall_pre_impl_getsockopt2(long long s, long long level, - long long name, long long val, - long long avalsize); -void __sanitizer_syscall_post_impl_getsockopt2(long long res, long long s, - long long level, long long name, - long long val, - long long avalsize); -void __sanitizer_syscall_pre_impl_getrlimit(long long which, long long rlp); -void __sanitizer_syscall_post_impl_getrlimit(long long res, long long which, - long long rlp); -void __sanitizer_syscall_pre_impl_setrlimit(long long which, long long rlp); -void __sanitizer_syscall_post_impl_setrlimit(long long res, long long which, - long long rlp); -void __sanitizer_syscall_pre_impl_compat_12_getdirentries(long long fd, - long long buf, - long long count, - long long basep); -void __sanitizer_syscall_post_impl_compat_12_getdirentries(long long res, - long long fd, - long long buf, - long long count, - long long basep); -void __sanitizer_syscall_pre_impl_mmap(long long addr, long long len, - long long prot, long long flags, - long long fd, long long PAD, - long long pos); -void __sanitizer_syscall_post_impl_mmap(long long res, long long addr, - long long len, long long prot, - long long flags, long long fd, - long long PAD, long long pos); -void __sanitizer_syscall_pre_impl___syscall(long long code, long long arg0, - long long arg1, long long arg2, - long long arg3, long long arg4, - long long arg5, long long arg6, - long long arg7); -void __sanitizer_syscall_post_impl___syscall(long long res, long long code, - long long arg0, long long arg1, - long long arg2, long long arg3, - long long arg4, long long arg5, - long long arg6, long long arg7); -void __sanitizer_syscall_pre_impl_lseek(long long fd, long long PAD, - long long offset, long long whence); -void __sanitizer_syscall_post_impl_lseek(long long res, long long fd, - long long PAD, long long offset, - long long whence); -void __sanitizer_syscall_pre_impl_truncate(long long path, long long PAD, - long long length); -void __sanitizer_syscall_post_impl_truncate(long long res, long long path, - long long PAD, long long length); -void __sanitizer_syscall_pre_impl_ftruncate(long long fd, long long PAD, - long long length); -void __sanitizer_syscall_post_impl_ftruncate(long long res, long long fd, - long long PAD, long long length); -void __sanitizer_syscall_pre_impl___sysctl(long long name, long long namelen, - long long oldv, long long oldlenp, - long long newv, long long newlen); -void __sanitizer_syscall_post_impl___sysctl(long long res, long long name, - long long namelen, long long oldv, - long long oldlenp, long long newv, - long long newlen); -void __sanitizer_syscall_pre_impl_mlock(long long addr, long long len); -void __sanitizer_syscall_post_impl_mlock(long long res, long long addr, - long long len); -void __sanitizer_syscall_pre_impl_munlock(long long addr, long long len); -void __sanitizer_syscall_post_impl_munlock(long long res, long long addr, - long long len); -void __sanitizer_syscall_pre_impl_undelete(long long path); -void __sanitizer_syscall_post_impl_undelete(long long res, long long path); -void __sanitizer_syscall_pre_impl_compat_50_futimes(long long fd, - long long tptr); -void __sanitizer_syscall_post_impl_compat_50_futimes(long long res, - long long fd, - long long tptr); -void __sanitizer_syscall_pre_impl_getpgid(long long pid); -void __sanitizer_syscall_post_impl_getpgid(long long res, long long pid); -void __sanitizer_syscall_pre_impl_reboot(long long opt, long long bootstr); -void __sanitizer_syscall_post_impl_reboot(long long res, long long opt, - long long bootstr); -void __sanitizer_syscall_pre_impl_poll(long long fds, long long nfds, - long long timeout); -void __sanitizer_syscall_post_impl_poll(long long res, long long fds, - long long nfds, long long timeout); -void __sanitizer_syscall_pre_impl_afssys(long long id, long long a1, - long long a2, long long a3, - long long a4, long long a5, - long long a6); -void __sanitizer_syscall_post_impl_afssys(long long res, long long id, - long long a1, long long a2, - long long a3, long long a4, - long long a5, long long a6); -/* syscall 211 has been skipped */ -/* syscall 212 has been skipped */ -/* syscall 213 has been skipped */ -/* syscall 214 has been skipped */ -/* syscall 215 has been skipped */ -/* syscall 216 has been skipped */ -/* syscall 217 has been skipped */ -/* syscall 218 has been skipped */ -/* syscall 219 has been skipped */ -void __sanitizer_syscall_pre_impl_compat_14___semctl(long long semid, - long long semnum, - long long cmd, - long long arg); -void __sanitizer_syscall_post_impl_compat_14___semctl(long long res, - long long semid, - long long semnum, - long long cmd, - long long arg); -void __sanitizer_syscall_pre_impl_semget(long long key, long long nsems, - long long semflg); -void __sanitizer_syscall_post_impl_semget(long long res, long long key, - long long nsems, long long semflg); -void __sanitizer_syscall_pre_impl_semop(long long semid, long long sops, - long long nsops); -void __sanitizer_syscall_post_impl_semop(long long res, long long semid, - long long sops, long long nsops); -void __sanitizer_syscall_pre_impl_semconfig(long long flag); -void __sanitizer_syscall_post_impl_semconfig(long long res, long long flag); -void __sanitizer_syscall_pre_impl_compat_14_msgctl(long long msqid, - long long cmd, - long long buf); -void __sanitizer_syscall_post_impl_compat_14_msgctl(long long res, - long long msqid, - long long cmd, - long long buf); -void __sanitizer_syscall_pre_impl_msgget(long long key, long long msgflg); -void __sanitizer_syscall_post_impl_msgget(long long res, long long key, - long long msgflg); -void __sanitizer_syscall_pre_impl_msgsnd(long long msqid, long long msgp, - long long msgsz, long long msgflg); -void __sanitizer_syscall_post_impl_msgsnd(long long res, long long msqid, - long long msgp, long long msgsz, - long long msgflg); -void __sanitizer_syscall_pre_impl_msgrcv(long long msqid, long long msgp, - long long msgsz, long long msgtyp, - long long msgflg); -void __sanitizer_syscall_post_impl_msgrcv(long long res, long long msqid, - long long msgp, long long msgsz, - long long msgtyp, long long msgflg); -void __sanitizer_syscall_pre_impl_shmat(long long shmid, long long shmaddr, - long long shmflg); -void __sanitizer_syscall_post_impl_shmat(long long res, long long shmid, - long long shmaddr, long long shmflg); -void __sanitizer_syscall_pre_impl_compat_14_shmctl(long long shmid, - long long cmd, - long long buf); -void __sanitizer_syscall_post_impl_compat_14_shmctl(long long res, - long long shmid, - long long cmd, - long long buf); -void __sanitizer_syscall_pre_impl_shmdt(long long shmaddr); -void __sanitizer_syscall_post_impl_shmdt(long long res, long long shmaddr); -void __sanitizer_syscall_pre_impl_shmget(long long key, long long size, - long long shmflg); -void __sanitizer_syscall_post_impl_shmget(long long res, long long key, - long long size, long long shmflg); -void __sanitizer_syscall_pre_impl_compat_50_clock_gettime(long long clock_id, - long long tp); -void __sanitizer_syscall_post_impl_compat_50_clock_gettime(long long res, - long long clock_id, - long long tp); -void __sanitizer_syscall_pre_impl_compat_50_clock_settime(long long clock_id, - long long tp); -void __sanitizer_syscall_post_impl_compat_50_clock_settime(long long res, - long long clock_id, - long long tp); -void __sanitizer_syscall_pre_impl_compat_50_clock_getres(long long clock_id, - long long tp); -void __sanitizer_syscall_post_impl_compat_50_clock_getres(long long res, - long long clock_id, - long long tp); -void __sanitizer_syscall_pre_impl_timer_create(long long clock_id, - long long evp, - long long timerid); -void __sanitizer_syscall_post_impl_timer_create(long long res, - long long clock_id, - long long evp, - long long timerid); -void __sanitizer_syscall_pre_impl_timer_delete(long long timerid); -void __sanitizer_syscall_post_impl_timer_delete(long long res, - long long timerid); -void __sanitizer_syscall_pre_impl_compat_50_timer_settime(long long timerid, - long long flags, - long long value, - long long ovalue); -void __sanitizer_syscall_post_impl_compat_50_timer_settime(long long res, - long long timerid, - long long flags, - long long value, - long long ovalue); -void __sanitizer_syscall_pre_impl_compat_50_timer_gettime(long long timerid, - long long value); -void __sanitizer_syscall_post_impl_compat_50_timer_gettime(long long res, - long long timerid, - long long value); -void __sanitizer_syscall_pre_impl_timer_getoverrun(long long timerid); -void __sanitizer_syscall_post_impl_timer_getoverrun(long long res, - long long timerid); -void __sanitizer_syscall_pre_impl_compat_50_nanosleep(long long rqtp, - long long rmtp); -void __sanitizer_syscall_post_impl_compat_50_nanosleep(long long res, - long long rqtp, - long long rmtp); -void __sanitizer_syscall_pre_impl_fdatasync(long long fd); -void __sanitizer_syscall_post_impl_fdatasync(long long res, long long fd); -void __sanitizer_syscall_pre_impl_mlockall(long long flags); -void __sanitizer_syscall_post_impl_mlockall(long long res, long long flags); -void __sanitizer_syscall_pre_impl_munlockall(void); -void __sanitizer_syscall_post_impl_munlockall(long long res); -void __sanitizer_syscall_pre_impl_compat_50___sigtimedwait(long long set, - long long info, - long long timeout); -void __sanitizer_syscall_post_impl_compat_50___sigtimedwait(long long res, - long long set, - long long info, - long long timeout); -void __sanitizer_syscall_pre_impl_sigqueueinfo(long long pid, long long info); -void __sanitizer_syscall_post_impl_sigqueueinfo(long long res, long long pid, - long long info); -void __sanitizer_syscall_pre_impl_modctl(long long cmd, long long arg); -void __sanitizer_syscall_post_impl_modctl(long long res, long long cmd, - long long arg); -void __sanitizer_syscall_pre_impl__ksem_init(long long value, long long idp); -void __sanitizer_syscall_post_impl__ksem_init(long long res, long long value, - long long idp); -void __sanitizer_syscall_pre_impl__ksem_open(long long name, long long oflag, - long long mode, long long value, - long long idp); -void __sanitizer_syscall_post_impl__ksem_open(long long res, long long name, - long long oflag, long long mode, - long long value, long long idp); -void __sanitizer_syscall_pre_impl__ksem_unlink(long long name); -void __sanitizer_syscall_post_impl__ksem_unlink(long long res, long long name); -void __sanitizer_syscall_pre_impl__ksem_close(long long id); -void __sanitizer_syscall_post_impl__ksem_close(long long res, long long id); -void __sanitizer_syscall_pre_impl__ksem_post(long long id); -void __sanitizer_syscall_post_impl__ksem_post(long long res, long long id); -void __sanitizer_syscall_pre_impl__ksem_wait(long long id); -void __sanitizer_syscall_post_impl__ksem_wait(long long res, long long id); -void __sanitizer_syscall_pre_impl__ksem_trywait(long long id); -void __sanitizer_syscall_post_impl__ksem_trywait(long long res, long long id); -void __sanitizer_syscall_pre_impl__ksem_getvalue(long long id, long long value); -void __sanitizer_syscall_post_impl__ksem_getvalue(long long res, long long id, - long long value); -void __sanitizer_syscall_pre_impl__ksem_destroy(long long id); -void __sanitizer_syscall_post_impl__ksem_destroy(long long res, long long id); -void __sanitizer_syscall_pre_impl__ksem_timedwait(long long id, - long long abstime); -void __sanitizer_syscall_post_impl__ksem_timedwait(long long res, long long id, - long long abstime); -void __sanitizer_syscall_pre_impl_mq_open(long long name, long long oflag, - long long mode, long long attr); -void __sanitizer_syscall_post_impl_mq_open(long long res, long long name, - long long oflag, long long mode, - long long attr); -void __sanitizer_syscall_pre_impl_mq_close(long long mqdes); -void __sanitizer_syscall_post_impl_mq_close(long long res, long long mqdes); -void __sanitizer_syscall_pre_impl_mq_unlink(long long name); -void __sanitizer_syscall_post_impl_mq_unlink(long long res, long long name); -void __sanitizer_syscall_pre_impl_mq_getattr(long long mqdes, long long mqstat); -void __sanitizer_syscall_post_impl_mq_getattr(long long res, long long mqdes, - long long mqstat); -void __sanitizer_syscall_pre_impl_mq_setattr(long long mqdes, long long mqstat, - long long omqstat); -void __sanitizer_syscall_post_impl_mq_setattr(long long res, long long mqdes, - long long mqstat, - long long omqstat); -void __sanitizer_syscall_pre_impl_mq_notify(long long mqdes, - long long notification); -void __sanitizer_syscall_post_impl_mq_notify(long long res, long long mqdes, - long long notification); -void __sanitizer_syscall_pre_impl_mq_send(long long mqdes, long long msg_ptr, - long long msg_len, - long long msg_prio); -void __sanitizer_syscall_post_impl_mq_send(long long res, long long mqdes, - long long msg_ptr, long long msg_len, - long long msg_prio); -void __sanitizer_syscall_pre_impl_mq_receive(long long mqdes, long long msg_ptr, - long long msg_len, - long long msg_prio); -void __sanitizer_syscall_post_impl_mq_receive(long long res, long long mqdes, - long long msg_ptr, - long long msg_len, - long long msg_prio); -void __sanitizer_syscall_pre_impl_compat_50_mq_timedsend(long long mqdes, - long long msg_ptr, - long long msg_len, - long long msg_prio, - long long abs_timeout); -void __sanitizer_syscall_post_impl_compat_50_mq_timedsend( - long long res, long long mqdes, long long msg_ptr, long long msg_len, - long long msg_prio, long long abs_timeout); -void __sanitizer_syscall_pre_impl_compat_50_mq_timedreceive( - long long mqdes, long long msg_ptr, long long msg_len, long long msg_prio, - long long abs_timeout); -void __sanitizer_syscall_post_impl_compat_50_mq_timedreceive( - long long res, long long mqdes, long long msg_ptr, long long msg_len, - long long msg_prio, long long abs_timeout); -/* syscall 267 has been skipped */ -/* syscall 268 has been skipped */ -/* syscall 269 has been skipped */ -void __sanitizer_syscall_pre_impl___posix_rename(long long from, long long to); -void __sanitizer_syscall_post_impl___posix_rename(long long res, long long from, - long long to); -void __sanitizer_syscall_pre_impl_swapctl(long long cmd, long long arg, - long long misc); -void __sanitizer_syscall_post_impl_swapctl(long long res, long long cmd, - long long arg, long long misc); -void __sanitizer_syscall_pre_impl_compat_30_getdents(long long fd, - long long buf, - long long count); -void __sanitizer_syscall_post_impl_compat_30_getdents(long long res, - long long fd, - long long buf, - long long count); -void __sanitizer_syscall_pre_impl_minherit(long long addr, long long len, - long long inherit); -void __sanitizer_syscall_post_impl_minherit(long long res, long long addr, - long long len, long long inherit); -void __sanitizer_syscall_pre_impl_lchmod(long long path, long long mode); -void __sanitizer_syscall_post_impl_lchmod(long long res, long long path, - long long mode); -void __sanitizer_syscall_pre_impl_lchown(long long path, long long uid, - long long gid); -void __sanitizer_syscall_post_impl_lchown(long long res, long long path, - long long uid, long long gid); -void __sanitizer_syscall_pre_impl_compat_50_lutimes(long long path, - long long tptr); -void __sanitizer_syscall_post_impl_compat_50_lutimes(long long res, - long long path, - long long tptr); -void __sanitizer_syscall_pre_impl___msync13(long long addr, long long len, - long long flags); -void __sanitizer_syscall_post_impl___msync13(long long res, long long addr, - long long len, long long flags); -void __sanitizer_syscall_pre_impl_compat_30___stat13(long long path, - long long ub); -void __sanitizer_syscall_post_impl_compat_30___stat13(long long res, - long long path, - long long ub); -void __sanitizer_syscall_pre_impl_compat_30___fstat13(long long fd, - long long sb); -void __sanitizer_syscall_post_impl_compat_30___fstat13(long long res, - long long fd, - long long sb); -void __sanitizer_syscall_pre_impl_compat_30___lstat13(long long path, - long long ub); -void __sanitizer_syscall_post_impl_compat_30___lstat13(long long res, - long long path, - long long ub); -void __sanitizer_syscall_pre_impl___sigaltstack14(long long nss, long long oss); -void __sanitizer_syscall_post_impl___sigaltstack14(long long res, long long nss, - long long oss); -void __sanitizer_syscall_pre_impl___vfork14(void); -void __sanitizer_syscall_post_impl___vfork14(long long res); -void __sanitizer_syscall_pre_impl___posix_chown(long long path, long long uid, - long long gid); -void __sanitizer_syscall_post_impl___posix_chown(long long res, long long path, - long long uid, long long gid); -void __sanitizer_syscall_pre_impl___posix_fchown(long long fd, long long uid, - long long gid); -void __sanitizer_syscall_post_impl___posix_fchown(long long res, long long fd, - long long uid, long long gid); -void __sanitizer_syscall_pre_impl___posix_lchown(long long path, long long uid, - long long gid); -void __sanitizer_syscall_post_impl___posix_lchown(long long res, long long path, - long long uid, long long gid); -void __sanitizer_syscall_pre_impl_getsid(long long pid); -void __sanitizer_syscall_post_impl_getsid(long long res, long long pid); -void __sanitizer_syscall_pre_impl___clone(long long flags, long long stack); -void __sanitizer_syscall_post_impl___clone(long long res, long long flags, - long long stack); -void __sanitizer_syscall_pre_impl_fktrace(long long fd, long long ops, - long long facs, long long pid); -void __sanitizer_syscall_post_impl_fktrace(long long res, long long fd, - long long ops, long long facs, - long long pid); -void __sanitizer_syscall_pre_impl_preadv(long long fd, long long iovp, - long long iovcnt, long long PAD, - long long offset); -void __sanitizer_syscall_post_impl_preadv(long long res, long long fd, - long long iovp, long long iovcnt, - long long PAD, long long offset); -void __sanitizer_syscall_pre_impl_pwritev(long long fd, long long iovp, - long long iovcnt, long long PAD, - long long offset); -void __sanitizer_syscall_post_impl_pwritev(long long res, long long fd, - long long iovp, long long iovcnt, - long long PAD, long long offset); -void __sanitizer_syscall_pre_impl_compat_16___sigaction14(long long signum, - long long nsa, - long long osa); -void __sanitizer_syscall_post_impl_compat_16___sigaction14(long long res, - long long signum, - long long nsa, - long long osa); -void __sanitizer_syscall_pre_impl___sigpending14(long long set); -void __sanitizer_syscall_post_impl___sigpending14(long long res, long long set); -void __sanitizer_syscall_pre_impl___sigprocmask14(long long how, long long set, - long long oset); -void __sanitizer_syscall_post_impl___sigprocmask14(long long res, long long how, - long long set, - long long oset); -void __sanitizer_syscall_pre_impl___sigsuspend14(long long set); -void __sanitizer_syscall_post_impl___sigsuspend14(long long res, long long set); -void __sanitizer_syscall_pre_impl_compat_16___sigreturn14(long long sigcntxp); -void __sanitizer_syscall_post_impl_compat_16___sigreturn14(long long res, - long long sigcntxp); -void __sanitizer_syscall_pre_impl___getcwd(long long bufp, long long length); -void __sanitizer_syscall_post_impl___getcwd(long long res, long long bufp, - long long length); -void __sanitizer_syscall_pre_impl_fchroot(long long fd); -void __sanitizer_syscall_post_impl_fchroot(long long res, long long fd); -void __sanitizer_syscall_pre_impl_compat_30_fhopen(long long fhp, - long long flags); -void __sanitizer_syscall_post_impl_compat_30_fhopen(long long res, - long long fhp, - long long flags); -void __sanitizer_syscall_pre_impl_compat_30_fhstat(long long fhp, long long sb); -void __sanitizer_syscall_post_impl_compat_30_fhstat(long long res, - long long fhp, - long long sb); -void __sanitizer_syscall_pre_impl_compat_20_fhstatfs(long long fhp, - long long buf); -void __sanitizer_syscall_post_impl_compat_20_fhstatfs(long long res, - long long fhp, - long long buf); -void __sanitizer_syscall_pre_impl_compat_50_____semctl13(long long semid, - long long semnum, - long long cmd, - long long arg); -void __sanitizer_syscall_post_impl_compat_50_____semctl13(long long res, - long long semid, - long long semnum, - long long cmd, - long long arg); -void __sanitizer_syscall_pre_impl_compat_50___msgctl13(long long msqid, - long long cmd, - long long buf); -void __sanitizer_syscall_post_impl_compat_50___msgctl13(long long res, - long long msqid, - long long cmd, - long long buf); -void __sanitizer_syscall_pre_impl_compat_50___shmctl13(long long shmid, - long long cmd, - long long buf); -void __sanitizer_syscall_post_impl_compat_50___shmctl13(long long res, - long long shmid, - long long cmd, - long long buf); -void __sanitizer_syscall_pre_impl_lchflags(long long path, long long flags); -void __sanitizer_syscall_post_impl_lchflags(long long res, long long path, - long long flags); -void __sanitizer_syscall_pre_impl_issetugid(void); -void __sanitizer_syscall_post_impl_issetugid(long long res); -void __sanitizer_syscall_pre_impl_utrace(long long label, long long addr, - long long len); -void __sanitizer_syscall_post_impl_utrace(long long res, long long label, - long long addr, long long len); -void __sanitizer_syscall_pre_impl_getcontext(long long ucp); -void __sanitizer_syscall_post_impl_getcontext(long long res, long long ucp); -void __sanitizer_syscall_pre_impl_setcontext(long long ucp); -void __sanitizer_syscall_post_impl_setcontext(long long res, long long ucp); -void __sanitizer_syscall_pre_impl__lwp_create(long long ucp, long long flags, - long long new_lwp); -void __sanitizer_syscall_post_impl__lwp_create(long long res, long long ucp, - long long flags, - long long new_lwp); -void __sanitizer_syscall_pre_impl__lwp_exit(void); -void __sanitizer_syscall_post_impl__lwp_exit(long long res); -void __sanitizer_syscall_pre_impl__lwp_self(void); -void __sanitizer_syscall_post_impl__lwp_self(long long res); -void __sanitizer_syscall_pre_impl__lwp_wait(long long wait_for, - long long departed); -void __sanitizer_syscall_post_impl__lwp_wait(long long res, long long wait_for, - long long departed); -void __sanitizer_syscall_pre_impl__lwp_suspend(long long target); -void __sanitizer_syscall_post_impl__lwp_suspend(long long res, - long long target); -void __sanitizer_syscall_pre_impl__lwp_continue(long long target); -void __sanitizer_syscall_post_impl__lwp_continue(long long res, - long long target); -void __sanitizer_syscall_pre_impl__lwp_wakeup(long long target); -void __sanitizer_syscall_post_impl__lwp_wakeup(long long res, long long target); -void __sanitizer_syscall_pre_impl__lwp_getprivate(void); -void __sanitizer_syscall_post_impl__lwp_getprivate(long long res); -void __sanitizer_syscall_pre_impl__lwp_setprivate(long long ptr); -void __sanitizer_syscall_post_impl__lwp_setprivate(long long res, - long long ptr); -void __sanitizer_syscall_pre_impl__lwp_kill(long long target, long long signo); -void __sanitizer_syscall_post_impl__lwp_kill(long long res, long long target, - long long signo); -void __sanitizer_syscall_pre_impl__lwp_detach(long long target); -void __sanitizer_syscall_post_impl__lwp_detach(long long res, long long target); -void __sanitizer_syscall_pre_impl_compat_50__lwp_park(long long ts, - long long unpark, - long long hint, - long long unparkhint); -void __sanitizer_syscall_post_impl_compat_50__lwp_park(long long res, - long long ts, - long long unpark, - long long hint, - long long unparkhint); -void __sanitizer_syscall_pre_impl__lwp_unpark(long long target, long long hint); -void __sanitizer_syscall_post_impl__lwp_unpark(long long res, long long target, - long long hint); -void __sanitizer_syscall_pre_impl__lwp_unpark_all(long long targets, - long long ntargets, - long long hint); -void __sanitizer_syscall_post_impl__lwp_unpark_all(long long res, - long long targets, - long long ntargets, - long long hint); -void __sanitizer_syscall_pre_impl__lwp_setname(long long target, - long long name); -void __sanitizer_syscall_post_impl__lwp_setname(long long res, long long target, - long long name); -void __sanitizer_syscall_pre_impl__lwp_getname(long long target, long long name, - long long len); -void __sanitizer_syscall_post_impl__lwp_getname(long long res, long long target, - long long name, long long len); -void __sanitizer_syscall_pre_impl__lwp_ctl(long long features, - long long address); -void __sanitizer_syscall_post_impl__lwp_ctl(long long res, long long features, - long long address); -/* syscall 326 has been skipped */ -/* syscall 327 has been skipped */ -/* syscall 328 has been skipped */ -/* syscall 329 has been skipped */ -void __sanitizer_syscall_pre_impl_compat_60_sa_register( - long long newv, long long oldv, long long flags, - long long stackinfo_offset); -void __sanitizer_syscall_post_impl_compat_60_sa_register( - long long res, long long newv, long long oldv, long long flags, - long long stackinfo_offset); -void __sanitizer_syscall_pre_impl_compat_60_sa_stacks(long long num, - long long stacks); -void __sanitizer_syscall_post_impl_compat_60_sa_stacks(long long res, - long long num, - long long stacks); -void __sanitizer_syscall_pre_impl_compat_60_sa_enable(void); -void __sanitizer_syscall_post_impl_compat_60_sa_enable(long long res); -void __sanitizer_syscall_pre_impl_compat_60_sa_setconcurrency( - long long concurrency); -void __sanitizer_syscall_post_impl_compat_60_sa_setconcurrency( - long long res, long long concurrency); -void __sanitizer_syscall_pre_impl_compat_60_sa_yield(void); -void __sanitizer_syscall_post_impl_compat_60_sa_yield(long long res); -void __sanitizer_syscall_pre_impl_compat_60_sa_preempt(long long sa_id); -void __sanitizer_syscall_post_impl_compat_60_sa_preempt(long long res, - long long sa_id); -/* syscall 336 has been skipped */ -/* syscall 337 has been skipped */ -/* syscall 338 has been skipped */ -/* syscall 339 has been skipped */ -void __sanitizer_syscall_pre_impl___sigaction_sigtramp(long long signum, - long long nsa, - long long osa, - long long tramp, - long long vers); -void __sanitizer_syscall_post_impl___sigaction_sigtramp( - long long res, long long signum, long long nsa, long long osa, - long long tramp, long long vers); -/* syscall 341 has been skipped */ -/* syscall 342 has been skipped */ -void __sanitizer_syscall_pre_impl_rasctl(long long addr, long long len, - long long op); -void __sanitizer_syscall_post_impl_rasctl(long long res, long long addr, - long long len, long long op); -void __sanitizer_syscall_pre_impl_kqueue(void); -void __sanitizer_syscall_post_impl_kqueue(long long res); -void __sanitizer_syscall_pre_impl_compat_50_kevent( - long long fd, long long changelist, long long nchanges, long long eventlist, - long long nevents, long long timeout); -void __sanitizer_syscall_post_impl_compat_50_kevent( - long long res, long long fd, long long changelist, long long nchanges, - long long eventlist, long long nevents, long long timeout); -void __sanitizer_syscall_pre_impl__sched_setparam(long long pid, long long lid, - long long policy, - long long params); -void __sanitizer_syscall_post_impl__sched_setparam(long long res, long long pid, - long long lid, - long long policy, - long long params); -void __sanitizer_syscall_pre_impl__sched_getparam(long long pid, long long lid, - long long policy, - long long params); -void __sanitizer_syscall_post_impl__sched_getparam(long long res, long long pid, - long long lid, - long long policy, - long long params); -void __sanitizer_syscall_pre_impl__sched_setaffinity(long long pid, - long long lid, - long long size, - long long cpuset); -void __sanitizer_syscall_post_impl__sched_setaffinity(long long res, - long long pid, - long long lid, - long long size, - long long cpuset); -void __sanitizer_syscall_pre_impl__sched_getaffinity(long long pid, - long long lid, - long long size, - long long cpuset); -void __sanitizer_syscall_post_impl__sched_getaffinity(long long res, - long long pid, - long long lid, - long long size, - long long cpuset); -void __sanitizer_syscall_pre_impl_sched_yield(void); -void __sanitizer_syscall_post_impl_sched_yield(long long res); -void __sanitizer_syscall_pre_impl__sched_protect(long long priority); -void __sanitizer_syscall_post_impl__sched_protect(long long res, - long long priority); -/* syscall 352 has been skipped */ -/* syscall 353 has been skipped */ -void __sanitizer_syscall_pre_impl_fsync_range(long long fd, long long flags, - long long start, - long long length); -void __sanitizer_syscall_post_impl_fsync_range(long long res, long long fd, - long long flags, long long start, - long long length); -void __sanitizer_syscall_pre_impl_uuidgen(long long store, long long count); -void __sanitizer_syscall_post_impl_uuidgen(long long res, long long store, - long long count); -void __sanitizer_syscall_pre_impl_compat_90_getvfsstat(long long buf, - long long bufsize, - long long flags); -void __sanitizer_syscall_post_impl_compat_90_getvfsstat(long long res, - long long buf, - long long bufsize, - long long flags); -void __sanitizer_syscall_pre_impl_compat_90_statvfs1(long long path, - long long buf, - long long flags); -void __sanitizer_syscall_post_impl_compat_90_statvfs1(long long res, - long long path, - long long buf, - long long flags); -void __sanitizer_syscall_pre_impl_compat_90_fstatvfs1(long long fd, - long long buf, - long long flags); -void __sanitizer_syscall_post_impl_compat_90_fstatvfs1(long long res, - long long fd, - long long buf, - long long flags); -void __sanitizer_syscall_pre_impl_compat_30_fhstatvfs1(long long fhp, - long long buf, - long long flags); -void __sanitizer_syscall_post_impl_compat_30_fhstatvfs1(long long res, - long long fhp, - long long buf, - long long flags); -void __sanitizer_syscall_pre_impl_extattrctl(long long path, long long cmd, - long long filename, - long long attrnamespace, - long long attrname); -void __sanitizer_syscall_post_impl_extattrctl(long long res, long long path, - long long cmd, long long filename, - long long attrnamespace, - long long attrname); -void __sanitizer_syscall_pre_impl_extattr_set_file(long long path, - long long attrnamespace, - long long attrname, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_set_file( - long long res, long long path, long long attrnamespace, long long attrname, - long long data, long long nbytes); -void __sanitizer_syscall_pre_impl_extattr_get_file(long long path, - long long attrnamespace, - long long attrname, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_get_file( - long long res, long long path, long long attrnamespace, long long attrname, - long long data, long long nbytes); -void __sanitizer_syscall_pre_impl_extattr_delete_file(long long path, - long long attrnamespace, - long long attrname); -void __sanitizer_syscall_post_impl_extattr_delete_file(long long res, - long long path, - long long attrnamespace, - long long attrname); -void __sanitizer_syscall_pre_impl_extattr_set_fd(long long fd, - long long attrnamespace, - long long attrname, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_set_fd(long long res, long long fd, - long long attrnamespace, - long long attrname, - long long data, - long long nbytes); -void __sanitizer_syscall_pre_impl_extattr_get_fd(long long fd, - long long attrnamespace, - long long attrname, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_get_fd(long long res, long long fd, - long long attrnamespace, - long long attrname, - long long data, - long long nbytes); -void __sanitizer_syscall_pre_impl_extattr_delete_fd(long long fd, - long long attrnamespace, - long long attrname); -void __sanitizer_syscall_post_impl_extattr_delete_fd(long long res, - long long fd, - long long attrnamespace, - long long attrname); -void __sanitizer_syscall_pre_impl_extattr_set_link(long long path, - long long attrnamespace, - long long attrname, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_set_link( - long long res, long long path, long long attrnamespace, long long attrname, - long long data, long long nbytes); -void __sanitizer_syscall_pre_impl_extattr_get_link(long long path, - long long attrnamespace, - long long attrname, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_get_link( - long long res, long long path, long long attrnamespace, long long attrname, - long long data, long long nbytes); -void __sanitizer_syscall_pre_impl_extattr_delete_link(long long path, - long long attrnamespace, - long long attrname); -void __sanitizer_syscall_post_impl_extattr_delete_link(long long res, - long long path, - long long attrnamespace, - long long attrname); -void __sanitizer_syscall_pre_impl_extattr_list_fd(long long fd, - long long attrnamespace, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_list_fd(long long res, long long fd, - long long attrnamespace, - long long data, - long long nbytes); -void __sanitizer_syscall_pre_impl_extattr_list_file(long long path, - long long attrnamespace, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_list_file(long long res, - long long path, - long long attrnamespace, - long long data, - long long nbytes); -void __sanitizer_syscall_pre_impl_extattr_list_link(long long path, - long long attrnamespace, - long long data, - long long nbytes); -void __sanitizer_syscall_post_impl_extattr_list_link(long long res, - long long path, - long long attrnamespace, - long long data, - long long nbytes); -void __sanitizer_syscall_pre_impl_compat_50_pselect(long long nd, long long in, - long long ou, long long ex, - long long ts, - long long mask); -void __sanitizer_syscall_post_impl_compat_50_pselect(long long res, - long long nd, long long in, - long long ou, long long ex, - long long ts, - long long mask); -void __sanitizer_syscall_pre_impl_compat_50_pollts(long long fds, - long long nfds, long long ts, - long long mask); -void __sanitizer_syscall_post_impl_compat_50_pollts( - long long res, long long fds, long long nfds, long long ts, long long mask); -void __sanitizer_syscall_pre_impl_setxattr(long long path, long long name, - long long value, long long size, - long long flags); -void __sanitizer_syscall_post_impl_setxattr(long long res, long long path, - long long name, long long value, - long long size, long long flags); -void __sanitizer_syscall_pre_impl_lsetxattr(long long path, long long name, - long long value, long long size, - long long flags); -void __sanitizer_syscall_post_impl_lsetxattr(long long res, long long path, - long long name, long long value, - long long size, long long flags); -void __sanitizer_syscall_pre_impl_fsetxattr(long long fd, long long name, - long long value, long long size, - long long flags); -void __sanitizer_syscall_post_impl_fsetxattr(long long res, long long fd, - long long name, long long value, - long long size, long long flags); -void __sanitizer_syscall_pre_impl_getxattr(long long path, long long name, - long long value, long long size); -void __sanitizer_syscall_post_impl_getxattr(long long res, long long path, - long long name, long long value, - long long size); -void __sanitizer_syscall_pre_impl_lgetxattr(long long path, long long name, - long long value, long long size); -void __sanitizer_syscall_post_impl_lgetxattr(long long res, long long path, - long long name, long long value, - long long size); -void __sanitizer_syscall_pre_impl_fgetxattr(long long fd, long long name, - long long value, long long size); -void __sanitizer_syscall_post_impl_fgetxattr(long long res, long long fd, - long long name, long long value, - long long size); -void __sanitizer_syscall_pre_impl_listxattr(long long path, long long list, - long long size); -void __sanitizer_syscall_post_impl_listxattr(long long res, long long path, - long long list, long long size); -void __sanitizer_syscall_pre_impl_llistxattr(long long path, long long list, - long long size); -void __sanitizer_syscall_post_impl_llistxattr(long long res, long long path, - long long list, long long size); -void __sanitizer_syscall_pre_impl_flistxattr(long long fd, long long list, - long long size); -void __sanitizer_syscall_post_impl_flistxattr(long long res, long long fd, - long long list, long long size); -void __sanitizer_syscall_pre_impl_removexattr(long long path, long long name); -void __sanitizer_syscall_post_impl_removexattr(long long res, long long path, - long long name); -void __sanitizer_syscall_pre_impl_lremovexattr(long long path, long long name); -void __sanitizer_syscall_post_impl_lremovexattr(long long res, long long path, - long long name); -void __sanitizer_syscall_pre_impl_fremovexattr(long long fd, long long name); -void __sanitizer_syscall_post_impl_fremovexattr(long long res, long long fd, - long long name); -void __sanitizer_syscall_pre_impl_compat_50___stat30(long long path, - long long ub); -void __sanitizer_syscall_post_impl_compat_50___stat30(long long res, - long long path, - long long ub); -void __sanitizer_syscall_pre_impl_compat_50___fstat30(long long fd, - long long sb); -void __sanitizer_syscall_post_impl_compat_50___fstat30(long long res, - long long fd, - long long sb); -void __sanitizer_syscall_pre_impl_compat_50___lstat30(long long path, - long long ub); -void __sanitizer_syscall_post_impl_compat_50___lstat30(long long res, - long long path, - long long ub); -void __sanitizer_syscall_pre_impl___getdents30(long long fd, long long buf, - long long count); -void __sanitizer_syscall_post_impl___getdents30(long long res, long long fd, - long long buf, long long count); -void __sanitizer_syscall_pre_impl_posix_fadvise(long long); -void __sanitizer_syscall_post_impl_posix_fadvise(long long res, long long); -void __sanitizer_syscall_pre_impl_compat_30___fhstat30(long long fhp, - long long sb); -void __sanitizer_syscall_post_impl_compat_30___fhstat30(long long res, - long long fhp, - long long sb); -void __sanitizer_syscall_pre_impl_compat_50___ntp_gettime30(long long ntvp); -void __sanitizer_syscall_post_impl_compat_50___ntp_gettime30(long long res, - long long ntvp); -void __sanitizer_syscall_pre_impl___socket30(long long domain, long long type, - long long protocol); -void __sanitizer_syscall_post_impl___socket30(long long res, long long domain, - long long type, - long long protocol); -void __sanitizer_syscall_pre_impl___getfh30(long long fname, long long fhp, - long long fh_size); -void __sanitizer_syscall_post_impl___getfh30(long long res, long long fname, - long long fhp, long long fh_size); -void __sanitizer_syscall_pre_impl___fhopen40(long long fhp, long long fh_size, - long long flags); -void __sanitizer_syscall_post_impl___fhopen40(long long res, long long fhp, - long long fh_size, - long long flags); -void __sanitizer_syscall_pre_impl_compat_90_fhstatvfs1(long long fhp, - long long fh_size, - long long buf, - long long flags); -void __sanitizer_syscall_post_impl_compat_90_fhstatvfs1(long long res, - long long fhp, - long long fh_size, - long long buf, - long long flags); -void __sanitizer_syscall_pre_impl_compat_50___fhstat40(long long fhp, - long long fh_size, - long long sb); -void __sanitizer_syscall_post_impl_compat_50___fhstat40(long long res, - long long fhp, - long long fh_size, - long long sb); -void __sanitizer_syscall_pre_impl_aio_cancel(long long fildes, - long long aiocbp); -void __sanitizer_syscall_post_impl_aio_cancel(long long res, long long fildes, - long long aiocbp); -void __sanitizer_syscall_pre_impl_aio_error(long long aiocbp); -void __sanitizer_syscall_post_impl_aio_error(long long res, long long aiocbp); -void __sanitizer_syscall_pre_impl_aio_fsync(long long op, long long aiocbp); -void __sanitizer_syscall_post_impl_aio_fsync(long long res, long long op, - long long aiocbp); -void __sanitizer_syscall_pre_impl_aio_read(long long aiocbp); -void __sanitizer_syscall_post_impl_aio_read(long long res, long long aiocbp); -void __sanitizer_syscall_pre_impl_aio_return(long long aiocbp); -void __sanitizer_syscall_post_impl_aio_return(long long res, long long aiocbp); -void __sanitizer_syscall_pre_impl_compat_50_aio_suspend(long long list, - long long nent, - long long timeout); -void __sanitizer_syscall_post_impl_compat_50_aio_suspend(long long res, - long long list, - long long nent, - long long timeout); -void __sanitizer_syscall_pre_impl_aio_write(long long aiocbp); -void __sanitizer_syscall_post_impl_aio_write(long long res, long long aiocbp); -void __sanitizer_syscall_pre_impl_lio_listio(long long mode, long long list, - long long nent, long long sig); -void __sanitizer_syscall_post_impl_lio_listio(long long res, long long mode, - long long list, long long nent, - long long sig); -/* syscall 407 has been skipped */ -/* syscall 408 has been skipped */ -/* syscall 409 has been skipped */ -void __sanitizer_syscall_pre_impl___mount50(long long type, long long path, - long long flags, long long data, - long long data_len); -void __sanitizer_syscall_post_impl___mount50(long long res, long long type, - long long path, long long flags, - long long data, - long long data_len); -void __sanitizer_syscall_pre_impl_mremap(long long old_address, - long long old_size, - long long new_address, - long long new_size, long long flags); -void __sanitizer_syscall_post_impl_mremap(long long res, long long old_address, - long long old_size, - long long new_address, - long long new_size, long long flags); -void __sanitizer_syscall_pre_impl_pset_create(long long psid); -void __sanitizer_syscall_post_impl_pset_create(long long res, long long psid); -void __sanitizer_syscall_pre_impl_pset_destroy(long long psid); -void __sanitizer_syscall_post_impl_pset_destroy(long long res, long long psid); -void __sanitizer_syscall_pre_impl_pset_assign(long long psid, long long cpuid, - long long opsid); -void __sanitizer_syscall_post_impl_pset_assign(long long res, long long psid, - long long cpuid, - long long opsid); -void __sanitizer_syscall_pre_impl__pset_bind(long long idtype, - long long first_id, - long long second_id, - long long psid, long long opsid); -void __sanitizer_syscall_post_impl__pset_bind(long long res, long long idtype, - long long first_id, - long long second_id, - long long psid, long long opsid); -void __sanitizer_syscall_pre_impl___posix_fadvise50(long long fd, long long PAD, - long long offset, - long long len, - long long advice); -void __sanitizer_syscall_post_impl___posix_fadvise50( - long long res, long long fd, long long PAD, long long offset, long long len, - long long advice); -void __sanitizer_syscall_pre_impl___select50(long long nd, long long in, - long long ou, long long ex, - long long tv); -void __sanitizer_syscall_post_impl___select50(long long res, long long nd, - long long in, long long ou, - long long ex, long long tv); -void __sanitizer_syscall_pre_impl___gettimeofday50(long long tp, long long tzp); -void __sanitizer_syscall_post_impl___gettimeofday50(long long res, long long tp, - long long tzp); -void __sanitizer_syscall_pre_impl___settimeofday50(long long tv, long long tzp); -void __sanitizer_syscall_post_impl___settimeofday50(long long res, long long tv, - long long tzp); -void __sanitizer_syscall_pre_impl___utimes50(long long path, long long tptr); -void __sanitizer_syscall_post_impl___utimes50(long long res, long long path, - long long tptr); -void __sanitizer_syscall_pre_impl___adjtime50(long long delta, - long long olddelta); -void __sanitizer_syscall_post_impl___adjtime50(long long res, long long delta, - long long olddelta); -void __sanitizer_syscall_pre_impl___lfs_segwait50(long long fsidp, - long long tv); -void __sanitizer_syscall_post_impl___lfs_segwait50(long long res, - long long fsidp, - long long tv); -void __sanitizer_syscall_pre_impl___futimes50(long long fd, long long tptr); -void __sanitizer_syscall_post_impl___futimes50(long long res, long long fd, - long long tptr); -void __sanitizer_syscall_pre_impl___lutimes50(long long path, long long tptr); -void __sanitizer_syscall_post_impl___lutimes50(long long res, long long path, - long long tptr); -void __sanitizer_syscall_pre_impl___setitimer50(long long which, long long itv, - long long oitv); -void __sanitizer_syscall_post_impl___setitimer50(long long res, long long which, - long long itv, long long oitv); -void __sanitizer_syscall_pre_impl___getitimer50(long long which, long long itv); -void __sanitizer_syscall_post_impl___getitimer50(long long res, long long which, - long long itv); -void __sanitizer_syscall_pre_impl___clock_gettime50(long long clock_id, - long long tp); -void __sanitizer_syscall_post_impl___clock_gettime50(long long res, - long long clock_id, - long long tp); -void __sanitizer_syscall_pre_impl___clock_settime50(long long clock_id, - long long tp); -void __sanitizer_syscall_post_impl___clock_settime50(long long res, - long long clock_id, - long long tp); -void __sanitizer_syscall_pre_impl___clock_getres50(long long clock_id, - long long tp); -void __sanitizer_syscall_post_impl___clock_getres50(long long res, - long long clock_id, - long long tp); -void __sanitizer_syscall_pre_impl___nanosleep50(long long rqtp, long long rmtp); -void __sanitizer_syscall_post_impl___nanosleep50(long long res, long long rqtp, - long long rmtp); -void __sanitizer_syscall_pre_impl_____sigtimedwait50(long long set, - long long info, - long long timeout); -void __sanitizer_syscall_post_impl_____sigtimedwait50(long long res, - long long set, - long long info, - long long timeout); -void __sanitizer_syscall_pre_impl___mq_timedsend50(long long mqdes, - long long msg_ptr, - long long msg_len, - long long msg_prio, - long long abs_timeout); -void __sanitizer_syscall_post_impl___mq_timedsend50( - long long res, long long mqdes, long long msg_ptr, long long msg_len, - long long msg_prio, long long abs_timeout); -void __sanitizer_syscall_pre_impl___mq_timedreceive50(long long mqdes, - long long msg_ptr, - long long msg_len, - long long msg_prio, - long long abs_timeout); -void __sanitizer_syscall_post_impl___mq_timedreceive50( - long long res, long long mqdes, long long msg_ptr, long long msg_len, - long long msg_prio, long long abs_timeout); -void __sanitizer_syscall_pre_impl_compat_60__lwp_park(long long ts, - long long unpark, - long long hint, - long long unparkhint); -void __sanitizer_syscall_post_impl_compat_60__lwp_park(long long res, - long long ts, - long long unpark, - long long hint, - long long unparkhint); -void __sanitizer_syscall_pre_impl___kevent50(long long fd, long long changelist, - long long nchanges, - long long eventlist, - long long nevents, - long long timeout); -void __sanitizer_syscall_post_impl___kevent50( - long long res, long long fd, long long changelist, long long nchanges, - long long eventlist, long long nevents, long long timeout); -void __sanitizer_syscall_pre_impl___pselect50(long long nd, long long in, - long long ou, long long ex, - long long ts, long long mask); -void __sanitizer_syscall_post_impl___pselect50(long long res, long long nd, - long long in, long long ou, - long long ex, long long ts, - long long mask); -void __sanitizer_syscall_pre_impl___pollts50(long long fds, long long nfds, - long long ts, long long mask); -void __sanitizer_syscall_post_impl___pollts50(long long res, long long fds, - long long nfds, long long ts, - long long mask); -void __sanitizer_syscall_pre_impl___aio_suspend50(long long list, - long long nent, - long long timeout); -void __sanitizer_syscall_post_impl___aio_suspend50(long long res, - long long list, - long long nent, - long long timeout); -void __sanitizer_syscall_pre_impl___stat50(long long path, long long ub); -void __sanitizer_syscall_post_impl___stat50(long long res, long long path, - long long ub); -void __sanitizer_syscall_pre_impl___fstat50(long long fd, long long sb); -void __sanitizer_syscall_post_impl___fstat50(long long res, long long fd, - long long sb); -void __sanitizer_syscall_pre_impl___lstat50(long long path, long long ub); -void __sanitizer_syscall_post_impl___lstat50(long long res, long long path, - long long ub); -void __sanitizer_syscall_pre_impl_____semctl50(long long semid, - long long semnum, long long cmd, - long long arg); -void __sanitizer_syscall_post_impl_____semctl50(long long res, long long semid, - long long semnum, long long cmd, - long long arg); -void __sanitizer_syscall_pre_impl___shmctl50(long long shmid, long long cmd, - long long buf); -void __sanitizer_syscall_post_impl___shmctl50(long long res, long long shmid, - long long cmd, long long buf); -void __sanitizer_syscall_pre_impl___msgctl50(long long msqid, long long cmd, - long long buf); -void __sanitizer_syscall_post_impl___msgctl50(long long res, long long msqid, - long long cmd, long long buf); -void __sanitizer_syscall_pre_impl___getrusage50(long long who, - long long rusage); -void __sanitizer_syscall_post_impl___getrusage50(long long res, long long who, - long long rusage); -void __sanitizer_syscall_pre_impl___timer_settime50(long long timerid, - long long flags, - long long value, - long long ovalue); -void __sanitizer_syscall_post_impl___timer_settime50(long long res, - long long timerid, - long long flags, - long long value, - long long ovalue); -void __sanitizer_syscall_pre_impl___timer_gettime50(long long timerid, - long long value); -void __sanitizer_syscall_post_impl___timer_gettime50(long long res, - long long timerid, - long long value); -#if defined(NTP) || !defined(_KERNEL_OPT) -void __sanitizer_syscall_pre_impl___ntp_gettime50(long long ntvp); -void __sanitizer_syscall_post_impl___ntp_gettime50(long long res, - long long ntvp); -#else -/* syscall 448 has been skipped */ -#endif -void __sanitizer_syscall_pre_impl___wait450(long long pid, long long status, - long long options, - long long rusage); -void __sanitizer_syscall_post_impl___wait450(long long res, long long pid, - long long status, - long long options, - long long rusage); -void __sanitizer_syscall_pre_impl___mknod50(long long path, long long mode, - long long dev); -void __sanitizer_syscall_post_impl___mknod50(long long res, long long path, - long long mode, long long dev); -void __sanitizer_syscall_pre_impl___fhstat50(long long fhp, long long fh_size, - long long sb); -void __sanitizer_syscall_post_impl___fhstat50(long long res, long long fhp, - long long fh_size, long long sb); -/* syscall 452 has been skipped */ -void __sanitizer_syscall_pre_impl_pipe2(long long fildes, long long flags); -void __sanitizer_syscall_post_impl_pipe2(long long res, long long fildes, - long long flags); -void __sanitizer_syscall_pre_impl_dup3(long long from, long long to, - long long flags); -void __sanitizer_syscall_post_impl_dup3(long long res, long long from, - long long to, long long flags); -void __sanitizer_syscall_pre_impl_kqueue1(long long flags); -void __sanitizer_syscall_post_impl_kqueue1(long long res, long long flags); -void __sanitizer_syscall_pre_impl_paccept(long long s, long long name, - long long anamelen, long long mask, - long long flags); -void __sanitizer_syscall_post_impl_paccept(long long res, long long s, - long long name, long long anamelen, - long long mask, long long flags); -void __sanitizer_syscall_pre_impl_linkat(long long fd1, long long name1, - long long fd2, long long name2, - long long flags); -void __sanitizer_syscall_post_impl_linkat(long long res, long long fd1, - long long name1, long long fd2, - long long name2, long long flags); -void __sanitizer_syscall_pre_impl_renameat(long long fromfd, long long from, - long long tofd, long long to); -void __sanitizer_syscall_post_impl_renameat(long long res, long long fromfd, - long long from, long long tofd, - long long to); -void __sanitizer_syscall_pre_impl_mkfifoat(long long fd, long long path, - long long mode); -void __sanitizer_syscall_post_impl_mkfifoat(long long res, long long fd, - long long path, long long mode); -void __sanitizer_syscall_pre_impl_mknodat(long long fd, long long path, - long long mode, long long PAD, - long long dev); -void __sanitizer_syscall_post_impl_mknodat(long long res, long long fd, - long long path, long long mode, - long long PAD, long long dev); -void __sanitizer_syscall_pre_impl_mkdirat(long long fd, long long path, - long long mode); -void __sanitizer_syscall_post_impl_mkdirat(long long res, long long fd, - long long path, long long mode); -void __sanitizer_syscall_pre_impl_faccessat(long long fd, long long path, - long long amode, long long flag); -void __sanitizer_syscall_post_impl_faccessat(long long res, long long fd, - long long path, long long amode, - long long flag); -void __sanitizer_syscall_pre_impl_fchmodat(long long fd, long long path, - long long mode, long long flag); -void __sanitizer_syscall_post_impl_fchmodat(long long res, long long fd, - long long path, long long mode, - long long flag); -void __sanitizer_syscall_pre_impl_fchownat(long long fd, long long path, - long long owner, long long group, - long long flag); -void __sanitizer_syscall_post_impl_fchownat(long long res, long long fd, - long long path, long long owner, - long long group, long long flag); -void __sanitizer_syscall_pre_impl_fexecve(long long fd, long long argp, - long long envp); -void __sanitizer_syscall_post_impl_fexecve(long long res, long long fd, - long long argp, long long envp); -void __sanitizer_syscall_pre_impl_fstatat(long long fd, long long path, - long long buf, long long flag); -void __sanitizer_syscall_post_impl_fstatat(long long res, long long fd, - long long path, long long buf, - long long flag); -void __sanitizer_syscall_pre_impl_utimensat(long long fd, long long path, - long long tptr, long long flag); -void __sanitizer_syscall_post_impl_utimensat(long long res, long long fd, - long long path, long long tptr, - long long flag); -void __sanitizer_syscall_pre_impl_openat(long long fd, long long path, - long long oflags, long long mode); -void __sanitizer_syscall_post_impl_openat(long long res, long long fd, - long long path, long long oflags, - long long mode); -void __sanitizer_syscall_pre_impl_readlinkat(long long fd, long long path, - long long buf, long long bufsize); -void __sanitizer_syscall_post_impl_readlinkat(long long res, long long fd, - long long path, long long buf, - long long bufsize); -void __sanitizer_syscall_pre_impl_symlinkat(long long path1, long long fd, - long long path2); -void __sanitizer_syscall_post_impl_symlinkat(long long res, long long path1, - long long fd, long long path2); -void __sanitizer_syscall_pre_impl_unlinkat(long long fd, long long path, - long long flag); -void __sanitizer_syscall_post_impl_unlinkat(long long res, long long fd, - long long path, long long flag); -void __sanitizer_syscall_pre_impl_futimens(long long fd, long long tptr); -void __sanitizer_syscall_post_impl_futimens(long long res, long long fd, - long long tptr); -void __sanitizer_syscall_pre_impl___quotactl(long long path, long long args); -void __sanitizer_syscall_post_impl___quotactl(long long res, long long path, - long long args); -void __sanitizer_syscall_pre_impl_posix_spawn(long long pid, long long path, - long long file_actions, - long long attrp, long long argv, - long long envp); -void __sanitizer_syscall_post_impl_posix_spawn(long long res, long long pid, - long long path, - long long file_actions, - long long attrp, long long argv, - long long envp); -void __sanitizer_syscall_pre_impl_recvmmsg(long long s, long long mmsg, - long long vlen, long long flags, - long long timeout); -void __sanitizer_syscall_post_impl_recvmmsg(long long res, long long s, - long long mmsg, long long vlen, - long long flags, long long timeout); -void __sanitizer_syscall_pre_impl_sendmmsg(long long s, long long mmsg, - long long vlen, long long flags); -void __sanitizer_syscall_post_impl_sendmmsg(long long res, long long s, - long long mmsg, long long vlen, - long long flags); -void __sanitizer_syscall_pre_impl_clock_nanosleep(long long clock_id, - long long flags, - long long rqtp, - long long rmtp); -void __sanitizer_syscall_post_impl_clock_nanosleep(long long res, - long long clock_id, - long long flags, - long long rqtp, - long long rmtp); -void __sanitizer_syscall_pre_impl____lwp_park60(long long clock_id, - long long flags, long long ts, - long long unpark, - long long hint, - long long unparkhint); -void __sanitizer_syscall_post_impl____lwp_park60( - long long res, long long clock_id, long long flags, long long ts, - long long unpark, long long hint, long long unparkhint); -void __sanitizer_syscall_pre_impl_posix_fallocate(long long fd, long long PAD, - long long pos, long long len); -void __sanitizer_syscall_post_impl_posix_fallocate(long long res, long long fd, - long long PAD, long long pos, - long long len); -void __sanitizer_syscall_pre_impl_fdiscard(long long fd, long long PAD, - long long pos, long long len); -void __sanitizer_syscall_post_impl_fdiscard(long long res, long long fd, - long long PAD, long long pos, - long long len); -void __sanitizer_syscall_pre_impl_wait6(long long idtype, long long id, - long long status, long long options, - long long wru, long long info); -void __sanitizer_syscall_post_impl_wait6(long long res, long long idtype, - long long id, long long status, - long long options, long long wru, - long long info); -void __sanitizer_syscall_pre_impl_clock_getcpuclockid2(long long idtype, - long long id, - long long clock_id); -void __sanitizer_syscall_post_impl_clock_getcpuclockid2(long long res, - long long idtype, - long long id, - long long clock_id); -void __sanitizer_syscall_pre_impl___getvfsstat90(long long buf, - long long bufsize, - long long flags); -void __sanitizer_syscall_post_impl___getvfsstat90(long long res, long long buf, - long long bufsize, - long long flags); -void __sanitizer_syscall_pre_impl___statvfs190(long long path, long long buf, - long long flags); -void __sanitizer_syscall_post_impl___statvfs190(long long res, long long path, - long long buf, long long flags); -void __sanitizer_syscall_pre_impl___fstatvfs190(long long fd, long long buf, - long long flags); -void __sanitizer_syscall_post_impl___fstatvfs190(long long res, long long fd, - long long buf, - long long flags); -void __sanitizer_syscall_pre_impl___fhstatvfs190(long long fhp, - long long fh_size, - long long buf, - long long flags); -void __sanitizer_syscall_post_impl___fhstatvfs190(long long res, long long fhp, - long long fh_size, - long long buf, - long long flags); -void __sanitizer_syscall_pre_impl___acl_get_link(long long path, long long type, - long long aclp); -void __sanitizer_syscall_post_impl___acl_get_link(long long res, long long path, - long long type, - long long aclp); -void __sanitizer_syscall_pre_impl___acl_set_link(long long path, long long type, - long long aclp); -void __sanitizer_syscall_post_impl___acl_set_link(long long res, long long path, - long long type, - long long aclp); -void __sanitizer_syscall_pre_impl___acl_delete_link(long long path, - long long type); -void __sanitizer_syscall_post_impl___acl_delete_link(long long res, - long long path, - long long type); -void __sanitizer_syscall_pre_impl___acl_aclcheck_link(long long path, - long long type, - long long aclp); -void __sanitizer_syscall_post_impl___acl_aclcheck_link(long long res, - long long path, - long long type, - long long aclp); -void __sanitizer_syscall_pre_impl___acl_get_file(long long path, long long type, - long long aclp); -void __sanitizer_syscall_post_impl___acl_get_file(long long res, long long path, - long long type, - long long aclp); -void __sanitizer_syscall_pre_impl___acl_set_file(long long path, long long type, - long long aclp); -void __sanitizer_syscall_post_impl___acl_set_file(long long res, long long path, - long long type, - long long aclp); -void __sanitizer_syscall_pre_impl___acl_get_fd(long long filedes, - long long type, long long aclp); -void __sanitizer_syscall_post_impl___acl_get_fd(long long res, - long long filedes, - long long type, long long aclp); -void __sanitizer_syscall_pre_impl___acl_set_fd(long long filedes, - long long type, long long aclp); -void __sanitizer_syscall_post_impl___acl_set_fd(long long res, - long long filedes, - long long type, long long aclp); -void __sanitizer_syscall_pre_impl___acl_delete_file(long long path, - long long type); -void __sanitizer_syscall_post_impl___acl_delete_file(long long res, - long long path, - long long type); -void __sanitizer_syscall_pre_impl___acl_delete_fd(long long filedes, - long long type); -void __sanitizer_syscall_post_impl___acl_delete_fd(long long res, - long long filedes, - long long type); -void __sanitizer_syscall_pre_impl___acl_aclcheck_file(long long path, - long long type, - long long aclp); -void __sanitizer_syscall_post_impl___acl_aclcheck_file(long long res, - long long path, - long long type, - long long aclp); -void __sanitizer_syscall_pre_impl___acl_aclcheck_fd(long long filedes, - long long type, - long long aclp); -void __sanitizer_syscall_post_impl___acl_aclcheck_fd(long long res, - long long filedes, - long long type, - long long aclp); -void __sanitizer_syscall_pre_impl_lpathconf(long long path, long long name); -void __sanitizer_syscall_post_impl_lpathconf(long long res, long long path, - long long name); - -#ifdef __cplusplus -} // extern "C" -#endif - -// DO NOT EDIT! THIS FILE HAS BEEN GENERATED! - -#endif // SANITIZER_NETBSD_SYSCALL_HOOKS_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/scudo_interface.h b/contrib/libs/clang14-rt/include/sanitizer/scudo_interface.h deleted file mode 100644 index dd522c1efc21..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/scudo_interface.h +++ /dev/null @@ -1,38 +0,0 @@ -//===-- sanitizer/scudo_interface.h -----------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -/// Public Scudo interface header. -// -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_SCUDO_INTERFACE_H_ -#define SANITIZER_SCUDO_INTERFACE_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - // This function may be optionally provided by a user and should return - // a string containing Scudo runtime options. See scudo_flags.h for details. - const char* __scudo_default_options(void); - - // This function allows to set the RSS limit at runtime. This can be either - // the hard limit (HardLimit=1) or the soft limit (HardLimit=0). The limit - // can be removed by setting LimitMb to 0. This function's parameters should - // be fully trusted to avoid security mishaps. - void __scudo_set_rss_limit(size_t LimitMb, int HardLimit); - - // This function outputs various allocator statistics for both the Primary - // and Secondary allocators, including memory usage, number of allocations - // and deallocations. - void __scudo_print_stats(void); -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_SCUDO_INTERFACE_H_ diff --git a/contrib/libs/clang14-rt/include/sanitizer/tsan_interface.h b/contrib/libs/clang14-rt/include/sanitizer/tsan_interface.h deleted file mode 100644 index 2782e61fb8c7..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/tsan_interface.h +++ /dev/null @@ -1,179 +0,0 @@ -//===-- tsan_interface.h ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of ThreadSanitizer (TSan), a race detector. -// -// Public interface header for TSan. -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_TSAN_INTERFACE_H -#define SANITIZER_TSAN_INTERFACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// __tsan_release establishes a happens-before relation with a preceding -// __tsan_acquire on the same address. -void __tsan_acquire(void *addr); -void __tsan_release(void *addr); - -// Annotations for custom mutexes. -// The annotations allow to get better reports (with sets of locked mutexes), -// detect more types of bugs (e.g. mutex misuses, races between lock/unlock and -// destruction and potential deadlocks) and improve precision and performance -// (by ignoring individual atomic operations in mutex code). However, the -// downside is that annotated mutex code itself is not checked for correctness. - -// Mutex creation flags are passed to __tsan_mutex_create annotation. -// If mutex has no constructor and __tsan_mutex_create is not called, -// the flags may be passed to __tsan_mutex_pre_lock/__tsan_mutex_post_lock -// annotations. - -// Mutex has static storage duration and no-op constructor and destructor. -// This effectively makes tsan ignore destroy annotation. -static const unsigned __tsan_mutex_linker_init = 1 << 0; -// Mutex is write reentrant. -static const unsigned __tsan_mutex_write_reentrant = 1 << 1; -// Mutex is read reentrant. -static const unsigned __tsan_mutex_read_reentrant = 1 << 2; -// Mutex does not have static storage duration, and must not be used after -// its destructor runs. The opposite of __tsan_mutex_linker_init. -// If this flag is passed to __tsan_mutex_destroy, then the destruction -// is ignored unless this flag was previously set on the mutex. -static const unsigned __tsan_mutex_not_static = 1 << 8; - -// Mutex operation flags: - -// Denotes read lock operation. -static const unsigned __tsan_mutex_read_lock = 1 << 3; -// Denotes try lock operation. -static const unsigned __tsan_mutex_try_lock = 1 << 4; -// Denotes that a try lock operation has failed to acquire the mutex. -static const unsigned __tsan_mutex_try_lock_failed = 1 << 5; -// Denotes that the lock operation acquires multiple recursion levels. -// Number of levels is passed in recursion parameter. -// This is useful for annotation of e.g. Java builtin monitors, -// for which wait operation releases all recursive acquisitions of the mutex. -static const unsigned __tsan_mutex_recursive_lock = 1 << 6; -// Denotes that the unlock operation releases all recursion levels. -// Number of released levels is returned and later must be passed to -// the corresponding __tsan_mutex_post_lock annotation. -static const unsigned __tsan_mutex_recursive_unlock = 1 << 7; - -// Convenient composed constants. -static const unsigned __tsan_mutex_try_read_lock = - __tsan_mutex_read_lock | __tsan_mutex_try_lock; -static const unsigned __tsan_mutex_try_read_lock_failed = - __tsan_mutex_try_read_lock | __tsan_mutex_try_lock_failed; - -// Annotate creation of a mutex. -// Supported flags: mutex creation flags. -void __tsan_mutex_create(void *addr, unsigned flags); - -// Annotate destruction of a mutex. -// Supported flags: -// - __tsan_mutex_linker_init -// - __tsan_mutex_not_static -void __tsan_mutex_destroy(void *addr, unsigned flags); - -// Annotate start of lock operation. -// Supported flags: -// - __tsan_mutex_read_lock -// - __tsan_mutex_try_lock -// - all mutex creation flags -void __tsan_mutex_pre_lock(void *addr, unsigned flags); - -// Annotate end of lock operation. -// Supported flags: -// - __tsan_mutex_read_lock (must match __tsan_mutex_pre_lock) -// - __tsan_mutex_try_lock (must match __tsan_mutex_pre_lock) -// - __tsan_mutex_try_lock_failed -// - __tsan_mutex_recursive_lock -// - all mutex creation flags -void __tsan_mutex_post_lock(void *addr, unsigned flags, int recursion); - -// Annotate start of unlock operation. -// Supported flags: -// - __tsan_mutex_read_lock -// - __tsan_mutex_recursive_unlock -int __tsan_mutex_pre_unlock(void *addr, unsigned flags); - -// Annotate end of unlock operation. -// Supported flags: -// - __tsan_mutex_read_lock (must match __tsan_mutex_pre_unlock) -void __tsan_mutex_post_unlock(void *addr, unsigned flags); - -// Annotate start/end of notify/signal/broadcast operation. -// Supported flags: none. -void __tsan_mutex_pre_signal(void *addr, unsigned flags); -void __tsan_mutex_post_signal(void *addr, unsigned flags); - -// Annotate start/end of a region of code where lock/unlock/signal operation -// diverts to do something else unrelated to the mutex. This can be used to -// annotate, for example, calls into cooperative scheduler or contention -// profiling code. -// These annotations must be called only from within -// __tsan_mutex_pre/post_lock, __tsan_mutex_pre/post_unlock, -// __tsan_mutex_pre/post_signal regions. -// Supported flags: none. -void __tsan_mutex_pre_divert(void *addr, unsigned flags); -void __tsan_mutex_post_divert(void *addr, unsigned flags); - -// External race detection API. -// Can be used by non-instrumented libraries to detect when their objects are -// being used in an unsafe manner. -// - __tsan_external_read/__tsan_external_write annotates the logical reads -// and writes of the object at the specified address. 'caller_pc' should -// be the PC of the library user, which the library can obtain with e.g. -// `__builtin_return_address(0)`. -// - __tsan_external_register_tag registers a 'tag' with the specified name, -// which is later used in read/write annotations to denote the object type -// - __tsan_external_assign_tag can optionally mark a heap object with a tag -void *__tsan_external_register_tag(const char *object_type); -void __tsan_external_register_header(void *tag, const char *header); -void __tsan_external_assign_tag(void *addr, void *tag); -void __tsan_external_read(void *addr, void *caller_pc, void *tag); -void __tsan_external_write(void *addr, void *caller_pc, void *tag); - -// Fiber switching API. -// - TSAN context for fiber can be created by __tsan_create_fiber -// and freed by __tsan_destroy_fiber. -// - TSAN context of current fiber or thread can be obtained -// by calling __tsan_get_current_fiber. -// - __tsan_switch_to_fiber should be called immediately before switch -// to fiber, such as call of swapcontext. -// - Fiber name can be set by __tsan_set_fiber_name. -void *__tsan_get_current_fiber(void); -void *__tsan_create_fiber(unsigned flags); -void __tsan_destroy_fiber(void *fiber); -void __tsan_switch_to_fiber(void *fiber, unsigned flags); -void __tsan_set_fiber_name(void *fiber, const char *name); - -// Flags for __tsan_switch_to_fiber: -// Do not establish a happens-before relation between fibers -static const unsigned __tsan_switch_to_fiber_no_sync = 1 << 0; - -// User-provided callback invoked on TSan initialization. -void __tsan_on_initialize(); - -// User-provided callback invoked on TSan shutdown. -// `failed` - Nonzero if TSan did detect issues, zero otherwise. -// Return `0` if TSan should exit as if no issues were detected. Return nonzero -// if TSan should exit as if issues were detected. -int __tsan_on_finalize(int failed); - -// Release TSan internal memory in a best-effort manner. -void __tsan_flush_memory(); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_TSAN_INTERFACE_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/tsan_interface_atomic.h b/contrib/libs/clang14-rt/include/sanitizer/tsan_interface_atomic.h deleted file mode 100644 index 5e41e2256c30..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/tsan_interface_atomic.h +++ /dev/null @@ -1,221 +0,0 @@ -//===-- tsan_interface_atomic.h ---------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of ThreadSanitizer (TSan), a race detector. -// -// Public interface header for TSan atomics. -//===----------------------------------------------------------------------===// -#ifndef TSAN_INTERFACE_ATOMIC_H -#define TSAN_INTERFACE_ATOMIC_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef char __tsan_atomic8; -typedef short __tsan_atomic16; -typedef int __tsan_atomic32; -typedef long __tsan_atomic64; -#if defined(__SIZEOF_INT128__) \ - || (__clang_major__ * 100 + __clang_minor__ >= 302) -__extension__ typedef __int128 __tsan_atomic128; -# define __TSAN_HAS_INT128 1 -#else -# define __TSAN_HAS_INT128 0 -#endif - -// Part of ABI, do not change. -// https://github.com/llvm/llvm-project/blob/main/libcxx/include/atomic -typedef enum { - __tsan_memory_order_relaxed, - __tsan_memory_order_consume, - __tsan_memory_order_acquire, - __tsan_memory_order_release, - __tsan_memory_order_acq_rel, - __tsan_memory_order_seq_cst -} __tsan_memory_order; - -__tsan_atomic8 __tsan_atomic8_load(const volatile __tsan_atomic8 *a, - __tsan_memory_order mo); -__tsan_atomic16 __tsan_atomic16_load(const volatile __tsan_atomic16 *a, - __tsan_memory_order mo); -__tsan_atomic32 __tsan_atomic32_load(const volatile __tsan_atomic32 *a, - __tsan_memory_order mo); -__tsan_atomic64 __tsan_atomic64_load(const volatile __tsan_atomic64 *a, - __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_load(const volatile __tsan_atomic128 *a, - __tsan_memory_order mo); -#endif - -void __tsan_atomic8_store(volatile __tsan_atomic8 *a, __tsan_atomic8 v, - __tsan_memory_order mo); -void __tsan_atomic16_store(volatile __tsan_atomic16 *a, __tsan_atomic16 v, - __tsan_memory_order mo); -void __tsan_atomic32_store(volatile __tsan_atomic32 *a, __tsan_atomic32 v, - __tsan_memory_order mo); -void __tsan_atomic64_store(volatile __tsan_atomic64 *a, __tsan_atomic64 v, - __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -void __tsan_atomic128_store(volatile __tsan_atomic128 *a, __tsan_atomic128 v, - __tsan_memory_order mo); -#endif - -__tsan_atomic8 __tsan_atomic8_exchange(volatile __tsan_atomic8 *a, - __tsan_atomic8 v, __tsan_memory_order mo); -__tsan_atomic16 __tsan_atomic16_exchange(volatile __tsan_atomic16 *a, - __tsan_atomic16 v, __tsan_memory_order mo); -__tsan_atomic32 __tsan_atomic32_exchange(volatile __tsan_atomic32 *a, - __tsan_atomic32 v, __tsan_memory_order mo); -__tsan_atomic64 __tsan_atomic64_exchange(volatile __tsan_atomic64 *a, - __tsan_atomic64 v, __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_exchange(volatile __tsan_atomic128 *a, - __tsan_atomic128 v, __tsan_memory_order mo); -#endif - -__tsan_atomic8 __tsan_atomic8_fetch_add(volatile __tsan_atomic8 *a, - __tsan_atomic8 v, __tsan_memory_order mo); -__tsan_atomic16 __tsan_atomic16_fetch_add(volatile __tsan_atomic16 *a, - __tsan_atomic16 v, __tsan_memory_order mo); -__tsan_atomic32 __tsan_atomic32_fetch_add(volatile __tsan_atomic32 *a, - __tsan_atomic32 v, __tsan_memory_order mo); -__tsan_atomic64 __tsan_atomic64_fetch_add(volatile __tsan_atomic64 *a, - __tsan_atomic64 v, __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_fetch_add(volatile __tsan_atomic128 *a, - __tsan_atomic128 v, __tsan_memory_order mo); -#endif - -__tsan_atomic8 __tsan_atomic8_fetch_sub(volatile __tsan_atomic8 *a, - __tsan_atomic8 v, __tsan_memory_order mo); -__tsan_atomic16 __tsan_atomic16_fetch_sub(volatile __tsan_atomic16 *a, - __tsan_atomic16 v, __tsan_memory_order mo); -__tsan_atomic32 __tsan_atomic32_fetch_sub(volatile __tsan_atomic32 *a, - __tsan_atomic32 v, __tsan_memory_order mo); -__tsan_atomic64 __tsan_atomic64_fetch_sub(volatile __tsan_atomic64 *a, - __tsan_atomic64 v, __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_fetch_sub(volatile __tsan_atomic128 *a, - __tsan_atomic128 v, __tsan_memory_order mo); -#endif - -__tsan_atomic8 __tsan_atomic8_fetch_and(volatile __tsan_atomic8 *a, - __tsan_atomic8 v, __tsan_memory_order mo); -__tsan_atomic16 __tsan_atomic16_fetch_and(volatile __tsan_atomic16 *a, - __tsan_atomic16 v, __tsan_memory_order mo); -__tsan_atomic32 __tsan_atomic32_fetch_and(volatile __tsan_atomic32 *a, - __tsan_atomic32 v, __tsan_memory_order mo); -__tsan_atomic64 __tsan_atomic64_fetch_and(volatile __tsan_atomic64 *a, - __tsan_atomic64 v, __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_fetch_and(volatile __tsan_atomic128 *a, - __tsan_atomic128 v, __tsan_memory_order mo); -#endif - -__tsan_atomic8 __tsan_atomic8_fetch_or(volatile __tsan_atomic8 *a, - __tsan_atomic8 v, __tsan_memory_order mo); -__tsan_atomic16 __tsan_atomic16_fetch_or(volatile __tsan_atomic16 *a, - __tsan_atomic16 v, __tsan_memory_order mo); -__tsan_atomic32 __tsan_atomic32_fetch_or(volatile __tsan_atomic32 *a, - __tsan_atomic32 v, __tsan_memory_order mo); -__tsan_atomic64 __tsan_atomic64_fetch_or(volatile __tsan_atomic64 *a, - __tsan_atomic64 v, __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_fetch_or(volatile __tsan_atomic128 *a, - __tsan_atomic128 v, __tsan_memory_order mo); -#endif - -__tsan_atomic8 __tsan_atomic8_fetch_xor(volatile __tsan_atomic8 *a, - __tsan_atomic8 v, __tsan_memory_order mo); -__tsan_atomic16 __tsan_atomic16_fetch_xor(volatile __tsan_atomic16 *a, - __tsan_atomic16 v, __tsan_memory_order mo); -__tsan_atomic32 __tsan_atomic32_fetch_xor(volatile __tsan_atomic32 *a, - __tsan_atomic32 v, __tsan_memory_order mo); -__tsan_atomic64 __tsan_atomic64_fetch_xor(volatile __tsan_atomic64 *a, - __tsan_atomic64 v, __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_fetch_xor(volatile __tsan_atomic128 *a, - __tsan_atomic128 v, __tsan_memory_order mo); -#endif - -__tsan_atomic8 __tsan_atomic8_fetch_nand(volatile __tsan_atomic8 *a, - __tsan_atomic8 v, __tsan_memory_order mo); -__tsan_atomic16 __tsan_atomic16_fetch_nand(volatile __tsan_atomic16 *a, - __tsan_atomic16 v, __tsan_memory_order mo); -__tsan_atomic32 __tsan_atomic32_fetch_nand(volatile __tsan_atomic32 *a, - __tsan_atomic32 v, __tsan_memory_order mo); -__tsan_atomic64 __tsan_atomic64_fetch_nand(volatile __tsan_atomic64 *a, - __tsan_atomic64 v, __tsan_memory_order mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_fetch_nand(volatile __tsan_atomic128 *a, - __tsan_atomic128 v, __tsan_memory_order mo); -#endif - -int __tsan_atomic8_compare_exchange_weak(volatile __tsan_atomic8 *a, - __tsan_atomic8 *c, __tsan_atomic8 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -int __tsan_atomic16_compare_exchange_weak(volatile __tsan_atomic16 *a, - __tsan_atomic16 *c, __tsan_atomic16 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -int __tsan_atomic32_compare_exchange_weak(volatile __tsan_atomic32 *a, - __tsan_atomic32 *c, __tsan_atomic32 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -int __tsan_atomic64_compare_exchange_weak(volatile __tsan_atomic64 *a, - __tsan_atomic64 *c, __tsan_atomic64 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -#if __TSAN_HAS_INT128 -int __tsan_atomic128_compare_exchange_weak(volatile __tsan_atomic128 *a, - __tsan_atomic128 *c, __tsan_atomic128 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -#endif - -int __tsan_atomic8_compare_exchange_strong(volatile __tsan_atomic8 *a, - __tsan_atomic8 *c, __tsan_atomic8 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -int __tsan_atomic16_compare_exchange_strong(volatile __tsan_atomic16 *a, - __tsan_atomic16 *c, __tsan_atomic16 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -int __tsan_atomic32_compare_exchange_strong(volatile __tsan_atomic32 *a, - __tsan_atomic32 *c, __tsan_atomic32 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -int __tsan_atomic64_compare_exchange_strong(volatile __tsan_atomic64 *a, - __tsan_atomic64 *c, __tsan_atomic64 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -#if __TSAN_HAS_INT128 -int __tsan_atomic128_compare_exchange_strong(volatile __tsan_atomic128 *a, - __tsan_atomic128 *c, __tsan_atomic128 v, __tsan_memory_order mo, - __tsan_memory_order fail_mo); -#endif - -__tsan_atomic8 __tsan_atomic8_compare_exchange_val( - volatile __tsan_atomic8 *a, __tsan_atomic8 c, __tsan_atomic8 v, - __tsan_memory_order mo, __tsan_memory_order fail_mo); -__tsan_atomic16 __tsan_atomic16_compare_exchange_val( - volatile __tsan_atomic16 *a, __tsan_atomic16 c, __tsan_atomic16 v, - __tsan_memory_order mo, __tsan_memory_order fail_mo); -__tsan_atomic32 __tsan_atomic32_compare_exchange_val( - volatile __tsan_atomic32 *a, __tsan_atomic32 c, __tsan_atomic32 v, - __tsan_memory_order mo, __tsan_memory_order fail_mo); -__tsan_atomic64 __tsan_atomic64_compare_exchange_val( - volatile __tsan_atomic64 *a, __tsan_atomic64 c, __tsan_atomic64 v, - __tsan_memory_order mo, __tsan_memory_order fail_mo); -#if __TSAN_HAS_INT128 -__tsan_atomic128 __tsan_atomic128_compare_exchange_val( - volatile __tsan_atomic128 *a, __tsan_atomic128 c, __tsan_atomic128 v, - __tsan_memory_order mo, __tsan_memory_order fail_mo); -#endif - -void __tsan_atomic_thread_fence(__tsan_memory_order mo); -void __tsan_atomic_signal_fence(__tsan_memory_order mo); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // TSAN_INTERFACE_ATOMIC_H diff --git a/contrib/libs/clang14-rt/include/sanitizer/ubsan_interface.h b/contrib/libs/clang14-rt/include/sanitizer/ubsan_interface.h deleted file mode 100644 index 59fc6c3c184c..000000000000 --- a/contrib/libs/clang14-rt/include/sanitizer/ubsan_interface.h +++ /dev/null @@ -1,32 +0,0 @@ -//===-- sanitizer/ubsan_interface.h -----------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of UBSanitizer (UBSan). -// -// Public interface header. -//===----------------------------------------------------------------------===// -#ifndef SANITIZER_UBSAN_INTERFACE_H -#define SANITIZER_UBSAN_INTERFACE_H - -#ifdef __cplusplus -extern "C" { -#endif -/// User-provided default option settings. -/// -/// You can provide your own implementation of this function to return a string -/// containing UBSan runtime options (for example, -/// verbosity=1:halt_on_error=0). -/// -/// \returns Default options string. -const char* __ubsan_default_options(void); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // SANITIZER_UBSAN_INTERFACE_H diff --git a/contrib/libs/clang14-rt/lib/asan-preinit/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/asan-preinit/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/asan-preinit/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/asan-preinit/ya.make b/contrib/libs/clang14-rt/lib/asan-preinit/ya.make deleted file mode 100644 index faf6b168abbb..000000000000 --- a/contrib/libs/clang14-rt/lib/asan-preinit/ya.make +++ /dev/null @@ -1,48 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.asan-preinit${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -fcommon - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib/asan) - -SRCS( - asan_preinit.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/asan/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/asan/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/asan/README.txt b/contrib/libs/clang14-rt/lib/asan/README.txt deleted file mode 100644 index bb6ff42c5cde..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/README.txt +++ /dev/null @@ -1,26 +0,0 @@ -AddressSanitizer RT -================================ -This directory contains sources of the AddressSanitizer (ASan) runtime library. - -Directory structure: -README.txt : This file. -Makefile.mk : File for make-based build. -CMakeLists.txt : File for cmake-based build. -asan_*.{cc,h} : Sources of the asan runtime library. -scripts/* : Helper scripts. -tests/* : ASan unit tests. - -Also ASan runtime needs the following libraries: -lib/interception/ : Machinery used to intercept function calls. -lib/sanitizer_common/ : Code shared between various sanitizers. - -ASan runtime currently also embeds part of LeakSanitizer runtime for -leak detection (lib/lsan/lsan_common.{cc,h}). - -ASan runtime can only be built by CMake. You can run ASan tests -from the root of your CMake build tree: - -make check-asan - -For more instructions see: -https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild diff --git a/contrib/libs/clang14-rt/lib/asan/asan_activation.cpp b/contrib/libs/clang14-rt/lib/asan/asan_activation.cpp deleted file mode 100644 index 1757838600ca..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_activation.cpp +++ /dev/null @@ -1,143 +0,0 @@ -//===-- asan_activation.cpp -------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan activation/deactivation logic. -//===----------------------------------------------------------------------===// - -#include "asan_activation.h" -#include "asan_allocator.h" -#include "asan_flags.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "asan_poisoning.h" -#include "asan_stack.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_flags.h" - -namespace __asan { - -static struct AsanDeactivatedFlags { - AllocatorOptions allocator_options; - int malloc_context_size; - bool poison_heap; - bool coverage; - const char *coverage_dir; - - void RegisterActivationFlags(FlagParser *parser, Flags *f, CommonFlags *cf) { -#define ASAN_ACTIVATION_FLAG(Type, Name) \ - RegisterFlag(parser, #Name, "", &f->Name); -#define COMMON_ACTIVATION_FLAG(Type, Name) \ - RegisterFlag(parser, #Name, "", &cf->Name); -#include "asan_activation_flags.inc" -#undef ASAN_ACTIVATION_FLAG -#undef COMMON_ACTIVATION_FLAG - - RegisterIncludeFlags(parser, cf); - } - - void OverrideFromActivationFlags() { - Flags f; - CommonFlags cf; - FlagParser parser; - RegisterActivationFlags(&parser, &f, &cf); - - cf.SetDefaults(); - // Copy the current activation flags. - allocator_options.CopyTo(&f, &cf); - cf.malloc_context_size = malloc_context_size; - f.poison_heap = poison_heap; - cf.coverage = coverage; - cf.coverage_dir = coverage_dir; - cf.verbosity = Verbosity(); - cf.help = false; // this is activation-specific help - - // Check if activation flags need to be overriden. - if (const char *env = GetEnv("ASAN_ACTIVATION_OPTIONS")) { - parser.ParseString(env); - } - - InitializeCommonFlags(&cf); - - if (Verbosity()) ReportUnrecognizedFlags(); - - if (cf.help) parser.PrintFlagDescriptions(); - - allocator_options.SetFrom(&f, &cf); - malloc_context_size = cf.malloc_context_size; - poison_heap = f.poison_heap; - coverage = cf.coverage; - coverage_dir = cf.coverage_dir; - } - - void Print() { - Report( - "quarantine_size_mb %d, thread_local_quarantine_size_kb %d, " - "max_redzone %d, poison_heap %d, malloc_context_size %d, " - "alloc_dealloc_mismatch %d, allocator_may_return_null %d, coverage %d, " - "coverage_dir %s, allocator_release_to_os_interval_ms %d\n", - allocator_options.quarantine_size_mb, - allocator_options.thread_local_quarantine_size_kb, - allocator_options.max_redzone, poison_heap, malloc_context_size, - allocator_options.alloc_dealloc_mismatch, - allocator_options.may_return_null, coverage, coverage_dir, - allocator_options.release_to_os_interval_ms); - } -} asan_deactivated_flags; - -static bool asan_is_deactivated; - -void AsanDeactivate() { - CHECK(!asan_is_deactivated); - VReport(1, "Deactivating ASan\n"); - - // Stash runtime state. - GetAllocatorOptions(&asan_deactivated_flags.allocator_options); - asan_deactivated_flags.malloc_context_size = GetMallocContextSize(); - asan_deactivated_flags.poison_heap = CanPoisonMemory(); - asan_deactivated_flags.coverage = common_flags()->coverage; - asan_deactivated_flags.coverage_dir = common_flags()->coverage_dir; - - // Deactivate the runtime. - SetCanPoisonMemory(false); - SetMallocContextSize(1); - - AllocatorOptions disabled = asan_deactivated_flags.allocator_options; - disabled.quarantine_size_mb = 0; - disabled.thread_local_quarantine_size_kb = 0; - // Redzone must be at least Max(16, granularity) bytes long. - disabled.min_redzone = Max(16, (int)ASAN_SHADOW_GRANULARITY); - disabled.max_redzone = disabled.min_redzone; - disabled.alloc_dealloc_mismatch = false; - disabled.may_return_null = true; - ReInitializeAllocator(disabled); - - asan_is_deactivated = true; -} - -void AsanActivate() { - if (!asan_is_deactivated) return; - VReport(1, "Activating ASan\n"); - - UpdateProcessName(); - - asan_deactivated_flags.OverrideFromActivationFlags(); - - SetCanPoisonMemory(asan_deactivated_flags.poison_heap); - SetMallocContextSize(asan_deactivated_flags.malloc_context_size); - ReInitializeAllocator(asan_deactivated_flags.allocator_options); - - asan_is_deactivated = false; - if (Verbosity()) { - Report("Activated with flags:\n"); - asan_deactivated_flags.Print(); - } -} - -} // namespace __asan diff --git a/contrib/libs/clang14-rt/lib/asan/asan_activation.h b/contrib/libs/clang14-rt/lib/asan/asan_activation.h deleted file mode 100644 index 93c290c2ae2f..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_activation.h +++ /dev/null @@ -1,22 +0,0 @@ -//===-- asan_activation.h ---------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan activation/deactivation logic. -//===----------------------------------------------------------------------===// - -#ifndef ASAN_ACTIVATION_H -#define ASAN_ACTIVATION_H - -namespace __asan { -void AsanDeactivate(); -void AsanActivate(); -} // namespace __asan - -#endif // ASAN_ACTIVATION_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_activation_flags.inc b/contrib/libs/clang14-rt/lib/asan/asan_activation_flags.inc deleted file mode 100644 index e0fdffc82ac3..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_activation_flags.inc +++ /dev/null @@ -1,36 +0,0 @@ -//===-- asan_activation_flags.inc -------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// A subset of ASan (and common) runtime flags supported at activation time. -// -//===----------------------------------------------------------------------===// -#ifndef ASAN_ACTIVATION_FLAG -# error "Define ASAN_ACTIVATION_FLAG prior to including this file!" -#endif - -#ifndef COMMON_ACTIVATION_FLAG -# error "Define COMMON_ACTIVATION_FLAG prior to including this file!" -#endif - -// ASAN_ACTIVATION_FLAG(Type, Name) -// See COMMON_FLAG in sanitizer_flags.inc for more details. - -ASAN_ACTIVATION_FLAG(int, redzone) -ASAN_ACTIVATION_FLAG(int, max_redzone) -ASAN_ACTIVATION_FLAG(int, quarantine_size_mb) -ASAN_ACTIVATION_FLAG(int, thread_local_quarantine_size_kb) -ASAN_ACTIVATION_FLAG(bool, alloc_dealloc_mismatch) -ASAN_ACTIVATION_FLAG(bool, poison_heap) - -COMMON_ACTIVATION_FLAG(bool, allocator_may_return_null) -COMMON_ACTIVATION_FLAG(int, malloc_context_size) -COMMON_ACTIVATION_FLAG(bool, coverage) -COMMON_ACTIVATION_FLAG(const char *, coverage_dir) -COMMON_ACTIVATION_FLAG(int, verbosity) -COMMON_ACTIVATION_FLAG(bool, help) -COMMON_ACTIVATION_FLAG(s32, allocator_release_to_os_interval_ms) diff --git a/contrib/libs/clang14-rt/lib/asan/asan_allocator.cpp b/contrib/libs/clang14-rt/lib/asan/asan_allocator.cpp deleted file mode 100644 index f9f1cfcd9f87..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_allocator.cpp +++ /dev/null @@ -1,1232 +0,0 @@ -//===-- asan_allocator.cpp ------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Implementation of ASan's memory allocator, 2-nd version. -// This variant uses the allocator from sanitizer_common, i.e. the one shared -// with ThreadSanitizer and MemorySanitizer. -// -//===----------------------------------------------------------------------===// - -#include "asan_allocator.h" - -#include "asan_mapping.h" -#include "asan_poisoning.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "asan_thread.h" -#include "lsan/lsan_common.h" -#include "sanitizer_common/sanitizer_allocator_checks.h" -#include "sanitizer_common/sanitizer_allocator_interface.h" -#include "sanitizer_common/sanitizer_errno.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "sanitizer_common/sanitizer_list.h" -#include "sanitizer_common/sanitizer_quarantine.h" -#include "sanitizer_common/sanitizer_stackdepot.h" - -namespace __asan { - -// Valid redzone sizes are 16, 32, 64, ... 2048, so we encode them in 3 bits. -// We use adaptive redzones: for larger allocation larger redzones are used. -static u32 RZLog2Size(u32 rz_log) { - CHECK_LT(rz_log, 8); - return 16 << rz_log; -} - -static u32 RZSize2Log(u32 rz_size) { - CHECK_GE(rz_size, 16); - CHECK_LE(rz_size, 2048); - CHECK(IsPowerOfTwo(rz_size)); - u32 res = Log2(rz_size) - 4; - CHECK_EQ(rz_size, RZLog2Size(res)); - return res; -} - -static AsanAllocator &get_allocator(); - -static void AtomicContextStore(volatile atomic_uint64_t *atomic_context, - u32 tid, u32 stack) { - u64 context = tid; - context <<= 32; - context += stack; - atomic_store(atomic_context, context, memory_order_relaxed); -} - -static void AtomicContextLoad(const volatile atomic_uint64_t *atomic_context, - u32 &tid, u32 &stack) { - u64 context = atomic_load(atomic_context, memory_order_relaxed); - stack = context; - context >>= 32; - tid = context; -} - -// The memory chunk allocated from the underlying allocator looks like this: -// L L L L L L H H U U U U U U R R -// L -- left redzone words (0 or more bytes) -// H -- ChunkHeader (16 bytes), which is also a part of the left redzone. -// U -- user memory. -// R -- right redzone (0 or more bytes) -// ChunkBase consists of ChunkHeader and other bytes that overlap with user -// memory. - -// If the left redzone is greater than the ChunkHeader size we store a magic -// value in the first uptr word of the memory block and store the address of -// ChunkBase in the next uptr. -// M B L L L L L L L L L H H U U U U U U -// | ^ -// ---------------------| -// M -- magic value kAllocBegMagic -// B -- address of ChunkHeader pointing to the first 'H' - -class ChunkHeader { - public: - atomic_uint8_t chunk_state; - u8 alloc_type : 2; - u8 lsan_tag : 2; - - // align < 8 -> 0 - // else -> log2(min(align, 512)) - 2 - u8 user_requested_alignment_log : 3; - - private: - u16 user_requested_size_hi; - u32 user_requested_size_lo; - atomic_uint64_t alloc_context_id; - - public: - uptr UsedSize() const { - static_assert(sizeof(user_requested_size_lo) == 4, - "Expression below requires this"); - return FIRST_32_SECOND_64(0, ((uptr)user_requested_size_hi << 32)) + - user_requested_size_lo; - } - - void SetUsedSize(uptr size) { - user_requested_size_lo = size; - static_assert(sizeof(user_requested_size_lo) == 4, - "Expression below requires this"); - user_requested_size_hi = FIRST_32_SECOND_64(0, size >> 32); - CHECK_EQ(UsedSize(), size); - } - - void SetAllocContext(u32 tid, u32 stack) { - AtomicContextStore(&alloc_context_id, tid, stack); - } - - void GetAllocContext(u32 &tid, u32 &stack) const { - AtomicContextLoad(&alloc_context_id, tid, stack); - } -}; - -class ChunkBase : public ChunkHeader { - atomic_uint64_t free_context_id; - - public: - void SetFreeContext(u32 tid, u32 stack) { - AtomicContextStore(&free_context_id, tid, stack); - } - - void GetFreeContext(u32 &tid, u32 &stack) const { - AtomicContextLoad(&free_context_id, tid, stack); - } -}; - -static const uptr kChunkHeaderSize = sizeof(ChunkHeader); -static const uptr kChunkHeader2Size = sizeof(ChunkBase) - kChunkHeaderSize; -COMPILER_CHECK(kChunkHeaderSize == 16); -COMPILER_CHECK(kChunkHeader2Size <= 16); - -enum { - // Either just allocated by underlying allocator, but AsanChunk is not yet - // ready, or almost returned to undelying allocator and AsanChunk is already - // meaningless. - CHUNK_INVALID = 0, - // The chunk is allocated and not yet freed. - CHUNK_ALLOCATED = 2, - // The chunk was freed and put into quarantine zone. - CHUNK_QUARANTINE = 3, -}; - -class AsanChunk : public ChunkBase { - public: - uptr Beg() { return reinterpret_cast(this) + kChunkHeaderSize; } - bool AddrIsInside(uptr addr) { - return (addr >= Beg()) && (addr < Beg() + UsedSize()); - } -}; - -class LargeChunkHeader { - static constexpr uptr kAllocBegMagic = - FIRST_32_SECOND_64(0xCC6E96B9, 0xCC6E96B9CC6E96B9ULL); - atomic_uintptr_t magic; - AsanChunk *chunk_header; - - public: - AsanChunk *Get() const { - return atomic_load(&magic, memory_order_acquire) == kAllocBegMagic - ? chunk_header - : nullptr; - } - - void Set(AsanChunk *p) { - if (p) { - chunk_header = p; - atomic_store(&magic, kAllocBegMagic, memory_order_release); - return; - } - - uptr old = kAllocBegMagic; - if (!atomic_compare_exchange_strong(&magic, &old, 0, - memory_order_release)) { - CHECK_EQ(old, kAllocBegMagic); - } - } -}; - -struct QuarantineCallback { - QuarantineCallback(AllocatorCache *cache, BufferedStackTrace *stack) - : cache_(cache), - stack_(stack) { - } - - void Recycle(AsanChunk *m) { - void *p = get_allocator().GetBlockBegin(m); - if (p != m) { - // Clear the magic value, as allocator internals may overwrite the - // contents of deallocated chunk, confusing GetAsanChunk lookup. - reinterpret_cast(p)->Set(nullptr); - } - - u8 old_chunk_state = CHUNK_QUARANTINE; - if (!atomic_compare_exchange_strong(&m->chunk_state, &old_chunk_state, - CHUNK_INVALID, memory_order_acquire)) { - CHECK_EQ(old_chunk_state, CHUNK_QUARANTINE); - } - - PoisonShadow(m->Beg(), RoundUpTo(m->UsedSize(), ASAN_SHADOW_GRANULARITY), - kAsanHeapLeftRedzoneMagic); - - // Statistics. - AsanStats &thread_stats = GetCurrentThreadStats(); - thread_stats.real_frees++; - thread_stats.really_freed += m->UsedSize(); - - get_allocator().Deallocate(cache_, p); - } - - void *Allocate(uptr size) { - void *res = get_allocator().Allocate(cache_, size, 1); - // TODO(alekseys): Consider making quarantine OOM-friendly. - if (UNLIKELY(!res)) - ReportOutOfMemory(size, stack_); - return res; - } - - void Deallocate(void *p) { - get_allocator().Deallocate(cache_, p); - } - - private: - AllocatorCache* const cache_; - BufferedStackTrace* const stack_; -}; - -typedef Quarantine AsanQuarantine; -typedef AsanQuarantine::Cache QuarantineCache; - -void AsanMapUnmapCallback::OnMap(uptr p, uptr size) const { - PoisonShadow(p, size, kAsanHeapLeftRedzoneMagic); - // Statistics. - AsanStats &thread_stats = GetCurrentThreadStats(); - thread_stats.mmaps++; - thread_stats.mmaped += size; -} -void AsanMapUnmapCallback::OnUnmap(uptr p, uptr size) const { - PoisonShadow(p, size, 0); - // We are about to unmap a chunk of user memory. - // Mark the corresponding shadow memory as not needed. - FlushUnneededASanShadowMemory(p, size); - // Statistics. - AsanStats &thread_stats = GetCurrentThreadStats(); - thread_stats.munmaps++; - thread_stats.munmaped += size; -} - -// We can not use THREADLOCAL because it is not supported on some of the -// platforms we care about (OSX 10.6, Android). -// static THREADLOCAL AllocatorCache cache; -AllocatorCache *GetAllocatorCache(AsanThreadLocalMallocStorage *ms) { - CHECK(ms); - return &ms->allocator_cache; -} - -QuarantineCache *GetQuarantineCache(AsanThreadLocalMallocStorage *ms) { - CHECK(ms); - CHECK_LE(sizeof(QuarantineCache), sizeof(ms->quarantine_cache)); - return reinterpret_cast(ms->quarantine_cache); -} - -void AllocatorOptions::SetFrom(const Flags *f, const CommonFlags *cf) { - quarantine_size_mb = f->quarantine_size_mb; - thread_local_quarantine_size_kb = f->thread_local_quarantine_size_kb; - min_redzone = f->redzone; - max_redzone = f->max_redzone; - may_return_null = cf->allocator_may_return_null; - alloc_dealloc_mismatch = f->alloc_dealloc_mismatch; - release_to_os_interval_ms = cf->allocator_release_to_os_interval_ms; -} - -void AllocatorOptions::CopyTo(Flags *f, CommonFlags *cf) { - f->quarantine_size_mb = quarantine_size_mb; - f->thread_local_quarantine_size_kb = thread_local_quarantine_size_kb; - f->redzone = min_redzone; - f->max_redzone = max_redzone; - cf->allocator_may_return_null = may_return_null; - f->alloc_dealloc_mismatch = alloc_dealloc_mismatch; - cf->allocator_release_to_os_interval_ms = release_to_os_interval_ms; -} - -struct Allocator { - static const uptr kMaxAllowedMallocSize = - FIRST_32_SECOND_64(3UL << 30, 1ULL << 40); - - AsanAllocator allocator; - AsanQuarantine quarantine; - StaticSpinMutex fallback_mutex; - AllocatorCache fallback_allocator_cache; - QuarantineCache fallback_quarantine_cache; - - uptr max_user_defined_malloc_size; - - // ------------------- Options -------------------------- - atomic_uint16_t min_redzone; - atomic_uint16_t max_redzone; - atomic_uint8_t alloc_dealloc_mismatch; - - // ------------------- Initialization ------------------------ - explicit Allocator(LinkerInitialized) - : quarantine(LINKER_INITIALIZED), - fallback_quarantine_cache(LINKER_INITIALIZED) {} - - void CheckOptions(const AllocatorOptions &options) const { - CHECK_GE(options.min_redzone, 16); - CHECK_GE(options.max_redzone, options.min_redzone); - CHECK_LE(options.max_redzone, 2048); - CHECK(IsPowerOfTwo(options.min_redzone)); - CHECK(IsPowerOfTwo(options.max_redzone)); - } - - void SharedInitCode(const AllocatorOptions &options) { - CheckOptions(options); - quarantine.Init((uptr)options.quarantine_size_mb << 20, - (uptr)options.thread_local_quarantine_size_kb << 10); - atomic_store(&alloc_dealloc_mismatch, options.alloc_dealloc_mismatch, - memory_order_release); - atomic_store(&min_redzone, options.min_redzone, memory_order_release); - atomic_store(&max_redzone, options.max_redzone, memory_order_release); - } - - void InitLinkerInitialized(const AllocatorOptions &options) { - SetAllocatorMayReturnNull(options.may_return_null); - allocator.InitLinkerInitialized(options.release_to_os_interval_ms); - SharedInitCode(options); - max_user_defined_malloc_size = common_flags()->max_allocation_size_mb - ? common_flags()->max_allocation_size_mb - << 20 - : kMaxAllowedMallocSize; - } - - void RePoisonChunk(uptr chunk) { - // This could be a user-facing chunk (with redzones), or some internal - // housekeeping chunk, like TransferBatch. Start by assuming the former. - AsanChunk *ac = GetAsanChunk((void *)chunk); - uptr allocated_size = allocator.GetActuallyAllocatedSize((void *)chunk); - if (ac && atomic_load(&ac->chunk_state, memory_order_acquire) == - CHUNK_ALLOCATED) { - uptr beg = ac->Beg(); - uptr end = ac->Beg() + ac->UsedSize(); - uptr chunk_end = chunk + allocated_size; - if (chunk < beg && beg < end && end <= chunk_end) { - // Looks like a valid AsanChunk in use, poison redzones only. - PoisonShadow(chunk, beg - chunk, kAsanHeapLeftRedzoneMagic); - uptr end_aligned_down = RoundDownTo(end, ASAN_SHADOW_GRANULARITY); - FastPoisonShadowPartialRightRedzone( - end_aligned_down, end - end_aligned_down, - chunk_end - end_aligned_down, kAsanHeapLeftRedzoneMagic); - return; - } - } - - // This is either not an AsanChunk or freed or quarantined AsanChunk. - // In either case, poison everything. - PoisonShadow(chunk, allocated_size, kAsanHeapLeftRedzoneMagic); - } - - void ReInitialize(const AllocatorOptions &options) { - SetAllocatorMayReturnNull(options.may_return_null); - allocator.SetReleaseToOSIntervalMs(options.release_to_os_interval_ms); - SharedInitCode(options); - - // Poison all existing allocation's redzones. - if (CanPoisonMemory()) { - allocator.ForceLock(); - allocator.ForEachChunk( - [](uptr chunk, void *alloc) { - ((Allocator *)alloc)->RePoisonChunk(chunk); - }, - this); - allocator.ForceUnlock(); - } - } - - void GetOptions(AllocatorOptions *options) const { - options->quarantine_size_mb = quarantine.GetSize() >> 20; - options->thread_local_quarantine_size_kb = quarantine.GetCacheSize() >> 10; - options->min_redzone = atomic_load(&min_redzone, memory_order_acquire); - options->max_redzone = atomic_load(&max_redzone, memory_order_acquire); - options->may_return_null = AllocatorMayReturnNull(); - options->alloc_dealloc_mismatch = - atomic_load(&alloc_dealloc_mismatch, memory_order_acquire); - options->release_to_os_interval_ms = allocator.ReleaseToOSIntervalMs(); - } - - // -------------------- Helper methods. ------------------------- - uptr ComputeRZLog(uptr user_requested_size) { - u32 rz_log = user_requested_size <= 64 - 16 ? 0 - : user_requested_size <= 128 - 32 ? 1 - : user_requested_size <= 512 - 64 ? 2 - : user_requested_size <= 4096 - 128 ? 3 - : user_requested_size <= (1 << 14) - 256 ? 4 - : user_requested_size <= (1 << 15) - 512 ? 5 - : user_requested_size <= (1 << 16) - 1024 ? 6 - : 7; - u32 hdr_log = RZSize2Log(RoundUpToPowerOfTwo(sizeof(ChunkHeader))); - u32 min_log = RZSize2Log(atomic_load(&min_redzone, memory_order_acquire)); - u32 max_log = RZSize2Log(atomic_load(&max_redzone, memory_order_acquire)); - return Min(Max(rz_log, Max(min_log, hdr_log)), Max(max_log, hdr_log)); - } - - static uptr ComputeUserRequestedAlignmentLog(uptr user_requested_alignment) { - if (user_requested_alignment < 8) - return 0; - if (user_requested_alignment > 512) - user_requested_alignment = 512; - return Log2(user_requested_alignment) - 2; - } - - static uptr ComputeUserAlignment(uptr user_requested_alignment_log) { - if (user_requested_alignment_log == 0) - return 0; - return 1LL << (user_requested_alignment_log + 2); - } - - // We have an address between two chunks, and we want to report just one. - AsanChunk *ChooseChunk(uptr addr, AsanChunk *left_chunk, - AsanChunk *right_chunk) { - if (!left_chunk) - return right_chunk; - if (!right_chunk) - return left_chunk; - // Prefer an allocated chunk over freed chunk and freed chunk - // over available chunk. - u8 left_state = atomic_load(&left_chunk->chunk_state, memory_order_relaxed); - u8 right_state = - atomic_load(&right_chunk->chunk_state, memory_order_relaxed); - if (left_state != right_state) { - if (left_state == CHUNK_ALLOCATED) - return left_chunk; - if (right_state == CHUNK_ALLOCATED) - return right_chunk; - if (left_state == CHUNK_QUARANTINE) - return left_chunk; - if (right_state == CHUNK_QUARANTINE) - return right_chunk; - } - // Same chunk_state: choose based on offset. - sptr l_offset = 0, r_offset = 0; - CHECK(AsanChunkView(left_chunk).AddrIsAtRight(addr, 1, &l_offset)); - CHECK(AsanChunkView(right_chunk).AddrIsAtLeft(addr, 1, &r_offset)); - if (l_offset < r_offset) - return left_chunk; - return right_chunk; - } - - bool UpdateAllocationStack(uptr addr, BufferedStackTrace *stack) { - AsanChunk *m = GetAsanChunkByAddr(addr); - if (!m) return false; - if (atomic_load(&m->chunk_state, memory_order_acquire) != CHUNK_ALLOCATED) - return false; - if (m->Beg() != addr) return false; - AsanThread *t = GetCurrentThread(); - m->SetAllocContext(t ? t->tid() : kMainTid, StackDepotPut(*stack)); - return true; - } - - // -------------------- Allocation/Deallocation routines --------------- - void *Allocate(uptr size, uptr alignment, BufferedStackTrace *stack, - AllocType alloc_type, bool can_fill) { - if (UNLIKELY(!asan_inited)) - AsanInitFromRtl(); - if (UNLIKELY(IsRssLimitExceeded())) { - if (AllocatorMayReturnNull()) - return nullptr; - ReportRssLimitExceeded(stack); - } - Flags &fl = *flags(); - CHECK(stack); - const uptr min_alignment = ASAN_SHADOW_GRANULARITY; - const uptr user_requested_alignment_log = - ComputeUserRequestedAlignmentLog(alignment); - if (alignment < min_alignment) - alignment = min_alignment; - if (size == 0) { - // We'd be happy to avoid allocating memory for zero-size requests, but - // some programs/tests depend on this behavior and assume that malloc - // would not return NULL even for zero-size allocations. Moreover, it - // looks like operator new should never return NULL, and results of - // consecutive "new" calls must be different even if the allocated size - // is zero. - size = 1; - } - CHECK(IsPowerOfTwo(alignment)); - uptr rz_log = ComputeRZLog(size); - uptr rz_size = RZLog2Size(rz_log); - uptr rounded_size = RoundUpTo(Max(size, kChunkHeader2Size), alignment); - uptr needed_size = rounded_size + rz_size; - if (alignment > min_alignment) - needed_size += alignment; - // If we are allocating from the secondary allocator, there will be no - // automatic right redzone, so add the right redzone manually. - if (!PrimaryAllocator::CanAllocate(needed_size, alignment)) - needed_size += rz_size; - CHECK(IsAligned(needed_size, min_alignment)); - if (size > kMaxAllowedMallocSize || needed_size > kMaxAllowedMallocSize || - size > max_user_defined_malloc_size) { - if (AllocatorMayReturnNull()) { - Report("WARNING: AddressSanitizer failed to allocate 0x%zx bytes\n", - size); - return nullptr; - } - uptr malloc_limit = - Min(kMaxAllowedMallocSize, max_user_defined_malloc_size); - ReportAllocationSizeTooBig(size, needed_size, malloc_limit, stack); - } - - AsanThread *t = GetCurrentThread(); - void *allocated; - if (t) { - AllocatorCache *cache = GetAllocatorCache(&t->malloc_storage()); - allocated = allocator.Allocate(cache, needed_size, 8); - } else { - SpinMutexLock l(&fallback_mutex); - AllocatorCache *cache = &fallback_allocator_cache; - allocated = allocator.Allocate(cache, needed_size, 8); - } - if (UNLIKELY(!allocated)) { - SetAllocatorOutOfMemory(); - if (AllocatorMayReturnNull()) - return nullptr; - ReportOutOfMemory(size, stack); - } - - if (*(u8 *)MEM_TO_SHADOW((uptr)allocated) == 0 && CanPoisonMemory()) { - // Heap poisoning is enabled, but the allocator provides an unpoisoned - // chunk. This is possible if CanPoisonMemory() was false for some - // time, for example, due to flags()->start_disabled. - // Anyway, poison the block before using it for anything else. - uptr allocated_size = allocator.GetActuallyAllocatedSize(allocated); - PoisonShadow((uptr)allocated, allocated_size, kAsanHeapLeftRedzoneMagic); - } - - uptr alloc_beg = reinterpret_cast(allocated); - uptr alloc_end = alloc_beg + needed_size; - uptr user_beg = alloc_beg + rz_size; - if (!IsAligned(user_beg, alignment)) - user_beg = RoundUpTo(user_beg, alignment); - uptr user_end = user_beg + size; - CHECK_LE(user_end, alloc_end); - uptr chunk_beg = user_beg - kChunkHeaderSize; - AsanChunk *m = reinterpret_cast(chunk_beg); - m->alloc_type = alloc_type; - CHECK(size); - m->SetUsedSize(size); - m->user_requested_alignment_log = user_requested_alignment_log; - - m->SetAllocContext(t ? t->tid() : kMainTid, StackDepotPut(*stack)); - - uptr size_rounded_down_to_granularity = - RoundDownTo(size, ASAN_SHADOW_GRANULARITY); - // Unpoison the bulk of the memory region. - if (size_rounded_down_to_granularity) - PoisonShadow(user_beg, size_rounded_down_to_granularity, 0); - // Deal with the end of the region if size is not aligned to granularity. - if (size != size_rounded_down_to_granularity && CanPoisonMemory()) { - u8 *shadow = - (u8 *)MemToShadow(user_beg + size_rounded_down_to_granularity); - *shadow = fl.poison_partial ? (size & (ASAN_SHADOW_GRANULARITY - 1)) : 0; - } - - AsanStats &thread_stats = GetCurrentThreadStats(); - thread_stats.mallocs++; - thread_stats.malloced += size; - thread_stats.malloced_redzones += needed_size - size; - if (needed_size > SizeClassMap::kMaxSize) - thread_stats.malloc_large++; - else - thread_stats.malloced_by_size[SizeClassMap::ClassID(needed_size)]++; - - void *res = reinterpret_cast(user_beg); - if (can_fill && fl.max_malloc_fill_size) { - uptr fill_size = Min(size, (uptr)fl.max_malloc_fill_size); - REAL(memset)(res, fl.malloc_fill_byte, fill_size); - } -#if CAN_SANITIZE_LEAKS - m->lsan_tag = __lsan::DisabledInThisThread() ? __lsan::kIgnored - : __lsan::kDirectlyLeaked; -#endif - // Must be the last mutation of metadata in this function. - atomic_store(&m->chunk_state, CHUNK_ALLOCATED, memory_order_release); - if (alloc_beg != chunk_beg) { - CHECK_LE(alloc_beg + sizeof(LargeChunkHeader), chunk_beg); - reinterpret_cast(alloc_beg)->Set(m); - } - ASAN_MALLOC_HOOK(res, size); - return res; - } - - // Set quarantine flag if chunk is allocated, issue ASan error report on - // available and quarantined chunks. Return true on success, false otherwise. - bool AtomicallySetQuarantineFlagIfAllocated(AsanChunk *m, void *ptr, - BufferedStackTrace *stack) { - u8 old_chunk_state = CHUNK_ALLOCATED; - // Flip the chunk_state atomically to avoid race on double-free. - if (!atomic_compare_exchange_strong(&m->chunk_state, &old_chunk_state, - CHUNK_QUARANTINE, - memory_order_acquire)) { - ReportInvalidFree(ptr, old_chunk_state, stack); - // It's not safe to push a chunk in quarantine on invalid free. - return false; - } - CHECK_EQ(CHUNK_ALLOCATED, old_chunk_state); - // It was a user data. - m->SetFreeContext(kInvalidTid, 0); - return true; - } - - // Expects the chunk to already be marked as quarantined by using - // AtomicallySetQuarantineFlagIfAllocated. - void QuarantineChunk(AsanChunk *m, void *ptr, BufferedStackTrace *stack) { - CHECK_EQ(atomic_load(&m->chunk_state, memory_order_relaxed), - CHUNK_QUARANTINE); - AsanThread *t = GetCurrentThread(); - m->SetFreeContext(t ? t->tid() : 0, StackDepotPut(*stack)); - - Flags &fl = *flags(); - if (fl.max_free_fill_size > 0) { - // We have to skip the chunk header, it contains free_context_id. - uptr scribble_start = (uptr)m + kChunkHeaderSize + kChunkHeader2Size; - if (m->UsedSize() >= kChunkHeader2Size) { // Skip Header2 in user area. - uptr size_to_fill = m->UsedSize() - kChunkHeader2Size; - size_to_fill = Min(size_to_fill, (uptr)fl.max_free_fill_size); - REAL(memset)((void *)scribble_start, fl.free_fill_byte, size_to_fill); - } - } - - // Poison the region. - PoisonShadow(m->Beg(), RoundUpTo(m->UsedSize(), ASAN_SHADOW_GRANULARITY), - kAsanHeapFreeMagic); - - AsanStats &thread_stats = GetCurrentThreadStats(); - thread_stats.frees++; - thread_stats.freed += m->UsedSize(); - - // Push into quarantine. - if (t) { - AsanThreadLocalMallocStorage *ms = &t->malloc_storage(); - AllocatorCache *ac = GetAllocatorCache(ms); - quarantine.Put(GetQuarantineCache(ms), QuarantineCallback(ac, stack), m, - m->UsedSize()); - } else { - SpinMutexLock l(&fallback_mutex); - AllocatorCache *ac = &fallback_allocator_cache; - quarantine.Put(&fallback_quarantine_cache, QuarantineCallback(ac, stack), - m, m->UsedSize()); - } - } - - void Deallocate(void *ptr, uptr delete_size, uptr delete_alignment, - BufferedStackTrace *stack, AllocType alloc_type) { - uptr p = reinterpret_cast(ptr); - if (p == 0) return; - - uptr chunk_beg = p - kChunkHeaderSize; - AsanChunk *m = reinterpret_cast(chunk_beg); - - // On Windows, uninstrumented DLLs may allocate memory before ASan hooks - // malloc. Don't report an invalid free in this case. - if (SANITIZER_WINDOWS && - !get_allocator().PointerIsMine(ptr)) { - if (!IsSystemHeapAddress(p)) - ReportFreeNotMalloced(p, stack); - return; - } - - ASAN_FREE_HOOK(ptr); - - // Must mark the chunk as quarantined before any changes to its metadata. - // Do not quarantine given chunk if we failed to set CHUNK_QUARANTINE flag. - if (!AtomicallySetQuarantineFlagIfAllocated(m, ptr, stack)) return; - - if (m->alloc_type != alloc_type) { - if (atomic_load(&alloc_dealloc_mismatch, memory_order_acquire)) { - ReportAllocTypeMismatch((uptr)ptr, stack, (AllocType)m->alloc_type, - (AllocType)alloc_type); - } - } else { - if (flags()->new_delete_type_mismatch && - (alloc_type == FROM_NEW || alloc_type == FROM_NEW_BR) && - ((delete_size && delete_size != m->UsedSize()) || - ComputeUserRequestedAlignmentLog(delete_alignment) != - m->user_requested_alignment_log)) { - ReportNewDeleteTypeMismatch(p, delete_size, delete_alignment, stack); - } - } - - QuarantineChunk(m, ptr, stack); - } - - void *Reallocate(void *old_ptr, uptr new_size, BufferedStackTrace *stack) { - CHECK(old_ptr && new_size); - uptr p = reinterpret_cast(old_ptr); - uptr chunk_beg = p - kChunkHeaderSize; - AsanChunk *m = reinterpret_cast(chunk_beg); - - AsanStats &thread_stats = GetCurrentThreadStats(); - thread_stats.reallocs++; - thread_stats.realloced += new_size; - - void *new_ptr = Allocate(new_size, 8, stack, FROM_MALLOC, true); - if (new_ptr) { - u8 chunk_state = atomic_load(&m->chunk_state, memory_order_acquire); - if (chunk_state != CHUNK_ALLOCATED) - ReportInvalidFree(old_ptr, chunk_state, stack); - CHECK_NE(REAL(memcpy), nullptr); - uptr memcpy_size = Min(new_size, m->UsedSize()); - // If realloc() races with free(), we may start copying freed memory. - // However, we will report racy double-free later anyway. - REAL(memcpy)(new_ptr, old_ptr, memcpy_size); - Deallocate(old_ptr, 0, 0, stack, FROM_MALLOC); - } - return new_ptr; - } - - void *Calloc(uptr nmemb, uptr size, BufferedStackTrace *stack) { - if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { - if (AllocatorMayReturnNull()) - return nullptr; - ReportCallocOverflow(nmemb, size, stack); - } - void *ptr = Allocate(nmemb * size, 8, stack, FROM_MALLOC, false); - // If the memory comes from the secondary allocator no need to clear it - // as it comes directly from mmap. - if (ptr && allocator.FromPrimary(ptr)) - REAL(memset)(ptr, 0, nmemb * size); - return ptr; - } - - void ReportInvalidFree(void *ptr, u8 chunk_state, BufferedStackTrace *stack) { - if (chunk_state == CHUNK_QUARANTINE) - ReportDoubleFree((uptr)ptr, stack); - else - ReportFreeNotMalloced((uptr)ptr, stack); - } - - void CommitBack(AsanThreadLocalMallocStorage *ms, BufferedStackTrace *stack) { - AllocatorCache *ac = GetAllocatorCache(ms); - quarantine.Drain(GetQuarantineCache(ms), QuarantineCallback(ac, stack)); - allocator.SwallowCache(ac); - } - - // -------------------------- Chunk lookup ---------------------- - - // Assumes alloc_beg == allocator.GetBlockBegin(alloc_beg). - // Returns nullptr if AsanChunk is not yet initialized just after - // get_allocator().Allocate(), or is being destroyed just before - // get_allocator().Deallocate(). - AsanChunk *GetAsanChunk(void *alloc_beg) { - if (!alloc_beg) - return nullptr; - AsanChunk *p = reinterpret_cast(alloc_beg)->Get(); - if (!p) { - if (!allocator.FromPrimary(alloc_beg)) - return nullptr; - p = reinterpret_cast(alloc_beg); - } - u8 state = atomic_load(&p->chunk_state, memory_order_relaxed); - // It does not guaranty that Chunk is initialized, but it's - // definitely not for any other value. - if (state == CHUNK_ALLOCATED || state == CHUNK_QUARANTINE) - return p; - return nullptr; - } - - AsanChunk *GetAsanChunkByAddr(uptr p) { - void *alloc_beg = allocator.GetBlockBegin(reinterpret_cast(p)); - return GetAsanChunk(alloc_beg); - } - - // Allocator must be locked when this function is called. - AsanChunk *GetAsanChunkByAddrFastLocked(uptr p) { - void *alloc_beg = - allocator.GetBlockBeginFastLocked(reinterpret_cast(p)); - return GetAsanChunk(alloc_beg); - } - - uptr AllocationSize(uptr p) { - AsanChunk *m = GetAsanChunkByAddr(p); - if (!m) return 0; - if (atomic_load(&m->chunk_state, memory_order_acquire) != CHUNK_ALLOCATED) - return 0; - if (m->Beg() != p) return 0; - return m->UsedSize(); - } - - AsanChunkView FindHeapChunkByAddress(uptr addr) { - AsanChunk *m1 = GetAsanChunkByAddr(addr); - sptr offset = 0; - if (!m1 || AsanChunkView(m1).AddrIsAtLeft(addr, 1, &offset)) { - // The address is in the chunk's left redzone, so maybe it is actually - // a right buffer overflow from the other chunk to the left. - // Search a bit to the left to see if there is another chunk. - AsanChunk *m2 = nullptr; - for (uptr l = 1; l < GetPageSizeCached(); l++) { - m2 = GetAsanChunkByAddr(addr - l); - if (m2 == m1) continue; // Still the same chunk. - break; - } - if (m2 && AsanChunkView(m2).AddrIsAtRight(addr, 1, &offset)) - m1 = ChooseChunk(addr, m2, m1); - } - return AsanChunkView(m1); - } - - void Purge(BufferedStackTrace *stack) { - AsanThread *t = GetCurrentThread(); - if (t) { - AsanThreadLocalMallocStorage *ms = &t->malloc_storage(); - quarantine.DrainAndRecycle(GetQuarantineCache(ms), - QuarantineCallback(GetAllocatorCache(ms), - stack)); - } - { - SpinMutexLock l(&fallback_mutex); - quarantine.DrainAndRecycle(&fallback_quarantine_cache, - QuarantineCallback(&fallback_allocator_cache, - stack)); - } - - allocator.ForceReleaseToOS(); - } - - void PrintStats() { - allocator.PrintStats(); - quarantine.PrintStats(); - } - - void ForceLock() SANITIZER_ACQUIRE(fallback_mutex) { - allocator.ForceLock(); - fallback_mutex.Lock(); - } - - void ForceUnlock() SANITIZER_RELEASE(fallback_mutex) { - fallback_mutex.Unlock(); - allocator.ForceUnlock(); - } -}; - -static Allocator instance(LINKER_INITIALIZED); - -static AsanAllocator &get_allocator() { - return instance.allocator; -} - -bool AsanChunkView::IsValid() const { - return chunk_ && atomic_load(&chunk_->chunk_state, memory_order_relaxed) != - CHUNK_INVALID; -} -bool AsanChunkView::IsAllocated() const { - return chunk_ && atomic_load(&chunk_->chunk_state, memory_order_relaxed) == - CHUNK_ALLOCATED; -} -bool AsanChunkView::IsQuarantined() const { - return chunk_ && atomic_load(&chunk_->chunk_state, memory_order_relaxed) == - CHUNK_QUARANTINE; -} -uptr AsanChunkView::Beg() const { return chunk_->Beg(); } -uptr AsanChunkView::End() const { return Beg() + UsedSize(); } -uptr AsanChunkView::UsedSize() const { return chunk_->UsedSize(); } -u32 AsanChunkView::UserRequestedAlignment() const { - return Allocator::ComputeUserAlignment(chunk_->user_requested_alignment_log); -} - -uptr AsanChunkView::AllocTid() const { - u32 tid = 0; - u32 stack = 0; - chunk_->GetAllocContext(tid, stack); - return tid; -} - -uptr AsanChunkView::FreeTid() const { - if (!IsQuarantined()) - return kInvalidTid; - u32 tid = 0; - u32 stack = 0; - chunk_->GetFreeContext(tid, stack); - return tid; -} - -AllocType AsanChunkView::GetAllocType() const { - return (AllocType)chunk_->alloc_type; -} - -u32 AsanChunkView::GetAllocStackId() const { - u32 tid = 0; - u32 stack = 0; - chunk_->GetAllocContext(tid, stack); - return stack; -} - -u32 AsanChunkView::GetFreeStackId() const { - if (!IsQuarantined()) - return 0; - u32 tid = 0; - u32 stack = 0; - chunk_->GetFreeContext(tid, stack); - return stack; -} - -void InitializeAllocator(const AllocatorOptions &options) { - instance.InitLinkerInitialized(options); -} - -void ReInitializeAllocator(const AllocatorOptions &options) { - instance.ReInitialize(options); -} - -void GetAllocatorOptions(AllocatorOptions *options) { - instance.GetOptions(options); -} - -AsanChunkView FindHeapChunkByAddress(uptr addr) { - return instance.FindHeapChunkByAddress(addr); -} -AsanChunkView FindHeapChunkByAllocBeg(uptr addr) { - return AsanChunkView(instance.GetAsanChunk(reinterpret_cast(addr))); -} - -void AsanThreadLocalMallocStorage::CommitBack() { - GET_STACK_TRACE_MALLOC; - instance.CommitBack(this, &stack); -} - -void PrintInternalAllocatorStats() { - instance.PrintStats(); -} - -void asan_free(void *ptr, BufferedStackTrace *stack, AllocType alloc_type) { - instance.Deallocate(ptr, 0, 0, stack, alloc_type); -} - -void asan_delete(void *ptr, uptr size, uptr alignment, - BufferedStackTrace *stack, AllocType alloc_type) { - instance.Deallocate(ptr, size, alignment, stack, alloc_type); -} - -void *asan_malloc(uptr size, BufferedStackTrace *stack) { - return SetErrnoOnNull(instance.Allocate(size, 8, stack, FROM_MALLOC, true)); -} - -void *asan_calloc(uptr nmemb, uptr size, BufferedStackTrace *stack) { - return SetErrnoOnNull(instance.Calloc(nmemb, size, stack)); -} - -void *asan_reallocarray(void *p, uptr nmemb, uptr size, - BufferedStackTrace *stack) { - if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { - errno = errno_ENOMEM; - if (AllocatorMayReturnNull()) - return nullptr; - ReportReallocArrayOverflow(nmemb, size, stack); - } - return asan_realloc(p, nmemb * size, stack); -} - -void *asan_realloc(void *p, uptr size, BufferedStackTrace *stack) { - if (!p) - return SetErrnoOnNull(instance.Allocate(size, 8, stack, FROM_MALLOC, true)); - if (size == 0) { - if (flags()->allocator_frees_and_returns_null_on_realloc_zero) { - instance.Deallocate(p, 0, 0, stack, FROM_MALLOC); - return nullptr; - } - // Allocate a size of 1 if we shouldn't free() on Realloc to 0 - size = 1; - } - return SetErrnoOnNull(instance.Reallocate(p, size, stack)); -} - -void *asan_valloc(uptr size, BufferedStackTrace *stack) { - return SetErrnoOnNull( - instance.Allocate(size, GetPageSizeCached(), stack, FROM_MALLOC, true)); -} - -void *asan_pvalloc(uptr size, BufferedStackTrace *stack) { - uptr PageSize = GetPageSizeCached(); - if (UNLIKELY(CheckForPvallocOverflow(size, PageSize))) { - errno = errno_ENOMEM; - if (AllocatorMayReturnNull()) - return nullptr; - ReportPvallocOverflow(size, stack); - } - // pvalloc(0) should allocate one page. - size = size ? RoundUpTo(size, PageSize) : PageSize; - return SetErrnoOnNull( - instance.Allocate(size, PageSize, stack, FROM_MALLOC, true)); -} - -void *asan_memalign(uptr alignment, uptr size, BufferedStackTrace *stack, - AllocType alloc_type) { - if (UNLIKELY(!IsPowerOfTwo(alignment))) { - errno = errno_EINVAL; - if (AllocatorMayReturnNull()) - return nullptr; - ReportInvalidAllocationAlignment(alignment, stack); - } - return SetErrnoOnNull( - instance.Allocate(size, alignment, stack, alloc_type, true)); -} - -void *asan_aligned_alloc(uptr alignment, uptr size, BufferedStackTrace *stack) { - if (UNLIKELY(!CheckAlignedAllocAlignmentAndSize(alignment, size))) { - errno = errno_EINVAL; - if (AllocatorMayReturnNull()) - return nullptr; - ReportInvalidAlignedAllocAlignment(size, alignment, stack); - } - return SetErrnoOnNull( - instance.Allocate(size, alignment, stack, FROM_MALLOC, true)); -} - -int asan_posix_memalign(void **memptr, uptr alignment, uptr size, - BufferedStackTrace *stack) { - if (UNLIKELY(!CheckPosixMemalignAlignment(alignment))) { - if (AllocatorMayReturnNull()) - return errno_EINVAL; - ReportInvalidPosixMemalignAlignment(alignment, stack); - } - void *ptr = instance.Allocate(size, alignment, stack, FROM_MALLOC, true); - if (UNLIKELY(!ptr)) - // OOM error is already taken care of by Allocate. - return errno_ENOMEM; - CHECK(IsAligned((uptr)ptr, alignment)); - *memptr = ptr; - return 0; -} - -uptr asan_malloc_usable_size(const void *ptr, uptr pc, uptr bp) { - if (!ptr) return 0; - uptr usable_size = instance.AllocationSize(reinterpret_cast(ptr)); - if (flags()->check_malloc_usable_size && (usable_size == 0)) { - GET_STACK_TRACE_FATAL(pc, bp); - ReportMallocUsableSizeNotOwned((uptr)ptr, &stack); - } - return usable_size; -} - -uptr asan_mz_size(const void *ptr) { - return instance.AllocationSize(reinterpret_cast(ptr)); -} - -void asan_mz_force_lock() SANITIZER_NO_THREAD_SAFETY_ANALYSIS { - instance.ForceLock(); -} - -void asan_mz_force_unlock() SANITIZER_NO_THREAD_SAFETY_ANALYSIS { - instance.ForceUnlock(); -} - -} // namespace __asan - -// --- Implementation of LSan-specific functions --- {{{1 -namespace __lsan { -void LockAllocator() { - __asan::get_allocator().ForceLock(); -} - -void UnlockAllocator() { - __asan::get_allocator().ForceUnlock(); -} - -void GetAllocatorGlobalRange(uptr *begin, uptr *end) { - *begin = (uptr)&__asan::get_allocator(); - *end = *begin + sizeof(__asan::get_allocator()); -} - -uptr PointsIntoChunk(void *p) { - uptr addr = reinterpret_cast(p); - __asan::AsanChunk *m = __asan::instance.GetAsanChunkByAddrFastLocked(addr); - if (!m || atomic_load(&m->chunk_state, memory_order_acquire) != - __asan::CHUNK_ALLOCATED) - return 0; - uptr chunk = m->Beg(); - if (m->AddrIsInside(addr)) - return chunk; - if (IsSpecialCaseOfOperatorNew0(chunk, m->UsedSize(), addr)) - return chunk; - return 0; -} - -uptr GetUserBegin(uptr chunk) { - __asan::AsanChunk *m = __asan::instance.GetAsanChunkByAddrFastLocked(chunk); - return m ? m->Beg() : 0; -} - -LsanMetadata::LsanMetadata(uptr chunk) { - metadata_ = chunk ? reinterpret_cast(chunk - __asan::kChunkHeaderSize) - : nullptr; -} - -bool LsanMetadata::allocated() const { - if (!metadata_) - return false; - __asan::AsanChunk *m = reinterpret_cast<__asan::AsanChunk *>(metadata_); - return atomic_load(&m->chunk_state, memory_order_relaxed) == - __asan::CHUNK_ALLOCATED; -} - -ChunkTag LsanMetadata::tag() const { - __asan::AsanChunk *m = reinterpret_cast<__asan::AsanChunk *>(metadata_); - return static_cast(m->lsan_tag); -} - -void LsanMetadata::set_tag(ChunkTag value) { - __asan::AsanChunk *m = reinterpret_cast<__asan::AsanChunk *>(metadata_); - m->lsan_tag = value; -} - -uptr LsanMetadata::requested_size() const { - __asan::AsanChunk *m = reinterpret_cast<__asan::AsanChunk *>(metadata_); - return m->UsedSize(); -} - -u32 LsanMetadata::stack_trace_id() const { - __asan::AsanChunk *m = reinterpret_cast<__asan::AsanChunk *>(metadata_); - u32 tid = 0; - u32 stack = 0; - m->GetAllocContext(tid, stack); - return stack; -} - -void ForEachChunk(ForEachChunkCallback callback, void *arg) { - __asan::get_allocator().ForEachChunk(callback, arg); -} - -IgnoreObjectResult IgnoreObjectLocked(const void *p) { - uptr addr = reinterpret_cast(p); - __asan::AsanChunk *m = __asan::instance.GetAsanChunkByAddr(addr); - if (!m || - (atomic_load(&m->chunk_state, memory_order_acquire) != - __asan::CHUNK_ALLOCATED) || - !m->AddrIsInside(addr)) { - return kIgnoreObjectInvalid; - } - if (m->lsan_tag == kIgnored) - return kIgnoreObjectAlreadyIgnored; - m->lsan_tag = __lsan::kIgnored; - return kIgnoreObjectSuccess; -} - -void GetAdditionalThreadContextPtrs(ThreadContextBase *tctx, void *ptrs) { - // Look for the arg pointer of threads that have been created or are running. - // This is necessary to prevent false positive leaks due to the AsanThread - // holding the only live reference to a heap object. This can happen because - // the `pthread_create()` interceptor doesn't wait for the child thread to - // start before returning and thus loosing the the only live reference to the - // heap object on the stack. - - __asan::AsanThreadContext *atctx = - reinterpret_cast<__asan::AsanThreadContext *>(tctx); - __asan::AsanThread *asan_thread = atctx->thread; - - // Note ThreadStatusRunning is required because there is a small window where - // the thread status switches to `ThreadStatusRunning` but the `arg` pointer - // still isn't on the stack yet. - if (atctx->status != ThreadStatusCreated && - atctx->status != ThreadStatusRunning) - return; - - uptr thread_arg = reinterpret_cast(asan_thread->get_arg()); - if (!thread_arg) - return; - - auto ptrsVec = reinterpret_cast *>(ptrs); - ptrsVec->push_back(thread_arg); -} - -} // namespace __lsan - -// ---------------------- Interface ---------------- {{{1 -using namespace __asan; - -// ASan allocator doesn't reserve extra bytes, so normally we would -// just return "size". We don't want to expose our redzone sizes, etc here. -uptr __sanitizer_get_estimated_allocated_size(uptr size) { - return size; -} - -int __sanitizer_get_ownership(const void *p) { - uptr ptr = reinterpret_cast(p); - return instance.AllocationSize(ptr) > 0; -} - -uptr __sanitizer_get_allocated_size(const void *p) { - if (!p) return 0; - uptr ptr = reinterpret_cast(p); - uptr allocated_size = instance.AllocationSize(ptr); - // Die if p is not malloced or if it is already freed. - if (allocated_size == 0) { - GET_STACK_TRACE_FATAL_HERE; - ReportSanitizerGetAllocatedSizeNotOwned(ptr, &stack); - } - return allocated_size; -} - -void __sanitizer_purge_allocator() { - GET_STACK_TRACE_MALLOC; - instance.Purge(&stack); -} - -int __asan_update_allocation_context(void* addr) { - GET_STACK_TRACE_MALLOC; - return instance.UpdateAllocationStack((uptr)addr, &stack); -} - -#if !SANITIZER_SUPPORTS_WEAK_HOOKS -// Provide default (no-op) implementation of malloc hooks. -SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_malloc_hook, - void *ptr, uptr size) { - (void)ptr; - (void)size; -} - -SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_free_hook, void *ptr) { - (void)ptr; -} -#endif diff --git a/contrib/libs/clang14-rt/lib/asan/asan_allocator.h b/contrib/libs/clang14-rt/lib/asan/asan_allocator.h deleted file mode 100644 index 27d826fb613a..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_allocator.h +++ /dev/null @@ -1,233 +0,0 @@ -//===-- asan_allocator.h ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for asan_allocator.cpp. -//===----------------------------------------------------------------------===// - -#ifndef ASAN_ALLOCATOR_H -#define ASAN_ALLOCATOR_H - -#include "asan_flags.h" -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "sanitizer_common/sanitizer_allocator.h" -#include "sanitizer_common/sanitizer_list.h" -#include "sanitizer_common/sanitizer_platform.h" - -namespace __asan { - -enum AllocType { - FROM_MALLOC = 1, // Memory block came from malloc, calloc, realloc, etc. - FROM_NEW = 2, // Memory block came from operator new. - FROM_NEW_BR = 3 // Memory block came from operator new [ ] -}; - -class AsanChunk; - -struct AllocatorOptions { - u32 quarantine_size_mb; - u32 thread_local_quarantine_size_kb; - u16 min_redzone; - u16 max_redzone; - u8 may_return_null; - u8 alloc_dealloc_mismatch; - s32 release_to_os_interval_ms; - - void SetFrom(const Flags *f, const CommonFlags *cf); - void CopyTo(Flags *f, CommonFlags *cf); -}; - -void InitializeAllocator(const AllocatorOptions &options); -void ReInitializeAllocator(const AllocatorOptions &options); -void GetAllocatorOptions(AllocatorOptions *options); - -class AsanChunkView { - public: - explicit AsanChunkView(AsanChunk *chunk) : chunk_(chunk) {} - bool IsValid() const; // Checks if AsanChunkView points to a valid - // allocated or quarantined chunk. - bool IsAllocated() const; // Checks if the memory is currently allocated. - bool IsQuarantined() const; // Checks if the memory is currently quarantined. - uptr Beg() const; // First byte of user memory. - uptr End() const; // Last byte of user memory. - uptr UsedSize() const; // Size requested by the user. - u32 UserRequestedAlignment() const; // Originally requested alignment. - uptr AllocTid() const; - uptr FreeTid() const; - bool Eq(const AsanChunkView &c) const { return chunk_ == c.chunk_; } - u32 GetAllocStackId() const; - u32 GetFreeStackId() const; - AllocType GetAllocType() const; - bool AddrIsInside(uptr addr, uptr access_size, sptr *offset) const { - if (addr >= Beg() && (addr + access_size) <= End()) { - *offset = addr - Beg(); - return true; - } - return false; - } - bool AddrIsAtLeft(uptr addr, uptr access_size, sptr *offset) const { - (void)access_size; - if (addr < Beg()) { - *offset = Beg() - addr; - return true; - } - return false; - } - bool AddrIsAtRight(uptr addr, uptr access_size, sptr *offset) const { - if (addr + access_size > End()) { - *offset = addr - End(); - return true; - } - return false; - } - - private: - AsanChunk *const chunk_; -}; - -AsanChunkView FindHeapChunkByAddress(uptr address); -AsanChunkView FindHeapChunkByAllocBeg(uptr address); - -// List of AsanChunks with total size. -class AsanChunkFifoList: public IntrusiveList { - public: - explicit AsanChunkFifoList(LinkerInitialized) { } - AsanChunkFifoList() { clear(); } - void Push(AsanChunk *n); - void PushList(AsanChunkFifoList *q); - AsanChunk *Pop(); - uptr size() { return size_; } - void clear() { - IntrusiveList::clear(); - size_ = 0; - } - private: - uptr size_; -}; - -struct AsanMapUnmapCallback { - void OnMap(uptr p, uptr size) const; - void OnUnmap(uptr p, uptr size) const; -}; - -#if SANITIZER_CAN_USE_ALLOCATOR64 -# if SANITIZER_FUCHSIA -const uptr kAllocatorSpace = ~(uptr)0; -const uptr kAllocatorSize = 0x40000000000ULL; // 4T. -typedef DefaultSizeClassMap SizeClassMap; -# elif defined(__powerpc64__) -const uptr kAllocatorSpace = ~(uptr)0; -const uptr kAllocatorSize = 0x20000000000ULL; // 2T. -typedef DefaultSizeClassMap SizeClassMap; -# elif defined(__aarch64__) && SANITIZER_ANDROID -// Android needs to support 39, 42 and 48 bit VMA. -const uptr kAllocatorSpace = ~(uptr)0; -const uptr kAllocatorSize = 0x2000000000ULL; // 128G. -typedef VeryCompactSizeClassMap SizeClassMap; -#elif SANITIZER_RISCV64 -const uptr kAllocatorSpace = ~(uptr)0; -const uptr kAllocatorSize = 0x2000000000ULL; // 128G. -typedef VeryDenseSizeClassMap SizeClassMap; -# elif defined(__aarch64__) -// AArch64/SANITIZER_CAN_USE_ALLOCATOR64 is only for 42-bit VMA -// so no need to different values for different VMA. -const uptr kAllocatorSpace = 0x10000000000ULL; -const uptr kAllocatorSize = 0x10000000000ULL; // 3T. -typedef DefaultSizeClassMap SizeClassMap; -#elif defined(__sparc__) -const uptr kAllocatorSpace = ~(uptr)0; -const uptr kAllocatorSize = 0x20000000000ULL; // 2T. -typedef DefaultSizeClassMap SizeClassMap; -# elif SANITIZER_WINDOWS -const uptr kAllocatorSpace = ~(uptr)0; -const uptr kAllocatorSize = 0x8000000000ULL; // 500G -typedef DefaultSizeClassMap SizeClassMap; -# else -const uptr kAllocatorSpace = 0x600000000000ULL; -const uptr kAllocatorSize = 0x40000000000ULL; // 4T. -typedef DefaultSizeClassMap SizeClassMap; -# endif -template -struct AP64 { // Allocator64 parameters. Deliberately using a short name. - static const uptr kSpaceBeg = kAllocatorSpace; - static const uptr kSpaceSize = kAllocatorSize; - static const uptr kMetadataSize = 0; - typedef __asan::SizeClassMap SizeClassMap; - typedef AsanMapUnmapCallback MapUnmapCallback; - static const uptr kFlags = 0; - using AddressSpaceView = AddressSpaceViewTy; -}; - -template -using PrimaryAllocatorASVT = SizeClassAllocator64>; -using PrimaryAllocator = PrimaryAllocatorASVT; -#else // Fallback to SizeClassAllocator32. -typedef CompactSizeClassMap SizeClassMap; -template -struct AP32 { - static const uptr kSpaceBeg = 0; - static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE; - static const uptr kMetadataSize = 0; - typedef __asan::SizeClassMap SizeClassMap; - static const uptr kRegionSizeLog = 20; - using AddressSpaceView = AddressSpaceViewTy; - typedef AsanMapUnmapCallback MapUnmapCallback; - static const uptr kFlags = 0; -}; -template -using PrimaryAllocatorASVT = SizeClassAllocator32 >; -using PrimaryAllocator = PrimaryAllocatorASVT; -#endif // SANITIZER_CAN_USE_ALLOCATOR64 - -static const uptr kNumberOfSizeClasses = SizeClassMap::kNumClasses; - -template -using AsanAllocatorASVT = - CombinedAllocator>; -using AsanAllocator = AsanAllocatorASVT; -using AllocatorCache = AsanAllocator::AllocatorCache; - -struct AsanThreadLocalMallocStorage { - uptr quarantine_cache[16]; - AllocatorCache allocator_cache; - void CommitBack(); - private: - // These objects are allocated via mmap() and are zero-initialized. - AsanThreadLocalMallocStorage() {} -}; - -void *asan_memalign(uptr alignment, uptr size, BufferedStackTrace *stack, - AllocType alloc_type); -void asan_free(void *ptr, BufferedStackTrace *stack, AllocType alloc_type); -void asan_delete(void *ptr, uptr size, uptr alignment, - BufferedStackTrace *stack, AllocType alloc_type); - -void *asan_malloc(uptr size, BufferedStackTrace *stack); -void *asan_calloc(uptr nmemb, uptr size, BufferedStackTrace *stack); -void *asan_realloc(void *p, uptr size, BufferedStackTrace *stack); -void *asan_reallocarray(void *p, uptr nmemb, uptr size, - BufferedStackTrace *stack); -void *asan_valloc(uptr size, BufferedStackTrace *stack); -void *asan_pvalloc(uptr size, BufferedStackTrace *stack); - -void *asan_aligned_alloc(uptr alignment, uptr size, BufferedStackTrace *stack); -int asan_posix_memalign(void **memptr, uptr alignment, uptr size, - BufferedStackTrace *stack); -uptr asan_malloc_usable_size(const void *ptr, uptr pc, uptr bp); - -uptr asan_mz_size(const void *ptr); -void asan_mz_force_lock(); -void asan_mz_force_unlock(); - -void PrintInternalAllocatorStats(); -void AsanSoftRssLimitExceededCallback(bool exceeded); - -} // namespace __asan -#endif // ASAN_ALLOCATOR_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_debugging.cpp b/contrib/libs/clang14-rt/lib/asan/asan_debugging.cpp deleted file mode 100644 index f078f1041a87..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_debugging.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//===-- asan_debugging.cpp ------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// This file contains various functions that are generally useful to call when -// using a debugger (LLDB, GDB). -//===----------------------------------------------------------------------===// - -#include "asan_allocator.h" -#include "asan_descriptions.h" -#include "asan_flags.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "asan_report.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_stackdepot.h" - -namespace { -using namespace __asan; - -static void FindInfoForStackVar(uptr addr, const char *frame_descr, uptr offset, - char *name, uptr name_size, - uptr *region_address, uptr *region_size) { - InternalMmapVector vars; - vars.reserve(16); - if (!ParseFrameDescription(frame_descr, &vars)) { - return; - } - - for (uptr i = 0; i < vars.size(); i++) { - if (offset <= vars[i].beg + vars[i].size) { - // We use name_len + 1 because strlcpy will guarantee a \0 at the end, so - // if we're limiting the copy due to name_len, we add 1 to ensure we copy - // the whole name and then terminate with '\0'. - internal_strlcpy(name, vars[i].name_pos, - Min(name_size, vars[i].name_len + 1)); - *region_address = addr - (offset - vars[i].beg); - *region_size = vars[i].size; - return; - } - } -} - -uptr AsanGetStack(uptr addr, uptr *trace, u32 size, u32 *thread_id, - bool alloc_stack) { - AsanChunkView chunk = FindHeapChunkByAddress(addr); - if (!chunk.IsValid()) return 0; - - StackTrace stack(nullptr, 0); - if (alloc_stack) { - if (chunk.AllocTid() == kInvalidTid) return 0; - stack = StackDepotGet(chunk.GetAllocStackId()); - if (thread_id) *thread_id = chunk.AllocTid(); - } else { - if (chunk.FreeTid() == kInvalidTid) return 0; - stack = StackDepotGet(chunk.GetFreeStackId()); - if (thread_id) *thread_id = chunk.FreeTid(); - } - - if (trace && size) { - size = Min(size, Min(stack.size, kStackTraceMax)); - for (uptr i = 0; i < size; i++) - trace[i] = StackTrace::GetPreviousInstructionPc(stack.trace[i]); - - return size; - } - - return 0; -} - -} // namespace - -SANITIZER_INTERFACE_ATTRIBUTE -const char *__asan_locate_address(uptr addr, char *name, uptr name_size, - uptr *region_address_ptr, - uptr *region_size_ptr) { - AddressDescription descr(addr); - uptr region_address = 0; - uptr region_size = 0; - const char *region_kind = nullptr; - if (name && name_size > 0) name[0] = 0; - - if (auto shadow = descr.AsShadow()) { - // region_{address,size} are already 0 - switch (shadow->kind) { - case kShadowKindLow: - region_kind = "low shadow"; - break; - case kShadowKindGap: - region_kind = "shadow gap"; - break; - case kShadowKindHigh: - region_kind = "high shadow"; - break; - } - } else if (auto heap = descr.AsHeap()) { - region_kind = "heap"; - region_address = heap->chunk_access.chunk_begin; - region_size = heap->chunk_access.chunk_size; - } else if (auto stack = descr.AsStack()) { - region_kind = "stack"; - if (!stack->frame_descr) { - // region_{address,size} are already 0 - } else { - FindInfoForStackVar(addr, stack->frame_descr, stack->offset, name, - name_size, ®ion_address, ®ion_size); - } - } else if (auto global = descr.AsGlobal()) { - region_kind = "global"; - auto &g = global->globals[0]; - internal_strlcpy(name, g.name, name_size); - region_address = g.beg; - region_size = g.size; - } else { - // region_{address,size} are already 0 - region_kind = "heap-invalid"; - } - - CHECK(region_kind); - if (region_address_ptr) *region_address_ptr = region_address; - if (region_size_ptr) *region_size_ptr = region_size; - return region_kind; -} - -SANITIZER_INTERFACE_ATTRIBUTE -uptr __asan_get_alloc_stack(uptr addr, uptr *trace, uptr size, u32 *thread_id) { - return AsanGetStack(addr, trace, size, thread_id, /* alloc_stack */ true); -} - -SANITIZER_INTERFACE_ATTRIBUTE -uptr __asan_get_free_stack(uptr addr, uptr *trace, uptr size, u32 *thread_id) { - return AsanGetStack(addr, trace, size, thread_id, /* alloc_stack */ false); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void __asan_get_shadow_mapping(uptr *shadow_scale, uptr *shadow_offset) { - if (shadow_scale) - *shadow_scale = ASAN_SHADOW_SCALE; - if (shadow_offset) - *shadow_offset = ASAN_SHADOW_OFFSET; -} diff --git a/contrib/libs/clang14-rt/lib/asan/asan_descriptions.cpp b/contrib/libs/clang14-rt/lib/asan/asan_descriptions.cpp deleted file mode 100644 index d7d961685793..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_descriptions.cpp +++ /dev/null @@ -1,507 +0,0 @@ -//===-- asan_descriptions.cpp -----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan functions for getting information about an address and/or printing it. -//===----------------------------------------------------------------------===// - -#include "asan_descriptions.h" -#include "asan_mapping.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "sanitizer_common/sanitizer_stackdepot.h" - -namespace __asan { - -AsanThreadIdAndName::AsanThreadIdAndName(AsanThreadContext *t) { - Init(t->tid, t->name); -} - -AsanThreadIdAndName::AsanThreadIdAndName(u32 tid) { - if (tid == kInvalidTid) { - Init(tid, ""); - } else { - asanThreadRegistry().CheckLocked(); - AsanThreadContext *t = GetThreadContextByTidLocked(tid); - Init(tid, t->name); - } -} - -void AsanThreadIdAndName::Init(u32 tid, const char *tname) { - int len = internal_snprintf(name, sizeof(name), "T%d", tid); - CHECK(((unsigned int)len) < sizeof(name)); - if (tname[0] != '\0') - internal_snprintf(&name[len], sizeof(name) - len, " (%s)", tname); -} - -void DescribeThread(AsanThreadContext *context) { - CHECK(context); - asanThreadRegistry().CheckLocked(); - // No need to announce the main thread. - if (context->tid == kMainTid || context->announced) { - return; - } - context->announced = true; - InternalScopedString str; - str.append("Thread %s", AsanThreadIdAndName(context).c_str()); - if (context->parent_tid == kInvalidTid) { - str.append(" created by unknown thread\n"); - Printf("%s", str.data()); - return; - } - str.append(" created by %s here:\n", - AsanThreadIdAndName(context->parent_tid).c_str()); - Printf("%s", str.data()); - StackDepotGet(context->stack_id).Print(); - // Recursively described parent thread if needed. - if (flags()->print_full_thread_history) { - AsanThreadContext *parent_context = - GetThreadContextByTidLocked(context->parent_tid); - DescribeThread(parent_context); - } -} - -// Shadow descriptions -static bool GetShadowKind(uptr addr, ShadowKind *shadow_kind) { - CHECK(!AddrIsInMem(addr)); - if (AddrIsInShadowGap(addr)) { - *shadow_kind = kShadowKindGap; - } else if (AddrIsInHighShadow(addr)) { - *shadow_kind = kShadowKindHigh; - } else if (AddrIsInLowShadow(addr)) { - *shadow_kind = kShadowKindLow; - } else { - return false; - } - return true; -} - -bool DescribeAddressIfShadow(uptr addr) { - ShadowAddressDescription descr; - if (!GetShadowAddressInformation(addr, &descr)) return false; - descr.Print(); - return true; -} - -bool GetShadowAddressInformation(uptr addr, ShadowAddressDescription *descr) { - if (AddrIsInMem(addr)) return false; - ShadowKind shadow_kind; - if (!GetShadowKind(addr, &shadow_kind)) return false; - if (shadow_kind != kShadowKindGap) descr->shadow_byte = *(u8 *)addr; - descr->addr = addr; - descr->kind = shadow_kind; - return true; -} - -// Heap descriptions -static void GetAccessToHeapChunkInformation(ChunkAccess *descr, - AsanChunkView chunk, uptr addr, - uptr access_size) { - descr->bad_addr = addr; - if (chunk.AddrIsAtLeft(addr, access_size, &descr->offset)) { - descr->access_type = kAccessTypeLeft; - } else if (chunk.AddrIsAtRight(addr, access_size, &descr->offset)) { - descr->access_type = kAccessTypeRight; - if (descr->offset < 0) { - descr->bad_addr -= descr->offset; - descr->offset = 0; - } - } else if (chunk.AddrIsInside(addr, access_size, &descr->offset)) { - descr->access_type = kAccessTypeInside; - } else { - descr->access_type = kAccessTypeUnknown; - } - descr->chunk_begin = chunk.Beg(); - descr->chunk_size = chunk.UsedSize(); - descr->user_requested_alignment = chunk.UserRequestedAlignment(); - descr->alloc_type = chunk.GetAllocType(); -} - -static void PrintHeapChunkAccess(uptr addr, const ChunkAccess &descr) { - Decorator d; - InternalScopedString str; - str.append("%s", d.Location()); - switch (descr.access_type) { - case kAccessTypeLeft: - str.append("%p is located %zd bytes to the left of", - (void *)descr.bad_addr, descr.offset); - break; - case kAccessTypeRight: - str.append("%p is located %zd bytes to the right of", - (void *)descr.bad_addr, descr.offset); - break; - case kAccessTypeInside: - str.append("%p is located %zd bytes inside of", (void *)descr.bad_addr, - descr.offset); - break; - case kAccessTypeUnknown: - str.append( - "%p is located somewhere around (this is AddressSanitizer bug!)", - (void *)descr.bad_addr); - } - str.append(" %zu-byte region [%p,%p)\n", descr.chunk_size, - (void *)descr.chunk_begin, - (void *)(descr.chunk_begin + descr.chunk_size)); - str.append("%s", d.Default()); - Printf("%s", str.data()); -} - -bool GetHeapAddressInformation(uptr addr, uptr access_size, - HeapAddressDescription *descr) { - AsanChunkView chunk = FindHeapChunkByAddress(addr); - if (!chunk.IsValid()) { - return false; - } - descr->addr = addr; - GetAccessToHeapChunkInformation(&descr->chunk_access, chunk, addr, - access_size); - CHECK_NE(chunk.AllocTid(), kInvalidTid); - descr->alloc_tid = chunk.AllocTid(); - descr->alloc_stack_id = chunk.GetAllocStackId(); - descr->free_tid = chunk.FreeTid(); - if (descr->free_tid != kInvalidTid) - descr->free_stack_id = chunk.GetFreeStackId(); - return true; -} - -static StackTrace GetStackTraceFromId(u32 id) { - CHECK(id); - StackTrace res = StackDepotGet(id); - CHECK(res.trace); - return res; -} - -bool DescribeAddressIfHeap(uptr addr, uptr access_size) { - HeapAddressDescription descr; - if (!GetHeapAddressInformation(addr, access_size, &descr)) { - Printf( - "AddressSanitizer can not describe address in more detail " - "(wild memory access suspected).\n"); - return false; - } - descr.Print(); - return true; -} - -// Stack descriptions -bool GetStackAddressInformation(uptr addr, uptr access_size, - StackAddressDescription *descr) { - AsanThread *t = FindThreadByStackAddress(addr); - if (!t) return false; - - descr->addr = addr; - descr->tid = t->tid(); - // Try to fetch precise stack frame for this access. - AsanThread::StackFrameAccess access; - if (!t->GetStackFrameAccessByAddr(addr, &access)) { - descr->frame_descr = nullptr; - return true; - } - - descr->offset = access.offset; - descr->access_size = access_size; - descr->frame_pc = access.frame_pc; - descr->frame_descr = access.frame_descr; - -#if SANITIZER_PPC64V1 - // On PowerPC64 ELFv1, the address of a function actually points to a - // three-doubleword data structure with the first field containing - // the address of the function's code. - descr->frame_pc = *reinterpret_cast(descr->frame_pc); -#endif - descr->frame_pc += 16; - - return true; -} - -static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr, - uptr access_size, uptr prev_var_end, - uptr next_var_beg) { - uptr var_end = var.beg + var.size; - uptr addr_end = addr + access_size; - const char *pos_descr = nullptr; - // If the variable [var.beg, var_end) is the nearest variable to the - // current memory access, indicate it in the log. - if (addr >= var.beg) { - if (addr_end <= var_end) - pos_descr = "is inside"; // May happen if this is a use-after-return. - else if (addr < var_end) - pos_descr = "partially overflows"; - else if (addr_end <= next_var_beg && - next_var_beg - addr_end >= addr - var_end) - pos_descr = "overflows"; - } else { - if (addr_end > var.beg) - pos_descr = "partially underflows"; - else if (addr >= prev_var_end && addr - prev_var_end >= var.beg - addr_end) - pos_descr = "underflows"; - } - InternalScopedString str; - str.append(" [%zd, %zd)", var.beg, var_end); - // Render variable name. - str.append(" '"); - for (uptr i = 0; i < var.name_len; ++i) { - str.append("%c", var.name_pos[i]); - } - str.append("'"); - if (var.line > 0) { - str.append(" (line %zd)", var.line); - } - if (pos_descr) { - Decorator d; - // FIXME: we may want to also print the size of the access here, - // but in case of accesses generated by memset it may be confusing. - str.append("%s <== Memory access at offset %zd %s this variable%s\n", - d.Location(), addr, pos_descr, d.Default()); - } else { - str.append("\n"); - } - Printf("%s", str.data()); -} - -bool DescribeAddressIfStack(uptr addr, uptr access_size) { - StackAddressDescription descr; - if (!GetStackAddressInformation(addr, access_size, &descr)) return false; - descr.Print(); - return true; -} - -// Global descriptions -static void DescribeAddressRelativeToGlobal(uptr addr, uptr access_size, - const __asan_global &g) { - InternalScopedString str; - Decorator d; - str.append("%s", d.Location()); - if (addr < g.beg) { - str.append("%p is located %zd bytes to the left", (void *)addr, - g.beg - addr); - } else if (addr + access_size > g.beg + g.size) { - if (addr < g.beg + g.size) addr = g.beg + g.size; - str.append("%p is located %zd bytes to the right", (void *)addr, - addr - (g.beg + g.size)); - } else { - // Can it happen? - str.append("%p is located %zd bytes inside", (void *)addr, addr - g.beg); - } - str.append(" of global variable '%s' defined in '", - MaybeDemangleGlobalName(g.name)); - PrintGlobalLocation(&str, g); - str.append("' (0x%zx) of size %zu\n", g.beg, g.size); - str.append("%s", d.Default()); - PrintGlobalNameIfASCII(&str, g); - Printf("%s", str.data()); -} - -bool GetGlobalAddressInformation(uptr addr, uptr access_size, - GlobalAddressDescription *descr) { - descr->addr = addr; - int globals_num = GetGlobalsForAddress(addr, descr->globals, descr->reg_sites, - ARRAY_SIZE(descr->globals)); - descr->size = globals_num; - descr->access_size = access_size; - return globals_num != 0; -} - -bool DescribeAddressIfGlobal(uptr addr, uptr access_size, - const char *bug_type) { - GlobalAddressDescription descr; - if (!GetGlobalAddressInformation(addr, access_size, &descr)) return false; - - descr.Print(bug_type); - return true; -} - -void ShadowAddressDescription::Print() const { - Printf("Address %p is located in the %s area.\n", (void *)addr, - ShadowNames[kind]); -} - -void GlobalAddressDescription::Print(const char *bug_type) const { - for (int i = 0; i < size; i++) { - DescribeAddressRelativeToGlobal(addr, access_size, globals[i]); - if (bug_type && - 0 == internal_strcmp(bug_type, "initialization-order-fiasco") && - reg_sites[i]) { - Printf(" registered at:\n"); - StackDepotGet(reg_sites[i]).Print(); - } - } -} - -bool GlobalAddressDescription::PointsInsideTheSameVariable( - const GlobalAddressDescription &other) const { - if (size == 0 || other.size == 0) return false; - - for (uptr i = 0; i < size; i++) { - const __asan_global &a = globals[i]; - for (uptr j = 0; j < other.size; j++) { - const __asan_global &b = other.globals[j]; - if (a.beg == b.beg && - a.beg <= addr && - b.beg <= other.addr && - (addr + access_size) < (a.beg + a.size) && - (other.addr + other.access_size) < (b.beg + b.size)) - return true; - } - } - - return false; -} - -void StackAddressDescription::Print() const { - Decorator d; - Printf("%s", d.Location()); - Printf("Address %p is located in stack of thread %s", (void *)addr, - AsanThreadIdAndName(tid).c_str()); - - if (!frame_descr) { - Printf("%s\n", d.Default()); - return; - } - Printf(" at offset %zu in frame%s\n", offset, d.Default()); - - // Now we print the frame where the alloca has happened. - // We print this frame as a stack trace with one element. - // The symbolizer may print more than one frame if inlining was involved. - // The frame numbers may be different than those in the stack trace printed - // previously. That's unfortunate, but I have no better solution, - // especially given that the alloca may be from entirely different place - // (e.g. use-after-scope, or different thread's stack). - Printf("%s", d.Default()); - StackTrace alloca_stack(&frame_pc, 1); - alloca_stack.Print(); - - InternalMmapVector vars; - vars.reserve(16); - if (!ParseFrameDescription(frame_descr, &vars)) { - Printf( - "AddressSanitizer can't parse the stack frame " - "descriptor: |%s|\n", - frame_descr); - // 'addr' is a stack address, so return true even if we can't parse frame - return; - } - uptr n_objects = vars.size(); - // Report the number of stack objects. - Printf(" This frame has %zu object(s):\n", n_objects); - - // Report all objects in this frame. - for (uptr i = 0; i < n_objects; i++) { - uptr prev_var_end = i ? vars[i - 1].beg + vars[i - 1].size : 0; - uptr next_var_beg = i + 1 < n_objects ? vars[i + 1].beg : ~(0UL); - PrintAccessAndVarIntersection(vars[i], offset, access_size, prev_var_end, - next_var_beg); - } - Printf( - "HINT: this may be a false positive if your program uses " - "some custom stack unwind mechanism, swapcontext or vfork\n"); - if (SANITIZER_WINDOWS) - Printf(" (longjmp, SEH and C++ exceptions *are* supported)\n"); - else - Printf(" (longjmp and C++ exceptions *are* supported)\n"); - - DescribeThread(GetThreadContextByTidLocked(tid)); -} - -void HeapAddressDescription::Print() const { - PrintHeapChunkAccess(addr, chunk_access); - - asanThreadRegistry().CheckLocked(); - AsanThreadContext *alloc_thread = GetThreadContextByTidLocked(alloc_tid); - StackTrace alloc_stack = GetStackTraceFromId(alloc_stack_id); - - Decorator d; - AsanThreadContext *free_thread = nullptr; - if (free_tid != kInvalidTid) { - free_thread = GetThreadContextByTidLocked(free_tid); - Printf("%sfreed by thread %s here:%s\n", d.Allocation(), - AsanThreadIdAndName(free_thread).c_str(), d.Default()); - StackTrace free_stack = GetStackTraceFromId(free_stack_id); - free_stack.Print(); - Printf("%spreviously allocated by thread %s here:%s\n", d.Allocation(), - AsanThreadIdAndName(alloc_thread).c_str(), d.Default()); - } else { - Printf("%sallocated by thread %s here:%s\n", d.Allocation(), - AsanThreadIdAndName(alloc_thread).c_str(), d.Default()); - } - alloc_stack.Print(); - DescribeThread(GetCurrentThread()); - if (free_thread) DescribeThread(free_thread); - DescribeThread(alloc_thread); -} - -AddressDescription::AddressDescription(uptr addr, uptr access_size, - bool shouldLockThreadRegistry) { - if (GetShadowAddressInformation(addr, &data.shadow)) { - data.kind = kAddressKindShadow; - return; - } - if (GetHeapAddressInformation(addr, access_size, &data.heap)) { - data.kind = kAddressKindHeap; - return; - } - - bool isStackMemory = false; - if (shouldLockThreadRegistry) { - ThreadRegistryLock l(&asanThreadRegistry()); - isStackMemory = GetStackAddressInformation(addr, access_size, &data.stack); - } else { - isStackMemory = GetStackAddressInformation(addr, access_size, &data.stack); - } - if (isStackMemory) { - data.kind = kAddressKindStack; - return; - } - - if (GetGlobalAddressInformation(addr, access_size, &data.global)) { - data.kind = kAddressKindGlobal; - return; - } - data.kind = kAddressKindWild; - data.wild.addr = addr; - data.wild.access_size = access_size; -} - -void WildAddressDescription::Print() const { - Printf("Address %p is a wild pointer inside of access range of size %p.\n", - (void *)addr, (void *)access_size); -} - -void PrintAddressDescription(uptr addr, uptr access_size, - const char *bug_type) { - ShadowAddressDescription shadow_descr; - if (GetShadowAddressInformation(addr, &shadow_descr)) { - shadow_descr.Print(); - return; - } - - GlobalAddressDescription global_descr; - if (GetGlobalAddressInformation(addr, access_size, &global_descr)) { - global_descr.Print(bug_type); - return; - } - - StackAddressDescription stack_descr; - if (GetStackAddressInformation(addr, access_size, &stack_descr)) { - stack_descr.Print(); - return; - } - - HeapAddressDescription heap_descr; - if (GetHeapAddressInformation(addr, access_size, &heap_descr)) { - heap_descr.Print(); - return; - } - - // We exhausted our possibilities. Bail out. - Printf( - "AddressSanitizer can not describe address in more detail " - "(wild memory access suspected).\n"); -} -} // namespace __asan diff --git a/contrib/libs/clang14-rt/lib/asan/asan_descriptions.h b/contrib/libs/clang14-rt/lib/asan/asan_descriptions.h deleted file mode 100644 index 650e2eb9173a..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_descriptions.h +++ /dev/null @@ -1,269 +0,0 @@ -//===-- asan_descriptions.h -------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for asan_descriptions.cpp. -// TODO(filcab): Most struct definitions should move to the interface headers. -//===----------------------------------------------------------------------===// -#ifndef ASAN_DESCRIPTIONS_H -#define ASAN_DESCRIPTIONS_H - -#include "asan_allocator.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_report_decorator.h" - -namespace __asan { - -void DescribeThread(AsanThreadContext *context); -static inline void DescribeThread(AsanThread *t) { - if (t) DescribeThread(t->context()); -} - -class AsanThreadIdAndName { - public: - explicit AsanThreadIdAndName(AsanThreadContext *t); - explicit AsanThreadIdAndName(u32 tid); - - // Contains "T%tid (%name)" or "T%tid" if the name is empty. - const char *c_str() const { return &name[0]; } - - private: - void Init(u32 tid, const char *tname); - - char name[128]; -}; - -class Decorator : public __sanitizer::SanitizerCommonDecorator { - public: - Decorator() : SanitizerCommonDecorator() {} - const char *Access() { return Blue(); } - const char *Location() { return Green(); } - const char *Allocation() { return Magenta(); } - - const char *ShadowByte(u8 byte) { - switch (byte) { - case kAsanHeapLeftRedzoneMagic: - case kAsanArrayCookieMagic: - return Red(); - case kAsanHeapFreeMagic: - return Magenta(); - case kAsanStackLeftRedzoneMagic: - case kAsanStackMidRedzoneMagic: - case kAsanStackRightRedzoneMagic: - return Red(); - case kAsanStackAfterReturnMagic: - return Magenta(); - case kAsanInitializationOrderMagic: - return Cyan(); - case kAsanUserPoisonedMemoryMagic: - case kAsanContiguousContainerOOBMagic: - case kAsanAllocaLeftMagic: - case kAsanAllocaRightMagic: - return Blue(); - case kAsanStackUseAfterScopeMagic: - return Magenta(); - case kAsanGlobalRedzoneMagic: - return Red(); - case kAsanInternalHeapMagic: - return Yellow(); - case kAsanIntraObjectRedzone: - return Yellow(); - default: - return Default(); - } - } -}; - -enum ShadowKind : u8 { - kShadowKindLow, - kShadowKindGap, - kShadowKindHigh, -}; -static const char *const ShadowNames[] = {"low shadow", "shadow gap", - "high shadow"}; - -struct ShadowAddressDescription { - uptr addr; - ShadowKind kind; - u8 shadow_byte; - - void Print() const; -}; - -bool GetShadowAddressInformation(uptr addr, ShadowAddressDescription *descr); -bool DescribeAddressIfShadow(uptr addr); - -enum AccessType { - kAccessTypeLeft, - kAccessTypeRight, - kAccessTypeInside, - kAccessTypeUnknown, // This means we have an AddressSanitizer bug! -}; - -struct ChunkAccess { - uptr bad_addr; - sptr offset; - uptr chunk_begin; - uptr chunk_size; - u32 user_requested_alignment : 12; - u32 access_type : 2; - u32 alloc_type : 2; -}; - -struct HeapAddressDescription { - uptr addr; - uptr alloc_tid; - uptr free_tid; - u32 alloc_stack_id; - u32 free_stack_id; - ChunkAccess chunk_access; - - void Print() const; -}; - -bool GetHeapAddressInformation(uptr addr, uptr access_size, - HeapAddressDescription *descr); -bool DescribeAddressIfHeap(uptr addr, uptr access_size = 1); - -struct StackAddressDescription { - uptr addr; - uptr tid; - uptr offset; - uptr frame_pc; - uptr access_size; - const char *frame_descr; - - void Print() const; -}; - -bool GetStackAddressInformation(uptr addr, uptr access_size, - StackAddressDescription *descr); - -struct WildAddressDescription { - uptr addr; - uptr access_size; - - void Print() const; -}; - -struct GlobalAddressDescription { - uptr addr; - // Assume address is close to at most four globals. - static const int kMaxGlobals = 4; - __asan_global globals[kMaxGlobals]; - u32 reg_sites[kMaxGlobals]; - uptr access_size; - u8 size; - - void Print(const char *bug_type = "") const; - - // Returns true when this descriptions points inside the same global variable - // as other. Descriptions can have different address within the variable - bool PointsInsideTheSameVariable(const GlobalAddressDescription &other) const; -}; - -bool GetGlobalAddressInformation(uptr addr, uptr access_size, - GlobalAddressDescription *descr); -bool DescribeAddressIfGlobal(uptr addr, uptr access_size, const char *bug_type); - -// General function to describe an address. Will try to describe the address as -// a shadow, global (variable), stack, or heap address. -// bug_type is optional and is used for checking if we're reporting an -// initialization-order-fiasco -// The proper access_size should be passed for stack, global, and heap -// addresses. Defaults to 1. -// Each of the *AddressDescription functions has its own Print() member, which -// may take access_size and bug_type parameters if needed. -void PrintAddressDescription(uptr addr, uptr access_size = 1, - const char *bug_type = ""); - -enum AddressKind { - kAddressKindWild, - kAddressKindShadow, - kAddressKindHeap, - kAddressKindStack, - kAddressKindGlobal, -}; - -class AddressDescription { - struct AddressDescriptionData { - AddressKind kind; - union { - ShadowAddressDescription shadow; - HeapAddressDescription heap; - StackAddressDescription stack; - GlobalAddressDescription global; - WildAddressDescription wild; - }; - }; - - AddressDescriptionData data; - - public: - AddressDescription() = default; - // shouldLockThreadRegistry allows us to skip locking if we're sure we already - // have done it. - explicit AddressDescription(uptr addr, bool shouldLockThreadRegistry = true) - : AddressDescription(addr, 1, shouldLockThreadRegistry) {} - AddressDescription(uptr addr, uptr access_size, - bool shouldLockThreadRegistry = true); - - uptr Address() const { - switch (data.kind) { - case kAddressKindWild: - return data.wild.addr; - case kAddressKindShadow: - return data.shadow.addr; - case kAddressKindHeap: - return data.heap.addr; - case kAddressKindStack: - return data.stack.addr; - case kAddressKindGlobal: - return data.global.addr; - } - UNREACHABLE("AddressInformation kind is invalid"); - } - void Print(const char *bug_descr = nullptr) const { - switch (data.kind) { - case kAddressKindWild: - data.wild.Print(); - return; - case kAddressKindShadow: - return data.shadow.Print(); - case kAddressKindHeap: - return data.heap.Print(); - case kAddressKindStack: - return data.stack.Print(); - case kAddressKindGlobal: - // initialization-order-fiasco has a special Print() - return data.global.Print(bug_descr); - } - UNREACHABLE("AddressInformation kind is invalid"); - } - - void StoreTo(AddressDescriptionData *dst) const { *dst = data; } - - const ShadowAddressDescription *AsShadow() const { - return data.kind == kAddressKindShadow ? &data.shadow : nullptr; - } - const HeapAddressDescription *AsHeap() const { - return data.kind == kAddressKindHeap ? &data.heap : nullptr; - } - const StackAddressDescription *AsStack() const { - return data.kind == kAddressKindStack ? &data.stack : nullptr; - } - const GlobalAddressDescription *AsGlobal() const { - return data.kind == kAddressKindGlobal ? &data.global : nullptr; - } -}; - -} // namespace __asan - -#endif // ASAN_DESCRIPTIONS_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_errors.cpp b/contrib/libs/clang14-rt/lib/asan/asan_errors.cpp deleted file mode 100644 index a22bf130d823..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_errors.cpp +++ /dev/null @@ -1,601 +0,0 @@ -//===-- asan_errors.cpp -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan implementation for error structures. -//===----------------------------------------------------------------------===// - -#include "asan_errors.h" -#include "asan_descriptions.h" -#include "asan_mapping.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "sanitizer_common/sanitizer_stackdepot.h" - -namespace __asan { - -static void OnStackUnwind(const SignalContext &sig, - const void *callback_context, - BufferedStackTrace *stack) { - bool fast = common_flags()->fast_unwind_on_fatal; -#if SANITIZER_FREEBSD || SANITIZER_NETBSD - // On FreeBSD the slow unwinding that leverages _Unwind_Backtrace() - // yields the call stack of the signal's handler and not of the code - // that raised the signal (as it does on Linux). - fast = true; -#endif - // Tests and maybe some users expect that scariness is going to be printed - // just before the stack. As only asan has scariness score we have no - // corresponding code in the sanitizer_common and we use this callback to - // print it. - static_cast(callback_context)->Print(); - stack->Unwind(StackTrace::GetNextInstructionPc(sig.pc), sig.bp, sig.context, - fast); -} - -void ErrorDeadlySignal::Print() { - ReportDeadlySignal(signal, tid, &OnStackUnwind, &scariness); -} - -void ErrorDoubleFree::Print() { - Decorator d; - Printf("%s", d.Error()); - Report("ERROR: AddressSanitizer: attempting %s on %p in thread %s:\n", - scariness.GetDescription(), (void *)addr_description.addr, - AsanThreadIdAndName(tid).c_str()); - Printf("%s", d.Default()); - scariness.Print(); - GET_STACK_TRACE_FATAL(second_free_stack->trace[0], - second_free_stack->top_frame_bp); - stack.Print(); - addr_description.Print(); - ReportErrorSummary(scariness.GetDescription(), &stack); -} - -void ErrorNewDeleteTypeMismatch::Print() { - Decorator d; - Printf("%s", d.Error()); - Report("ERROR: AddressSanitizer: %s on %p in thread %s:\n", - scariness.GetDescription(), (void *)addr_description.addr, - AsanThreadIdAndName(tid).c_str()); - Printf("%s object passed to delete has wrong type:\n", d.Default()); - if (delete_size != 0) { - Printf( - " size of the allocated type: %zd bytes;\n" - " size of the deallocated type: %zd bytes.\n", - addr_description.chunk_access.chunk_size, delete_size); - } - const uptr user_alignment = - addr_description.chunk_access.user_requested_alignment; - if (delete_alignment != user_alignment) { - char user_alignment_str[32]; - char delete_alignment_str[32]; - internal_snprintf(user_alignment_str, sizeof(user_alignment_str), - "%zd bytes", user_alignment); - internal_snprintf(delete_alignment_str, sizeof(delete_alignment_str), - "%zd bytes", delete_alignment); - static const char *kDefaultAlignment = "default-aligned"; - Printf( - " alignment of the allocated type: %s;\n" - " alignment of the deallocated type: %s.\n", - user_alignment > 0 ? user_alignment_str : kDefaultAlignment, - delete_alignment > 0 ? delete_alignment_str : kDefaultAlignment); - } - CHECK_GT(free_stack->size, 0); - scariness.Print(); - GET_STACK_TRACE_FATAL(free_stack->trace[0], free_stack->top_frame_bp); - stack.Print(); - addr_description.Print(); - ReportErrorSummary(scariness.GetDescription(), &stack); - Report( - "HINT: if you don't care about these errors you may set " - "ASAN_OPTIONS=new_delete_type_mismatch=0\n"); -} - -void ErrorFreeNotMalloced::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: attempting free on address " - "which was not malloc()-ed: %p in thread %s\n", - (void *)addr_description.Address(), AsanThreadIdAndName(tid).c_str()); - Printf("%s", d.Default()); - CHECK_GT(free_stack->size, 0); - scariness.Print(); - GET_STACK_TRACE_FATAL(free_stack->trace[0], free_stack->top_frame_bp); - stack.Print(); - addr_description.Print(); - ReportErrorSummary(scariness.GetDescription(), &stack); -} - -void ErrorAllocTypeMismatch::Print() { - static const char *alloc_names[] = {"INVALID", "malloc", "operator new", - "operator new []"}; - static const char *dealloc_names[] = {"INVALID", "free", "operator delete", - "operator delete []"}; - CHECK_NE(alloc_type, dealloc_type); - Decorator d; - Printf("%s", d.Error()); - Report("ERROR: AddressSanitizer: %s (%s vs %s) on %p\n", - scariness.GetDescription(), alloc_names[alloc_type], - dealloc_names[dealloc_type], (void *)addr_description.Address()); - Printf("%s", d.Default()); - CHECK_GT(dealloc_stack->size, 0); - scariness.Print(); - GET_STACK_TRACE_FATAL(dealloc_stack->trace[0], dealloc_stack->top_frame_bp); - stack.Print(); - addr_description.Print(); - ReportErrorSummary(scariness.GetDescription(), &stack); - Report( - "HINT: if you don't care about these errors you may set " - "ASAN_OPTIONS=alloc_dealloc_mismatch=0\n"); -} - -void ErrorMallocUsableSizeNotOwned::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: attempting to call malloc_usable_size() for " - "pointer which is not owned: %p\n", - (void *)addr_description.Address()); - Printf("%s", d.Default()); - stack->Print(); - addr_description.Print(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorSanitizerGetAllocatedSizeNotOwned::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: attempting to call " - "__sanitizer_get_allocated_size() for pointer which is not owned: %p\n", - (void *)addr_description.Address()); - Printf("%s", d.Default()); - stack->Print(); - addr_description.Print(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorCallocOverflow::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: calloc parameters overflow: count * size " - "(%zd * %zd) cannot be represented in type size_t (thread %s)\n", - count, size, AsanThreadIdAndName(tid).c_str()); - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorReallocArrayOverflow::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: reallocarray parameters overflow: count * size " - "(%zd * %zd) cannot be represented in type size_t (thread %s)\n", - count, size, AsanThreadIdAndName(tid).c_str()); - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorPvallocOverflow::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: pvalloc parameters overflow: size 0x%zx " - "rounded up to system page size 0x%zx cannot be represented in type " - "size_t (thread %s)\n", - size, GetPageSizeCached(), AsanThreadIdAndName(tid).c_str()); - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorInvalidAllocationAlignment::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: invalid allocation alignment: %zd, " - "alignment must be a power of two (thread %s)\n", - alignment, AsanThreadIdAndName(tid).c_str()); - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorInvalidAlignedAllocAlignment::Print() { - Decorator d; - Printf("%s", d.Error()); -#if SANITIZER_POSIX - Report("ERROR: AddressSanitizer: invalid alignment requested in " - "aligned_alloc: %zd, alignment must be a power of two and the " - "requested size 0x%zx must be a multiple of alignment " - "(thread %s)\n", alignment, size, AsanThreadIdAndName(tid).c_str()); -#else - Report("ERROR: AddressSanitizer: invalid alignment requested in " - "aligned_alloc: %zd, the requested size 0x%zx must be a multiple of " - "alignment (thread %s)\n", alignment, size, - AsanThreadIdAndName(tid).c_str()); -#endif - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorInvalidPosixMemalignAlignment::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: invalid alignment requested in posix_memalign: " - "%zd, alignment must be a power of two and a multiple of sizeof(void*) " - "== %zd (thread %s)\n", - alignment, sizeof(void *), AsanThreadIdAndName(tid).c_str()); - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorAllocationSizeTooBig::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: requested allocation size 0x%zx (0x%zx after " - "adjustments for alignment, red zones etc.) exceeds maximum supported " - "size of 0x%zx (thread %s)\n", - user_size, total_size, max_size, AsanThreadIdAndName(tid).c_str()); - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorRssLimitExceeded::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: specified RSS limit exceeded, currently set to " - "soft_rss_limit_mb=%zd\n", common_flags()->soft_rss_limit_mb); - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorOutOfMemory::Print() { - Decorator d; - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: allocator is out of memory trying to allocate " - "0x%zx bytes\n", requested_size); - Printf("%s", d.Default()); - stack->Print(); - PrintHintAllocatorCannotReturnNull(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorStringFunctionMemoryRangesOverlap::Print() { - Decorator d; - char bug_type[100]; - internal_snprintf(bug_type, sizeof(bug_type), "%s-param-overlap", function); - Printf("%s", d.Error()); - Report( - "ERROR: AddressSanitizer: %s: memory ranges [%p,%p) and [%p, %p) " - "overlap\n", - bug_type, (void *)addr1_description.Address(), - (void *)(addr1_description.Address() + length1), - (void *)addr2_description.Address(), - (void *)(addr2_description.Address() + length2)); - Printf("%s", d.Default()); - scariness.Print(); - stack->Print(); - addr1_description.Print(); - addr2_description.Print(); - ReportErrorSummary(bug_type, stack); -} - -void ErrorStringFunctionSizeOverflow::Print() { - Decorator d; - Printf("%s", d.Error()); - Report("ERROR: AddressSanitizer: %s: (size=%zd)\n", - scariness.GetDescription(), size); - Printf("%s", d.Default()); - scariness.Print(); - stack->Print(); - addr_description.Print(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorBadParamsToAnnotateContiguousContainer::Print() { - Report( - "ERROR: AddressSanitizer: bad parameters to " - "__sanitizer_annotate_contiguous_container:\n" - " beg : %p\n" - " end : %p\n" - " old_mid : %p\n" - " new_mid : %p\n", - (void *)beg, (void *)end, (void *)old_mid, (void *)new_mid); - uptr granularity = ASAN_SHADOW_GRANULARITY; - if (!IsAligned(beg, granularity)) - Report("ERROR: beg is not aligned by %zu\n", granularity); - stack->Print(); - ReportErrorSummary(scariness.GetDescription(), stack); -} - -void ErrorODRViolation::Print() { - Decorator d; - Printf("%s", d.Error()); - Report("ERROR: AddressSanitizer: %s (%p):\n", scariness.GetDescription(), - (void *)global1.beg); - Printf("%s", d.Default()); - InternalScopedString g1_loc; - InternalScopedString g2_loc; - PrintGlobalLocation(&g1_loc, global1); - PrintGlobalLocation(&g2_loc, global2); - Printf(" [1] size=%zd '%s' %s\n", global1.size, - MaybeDemangleGlobalName(global1.name), g1_loc.data()); - Printf(" [2] size=%zd '%s' %s\n", global2.size, - MaybeDemangleGlobalName(global2.name), g2_loc.data()); - if (stack_id1 && stack_id2) { - Printf("These globals were registered at these points:\n"); - Printf(" [1]:\n"); - StackDepotGet(stack_id1).Print(); - Printf(" [2]:\n"); - StackDepotGet(stack_id2).Print(); - } - Report( - "HINT: if you don't care about these errors you may set " - "ASAN_OPTIONS=detect_odr_violation=0\n"); - InternalScopedString error_msg; - error_msg.append("%s: global '%s' at %s", scariness.GetDescription(), - MaybeDemangleGlobalName(global1.name), g1_loc.data()); - ReportErrorSummary(error_msg.data()); -} - -void ErrorInvalidPointerPair::Print() { - Decorator d; - Printf("%s", d.Error()); - Report("ERROR: AddressSanitizer: %s: %p %p\n", scariness.GetDescription(), - (void *)addr1_description.Address(), - (void *)addr2_description.Address()); - Printf("%s", d.Default()); - GET_STACK_TRACE_FATAL(pc, bp); - stack.Print(); - addr1_description.Print(); - addr2_description.Print(); - ReportErrorSummary(scariness.GetDescription(), &stack); -} - -static bool AdjacentShadowValuesAreFullyPoisoned(u8 *s) { - return s[-1] > 127 && s[1] > 127; -} - -ErrorGeneric::ErrorGeneric(u32 tid, uptr pc_, uptr bp_, uptr sp_, uptr addr, - bool is_write_, uptr access_size_) - : ErrorBase(tid), - addr_description(addr, access_size_, /*shouldLockThreadRegistry=*/false), - pc(pc_), - bp(bp_), - sp(sp_), - access_size(access_size_), - is_write(is_write_), - shadow_val(0) { - scariness.Clear(); - if (access_size) { - if (access_size <= 9) { - char desr[] = "?-byte"; - desr[0] = '0' + access_size; - scariness.Scare(access_size + access_size / 2, desr); - } else if (access_size >= 10) { - scariness.Scare(15, "multi-byte"); - } - is_write ? scariness.Scare(20, "write") : scariness.Scare(1, "read"); - - // Determine the error type. - bug_descr = "unknown-crash"; - if (AddrIsInMem(addr)) { - u8 *shadow_addr = (u8 *)MemToShadow(addr); - // If we are accessing 16 bytes, look at the second shadow byte. - if (*shadow_addr == 0 && access_size > ASAN_SHADOW_GRANULARITY) - shadow_addr++; - // If we are in the partial right redzone, look at the next shadow byte. - if (*shadow_addr > 0 && *shadow_addr < 128) shadow_addr++; - bool far_from_bounds = false; - shadow_val = *shadow_addr; - int bug_type_score = 0; - // For use-after-frees reads are almost as bad as writes. - int read_after_free_bonus = 0; - switch (shadow_val) { - case kAsanHeapLeftRedzoneMagic: - case kAsanArrayCookieMagic: - bug_descr = "heap-buffer-overflow"; - bug_type_score = 10; - far_from_bounds = AdjacentShadowValuesAreFullyPoisoned(shadow_addr); - break; - case kAsanHeapFreeMagic: - bug_descr = "heap-use-after-free"; - bug_type_score = 20; - if (!is_write) read_after_free_bonus = 18; - break; - case kAsanStackLeftRedzoneMagic: - bug_descr = "stack-buffer-underflow"; - bug_type_score = 25; - far_from_bounds = AdjacentShadowValuesAreFullyPoisoned(shadow_addr); - break; - case kAsanInitializationOrderMagic: - bug_descr = "initialization-order-fiasco"; - bug_type_score = 1; - break; - case kAsanStackMidRedzoneMagic: - case kAsanStackRightRedzoneMagic: - bug_descr = "stack-buffer-overflow"; - bug_type_score = 25; - far_from_bounds = AdjacentShadowValuesAreFullyPoisoned(shadow_addr); - break; - case kAsanStackAfterReturnMagic: - bug_descr = "stack-use-after-return"; - bug_type_score = 30; - if (!is_write) read_after_free_bonus = 18; - break; - case kAsanUserPoisonedMemoryMagic: - bug_descr = "use-after-poison"; - bug_type_score = 20; - break; - case kAsanContiguousContainerOOBMagic: - bug_descr = "container-overflow"; - bug_type_score = 10; - break; - case kAsanStackUseAfterScopeMagic: - bug_descr = "stack-use-after-scope"; - bug_type_score = 10; - break; - case kAsanGlobalRedzoneMagic: - bug_descr = "global-buffer-overflow"; - bug_type_score = 10; - far_from_bounds = AdjacentShadowValuesAreFullyPoisoned(shadow_addr); - break; - case kAsanIntraObjectRedzone: - bug_descr = "intra-object-overflow"; - bug_type_score = 10; - break; - case kAsanAllocaLeftMagic: - case kAsanAllocaRightMagic: - bug_descr = "dynamic-stack-buffer-overflow"; - bug_type_score = 25; - far_from_bounds = AdjacentShadowValuesAreFullyPoisoned(shadow_addr); - break; - } - scariness.Scare(bug_type_score + read_after_free_bonus, bug_descr); - if (far_from_bounds) scariness.Scare(10, "far-from-bounds"); - } - } -} - -static void PrintContainerOverflowHint() { - Printf("HINT: if you don't care about these errors you may set " - "ASAN_OPTIONS=detect_container_overflow=0.\n" - "If you suspect a false positive see also: " - "https://github.com/google/sanitizers/wiki/" - "AddressSanitizerContainerOverflow.\n"); -} - -static void PrintShadowByte(InternalScopedString *str, const char *before, - u8 byte, const char *after = "\n") { - PrintMemoryByte(str, before, byte, /*in_shadow*/true, after); -} - -static void PrintLegend(InternalScopedString *str) { - str->append( - "Shadow byte legend (one shadow byte represents %d " - "application bytes):\n", - (int)ASAN_SHADOW_GRANULARITY); - PrintShadowByte(str, " Addressable: ", 0); - str->append(" Partially addressable: "); - for (u8 i = 1; i < ASAN_SHADOW_GRANULARITY; i++) - PrintShadowByte(str, "", i, " "); - str->append("\n"); - PrintShadowByte(str, " Heap left redzone: ", - kAsanHeapLeftRedzoneMagic); - PrintShadowByte(str, " Freed heap region: ", kAsanHeapFreeMagic); - PrintShadowByte(str, " Stack left redzone: ", - kAsanStackLeftRedzoneMagic); - PrintShadowByte(str, " Stack mid redzone: ", - kAsanStackMidRedzoneMagic); - PrintShadowByte(str, " Stack right redzone: ", - kAsanStackRightRedzoneMagic); - PrintShadowByte(str, " Stack after return: ", - kAsanStackAfterReturnMagic); - PrintShadowByte(str, " Stack use after scope: ", - kAsanStackUseAfterScopeMagic); - PrintShadowByte(str, " Global redzone: ", kAsanGlobalRedzoneMagic); - PrintShadowByte(str, " Global init order: ", - kAsanInitializationOrderMagic); - PrintShadowByte(str, " Poisoned by user: ", - kAsanUserPoisonedMemoryMagic); - PrintShadowByte(str, " Container overflow: ", - kAsanContiguousContainerOOBMagic); - PrintShadowByte(str, " Array cookie: ", - kAsanArrayCookieMagic); - PrintShadowByte(str, " Intra object redzone: ", - kAsanIntraObjectRedzone); - PrintShadowByte(str, " ASan internal: ", kAsanInternalHeapMagic); - PrintShadowByte(str, " Left alloca redzone: ", kAsanAllocaLeftMagic); - PrintShadowByte(str, " Right alloca redzone: ", kAsanAllocaRightMagic); -} - -static void PrintShadowBytes(InternalScopedString *str, const char *before, - u8 *bytes, u8 *guilty, uptr n) { - Decorator d; - if (before) - str->append("%s%p:", before, (void *)bytes); - for (uptr i = 0; i < n; i++) { - u8 *p = bytes + i; - const char *before = - p == guilty ? "[" : (p - 1 == guilty && i != 0) ? "" : " "; - const char *after = p == guilty ? "]" : ""; - PrintShadowByte(str, before, *p, after); - } - str->append("\n"); -} - -static void PrintShadowMemoryForAddress(uptr addr) { - if (!AddrIsInMem(addr)) return; - uptr shadow_addr = MemToShadow(addr); - const uptr n_bytes_per_row = 16; - uptr aligned_shadow = shadow_addr & ~(n_bytes_per_row - 1); - InternalScopedString str; - str.append("Shadow bytes around the buggy address:\n"); - for (int i = -5; i <= 5; i++) { - uptr row_shadow_addr = aligned_shadow + i * n_bytes_per_row; - // Skip rows that would be outside the shadow range. This can happen when - // the user address is near the bottom, top, or shadow gap of the address - // space. - if (!AddrIsInShadow(row_shadow_addr)) continue; - const char *prefix = (i == 0) ? "=>" : " "; - PrintShadowBytes(&str, prefix, (u8 *)row_shadow_addr, (u8 *)shadow_addr, - n_bytes_per_row); - } - if (flags()->print_legend) PrintLegend(&str); - Printf("%s", str.data()); -} - -void ErrorGeneric::Print() { - Decorator d; - Printf("%s", d.Error()); - uptr addr = addr_description.Address(); - Report("ERROR: AddressSanitizer: %s on address %p at pc %p bp %p sp %p\n", - bug_descr, (void *)addr, (void *)pc, (void *)bp, (void *)sp); - Printf("%s", d.Default()); - - Printf("%s%s of size %zu at %p thread %s%s\n", d.Access(), - access_size ? (is_write ? "WRITE" : "READ") : "ACCESS", access_size, - (void *)addr, AsanThreadIdAndName(tid).c_str(), d.Default()); - - scariness.Print(); - GET_STACK_TRACE_FATAL(pc, bp); - stack.Print(); - - // Pass bug_descr because we have a special case for - // initialization-order-fiasco - addr_description.Print(bug_descr); - if (shadow_val == kAsanContiguousContainerOOBMagic) - PrintContainerOverflowHint(); - ReportErrorSummary(bug_descr, &stack); - PrintShadowMemoryForAddress(addr); -} - -} // namespace __asan diff --git a/contrib/libs/clang14-rt/lib/asan/asan_errors.h b/contrib/libs/clang14-rt/lib/asan/asan_errors.h deleted file mode 100644 index af6d1f295eb2..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_errors.h +++ /dev/null @@ -1,456 +0,0 @@ -//===-- asan_errors.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for error structures. -//===----------------------------------------------------------------------===// -#ifndef ASAN_ERRORS_H -#define ASAN_ERRORS_H - -#include "asan_descriptions.h" -#include "asan_scariness_score.h" -#include "sanitizer_common/sanitizer_common.h" - -namespace __asan { - -// (*) VS2013 does not implement unrestricted unions, so we need a trivial -// default constructor explicitly defined for each particular error. - -// None of the error classes own the stack traces mentioned in them. - -struct ErrorBase { - ScarinessScoreBase scariness; - u32 tid; - - ErrorBase() = default; // (*) - explicit ErrorBase(u32 tid_) : tid(tid_) {} - ErrorBase(u32 tid_, int initial_score, const char *reason) : tid(tid_) { - scariness.Clear(); - scariness.Scare(initial_score, reason); - } -}; - -struct ErrorDeadlySignal : ErrorBase { - SignalContext signal; - - ErrorDeadlySignal() = default; // (*) - ErrorDeadlySignal(u32 tid, const SignalContext &sig) - : ErrorBase(tid), - signal(sig) { - scariness.Clear(); - if (signal.IsStackOverflow()) { - scariness.Scare(10, "stack-overflow"); - } else if (!signal.is_memory_access) { - scariness.Scare(10, "signal"); - } else if (signal.is_true_faulting_addr && - signal.addr < GetPageSizeCached()) { - scariness.Scare(10, "null-deref"); - } else if (signal.addr == signal.pc) { - scariness.Scare(60, "wild-jump"); - } else if (signal.write_flag == SignalContext::Write) { - scariness.Scare(30, "wild-addr-write"); - } else if (signal.write_flag == SignalContext::Read) { - scariness.Scare(20, "wild-addr-read"); - } else { - scariness.Scare(25, "wild-addr"); - } - } - void Print(); -}; - -struct ErrorDoubleFree : ErrorBase { - const BufferedStackTrace *second_free_stack; - HeapAddressDescription addr_description; - - ErrorDoubleFree() = default; // (*) - ErrorDoubleFree(u32 tid, BufferedStackTrace *stack, uptr addr) - : ErrorBase(tid, 42, "double-free"), - second_free_stack(stack) { - CHECK_GT(second_free_stack->size, 0); - GetHeapAddressInformation(addr, 1, &addr_description); - } - void Print(); -}; - -struct ErrorNewDeleteTypeMismatch : ErrorBase { - const BufferedStackTrace *free_stack; - HeapAddressDescription addr_description; - uptr delete_size; - uptr delete_alignment; - - ErrorNewDeleteTypeMismatch() = default; // (*) - ErrorNewDeleteTypeMismatch(u32 tid, BufferedStackTrace *stack, uptr addr, - uptr delete_size_, uptr delete_alignment_) - : ErrorBase(tid, 10, "new-delete-type-mismatch"), - free_stack(stack), - delete_size(delete_size_), - delete_alignment(delete_alignment_) { - GetHeapAddressInformation(addr, 1, &addr_description); - } - void Print(); -}; - -struct ErrorFreeNotMalloced : ErrorBase { - const BufferedStackTrace *free_stack; - AddressDescription addr_description; - - ErrorFreeNotMalloced() = default; // (*) - ErrorFreeNotMalloced(u32 tid, BufferedStackTrace *stack, uptr addr) - : ErrorBase(tid, 40, "bad-free"), - free_stack(stack), - addr_description(addr, /*shouldLockThreadRegistry=*/false) {} - void Print(); -}; - -struct ErrorAllocTypeMismatch : ErrorBase { - const BufferedStackTrace *dealloc_stack; - AllocType alloc_type, dealloc_type; - AddressDescription addr_description; - - ErrorAllocTypeMismatch() = default; // (*) - ErrorAllocTypeMismatch(u32 tid, BufferedStackTrace *stack, uptr addr, - AllocType alloc_type_, AllocType dealloc_type_) - : ErrorBase(tid, 10, "alloc-dealloc-mismatch"), - dealloc_stack(stack), - alloc_type(alloc_type_), - dealloc_type(dealloc_type_), - addr_description(addr, 1, false) {} - void Print(); -}; - -struct ErrorMallocUsableSizeNotOwned : ErrorBase { - const BufferedStackTrace *stack; - AddressDescription addr_description; - - ErrorMallocUsableSizeNotOwned() = default; // (*) - ErrorMallocUsableSizeNotOwned(u32 tid, BufferedStackTrace *stack_, uptr addr) - : ErrorBase(tid, 10, "bad-malloc_usable_size"), - stack(stack_), - addr_description(addr, /*shouldLockThreadRegistry=*/false) {} - void Print(); -}; - -struct ErrorSanitizerGetAllocatedSizeNotOwned : ErrorBase { - const BufferedStackTrace *stack; - AddressDescription addr_description; - - ErrorSanitizerGetAllocatedSizeNotOwned() = default; // (*) - ErrorSanitizerGetAllocatedSizeNotOwned(u32 tid, BufferedStackTrace *stack_, - uptr addr) - : ErrorBase(tid, 10, "bad-__sanitizer_get_allocated_size"), - stack(stack_), - addr_description(addr, /*shouldLockThreadRegistry=*/false) {} - void Print(); -}; - -struct ErrorCallocOverflow : ErrorBase { - const BufferedStackTrace *stack; - uptr count; - uptr size; - - ErrorCallocOverflow() = default; // (*) - ErrorCallocOverflow(u32 tid, BufferedStackTrace *stack_, uptr count_, - uptr size_) - : ErrorBase(tid, 10, "calloc-overflow"), - stack(stack_), - count(count_), - size(size_) {} - void Print(); -}; - -struct ErrorReallocArrayOverflow : ErrorBase { - const BufferedStackTrace *stack; - uptr count; - uptr size; - - ErrorReallocArrayOverflow() = default; // (*) - ErrorReallocArrayOverflow(u32 tid, BufferedStackTrace *stack_, uptr count_, - uptr size_) - : ErrorBase(tid, 10, "reallocarray-overflow"), - stack(stack_), - count(count_), - size(size_) {} - void Print(); -}; - -struct ErrorPvallocOverflow : ErrorBase { - const BufferedStackTrace *stack; - uptr size; - - ErrorPvallocOverflow() = default; // (*) - ErrorPvallocOverflow(u32 tid, BufferedStackTrace *stack_, uptr size_) - : ErrorBase(tid, 10, "pvalloc-overflow"), - stack(stack_), - size(size_) {} - void Print(); -}; - -struct ErrorInvalidAllocationAlignment : ErrorBase { - const BufferedStackTrace *stack; - uptr alignment; - - ErrorInvalidAllocationAlignment() = default; // (*) - ErrorInvalidAllocationAlignment(u32 tid, BufferedStackTrace *stack_, - uptr alignment_) - : ErrorBase(tid, 10, "invalid-allocation-alignment"), - stack(stack_), - alignment(alignment_) {} - void Print(); -}; - -struct ErrorInvalidAlignedAllocAlignment : ErrorBase { - const BufferedStackTrace *stack; - uptr size; - uptr alignment; - - ErrorInvalidAlignedAllocAlignment() = default; // (*) - ErrorInvalidAlignedAllocAlignment(u32 tid, BufferedStackTrace *stack_, - uptr size_, uptr alignment_) - : ErrorBase(tid, 10, "invalid-aligned-alloc-alignment"), - stack(stack_), - size(size_), - alignment(alignment_) {} - void Print(); -}; - -struct ErrorInvalidPosixMemalignAlignment : ErrorBase { - const BufferedStackTrace *stack; - uptr alignment; - - ErrorInvalidPosixMemalignAlignment() = default; // (*) - ErrorInvalidPosixMemalignAlignment(u32 tid, BufferedStackTrace *stack_, - uptr alignment_) - : ErrorBase(tid, 10, "invalid-posix-memalign-alignment"), - stack(stack_), - alignment(alignment_) {} - void Print(); -}; - -struct ErrorAllocationSizeTooBig : ErrorBase { - const BufferedStackTrace *stack; - uptr user_size; - uptr total_size; - uptr max_size; - - ErrorAllocationSizeTooBig() = default; // (*) - ErrorAllocationSizeTooBig(u32 tid, BufferedStackTrace *stack_, - uptr user_size_, uptr total_size_, uptr max_size_) - : ErrorBase(tid, 10, "allocation-size-too-big"), - stack(stack_), - user_size(user_size_), - total_size(total_size_), - max_size(max_size_) {} - void Print(); -}; - -struct ErrorRssLimitExceeded : ErrorBase { - const BufferedStackTrace *stack; - - ErrorRssLimitExceeded() = default; // (*) - ErrorRssLimitExceeded(u32 tid, BufferedStackTrace *stack_) - : ErrorBase(tid, 10, "rss-limit-exceeded"), - stack(stack_) {} - void Print(); -}; - -struct ErrorOutOfMemory : ErrorBase { - const BufferedStackTrace *stack; - uptr requested_size; - - ErrorOutOfMemory() = default; // (*) - ErrorOutOfMemory(u32 tid, BufferedStackTrace *stack_, uptr requested_size_) - : ErrorBase(tid, 10, "out-of-memory"), - stack(stack_), - requested_size(requested_size_) {} - void Print(); -}; - -struct ErrorStringFunctionMemoryRangesOverlap : ErrorBase { - const BufferedStackTrace *stack; - uptr length1, length2; - AddressDescription addr1_description; - AddressDescription addr2_description; - const char *function; - - ErrorStringFunctionMemoryRangesOverlap() = default; // (*) - ErrorStringFunctionMemoryRangesOverlap(u32 tid, BufferedStackTrace *stack_, - uptr addr1, uptr length1_, uptr addr2, - uptr length2_, const char *function_) - : ErrorBase(tid), - stack(stack_), - length1(length1_), - length2(length2_), - addr1_description(addr1, length1, /*shouldLockThreadRegistry=*/false), - addr2_description(addr2, length2, /*shouldLockThreadRegistry=*/false), - function(function_) { - char bug_type[100]; - internal_snprintf(bug_type, sizeof(bug_type), "%s-param-overlap", function); - scariness.Clear(); - scariness.Scare(10, bug_type); - } - void Print(); -}; - -struct ErrorStringFunctionSizeOverflow : ErrorBase { - const BufferedStackTrace *stack; - AddressDescription addr_description; - uptr size; - - ErrorStringFunctionSizeOverflow() = default; // (*) - ErrorStringFunctionSizeOverflow(u32 tid, BufferedStackTrace *stack_, - uptr addr, uptr size_) - : ErrorBase(tid, 10, "negative-size-param"), - stack(stack_), - addr_description(addr, /*shouldLockThreadRegistry=*/false), - size(size_) {} - void Print(); -}; - -struct ErrorBadParamsToAnnotateContiguousContainer : ErrorBase { - const BufferedStackTrace *stack; - uptr beg, end, old_mid, new_mid; - - ErrorBadParamsToAnnotateContiguousContainer() = default; // (*) - // PS4: Do we want an AddressDescription for beg? - ErrorBadParamsToAnnotateContiguousContainer(u32 tid, - BufferedStackTrace *stack_, - uptr beg_, uptr end_, - uptr old_mid_, uptr new_mid_) - : ErrorBase(tid, 10, "bad-__sanitizer_annotate_contiguous_container"), - stack(stack_), - beg(beg_), - end(end_), - old_mid(old_mid_), - new_mid(new_mid_) {} - void Print(); -}; - -struct ErrorODRViolation : ErrorBase { - __asan_global global1, global2; - u32 stack_id1, stack_id2; - - ErrorODRViolation() = default; // (*) - ErrorODRViolation(u32 tid, const __asan_global *g1, u32 stack_id1_, - const __asan_global *g2, u32 stack_id2_) - : ErrorBase(tid, 10, "odr-violation"), - global1(*g1), - global2(*g2), - stack_id1(stack_id1_), - stack_id2(stack_id2_) {} - void Print(); -}; - -struct ErrorInvalidPointerPair : ErrorBase { - uptr pc, bp, sp; - AddressDescription addr1_description; - AddressDescription addr2_description; - - ErrorInvalidPointerPair() = default; // (*) - ErrorInvalidPointerPair(u32 tid, uptr pc_, uptr bp_, uptr sp_, uptr p1, - uptr p2) - : ErrorBase(tid, 10, "invalid-pointer-pair"), - pc(pc_), - bp(bp_), - sp(sp_), - addr1_description(p1, 1, /*shouldLockThreadRegistry=*/false), - addr2_description(p2, 1, /*shouldLockThreadRegistry=*/false) {} - void Print(); -}; - -struct ErrorGeneric : ErrorBase { - AddressDescription addr_description; - uptr pc, bp, sp; - uptr access_size; - const char *bug_descr; - bool is_write; - u8 shadow_val; - - ErrorGeneric() = default; // (*) - ErrorGeneric(u32 tid, uptr addr, uptr pc_, uptr bp_, uptr sp_, bool is_write_, - uptr access_size_); - void Print(); -}; - -// clang-format off -#define ASAN_FOR_EACH_ERROR_KIND(macro) \ - macro(DeadlySignal) \ - macro(DoubleFree) \ - macro(NewDeleteTypeMismatch) \ - macro(FreeNotMalloced) \ - macro(AllocTypeMismatch) \ - macro(MallocUsableSizeNotOwned) \ - macro(SanitizerGetAllocatedSizeNotOwned) \ - macro(CallocOverflow) \ - macro(ReallocArrayOverflow) \ - macro(PvallocOverflow) \ - macro(InvalidAllocationAlignment) \ - macro(InvalidAlignedAllocAlignment) \ - macro(InvalidPosixMemalignAlignment) \ - macro(AllocationSizeTooBig) \ - macro(RssLimitExceeded) \ - macro(OutOfMemory) \ - macro(StringFunctionMemoryRangesOverlap) \ - macro(StringFunctionSizeOverflow) \ - macro(BadParamsToAnnotateContiguousContainer) \ - macro(ODRViolation) \ - macro(InvalidPointerPair) \ - macro(Generic) -// clang-format on - -#define ASAN_DEFINE_ERROR_KIND(name) kErrorKind##name, -#define ASAN_ERROR_DESCRIPTION_MEMBER(name) Error##name name; -#define ASAN_ERROR_DESCRIPTION_CONSTRUCTOR(name) \ - ErrorDescription(Error##name const &e) : kind(kErrorKind##name) { \ - internal_memcpy(&name, &e, sizeof(name)); \ - } -#define ASAN_ERROR_DESCRIPTION_PRINT(name) \ - case kErrorKind##name: \ - return name.Print(); - -enum ErrorKind { - kErrorKindInvalid = 0, - ASAN_FOR_EACH_ERROR_KIND(ASAN_DEFINE_ERROR_KIND) -}; - -struct ErrorDescription { - ErrorKind kind; - // We're using a tagged union because it allows us to have a trivially - // copiable type and use the same structures as the public interface. - // - // We can add a wrapper around it to make it "more c++-like", but that would - // add a lot of code and the benefit wouldn't be that big. - union { - ErrorBase Base; - ASAN_FOR_EACH_ERROR_KIND(ASAN_ERROR_DESCRIPTION_MEMBER) - }; - - ErrorDescription() { internal_memset(this, 0, sizeof(*this)); } - explicit ErrorDescription(LinkerInitialized) {} - ASAN_FOR_EACH_ERROR_KIND(ASAN_ERROR_DESCRIPTION_CONSTRUCTOR) - - bool IsValid() { return kind != kErrorKindInvalid; } - void Print() { - switch (kind) { - ASAN_FOR_EACH_ERROR_KIND(ASAN_ERROR_DESCRIPTION_PRINT) - case kErrorKindInvalid: - CHECK(0); - } - CHECK(0); - } -}; - -#undef ASAN_FOR_EACH_ERROR_KIND -#undef ASAN_DEFINE_ERROR_KIND -#undef ASAN_ERROR_DESCRIPTION_MEMBER -#undef ASAN_ERROR_DESCRIPTION_CONSTRUCTOR -#undef ASAN_ERROR_DESCRIPTION_PRINT - -} // namespace __asan - -#endif // ASAN_ERRORS_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_fake_stack.cpp b/contrib/libs/clang14-rt/lib/asan/asan_fake_stack.cpp deleted file mode 100644 index 08d81c72597c..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_fake_stack.cpp +++ /dev/null @@ -1,312 +0,0 @@ -//===-- asan_fake_stack.cpp -----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// FakeStack is used to detect use-after-return bugs. -//===----------------------------------------------------------------------===// - -#include "asan_allocator.h" -#include "asan_poisoning.h" -#include "asan_thread.h" - -namespace __asan { - -static const u64 kMagic1 = kAsanStackAfterReturnMagic; -static const u64 kMagic2 = (kMagic1 << 8) | kMagic1; -static const u64 kMagic4 = (kMagic2 << 16) | kMagic2; -static const u64 kMagic8 = (kMagic4 << 32) | kMagic4; - -static const u64 kAllocaRedzoneSize = 32UL; -static const u64 kAllocaRedzoneMask = 31UL; - -// For small size classes inline PoisonShadow for better performance. -ALWAYS_INLINE void SetShadow(uptr ptr, uptr size, uptr class_id, u64 magic) { - u64 *shadow = reinterpret_cast(MemToShadow(ptr)); - if (ASAN_SHADOW_SCALE == 3 && class_id <= 6) { - // This code expects ASAN_SHADOW_SCALE=3. - for (uptr i = 0; i < (((uptr)1) << class_id); i++) { - shadow[i] = magic; - // Make sure this does not become memset. - SanitizerBreakOptimization(nullptr); - } - } else { - // The size class is too big, it's cheaper to poison only size bytes. - PoisonShadow(ptr, size, static_cast(magic)); - } -} - -FakeStack *FakeStack::Create(uptr stack_size_log) { - static uptr kMinStackSizeLog = 16; - static uptr kMaxStackSizeLog = FIRST_32_SECOND_64(24, 28); - if (stack_size_log < kMinStackSizeLog) - stack_size_log = kMinStackSizeLog; - if (stack_size_log > kMaxStackSizeLog) - stack_size_log = kMaxStackSizeLog; - uptr size = RequiredSize(stack_size_log); - FakeStack *res = reinterpret_cast( - flags()->uar_noreserve ? MmapNoReserveOrDie(size, "FakeStack") - : MmapOrDie(size, "FakeStack")); - res->stack_size_log_ = stack_size_log; - u8 *p = reinterpret_cast(res); - VReport(1, - "T%d: FakeStack created: %p -- %p stack_size_log: %zd; " - "mmapped %zdK, noreserve=%d \n", - GetCurrentTidOrInvalid(), (void *)p, - (void *)(p + FakeStack::RequiredSize(stack_size_log)), stack_size_log, - size >> 10, flags()->uar_noreserve); - return res; -} - -void FakeStack::Destroy(int tid) { - PoisonAll(0); - if (Verbosity() >= 2) { - InternalScopedString str; - for (uptr class_id = 0; class_id < kNumberOfSizeClasses; class_id++) - str.append("%zd: %zd/%zd; ", class_id, hint_position_[class_id], - NumberOfFrames(stack_size_log(), class_id)); - Report("T%d: FakeStack destroyed: %s\n", tid, str.data()); - } - uptr size = RequiredSize(stack_size_log_); - FlushUnneededASanShadowMemory(reinterpret_cast(this), size); - UnmapOrDie(this, size); -} - -void FakeStack::PoisonAll(u8 magic) { - PoisonShadow(reinterpret_cast(this), RequiredSize(stack_size_log()), - magic); -} - -#if !defined(_MSC_VER) || defined(__clang__) -ALWAYS_INLINE USED -#endif -FakeFrame *FakeStack::Allocate(uptr stack_size_log, uptr class_id, - uptr real_stack) { - CHECK_LT(class_id, kNumberOfSizeClasses); - if (needs_gc_) - GC(real_stack); - uptr &hint_position = hint_position_[class_id]; - const int num_iter = NumberOfFrames(stack_size_log, class_id); - u8 *flags = GetFlags(stack_size_log, class_id); - for (int i = 0; i < num_iter; i++) { - uptr pos = ModuloNumberOfFrames(stack_size_log, class_id, hint_position++); - // This part is tricky. On one hand, checking and setting flags[pos] - // should be atomic to ensure async-signal safety. But on the other hand, - // if the signal arrives between checking and setting flags[pos], the - // signal handler's fake stack will start from a different hint_position - // and so will not touch this particular byte. So, it is safe to do this - // with regular non-atomic load and store (at least I was not able to make - // this code crash). - if (flags[pos]) continue; - flags[pos] = 1; - FakeFrame *res = reinterpret_cast( - GetFrame(stack_size_log, class_id, pos)); - res->real_stack = real_stack; - *SavedFlagPtr(reinterpret_cast(res), class_id) = &flags[pos]; - return res; - } - return nullptr; // We are out of fake stack. -} - -uptr FakeStack::AddrIsInFakeStack(uptr ptr, uptr *frame_beg, uptr *frame_end) { - uptr stack_size_log = this->stack_size_log(); - uptr beg = reinterpret_cast(GetFrame(stack_size_log, 0, 0)); - uptr end = reinterpret_cast(this) + RequiredSize(stack_size_log); - if (ptr < beg || ptr >= end) return 0; - uptr class_id = (ptr - beg) >> stack_size_log; - uptr base = beg + (class_id << stack_size_log); - CHECK_LE(base, ptr); - CHECK_LT(ptr, base + (((uptr)1) << stack_size_log)); - uptr pos = (ptr - base) >> (kMinStackFrameSizeLog + class_id); - uptr res = base + pos * BytesInSizeClass(class_id); - *frame_end = res + BytesInSizeClass(class_id); - *frame_beg = res + sizeof(FakeFrame); - return res; -} - -void FakeStack::HandleNoReturn() { - needs_gc_ = true; -} - -// When throw, longjmp or some such happens we don't call OnFree() and -// as the result may leak one or more fake frames, but the good news is that -// we are notified about all such events by HandleNoReturn(). -// If we recently had such no-return event we need to collect garbage frames. -// We do it based on their 'real_stack' values -- everything that is lower -// than the current real_stack is garbage. -NOINLINE void FakeStack::GC(uptr real_stack) { - uptr collected = 0; - for (uptr class_id = 0; class_id < kNumberOfSizeClasses; class_id++) { - u8 *flags = GetFlags(stack_size_log(), class_id); - for (uptr i = 0, n = NumberOfFrames(stack_size_log(), class_id); i < n; - i++) { - if (flags[i] == 0) continue; // not allocated. - FakeFrame *ff = reinterpret_cast( - GetFrame(stack_size_log(), class_id, i)); - if (ff->real_stack < real_stack) { - flags[i] = 0; - collected++; - } - } - } - needs_gc_ = false; -} - -void FakeStack::ForEachFakeFrame(RangeIteratorCallback callback, void *arg) { - for (uptr class_id = 0; class_id < kNumberOfSizeClasses; class_id++) { - u8 *flags = GetFlags(stack_size_log(), class_id); - for (uptr i = 0, n = NumberOfFrames(stack_size_log(), class_id); i < n; - i++) { - if (flags[i] == 0) continue; // not allocated. - FakeFrame *ff = reinterpret_cast( - GetFrame(stack_size_log(), class_id, i)); - uptr begin = reinterpret_cast(ff); - callback(begin, begin + FakeStack::BytesInSizeClass(class_id), arg); - } - } -} - -#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FUCHSIA -static THREADLOCAL FakeStack *fake_stack_tls; - -FakeStack *GetTLSFakeStack() { - return fake_stack_tls; -} -void SetTLSFakeStack(FakeStack *fs) { - fake_stack_tls = fs; -} -#else -FakeStack *GetTLSFakeStack() { return 0; } -void SetTLSFakeStack(FakeStack *fs) { } -#endif // (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FUCHSIA - -static FakeStack *GetFakeStack() { - AsanThread *t = GetCurrentThread(); - if (!t) return nullptr; - return t->get_or_create_fake_stack(); -} - -static FakeStack *GetFakeStackFast() { - if (FakeStack *fs = GetTLSFakeStack()) - return fs; - if (!__asan_option_detect_stack_use_after_return) - return nullptr; - return GetFakeStack(); -} - -static FakeStack *GetFakeStackFastAlways() { - if (FakeStack *fs = GetTLSFakeStack()) - return fs; - return GetFakeStack(); -} - -static ALWAYS_INLINE uptr OnMalloc(uptr class_id, uptr size) { - FakeStack *fs = GetFakeStackFast(); - if (!fs) return 0; - uptr local_stack; - uptr real_stack = reinterpret_cast(&local_stack); - FakeFrame *ff = fs->Allocate(fs->stack_size_log(), class_id, real_stack); - if (!ff) return 0; // Out of fake stack. - uptr ptr = reinterpret_cast(ff); - SetShadow(ptr, size, class_id, 0); - return ptr; -} - -static ALWAYS_INLINE uptr OnMallocAlways(uptr class_id, uptr size) { - FakeStack *fs = GetFakeStackFastAlways(); - if (!fs) - return 0; - uptr local_stack; - uptr real_stack = reinterpret_cast(&local_stack); - FakeFrame *ff = fs->Allocate(fs->stack_size_log(), class_id, real_stack); - if (!ff) - return 0; // Out of fake stack. - uptr ptr = reinterpret_cast(ff); - SetShadow(ptr, size, class_id, 0); - return ptr; -} - -static ALWAYS_INLINE void OnFree(uptr ptr, uptr class_id, uptr size) { - FakeStack::Deallocate(ptr, class_id); - SetShadow(ptr, size, class_id, kMagic8); -} - -} // namespace __asan - -// ---------------------- Interface ---------------- {{{1 -using namespace __asan; -#define DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(class_id) \ - extern "C" SANITIZER_INTERFACE_ATTRIBUTE uptr \ - __asan_stack_malloc_##class_id(uptr size) { \ - return OnMalloc(class_id, size); \ - } \ - extern "C" SANITIZER_INTERFACE_ATTRIBUTE uptr \ - __asan_stack_malloc_always_##class_id(uptr size) { \ - return OnMallocAlways(class_id, size); \ - } \ - extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __asan_stack_free_##class_id( \ - uptr ptr, uptr size) { \ - OnFree(ptr, class_id, size); \ - } - -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(0) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(1) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(2) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(3) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(4) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(5) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(6) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(7) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(8) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(9) -DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(10) - -extern "C" { -// TODO: remove this method and fix tests that use it by setting -// -asan-use-after-return=never, after modal UAR flag lands -// (https://github.com/google/sanitizers/issues/1394) -SANITIZER_INTERFACE_ATTRIBUTE -void *__asan_get_current_fake_stack() { return GetFakeStackFast(); } - -SANITIZER_INTERFACE_ATTRIBUTE -void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg, - void **end) { - FakeStack *fs = reinterpret_cast(fake_stack); - if (!fs) return nullptr; - uptr frame_beg, frame_end; - FakeFrame *frame = reinterpret_cast(fs->AddrIsInFakeStack( - reinterpret_cast(addr), &frame_beg, &frame_end)); - if (!frame) return nullptr; - if (frame->magic != kCurrentStackFrameMagic) - return nullptr; - if (beg) *beg = reinterpret_cast(frame_beg); - if (end) *end = reinterpret_cast(frame_end); - return reinterpret_cast(frame->real_stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void __asan_alloca_poison(uptr addr, uptr size) { - uptr LeftRedzoneAddr = addr - kAllocaRedzoneSize; - uptr PartialRzAddr = addr + size; - uptr RightRzAddr = (PartialRzAddr + kAllocaRedzoneMask) & ~kAllocaRedzoneMask; - uptr PartialRzAligned = PartialRzAddr & ~(ASAN_SHADOW_GRANULARITY - 1); - FastPoisonShadow(LeftRedzoneAddr, kAllocaRedzoneSize, kAsanAllocaLeftMagic); - FastPoisonShadowPartialRightRedzone( - PartialRzAligned, PartialRzAddr % ASAN_SHADOW_GRANULARITY, - RightRzAddr - PartialRzAligned, kAsanAllocaRightMagic); - FastPoisonShadow(RightRzAddr, kAllocaRedzoneSize, kAsanAllocaRightMagic); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void __asan_allocas_unpoison(uptr top, uptr bottom) { - if ((!top) || (top > bottom)) return; - REAL(memset) - (reinterpret_cast(MemToShadow(top)), 0, - (bottom - top) / ASAN_SHADOW_GRANULARITY); -} -} // extern "C" diff --git a/contrib/libs/clang14-rt/lib/asan/asan_fake_stack.h b/contrib/libs/clang14-rt/lib/asan/asan_fake_stack.h deleted file mode 100644 index 270a19816d6e..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_fake_stack.h +++ /dev/null @@ -1,175 +0,0 @@ -//===-- asan_fake_stack.h ---------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for asan_fake_stack.cpp, implements FakeStack. -//===----------------------------------------------------------------------===// - -#ifndef ASAN_FAKE_STACK_H -#define ASAN_FAKE_STACK_H - -#include "sanitizer_common/sanitizer_common.h" - -namespace __asan { - -// Fake stack frame contains local variables of one function. -struct FakeFrame { - uptr magic; // Modified by the instrumented code. - uptr descr; // Modified by the instrumented code. - uptr pc; // Modified by the instrumented code. - uptr real_stack; -}; - -// For each thread we create a fake stack and place stack objects on this fake -// stack instead of the real stack. The fake stack is not really a stack but -// a fast malloc-like allocator so that when a function exits the fake stack -// is not popped but remains there for quite some time until gets used again. -// So, we poison the objects on the fake stack when function returns. -// It helps us find use-after-return bugs. -// -// The FakeStack objects is allocated by a single mmap call and has no other -// pointers. The size of the fake stack depends on the actual thread stack size -// and thus can not be a constant. -// stack_size is a power of two greater or equal to the thread's stack size; -// we store it as its logarithm (stack_size_log). -// FakeStack has kNumberOfSizeClasses (11) size classes, each size class -// is a power of two, starting from 64 bytes. Each size class occupies -// stack_size bytes and thus can allocate -// NumberOfFrames=(stack_size/BytesInSizeClass) fake frames (also a power of 2). -// For each size class we have NumberOfFrames allocation flags, -// each flag indicates whether the given frame is currently allocated. -// All flags for size classes 0 .. 10 are stored in a single contiguous region -// followed by another contiguous region which contains the actual memory for -// size classes. The addresses are computed by GetFlags and GetFrame without -// any memory accesses solely based on 'this' and stack_size_log. -// Allocate() flips the appropriate allocation flag atomically, thus achieving -// async-signal safety. -// This allocator does not have quarantine per se, but it tries to allocate the -// frames in round robin fashion to maximize the delay between a deallocation -// and the next allocation. -class FakeStack { - static const uptr kMinStackFrameSizeLog = 6; // Min frame is 64B. - static const uptr kMaxStackFrameSizeLog = 16; // Max stack frame is 64K. - - public: - static const uptr kNumberOfSizeClasses = - kMaxStackFrameSizeLog - kMinStackFrameSizeLog + 1; - - // CTOR: create the FakeStack as a single mmap-ed object. - static FakeStack *Create(uptr stack_size_log); - - void Destroy(int tid); - - // stack_size_log is at least 15 (stack_size >= 32K). - static uptr SizeRequiredForFlags(uptr stack_size_log) { - return ((uptr)1) << (stack_size_log + 1 - kMinStackFrameSizeLog); - } - - // Each size class occupies stack_size bytes. - static uptr SizeRequiredForFrames(uptr stack_size_log) { - return (((uptr)1) << stack_size_log) * kNumberOfSizeClasses; - } - - // Number of bytes requires for the whole object. - static uptr RequiredSize(uptr stack_size_log) { - return kFlagsOffset + SizeRequiredForFlags(stack_size_log) + - SizeRequiredForFrames(stack_size_log); - } - - // Offset of the given flag from the first flag. - // The flags for class 0 begin at offset 000000000 - // The flags for class 1 begin at offset 100000000 - // ....................2................ 110000000 - // ....................3................ 111000000 - // and so on. - static uptr FlagsOffset(uptr stack_size_log, uptr class_id) { - uptr t = kNumberOfSizeClasses - 1 - class_id; - const uptr all_ones = (((uptr)1) << (kNumberOfSizeClasses - 1)) - 1; - return ((all_ones >> t) << t) << (stack_size_log - 15); - } - - static uptr NumberOfFrames(uptr stack_size_log, uptr class_id) { - return ((uptr)1) << (stack_size_log - kMinStackFrameSizeLog - class_id); - } - - // Divide n by the number of frames in size class. - static uptr ModuloNumberOfFrames(uptr stack_size_log, uptr class_id, uptr n) { - return n & (NumberOfFrames(stack_size_log, class_id) - 1); - } - - // The pointer to the flags of the given class_id. - u8 *GetFlags(uptr stack_size_log, uptr class_id) { - return reinterpret_cast(this) + kFlagsOffset + - FlagsOffset(stack_size_log, class_id); - } - - // Get frame by class_id and pos. - u8 *GetFrame(uptr stack_size_log, uptr class_id, uptr pos) { - return reinterpret_cast(this) + kFlagsOffset + - SizeRequiredForFlags(stack_size_log) + - (((uptr)1) << stack_size_log) * class_id + - BytesInSizeClass(class_id) * pos; - } - - // Allocate the fake frame. - FakeFrame *Allocate(uptr stack_size_log, uptr class_id, uptr real_stack); - - // Deallocate the fake frame: read the saved flag address and write 0 there. - static void Deallocate(uptr x, uptr class_id) { - **SavedFlagPtr(x, class_id) = 0; - } - - // Poison the entire FakeStack's shadow with the magic value. - void PoisonAll(u8 magic); - - // Return the beginning of the FakeFrame or 0 if the address is not ours. - uptr AddrIsInFakeStack(uptr addr, uptr *frame_beg, uptr *frame_end); - USED uptr AddrIsInFakeStack(uptr addr) { - uptr t1, t2; - return AddrIsInFakeStack(addr, &t1, &t2); - } - - // Number of bytes in a fake frame of this size class. - static uptr BytesInSizeClass(uptr class_id) { - return ((uptr)1) << (class_id + kMinStackFrameSizeLog); - } - - // The fake frame is guaranteed to have a right redzone. - // We use the last word of that redzone to store the address of the flag - // that corresponds to the current frame to make faster deallocation. - static u8 **SavedFlagPtr(uptr x, uptr class_id) { - return reinterpret_cast(x + BytesInSizeClass(class_id) - sizeof(x)); - } - - uptr stack_size_log() const { return stack_size_log_; } - - void HandleNoReturn(); - void GC(uptr real_stack); - - void ForEachFakeFrame(RangeIteratorCallback callback, void *arg); - - private: - FakeStack() { } - static const uptr kFlagsOffset = 4096; // This is were the flags begin. - // Must match the number of uses of DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID - COMPILER_CHECK(kNumberOfSizeClasses == 11); - static const uptr kMaxStackMallocSize = ((uptr)1) << kMaxStackFrameSizeLog; - - uptr hint_position_[kNumberOfSizeClasses]; - uptr stack_size_log_; - // a bit is set if something was allocated from the corresponding size class. - bool needs_gc_; -}; - -FakeStack *GetTLSFakeStack(); -void SetTLSFakeStack(FakeStack *fs); - -} // namespace __asan - -#endif // ASAN_FAKE_STACK_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_flags.cpp b/contrib/libs/clang14-rt/lib/asan/asan_flags.cpp deleted file mode 100644 index 9ea899f84b4b..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_flags.cpp +++ /dev/null @@ -1,206 +0,0 @@ -//===-- asan_flags.cpp ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan flag parsing logic. -//===----------------------------------------------------------------------===// - -#include "asan_activation.h" -#include "asan_flags.h" -#include "asan_interface_internal.h" -#include "asan_stack.h" -#include "lsan/lsan_common.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_flag_parser.h" -#include "ubsan/ubsan_flags.h" -#include "ubsan/ubsan_platform.h" - -namespace __asan { - -Flags asan_flags_dont_use_directly; // use via flags(). - -static const char *MaybeUseAsanDefaultOptionsCompileDefinition() { -#ifdef ASAN_DEFAULT_OPTIONS - return SANITIZER_STRINGIFY(ASAN_DEFAULT_OPTIONS); -#else - return ""; -#endif -} - -void Flags::SetDefaults() { -#define ASAN_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue; -#include "asan_flags.inc" -#undef ASAN_FLAG -} - -static void RegisterAsanFlags(FlagParser *parser, Flags *f) { -#define ASAN_FLAG(Type, Name, DefaultValue, Description) \ - RegisterFlag(parser, #Name, Description, &f->Name); -#include "asan_flags.inc" -#undef ASAN_FLAG -} - -void InitializeFlags() { - // Set the default values and prepare for parsing ASan and common flags. - SetCommonFlagsDefaults(); - { - CommonFlags cf; - cf.CopyFrom(*common_flags()); - cf.detect_leaks = cf.detect_leaks && CAN_SANITIZE_LEAKS; - cf.external_symbolizer_path = GetEnv("ASAN_SYMBOLIZER_PATH"); - cf.malloc_context_size = kDefaultMallocContextSize; - cf.intercept_tls_get_addr = true; - cf.exitcode = 1; - OverrideCommonFlags(cf); - } - Flags *f = flags(); - f->SetDefaults(); - - FlagParser asan_parser; - RegisterAsanFlags(&asan_parser, f); - RegisterCommonFlags(&asan_parser); - - // Set the default values and prepare for parsing LSan and UBSan flags - // (which can also overwrite common flags). -#if CAN_SANITIZE_LEAKS - __lsan::Flags *lf = __lsan::flags(); - lf->SetDefaults(); - - FlagParser lsan_parser; - __lsan::RegisterLsanFlags(&lsan_parser, lf); - RegisterCommonFlags(&lsan_parser); -#endif - -#if CAN_SANITIZE_UB - __ubsan::Flags *uf = __ubsan::flags(); - uf->SetDefaults(); - - FlagParser ubsan_parser; - __ubsan::RegisterUbsanFlags(&ubsan_parser, uf); - RegisterCommonFlags(&ubsan_parser); -#endif - - if (SANITIZER_MAC) { - // Support macOS MallocScribble and MallocPreScribble: - // - if (GetEnv("MallocScribble")) { - f->max_free_fill_size = 0x1000; - } - if (GetEnv("MallocPreScribble")) { - f->malloc_fill_byte = 0xaa; - } - } - - // Override from ASan compile definition. - const char *asan_compile_def = MaybeUseAsanDefaultOptionsCompileDefinition(); - asan_parser.ParseString(asan_compile_def); - - // Override from user-specified string. - const char *asan_default_options = __asan_default_options(); - asan_parser.ParseString(asan_default_options); -#if CAN_SANITIZE_UB - const char *ubsan_default_options = __ubsan_default_options(); - ubsan_parser.ParseString(ubsan_default_options); -#endif -#if CAN_SANITIZE_LEAKS - const char *lsan_default_options = __lsan_default_options(); - lsan_parser.ParseString(lsan_default_options); -#endif - - // Override from command line. - asan_parser.ParseStringFromEnv("ASAN_OPTIONS"); -#if CAN_SANITIZE_LEAKS - lsan_parser.ParseStringFromEnv("LSAN_OPTIONS"); -#endif -#if CAN_SANITIZE_UB - ubsan_parser.ParseStringFromEnv("UBSAN_OPTIONS"); -#endif - - InitializeCommonFlags(); - - // TODO(eugenis): dump all flags at verbosity>=2? - if (Verbosity()) ReportUnrecognizedFlags(); - - if (common_flags()->help) { - // TODO(samsonov): print all of the flags (ASan, LSan, common). - asan_parser.PrintFlagDescriptions(); - } - - // Flag validation: - if (!CAN_SANITIZE_LEAKS && common_flags()->detect_leaks) { - Report("%s: detect_leaks is not supported on this platform.\n", - SanitizerToolName); - Die(); - } - // Ensure that redzone is at least ASAN_SHADOW_GRANULARITY. - if (f->redzone < (int)ASAN_SHADOW_GRANULARITY) - f->redzone = ASAN_SHADOW_GRANULARITY; - // Make "strict_init_order" imply "check_initialization_order". - // TODO(samsonov): Use a single runtime flag for an init-order checker. - if (f->strict_init_order) { - f->check_initialization_order = true; - } - CHECK_LE((uptr)common_flags()->malloc_context_size, kStackTraceMax); - CHECK_LE(f->min_uar_stack_size_log, f->max_uar_stack_size_log); - CHECK_GE(f->redzone, 16); - CHECK_GE(f->max_redzone, f->redzone); - CHECK_LE(f->max_redzone, 2048); - CHECK(IsPowerOfTwo(f->redzone)); - CHECK(IsPowerOfTwo(f->max_redzone)); - - // quarantine_size is deprecated but we still honor it. - // quarantine_size can not be used together with quarantine_size_mb. - if (f->quarantine_size >= 0 && f->quarantine_size_mb >= 0) { - Report("%s: please use either 'quarantine_size' (deprecated) or " - "quarantine_size_mb, but not both\n", SanitizerToolName); - Die(); - } - if (f->quarantine_size >= 0) - f->quarantine_size_mb = f->quarantine_size >> 20; - if (f->quarantine_size_mb < 0) { - const int kDefaultQuarantineSizeMb = - (ASAN_LOW_MEMORY) ? 1UL << 4 : 1UL << 8; - f->quarantine_size_mb = kDefaultQuarantineSizeMb; - } - if (f->thread_local_quarantine_size_kb < 0) { - const u32 kDefaultThreadLocalQuarantineSizeKb = - // It is not advised to go lower than 64Kb, otherwise quarantine batches - // pushed from thread local quarantine to global one will create too - // much overhead. One quarantine batch size is 8Kb and it holds up to - // 1021 chunk, which amounts to 1/8 memory overhead per batch when - // thread local quarantine is set to 64Kb. - (ASAN_LOW_MEMORY) ? 1 << 6 : FIRST_32_SECOND_64(1 << 8, 1 << 10); - f->thread_local_quarantine_size_kb = kDefaultThreadLocalQuarantineSizeKb; - } - if (f->thread_local_quarantine_size_kb == 0 && f->quarantine_size_mb > 0) { - Report("%s: thread_local_quarantine_size_kb can be set to 0 only when " - "quarantine_size_mb is set to 0\n", SanitizerToolName); - Die(); - } - if (!f->replace_str && common_flags()->intercept_strlen) { - Report("WARNING: strlen interceptor is enabled even though replace_str=0. " - "Use intercept_strlen=0 to disable it."); - } - if (!f->replace_str && common_flags()->intercept_strchr) { - Report("WARNING: strchr* interceptors are enabled even though " - "replace_str=0. Use intercept_strchr=0 to disable them."); - } - if (!f->replace_str && common_flags()->intercept_strndup) { - Report("WARNING: strndup* interceptors are enabled even though " - "replace_str=0. Use intercept_strndup=0 to disable them."); - } -} - -} // namespace __asan - -SANITIZER_INTERFACE_WEAK_DEF(const char*, __asan_default_options, void) { - return ""; -} diff --git a/contrib/libs/clang14-rt/lib/asan/asan_flags.h b/contrib/libs/clang14-rt/lib/asan/asan_flags.h deleted file mode 100644 index b55c81f07d4b..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_flags.h +++ /dev/null @@ -1,48 +0,0 @@ -//===-- asan_flags.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan runtime flags. -//===----------------------------------------------------------------------===// - -#ifndef ASAN_FLAGS_H -#define ASAN_FLAGS_H - -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "sanitizer_common/sanitizer_flag_parser.h" - -// ASan flag values can be defined in four ways: -// 1) initialized with default values at startup. -// 2) overriden during compilation of ASan runtime by providing -// compile definition ASAN_DEFAULT_OPTIONS. -// 3) overriden from string returned by user-specified function -// __asan_default_options(). -// 4) overriden from env variable ASAN_OPTIONS. -// 5) overriden during ASan activation (for now used on Android only). - -namespace __asan { - -struct Flags { -#define ASAN_FLAG(Type, Name, DefaultValue, Description) Type Name; -#include "asan_flags.inc" -#undef ASAN_FLAG - - void SetDefaults(); -}; - -extern Flags asan_flags_dont_use_directly; -inline Flags *flags() { - return &asan_flags_dont_use_directly; -} - -void InitializeFlags(); - -} // namespace __asan - -#endif // ASAN_FLAGS_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_flags.inc b/contrib/libs/clang14-rt/lib/asan/asan_flags.inc deleted file mode 100644 index 514b225c4073..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_flags.inc +++ /dev/null @@ -1,162 +0,0 @@ -//===-- asan_flags.inc ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// ASan runtime flags. -// -//===----------------------------------------------------------------------===// -#ifndef ASAN_FLAG -# error "Define ASAN_FLAG prior to including this file!" -#endif - -// ASAN_FLAG(Type, Name, DefaultValue, Description) -// See COMMON_FLAG in sanitizer_flags.inc for more details. - -ASAN_FLAG(int, quarantine_size, -1, - "Deprecated, please use quarantine_size_mb.") -ASAN_FLAG(int, quarantine_size_mb, -1, - "Size (in Mb) of quarantine used to detect use-after-free " - "errors. Lower value may reduce memory usage but increase the " - "chance of false negatives.") -ASAN_FLAG(int, thread_local_quarantine_size_kb, -1, - "Size (in Kb) of thread local quarantine used to detect " - "use-after-free errors. Lower value may reduce memory usage but " - "increase the chance of false negatives. It is not advised to go " - "lower than 64Kb, otherwise frequent transfers to global quarantine " - "might affect performance.") -ASAN_FLAG(int, redzone, 16, - "Minimal size (in bytes) of redzones around heap objects. " - "Requirement: redzone >= 16, is a power of two.") -ASAN_FLAG(int, max_redzone, 2048, - "Maximal size (in bytes) of redzones around heap objects.") -ASAN_FLAG( - bool, debug, false, - "If set, prints some debugging information and does additional checks.") -ASAN_FLAG( - int, report_globals, 1, - "Controls the way to handle globals (0 - don't detect buffer overflow on " - "globals, 1 - detect buffer overflow, 2 - print data about registered " - "globals).") -ASAN_FLAG(bool, check_initialization_order, false, - "If set, attempts to catch initialization order issues.") -ASAN_FLAG( - bool, replace_str, true, - "If set, uses custom wrappers and replacements for libc string functions " - "to find more errors.") -ASAN_FLAG(bool, replace_intrin, true, - "If set, uses custom wrappers for memset/memcpy/memmove intrinsics.") -ASAN_FLAG(bool, detect_stack_use_after_return, false, - "Enables stack-use-after-return checking at run-time.") -ASAN_FLAG(int, min_uar_stack_size_log, 16, // We can't do smaller anyway. - "Minimum fake stack size log.") -ASAN_FLAG(int, max_uar_stack_size_log, - 20, // 1Mb per size class, i.e. ~11Mb per thread - "Maximum fake stack size log.") -ASAN_FLAG(bool, uar_noreserve, false, - "Use mmap with 'noreserve' flag to allocate fake stack.") -ASAN_FLAG( - int, max_malloc_fill_size, 0x1000, // By default, fill only the first 4K. - "ASan allocator flag. max_malloc_fill_size is the maximal amount of " - "bytes that will be filled with malloc_fill_byte on malloc.") -ASAN_FLAG( - int, max_free_fill_size, 0, - "ASan allocator flag. max_free_fill_size is the maximal amount of " - "bytes that will be filled with free_fill_byte during free.") -ASAN_FLAG(int, malloc_fill_byte, 0xbe, - "Value used to fill the newly allocated memory.") -ASAN_FLAG(int, free_fill_byte, 0x55, - "Value used to fill deallocated memory.") -ASAN_FLAG(bool, allow_user_poisoning, true, - "If set, user may manually mark memory regions as poisoned or " - "unpoisoned.") -ASAN_FLAG( - int, sleep_before_dying, 0, - "Number of seconds to sleep between printing an error report and " - "terminating the program. Useful for debugging purposes (e.g. when one " - "needs to attach gdb).") -ASAN_FLAG( - int, sleep_after_init, 0, - "Number of seconds to sleep after AddressSanitizer is initialized. " - "Useful for debugging purposes (e.g. when one needs to attach gdb).") -ASAN_FLAG(bool, check_malloc_usable_size, true, - "Allows the users to work around the bug in Nvidia drivers prior to " - "295.*.") -ASAN_FLAG(bool, unmap_shadow_on_exit, false, - "If set, explicitly unmaps the (huge) shadow at exit.") -ASAN_FLAG(bool, protect_shadow_gap, true, "If set, mprotect the shadow gap") -ASAN_FLAG(bool, print_stats, false, - "Print various statistics after printing an error message or if " - "atexit=1.") -ASAN_FLAG(bool, print_legend, true, "Print the legend for the shadow bytes.") -ASAN_FLAG(bool, print_scariness, false, - "Print the scariness score. Experimental.") -ASAN_FLAG(bool, atexit, false, - "If set, prints ASan exit stats even after program terminates " - "successfully.") -ASAN_FLAG( - bool, print_full_thread_history, true, - "If set, prints thread creation stacks for the threads involved in the " - "report and their ancestors up to the main thread.") -ASAN_FLAG( - bool, poison_heap, true, - "Poison (or not) the heap memory on [de]allocation. Zero value is useful " - "for benchmarking the allocator or instrumentator.") -ASAN_FLAG(bool, poison_partial, true, - "If true, poison partially addressable 8-byte aligned words " - "(default=true). This flag affects heap and global buffers, but not " - "stack buffers.") -ASAN_FLAG(bool, poison_array_cookie, true, - "Poison (or not) the array cookie after operator new[].") - -// Turn off alloc/dealloc mismatch checker on Mac and Windows for now. -// https://github.com/google/sanitizers/issues/131 -// https://github.com/google/sanitizers/issues/309 -// TODO(glider,timurrrr): Fix known issues and enable this back. -ASAN_FLAG(bool, alloc_dealloc_mismatch, - !SANITIZER_MAC && !SANITIZER_WINDOWS && !SANITIZER_ANDROID, - "Report errors on malloc/delete, new/free, new/delete[], etc.") - -ASAN_FLAG(bool, new_delete_type_mismatch, true, - "Report errors on mismatch between size of new and delete.") -ASAN_FLAG( - bool, strict_init_order, false, - "If true, assume that dynamic initializers can never access globals from " - "other modules, even if the latter are already initialized.") -ASAN_FLAG( - bool, start_deactivated, false, - "If true, ASan tweaks a bunch of other flags (quarantine, redzone, heap " - "poisoning) to reduce memory consumption as much as possible, and " - "restores them to original values when the first instrumented module is " - "loaded into the process. This is mainly intended to be used on " - "Android. ") -ASAN_FLAG( - int, detect_invalid_pointer_pairs, 0, - "If >= 2, detect operations like <, <=, >, >= and - on invalid pointer " - "pairs (e.g. when pointers belong to different objects); " - "If == 1, detect invalid operations only when both pointers are non-null.") -ASAN_FLAG(bool, detect_container_overflow, true, - "If true, honor the container overflow annotations. See " - "https://github.com/google/sanitizers/wiki/" - "AddressSanitizerContainerOverflow") -ASAN_FLAG(int, detect_odr_violation, 2, - "If >=2, detect violation of One-Definition-Rule (ODR); " - "If ==1, detect ODR-violation only if the two variables " - "have different sizes") -ASAN_FLAG(const char *, suppressions, "", "Suppressions file name.") -ASAN_FLAG(bool, halt_on_error, true, - "Crash the program after printing the first error report " - "(WARNING: USE AT YOUR OWN RISK!)") -ASAN_FLAG(bool, allocator_frees_and_returns_null_on_realloc_zero, true, - "realloc(p, 0) is equivalent to free(p) by default (Same as the " - "POSIX standard). If set to false, realloc(p, 0) will return a " - "pointer to an allocated space which can not be used.") -ASAN_FLAG(bool, verify_asan_link_order, true, - "Check position of ASan runtime in library list (needs to be disabled" - " when other library has to be preloaded system-wide)") -ASAN_FLAG( - bool, windows_hook_rtl_allocators, false, - "(Windows only) enable hooking of Rtl(Allocate|Free|Size|ReAllocate)Heap.") diff --git a/contrib/libs/clang14-rt/lib/asan/asan_fuchsia.cpp b/contrib/libs/clang14-rt/lib/asan/asan_fuchsia.cpp deleted file mode 100644 index e4c72908b591..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_fuchsia.cpp +++ /dev/null @@ -1,263 +0,0 @@ -//===-- asan_fuchsia.cpp -------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===---------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Fuchsia-specific details. -//===---------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_fuchsia.h" -#if SANITIZER_FUCHSIA - -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "asan_stack.h" -#include "asan_thread.h" - -#include -#error #include -#error #include -#error #include - -namespace __asan { - -// The system already set up the shadow memory for us. -// __sanitizer::GetMaxUserVirtualAddress has already been called by -// AsanInitInternal->InitializeHighMemEnd (asan_rtl.cpp). -// Just do some additional sanity checks here. -void InitializeShadowMemory() { - if (Verbosity()) - PrintAddressSpaceLayout(); - - // Make sure SHADOW_OFFSET doesn't use __asan_shadow_memory_dynamic_address. - __asan_shadow_memory_dynamic_address = kDefaultShadowSentinel; - DCHECK(kLowShadowBeg != kDefaultShadowSentinel); - __asan_shadow_memory_dynamic_address = kLowShadowBeg; - - CHECK_EQ(kShadowGapEnd, kHighShadowBeg - 1); - CHECK_EQ(kHighMemEnd, __sanitizer::ShadowBounds.memory_limit - 1); - CHECK_EQ(kHighMemBeg, __sanitizer::ShadowBounds.shadow_limit); - CHECK_EQ(kHighShadowBeg, __sanitizer::ShadowBounds.shadow_base); - CHECK_EQ(kShadowGapEnd, __sanitizer::ShadowBounds.shadow_base - 1); - CHECK_EQ(kLowShadowEnd, 0); - CHECK_EQ(kLowShadowBeg, 0); -} - -void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { - UNIMPLEMENTED(); -} - -void AsanCheckDynamicRTPrereqs() {} -void AsanCheckIncompatibleRT() {} -void InitializeAsanInterceptors() {} - -void *AsanDoesNotSupportStaticLinkage() { return nullptr; } - -void InitializePlatformExceptionHandlers() {} -void AsanOnDeadlySignal(int signo, void *siginfo, void *context) { - UNIMPLEMENTED(); -} - -bool PlatformUnpoisonStacks() { - // The current sp might not point to the default stack. This - // could be because we are in a crash stack from fuzzing for example. - // Unpoison the default stack and the current stack page. - AsanThread *curr_thread = GetCurrentThread(); - CHECK(curr_thread != nullptr); - uptr top = curr_thread->stack_top(); - uptr bottom = curr_thread->stack_bottom(); - // The default stack grows from top to bottom. (bottom < top). - - uptr local_stack = reinterpret_cast(__builtin_frame_address(0)); - if (local_stack >= bottom && local_stack <= top) { - // The current stack is the default stack. - // We only need to unpoison from where we are using until the end. - bottom = RoundDownTo(local_stack, GetPageSize()); - UnpoisonStack(bottom, top, "default"); - } else { - // The current stack is not the default stack. - // Unpoison the entire default stack and the current stack page. - UnpoisonStack(bottom, top, "default"); - bottom = RoundDownTo(local_stack, GetPageSize()); - top = bottom + GetPageSize(); - UnpoisonStack(bottom, top, "unknown"); - return true; - } - - return false; -} - -// We can use a plain thread_local variable for TSD. -static thread_local void *per_thread; - -void *AsanTSDGet() { return per_thread; } - -void AsanTSDSet(void *tsd) { per_thread = tsd; } - -// There's no initialization needed, and the passed-in destructor -// will never be called. Instead, our own thread destruction hook -// (below) will call AsanThread::TSDDtor directly. -void AsanTSDInit(void (*destructor)(void *tsd)) { - DCHECK(destructor == &PlatformTSDDtor); -} - -void PlatformTSDDtor(void *tsd) { UNREACHABLE(__func__); } - -static inline size_t AsanThreadMmapSize() { - return RoundUpTo(sizeof(AsanThread), _zx_system_get_page_size()); -} - -struct AsanThread::InitOptions { - uptr stack_bottom, stack_size; -}; - -// Shared setup between thread creation and startup for the initial thread. -static AsanThread *CreateAsanThread(StackTrace *stack, u32 parent_tid, - bool detached, const char *name) { - // In lieu of AsanThread::Create. - AsanThread *thread = (AsanThread *)MmapOrDie(AsanThreadMmapSize(), __func__); - - AsanThreadContext::CreateThreadContextArgs args = {thread, stack}; - u32 tid = asanThreadRegistry().CreateThread(0, detached, parent_tid, &args); - asanThreadRegistry().SetThreadName(tid, name); - - return thread; -} - -// This gets the same arguments passed to Init by CreateAsanThread, above. -// We're in the creator thread before the new thread is actually started, -// but its stack address range is already known. We don't bother tracking -// the static TLS address range because the system itself already uses an -// ASan-aware allocator for that. -void AsanThread::SetThreadStackAndTls(const AsanThread::InitOptions *options) { - DCHECK_NE(GetCurrentThread(), this); - DCHECK_NE(GetCurrentThread(), nullptr); - CHECK_NE(options->stack_bottom, 0); - CHECK_NE(options->stack_size, 0); - stack_bottom_ = options->stack_bottom; - stack_top_ = options->stack_bottom + options->stack_size; -} - -// Called by __asan::AsanInitInternal (asan_rtl.c). -AsanThread *CreateMainThread() { - thrd_t self = thrd_current(); - char name[ZX_MAX_NAME_LEN]; - CHECK_NE(__sanitizer::MainThreadStackBase, 0); - CHECK_GT(__sanitizer::MainThreadStackSize, 0); - AsanThread *t = CreateAsanThread( - nullptr, 0, true, - _zx_object_get_property(thrd_get_zx_handle(self), ZX_PROP_NAME, name, - sizeof(name)) == ZX_OK - ? name - : nullptr); - // We need to set the current thread before calling AsanThread::Init() below, - // since it reads the thread ID. - SetCurrentThread(t); - DCHECK_EQ(t->tid(), 0); - - const AsanThread::InitOptions options = {__sanitizer::MainThreadStackBase, - __sanitizer::MainThreadStackSize}; - t->Init(&options); - - return t; -} - -// This is called before each thread creation is attempted. So, in -// its first call, the calling thread is the initial and sole thread. -static void *BeforeThreadCreateHook(uptr user_id, bool detached, - const char *name, uptr stack_bottom, - uptr stack_size) { - EnsureMainThreadIDIsCorrect(); - // Strict init-order checking is thread-hostile. - if (flags()->strict_init_order) - StopInitOrderChecking(); - - GET_STACK_TRACE_THREAD; - u32 parent_tid = GetCurrentTidOrInvalid(); - - AsanThread *thread = CreateAsanThread(&stack, parent_tid, detached, name); - - // On other systems, AsanThread::Init() is called from the new - // thread itself. But on Fuchsia we already know the stack address - // range beforehand, so we can do most of the setup right now. - const AsanThread::InitOptions options = {stack_bottom, stack_size}; - thread->Init(&options); - return thread; -} - -// This is called after creating a new thread (in the creating thread), -// with the pointer returned by BeforeThreadCreateHook (above). -static void ThreadCreateHook(void *hook, bool aborted) { - AsanThread *thread = static_cast(hook); - if (!aborted) { - // The thread was created successfully. - // ThreadStartHook is already running in the new thread. - } else { - // The thread wasn't created after all. - // Clean up everything we set up in BeforeThreadCreateHook. - asanThreadRegistry().FinishThread(thread->tid()); - UnmapOrDie(thread, AsanThreadMmapSize()); - } -} - -// This is called in the newly-created thread before it runs anything else, -// with the pointer returned by BeforeThreadCreateHook (above). -// cf. asan_interceptors.cpp:asan_thread_start -static void ThreadStartHook(void *hook, uptr os_id) { - AsanThread *thread = static_cast(hook); - SetCurrentThread(thread); - - // In lieu of AsanThread::ThreadStart. - asanThreadRegistry().StartThread(thread->tid(), os_id, ThreadType::Regular, - nullptr); -} - -// Each thread runs this just before it exits, -// with the pointer returned by BeforeThreadCreateHook (above). -// All per-thread destructors have already been called. -static void ThreadExitHook(void *hook, uptr os_id) { - AsanThread::TSDDtor(per_thread); -} - -bool HandleDlopenInit() { - // Not supported on this platform. - static_assert(!SANITIZER_SUPPORTS_INIT_FOR_DLOPEN, - "Expected SANITIZER_SUPPORTS_INIT_FOR_DLOPEN to be false"); - return false; -} - -void FlushUnneededASanShadowMemory(uptr p, uptr size) { - __sanitizer_fill_shadow(p, size, 0, 0); -} - -} // namespace __asan - -// These are declared (in extern "C") by . -// The system runtime will call our definitions directly. - -void *__sanitizer_before_thread_create_hook(thrd_t thread, bool detached, - const char *name, void *stack_base, - size_t stack_size) { - return __asan::BeforeThreadCreateHook( - reinterpret_cast(thread), detached, name, - reinterpret_cast(stack_base), stack_size); -} - -void __sanitizer_thread_create_hook(void *hook, thrd_t thread, int error) { - __asan::ThreadCreateHook(hook, error != thrd_success); -} - -void __sanitizer_thread_start_hook(void *hook, thrd_t self) { - __asan::ThreadStartHook(hook, reinterpret_cast(self)); -} - -void __sanitizer_thread_exit_hook(void *hook, thrd_t self) { - __asan::ThreadExitHook(hook, reinterpret_cast(self)); -} - -#endif // SANITIZER_FUCHSIA diff --git a/contrib/libs/clang14-rt/lib/asan/asan_globals.cpp b/contrib/libs/clang14-rt/lib/asan/asan_globals.cpp deleted file mode 100644 index ecc2600f039a..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_globals.cpp +++ /dev/null @@ -1,463 +0,0 @@ -//===-- asan_globals.cpp --------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Handle globals. -//===----------------------------------------------------------------------===// - -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "asan_poisoning.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "asan_stats.h" -#include "asan_suppressions.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_mutex.h" -#include "sanitizer_common/sanitizer_placement_new.h" -#include "sanitizer_common/sanitizer_stackdepot.h" -#include "sanitizer_common/sanitizer_symbolizer.h" - -namespace __asan { - -typedef __asan_global Global; - -struct ListOfGlobals { - const Global *g; - ListOfGlobals *next; -}; - -static Mutex mu_for_globals; -static LowLevelAllocator allocator_for_globals; -static ListOfGlobals *list_of_all_globals; - -static const int kDynamicInitGlobalsInitialCapacity = 512; -struct DynInitGlobal { - Global g; - bool initialized; -}; -typedef InternalMmapVector VectorOfGlobals; -// Lazy-initialized and never deleted. -static VectorOfGlobals *dynamic_init_globals; - -// We want to remember where a certain range of globals was registered. -struct GlobalRegistrationSite { - u32 stack_id; - Global *g_first, *g_last; -}; -typedef InternalMmapVector GlobalRegistrationSiteVector; -static GlobalRegistrationSiteVector *global_registration_site_vector; - -ALWAYS_INLINE void PoisonShadowForGlobal(const Global *g, u8 value) { - FastPoisonShadow(g->beg, g->size_with_redzone, value); -} - -ALWAYS_INLINE void PoisonRedZones(const Global &g) { - uptr aligned_size = RoundUpTo(g.size, ASAN_SHADOW_GRANULARITY); - FastPoisonShadow(g.beg + aligned_size, g.size_with_redzone - aligned_size, - kAsanGlobalRedzoneMagic); - if (g.size != aligned_size) { - FastPoisonShadowPartialRightRedzone( - g.beg + RoundDownTo(g.size, ASAN_SHADOW_GRANULARITY), - g.size % ASAN_SHADOW_GRANULARITY, ASAN_SHADOW_GRANULARITY, - kAsanGlobalRedzoneMagic); - } -} - -const uptr kMinimalDistanceFromAnotherGlobal = 64; - -static bool IsAddressNearGlobal(uptr addr, const __asan_global &g) { - if (addr <= g.beg - kMinimalDistanceFromAnotherGlobal) return false; - if (addr >= g.beg + g.size_with_redzone) return false; - return true; -} - -static void ReportGlobal(const Global &g, const char *prefix) { - Report( - "%s Global[%p]: beg=%p size=%zu/%zu name=%s module=%s dyn_init=%zu " - "odr_indicator=%p\n", - prefix, (void *)&g, (void *)g.beg, g.size, g.size_with_redzone, g.name, - g.module_name, g.has_dynamic_init, (void *)g.odr_indicator); - if (g.location) { - Report(" location (%p): name=%s[%p], %d %d\n", (void *)g.location, - g.location->filename, (void *)g.location->filename, - g.location->line_no, g.location->column_no); - } -} - -static u32 FindRegistrationSite(const Global *g) { - mu_for_globals.CheckLocked(); - CHECK(global_registration_site_vector); - for (uptr i = 0, n = global_registration_site_vector->size(); i < n; i++) { - GlobalRegistrationSite &grs = (*global_registration_site_vector)[i]; - if (g >= grs.g_first && g <= grs.g_last) - return grs.stack_id; - } - return 0; -} - -int GetGlobalsForAddress(uptr addr, Global *globals, u32 *reg_sites, - int max_globals) { - if (!flags()->report_globals) return 0; - Lock lock(&mu_for_globals); - int res = 0; - for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) { - const Global &g = *l->g; - if (flags()->report_globals >= 2) - ReportGlobal(g, "Search"); - if (IsAddressNearGlobal(addr, g)) { - internal_memcpy(&globals[res], &g, sizeof(g)); - if (reg_sites) - reg_sites[res] = FindRegistrationSite(&g); - res++; - if (res == max_globals) - break; - } - } - return res; -} - -enum GlobalSymbolState { - UNREGISTERED = 0, - REGISTERED = 1 -}; - -// Check ODR violation for given global G via special ODR indicator. We use -// this method in case compiler instruments global variables through their -// local aliases. -static void CheckODRViolationViaIndicator(const Global *g) { - // Instrumentation requests to skip ODR check. - if (g->odr_indicator == UINTPTR_MAX) - return; - u8 *odr_indicator = reinterpret_cast(g->odr_indicator); - if (*odr_indicator == UNREGISTERED) { - *odr_indicator = REGISTERED; - return; - } - // If *odr_indicator is DEFINED, some module have already registered - // externally visible symbol with the same name. This is an ODR violation. - for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) { - if (g->odr_indicator == l->g->odr_indicator && - (flags()->detect_odr_violation >= 2 || g->size != l->g->size) && - !IsODRViolationSuppressed(g->name)) - ReportODRViolation(g, FindRegistrationSite(g), - l->g, FindRegistrationSite(l->g)); - } -} - -// Check ODR violation for given global G by checking if it's already poisoned. -// We use this method in case compiler doesn't use private aliases for global -// variables. -static void CheckODRViolationViaPoisoning(const Global *g) { - if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) { - // This check may not be enough: if the first global is much larger - // the entire redzone of the second global may be within the first global. - for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) { - if (g->beg == l->g->beg && - (flags()->detect_odr_violation >= 2 || g->size != l->g->size) && - !IsODRViolationSuppressed(g->name)) - ReportODRViolation(g, FindRegistrationSite(g), - l->g, FindRegistrationSite(l->g)); - } - } -} - -// Clang provides two different ways for global variables protection: -// it can poison the global itself or its private alias. In former -// case we may poison same symbol multiple times, that can help us to -// cheaply detect ODR violation: if we try to poison an already poisoned -// global, we have ODR violation error. -// In latter case, we poison each symbol exactly once, so we use special -// indicator symbol to perform similar check. -// In either case, compiler provides a special odr_indicator field to Global -// structure, that can contain two kinds of values: -// 1) Non-zero value. In this case, odr_indicator is an address of -// corresponding indicator variable for given global. -// 2) Zero. This means that we don't use private aliases for global variables -// and can freely check ODR violation with the first method. -// -// This routine chooses between two different methods of ODR violation -// detection. -static inline bool UseODRIndicator(const Global *g) { - return g->odr_indicator > 0; -} - -// Register a global variable. -// This function may be called more than once for every global -// so we store the globals in a map. -static void RegisterGlobal(const Global *g) { - CHECK(asan_inited); - if (flags()->report_globals >= 2) - ReportGlobal(*g, "Added"); - CHECK(flags()->report_globals); - CHECK(AddrIsInMem(g->beg)); - if (!AddrIsAlignedByGranularity(g->beg)) { - Report("The following global variable is not properly aligned.\n"); - Report("This may happen if another global with the same name\n"); - Report("resides in another non-instrumented module.\n"); - Report("Or the global comes from a C file built w/o -fno-common.\n"); - Report("In either case this is likely an ODR violation bug,\n"); - Report("but AddressSanitizer can not provide more details.\n"); - ReportODRViolation(g, FindRegistrationSite(g), g, FindRegistrationSite(g)); - CHECK(AddrIsAlignedByGranularity(g->beg)); - } - CHECK(AddrIsAlignedByGranularity(g->size_with_redzone)); - if (flags()->detect_odr_violation) { - // Try detecting ODR (One Definition Rule) violation, i.e. the situation - // where two globals with the same name are defined in different modules. - if (UseODRIndicator(g)) - CheckODRViolationViaIndicator(g); - else - CheckODRViolationViaPoisoning(g); - } - if (CanPoisonMemory()) - PoisonRedZones(*g); - ListOfGlobals *l = new(allocator_for_globals) ListOfGlobals; - l->g = g; - l->next = list_of_all_globals; - list_of_all_globals = l; - if (g->has_dynamic_init) { - if (!dynamic_init_globals) { - dynamic_init_globals = new (allocator_for_globals) VectorOfGlobals; - dynamic_init_globals->reserve(kDynamicInitGlobalsInitialCapacity); - } - DynInitGlobal dyn_global = { *g, false }; - dynamic_init_globals->push_back(dyn_global); - } -} - -static void UnregisterGlobal(const Global *g) { - CHECK(asan_inited); - if (flags()->report_globals >= 2) - ReportGlobal(*g, "Removed"); - CHECK(flags()->report_globals); - CHECK(AddrIsInMem(g->beg)); - CHECK(AddrIsAlignedByGranularity(g->beg)); - CHECK(AddrIsAlignedByGranularity(g->size_with_redzone)); - if (CanPoisonMemory()) - PoisonShadowForGlobal(g, 0); - // We unpoison the shadow memory for the global but we do not remove it from - // the list because that would require O(n^2) time with the current list - // implementation. It might not be worth doing anyway. - - // Release ODR indicator. - if (UseODRIndicator(g) && g->odr_indicator != UINTPTR_MAX) { - u8 *odr_indicator = reinterpret_cast(g->odr_indicator); - *odr_indicator = UNREGISTERED; - } -} - -void StopInitOrderChecking() { - Lock lock(&mu_for_globals); - if (!flags()->check_initialization_order || !dynamic_init_globals) - return; - flags()->check_initialization_order = false; - for (uptr i = 0, n = dynamic_init_globals->size(); i < n; ++i) { - DynInitGlobal &dyn_g = (*dynamic_init_globals)[i]; - const Global *g = &dyn_g.g; - // Unpoison the whole global. - PoisonShadowForGlobal(g, 0); - // Poison redzones back. - PoisonRedZones(*g); - } -} - -static bool IsASCII(unsigned char c) { return /*0x00 <= c &&*/ c <= 0x7F; } - -const char *MaybeDemangleGlobalName(const char *name) { - // We can spoil names of globals with C linkage, so use an heuristic - // approach to check if the name should be demangled. - bool should_demangle = false; - if (name[0] == '_' && name[1] == 'Z') - should_demangle = true; - else if (SANITIZER_WINDOWS && name[0] == '\01' && name[1] == '?') - should_demangle = true; - - return should_demangle ? Symbolizer::GetOrInit()->Demangle(name) : name; -} - -// Check if the global is a zero-terminated ASCII string. If so, print it. -void PrintGlobalNameIfASCII(InternalScopedString *str, const __asan_global &g) { - for (uptr p = g.beg; p < g.beg + g.size - 1; p++) { - unsigned char c = *(unsigned char *)p; - if (c == '\0' || !IsASCII(c)) return; - } - if (*(char *)(g.beg + g.size - 1) != '\0') return; - str->append(" '%s' is ascii string '%s'\n", MaybeDemangleGlobalName(g.name), - (char *)g.beg); -} - -static const char *GlobalFilename(const __asan_global &g) { - const char *res = g.module_name; - // Prefer the filename from source location, if is available. - if (g.location) res = g.location->filename; - CHECK(res); - return res; -} - -void PrintGlobalLocation(InternalScopedString *str, const __asan_global &g) { - str->append("%s", GlobalFilename(g)); - if (!g.location) return; - if (g.location->line_no) str->append(":%d", g.location->line_no); - if (g.location->column_no) str->append(":%d", g.location->column_no); -} - -} // namespace __asan - -// ---------------------- Interface ---------------- {{{1 -using namespace __asan; - -// Apply __asan_register_globals to all globals found in the same loaded -// executable or shared library as `flag'. The flag tracks whether globals have -// already been registered or not for this image. -void __asan_register_image_globals(uptr *flag) { - if (*flag) - return; - AsanApplyToGlobals(__asan_register_globals, flag); - *flag = 1; -} - -// This mirrors __asan_register_image_globals. -void __asan_unregister_image_globals(uptr *flag) { - if (!*flag) - return; - AsanApplyToGlobals(__asan_unregister_globals, flag); - *flag = 0; -} - -void __asan_register_elf_globals(uptr *flag, void *start, void *stop) { - if (*flag) return; - if (!start) return; - CHECK_EQ(0, ((uptr)stop - (uptr)start) % sizeof(__asan_global)); - __asan_global *globals_start = (__asan_global*)start; - __asan_global *globals_stop = (__asan_global*)stop; - __asan_register_globals(globals_start, globals_stop - globals_start); - *flag = 1; -} - -void __asan_unregister_elf_globals(uptr *flag, void *start, void *stop) { - if (!*flag) return; - if (!start) return; - CHECK_EQ(0, ((uptr)stop - (uptr)start) % sizeof(__asan_global)); - __asan_global *globals_start = (__asan_global*)start; - __asan_global *globals_stop = (__asan_global*)stop; - __asan_unregister_globals(globals_start, globals_stop - globals_start); - *flag = 0; -} - -// Register an array of globals. -void __asan_register_globals(__asan_global *globals, uptr n) { - if (!flags()->report_globals) return; - GET_STACK_TRACE_MALLOC; - u32 stack_id = StackDepotPut(stack); - Lock lock(&mu_for_globals); - if (!global_registration_site_vector) { - global_registration_site_vector = - new (allocator_for_globals) GlobalRegistrationSiteVector; - global_registration_site_vector->reserve(128); - } - GlobalRegistrationSite site = {stack_id, &globals[0], &globals[n - 1]}; - global_registration_site_vector->push_back(site); - if (flags()->report_globals >= 2) { - PRINT_CURRENT_STACK(); - Printf("=== ID %d; %p %p\n", stack_id, (void *)&globals[0], - (void *)&globals[n - 1]); - } - for (uptr i = 0; i < n; i++) { - if (SANITIZER_WINDOWS && globals[i].beg == 0) { - // The MSVC incremental linker may pad globals out to 256 bytes. As long - // as __asan_global is less than 256 bytes large and its size is a power - // of two, we can skip over the padding. - static_assert( - sizeof(__asan_global) < 256 && - (sizeof(__asan_global) & (sizeof(__asan_global) - 1)) == 0, - "sizeof(__asan_global) incompatible with incremental linker padding"); - // If these are padding bytes, the rest of the global should be zero. - CHECK(globals[i].size == 0 && globals[i].size_with_redzone == 0 && - globals[i].name == nullptr && globals[i].module_name == nullptr && - globals[i].odr_indicator == 0); - continue; - } - RegisterGlobal(&globals[i]); - } - - // Poison the metadata. It should not be accessible to user code. - PoisonShadow(reinterpret_cast(globals), n * sizeof(__asan_global), - kAsanGlobalRedzoneMagic); -} - -// Unregister an array of globals. -// We must do this when a shared objects gets dlclosed. -void __asan_unregister_globals(__asan_global *globals, uptr n) { - if (!flags()->report_globals) return; - Lock lock(&mu_for_globals); - for (uptr i = 0; i < n; i++) { - if (SANITIZER_WINDOWS && globals[i].beg == 0) { - // Skip globals that look like padding from the MSVC incremental linker. - // See comment in __asan_register_globals. - continue; - } - UnregisterGlobal(&globals[i]); - } - - // Unpoison the metadata. - PoisonShadow(reinterpret_cast(globals), n * sizeof(__asan_global), 0); -} - -// This method runs immediately prior to dynamic initialization in each TU, -// when all dynamically initialized globals are unpoisoned. This method -// poisons all global variables not defined in this TU, so that a dynamic -// initializer can only touch global variables in the same TU. -void __asan_before_dynamic_init(const char *module_name) { - if (!flags()->check_initialization_order || - !CanPoisonMemory() || - !dynamic_init_globals) - return; - bool strict_init_order = flags()->strict_init_order; - CHECK(module_name); - CHECK(asan_inited); - Lock lock(&mu_for_globals); - if (flags()->report_globals >= 3) - Printf("DynInitPoison module: %s\n", module_name); - for (uptr i = 0, n = dynamic_init_globals->size(); i < n; ++i) { - DynInitGlobal &dyn_g = (*dynamic_init_globals)[i]; - const Global *g = &dyn_g.g; - if (dyn_g.initialized) - continue; - if (g->module_name != module_name) - PoisonShadowForGlobal(g, kAsanInitializationOrderMagic); - else if (!strict_init_order) - dyn_g.initialized = true; - } -} - -// This method runs immediately after dynamic initialization in each TU, when -// all dynamically initialized globals except for those defined in the current -// TU are poisoned. It simply unpoisons all dynamically initialized globals. -void __asan_after_dynamic_init() { - if (!flags()->check_initialization_order || - !CanPoisonMemory() || - !dynamic_init_globals) - return; - CHECK(asan_inited); - Lock lock(&mu_for_globals); - // FIXME: Optionally report that we're unpoisoning globals from a module. - for (uptr i = 0, n = dynamic_init_globals->size(); i < n; ++i) { - DynInitGlobal &dyn_g = (*dynamic_init_globals)[i]; - const Global *g = &dyn_g.g; - if (!dyn_g.initialized) { - // Unpoison the whole global. - PoisonShadowForGlobal(g, 0); - // Poison redzones back. - PoisonRedZones(*g); - } - } -} diff --git a/contrib/libs/clang14-rt/lib/asan/asan_globals_win.cpp b/contrib/libs/clang14-rt/lib/asan/asan_globals_win.cpp deleted file mode 100644 index 19af88ab12b4..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_globals_win.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===-- asan_globals_win.cpp ----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Global registration code that is linked into every Windows DLL and EXE. -// -//===----------------------------------------------------------------------===// - -#include "asan_interface_internal.h" -#if SANITIZER_WINDOWS - -namespace __asan { - -#pragma section(".ASAN$GA", read, write) -#pragma section(".ASAN$GZ", read, write) -extern "C" __declspec(allocate(".ASAN$GA")) - ALIGNED(sizeof(__asan_global)) __asan_global __asan_globals_start = {}; -extern "C" __declspec(allocate(".ASAN$GZ")) - ALIGNED(sizeof(__asan_global)) __asan_global __asan_globals_end = {}; -#pragma comment(linker, "/merge:.ASAN=.data") - -static void call_on_globals(void (*hook)(__asan_global *, uptr)) { - __asan_global *start = &__asan_globals_start + 1; - __asan_global *end = &__asan_globals_end; - uptr bytediff = (uptr)end - (uptr)start; - if (bytediff % sizeof(__asan_global) != 0) { -#if defined(SANITIZER_DLL_THUNK) || defined(SANITIZER_DYNAMIC_RUNTIME_THUNK) - __debugbreak(); -#else - CHECK("corrupt asan global array"); -#endif - } - // We know end >= start because the linker sorts the portion after the dollar - // sign alphabetically. - uptr n = end - start; - hook(start, n); -} - -static void register_dso_globals() { - call_on_globals(&__asan_register_globals); -} - -static void unregister_dso_globals() { - call_on_globals(&__asan_unregister_globals); -} - -// Register globals -#pragma section(".CRT$XCU", long, read) -#pragma section(".CRT$XTX", long, read) -extern "C" __declspec(allocate(".CRT$XCU")) -void (*const __asan_dso_reg_hook)() = ®ister_dso_globals; -extern "C" __declspec(allocate(".CRT$XTX")) -void (*const __asan_dso_unreg_hook)() = &unregister_dso_globals; - -} // namespace __asan - -#endif // SANITIZER_WINDOWS diff --git a/contrib/libs/clang14-rt/lib/asan/asan_init_version.h b/contrib/libs/clang14-rt/lib/asan/asan_init_version.h deleted file mode 100644 index b806d794e056..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_init_version.h +++ /dev/null @@ -1,44 +0,0 @@ -//===-- asan_init_version.h -------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// This header defines a versioned __asan_init function to be called at the -// startup of the instrumented program. -//===----------------------------------------------------------------------===// -#ifndef ASAN_INIT_VERSION_H -#define ASAN_INIT_VERSION_H - -#include "sanitizer_common/sanitizer_platform.h" - -extern "C" { - // Every time the ASan ABI changes we also change the version number in the - // __asan_init function name. Objects built with incompatible ASan ABI - // versions will not link with run-time. - // - // Changes between ABI versions: - // v1=>v2: added 'module_name' to __asan_global - // v2=>v3: stack frame description (created by the compiler) - // contains the function PC as the 3rd field (see - // DescribeAddressIfStack) - // v3=>v4: added '__asan_global_source_location' to __asan_global - // v4=>v5: changed the semantics and format of __asan_stack_malloc_ and - // __asan_stack_free_ functions - // v5=>v6: changed the name of the version check symbol - // v6=>v7: added 'odr_indicator' to __asan_global - // v7=>v8: added '__asan_(un)register_image_globals' functions for dead - // stripping support on Mach-O platforms -#if SANITIZER_WORDSIZE == 32 && SANITIZER_ANDROID - // v8=>v9: 32-bit Android switched to dynamic shadow - #define __asan_version_mismatch_check __asan_version_mismatch_check_v9 -#else - #define __asan_version_mismatch_check __asan_version_mismatch_check_v8 -#endif -} - -#endif // ASAN_INIT_VERSION_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_interceptors.cpp b/contrib/libs/clang14-rt/lib/asan/asan_interceptors.cpp deleted file mode 100644 index 2ff314a5a9cb..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_interceptors.cpp +++ /dev/null @@ -1,711 +0,0 @@ -//===-- asan_interceptors.cpp ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Intercept various libc functions. -//===----------------------------------------------------------------------===// - -#include "asan_interceptors.h" -#include "asan_allocator.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "asan_poisoning.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "asan_stats.h" -#include "asan_suppressions.h" -#include "lsan/lsan_common.h" -#include "sanitizer_common/sanitizer_libc.h" - -// There is no general interception at all on Fuchsia. -// Only the functions in asan_interceptors_memintrinsics.cpp are -// really defined to replace libc functions. -#if !SANITIZER_FUCHSIA - -# if SANITIZER_POSIX -# include "sanitizer_common/sanitizer_posix.h" -# endif - -# if ASAN_INTERCEPT__UNWIND_RAISEEXCEPTION || \ - ASAN_INTERCEPT__SJLJ_UNWIND_RAISEEXCEPTION -# include -# endif - -# if defined(__i386) && SANITIZER_LINUX -# define ASAN_PTHREAD_CREATE_VERSION "GLIBC_2.1" -# elif defined(__mips__) && SANITIZER_LINUX -# define ASAN_PTHREAD_CREATE_VERSION "GLIBC_2.2" -# endif - -namespace __asan { - -#define ASAN_READ_STRING_OF_LEN(ctx, s, len, n) \ - ASAN_READ_RANGE((ctx), (s), \ - common_flags()->strict_string_checks ? (len) + 1 : (n)) - -# define ASAN_READ_STRING(ctx, s, n) \ - ASAN_READ_STRING_OF_LEN((ctx), (s), internal_strlen(s), (n)) - -static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) { -#if SANITIZER_INTERCEPT_STRNLEN - if (REAL(strnlen)) { - return REAL(strnlen)(s, maxlen); - } -#endif - return internal_strnlen(s, maxlen); -} - -void SetThreadName(const char *name) { - AsanThread *t = GetCurrentThread(); - if (t) - asanThreadRegistry().SetThreadName(t->tid(), name); -} - -int OnExit() { - if (CAN_SANITIZE_LEAKS && common_flags()->detect_leaks && - __lsan::HasReportedLeaks()) { - return common_flags()->exitcode; - } - // FIXME: ask frontend whether we need to return failure. - return 0; -} - -} // namespace __asan - -// ---------------------- Wrappers ---------------- {{{1 -using namespace __asan; - -DECLARE_REAL_AND_INTERCEPTOR(void *, malloc, uptr) -DECLARE_REAL_AND_INTERCEPTOR(void, free, void *) - -#define ASAN_INTERCEPTOR_ENTER(ctx, func) \ - AsanInterceptorContext _ctx = {#func}; \ - ctx = (void *)&_ctx; \ - (void) ctx; \ - -#define COMMON_INTERCEPT_FUNCTION(name) ASAN_INTERCEPT_FUNC(name) -#define COMMON_INTERCEPT_FUNCTION_VER(name, ver) \ - ASAN_INTERCEPT_FUNC_VER(name, ver) -#define COMMON_INTERCEPT_FUNCTION_VER_UNVERSIONED_FALLBACK(name, ver) \ - ASAN_INTERCEPT_FUNC_VER_UNVERSIONED_FALLBACK(name, ver) -#define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) \ - ASAN_WRITE_RANGE(ctx, ptr, size) -#define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) \ - ASAN_READ_RANGE(ctx, ptr, size) -#define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \ - ASAN_INTERCEPTOR_ENTER(ctx, func); \ - do { \ - if (asan_init_is_running) \ - return REAL(func)(__VA_ARGS__); \ - if (SANITIZER_MAC && UNLIKELY(!asan_inited)) \ - return REAL(func)(__VA_ARGS__); \ - ENSURE_ASAN_INITED(); \ - } while (false) -#define COMMON_INTERCEPTOR_DIR_ACQUIRE(ctx, path) \ - do { \ - } while (false) -#define COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd) \ - do { \ - } while (false) -#define COMMON_INTERCEPTOR_FD_RELEASE(ctx, fd) \ - do { \ - } while (false) -#define COMMON_INTERCEPTOR_FD_SOCKET_ACCEPT(ctx, fd, newfd) \ - do { \ - } while (false) -#define COMMON_INTERCEPTOR_SET_THREAD_NAME(ctx, name) SetThreadName(name) -// Should be asanThreadRegistry().SetThreadNameByUserId(thread, name) -// But asan does not remember UserId's for threads (pthread_t); -// and remembers all ever existed threads, so the linear search by UserId -// can be slow. -#define COMMON_INTERCEPTOR_SET_PTHREAD_NAME(ctx, thread, name) \ - do { \ - } while (false) -#define COMMON_INTERCEPTOR_BLOCK_REAL(name) REAL(name) -// Strict init-order checking is dlopen-hostile: -// https://github.com/google/sanitizers/issues/178 -# define COMMON_INTERCEPTOR_DLOPEN(filename, flag) \ - ({ \ - if (flags()->strict_init_order) \ - StopInitOrderChecking(); \ - CheckNoDeepBind(filename, flag); \ - REAL(dlopen)(filename, flag); \ - }) -# define COMMON_INTERCEPTOR_ON_EXIT(ctx) OnExit() -# define COMMON_INTERCEPTOR_LIBRARY_LOADED(filename, handle) -# define COMMON_INTERCEPTOR_LIBRARY_UNLOADED() -# define COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED (!asan_inited) -# define COMMON_INTERCEPTOR_GET_TLS_RANGE(begin, end) \ - if (AsanThread *t = GetCurrentThread()) { \ - *begin = t->tls_begin(); \ - *end = t->tls_end(); \ - } else { \ - *begin = *end = 0; \ - } - -#define COMMON_INTERCEPTOR_MEMMOVE_IMPL(ctx, to, from, size) \ - do { \ - ASAN_INTERCEPTOR_ENTER(ctx, memmove); \ - ASAN_MEMMOVE_IMPL(ctx, to, from, size); \ - } while (false) - -#define COMMON_INTERCEPTOR_MEMCPY_IMPL(ctx, to, from, size) \ - do { \ - ASAN_INTERCEPTOR_ENTER(ctx, memcpy); \ - ASAN_MEMCPY_IMPL(ctx, to, from, size); \ - } while (false) - -#define COMMON_INTERCEPTOR_MEMSET_IMPL(ctx, block, c, size) \ - do { \ - ASAN_INTERCEPTOR_ENTER(ctx, memset); \ - ASAN_MEMSET_IMPL(ctx, block, c, size); \ - } while (false) - -#if CAN_SANITIZE_LEAKS -#define COMMON_INTERCEPTOR_STRERROR() \ - __lsan::ScopedInterceptorDisabler disabler -#endif - -#include "sanitizer_common/sanitizer_common_interceptors.inc" -#include "sanitizer_common/sanitizer_signal_interceptors.inc" - -// Syscall interceptors don't have contexts, we don't support suppressions -// for them. -#define COMMON_SYSCALL_PRE_READ_RANGE(p, s) ASAN_READ_RANGE(nullptr, p, s) -#define COMMON_SYSCALL_PRE_WRITE_RANGE(p, s) ASAN_WRITE_RANGE(nullptr, p, s) -#define COMMON_SYSCALL_POST_READ_RANGE(p, s) \ - do { \ - (void)(p); \ - (void)(s); \ - } while (false) -#define COMMON_SYSCALL_POST_WRITE_RANGE(p, s) \ - do { \ - (void)(p); \ - (void)(s); \ - } while (false) -#include "sanitizer_common/sanitizer_common_syscalls.inc" -#include "sanitizer_common/sanitizer_syscalls_netbsd.inc" - -#if ASAN_INTERCEPT_PTHREAD_CREATE -static thread_return_t THREAD_CALLING_CONV asan_thread_start(void *arg) { - AsanThread *t = (AsanThread *)arg; - SetCurrentThread(t); - return t->ThreadStart(GetTid()); -} - -INTERCEPTOR(int, pthread_create, void *thread, - void *attr, void *(*start_routine)(void*), void *arg) { - EnsureMainThreadIDIsCorrect(); - // Strict init-order checking is thread-hostile. - if (flags()->strict_init_order) - StopInitOrderChecking(); - GET_STACK_TRACE_THREAD; - int detached = 0; - if (attr) - REAL(pthread_attr_getdetachstate)(attr, &detached); - - u32 current_tid = GetCurrentTidOrInvalid(); - AsanThread *t = - AsanThread::Create(start_routine, arg, current_tid, &stack, detached); - - int result; - { - // Ignore all allocations made by pthread_create: thread stack/TLS may be - // stored by pthread for future reuse even after thread destruction, and - // the linked list it's stored in doesn't even hold valid pointers to the - // objects, the latter are calculated by obscure pointer arithmetic. -#if CAN_SANITIZE_LEAKS - __lsan::ScopedInterceptorDisabler disabler; -#endif - result = REAL(pthread_create)(thread, attr, asan_thread_start, t); - } - if (result != 0) { - // If the thread didn't start delete the AsanThread to avoid leaking it. - // Note AsanThreadContexts never get destroyed so the AsanThreadContext - // that was just created for the AsanThread is wasted. - t->Destroy(); - } - return result; -} - -INTERCEPTOR(int, pthread_join, void *t, void **arg) { - return real_pthread_join(t, arg); -} - -DEFINE_REAL_PTHREAD_FUNCTIONS -#endif // ASAN_INTERCEPT_PTHREAD_CREATE - -#if ASAN_INTERCEPT_SWAPCONTEXT -static void ClearShadowMemoryForContextStack(uptr stack, uptr ssize) { - // Align to page size. - uptr PageSize = GetPageSizeCached(); - uptr bottom = stack & ~(PageSize - 1); - ssize += stack - bottom; - ssize = RoundUpTo(ssize, PageSize); - static const uptr kMaxSaneContextStackSize = 1 << 22; // 4 Mb - if (AddrIsInMem(bottom) && ssize && ssize <= kMaxSaneContextStackSize) { - PoisonShadow(bottom, ssize, 0); - } -} - -INTERCEPTOR(int, swapcontext, struct ucontext_t *oucp, - struct ucontext_t *ucp) { - static bool reported_warning = false; - if (!reported_warning) { - Report("WARNING: ASan doesn't fully support makecontext/swapcontext " - "functions and may produce false positives in some cases!\n"); - reported_warning = true; - } - // Clear shadow memory for new context (it may share stack - // with current context). - uptr stack, ssize; - ReadContextStack(ucp, &stack, &ssize); - ClearShadowMemoryForContextStack(stack, ssize); -#if __has_attribute(__indirect_return__) && \ - (defined(__x86_64__) || defined(__i386__)) - int (*real_swapcontext)(struct ucontext_t *, struct ucontext_t *) - __attribute__((__indirect_return__)) - = REAL(swapcontext); - int res = real_swapcontext(oucp, ucp); -#else - int res = REAL(swapcontext)(oucp, ucp); -#endif - // swapcontext technically does not return, but program may swap context to - // "oucp" later, that would look as if swapcontext() returned 0. - // We need to clear shadow for ucp once again, as it may be in arbitrary - // state. - ClearShadowMemoryForContextStack(stack, ssize); - return res; -} -#endif // ASAN_INTERCEPT_SWAPCONTEXT - -#if SANITIZER_NETBSD -#define longjmp __longjmp14 -#define siglongjmp __siglongjmp14 -#endif - -INTERCEPTOR(void, longjmp, void *env, int val) { - __asan_handle_no_return(); - REAL(longjmp)(env, val); -} - -#if ASAN_INTERCEPT__LONGJMP -INTERCEPTOR(void, _longjmp, void *env, int val) { - __asan_handle_no_return(); - REAL(_longjmp)(env, val); -} -#endif - -#if ASAN_INTERCEPT___LONGJMP_CHK -INTERCEPTOR(void, __longjmp_chk, void *env, int val) { - __asan_handle_no_return(); - REAL(__longjmp_chk)(env, val); -} -#endif - -#if ASAN_INTERCEPT_SIGLONGJMP -INTERCEPTOR(void, siglongjmp, void *env, int val) { - __asan_handle_no_return(); - REAL(siglongjmp)(env, val); -} -#endif - -#if ASAN_INTERCEPT___CXA_THROW -INTERCEPTOR(void, __cxa_throw, void *a, void *b, void *c) { - CHECK(REAL(__cxa_throw)); - __asan_handle_no_return(); - REAL(__cxa_throw)(a, b, c); -} -#endif - -#if ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION -INTERCEPTOR(void, __cxa_rethrow_primary_exception, void *a) { - CHECK(REAL(__cxa_rethrow_primary_exception)); - __asan_handle_no_return(); - REAL(__cxa_rethrow_primary_exception)(a); -} -#endif - -#if ASAN_INTERCEPT__UNWIND_RAISEEXCEPTION -INTERCEPTOR(_Unwind_Reason_Code, _Unwind_RaiseException, - _Unwind_Exception *object) { - CHECK(REAL(_Unwind_RaiseException)); - __asan_handle_no_return(); - return REAL(_Unwind_RaiseException)(object); -} -#endif - -#if ASAN_INTERCEPT__SJLJ_UNWIND_RAISEEXCEPTION -INTERCEPTOR(_Unwind_Reason_Code, _Unwind_SjLj_RaiseException, - _Unwind_Exception *object) { - CHECK(REAL(_Unwind_SjLj_RaiseException)); - __asan_handle_no_return(); - return REAL(_Unwind_SjLj_RaiseException)(object); -} -#endif - -#if ASAN_INTERCEPT_INDEX -# if ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX -INTERCEPTOR(char*, index, const char *string, int c) - ALIAS(WRAPPER_NAME(strchr)); -# else -# if SANITIZER_MAC -DECLARE_REAL(char*, index, const char *string, int c) -OVERRIDE_FUNCTION(index, strchr); -# else -DEFINE_REAL(char*, index, const char *string, int c) -# endif -# endif -#endif // ASAN_INTERCEPT_INDEX - -// For both strcat() and strncat() we need to check the validity of |to| -// argument irrespective of the |from| length. - INTERCEPTOR(char *, strcat, char *to, const char *from) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strcat); - ENSURE_ASAN_INITED(); - if (flags()->replace_str) { - uptr from_length = internal_strlen(from); - ASAN_READ_RANGE(ctx, from, from_length + 1); - uptr to_length = internal_strlen(to); - ASAN_READ_STRING_OF_LEN(ctx, to, to_length, to_length); - ASAN_WRITE_RANGE(ctx, to + to_length, from_length + 1); - // If the copying actually happens, the |from| string should not overlap - // with the resulting string starting at |to|, which has a length of - // to_length + from_length + 1. - if (from_length > 0) { - CHECK_RANGES_OVERLAP("strcat", to, from_length + to_length + 1, from, - from_length + 1); - } - } - return REAL(strcat)(to, from); - } - -INTERCEPTOR(char*, strncat, char *to, const char *from, uptr size) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strncat); - ENSURE_ASAN_INITED(); - if (flags()->replace_str) { - uptr from_length = MaybeRealStrnlen(from, size); - uptr copy_length = Min(size, from_length + 1); - ASAN_READ_RANGE(ctx, from, copy_length); - uptr to_length = internal_strlen(to); - ASAN_READ_STRING_OF_LEN(ctx, to, to_length, to_length); - ASAN_WRITE_RANGE(ctx, to + to_length, from_length + 1); - if (from_length > 0) { - CHECK_RANGES_OVERLAP("strncat", to, to_length + copy_length + 1, - from, copy_length); - } - } - return REAL(strncat)(to, from, size); -} - -INTERCEPTOR(char *, strcpy, char *to, const char *from) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strcpy); -#if SANITIZER_MAC - if (UNLIKELY(!asan_inited)) - return REAL(strcpy)(to, from); -#endif - // strcpy is called from malloc_default_purgeable_zone() - // in __asan::ReplaceSystemAlloc() on Mac. - if (asan_init_is_running) { - return REAL(strcpy)(to, from); - } - ENSURE_ASAN_INITED(); - if (flags()->replace_str) { - uptr from_size = internal_strlen(from) + 1; - CHECK_RANGES_OVERLAP("strcpy", to, from_size, from, from_size); - ASAN_READ_RANGE(ctx, from, from_size); - ASAN_WRITE_RANGE(ctx, to, from_size); - } - return REAL(strcpy)(to, from); -} - -INTERCEPTOR(char*, strdup, const char *s) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strdup); - if (UNLIKELY(!asan_inited)) return internal_strdup(s); - ENSURE_ASAN_INITED(); - uptr length = internal_strlen(s); - if (flags()->replace_str) { - ASAN_READ_RANGE(ctx, s, length + 1); - } - GET_STACK_TRACE_MALLOC; - void *new_mem = asan_malloc(length + 1, &stack); - REAL(memcpy)(new_mem, s, length + 1); - return reinterpret_cast(new_mem); -} - -#if ASAN_INTERCEPT___STRDUP -INTERCEPTOR(char*, __strdup, const char *s) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strdup); - if (UNLIKELY(!asan_inited)) return internal_strdup(s); - ENSURE_ASAN_INITED(); - uptr length = internal_strlen(s); - if (flags()->replace_str) { - ASAN_READ_RANGE(ctx, s, length + 1); - } - GET_STACK_TRACE_MALLOC; - void *new_mem = asan_malloc(length + 1, &stack); - REAL(memcpy)(new_mem, s, length + 1); - return reinterpret_cast(new_mem); -} -#endif // ASAN_INTERCEPT___STRDUP - -INTERCEPTOR(char*, strncpy, char *to, const char *from, uptr size) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strncpy); - ENSURE_ASAN_INITED(); - if (flags()->replace_str) { - uptr from_size = Min(size, MaybeRealStrnlen(from, size) + 1); - CHECK_RANGES_OVERLAP("strncpy", to, from_size, from, from_size); - ASAN_READ_RANGE(ctx, from, from_size); - ASAN_WRITE_RANGE(ctx, to, size); - } - return REAL(strncpy)(to, from, size); -} - -INTERCEPTOR(long, strtol, const char *nptr, char **endptr, int base) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strtol); - ENSURE_ASAN_INITED(); - if (!flags()->replace_str) { - return REAL(strtol)(nptr, endptr, base); - } - char *real_endptr; - long result = REAL(strtol)(nptr, &real_endptr, base); - StrtolFixAndCheck(ctx, nptr, endptr, real_endptr, base); - return result; -} - -INTERCEPTOR(int, atoi, const char *nptr) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, atoi); -#if SANITIZER_MAC - if (UNLIKELY(!asan_inited)) return REAL(atoi)(nptr); -#endif - ENSURE_ASAN_INITED(); - if (!flags()->replace_str) { - return REAL(atoi)(nptr); - } - char *real_endptr; - // "man atoi" tells that behavior of atoi(nptr) is the same as - // strtol(nptr, 0, 10), i.e. it sets errno to ERANGE if the - // parsed integer can't be stored in *long* type (even if it's - // different from int). So, we just imitate this behavior. - int result = REAL(strtol)(nptr, &real_endptr, 10); - FixRealStrtolEndptr(nptr, &real_endptr); - ASAN_READ_STRING(ctx, nptr, (real_endptr - nptr) + 1); - return result; -} - -INTERCEPTOR(long, atol, const char *nptr) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, atol); -#if SANITIZER_MAC - if (UNLIKELY(!asan_inited)) return REAL(atol)(nptr); -#endif - ENSURE_ASAN_INITED(); - if (!flags()->replace_str) { - return REAL(atol)(nptr); - } - char *real_endptr; - long result = REAL(strtol)(nptr, &real_endptr, 10); - FixRealStrtolEndptr(nptr, &real_endptr); - ASAN_READ_STRING(ctx, nptr, (real_endptr - nptr) + 1); - return result; -} - -#if ASAN_INTERCEPT_ATOLL_AND_STRTOLL -INTERCEPTOR(long long, strtoll, const char *nptr, char **endptr, int base) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strtoll); - ENSURE_ASAN_INITED(); - if (!flags()->replace_str) { - return REAL(strtoll)(nptr, endptr, base); - } - char *real_endptr; - long long result = REAL(strtoll)(nptr, &real_endptr, base); - StrtolFixAndCheck(ctx, nptr, endptr, real_endptr, base); - return result; -} - -INTERCEPTOR(long long, atoll, const char *nptr) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, atoll); - ENSURE_ASAN_INITED(); - if (!flags()->replace_str) { - return REAL(atoll)(nptr); - } - char *real_endptr; - long long result = REAL(strtoll)(nptr, &real_endptr, 10); - FixRealStrtolEndptr(nptr, &real_endptr); - ASAN_READ_STRING(ctx, nptr, (real_endptr - nptr) + 1); - return result; -} -#endif // ASAN_INTERCEPT_ATOLL_AND_STRTOLL - -#if ASAN_INTERCEPT___CXA_ATEXIT || ASAN_INTERCEPT_ATEXIT -static void AtCxaAtexit(void *unused) { - (void)unused; - StopInitOrderChecking(); -} -#endif - -#if ASAN_INTERCEPT___CXA_ATEXIT -INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg, - void *dso_handle) { -#if SANITIZER_MAC - if (UNLIKELY(!asan_inited)) return REAL(__cxa_atexit)(func, arg, dso_handle); -#endif - ENSURE_ASAN_INITED(); -#if CAN_SANITIZE_LEAKS - __lsan::ScopedInterceptorDisabler disabler; -#endif - int res = REAL(__cxa_atexit)(func, arg, dso_handle); - REAL(__cxa_atexit)(AtCxaAtexit, nullptr, nullptr); - return res; -} -#endif // ASAN_INTERCEPT___CXA_ATEXIT - -#if ASAN_INTERCEPT_ATEXIT -INTERCEPTOR(int, atexit, void (*func)()) { - ENSURE_ASAN_INITED(); -#if CAN_SANITIZE_LEAKS - __lsan::ScopedInterceptorDisabler disabler; -#endif - // Avoid calling real atexit as it is unreachable on at least on Linux. - int res = REAL(__cxa_atexit)((void (*)(void *a))func, nullptr, nullptr); - REAL(__cxa_atexit)(AtCxaAtexit, nullptr, nullptr); - return res; -} -#endif - -#if ASAN_INTERCEPT_PTHREAD_ATFORK -extern "C" { -extern int _pthread_atfork(void (*prepare)(), void (*parent)(), - void (*child)()); -}; - -INTERCEPTOR(int, pthread_atfork, void (*prepare)(), void (*parent)(), - void (*child)()) { -#if CAN_SANITIZE_LEAKS - __lsan::ScopedInterceptorDisabler disabler; -#endif - // REAL(pthread_atfork) cannot be called due to symbol indirections at least - // on NetBSD - return _pthread_atfork(prepare, parent, child); -} -#endif - -#if ASAN_INTERCEPT_VFORK -DEFINE_REAL(int, vfork) -DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(int, vfork) -#endif - -// ---------------------- InitializeAsanInterceptors ---------------- {{{1 -namespace __asan { -void InitializeAsanInterceptors() { - static bool was_called_once; - CHECK(!was_called_once); - was_called_once = true; - InitializeCommonInterceptors(); - InitializeSignalInterceptors(); - - // Intercept str* functions. - ASAN_INTERCEPT_FUNC(strcat); - ASAN_INTERCEPT_FUNC(strcpy); - ASAN_INTERCEPT_FUNC(strncat); - ASAN_INTERCEPT_FUNC(strncpy); - ASAN_INTERCEPT_FUNC(strdup); -#if ASAN_INTERCEPT___STRDUP - ASAN_INTERCEPT_FUNC(__strdup); -#endif -#if ASAN_INTERCEPT_INDEX && ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX - ASAN_INTERCEPT_FUNC(index); -#endif - - ASAN_INTERCEPT_FUNC(atoi); - ASAN_INTERCEPT_FUNC(atol); - ASAN_INTERCEPT_FUNC(strtol); -#if ASAN_INTERCEPT_ATOLL_AND_STRTOLL - ASAN_INTERCEPT_FUNC(atoll); - ASAN_INTERCEPT_FUNC(strtoll); -#endif - - // Intecept jump-related functions. - ASAN_INTERCEPT_FUNC(longjmp); - -#if ASAN_INTERCEPT_SWAPCONTEXT - ASAN_INTERCEPT_FUNC(swapcontext); -#endif -#if ASAN_INTERCEPT__LONGJMP - ASAN_INTERCEPT_FUNC(_longjmp); -#endif -#if ASAN_INTERCEPT___LONGJMP_CHK - ASAN_INTERCEPT_FUNC(__longjmp_chk); -#endif -#if ASAN_INTERCEPT_SIGLONGJMP - ASAN_INTERCEPT_FUNC(siglongjmp); -#endif - - // Intercept exception handling functions. -#if ASAN_INTERCEPT___CXA_THROW - ASAN_INTERCEPT_FUNC(__cxa_throw); -#endif -#if ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION - ASAN_INTERCEPT_FUNC(__cxa_rethrow_primary_exception); -#endif - // Indirectly intercept std::rethrow_exception. -#if ASAN_INTERCEPT__UNWIND_RAISEEXCEPTION - INTERCEPT_FUNCTION(_Unwind_RaiseException); -#endif - // Indirectly intercept std::rethrow_exception. -#if ASAN_INTERCEPT__UNWIND_SJLJ_RAISEEXCEPTION - INTERCEPT_FUNCTION(_Unwind_SjLj_RaiseException); -#endif - - // Intercept threading-related functions -#if ASAN_INTERCEPT_PTHREAD_CREATE -// TODO: this should probably have an unversioned fallback for newer arches? -#if defined(ASAN_PTHREAD_CREATE_VERSION) - ASAN_INTERCEPT_FUNC_VER(pthread_create, ASAN_PTHREAD_CREATE_VERSION); -#else - ASAN_INTERCEPT_FUNC(pthread_create); -#endif - ASAN_INTERCEPT_FUNC(pthread_join); -#endif - - // Intercept atexit function. -#if ASAN_INTERCEPT___CXA_ATEXIT - ASAN_INTERCEPT_FUNC(__cxa_atexit); -#endif - -#if ASAN_INTERCEPT_ATEXIT - ASAN_INTERCEPT_FUNC(atexit); -#endif - -#if ASAN_INTERCEPT_PTHREAD_ATFORK - ASAN_INTERCEPT_FUNC(pthread_atfork); -#endif - -#if ASAN_INTERCEPT_VFORK - ASAN_INTERCEPT_FUNC(vfork); -#endif - - InitializePlatformInterceptors(); - - VReport(1, "AddressSanitizer: libc interceptors initialized\n"); -} - -} // namespace __asan - -#endif // !SANITIZER_FUCHSIA diff --git a/contrib/libs/clang14-rt/lib/asan/asan_interceptors.h b/contrib/libs/clang14-rt/lib/asan/asan_interceptors.h deleted file mode 100644 index 047b044c8bf4..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_interceptors.h +++ /dev/null @@ -1,163 +0,0 @@ -//===-- asan_interceptors.h -------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for asan_interceptors.cpp -//===----------------------------------------------------------------------===// -#ifndef ASAN_INTERCEPTORS_H -#define ASAN_INTERCEPTORS_H - -#include "asan_interceptors_memintrinsics.h" -#include "asan_internal.h" -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_platform.h" -#include "sanitizer_common/sanitizer_platform_interceptors.h" - -namespace __asan { - -void InitializeAsanInterceptors(); -void InitializePlatformInterceptors(); - -#define ENSURE_ASAN_INITED() \ - do { \ - CHECK(!asan_init_is_running); \ - if (UNLIKELY(!asan_inited)) { \ - AsanInitFromRtl(); \ - } \ - } while (0) - -} // namespace __asan - -// There is no general interception at all on Fuchsia. -// Only the functions in asan_interceptors_memintrinsics.h are -// really defined to replace libc functions. -#if !SANITIZER_FUCHSIA - -// Use macro to describe if specific function should be -// intercepted on a given platform. -#if !SANITIZER_WINDOWS -# define ASAN_INTERCEPT_ATOLL_AND_STRTOLL 1 -# define ASAN_INTERCEPT__LONGJMP 1 -# define ASAN_INTERCEPT_INDEX 1 -# define ASAN_INTERCEPT_PTHREAD_CREATE 1 -#else -# define ASAN_INTERCEPT_ATOLL_AND_STRTOLL 0 -# define ASAN_INTERCEPT__LONGJMP 0 -# define ASAN_INTERCEPT_INDEX 0 -# define ASAN_INTERCEPT_PTHREAD_CREATE 0 -#endif - -#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \ - SANITIZER_SOLARIS -# define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 1 -#else -# define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 0 -#endif - -#if SANITIZER_GLIBC || SANITIZER_SOLARIS -# define ASAN_INTERCEPT_SWAPCONTEXT 1 -#else -# define ASAN_INTERCEPT_SWAPCONTEXT 0 -#endif - -#if !SANITIZER_WINDOWS -# define ASAN_INTERCEPT_SIGLONGJMP 1 -#else -# define ASAN_INTERCEPT_SIGLONGJMP 0 -#endif - -#if SANITIZER_GLIBC -# define ASAN_INTERCEPT___LONGJMP_CHK 1 -#else -# define ASAN_INTERCEPT___LONGJMP_CHK 0 -#endif - -#if ASAN_HAS_EXCEPTIONS && !SANITIZER_WINDOWS && !SANITIZER_SOLARIS && \ - !SANITIZER_NETBSD -# define ASAN_INTERCEPT___CXA_THROW 1 -# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 1 -# if defined(_GLIBCXX_SJLJ_EXCEPTIONS) || (SANITIZER_IOS && defined(__arm__)) -# define ASAN_INTERCEPT__UNWIND_SJLJ_RAISEEXCEPTION 1 -# else -# define ASAN_INTERCEPT__UNWIND_RAISEEXCEPTION 1 -# endif -#else -# define ASAN_INTERCEPT___CXA_THROW 0 -# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 0 -# define ASAN_INTERCEPT__UNWIND_RAISEEXCEPTION 0 -# define ASAN_INTERCEPT__UNWIND_SJLJ_RAISEEXCEPTION 0 -#endif - -#if !SANITIZER_WINDOWS -# define ASAN_INTERCEPT___CXA_ATEXIT 1 -#else -# define ASAN_INTERCEPT___CXA_ATEXIT 0 -#endif - -#if SANITIZER_NETBSD -# define ASAN_INTERCEPT_ATEXIT 1 -#else -# define ASAN_INTERCEPT_ATEXIT 0 -#endif - -#if SANITIZER_GLIBC -# define ASAN_INTERCEPT___STRDUP 1 -#else -# define ASAN_INTERCEPT___STRDUP 0 -#endif - -#if SANITIZER_LINUX && \ - (defined(__arm__) || defined(__aarch64__) || defined(__i386__) || \ - defined(__x86_64__) || SANITIZER_RISCV64) -# define ASAN_INTERCEPT_VFORK 1 -#else -# define ASAN_INTERCEPT_VFORK 0 -#endif - -#if SANITIZER_NETBSD -# define ASAN_INTERCEPT_PTHREAD_ATFORK 1 -#else -# define ASAN_INTERCEPT_PTHREAD_ATFORK 0 -#endif - -DECLARE_REAL(int, memcmp, const void *a1, const void *a2, uptr size) -DECLARE_REAL(char*, strchr, const char *str, int c) -DECLARE_REAL(SIZE_T, strlen, const char *s) -DECLARE_REAL(char*, strncpy, char *to, const char *from, uptr size) -DECLARE_REAL(uptr, strnlen, const char *s, uptr maxlen) -DECLARE_REAL(char*, strstr, const char *s1, const char *s2) - -# if !SANITIZER_MAC -# define ASAN_INTERCEPT_FUNC(name) \ - do { \ - if (!INTERCEPT_FUNCTION(name)) \ - VReport(1, "AddressSanitizer: failed to intercept '%s'\n", #name); \ - } while (0) -# define ASAN_INTERCEPT_FUNC_VER(name, ver) \ - do { \ - if (!INTERCEPT_FUNCTION_VER(name, ver)) \ - VReport(1, "AddressSanitizer: failed to intercept '%s@@%s'\n", \ - #name, ver); \ - } while (0) -# define ASAN_INTERCEPT_FUNC_VER_UNVERSIONED_FALLBACK(name, ver) \ - do { \ - if (!INTERCEPT_FUNCTION_VER(name, ver) && !INTERCEPT_FUNCTION(name)) \ - VReport(1, \ - "AddressSanitizer: failed to intercept '%s@@%s' or '%s'\n", \ - #name, ver, #name); \ - } while (0) - -# else -// OS X interceptors don't need to be initialized with INTERCEPT_FUNCTION. -# define ASAN_INTERCEPT_FUNC(name) -# endif // SANITIZER_MAC - -#endif // !SANITIZER_FUCHSIA - -#endif // ASAN_INTERCEPTORS_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_interceptors_memintrinsics.cpp b/contrib/libs/clang14-rt/lib/asan/asan_interceptors_memintrinsics.cpp deleted file mode 100644 index 9c316bb95749..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_interceptors_memintrinsics.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===-- asan_interceptors_memintrinsics.cpp -------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===---------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan versions of memcpy, memmove, and memset. -//===---------------------------------------------------------------------===// - -#include "asan_interceptors_memintrinsics.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "asan_suppressions.h" - -using namespace __asan; - -void *__asan_memcpy(void *to, const void *from, uptr size) { - ASAN_MEMCPY_IMPL(nullptr, to, from, size); -} - -void *__asan_memset(void *block, int c, uptr size) { - ASAN_MEMSET_IMPL(nullptr, block, c, size); -} - -void *__asan_memmove(void *to, const void *from, uptr size) { - ASAN_MEMMOVE_IMPL(nullptr, to, from, size); -} - -#if SANITIZER_FUCHSIA - -// Fuchsia doesn't use sanitizer_common_interceptors.inc, but -// the only things there it wants are these three. Just define them -// as aliases here rather than repeating the contents. - -extern "C" decltype(__asan_memcpy) memcpy[[gnu::alias("__asan_memcpy")]]; -extern "C" decltype(__asan_memmove) memmove[[gnu::alias("__asan_memmove")]]; -extern "C" decltype(__asan_memset) memset[[gnu::alias("__asan_memset")]]; - -#endif // SANITIZER_FUCHSIA diff --git a/contrib/libs/clang14-rt/lib/asan/asan_interceptors_memintrinsics.h b/contrib/libs/clang14-rt/lib/asan/asan_interceptors_memintrinsics.h deleted file mode 100644 index 632f0515a9eb..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_interceptors_memintrinsics.h +++ /dev/null @@ -1,154 +0,0 @@ -//===-- asan_interceptors_memintrinsics.h -----------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===---------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for asan_interceptors_memintrinsics.cpp -//===---------------------------------------------------------------------===// -#ifndef ASAN_MEMINTRIN_H -#define ASAN_MEMINTRIN_H - -#include "asan_interface_internal.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "interception/interception.h" - -DECLARE_REAL(void*, memcpy, void *to, const void *from, uptr size) -DECLARE_REAL(void*, memset, void *block, int c, uptr size) - -namespace __asan { - -// Return true if we can quickly decide that the region is unpoisoned. -// We assume that a redzone is at least 16 bytes. -static inline bool QuickCheckForUnpoisonedRegion(uptr beg, uptr size) { - if (size == 0) return true; - if (size <= 32) - return !AddressIsPoisoned(beg) && - !AddressIsPoisoned(beg + size - 1) && - !AddressIsPoisoned(beg + size / 2); - if (size <= 64) - return !AddressIsPoisoned(beg) && - !AddressIsPoisoned(beg + size / 4) && - !AddressIsPoisoned(beg + size - 1) && - !AddressIsPoisoned(beg + 3 * size / 4) && - !AddressIsPoisoned(beg + size / 2); - return false; -} - -struct AsanInterceptorContext { - const char *interceptor_name; -}; - -// We implement ACCESS_MEMORY_RANGE, ASAN_READ_RANGE, -// and ASAN_WRITE_RANGE as macro instead of function so -// that no extra frames are created, and stack trace contains -// relevant information only. -// We check all shadow bytes. -#define ACCESS_MEMORY_RANGE(ctx, offset, size, isWrite) do { \ - uptr __offset = (uptr)(offset); \ - uptr __size = (uptr)(size); \ - uptr __bad = 0; \ - if (__offset > __offset + __size) { \ - GET_STACK_TRACE_FATAL_HERE; \ - ReportStringFunctionSizeOverflow(__offset, __size, &stack); \ - } \ - if (!QuickCheckForUnpoisonedRegion(__offset, __size) && \ - (__bad = __asan_region_is_poisoned(__offset, __size))) { \ - AsanInterceptorContext *_ctx = (AsanInterceptorContext *)ctx; \ - bool suppressed = false; \ - if (_ctx) { \ - suppressed = IsInterceptorSuppressed(_ctx->interceptor_name); \ - if (!suppressed && HaveStackTraceBasedSuppressions()) { \ - GET_STACK_TRACE_FATAL_HERE; \ - suppressed = IsStackTraceSuppressed(&stack); \ - } \ - } \ - if (!suppressed) { \ - GET_CURRENT_PC_BP_SP; \ - ReportGenericError(pc, bp, sp, __bad, isWrite, __size, 0, false);\ - } \ - } \ - } while (0) - -// memcpy is called during __asan_init() from the internals of printf(...). -// We do not treat memcpy with to==from as a bug. -// See http://llvm.org/bugs/show_bug.cgi?id=11763. -#define ASAN_MEMCPY_IMPL(ctx, to, from, size) \ - do { \ - if (UNLIKELY(!asan_inited)) return internal_memcpy(to, from, size); \ - if (asan_init_is_running) { \ - return REAL(memcpy)(to, from, size); \ - } \ - ENSURE_ASAN_INITED(); \ - if (flags()->replace_intrin) { \ - if (to != from) { \ - CHECK_RANGES_OVERLAP("memcpy", to, size, from, size); \ - } \ - ASAN_READ_RANGE(ctx, from, size); \ - ASAN_WRITE_RANGE(ctx, to, size); \ - } \ - return REAL(memcpy)(to, from, size); \ - } while (0) - -// memset is called inside Printf. -#define ASAN_MEMSET_IMPL(ctx, block, c, size) \ - do { \ - if (UNLIKELY(!asan_inited)) return internal_memset(block, c, size); \ - if (asan_init_is_running) { \ - return REAL(memset)(block, c, size); \ - } \ - ENSURE_ASAN_INITED(); \ - if (flags()->replace_intrin) { \ - ASAN_WRITE_RANGE(ctx, block, size); \ - } \ - return REAL(memset)(block, c, size); \ - } while (0) - -#define ASAN_MEMMOVE_IMPL(ctx, to, from, size) \ - do { \ - if (UNLIKELY(!asan_inited)) return internal_memmove(to, from, size); \ - ENSURE_ASAN_INITED(); \ - if (flags()->replace_intrin) { \ - ASAN_READ_RANGE(ctx, from, size); \ - ASAN_WRITE_RANGE(ctx, to, size); \ - } \ - return internal_memmove(to, from, size); \ - } while (0) - -#define ASAN_READ_RANGE(ctx, offset, size) \ - ACCESS_MEMORY_RANGE(ctx, offset, size, false) -#define ASAN_WRITE_RANGE(ctx, offset, size) \ - ACCESS_MEMORY_RANGE(ctx, offset, size, true) - -// Behavior of functions like "memcpy" or "strcpy" is undefined -// if memory intervals overlap. We report error in this case. -// Macro is used to avoid creation of new frames. -static inline bool RangesOverlap(const char *offset1, uptr length1, - const char *offset2, uptr length2) { - return !((offset1 + length1 <= offset2) || (offset2 + length2 <= offset1)); -} -#define CHECK_RANGES_OVERLAP(name, _offset1, length1, _offset2, length2) \ - do { \ - const char *offset1 = (const char *)_offset1; \ - const char *offset2 = (const char *)_offset2; \ - if (RangesOverlap(offset1, length1, offset2, length2)) { \ - GET_STACK_TRACE_FATAL_HERE; \ - bool suppressed = IsInterceptorSuppressed(name); \ - if (!suppressed && HaveStackTraceBasedSuppressions()) { \ - suppressed = IsStackTraceSuppressed(&stack); \ - } \ - if (!suppressed) { \ - ReportStringFunctionMemoryRangesOverlap(name, offset1, length1, \ - offset2, length2, &stack); \ - } \ - } \ - } while (0) - -} // namespace __asan - -#endif // ASAN_MEMINTRIN_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_interceptors_vfork.S b/contrib/libs/clang14-rt/lib/asan/asan_interceptors_vfork.S deleted file mode 100644 index 3ae5503e83cd..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_interceptors_vfork.S +++ /dev/null @@ -1,13 +0,0 @@ -#include "sanitizer_common/sanitizer_asm.h" - -#if defined(__linux__) -#define COMMON_INTERCEPTOR_SPILL_AREA __asan_extra_spill_area -#define COMMON_INTERCEPTOR_HANDLE_VFORK __asan_handle_vfork -#include "sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S" -#include "sanitizer_common/sanitizer_common_interceptors_vfork_arm.inc.S" -#include "sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S" -#include "sanitizer_common/sanitizer_common_interceptors_vfork_riscv64.inc.S" -#include "sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S" -#endif - -NO_EXEC_STACK_DIRECTIVE diff --git a/contrib/libs/clang14-rt/lib/asan/asan_interface_internal.h b/contrib/libs/clang14-rt/lib/asan/asan_interface_internal.h deleted file mode 100644 index 3e6e66028874..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_interface_internal.h +++ /dev/null @@ -1,259 +0,0 @@ -//===-- asan_interface_internal.h -------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// This header declares the AddressSanitizer runtime interface functions. -// The runtime library has to define these functions so the instrumented program -// could call them. -// -// See also include/sanitizer/asan_interface.h -//===----------------------------------------------------------------------===// -#ifndef ASAN_INTERFACE_INTERNAL_H -#define ASAN_INTERFACE_INTERNAL_H - -#include "sanitizer_common/sanitizer_internal_defs.h" - -#include "asan_init_version.h" - -using __sanitizer::uptr; -using __sanitizer::u64; -using __sanitizer::u32; - -extern "C" { - // This function should be called at the very beginning of the process, - // before any instrumented code is executed and before any call to malloc. - SANITIZER_INTERFACE_ATTRIBUTE void __asan_init(); - - // This function exists purely to get a linker/loader error when using - // incompatible versions of instrumentation and runtime library. Please note - // that __asan_version_mismatch_check is a macro that is replaced with - // __asan_version_mismatch_check_vXXX at compile-time. - SANITIZER_INTERFACE_ATTRIBUTE void __asan_version_mismatch_check(); - - // This structure is used to describe the source location of a place where - // global was defined. - struct __asan_global_source_location { - const char *filename; - int line_no; - int column_no; - }; - - // This structure describes an instrumented global variable. - struct __asan_global { - uptr beg; // The address of the global. - uptr size; // The original size of the global. - uptr size_with_redzone; // The size with the redzone. - const char *name; // Name as a C string. - const char *module_name; // Module name as a C string. This pointer is a - // unique identifier of a module. - uptr has_dynamic_init; // Non-zero if the global has dynamic initializer. - __asan_global_source_location *location; // Source location of a global, - // or NULL if it is unknown. - uptr odr_indicator; // The address of the ODR indicator symbol. - }; - - // These functions can be called on some platforms to find globals in the same - // loaded image as `flag' and apply __asan_(un)register_globals to them, - // filtering out redundant calls. - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_register_image_globals(uptr *flag); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_unregister_image_globals(uptr *flag); - - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_register_elf_globals(uptr *flag, void *start, void *stop); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_unregister_elf_globals(uptr *flag, void *start, void *stop); - - // These two functions should be called by the instrumented code. - // 'globals' is an array of structures describing 'n' globals. - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_register_globals(__asan_global *globals, uptr n); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_unregister_globals(__asan_global *globals, uptr n); - - // These two functions should be called before and after dynamic initializers - // of a single module run, respectively. - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_before_dynamic_init(const char *module_name); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_after_dynamic_init(); - - // Sets bytes of the given range of the shadow memory into specific value. - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_set_shadow_00(uptr addr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_set_shadow_f1(uptr addr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_set_shadow_f2(uptr addr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_set_shadow_f3(uptr addr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_set_shadow_f5(uptr addr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_set_shadow_f8(uptr addr, uptr size); - - // These two functions are used by instrumented code in the - // use-after-scope mode. They mark memory for local variables as - // unaddressable when they leave scope and addressable before the - // function exits. - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_poison_stack_memory(uptr addr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_unpoison_stack_memory(uptr addr, uptr size); - - // Performs cleanup before a NoReturn function. Must be called before things - // like _exit and execl to avoid false positives on stack. - SANITIZER_INTERFACE_ATTRIBUTE void __asan_handle_no_return(); - - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_poison_memory_region(void const volatile *addr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_unpoison_memory_region(void const volatile *addr, uptr size); - - SANITIZER_INTERFACE_ATTRIBUTE - int __asan_address_is_poisoned(void const volatile *addr); - - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_region_is_poisoned(uptr beg, uptr size); - - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_describe_address(uptr addr); - - SANITIZER_INTERFACE_ATTRIBUTE - int __asan_report_present(); - - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_get_report_pc(); - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_get_report_bp(); - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_get_report_sp(); - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_get_report_address(); - SANITIZER_INTERFACE_ATTRIBUTE - int __asan_get_report_access_type(); - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_get_report_access_size(); - SANITIZER_INTERFACE_ATTRIBUTE - const char * __asan_get_report_description(); - - SANITIZER_INTERFACE_ATTRIBUTE - const char * __asan_locate_address(uptr addr, char *name, uptr name_size, - uptr *region_address, uptr *region_size); - - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_get_alloc_stack(uptr addr, uptr *trace, uptr size, - u32 *thread_id); - - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_get_free_stack(uptr addr, uptr *trace, uptr size, - u32 *thread_id); - - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_get_shadow_mapping(uptr *shadow_scale, uptr *shadow_offset); - - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_report_error(uptr pc, uptr bp, uptr sp, - uptr addr, int is_write, uptr access_size, u32 exp); - - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_set_death_callback(void (*callback)(void)); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_set_error_report_callback(void (*callback)(const char*)); - - SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE - void __asan_on_error(); - - SANITIZER_INTERFACE_ATTRIBUTE void __asan_print_accumulated_stats(); - - SANITIZER_INTERFACE_ATTRIBUTE - const char *__asan_default_options(); - - SANITIZER_INTERFACE_ATTRIBUTE - extern uptr __asan_shadow_memory_dynamic_address; - - // Global flag, copy of ASAN_OPTIONS=detect_stack_use_after_return - SANITIZER_INTERFACE_ATTRIBUTE - extern int __asan_option_detect_stack_use_after_return; - - SANITIZER_INTERFACE_ATTRIBUTE - extern uptr *__asan_test_only_reported_buggy_pointer; - - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load1(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load2(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load4(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load8(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load16(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store1(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store2(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store4(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store8(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store16(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_loadN(uptr p, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_storeN(uptr p, uptr size); - - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load1_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load2_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load4_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load8_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_load16_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store1_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store2_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store4_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store8_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_store16_noabort(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_loadN_noabort(uptr p, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_storeN_noabort(uptr p, uptr size); - - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_load1(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_load2(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_load4(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_load8(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_load16(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_store1(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_store2(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_store4(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_store8(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_store16(uptr p, u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_loadN(uptr p, uptr size, - u32 exp); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_storeN(uptr p, uptr size, - u32 exp); - - SANITIZER_INTERFACE_ATTRIBUTE - void* __asan_memcpy(void *dst, const void *src, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void* __asan_memset(void *s, int c, uptr n); - SANITIZER_INTERFACE_ATTRIBUTE - void* __asan_memmove(void* dest, const void* src, uptr n); - - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_poison_cxx_array_cookie(uptr p); - SANITIZER_INTERFACE_ATTRIBUTE - uptr __asan_load_cxx_array_cookie(uptr *p); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_poison_intra_object_redzone(uptr p, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_unpoison_intra_object_redzone(uptr p, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_alloca_poison(uptr addr, uptr size); - SANITIZER_INTERFACE_ATTRIBUTE - void __asan_allocas_unpoison(uptr top, uptr bottom); - - SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE - const char* __asan_default_suppressions(); - - SANITIZER_INTERFACE_ATTRIBUTE void __asan_handle_vfork(void *sp); - - SANITIZER_INTERFACE_ATTRIBUTE int __asan_update_allocation_context( - void *addr); -} // extern "C" - -#endif // ASAN_INTERFACE_INTERNAL_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_internal.h b/contrib/libs/clang14-rt/lib/asan/asan_internal.h deleted file mode 100644 index ad3320304d0d..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_internal.h +++ /dev/null @@ -1,168 +0,0 @@ -//===-- asan_internal.h -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header which defines various general utilities. -//===----------------------------------------------------------------------===// -#ifndef ASAN_INTERNAL_H -#define ASAN_INTERNAL_H - -#include "asan_flags.h" -#include "asan_interface_internal.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "sanitizer_common/sanitizer_stacktrace.h" -#include "sanitizer_common/sanitizer_libc.h" - -#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) -# error "The AddressSanitizer run-time should not be" - " instrumented by AddressSanitizer" -#endif - -// Build-time configuration options. - -// If set, asan will intercept C++ exception api call(s). -#ifndef ASAN_HAS_EXCEPTIONS -# define ASAN_HAS_EXCEPTIONS 1 -#endif - -// If set, values like allocator chunk size, as well as defaults for some flags -// will be changed towards less memory overhead. -#ifndef ASAN_LOW_MEMORY -# if SANITIZER_IOS || SANITIZER_ANDROID -# define ASAN_LOW_MEMORY 1 -# else -# define ASAN_LOW_MEMORY 0 -# endif -#endif - -#ifndef ASAN_DYNAMIC -# ifdef PIC -# define ASAN_DYNAMIC 1 -# else -# define ASAN_DYNAMIC 0 -# endif -#endif - -// All internal functions in asan reside inside the __asan namespace -// to avoid namespace collisions with the user programs. -// Separate namespace also makes it simpler to distinguish the asan run-time -// functions from the instrumented user code in a profile. -namespace __asan { - -class AsanThread; -using __sanitizer::StackTrace; - -void AsanInitFromRtl(); - -// asan_win.cpp -void InitializePlatformExceptionHandlers(); -// Returns whether an address is a valid allocated system heap block. -// 'addr' must point to the beginning of the block. -bool IsSystemHeapAddress(uptr addr); - -// asan_rtl.cpp -void PrintAddressSpaceLayout(); -void NORETURN ShowStatsAndAbort(); - -// asan_shadow_setup.cpp -void InitializeShadowMemory(); - -// asan_malloc_linux.cpp / asan_malloc_mac.cpp -void ReplaceSystemMalloc(); - -// asan_linux.cpp / asan_mac.cpp / asan_win.cpp -uptr FindDynamicShadowStart(); -void *AsanDoesNotSupportStaticLinkage(); -void AsanCheckDynamicRTPrereqs(); -void AsanCheckIncompatibleRT(); - -// Unpoisons platform-specific stacks. -// Returns true if all stacks have been unpoisoned. -bool PlatformUnpoisonStacks(); - -// asan_rtl.cpp -// Unpoison a region containing a stack. -// Performs a sanity check and warns if the bounds don't look right. -// The warning contains the type string to identify the stack type. -void UnpoisonStack(uptr bottom, uptr top, const char *type); - -// asan_thread.cpp -AsanThread *CreateMainThread(); - -// Support function for __asan_(un)register_image_globals. Searches for the -// loaded image containing `needle' and then enumerates all global metadata -// structures declared in that image, applying `op' (e.g., -// __asan_(un)register_globals) to them. -typedef void (*globals_op_fptr)(__asan_global *, uptr); -void AsanApplyToGlobals(globals_op_fptr op, const void *needle); - -void AsanOnDeadlySignal(int, void *siginfo, void *context); - -void ReadContextStack(void *context, uptr *stack, uptr *ssize); -void StopInitOrderChecking(); - -// Wrapper for TLS/TSD. -void AsanTSDInit(void (*destructor)(void *tsd)); -void *AsanTSDGet(); -void AsanTSDSet(void *tsd); -void PlatformTSDDtor(void *tsd); - -void AppendToErrorMessageBuffer(const char *buffer); - -void *AsanDlSymNext(const char *sym); - -// Returns `true` iff most of ASan init process should be skipped due to the -// ASan library being loaded via `dlopen()`. Platforms may perform any -// `dlopen()` specific initialization inside this function. -bool HandleDlopenInit(); - -// Add convenient macro for interface functions that may be represented as -// weak hooks. -#define ASAN_MALLOC_HOOK(ptr, size) \ - do { \ - if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(ptr, size); \ - RunMallocHooks(ptr, size); \ - } while (false) -#define ASAN_FREE_HOOK(ptr) \ - do { \ - if (&__sanitizer_free_hook) __sanitizer_free_hook(ptr); \ - RunFreeHooks(ptr); \ - } while (false) -#define ASAN_ON_ERROR() \ - if (&__asan_on_error) __asan_on_error() - -extern int asan_inited; -// Used to avoid infinite recursion in __asan_init(). -extern bool asan_init_is_running; -extern void (*death_callback)(void); -// These magic values are written to shadow for better error reporting. -const int kAsanHeapLeftRedzoneMagic = 0xfa; -const int kAsanHeapFreeMagic = 0xfd; -const int kAsanStackLeftRedzoneMagic = 0xf1; -const int kAsanStackMidRedzoneMagic = 0xf2; -const int kAsanStackRightRedzoneMagic = 0xf3; -const int kAsanStackAfterReturnMagic = 0xf5; -const int kAsanInitializationOrderMagic = 0xf6; -const int kAsanUserPoisonedMemoryMagic = 0xf7; -const int kAsanContiguousContainerOOBMagic = 0xfc; -const int kAsanStackUseAfterScopeMagic = 0xf8; -const int kAsanGlobalRedzoneMagic = 0xf9; -const int kAsanInternalHeapMagic = 0xfe; -const int kAsanArrayCookieMagic = 0xac; -const int kAsanIntraObjectRedzone = 0xbb; -const int kAsanAllocaLeftMagic = 0xca; -const int kAsanAllocaRightMagic = 0xcb; - -static const uptr kCurrentStackFrameMagic = 0x41B58AB3; -static const uptr kRetiredStackFrameMagic = 0x45E0360E; - -} // namespace __asan - -#endif // ASAN_INTERNAL_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_linux.cpp b/contrib/libs/clang14-rt/lib/asan/asan_linux.cpp deleted file mode 100644 index 04741eeb6161..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_linux.cpp +++ /dev/null @@ -1,237 +0,0 @@ -//===-- asan_linux.cpp ----------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Linux-specific details. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \ - SANITIZER_SOLARIS - -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "asan_premap_shadow.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_freebsd.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_procmaps.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if SANITIZER_FREEBSD -#error #include -#endif - -#if SANITIZER_SOLARIS -#include -#endif - -#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS -#include -extern "C" void* _DYNAMIC; -#elif SANITIZER_NETBSD -#error #include -#include -extern Elf_Dyn _DYNAMIC; -#else -#include -#include -extern ElfW(Dyn) _DYNAMIC[]; -#endif - -// x86-64 FreeBSD 9.2 and older define 'ucontext_t' incorrectly in -// 32-bit mode. -#if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32) && \ - __FreeBSD_version <= 902001 // v9.2 -#define ucontext_t xucontext_t -#endif - -typedef enum { - ASAN_RT_VERSION_UNDEFINED = 0, - ASAN_RT_VERSION_DYNAMIC, - ASAN_RT_VERSION_STATIC, -} asan_rt_version_t; - -// FIXME: perhaps also store abi version here? -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -asan_rt_version_t __asan_rt_version; -} - -namespace __asan { - -void InitializePlatformInterceptors() {} -void InitializePlatformExceptionHandlers() {} -bool IsSystemHeapAddress (uptr addr) { return false; } - -void *AsanDoesNotSupportStaticLinkage() { - // This will fail to link with -static. - return &_DYNAMIC; -} - -#if ASAN_PREMAP_SHADOW -uptr FindPremappedShadowStart(uptr shadow_size_bytes) { - uptr granularity = GetMmapGranularity(); - uptr shadow_start = reinterpret_cast(&__asan_shadow); - uptr premap_shadow_size = PremapShadowSize(); - uptr shadow_size = RoundUpTo(shadow_size_bytes, granularity); - // We may have mapped too much. Release extra memory. - UnmapFromTo(shadow_start + shadow_size, shadow_start + premap_shadow_size); - return shadow_start; -} -#endif - -uptr FindDynamicShadowStart() { - uptr shadow_size_bytes = MemToShadowSize(kHighMemEnd); -#if ASAN_PREMAP_SHADOW - if (!PremapShadowFailed()) - return FindPremappedShadowStart(shadow_size_bytes); -#endif - - return MapDynamicShadow(shadow_size_bytes, ASAN_SHADOW_SCALE, - /*min_shadow_base_alignment*/ 0, kHighMemEnd); -} - -void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { - UNIMPLEMENTED(); -} - -void FlushUnneededASanShadowMemory(uptr p, uptr size) { - // Since asan's mapping is compacting, the shadow chunk may be - // not page-aligned, so we only flush the page-aligned portion. - ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size)); -} - -#if SANITIZER_ANDROID -// FIXME: should we do anything for Android? -void AsanCheckDynamicRTPrereqs() {} -void AsanCheckIncompatibleRT() {} -#else -static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size, - void *data) { - VReport(2, "info->dlpi_name = %s\tinfo->dlpi_addr = %p\n", info->dlpi_name, - (void *)info->dlpi_addr); - - const char **name = (const char **)data; - - // Ignore first entry (the main program) - if (!*name) { - *name = ""; - return 0; - } - -# if SANITIZER_LINUX - // Ignore vDSO. glibc versions earlier than 2.15 (and some patched - // by distributors) return an empty name for the vDSO entry, so - // detect this as well. - if (!info->dlpi_name[0] || - internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0) - return 0; -# endif - - *name = info->dlpi_name; - return 1; -} - -static bool IsDynamicRTName(const char *libname) { - return internal_strstr(libname, "libclang_rt.asan") || - internal_strstr(libname, "libasan.so"); -} - -static void ReportIncompatibleRT() { - Report("Your application is linked against incompatible ASan runtimes.\n"); - Die(); -} - -void AsanCheckDynamicRTPrereqs() { - if (!ASAN_DYNAMIC || !flags()->verify_asan_link_order) - return; - - // Ensure that dynamic RT is the first DSO in the list - const char *first_dso_name = nullptr; - dl_iterate_phdr(FindFirstDSOCallback, &first_dso_name); - if (first_dso_name && first_dso_name[0] && !IsDynamicRTName(first_dso_name)) { - Report("ASan runtime does not come first in initial library list; " - "you should either link runtime to your application or " - "manually preload it with LD_PRELOAD.\n"); - Die(); - } -} - -void AsanCheckIncompatibleRT() { - if (ASAN_DYNAMIC) { - if (__asan_rt_version == ASAN_RT_VERSION_UNDEFINED) { - __asan_rt_version = ASAN_RT_VERSION_DYNAMIC; - } else if (__asan_rt_version != ASAN_RT_VERSION_DYNAMIC) { - ReportIncompatibleRT(); - } - } else { - if (__asan_rt_version == ASAN_RT_VERSION_UNDEFINED) { - // Ensure that dynamic runtime is not present. We should detect it - // as early as possible, otherwise ASan interceptors could bind to - // the functions in dynamic ASan runtime instead of the functions in - // system libraries, causing crashes later in ASan initialization. - MemoryMappingLayout proc_maps(/*cache_enabled*/true); - char filename[PATH_MAX]; - MemoryMappedSegment segment(filename, sizeof(filename)); - while (proc_maps.Next(&segment)) { - if (IsDynamicRTName(segment.filename)) { - Report("Your application is linked against " - "incompatible ASan runtimes.\n"); - Die(); - } - } - __asan_rt_version = ASAN_RT_VERSION_STATIC; - } else if (__asan_rt_version != ASAN_RT_VERSION_STATIC) { - ReportIncompatibleRT(); - } - } -} -#endif // SANITIZER_ANDROID - -#if !SANITIZER_ANDROID -void ReadContextStack(void *context, uptr *stack, uptr *ssize) { - ucontext_t *ucp = (ucontext_t*)context; - *stack = (uptr)ucp->uc_stack.ss_sp; - *ssize = ucp->uc_stack.ss_size; -} -#else -void ReadContextStack(void *context, uptr *stack, uptr *ssize) { - UNIMPLEMENTED(); -} -#endif - -void *AsanDlSymNext(const char *sym) { - return dlsym(RTLD_NEXT, sym); -} - -bool HandleDlopenInit() { - // Not supported on this platform. - static_assert(!SANITIZER_SUPPORTS_INIT_FOR_DLOPEN, - "Expected SANITIZER_SUPPORTS_INIT_FOR_DLOPEN to be false"); - return false; -} - -} // namespace __asan - -#endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || - // SANITIZER_SOLARIS diff --git a/contrib/libs/clang14-rt/lib/asan/asan_mac.cpp b/contrib/libs/clang14-rt/lib/asan/asan_mac.cpp deleted file mode 100644 index 9161f728d44c..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_mac.cpp +++ /dev/null @@ -1,299 +0,0 @@ -//===-- asan_mac.cpp ------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Mac-specific details. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_MAC - -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "asan_stack.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_atomic.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_mac.h" - -#include -#include -#include -#include -#include -#include -#include -#include // for free() -#include -#include -#include -#include -#include - -// from , but we don't have that file on iOS -extern "C" { - extern char ***_NSGetArgv(void); - extern char ***_NSGetEnviron(void); -} - -namespace __asan { - -void InitializePlatformInterceptors() {} -void InitializePlatformExceptionHandlers() {} -bool IsSystemHeapAddress (uptr addr) { return false; } - -// No-op. Mac does not support static linkage anyway. -void *AsanDoesNotSupportStaticLinkage() { - return 0; -} - -uptr FindDynamicShadowStart() { - return MapDynamicShadow(MemToShadowSize(kHighMemEnd), ASAN_SHADOW_SCALE, - /*min_shadow_base_alignment*/ 0, kHighMemEnd); -} - -// No-op. Mac does not support static linkage anyway. -void AsanCheckDynamicRTPrereqs() {} - -// No-op. Mac does not support static linkage anyway. -void AsanCheckIncompatibleRT() {} - -void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { - // Find the Mach-O header for the image containing the needle - Dl_info info; - int err = dladdr(needle, &info); - if (err == 0) return; - -#if __LP64__ - const struct mach_header_64 *mh = (struct mach_header_64 *)info.dli_fbase; -#else - const struct mach_header *mh = (struct mach_header *)info.dli_fbase; -#endif - - // Look up the __asan_globals section in that image and register its globals - unsigned long size = 0; - __asan_global *globals = (__asan_global *)getsectiondata( - mh, - "__DATA", "__asan_globals", - &size); - - if (!globals) return; - if (size % sizeof(__asan_global) != 0) return; - op(globals, size / sizeof(__asan_global)); -} - -void FlushUnneededASanShadowMemory(uptr p, uptr size) { - // Since asan's mapping is compacting, the shadow chunk may be - // not page-aligned, so we only flush the page-aligned portion. - ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size)); -} - -void ReadContextStack(void *context, uptr *stack, uptr *ssize) { - UNIMPLEMENTED(); -} - -// Support for the following functions from libdispatch on Mac OS: -// dispatch_async_f() -// dispatch_async() -// dispatch_sync_f() -// dispatch_sync() -// dispatch_after_f() -// dispatch_after() -// dispatch_group_async_f() -// dispatch_group_async() -// TODO(glider): libdispatch API contains other functions that we don't support -// yet. -// -// dispatch_sync() and dispatch_sync_f() are synchronous, although chances are -// they can cause jobs to run on a thread different from the current one. -// TODO(glider): if so, we need a test for this (otherwise we should remove -// them). -// -// The following functions use dispatch_barrier_async_f() (which isn't a library -// function but is exported) and are thus supported: -// dispatch_source_set_cancel_handler_f() -// dispatch_source_set_cancel_handler() -// dispatch_source_set_event_handler_f() -// dispatch_source_set_event_handler() -// -// The reference manual for Grand Central Dispatch is available at -// http://developer.apple.com/library/mac/#documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html -// The implementation details are at -// http://libdispatch.macosforge.org/trac/browser/trunk/src/queue.c - -typedef void* dispatch_group_t; -typedef void* dispatch_queue_t; -typedef void* dispatch_source_t; -typedef u64 dispatch_time_t; -typedef void (*dispatch_function_t)(void *block); -typedef void* (*worker_t)(void *block); - -// A wrapper for the ObjC blocks used to support libdispatch. -typedef struct { - void *block; - dispatch_function_t func; - u32 parent_tid; -} asan_block_context_t; - -ALWAYS_INLINE -void asan_register_worker_thread(int parent_tid, StackTrace *stack) { - AsanThread *t = GetCurrentThread(); - if (!t) { - t = AsanThread::Create(/* start_routine */ nullptr, /* arg */ nullptr, - parent_tid, stack, /* detached */ true); - t->Init(); - asanThreadRegistry().StartThread(t->tid(), GetTid(), ThreadType::Worker, - nullptr); - SetCurrentThread(t); - } -} - -// For use by only those functions that allocated the context via -// alloc_asan_context(). -extern "C" -void asan_dispatch_call_block_and_release(void *block) { - GET_STACK_TRACE_THREAD; - asan_block_context_t *context = (asan_block_context_t*)block; - VReport(2, - "asan_dispatch_call_block_and_release(): " - "context: %p, pthread_self: %p\n", - block, pthread_self()); - asan_register_worker_thread(context->parent_tid, &stack); - // Call the original dispatcher for the block. - context->func(context->block); - asan_free(context, &stack, FROM_MALLOC); -} - -} // namespace __asan - -using namespace __asan; - -// Wrap |ctxt| and |func| into an asan_block_context_t. -// The caller retains control of the allocated context. -extern "C" -asan_block_context_t *alloc_asan_context(void *ctxt, dispatch_function_t func, - BufferedStackTrace *stack) { - asan_block_context_t *asan_ctxt = - (asan_block_context_t*) asan_malloc(sizeof(asan_block_context_t), stack); - asan_ctxt->block = ctxt; - asan_ctxt->func = func; - asan_ctxt->parent_tid = GetCurrentTidOrInvalid(); - return asan_ctxt; -} - -// Define interceptor for dispatch_*_f function with the three most common -// parameters: dispatch_queue_t, context, dispatch_function_t. -#define INTERCEPT_DISPATCH_X_F_3(dispatch_x_f) \ - INTERCEPTOR(void, dispatch_x_f, dispatch_queue_t dq, void *ctxt, \ - dispatch_function_t func) { \ - GET_STACK_TRACE_THREAD; \ - asan_block_context_t *asan_ctxt = alloc_asan_context(ctxt, func, &stack); \ - if (Verbosity() >= 2) { \ - Report(#dispatch_x_f "(): context: %p, pthread_self: %p\n", \ - asan_ctxt, pthread_self()); \ - PRINT_CURRENT_STACK(); \ - } \ - return REAL(dispatch_x_f)(dq, (void*)asan_ctxt, \ - asan_dispatch_call_block_and_release); \ - } - -INTERCEPT_DISPATCH_X_F_3(dispatch_async_f) -INTERCEPT_DISPATCH_X_F_3(dispatch_sync_f) -INTERCEPT_DISPATCH_X_F_3(dispatch_barrier_async_f) - -INTERCEPTOR(void, dispatch_after_f, dispatch_time_t when, - dispatch_queue_t dq, void *ctxt, - dispatch_function_t func) { - GET_STACK_TRACE_THREAD; - asan_block_context_t *asan_ctxt = alloc_asan_context(ctxt, func, &stack); - if (Verbosity() >= 2) { - Report("dispatch_after_f: %p\n", asan_ctxt); - PRINT_CURRENT_STACK(); - } - return REAL(dispatch_after_f)(when, dq, (void*)asan_ctxt, - asan_dispatch_call_block_and_release); -} - -INTERCEPTOR(void, dispatch_group_async_f, dispatch_group_t group, - dispatch_queue_t dq, void *ctxt, - dispatch_function_t func) { - GET_STACK_TRACE_THREAD; - asan_block_context_t *asan_ctxt = alloc_asan_context(ctxt, func, &stack); - if (Verbosity() >= 2) { - Report("dispatch_group_async_f(): context: %p, pthread_self: %p\n", - asan_ctxt, pthread_self()); - PRINT_CURRENT_STACK(); - } - REAL(dispatch_group_async_f)(group, dq, (void*)asan_ctxt, - asan_dispatch_call_block_and_release); -} - -#if !defined(MISSING_BLOCKS_SUPPORT) -extern "C" { -void dispatch_async(dispatch_queue_t dq, void(^work)(void)); -void dispatch_group_async(dispatch_group_t dg, dispatch_queue_t dq, - void(^work)(void)); -void dispatch_after(dispatch_time_t when, dispatch_queue_t queue, - void(^work)(void)); -void dispatch_source_set_cancel_handler(dispatch_source_t ds, - void(^work)(void)); -void dispatch_source_set_event_handler(dispatch_source_t ds, void(^work)(void)); -} - -#define GET_ASAN_BLOCK(work) \ - void (^asan_block)(void); \ - int parent_tid = GetCurrentTidOrInvalid(); \ - asan_block = ^(void) { \ - GET_STACK_TRACE_THREAD; \ - asan_register_worker_thread(parent_tid, &stack); \ - work(); \ - } - -INTERCEPTOR(void, dispatch_async, - dispatch_queue_t dq, void(^work)(void)) { - ENABLE_FRAME_POINTER; - GET_ASAN_BLOCK(work); - REAL(dispatch_async)(dq, asan_block); -} - -INTERCEPTOR(void, dispatch_group_async, - dispatch_group_t dg, dispatch_queue_t dq, void(^work)(void)) { - ENABLE_FRAME_POINTER; - GET_ASAN_BLOCK(work); - REAL(dispatch_group_async)(dg, dq, asan_block); -} - -INTERCEPTOR(void, dispatch_after, - dispatch_time_t when, dispatch_queue_t queue, void(^work)(void)) { - ENABLE_FRAME_POINTER; - GET_ASAN_BLOCK(work); - REAL(dispatch_after)(when, queue, asan_block); -} - -INTERCEPTOR(void, dispatch_source_set_cancel_handler, - dispatch_source_t ds, void(^work)(void)) { - if (!work) { - REAL(dispatch_source_set_cancel_handler)(ds, work); - return; - } - ENABLE_FRAME_POINTER; - GET_ASAN_BLOCK(work); - REAL(dispatch_source_set_cancel_handler)(ds, asan_block); -} - -INTERCEPTOR(void, dispatch_source_set_event_handler, - dispatch_source_t ds, void(^work)(void)) { - ENABLE_FRAME_POINTER; - GET_ASAN_BLOCK(work); - REAL(dispatch_source_set_event_handler)(ds, asan_block); -} -#endif - -#endif // SANITIZER_MAC diff --git a/contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp b/contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp deleted file mode 100644 index bab80b96f584..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp +++ /dev/null @@ -1,226 +0,0 @@ -//===-- asan_malloc_linux.cpp ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Linux-specific malloc interception. -// We simply define functions like malloc, free, realloc, etc. -// They will replace the corresponding libc functions automagically. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_FREEBSD || SANITIZER_FUCHSIA || SANITIZER_LINUX || \ - SANITIZER_NETBSD || SANITIZER_SOLARIS - -# include "asan_allocator.h" -# include "asan_interceptors.h" -# include "asan_internal.h" -# include "asan_stack.h" -# include "lsan/lsan_common.h" -# include "sanitizer_common/sanitizer_allocator_checks.h" -# include "sanitizer_common/sanitizer_allocator_dlsym.h" -# include "sanitizer_common/sanitizer_errno.h" -# include "sanitizer_common/sanitizer_tls_get_addr.h" - -// ---------------------- Replacement functions ---------------- {{{1 -using namespace __asan; - -struct DlsymAlloc : public DlSymAllocator { - static bool UseImpl() { return asan_init_is_running; } - static void OnAllocate(const void *ptr, uptr size) { -# if CAN_SANITIZE_LEAKS - // Suppress leaks from dlerror(). Previously dlsym hack on global array was - // used by leak sanitizer as a root region. - __lsan_register_root_region(ptr, size); -# endif - } - static void OnFree(const void *ptr, uptr size) { -# if CAN_SANITIZE_LEAKS - __lsan_unregister_root_region(ptr, size); -# endif - } -}; - -INTERCEPTOR(void, free, void *ptr) { - if (DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Free(ptr); - GET_STACK_TRACE_FREE; - asan_free(ptr, &stack, FROM_MALLOC); -} - -#if SANITIZER_INTERCEPT_CFREE -INTERCEPTOR(void, cfree, void *ptr) { - if (DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Free(ptr); - GET_STACK_TRACE_FREE; - asan_free(ptr, &stack, FROM_MALLOC); -} -#endif // SANITIZER_INTERCEPT_CFREE - -INTERCEPTOR(void*, malloc, uptr size) { - if (DlsymAlloc::Use()) - return DlsymAlloc::Allocate(size); - ENSURE_ASAN_INITED(); - GET_STACK_TRACE_MALLOC; - return asan_malloc(size, &stack); -} - -INTERCEPTOR(void*, calloc, uptr nmemb, uptr size) { - if (DlsymAlloc::Use()) - return DlsymAlloc::Callocate(nmemb, size); - ENSURE_ASAN_INITED(); - GET_STACK_TRACE_MALLOC; - return asan_calloc(nmemb, size, &stack); -} - -INTERCEPTOR(void*, realloc, void *ptr, uptr size) { - if (DlsymAlloc::Use() || DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Realloc(ptr, size); - ENSURE_ASAN_INITED(); - GET_STACK_TRACE_MALLOC; - return asan_realloc(ptr, size, &stack); -} - -#if SANITIZER_INTERCEPT_REALLOCARRAY -INTERCEPTOR(void*, reallocarray, void *ptr, uptr nmemb, uptr size) { - ENSURE_ASAN_INITED(); - GET_STACK_TRACE_MALLOC; - return asan_reallocarray(ptr, nmemb, size, &stack); -} -#endif // SANITIZER_INTERCEPT_REALLOCARRAY - -#if SANITIZER_INTERCEPT_MEMALIGN -INTERCEPTOR(void*, memalign, uptr boundary, uptr size) { - GET_STACK_TRACE_MALLOC; - return asan_memalign(boundary, size, &stack, FROM_MALLOC); -} - -INTERCEPTOR(void*, __libc_memalign, uptr boundary, uptr size) { - GET_STACK_TRACE_MALLOC; - void *res = asan_memalign(boundary, size, &stack, FROM_MALLOC); - DTLS_on_libc_memalign(res, size); - return res; -} -#endif // SANITIZER_INTERCEPT_MEMALIGN - -#if SANITIZER_INTERCEPT_ALIGNED_ALLOC -INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) { - GET_STACK_TRACE_MALLOC; - return asan_aligned_alloc(boundary, size, &stack); -} -#endif // SANITIZER_INTERCEPT_ALIGNED_ALLOC - -INTERCEPTOR(uptr, malloc_usable_size, void *ptr) { - GET_CURRENT_PC_BP_SP; - (void)sp; - return asan_malloc_usable_size(ptr, pc, bp); -} - -#if SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO -// We avoid including malloc.h for portability reasons. -// man mallinfo says the fields are "long", but the implementation uses int. -// It doesn't matter much -- we just need to make sure that the libc's mallinfo -// is not called. -struct fake_mallinfo { - int x[10]; -}; - -INTERCEPTOR(struct fake_mallinfo, mallinfo, void) { - struct fake_mallinfo res; - REAL(memset)(&res, 0, sizeof(res)); - return res; -} - -INTERCEPTOR(int, mallopt, int cmd, int value) { - return 0; -} -#endif // SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO - -INTERCEPTOR(int, posix_memalign, void **memptr, uptr alignment, uptr size) { - GET_STACK_TRACE_MALLOC; - return asan_posix_memalign(memptr, alignment, size, &stack); -} - -INTERCEPTOR(void*, valloc, uptr size) { - GET_STACK_TRACE_MALLOC; - return asan_valloc(size, &stack); -} - -#if SANITIZER_INTERCEPT_PVALLOC -INTERCEPTOR(void*, pvalloc, uptr size) { - GET_STACK_TRACE_MALLOC; - return asan_pvalloc(size, &stack); -} -#endif // SANITIZER_INTERCEPT_PVALLOC - -INTERCEPTOR(void, malloc_stats, void) { - __asan_print_accumulated_stats(); -} - -#if SANITIZER_ANDROID -// Format of __libc_malloc_dispatch has changed in Android L. -// While we are moving towards a solution that does not depend on bionic -// internals, here is something to support both K* and L releases. -struct MallocDebugK { - void *(*malloc)(uptr bytes); - void (*free)(void *mem); - void *(*calloc)(uptr n_elements, uptr elem_size); - void *(*realloc)(void *oldMem, uptr bytes); - void *(*memalign)(uptr alignment, uptr bytes); - uptr (*malloc_usable_size)(void *mem); -}; - -struct MallocDebugL { - void *(*calloc)(uptr n_elements, uptr elem_size); - void (*free)(void *mem); - fake_mallinfo (*mallinfo)(void); - void *(*malloc)(uptr bytes); - uptr (*malloc_usable_size)(void *mem); - void *(*memalign)(uptr alignment, uptr bytes); - int (*posix_memalign)(void **memptr, uptr alignment, uptr size); - void* (*pvalloc)(uptr size); - void *(*realloc)(void *oldMem, uptr bytes); - void* (*valloc)(uptr size); -}; - -ALIGNED(32) const MallocDebugK asan_malloc_dispatch_k = { - WRAP(malloc), WRAP(free), WRAP(calloc), - WRAP(realloc), WRAP(memalign), WRAP(malloc_usable_size)}; - -ALIGNED(32) const MallocDebugL asan_malloc_dispatch_l = { - WRAP(calloc), WRAP(free), WRAP(mallinfo), - WRAP(malloc), WRAP(malloc_usable_size), WRAP(memalign), - WRAP(posix_memalign), WRAP(pvalloc), WRAP(realloc), - WRAP(valloc)}; - -namespace __asan { -void ReplaceSystemMalloc() { - void **__libc_malloc_dispatch_p = - (void **)AsanDlSymNext("__libc_malloc_dispatch"); - if (__libc_malloc_dispatch_p) { - // Decide on K vs L dispatch format by the presence of - // __libc_malloc_default_dispatch export in libc. - void *default_dispatch_p = AsanDlSymNext("__libc_malloc_default_dispatch"); - if (default_dispatch_p) - *__libc_malloc_dispatch_p = (void *)&asan_malloc_dispatch_k; - else - *__libc_malloc_dispatch_p = (void *)&asan_malloc_dispatch_l; - } -} -} // namespace __asan - -#else // SANITIZER_ANDROID - -namespace __asan { -void ReplaceSystemMalloc() { -} -} // namespace __asan -#endif // SANITIZER_ANDROID - -#endif // SANITIZER_FREEBSD || SANITIZER_FUCHSIA || SANITIZER_LINUX || - // SANITIZER_NETBSD || SANITIZER_SOLARIS diff --git a/contrib/libs/clang14-rt/lib/asan/asan_malloc_mac.cpp b/contrib/libs/clang14-rt/lib/asan/asan_malloc_mac.cpp deleted file mode 100644 index e8484685daed..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_malloc_mac.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===-- asan_malloc_mac.cpp -----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Mac-specific malloc interception. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_MAC - -#include "asan_interceptors.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "asan_stats.h" -#include "lsan/lsan_common.h" - -using namespace __asan; -#define COMMON_MALLOC_ZONE_NAME "asan" -#define COMMON_MALLOC_ENTER() ENSURE_ASAN_INITED() -#define COMMON_MALLOC_SANITIZER_INITIALIZED asan_inited -#define COMMON_MALLOC_FORCE_LOCK() asan_mz_force_lock() -#define COMMON_MALLOC_FORCE_UNLOCK() asan_mz_force_unlock() -#define COMMON_MALLOC_MEMALIGN(alignment, size) \ - GET_STACK_TRACE_MALLOC; \ - void *p = asan_memalign(alignment, size, &stack, FROM_MALLOC) -#define COMMON_MALLOC_MALLOC(size) \ - GET_STACK_TRACE_MALLOC; \ - void *p = asan_malloc(size, &stack) -#define COMMON_MALLOC_REALLOC(ptr, size) \ - GET_STACK_TRACE_MALLOC; \ - void *p = asan_realloc(ptr, size, &stack); -#define COMMON_MALLOC_CALLOC(count, size) \ - GET_STACK_TRACE_MALLOC; \ - void *p = asan_calloc(count, size, &stack); -#define COMMON_MALLOC_POSIX_MEMALIGN(memptr, alignment, size) \ - GET_STACK_TRACE_MALLOC; \ - int res = asan_posix_memalign(memptr, alignment, size, &stack); -#define COMMON_MALLOC_VALLOC(size) \ - GET_STACK_TRACE_MALLOC; \ - void *p = asan_memalign(GetPageSizeCached(), size, &stack, FROM_MALLOC); -#define COMMON_MALLOC_FREE(ptr) \ - GET_STACK_TRACE_FREE; \ - asan_free(ptr, &stack, FROM_MALLOC); -#define COMMON_MALLOC_SIZE(ptr) \ - uptr size = asan_mz_size(ptr); -#define COMMON_MALLOC_FILL_STATS(zone, stats) \ - AsanMallocStats malloc_stats; \ - FillMallocStatistics(&malloc_stats); \ - CHECK(sizeof(malloc_statistics_t) == sizeof(AsanMallocStats)); \ - internal_memcpy(stats, &malloc_stats, sizeof(malloc_statistics_t)); -#define COMMON_MALLOC_REPORT_UNKNOWN_REALLOC(ptr, zone_ptr, zone_name) \ - GET_STACK_TRACE_FREE; \ - ReportMacMzReallocUnknown((uptr)ptr, (uptr)zone_ptr, zone_name, &stack); -#define COMMON_MALLOC_NAMESPACE __asan -#define COMMON_MALLOC_HAS_ZONE_ENUMERATOR 0 -#define COMMON_MALLOC_HAS_EXTRA_INTROSPECTION_INIT 1 - -#include "sanitizer_common/sanitizer_malloc_mac.inc" - -namespace COMMON_MALLOC_NAMESPACE { - -bool HandleDlopenInit() { - static_assert(SANITIZER_SUPPORTS_INIT_FOR_DLOPEN, - "Expected SANITIZER_SUPPORTS_INIT_FOR_DLOPEN to be true"); - // We have no reliable way of knowing how we are being loaded - // so make it a requirement on Apple platforms to set this environment - // variable to indicate that we want to perform initialization via - // dlopen(). - auto init_str = GetEnv("APPLE_ASAN_INIT_FOR_DLOPEN"); - if (!init_str) - return false; - if (internal_strncmp(init_str, "1", 1) != 0) - return false; - // When we are loaded via `dlopen()` path we still initialize the malloc zone - // so Symbolication clients (e.g. `leaks`) that load the ASan allocator can - // find an initialized malloc zone. - InitMallocZoneFields(); - return true; -} -} // namespace COMMON_MALLOC_NAMESPACE - -namespace { - -void mi_extra_init(sanitizer_malloc_introspection_t *mi) { - uptr last_byte_plus_one = 0; - mi->allocator_ptr = 0; - // Range is [begin_ptr, end_ptr) - __lsan::GetAllocatorGlobalRange(&(mi->allocator_ptr), &last_byte_plus_one); - CHECK_NE(mi->allocator_ptr, 0); - CHECK_GT(last_byte_plus_one, mi->allocator_ptr); - mi->allocator_size = last_byte_plus_one - (mi->allocator_ptr); - CHECK_GT(mi->allocator_size, 0); -} -} // namespace - -#endif diff --git a/contrib/libs/clang14-rt/lib/asan/asan_malloc_win.cpp b/contrib/libs/clang14-rt/lib/asan/asan_malloc_win.cpp deleted file mode 100644 index 4b76d4ebd3eb..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_malloc_win.cpp +++ /dev/null @@ -1,551 +0,0 @@ -//===-- asan_malloc_win.cpp -----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Windows-specific malloc interception. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_allocator_interface.h" -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_WINDOWS -#include "asan_allocator.h" -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "asan_stack.h" -#include "interception/interception.h" -#include - -// Intentionally not including windows.h here, to avoid the risk of -// pulling in conflicting declarations of these functions. (With mingw-w64, -// there's a risk of windows.h pulling in stdint.h.) -typedef int BOOL; -typedef void *HANDLE; -typedef const void *LPCVOID; -typedef void *LPVOID; - -typedef unsigned long DWORD; -constexpr unsigned long HEAP_ZERO_MEMORY = 0x00000008; -constexpr unsigned long HEAP_REALLOC_IN_PLACE_ONLY = 0x00000010; -constexpr unsigned long HEAP_ALLOCATE_SUPPORTED_FLAGS = (HEAP_ZERO_MEMORY); -constexpr unsigned long HEAP_ALLOCATE_UNSUPPORTED_FLAGS = - (~HEAP_ALLOCATE_SUPPORTED_FLAGS); -constexpr unsigned long HEAP_FREE_UNSUPPORTED_FLAGS = - (~HEAP_ALLOCATE_SUPPORTED_FLAGS); -constexpr unsigned long HEAP_REALLOC_UNSUPPORTED_FLAGS = - (~HEAP_ALLOCATE_SUPPORTED_FLAGS); - - -extern "C" { -LPVOID WINAPI HeapAlloc(HANDLE hHeap, DWORD dwFlags, size_t dwBytes); -LPVOID WINAPI HeapReAlloc(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, - size_t dwBytes); -BOOL WINAPI HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem); -size_t WINAPI HeapSize(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem); - -BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem); -} - -using namespace __asan; - -// MT: Simply defining functions with the same signature in *.obj -// files overrides the standard functions in the CRT. -// MD: Memory allocation functions are defined in the CRT .dll, -// so we have to intercept them before they are called for the first time. - -#if ASAN_DYNAMIC -# define ALLOCATION_FUNCTION_ATTRIBUTE -#else -# define ALLOCATION_FUNCTION_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE -#endif - -extern "C" { -ALLOCATION_FUNCTION_ATTRIBUTE -size_t _msize(void *ptr) { - GET_CURRENT_PC_BP_SP; - (void)sp; - return asan_malloc_usable_size(ptr, pc, bp); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -size_t _msize_base(void *ptr) { - return _msize(ptr); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void free(void *ptr) { - GET_STACK_TRACE_FREE; - return asan_free(ptr, &stack, FROM_MALLOC); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void _free_dbg(void *ptr, int) { - free(ptr); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void _free_base(void *ptr) { - free(ptr); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *malloc(size_t size) { - GET_STACK_TRACE_MALLOC; - return asan_malloc(size, &stack); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_malloc_base(size_t size) { - return malloc(size); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_malloc_dbg(size_t size, int, const char *, int) { - return malloc(size); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *calloc(size_t nmemb, size_t size) { - GET_STACK_TRACE_MALLOC; - return asan_calloc(nmemb, size, &stack); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_calloc_base(size_t nmemb, size_t size) { - return calloc(nmemb, size); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_calloc_dbg(size_t nmemb, size_t size, int, const char *, int) { - return calloc(nmemb, size); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_calloc_impl(size_t nmemb, size_t size, int *errno_tmp) { - return calloc(nmemb, size); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *realloc(void *ptr, size_t size) { - GET_STACK_TRACE_MALLOC; - return asan_realloc(ptr, size, &stack); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_realloc_dbg(void *ptr, size_t size, int) { - UNREACHABLE("_realloc_dbg should not exist!"); - return 0; -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_realloc_base(void *ptr, size_t size) { - return realloc(ptr, size); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_recalloc(void *p, size_t n, size_t elem_size) { - if (!p) - return calloc(n, elem_size); - const size_t size = n * elem_size; - if (elem_size != 0 && size / elem_size != n) - return 0; - - size_t old_size = _msize(p); - void *new_alloc = malloc(size); - if (new_alloc) { - REAL(memcpy)(new_alloc, p, Min(size, old_size)); - if (old_size < size) - REAL(memset)(((u8 *)new_alloc) + old_size, 0, size - old_size); - free(p); - } - return new_alloc; -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_recalloc_base(void *p, size_t n, size_t elem_size) { - return _recalloc(p, n, elem_size); -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_expand(void *memblock, size_t size) { - // _expand is used in realloc-like functions to resize the buffer if possible. - // We don't want memory to stand still while resizing buffers, so return 0. - return 0; -} - -ALLOCATION_FUNCTION_ATTRIBUTE -void *_expand_dbg(void *memblock, size_t size) { - return _expand(memblock, size); -} - -// TODO(timurrrr): Might want to add support for _aligned_* allocation -// functions to detect a bit more bugs. Those functions seem to wrap malloc(). - -int _CrtDbgReport(int, const char*, int, - const char*, const char*, ...) { - ShowStatsAndAbort(); -} - -int _CrtDbgReportW(int reportType, const wchar_t*, int, - const wchar_t*, const wchar_t*, ...) { - ShowStatsAndAbort(); -} - -int _CrtSetReportMode(int, int) { - return 0; -} -} // extern "C" - -#define OWNED_BY_RTL(heap, memory) \ - (!__sanitizer_get_ownership(memory) && HeapValidate(heap, 0, memory)) - -INTERCEPTOR_WINAPI(size_t, HeapSize, HANDLE hHeap, DWORD dwFlags, - LPCVOID lpMem) { - // If the RTL allocators are hooked we need to check whether the ASAN - // allocator owns the pointer we're about to use. Allocations occur before - // interception takes place, so if it is not owned by the RTL heap we can - // pass it to the ASAN heap for inspection. - if (flags()->windows_hook_rtl_allocators) { - if (!asan_inited || OWNED_BY_RTL(hHeap, lpMem)) - return REAL(HeapSize)(hHeap, dwFlags, lpMem); - } else { - CHECK(dwFlags == 0 && "unsupported heap flags"); - } - GET_CURRENT_PC_BP_SP; - (void)sp; - return asan_malloc_usable_size(lpMem, pc, bp); -} - -INTERCEPTOR_WINAPI(LPVOID, HeapAlloc, HANDLE hHeap, DWORD dwFlags, - size_t dwBytes) { - // If the ASAN runtime is not initialized, or we encounter an unsupported - // flag, fall back to the original allocator. - if (flags()->windows_hook_rtl_allocators) { - if (UNLIKELY(!asan_inited || - (dwFlags & HEAP_ALLOCATE_UNSUPPORTED_FLAGS) != 0)) { - return REAL(HeapAlloc)(hHeap, dwFlags, dwBytes); - } - } else { - // In the case that we don't hook the rtl allocators, - // this becomes an assert since there is no failover to the original - // allocator. - CHECK((HEAP_ALLOCATE_UNSUPPORTED_FLAGS & dwFlags) != 0 && - "unsupported flags"); - } - GET_STACK_TRACE_MALLOC; - void *p = asan_malloc(dwBytes, &stack); - // Reading MSDN suggests that the *entire* usable allocation is zeroed out. - // Otherwise it is difficult to HeapReAlloc with HEAP_ZERO_MEMORY. - // https://blogs.msdn.microsoft.com/oldnewthing/20120316-00/?p=8083 - if (p && (dwFlags & HEAP_ZERO_MEMORY)) { - GET_CURRENT_PC_BP_SP; - (void)sp; - auto usable_size = asan_malloc_usable_size(p, pc, bp); - internal_memset(p, 0, usable_size); - } - return p; -} - -INTERCEPTOR_WINAPI(BOOL, HeapFree, HANDLE hHeap, DWORD dwFlags, LPVOID lpMem) { - // Heap allocations happen before this function is hooked, so we must fall - // back to the original function if the pointer is not from the ASAN heap, - // or unsupported flags are provided. - if (flags()->windows_hook_rtl_allocators) { - if (OWNED_BY_RTL(hHeap, lpMem)) - return REAL(HeapFree)(hHeap, dwFlags, lpMem); - } else { - CHECK((HEAP_FREE_UNSUPPORTED_FLAGS & dwFlags) != 0 && "unsupported flags"); - } - GET_STACK_TRACE_FREE; - asan_free(lpMem, &stack, FROM_MALLOC); - return true; -} - -namespace __asan { -using AllocFunction = LPVOID(WINAPI *)(HANDLE, DWORD, size_t); -using ReAllocFunction = LPVOID(WINAPI *)(HANDLE, DWORD, LPVOID, size_t); -using SizeFunction = size_t(WINAPI *)(HANDLE, DWORD, LPVOID); -using FreeFunction = BOOL(WINAPI *)(HANDLE, DWORD, LPVOID); - -void *SharedReAlloc(ReAllocFunction reallocFunc, SizeFunction heapSizeFunc, - FreeFunction freeFunc, AllocFunction allocFunc, - HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, size_t dwBytes) { - CHECK(reallocFunc && heapSizeFunc && freeFunc && allocFunc); - GET_STACK_TRACE_MALLOC; - GET_CURRENT_PC_BP_SP; - (void)sp; - if (flags()->windows_hook_rtl_allocators) { - enum AllocationOwnership { NEITHER = 0, ASAN = 1, RTL = 2 }; - AllocationOwnership ownershipState; - bool owned_rtlalloc = false; - bool owned_asan = __sanitizer_get_ownership(lpMem); - - if (!owned_asan) - owned_rtlalloc = HeapValidate(hHeap, 0, lpMem); - - if (owned_asan && !owned_rtlalloc) - ownershipState = ASAN; - else if (!owned_asan && owned_rtlalloc) - ownershipState = RTL; - else if (!owned_asan && !owned_rtlalloc) - ownershipState = NEITHER; - - // If this heap block which was allocated before the ASAN - // runtime came up, use the real HeapFree function. - if (UNLIKELY(!asan_inited)) { - return reallocFunc(hHeap, dwFlags, lpMem, dwBytes); - } - bool only_asan_supported_flags = - (HEAP_REALLOC_UNSUPPORTED_FLAGS & dwFlags) == 0; - - if (ownershipState == RTL || - (ownershipState == NEITHER && !only_asan_supported_flags)) { - if (only_asan_supported_flags) { - // if this is a conversion to ASAN upported flags, transfer this - // allocation to the ASAN allocator - void *replacement_alloc; - if (dwFlags & HEAP_ZERO_MEMORY) - replacement_alloc = asan_calloc(1, dwBytes, &stack); - else - replacement_alloc = asan_malloc(dwBytes, &stack); - if (replacement_alloc) { - size_t old_size = heapSizeFunc(hHeap, dwFlags, lpMem); - if (old_size == ((size_t)0) - 1) { - asan_free(replacement_alloc, &stack, FROM_MALLOC); - return nullptr; - } - REAL(memcpy)(replacement_alloc, lpMem, old_size); - freeFunc(hHeap, dwFlags, lpMem); - } - return replacement_alloc; - } else { - // owned by rtl or neither with unsupported ASAN flags, - // just pass back to original allocator - CHECK(ownershipState == RTL || ownershipState == NEITHER); - CHECK(!only_asan_supported_flags); - return reallocFunc(hHeap, dwFlags, lpMem, dwBytes); - } - } - - if (ownershipState == ASAN && !only_asan_supported_flags) { - // Conversion to unsupported flags allocation, - // transfer this allocation back to the original allocator. - void *replacement_alloc = allocFunc(hHeap, dwFlags, dwBytes); - size_t old_usable_size = 0; - if (replacement_alloc) { - old_usable_size = asan_malloc_usable_size(lpMem, pc, bp); - REAL(memcpy)(replacement_alloc, lpMem, - Min(dwBytes, old_usable_size)); - asan_free(lpMem, &stack, FROM_MALLOC); - } - return replacement_alloc; - } - - CHECK((ownershipState == ASAN || ownershipState == NEITHER) && - only_asan_supported_flags); - // At this point we should either be ASAN owned with ASAN supported flags - // or we owned by neither and have supported flags. - // Pass through even when it's neither since this could be a null realloc or - // UAF that ASAN needs to catch. - } else { - CHECK((HEAP_REALLOC_UNSUPPORTED_FLAGS & dwFlags) != 0 && - "unsupported flags"); - } - // asan_realloc will never reallocate in place, so for now this flag is - // unsupported until we figure out a way to fake this. - if (dwFlags & HEAP_REALLOC_IN_PLACE_ONLY) - return nullptr; - - // HeapReAlloc and HeapAlloc both happily accept 0 sized allocations. - // passing a 0 size into asan_realloc will free the allocation. - // To avoid this and keep behavior consistent, fudge the size if 0. - // (asan_malloc already does this) - if (dwBytes == 0) - dwBytes = 1; - - size_t old_size; - if (dwFlags & HEAP_ZERO_MEMORY) - old_size = asan_malloc_usable_size(lpMem, pc, bp); - - void *ptr = asan_realloc(lpMem, dwBytes, &stack); - if (ptr == nullptr) - return nullptr; - - if (dwFlags & HEAP_ZERO_MEMORY) { - size_t new_size = asan_malloc_usable_size(ptr, pc, bp); - if (old_size < new_size) - REAL(memset)(((u8 *)ptr) + old_size, 0, new_size - old_size); - } - - return ptr; -} -} // namespace __asan - -INTERCEPTOR_WINAPI(LPVOID, HeapReAlloc, HANDLE hHeap, DWORD dwFlags, - LPVOID lpMem, size_t dwBytes) { - return SharedReAlloc(REAL(HeapReAlloc), (SizeFunction)REAL(HeapSize), - REAL(HeapFree), REAL(HeapAlloc), hHeap, dwFlags, lpMem, - dwBytes); -} - -// The following functions are undocumented and subject to change. -// However, hooking them is necessary to hook Windows heap -// allocations with detours and their definitions are unlikely to change. -// Comments in /minkernel/ntos/rtl/heappublic.c indicate that these functions -// are part of the heap's public interface. -typedef unsigned long LOGICAL; - -// This function is documented as part of the Driver Development Kit but *not* -// the Windows Development Kit. -LOGICAL RtlFreeHeap(void* HeapHandle, DWORD Flags, - void* BaseAddress); - -// This function is documented as part of the Driver Development Kit but *not* -// the Windows Development Kit. -void* RtlAllocateHeap(void* HeapHandle, DWORD Flags, size_t Size); - -// This function is completely undocumented. -void* -RtlReAllocateHeap(void* HeapHandle, DWORD Flags, void* BaseAddress, - size_t Size); - -// This function is completely undocumented. -size_t RtlSizeHeap(void* HeapHandle, DWORD Flags, void* BaseAddress); - -INTERCEPTOR_WINAPI(size_t, RtlSizeHeap, HANDLE HeapHandle, DWORD Flags, - void* BaseAddress) { - if (!flags()->windows_hook_rtl_allocators || - UNLIKELY(!asan_inited || OWNED_BY_RTL(HeapHandle, BaseAddress))) { - return REAL(RtlSizeHeap)(HeapHandle, Flags, BaseAddress); - } - GET_CURRENT_PC_BP_SP; - (void)sp; - return asan_malloc_usable_size(BaseAddress, pc, bp); -} - -INTERCEPTOR_WINAPI(BOOL, RtlFreeHeap, HANDLE HeapHandle, DWORD Flags, - void* BaseAddress) { - // Heap allocations happen before this function is hooked, so we must fall - // back to the original function if the pointer is not from the ASAN heap, or - // unsupported flags are provided. - if (!flags()->windows_hook_rtl_allocators || - UNLIKELY((HEAP_FREE_UNSUPPORTED_FLAGS & Flags) != 0 || - OWNED_BY_RTL(HeapHandle, BaseAddress))) { - return REAL(RtlFreeHeap)(HeapHandle, Flags, BaseAddress); - } - GET_STACK_TRACE_FREE; - asan_free(BaseAddress, &stack, FROM_MALLOC); - return true; -} - -INTERCEPTOR_WINAPI(void*, RtlAllocateHeap, HANDLE HeapHandle, DWORD Flags, - size_t Size) { - // If the ASAN runtime is not initialized, or we encounter an unsupported - // flag, fall back to the original allocator. - if (!flags()->windows_hook_rtl_allocators || - UNLIKELY(!asan_inited || - (Flags & HEAP_ALLOCATE_UNSUPPORTED_FLAGS) != 0)) { - return REAL(RtlAllocateHeap)(HeapHandle, Flags, Size); - } - GET_STACK_TRACE_MALLOC; - void *p; - // Reading MSDN suggests that the *entire* usable allocation is zeroed out. - // Otherwise it is difficult to HeapReAlloc with HEAP_ZERO_MEMORY. - // https://blogs.msdn.microsoft.com/oldnewthing/20120316-00/?p=8083 - if (Flags & HEAP_ZERO_MEMORY) { - p = asan_calloc(Size, 1, &stack); - } else { - p = asan_malloc(Size, &stack); - } - return p; -} - -INTERCEPTOR_WINAPI(void*, RtlReAllocateHeap, HANDLE HeapHandle, DWORD Flags, - void* BaseAddress, size_t Size) { - // If it's actually a heap block which was allocated before the ASAN runtime - // came up, use the real RtlFreeHeap function. - if (!flags()->windows_hook_rtl_allocators) - return REAL(RtlReAllocateHeap)(HeapHandle, Flags, BaseAddress, Size); - - return SharedReAlloc(REAL(RtlReAllocateHeap), REAL(RtlSizeHeap), - REAL(RtlFreeHeap), REAL(RtlAllocateHeap), HeapHandle, - Flags, BaseAddress, Size); -} - -namespace __asan { - -static void TryToOverrideFunction(const char *fname, uptr new_func) { - // Failure here is not fatal. The CRT may not be present, and different CRT - // versions use different symbols. - if (!__interception::OverrideFunction(fname, new_func)) - VPrintf(2, "Failed to override function %s\n", fname); -} - -void ReplaceSystemMalloc() { -#if defined(ASAN_DYNAMIC) - TryToOverrideFunction("free", (uptr)free); - TryToOverrideFunction("_free_base", (uptr)free); - TryToOverrideFunction("malloc", (uptr)malloc); - TryToOverrideFunction("_malloc_base", (uptr)malloc); - TryToOverrideFunction("_malloc_crt", (uptr)malloc); - TryToOverrideFunction("calloc", (uptr)calloc); - TryToOverrideFunction("_calloc_base", (uptr)calloc); - TryToOverrideFunction("_calloc_crt", (uptr)calloc); - TryToOverrideFunction("realloc", (uptr)realloc); - TryToOverrideFunction("_realloc_base", (uptr)realloc); - TryToOverrideFunction("_realloc_crt", (uptr)realloc); - TryToOverrideFunction("_recalloc", (uptr)_recalloc); - TryToOverrideFunction("_recalloc_base", (uptr)_recalloc); - TryToOverrideFunction("_recalloc_crt", (uptr)_recalloc); - TryToOverrideFunction("_msize", (uptr)_msize); - TryToOverrideFunction("_msize_base", (uptr)_msize); - TryToOverrideFunction("_expand", (uptr)_expand); - TryToOverrideFunction("_expand_base", (uptr)_expand); - - if (flags()->windows_hook_rtl_allocators) { - INTERCEPT_FUNCTION(HeapSize); - INTERCEPT_FUNCTION(HeapFree); - INTERCEPT_FUNCTION(HeapReAlloc); - INTERCEPT_FUNCTION(HeapAlloc); - - // Undocumented functions must be intercepted by name, not by symbol. - __interception::OverrideFunction("RtlSizeHeap", (uptr)WRAP(RtlSizeHeap), - (uptr *)&REAL(RtlSizeHeap)); - __interception::OverrideFunction("RtlFreeHeap", (uptr)WRAP(RtlFreeHeap), - (uptr *)&REAL(RtlFreeHeap)); - __interception::OverrideFunction("RtlReAllocateHeap", - (uptr)WRAP(RtlReAllocateHeap), - (uptr *)&REAL(RtlReAllocateHeap)); - __interception::OverrideFunction("RtlAllocateHeap", - (uptr)WRAP(RtlAllocateHeap), - (uptr *)&REAL(RtlAllocateHeap)); - } else { -#define INTERCEPT_UCRT_FUNCTION(func) \ - if (!INTERCEPT_FUNCTION_DLLIMPORT( \ - "ucrtbase.dll", "api-ms-win-core-heap-l1-1-0.dll", func)) { \ - VPrintf(2, "Failed to intercept ucrtbase.dll import %s\n", #func); \ - } - INTERCEPT_UCRT_FUNCTION(HeapAlloc); - INTERCEPT_UCRT_FUNCTION(HeapFree); - INTERCEPT_UCRT_FUNCTION(HeapReAlloc); - INTERCEPT_UCRT_FUNCTION(HeapSize); -#undef INTERCEPT_UCRT_FUNCTION - } - // Recent versions of ucrtbase.dll appear to be built with PGO and LTCG, which - // enable cross-module inlining. This means our _malloc_base hook won't catch - // all CRT allocations. This code here patches the import table of - // ucrtbase.dll so that all attempts to use the lower-level win32 heap - // allocation API will be directed to ASan's heap. We don't currently - // intercept all calls to HeapAlloc. If we did, we would have to check on - // HeapFree whether the pointer came from ASan of from the system. - -#endif // defined(ASAN_DYNAMIC) -} -} // namespace __asan - -#endif // _WIN32 diff --git a/contrib/libs/clang14-rt/lib/asan/asan_mapping.h b/contrib/libs/clang14-rt/lib/asan/asan_mapping.h deleted file mode 100644 index 4ff09b103d5f..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_mapping.h +++ /dev/null @@ -1,393 +0,0 @@ -//===-- asan_mapping.h ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Defines ASan memory mapping. -//===----------------------------------------------------------------------===// -#ifndef ASAN_MAPPING_H -#define ASAN_MAPPING_H - -#include "sanitizer_common/sanitizer_platform.h" - -// The full explanation of the memory mapping could be found here: -// https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm -// -// Typical shadow mapping on Linux/x86_64 with SHADOW_OFFSET == 0x00007fff8000: -// || `[0x10007fff8000, 0x7fffffffffff]` || HighMem || -// || `[0x02008fff7000, 0x10007fff7fff]` || HighShadow || -// || `[0x00008fff7000, 0x02008fff6fff]` || ShadowGap || -// || `[0x00007fff8000, 0x00008fff6fff]` || LowShadow || -// || `[0x000000000000, 0x00007fff7fff]` || LowMem || -// -// When SHADOW_OFFSET is zero (-pie): -// || `[0x100000000000, 0x7fffffffffff]` || HighMem || -// || `[0x020000000000, 0x0fffffffffff]` || HighShadow || -// || `[0x000000040000, 0x01ffffffffff]` || ShadowGap || -// -// Special case when something is already mapped between -// 0x003000000000 and 0x005000000000 (e.g. when prelink is installed): -// || `[0x10007fff8000, 0x7fffffffffff]` || HighMem || -// || `[0x02008fff7000, 0x10007fff7fff]` || HighShadow || -// || `[0x005000000000, 0x02008fff6fff]` || ShadowGap3 || -// || `[0x003000000000, 0x004fffffffff]` || MidMem || -// || `[0x000a7fff8000, 0x002fffffffff]` || ShadowGap2 || -// || `[0x00067fff8000, 0x000a7fff7fff]` || MidShadow || -// || `[0x00008fff7000, 0x00067fff7fff]` || ShadowGap || -// || `[0x00007fff8000, 0x00008fff6fff]` || LowShadow || -// || `[0x000000000000, 0x00007fff7fff]` || LowMem || -// -// Default Linux/i386 mapping on x86_64 machine: -// || `[0x40000000, 0xffffffff]` || HighMem || -// || `[0x28000000, 0x3fffffff]` || HighShadow || -// || `[0x24000000, 0x27ffffff]` || ShadowGap || -// || `[0x20000000, 0x23ffffff]` || LowShadow || -// || `[0x00000000, 0x1fffffff]` || LowMem || -// -// Default Linux/i386 mapping on i386 machine -// (addresses starting with 0xc0000000 are reserved -// for kernel and thus not sanitized): -// || `[0x38000000, 0xbfffffff]` || HighMem || -// || `[0x27000000, 0x37ffffff]` || HighShadow || -// || `[0x24000000, 0x26ffffff]` || ShadowGap || -// || `[0x20000000, 0x23ffffff]` || LowShadow || -// || `[0x00000000, 0x1fffffff]` || LowMem || -// -// Default Linux/MIPS32 mapping: -// || `[0x2aaa0000, 0xffffffff]` || HighMem || -// || `[0x0fff4000, 0x2aa9ffff]` || HighShadow || -// || `[0x0bff4000, 0x0fff3fff]` || ShadowGap || -// || `[0x0aaa0000, 0x0bff3fff]` || LowShadow || -// || `[0x00000000, 0x0aa9ffff]` || LowMem || -// -// Default Linux/MIPS64 mapping: -// || `[0x4000000000, 0xffffffffff]` || HighMem || -// || `[0x2800000000, 0x3fffffffff]` || HighShadow || -// || `[0x2400000000, 0x27ffffffff]` || ShadowGap || -// || `[0x2000000000, 0x23ffffffff]` || LowShadow || -// || `[0x0000000000, 0x1fffffffff]` || LowMem || -// -// Default Linux/RISCV64 Sv39 mapping: -// || `[0x1555550000, 0x3fffffffff]` || HighMem || -// || `[0x0fffffa000, 0x1555555fff]` || HighShadow || -// || `[0x0effffa000, 0x0fffff9fff]` || ShadowGap || -// || `[0x0d55550000, 0x0effff9fff]` || LowShadow || -// || `[0x0000000000, 0x0d5554ffff]` || LowMem || -// -// Default Linux/AArch64 (39-bit VMA) mapping: -// || `[0x2000000000, 0x7fffffffff]` || highmem || -// || `[0x1400000000, 0x1fffffffff]` || highshadow || -// || `[0x1200000000, 0x13ffffffff]` || shadowgap || -// || `[0x1000000000, 0x11ffffffff]` || lowshadow || -// || `[0x0000000000, 0x0fffffffff]` || lowmem || -// -// Default Linux/AArch64 (42-bit VMA) mapping: -// || `[0x10000000000, 0x3ffffffffff]` || highmem || -// || `[0x0a000000000, 0x0ffffffffff]` || highshadow || -// || `[0x09000000000, 0x09fffffffff]` || shadowgap || -// || `[0x08000000000, 0x08fffffffff]` || lowshadow || -// || `[0x00000000000, 0x07fffffffff]` || lowmem || -// -// Default Linux/S390 mapping: -// || `[0x30000000, 0x7fffffff]` || HighMem || -// || `[0x26000000, 0x2fffffff]` || HighShadow || -// || `[0x24000000, 0x25ffffff]` || ShadowGap || -// || `[0x20000000, 0x23ffffff]` || LowShadow || -// || `[0x00000000, 0x1fffffff]` || LowMem || -// -// Default Linux/SystemZ mapping: -// || `[0x14000000000000, 0x1fffffffffffff]` || HighMem || -// || `[0x12800000000000, 0x13ffffffffffff]` || HighShadow || -// || `[0x12000000000000, 0x127fffffffffff]` || ShadowGap || -// || `[0x10000000000000, 0x11ffffffffffff]` || LowShadow || -// || `[0x00000000000000, 0x0fffffffffffff]` || LowMem || -// -// Default Linux/SPARC64 (52-bit VMA) mapping: -// || `[0x8000000000000, 0xfffffffffffff]` || HighMem || -// || `[0x1080000000000, 0x207ffffffffff]` || HighShadow || -// || `[0x0090000000000, 0x107ffffffffff]` || ShadowGap || -// || `[0x0080000000000, 0x008ffffffffff]` || LowShadow || -// || `[0x0000000000000, 0x007ffffffffff]` || LowMem || -// -// Shadow mapping on FreeBSD/x86-64 with SHADOW_OFFSET == 0x400000000000: -// || `[0x500000000000, 0x7fffffffffff]` || HighMem || -// || `[0x4a0000000000, 0x4fffffffffff]` || HighShadow || -// || `[0x480000000000, 0x49ffffffffff]` || ShadowGap || -// || `[0x400000000000, 0x47ffffffffff]` || LowShadow || -// || `[0x000000000000, 0x3fffffffffff]` || LowMem || -// -// Shadow mapping on FreeBSD/i386 with SHADOW_OFFSET == 0x40000000: -// || `[0x60000000, 0xffffffff]` || HighMem || -// || `[0x4c000000, 0x5fffffff]` || HighShadow || -// || `[0x48000000, 0x4bffffff]` || ShadowGap || -// || `[0x40000000, 0x47ffffff]` || LowShadow || -// || `[0x00000000, 0x3fffffff]` || LowMem || -// -// Shadow mapping on NetBSD/x86-64 with SHADOW_OFFSET == 0x400000000000: -// || `[0x4feffffffe01, 0x7f7ffffff000]` || HighMem || -// || `[0x49fdffffffc0, 0x4feffffffe00]` || HighShadow || -// || `[0x480000000000, 0x49fdffffffbf]` || ShadowGap || -// || `[0x400000000000, 0x47ffffffffff]` || LowShadow || -// || `[0x000000000000, 0x3fffffffffff]` || LowMem || -// -// Shadow mapping on NetBSD/i386 with SHADOW_OFFSET == 0x40000000: -// || `[0x60000000, 0xfffff000]` || HighMem || -// || `[0x4c000000, 0x5fffffff]` || HighShadow || -// || `[0x48000000, 0x4bffffff]` || ShadowGap || -// || `[0x40000000, 0x47ffffff]` || LowShadow || -// || `[0x00000000, 0x3fffffff]` || LowMem || -// -// Default Windows/i386 mapping: -// (the exact location of HighShadow/HighMem may vary depending -// on WoW64, /LARGEADDRESSAWARE, etc). -// || `[0x50000000, 0xffffffff]` || HighMem || -// || `[0x3a000000, 0x4fffffff]` || HighShadow || -// || `[0x36000000, 0x39ffffff]` || ShadowGap || -// || `[0x30000000, 0x35ffffff]` || LowShadow || -// || `[0x00000000, 0x2fffffff]` || LowMem || - -#define ASAN_SHADOW_SCALE 3 - -#if SANITIZER_FUCHSIA -# define ASAN_SHADOW_OFFSET_CONST (0) -#elif SANITIZER_WORDSIZE == 32 -# if SANITIZER_ANDROID -# define ASAN_SHADOW_OFFSET_DYNAMIC -# elif defined(__mips__) -# define ASAN_SHADOW_OFFSET_CONST 0x0aaa0000 -# elif SANITIZER_FREEBSD -# define ASAN_SHADOW_OFFSET_CONST 0x40000000 -# elif SANITIZER_NETBSD -# define ASAN_SHADOW_OFFSET_CONST 0x40000000 -# elif SANITIZER_WINDOWS -# define ASAN_SHADOW_OFFSET_CONST 0x30000000 -# elif SANITIZER_IOS -# define ASAN_SHADOW_OFFSET_DYNAMIC -# else -# define ASAN_SHADOW_OFFSET_CONST 0x20000000 -# endif -#else -# if SANITIZER_IOS -# define ASAN_SHADOW_OFFSET_DYNAMIC -# elif SANITIZER_MAC && defined(__aarch64__) -# define ASAN_SHADOW_OFFSET_DYNAMIC -# elif SANITIZER_RISCV64 -# define ASAN_SHADOW_OFFSET_CONST 0x0000000d55550000 -# elif defined(__aarch64__) -# define ASAN_SHADOW_OFFSET_CONST 0x0000001000000000 -# elif defined(__powerpc64__) -# define ASAN_SHADOW_OFFSET_CONST 0x0000100000000000 -# elif defined(__s390x__) -# define ASAN_SHADOW_OFFSET_CONST 0x0010000000000000 -# elif SANITIZER_FREEBSD -# define ASAN_SHADOW_OFFSET_CONST 0x0000400000000000 -# elif SANITIZER_NETBSD -# define ASAN_SHADOW_OFFSET_CONST 0x0000400000000000 -# elif SANITIZER_MAC -# define ASAN_SHADOW_OFFSET_CONST 0x0000100000000000 -# elif defined(__mips64) -# define ASAN_SHADOW_OFFSET_CONST 0x0000002000000000 -# elif defined(__sparc__) -# define ASAN_SHADOW_OFFSET_CONST 0x0000080000000000 -# elif SANITIZER_WINDOWS64 -# define ASAN_SHADOW_OFFSET_DYNAMIC -# else -# if ASAN_SHADOW_SCALE != 3 -# error "Value below is based on shadow scale = 3." -# error "Original formula was: 0x7FFFFFFF & (~0xFFFULL << SHADOW_SCALE)." -# endif -# define ASAN_SHADOW_OFFSET_CONST 0x000000007fff8000 -# endif -#endif - -#if defined(__cplusplus) -# include "asan_internal.h" - -static const u64 kDefaultShadowSentinel = ~(uptr)0; - -# if defined(ASAN_SHADOW_OFFSET_CONST) -static const u64 kConstShadowOffset = ASAN_SHADOW_OFFSET_CONST; -# define ASAN_SHADOW_OFFSET kConstShadowOffset -# elif defined(ASAN_SHADOW_OFFSET_DYNAMIC) -# define ASAN_SHADOW_OFFSET __asan_shadow_memory_dynamic_address -# else -# error "ASAN_SHADOW_OFFSET can't be determined." -# endif - -# if SANITIZER_ANDROID && defined(__arm__) -# define ASAN_PREMAP_SHADOW 1 -# else -# define ASAN_PREMAP_SHADOW 0 -# endif - -# define ASAN_SHADOW_GRANULARITY (1ULL << ASAN_SHADOW_SCALE) - -# define DO_ASAN_MAPPING_PROFILE 0 // Set to 1 to profile the functions below. - -# if DO_ASAN_MAPPING_PROFILE -# define PROFILE_ASAN_MAPPING() AsanMappingProfile[__LINE__]++; -# else -# define PROFILE_ASAN_MAPPING() -# endif - -// If 1, all shadow boundaries are constants. -// Don't set to 1 other than for testing. -# define ASAN_FIXED_MAPPING 0 - -namespace __asan { - -extern uptr AsanMappingProfile[]; - -# if ASAN_FIXED_MAPPING -// Fixed mapping for 64-bit Linux. Mostly used for performance comparison -// with non-fixed mapping. As of r175253 (Feb 2013) the performance -// difference between fixed and non-fixed mapping is below the noise level. -static uptr kHighMemEnd = 0x7fffffffffffULL; -static uptr kMidMemBeg = 0x3000000000ULL; -static uptr kMidMemEnd = 0x4fffffffffULL; -# else -extern uptr kHighMemEnd, kMidMemBeg, kMidMemEnd; // Initialized in __asan_init. -# endif - -} // namespace __asan - -# if defined(__sparc__) && SANITIZER_WORDSIZE == 64 -# include "asan_mapping_sparc64.h" -# else -# define MEM_TO_SHADOW(mem) \ - (((mem) >> ASAN_SHADOW_SCALE) + (ASAN_SHADOW_OFFSET)) - -# define kLowMemBeg 0 -# define kLowMemEnd (ASAN_SHADOW_OFFSET ? ASAN_SHADOW_OFFSET - 1 : 0) - -# define kLowShadowBeg ASAN_SHADOW_OFFSET -# define kLowShadowEnd MEM_TO_SHADOW(kLowMemEnd) - -# define kHighMemBeg (MEM_TO_SHADOW(kHighMemEnd) + 1) - -# define kHighShadowBeg MEM_TO_SHADOW(kHighMemBeg) -# define kHighShadowEnd MEM_TO_SHADOW(kHighMemEnd) - -# define kMidShadowBeg MEM_TO_SHADOW(kMidMemBeg) -# define kMidShadowEnd MEM_TO_SHADOW(kMidMemEnd) - -// With the zero shadow base we can not actually map pages starting from 0. -// This constant is somewhat arbitrary. -# define kZeroBaseShadowStart 0 -# define kZeroBaseMaxShadowStart (1 << 18) - -# define kShadowGapBeg \ - (kLowShadowEnd ? kLowShadowEnd + 1 : kZeroBaseShadowStart) -# define kShadowGapEnd ((kMidMemBeg ? kMidShadowBeg : kHighShadowBeg) - 1) - -# define kShadowGap2Beg (kMidMemBeg ? kMidShadowEnd + 1 : 0) -# define kShadowGap2End (kMidMemBeg ? kMidMemBeg - 1 : 0) - -# define kShadowGap3Beg (kMidMemBeg ? kMidMemEnd + 1 : 0) -# define kShadowGap3End (kMidMemBeg ? kHighShadowBeg - 1 : 0) - -namespace __asan { - -static inline bool AddrIsInLowMem(uptr a) { - PROFILE_ASAN_MAPPING(); - return a <= kLowMemEnd; -} - -static inline bool AddrIsInLowShadow(uptr a) { - PROFILE_ASAN_MAPPING(); - return a >= kLowShadowBeg && a <= kLowShadowEnd; -} - -static inline bool AddrIsInMidMem(uptr a) { - PROFILE_ASAN_MAPPING(); - return kMidMemBeg && a >= kMidMemBeg && a <= kMidMemEnd; -} - -static inline bool AddrIsInMidShadow(uptr a) { - PROFILE_ASAN_MAPPING(); - return kMidMemBeg && a >= kMidShadowBeg && a <= kMidShadowEnd; -} - -static inline bool AddrIsInHighMem(uptr a) { - PROFILE_ASAN_MAPPING(); - return kHighMemBeg && a >= kHighMemBeg && a <= kHighMemEnd; -} - -static inline bool AddrIsInHighShadow(uptr a) { - PROFILE_ASAN_MAPPING(); - return kHighMemBeg && a >= kHighShadowBeg && a <= kHighShadowEnd; -} - -static inline bool AddrIsInShadowGap(uptr a) { - PROFILE_ASAN_MAPPING(); - if (kMidMemBeg) { - if (a <= kShadowGapEnd) - return ASAN_SHADOW_OFFSET == 0 || a >= kShadowGapBeg; - return (a >= kShadowGap2Beg && a <= kShadowGap2End) || - (a >= kShadowGap3Beg && a <= kShadowGap3End); - } - // In zero-based shadow mode we treat addresses near zero as addresses - // in shadow gap as well. - if (ASAN_SHADOW_OFFSET == 0) - return a <= kShadowGapEnd; - return a >= kShadowGapBeg && a <= kShadowGapEnd; -} - -} // namespace __asan - -# endif - -namespace __asan { - -static inline uptr MemToShadowSize(uptr size) { - return size >> ASAN_SHADOW_SCALE; -} - -static inline bool AddrIsInMem(uptr a) { - PROFILE_ASAN_MAPPING(); - return AddrIsInLowMem(a) || AddrIsInMidMem(a) || AddrIsInHighMem(a) || - (flags()->protect_shadow_gap == 0 && AddrIsInShadowGap(a)); -} - -static inline uptr MemToShadow(uptr p) { - PROFILE_ASAN_MAPPING(); - CHECK(AddrIsInMem(p)); - return MEM_TO_SHADOW(p); -} - -static inline bool AddrIsInShadow(uptr a) { - PROFILE_ASAN_MAPPING(); - return AddrIsInLowShadow(a) || AddrIsInMidShadow(a) || AddrIsInHighShadow(a); -} - -static inline bool AddrIsAlignedByGranularity(uptr a) { - PROFILE_ASAN_MAPPING(); - return (a & (ASAN_SHADOW_GRANULARITY - 1)) == 0; -} - -static inline bool AddressIsPoisoned(uptr a) { - PROFILE_ASAN_MAPPING(); - const uptr kAccessSize = 1; - u8 *shadow_address = (u8 *)MEM_TO_SHADOW(a); - s8 shadow_value = *shadow_address; - if (shadow_value) { - u8 last_accessed_byte = - (a & (ASAN_SHADOW_GRANULARITY - 1)) + kAccessSize - 1; - return (last_accessed_byte >= shadow_value); - } - return false; -} - -// Must be after all calls to PROFILE_ASAN_MAPPING(). -static const uptr kAsanMappingProfileSize = __LINE__; - -} // namespace __asan - -#endif // __cplusplus - -#endif // ASAN_MAPPING_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_mapping_sparc64.h b/contrib/libs/clang14-rt/lib/asan/asan_mapping_sparc64.h deleted file mode 100644 index 90261d301f7f..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_mapping_sparc64.h +++ /dev/null @@ -1,102 +0,0 @@ -//===-- asan_mapping_sparc64.h ----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// SPARC64-specific definitions for ASan memory mapping. -//===----------------------------------------------------------------------===// -#ifndef ASAN_MAPPING_SPARC64_H -#define ASAN_MAPPING_SPARC64_H - -// This is tailored to the 52-bit VM layout on SPARC-T4 and later. -// The VM space is split into two 51-bit halves at both ends: the low part -// has all the bits above the 51st cleared, while the high part has them set. -// 0xfff8000000000000 - 0xffffffffffffffff -// 0x0000000000000000 - 0x0007ffffffffffff - -#define VMA_BITS 52 -#define HIGH_BITS (64 - VMA_BITS) - -// The idea is to chop the high bits before doing the scaling, so the two -// parts become contiguous again and the usual scheme can be applied. - -#define MEM_TO_SHADOW(mem) \ - ((((mem) << HIGH_BITS) >> (HIGH_BITS + (ASAN_SHADOW_SCALE))) + \ - (ASAN_SHADOW_OFFSET)) - -#define kLowMemBeg 0 -#define kLowMemEnd (ASAN_SHADOW_OFFSET - 1) - -#define kLowShadowBeg ASAN_SHADOW_OFFSET -#define kLowShadowEnd MEM_TO_SHADOW(kLowMemEnd) - -// But of course there is the huge hole between the high shadow memory, -// which is in the low part, and the beginning of the high part. - -#define kHighMemBeg (-(1ULL << (VMA_BITS - 1))) - -#define kHighShadowBeg MEM_TO_SHADOW(kHighMemBeg) -#define kHighShadowEnd MEM_TO_SHADOW(kHighMemEnd) - -#define kMidShadowBeg 0 -#define kMidShadowEnd 0 - -// With the zero shadow base we can not actually map pages starting from 0. -// This constant is somewhat arbitrary. -#define kZeroBaseShadowStart 0 -#define kZeroBaseMaxShadowStart (1 << 18) - -#define kShadowGapBeg (kLowShadowEnd + 1) -#define kShadowGapEnd (kHighShadowBeg - 1) - -#define kShadowGap2Beg 0 -#define kShadowGap2End 0 - -#define kShadowGap3Beg 0 -#define kShadowGap3End 0 - -namespace __asan { - -static inline bool AddrIsInLowMem(uptr a) { - PROFILE_ASAN_MAPPING(); - return a <= kLowMemEnd; -} - -static inline bool AddrIsInLowShadow(uptr a) { - PROFILE_ASAN_MAPPING(); - return a >= kLowShadowBeg && a <= kLowShadowEnd; -} - -static inline bool AddrIsInMidMem(uptr a) { - PROFILE_ASAN_MAPPING(); - return false; -} - -static inline bool AddrIsInMidShadow(uptr a) { - PROFILE_ASAN_MAPPING(); - return false; -} - -static inline bool AddrIsInHighMem(uptr a) { - PROFILE_ASAN_MAPPING(); - return kHighMemBeg && a >= kHighMemBeg && a <= kHighMemEnd; -} - -static inline bool AddrIsInHighShadow(uptr a) { - PROFILE_ASAN_MAPPING(); - return kHighMemBeg && a >= kHighShadowBeg && a <= kHighShadowEnd; -} - -static inline bool AddrIsInShadowGap(uptr a) { - PROFILE_ASAN_MAPPING(); - return a >= kShadowGapBeg && a <= kShadowGapEnd; -} - -} // namespace __asan - -#endif // ASAN_MAPPING_SPARC64_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_memory_profile.cpp b/contrib/libs/clang14-rt/lib/asan/asan_memory_profile.cpp deleted file mode 100644 index 4fcd5600ed1a..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_memory_profile.cpp +++ /dev/null @@ -1,129 +0,0 @@ -//===-- asan_memory_profile.cpp ----------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// This file implements __sanitizer_print_memory_profile. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_stackdepot.h" -#include "sanitizer_common/sanitizer_stacktrace.h" -#include "sanitizer_common/sanitizer_stoptheworld.h" -#include "lsan/lsan_common.h" -#include "asan/asan_allocator.h" - -#if CAN_SANITIZE_LEAKS - -namespace __asan { - -struct AllocationSite { - u32 id; - uptr total_size; - uptr count; -}; - -class HeapProfile { - public: - HeapProfile() { allocations_.reserve(1024); } - - void ProcessChunk(const AsanChunkView &cv) { - if (cv.IsAllocated()) { - total_allocated_user_size_ += cv.UsedSize(); - total_allocated_count_++; - u32 id = cv.GetAllocStackId(); - if (id) - Insert(id, cv.UsedSize()); - } else if (cv.IsQuarantined()) { - total_quarantined_user_size_ += cv.UsedSize(); - total_quarantined_count_++; - } else { - total_other_count_++; - } - } - - void Print(uptr top_percent, uptr max_number_of_contexts) { - Sort(allocations_.data(), allocations_.size(), - [](const AllocationSite &a, const AllocationSite &b) { - return a.total_size > b.total_size; - }); - CHECK(total_allocated_user_size_); - uptr total_shown = 0; - Printf("Live Heap Allocations: %zd bytes in %zd chunks; quarantined: " - "%zd bytes in %zd chunks; %zd other chunks; total chunks: %zd; " - "showing top %zd%% (at most %zd unique contexts)\n", - total_allocated_user_size_, total_allocated_count_, - total_quarantined_user_size_, total_quarantined_count_, - total_other_count_, total_allocated_count_ + - total_quarantined_count_ + total_other_count_, top_percent, - max_number_of_contexts); - for (uptr i = 0; i < Min(allocations_.size(), max_number_of_contexts); - i++) { - auto &a = allocations_[i]; - Printf("%zd byte(s) (%zd%%) in %zd allocation(s)\n", a.total_size, - a.total_size * 100 / total_allocated_user_size_, a.count); - StackDepotGet(a.id).Print(); - total_shown += a.total_size; - if (total_shown * 100 / total_allocated_user_size_ > top_percent) - break; - } - } - - private: - uptr total_allocated_user_size_ = 0; - uptr total_allocated_count_ = 0; - uptr total_quarantined_user_size_ = 0; - uptr total_quarantined_count_ = 0; - uptr total_other_count_ = 0; - InternalMmapVector allocations_; - - void Insert(u32 id, uptr size) { - // Linear lookup will be good enough for most cases (although not all). - for (uptr i = 0; i < allocations_.size(); i++) { - if (allocations_[i].id == id) { - allocations_[i].total_size += size; - allocations_[i].count++; - return; - } - } - allocations_.push_back({id, size, 1}); - } -}; - -static void ChunkCallback(uptr chunk, void *arg) { - reinterpret_cast(arg)->ProcessChunk( - FindHeapChunkByAllocBeg(chunk)); -} - -static void MemoryProfileCB(const SuspendedThreadsList &suspended_threads_list, - void *argument) { - HeapProfile hp; - __lsan::ForEachChunk(ChunkCallback, &hp); - uptr *Arg = reinterpret_cast(argument); - hp.Print(Arg[0], Arg[1]); - - if (Verbosity()) - __asan_print_accumulated_stats(); -} - -} // namespace __asan - -#endif // CAN_SANITIZE_LEAKS - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_print_memory_profile(uptr top_percent, - uptr max_number_of_contexts) { -#if CAN_SANITIZE_LEAKS - uptr Arg[2]; - Arg[0] = top_percent; - Arg[1] = max_number_of_contexts; - __sanitizer::StopTheWorld(__asan::MemoryProfileCB, Arg); -#endif // CAN_SANITIZE_LEAKS -} -} // extern "C" diff --git a/contrib/libs/clang14-rt/lib/asan/asan_new_delete.cpp b/contrib/libs/clang14-rt/lib/asan/asan_new_delete.cpp deleted file mode 100644 index da446072de18..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_new_delete.cpp +++ /dev/null @@ -1,196 +0,0 @@ -//===-- asan_interceptors.cpp ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Interceptors for operators new and delete. -//===----------------------------------------------------------------------===// - -#include - -#include "asan_allocator.h" -#include "asan_internal.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "interception/interception.h" - -// C++ operators can't have dllexport attributes on Windows. We export them -// anyway by passing extra -export flags to the linker, which is exactly that -// dllexport would normally do. We need to export them in order to make the -// VS2015 dynamic CRT (MD) work. -#if SANITIZER_WINDOWS && defined(_MSC_VER) -#define CXX_OPERATOR_ATTRIBUTE -#define COMMENT_EXPORT(sym) __pragma(comment(linker, "/export:" sym)) -#ifdef _WIN64 -COMMENT_EXPORT("??2@YAPEAX_K@Z") // operator new -COMMENT_EXPORT("??2@YAPEAX_KAEBUnothrow_t@std@@@Z") // operator new nothrow -COMMENT_EXPORT("??3@YAXPEAX@Z") // operator delete -COMMENT_EXPORT("??3@YAXPEAX_K@Z") // sized operator delete -COMMENT_EXPORT("??_U@YAPEAX_K@Z") // operator new[] -COMMENT_EXPORT("??_V@YAXPEAX@Z") // operator delete[] -#else -COMMENT_EXPORT("??2@YAPAXI@Z") // operator new -COMMENT_EXPORT("??2@YAPAXIABUnothrow_t@std@@@Z") // operator new nothrow -COMMENT_EXPORT("??3@YAXPAX@Z") // operator delete -COMMENT_EXPORT("??3@YAXPAXI@Z") // sized operator delete -COMMENT_EXPORT("??_U@YAPAXI@Z") // operator new[] -COMMENT_EXPORT("??_V@YAXPAX@Z") // operator delete[] -#endif -#undef COMMENT_EXPORT -#else -#define CXX_OPERATOR_ATTRIBUTE INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -#endif - -using namespace __asan; - -// FreeBSD prior v9.2 have wrong definition of 'size_t'. -// http://svnweb.freebsd.org/base?view=revision&revision=232261 -#if SANITIZER_FREEBSD && SANITIZER_WORDSIZE == 32 -#include -#if __FreeBSD_version <= 902001 // v9.2 -#define size_t unsigned -#endif // __FreeBSD_version -#endif // SANITIZER_FREEBSD && SANITIZER_WORDSIZE == 32 - -// This code has issues on OSX. -// See https://github.com/google/sanitizers/issues/131. - -// Fake std::nothrow_t and std::align_val_t to avoid including . -namespace std { -struct nothrow_t {}; -enum class align_val_t: size_t {}; -} // namespace std - -// TODO(alekseyshl): throw std::bad_alloc instead of dying on OOM. -// For local pool allocation, align to SHADOW_GRANULARITY to match asan -// allocator behavior. -#define OPERATOR_NEW_BODY(type, nothrow) \ - GET_STACK_TRACE_MALLOC; \ - void *res = asan_memalign(0, size, &stack, type); \ - if (!nothrow && UNLIKELY(!res)) \ - ReportOutOfMemory(size, &stack); \ - return res; -#define OPERATOR_NEW_BODY_ALIGN(type, nothrow) \ - GET_STACK_TRACE_MALLOC; \ - void *res = asan_memalign((uptr)align, size, &stack, type); \ - if (!nothrow && UNLIKELY(!res)) \ - ReportOutOfMemory(size, &stack); \ - return res; - -// On OS X it's not enough to just provide our own 'operator new' and -// 'operator delete' implementations, because they're going to be in the -// runtime dylib, and the main executable will depend on both the runtime -// dylib and libstdc++, each of those'll have its implementation of new and -// delete. -// To make sure that C++ allocation/deallocation operators are overridden on -// OS X we need to intercept them using their mangled names. -#if !SANITIZER_MAC -CXX_OPERATOR_ATTRIBUTE -void *operator new(size_t size) -{ OPERATOR_NEW_BODY(FROM_NEW, false /*nothrow*/); } -CXX_OPERATOR_ATTRIBUTE -void *operator new[](size_t size) -{ OPERATOR_NEW_BODY(FROM_NEW_BR, false /*nothrow*/); } -CXX_OPERATOR_ATTRIBUTE -void *operator new(size_t size, std::nothrow_t const&) -{ OPERATOR_NEW_BODY(FROM_NEW, true /*nothrow*/); } -CXX_OPERATOR_ATTRIBUTE -void *operator new[](size_t size, std::nothrow_t const&) -{ OPERATOR_NEW_BODY(FROM_NEW_BR, true /*nothrow*/); } -CXX_OPERATOR_ATTRIBUTE -void *operator new(size_t size, std::align_val_t align) -{ OPERATOR_NEW_BODY_ALIGN(FROM_NEW, false /*nothrow*/); } -CXX_OPERATOR_ATTRIBUTE -void *operator new[](size_t size, std::align_val_t align) -{ OPERATOR_NEW_BODY_ALIGN(FROM_NEW_BR, false /*nothrow*/); } -CXX_OPERATOR_ATTRIBUTE -void *operator new(size_t size, std::align_val_t align, std::nothrow_t const&) -{ OPERATOR_NEW_BODY_ALIGN(FROM_NEW, true /*nothrow*/); } -CXX_OPERATOR_ATTRIBUTE -void *operator new[](size_t size, std::align_val_t align, std::nothrow_t const&) -{ OPERATOR_NEW_BODY_ALIGN(FROM_NEW_BR, true /*nothrow*/); } - -#else // SANITIZER_MAC -INTERCEPTOR(void *, _Znwm, size_t size) { - OPERATOR_NEW_BODY(FROM_NEW, false /*nothrow*/); -} -INTERCEPTOR(void *, _Znam, size_t size) { - OPERATOR_NEW_BODY(FROM_NEW_BR, false /*nothrow*/); -} -INTERCEPTOR(void *, _ZnwmRKSt9nothrow_t, size_t size, std::nothrow_t const&) { - OPERATOR_NEW_BODY(FROM_NEW, true /*nothrow*/); -} -INTERCEPTOR(void *, _ZnamRKSt9nothrow_t, size_t size, std::nothrow_t const&) { - OPERATOR_NEW_BODY(FROM_NEW_BR, true /*nothrow*/); -} -#endif // !SANITIZER_MAC - -#define OPERATOR_DELETE_BODY(type) \ - GET_STACK_TRACE_FREE; \ - asan_delete(ptr, 0, 0, &stack, type); - -#define OPERATOR_DELETE_BODY_SIZE(type) \ - GET_STACK_TRACE_FREE; \ - asan_delete(ptr, size, 0, &stack, type); - -#define OPERATOR_DELETE_BODY_ALIGN(type) \ - GET_STACK_TRACE_FREE; \ - asan_delete(ptr, 0, static_cast(align), &stack, type); - -#define OPERATOR_DELETE_BODY_SIZE_ALIGN(type) \ - GET_STACK_TRACE_FREE; \ - asan_delete(ptr, size, static_cast(align), &stack, type); - -#if !SANITIZER_MAC -CXX_OPERATOR_ATTRIBUTE -void operator delete(void *ptr) NOEXCEPT -{ OPERATOR_DELETE_BODY(FROM_NEW); } -CXX_OPERATOR_ATTRIBUTE -void operator delete[](void *ptr) NOEXCEPT -{ OPERATOR_DELETE_BODY(FROM_NEW_BR); } -CXX_OPERATOR_ATTRIBUTE -void operator delete(void *ptr, std::nothrow_t const&) -{ OPERATOR_DELETE_BODY(FROM_NEW); } -CXX_OPERATOR_ATTRIBUTE -void operator delete[](void *ptr, std::nothrow_t const&) -{ OPERATOR_DELETE_BODY(FROM_NEW_BR); } -CXX_OPERATOR_ATTRIBUTE -void operator delete(void *ptr, size_t size) NOEXCEPT -{ OPERATOR_DELETE_BODY_SIZE(FROM_NEW); } -CXX_OPERATOR_ATTRIBUTE -void operator delete[](void *ptr, size_t size) NOEXCEPT -{ OPERATOR_DELETE_BODY_SIZE(FROM_NEW_BR); } -CXX_OPERATOR_ATTRIBUTE -void operator delete(void *ptr, std::align_val_t align) NOEXCEPT -{ OPERATOR_DELETE_BODY_ALIGN(FROM_NEW); } -CXX_OPERATOR_ATTRIBUTE -void operator delete[](void *ptr, std::align_val_t align) NOEXCEPT -{ OPERATOR_DELETE_BODY_ALIGN(FROM_NEW_BR); } -CXX_OPERATOR_ATTRIBUTE -void operator delete(void *ptr, std::align_val_t align, std::nothrow_t const&) -{ OPERATOR_DELETE_BODY_ALIGN(FROM_NEW); } -CXX_OPERATOR_ATTRIBUTE -void operator delete[](void *ptr, std::align_val_t align, std::nothrow_t const&) -{ OPERATOR_DELETE_BODY_ALIGN(FROM_NEW_BR); } -CXX_OPERATOR_ATTRIBUTE -void operator delete(void *ptr, size_t size, std::align_val_t align) NOEXCEPT -{ OPERATOR_DELETE_BODY_SIZE_ALIGN(FROM_NEW); } -CXX_OPERATOR_ATTRIBUTE -void operator delete[](void *ptr, size_t size, std::align_val_t align) NOEXCEPT -{ OPERATOR_DELETE_BODY_SIZE_ALIGN(FROM_NEW_BR); } - -#else // SANITIZER_MAC -INTERCEPTOR(void, _ZdlPv, void *ptr) -{ OPERATOR_DELETE_BODY(FROM_NEW); } -INTERCEPTOR(void, _ZdaPv, void *ptr) -{ OPERATOR_DELETE_BODY(FROM_NEW_BR); } -INTERCEPTOR(void, _ZdlPvRKSt9nothrow_t, void *ptr, std::nothrow_t const&) -{ OPERATOR_DELETE_BODY(FROM_NEW); } -INTERCEPTOR(void, _ZdaPvRKSt9nothrow_t, void *ptr, std::nothrow_t const&) -{ OPERATOR_DELETE_BODY(FROM_NEW_BR); } -#endif // !SANITIZER_MAC diff --git a/contrib/libs/clang14-rt/lib/asan/asan_poisoning.cpp b/contrib/libs/clang14-rt/lib/asan/asan_poisoning.cpp deleted file mode 100644 index bbc7db4709e1..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_poisoning.cpp +++ /dev/null @@ -1,449 +0,0 @@ -//===-- asan_poisoning.cpp ------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Shadow memory poisoning by ASan RTL and by user application. -//===----------------------------------------------------------------------===// - -#include "asan_poisoning.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "sanitizer_common/sanitizer_atomic.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_flags.h" - -namespace __asan { - -static atomic_uint8_t can_poison_memory; - -void SetCanPoisonMemory(bool value) { - atomic_store(&can_poison_memory, value, memory_order_release); -} - -bool CanPoisonMemory() { - return atomic_load(&can_poison_memory, memory_order_acquire); -} - -void PoisonShadow(uptr addr, uptr size, u8 value) { - if (value && !CanPoisonMemory()) return; - CHECK(AddrIsAlignedByGranularity(addr)); - CHECK(AddrIsInMem(addr)); - CHECK(AddrIsAlignedByGranularity(addr + size)); - CHECK(AddrIsInMem(addr + size - ASAN_SHADOW_GRANULARITY)); - CHECK(REAL(memset)); - FastPoisonShadow(addr, size, value); -} - -void PoisonShadowPartialRightRedzone(uptr addr, - uptr size, - uptr redzone_size, - u8 value) { - if (!CanPoisonMemory()) return; - CHECK(AddrIsAlignedByGranularity(addr)); - CHECK(AddrIsInMem(addr)); - FastPoisonShadowPartialRightRedzone(addr, size, redzone_size, value); -} - -struct ShadowSegmentEndpoint { - u8 *chunk; - s8 offset; // in [0, ASAN_SHADOW_GRANULARITY) - s8 value; // = *chunk; - - explicit ShadowSegmentEndpoint(uptr address) { - chunk = (u8*)MemToShadow(address); - offset = address & (ASAN_SHADOW_GRANULARITY - 1); - value = *chunk; - } -}; - -void AsanPoisonOrUnpoisonIntraObjectRedzone(uptr ptr, uptr size, bool poison) { - uptr end = ptr + size; - if (Verbosity()) { - Printf("__asan_%spoison_intra_object_redzone [%p,%p) %zd\n", - poison ? "" : "un", (void *)ptr, (void *)end, size); - if (Verbosity() >= 2) - PRINT_CURRENT_STACK(); - } - CHECK(size); - CHECK_LE(size, 4096); - CHECK(IsAligned(end, ASAN_SHADOW_GRANULARITY)); - if (!IsAligned(ptr, ASAN_SHADOW_GRANULARITY)) { - *(u8 *)MemToShadow(ptr) = - poison ? static_cast(ptr % ASAN_SHADOW_GRANULARITY) : 0; - ptr |= ASAN_SHADOW_GRANULARITY - 1; - ptr++; - } - for (; ptr < end; ptr += ASAN_SHADOW_GRANULARITY) - *(u8*)MemToShadow(ptr) = poison ? kAsanIntraObjectRedzone : 0; -} - -} // namespace __asan - -// ---------------------- Interface ---------------- {{{1 -using namespace __asan; - -// Current implementation of __asan_(un)poison_memory_region doesn't check -// that user program (un)poisons the memory it owns. It poisons memory -// conservatively, and unpoisons progressively to make sure asan shadow -// mapping invariant is preserved (see detailed mapping description here: -// https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm). -// -// * if user asks to poison region [left, right), the program poisons -// at least [left, AlignDown(right)). -// * if user asks to unpoison region [left, right), the program unpoisons -// at most [AlignDown(left), right). -void __asan_poison_memory_region(void const volatile *addr, uptr size) { - if (!flags()->allow_user_poisoning || size == 0) return; - uptr beg_addr = (uptr)addr; - uptr end_addr = beg_addr + size; - VPrintf(3, "Trying to poison memory region [%p, %p)\n", (void *)beg_addr, - (void *)end_addr); - ShadowSegmentEndpoint beg(beg_addr); - ShadowSegmentEndpoint end(end_addr); - if (beg.chunk == end.chunk) { - CHECK_LT(beg.offset, end.offset); - s8 value = beg.value; - CHECK_EQ(value, end.value); - // We can only poison memory if the byte in end.offset is unaddressable. - // No need to re-poison memory if it is poisoned already. - if (value > 0 && value <= end.offset) { - if (beg.offset > 0) { - *beg.chunk = Min(value, beg.offset); - } else { - *beg.chunk = kAsanUserPoisonedMemoryMagic; - } - } - return; - } - CHECK_LT(beg.chunk, end.chunk); - if (beg.offset > 0) { - // Mark bytes from beg.offset as unaddressable. - if (beg.value == 0) { - *beg.chunk = beg.offset; - } else { - *beg.chunk = Min(beg.value, beg.offset); - } - beg.chunk++; - } - REAL(memset)(beg.chunk, kAsanUserPoisonedMemoryMagic, end.chunk - beg.chunk); - // Poison if byte in end.offset is unaddressable. - if (end.value > 0 && end.value <= end.offset) { - *end.chunk = kAsanUserPoisonedMemoryMagic; - } -} - -void __asan_unpoison_memory_region(void const volatile *addr, uptr size) { - if (!flags()->allow_user_poisoning || size == 0) return; - uptr beg_addr = (uptr)addr; - uptr end_addr = beg_addr + size; - VPrintf(3, "Trying to unpoison memory region [%p, %p)\n", (void *)beg_addr, - (void *)end_addr); - ShadowSegmentEndpoint beg(beg_addr); - ShadowSegmentEndpoint end(end_addr); - if (beg.chunk == end.chunk) { - CHECK_LT(beg.offset, end.offset); - s8 value = beg.value; - CHECK_EQ(value, end.value); - // We unpoison memory bytes up to enbytes up to end.offset if it is not - // unpoisoned already. - if (value != 0) { - *beg.chunk = Max(value, end.offset); - } - return; - } - CHECK_LT(beg.chunk, end.chunk); - if (beg.offset > 0) { - *beg.chunk = 0; - beg.chunk++; - } - REAL(memset)(beg.chunk, 0, end.chunk - beg.chunk); - if (end.offset > 0 && end.value != 0) { - *end.chunk = Max(end.value, end.offset); - } -} - -int __asan_address_is_poisoned(void const volatile *addr) { - return __asan::AddressIsPoisoned((uptr)addr); -} - -uptr __asan_region_is_poisoned(uptr beg, uptr size) { - if (!size) - return 0; - uptr end = beg + size; - if (!AddrIsInMem(beg)) - return beg; - if (!AddrIsInMem(end)) - return end; - CHECK_LT(beg, end); - uptr aligned_b = RoundUpTo(beg, ASAN_SHADOW_GRANULARITY); - uptr aligned_e = RoundDownTo(end, ASAN_SHADOW_GRANULARITY); - uptr shadow_beg = MemToShadow(aligned_b); - uptr shadow_end = MemToShadow(aligned_e); - // First check the first and the last application bytes, - // then check the ASAN_SHADOW_GRANULARITY-aligned region by calling - // mem_is_zero on the corresponding shadow. - if (!__asan::AddressIsPoisoned(beg) && !__asan::AddressIsPoisoned(end - 1) && - (shadow_end <= shadow_beg || - __sanitizer::mem_is_zero((const char *)shadow_beg, - shadow_end - shadow_beg))) - return 0; - // The fast check failed, so we have a poisoned byte somewhere. - // Find it slowly. - for (; beg < end; beg++) - if (__asan::AddressIsPoisoned(beg)) - return beg; - UNREACHABLE("mem_is_zero returned false, but poisoned byte was not found"); - return 0; -} - -#define CHECK_SMALL_REGION(p, size, isWrite) \ - do { \ - uptr __p = reinterpret_cast(p); \ - uptr __size = size; \ - if (UNLIKELY(__asan::AddressIsPoisoned(__p) || \ - __asan::AddressIsPoisoned(__p + __size - 1))) { \ - GET_CURRENT_PC_BP_SP; \ - uptr __bad = __asan_region_is_poisoned(__p, __size); \ - __asan_report_error(pc, bp, sp, __bad, isWrite, __size, 0);\ - } \ - } while (false) - - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -u16 __sanitizer_unaligned_load16(const uu16 *p) { - CHECK_SMALL_REGION(p, sizeof(*p), false); - return *p; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -u32 __sanitizer_unaligned_load32(const uu32 *p) { - CHECK_SMALL_REGION(p, sizeof(*p), false); - return *p; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -u64 __sanitizer_unaligned_load64(const uu64 *p) { - CHECK_SMALL_REGION(p, sizeof(*p), false); - return *p; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_unaligned_store16(uu16 *p, u16 x) { - CHECK_SMALL_REGION(p, sizeof(*p), true); - *p = x; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_unaligned_store32(uu32 *p, u32 x) { - CHECK_SMALL_REGION(p, sizeof(*p), true); - *p = x; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_unaligned_store64(uu64 *p, u64 x) { - CHECK_SMALL_REGION(p, sizeof(*p), true); - *p = x; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -void __asan_poison_cxx_array_cookie(uptr p) { - if (SANITIZER_WORDSIZE != 64) return; - if (!flags()->poison_array_cookie) return; - uptr s = MEM_TO_SHADOW(p); - *reinterpret_cast(s) = kAsanArrayCookieMagic; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -uptr __asan_load_cxx_array_cookie(uptr *p) { - if (SANITIZER_WORDSIZE != 64) return *p; - if (!flags()->poison_array_cookie) return *p; - uptr s = MEM_TO_SHADOW(reinterpret_cast(p)); - u8 sval = *reinterpret_cast(s); - if (sval == kAsanArrayCookieMagic) return *p; - // If sval is not kAsanArrayCookieMagic it can only be freed memory, - // which means that we are going to get double-free. So, return 0 to avoid - // infinite loop of destructors. We don't want to report a double-free here - // though, so print a warning just in case. - // CHECK_EQ(sval, kAsanHeapFreeMagic); - if (sval == kAsanHeapFreeMagic) { - Report("AddressSanitizer: loaded array cookie from free-d memory; " - "expect a double-free report\n"); - return 0; - } - // The cookie may remain unpoisoned if e.g. it comes from a custom - // operator new defined inside a class. - return *p; -} - -// This is a simplified version of __asan_(un)poison_memory_region, which -// assumes that left border of region to be poisoned is properly aligned. -static void PoisonAlignedStackMemory(uptr addr, uptr size, bool do_poison) { - if (size == 0) return; - uptr aligned_size = size & ~(ASAN_SHADOW_GRANULARITY - 1); - PoisonShadow(addr, aligned_size, - do_poison ? kAsanStackUseAfterScopeMagic : 0); - if (size == aligned_size) - return; - s8 end_offset = (s8)(size - aligned_size); - s8* shadow_end = (s8*)MemToShadow(addr + aligned_size); - s8 end_value = *shadow_end; - if (do_poison) { - // If possible, mark all the bytes mapping to last shadow byte as - // unaddressable. - if (end_value > 0 && end_value <= end_offset) - *shadow_end = (s8)kAsanStackUseAfterScopeMagic; - } else { - // If necessary, mark few first bytes mapping to last shadow byte - // as addressable - if (end_value != 0) - *shadow_end = Max(end_value, end_offset); - } -} - -void __asan_set_shadow_00(uptr addr, uptr size) { - REAL(memset)((void *)addr, 0, size); -} - -void __asan_set_shadow_f1(uptr addr, uptr size) { - REAL(memset)((void *)addr, 0xf1, size); -} - -void __asan_set_shadow_f2(uptr addr, uptr size) { - REAL(memset)((void *)addr, 0xf2, size); -} - -void __asan_set_shadow_f3(uptr addr, uptr size) { - REAL(memset)((void *)addr, 0xf3, size); -} - -void __asan_set_shadow_f5(uptr addr, uptr size) { - REAL(memset)((void *)addr, 0xf5, size); -} - -void __asan_set_shadow_f8(uptr addr, uptr size) { - REAL(memset)((void *)addr, 0xf8, size); -} - -void __asan_poison_stack_memory(uptr addr, uptr size) { - VReport(1, "poisoning: %p %zx\n", (void *)addr, size); - PoisonAlignedStackMemory(addr, size, true); -} - -void __asan_unpoison_stack_memory(uptr addr, uptr size) { - VReport(1, "unpoisoning: %p %zx\n", (void *)addr, size); - PoisonAlignedStackMemory(addr, size, false); -} - -void __sanitizer_annotate_contiguous_container(const void *beg_p, - const void *end_p, - const void *old_mid_p, - const void *new_mid_p) { - if (!flags()->detect_container_overflow) return; - VPrintf(2, "contiguous_container: %p %p %p %p\n", beg_p, end_p, old_mid_p, - new_mid_p); - uptr beg = reinterpret_cast(beg_p); - uptr end = reinterpret_cast(end_p); - uptr old_mid = reinterpret_cast(old_mid_p); - uptr new_mid = reinterpret_cast(new_mid_p); - uptr granularity = ASAN_SHADOW_GRANULARITY; - if (!(beg <= old_mid && beg <= new_mid && old_mid <= end && new_mid <= end && - IsAligned(beg, granularity))) { - GET_STACK_TRACE_FATAL_HERE; - ReportBadParamsToAnnotateContiguousContainer(beg, end, old_mid, new_mid, - &stack); - } - CHECK_LE(end - beg, - FIRST_32_SECOND_64(1UL << 30, 1ULL << 40)); // Sanity check. - - uptr a = RoundDownTo(Min(old_mid, new_mid), granularity); - uptr c = RoundUpTo(Max(old_mid, new_mid), granularity); - uptr d1 = RoundDownTo(old_mid, granularity); - // uptr d2 = RoundUpTo(old_mid, granularity); - // Currently we should be in this state: - // [a, d1) is good, [d2, c) is bad, [d1, d2) is partially good. - // Make a quick sanity check that we are indeed in this state. - // - // FIXME: Two of these three checks are disabled until we fix - // https://github.com/google/sanitizers/issues/258. - // if (d1 != d2) - // CHECK_EQ(*(u8*)MemToShadow(d1), old_mid - d1); - if (a + granularity <= d1) - CHECK_EQ(*(u8*)MemToShadow(a), 0); - // if (d2 + granularity <= c && c <= end) - // CHECK_EQ(*(u8 *)MemToShadow(c - granularity), - // kAsanContiguousContainerOOBMagic); - - uptr b1 = RoundDownTo(new_mid, granularity); - uptr b2 = RoundUpTo(new_mid, granularity); - // New state: - // [a, b1) is good, [b2, c) is bad, [b1, b2) is partially good. - PoisonShadow(a, b1 - a, 0); - PoisonShadow(b2, c - b2, kAsanContiguousContainerOOBMagic); - if (b1 != b2) { - CHECK_EQ(b2 - b1, granularity); - *(u8*)MemToShadow(b1) = static_cast(new_mid - b1); - } -} - -const void *__sanitizer_contiguous_container_find_bad_address( - const void *beg_p, const void *mid_p, const void *end_p) { - if (!flags()->detect_container_overflow) - return nullptr; - uptr beg = reinterpret_cast(beg_p); - uptr end = reinterpret_cast(end_p); - uptr mid = reinterpret_cast(mid_p); - CHECK_LE(beg, mid); - CHECK_LE(mid, end); - // Check some bytes starting from beg, some bytes around mid, and some bytes - // ending with end. - uptr kMaxRangeToCheck = 32; - uptr r1_beg = beg; - uptr r1_end = Min(beg + kMaxRangeToCheck, mid); - uptr r2_beg = Max(beg, mid - kMaxRangeToCheck); - uptr r2_end = Min(end, mid + kMaxRangeToCheck); - uptr r3_beg = Max(end - kMaxRangeToCheck, mid); - uptr r3_end = end; - for (uptr i = r1_beg; i < r1_end; i++) - if (AddressIsPoisoned(i)) - return reinterpret_cast(i); - for (uptr i = r2_beg; i < mid; i++) - if (AddressIsPoisoned(i)) - return reinterpret_cast(i); - for (uptr i = mid; i < r2_end; i++) - if (!AddressIsPoisoned(i)) - return reinterpret_cast(i); - for (uptr i = r3_beg; i < r3_end; i++) - if (!AddressIsPoisoned(i)) - return reinterpret_cast(i); - return nullptr; -} - -int __sanitizer_verify_contiguous_container(const void *beg_p, - const void *mid_p, - const void *end_p) { - return __sanitizer_contiguous_container_find_bad_address(beg_p, mid_p, - end_p) == nullptr; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -void __asan_poison_intra_object_redzone(uptr ptr, uptr size) { - AsanPoisonOrUnpoisonIntraObjectRedzone(ptr, size, true); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -void __asan_unpoison_intra_object_redzone(uptr ptr, uptr size) { - AsanPoisonOrUnpoisonIntraObjectRedzone(ptr, size, false); -} - -// --- Implementation of LSan-specific functions --- {{{1 -namespace __lsan { -bool WordIsPoisoned(uptr addr) { - return (__asan_region_is_poisoned(addr, sizeof(uptr)) != 0); -} -} diff --git a/contrib/libs/clang14-rt/lib/asan/asan_poisoning.h b/contrib/libs/clang14-rt/lib/asan/asan_poisoning.h deleted file mode 100644 index 600bd011f304..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_poisoning.h +++ /dev/null @@ -1,98 +0,0 @@ -//===-- asan_poisoning.h ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Shadow memory poisoning by ASan RTL and by user application. -//===----------------------------------------------------------------------===// - -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_platform.h" - -namespace __asan { - -// Enable/disable memory poisoning. -void SetCanPoisonMemory(bool value); -bool CanPoisonMemory(); - -// Poisons the shadow memory for "size" bytes starting from "addr". -void PoisonShadow(uptr addr, uptr size, u8 value); - -// Poisons the shadow memory for "redzone_size" bytes starting from -// "addr + size". -void PoisonShadowPartialRightRedzone(uptr addr, - uptr size, - uptr redzone_size, - u8 value); - -// Fast versions of PoisonShadow and PoisonShadowPartialRightRedzone that -// assume that memory addresses are properly aligned. Use in -// performance-critical code with care. -ALWAYS_INLINE void FastPoisonShadow(uptr aligned_beg, uptr aligned_size, - u8 value) { - DCHECK(!value || CanPoisonMemory()); -#if SANITIZER_FUCHSIA - __sanitizer_fill_shadow(aligned_beg, aligned_size, value, - common_flags()->clear_shadow_mmap_threshold); -#else - uptr shadow_beg = MEM_TO_SHADOW(aligned_beg); - uptr shadow_end = - MEM_TO_SHADOW(aligned_beg + aligned_size - ASAN_SHADOW_GRANULARITY) + 1; - // FIXME: Page states are different on Windows, so using the same interface - // for mapping shadow and zeroing out pages doesn't "just work", so we should - // probably provide higher-level interface for these operations. - // For now, just memset on Windows. - if (value || SANITIZER_WINDOWS == 1 || - shadow_end - shadow_beg < common_flags()->clear_shadow_mmap_threshold) { - REAL(memset)((void*)shadow_beg, value, shadow_end - shadow_beg); - } else { - uptr page_size = GetPageSizeCached(); - uptr page_beg = RoundUpTo(shadow_beg, page_size); - uptr page_end = RoundDownTo(shadow_end, page_size); - - if (page_beg >= page_end) { - REAL(memset)((void *)shadow_beg, 0, shadow_end - shadow_beg); - } else { - if (page_beg != shadow_beg) { - REAL(memset)((void *)shadow_beg, 0, page_beg - shadow_beg); - } - if (page_end != shadow_end) { - REAL(memset)((void *)page_end, 0, shadow_end - page_end); - } - ReserveShadowMemoryRange(page_beg, page_end - 1, nullptr); - } - } -#endif // SANITIZER_FUCHSIA -} - -ALWAYS_INLINE void FastPoisonShadowPartialRightRedzone( - uptr aligned_addr, uptr size, uptr redzone_size, u8 value) { - DCHECK(CanPoisonMemory()); - bool poison_partial = flags()->poison_partial; - u8 *shadow = (u8*)MEM_TO_SHADOW(aligned_addr); - for (uptr i = 0; i < redzone_size; i += ASAN_SHADOW_GRANULARITY, shadow++) { - if (i + ASAN_SHADOW_GRANULARITY <= size) { - *shadow = 0; // fully addressable - } else if (i >= size) { - *shadow = - (ASAN_SHADOW_GRANULARITY == 128) ? 0xff : value; // unaddressable - } else { - // first size-i bytes are addressable - *shadow = poison_partial ? static_cast(size - i) : 0; - } - } -} - -// Calls __sanitizer::ReleaseMemoryPagesToOS() on -// [MemToShadow(p), MemToShadow(p+size)]. -void FlushUnneededASanShadowMemory(uptr p, uptr size); - -} // namespace __asan diff --git a/contrib/libs/clang14-rt/lib/asan/asan_posix.cpp b/contrib/libs/clang14-rt/lib/asan/asan_posix.cpp deleted file mode 100644 index 63ad735f8bba..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_posix.cpp +++ /dev/null @@ -1,145 +0,0 @@ -//===-- asan_posix.cpp ----------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Posix-specific details. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_POSIX - -#include "asan_internal.h" -#include "asan_interceptors.h" -#include "asan_mapping.h" -#include "asan_poisoning.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_posix.h" -#include "sanitizer_common/sanitizer_procmaps.h" - -#include -#include -#include -#include -#include -#include - -namespace __asan { - -void AsanOnDeadlySignal(int signo, void *siginfo, void *context) { - StartReportDeadlySignal(); - SignalContext sig(siginfo, context); - ReportDeadlySignal(sig); -} - -bool PlatformUnpoisonStacks() { - stack_t signal_stack; - CHECK_EQ(0, sigaltstack(nullptr, &signal_stack)); - uptr sigalt_bottom = (uptr)signal_stack.ss_sp; - uptr sigalt_top = (uptr)((char *)signal_stack.ss_sp + signal_stack.ss_size); - // If we're executing on the signal alternate stack AND the Linux flag - // SS_AUTODISARM was used, then we cannot get the signal alternate stack - // bounds from sigaltstack -- sigaltstack's output looks just as if no - // alternate stack has ever been set up. - // We're always unpoisoning the signal alternate stack to support jumping - // between the default stack and signal alternate stack. - if (signal_stack.ss_flags != SS_DISABLE) - UnpoisonStack(sigalt_bottom, sigalt_top, "sigalt"); - - if (signal_stack.ss_flags != SS_ONSTACK) - return false; - - // Since we're on the signal alternate stack, we cannot find the DEFAULT - // stack bottom using a local variable. - uptr default_bottom, tls_addr, tls_size, stack_size; - GetThreadStackAndTls(/*main=*/false, &default_bottom, &stack_size, &tls_addr, - &tls_size); - UnpoisonStack(default_bottom, default_bottom + stack_size, "default"); - return true; -} - -// ---------------------- TSD ---------------- {{{1 - -#if SANITIZER_NETBSD && !ASAN_DYNAMIC -// Thread Static Data cannot be used in early static ASan init on NetBSD. -// Reuse the Asan TSD API for compatibility with existing code -// with an alternative implementation. - -static void (*tsd_destructor)(void *tsd) = nullptr; - -struct tsd_key { - tsd_key() : key(nullptr) {} - ~tsd_key() { - CHECK(tsd_destructor); - if (key) - (*tsd_destructor)(key); - } - void *key; -}; - -static thread_local struct tsd_key key; - -void AsanTSDInit(void (*destructor)(void *tsd)) { - CHECK(!tsd_destructor); - tsd_destructor = destructor; -} - -void *AsanTSDGet() { - CHECK(tsd_destructor); - return key.key; -} - -void AsanTSDSet(void *tsd) { - CHECK(tsd_destructor); - CHECK(tsd); - CHECK(!key.key); - key.key = tsd; -} - -void PlatformTSDDtor(void *tsd) { - CHECK(tsd_destructor); - CHECK_EQ(key.key, tsd); - key.key = nullptr; - // Make sure that signal handler can not see a stale current thread pointer. - atomic_signal_fence(memory_order_seq_cst); - AsanThread::TSDDtor(tsd); -} -#else -static pthread_key_t tsd_key; -static bool tsd_key_inited = false; -void AsanTSDInit(void (*destructor)(void *tsd)) { - CHECK(!tsd_key_inited); - tsd_key_inited = true; - CHECK_EQ(0, pthread_key_create(&tsd_key, destructor)); -} - -void *AsanTSDGet() { - CHECK(tsd_key_inited); - return pthread_getspecific(tsd_key); -} - -void AsanTSDSet(void *tsd) { - CHECK(tsd_key_inited); - pthread_setspecific(tsd_key, tsd); -} - -void PlatformTSDDtor(void *tsd) { - AsanThreadContext *context = (AsanThreadContext*)tsd; - if (context->destructor_iterations > 1) { - context->destructor_iterations--; - CHECK_EQ(0, pthread_setspecific(tsd_key, tsd)); - return; - } - AsanThread::TSDDtor(tsd); -} -#endif -} // namespace __asan - -#endif // SANITIZER_POSIX diff --git a/contrib/libs/clang14-rt/lib/asan/asan_preinit.cpp b/contrib/libs/clang14-rt/lib/asan/asan_preinit.cpp deleted file mode 100644 index b07556ec96f8..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_preinit.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===-- asan_preinit.cpp --------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Call __asan_init at the very early stage of process startup. -//===----------------------------------------------------------------------===// -#include "asan_internal.h" - -using namespace __asan; - -#if SANITIZER_CAN_USE_PREINIT_ARRAY - // The symbol is called __local_asan_preinit, because it's not intended to be - // exported. - // This code linked into the main executable when -fsanitize=address is in - // the link flags. It can only use exported interface functions. - __attribute__((section(".preinit_array"), used)) - void (*__local_asan_preinit)(void) = __asan_init; -#endif diff --git a/contrib/libs/clang14-rt/lib/asan/asan_premap_shadow.cpp b/contrib/libs/clang14-rt/lib/asan/asan_premap_shadow.cpp deleted file mode 100644 index bed2f62a2251..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_premap_shadow.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===-- asan_premap_shadow.cpp --------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Reserve shadow memory with an ifunc resolver. -//===----------------------------------------------------------------------===// - -#include "asan_mapping.h" - -#if ASAN_PREMAP_SHADOW - -#include "asan_premap_shadow.h" -#include "sanitizer_common/sanitizer_posix.h" - -namespace __asan { - -// The code in this file needs to run in an unrelocated binary. It may not -// access any external symbol, including its own non-hidden globals. - -// Conservative upper limit. -uptr PremapShadowSize() { - uptr granularity = GetMmapGranularity(); - return RoundUpTo(GetMaxVirtualAddress() >> ASAN_SHADOW_SCALE, granularity); -} - -// Returns an address aligned to 8 pages, such that one page on the left and -// PremapShadowSize() bytes on the right of it are mapped r/o. -uptr PremapShadow() { - return MapDynamicShadow(PremapShadowSize(), /*mmap_alignment_scale*/ 3, - /*min_shadow_base_alignment*/ 0, kHighMemEnd); -} - -bool PremapShadowFailed() { - uptr shadow = reinterpret_cast(&__asan_shadow); - uptr resolver = reinterpret_cast(&__asan_premap_shadow); - // shadow == resolver is how Android KitKat and older handles ifunc. - // shadow == 0 just in case. - if (shadow == 0 || shadow == resolver) - return true; - return false; -} -} // namespace __asan - -extern "C" { -decltype(__asan_shadow)* __asan_premap_shadow() { - // The resolver may be called multiple times. Map the shadow just once. - static uptr premapped_shadow = 0; - if (!premapped_shadow) premapped_shadow = __asan::PremapShadow(); - return reinterpret_cast(premapped_shadow); -} - -// __asan_shadow is a "function" that has the same address as the first byte of -// the shadow mapping. -INTERFACE_ATTRIBUTE __attribute__((ifunc("__asan_premap_shadow"))) void -__asan_shadow(); -} - -#endif // ASAN_PREMAP_SHADOW diff --git a/contrib/libs/clang14-rt/lib/asan/asan_premap_shadow.h b/contrib/libs/clang14-rt/lib/asan/asan_premap_shadow.h deleted file mode 100644 index c9c886e8dca7..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_premap_shadow.h +++ /dev/null @@ -1,29 +0,0 @@ -//===-- asan_mapping.h ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Premap shadow range with an ifunc resolver. -//===----------------------------------------------------------------------===// - - -#ifndef ASAN_PREMAP_SHADOW_H -#define ASAN_PREMAP_SHADOW_H - -#if ASAN_PREMAP_SHADOW -namespace __asan { -// Conservative upper limit. -uptr PremapShadowSize(); -bool PremapShadowFailed(); -} -#endif - -extern "C" INTERFACE_ATTRIBUTE void __asan_shadow(); -extern "C" decltype(__asan_shadow)* __asan_premap_shadow(); - -#endif // ASAN_PREMAP_SHADOW_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_report.cpp b/contrib/libs/clang14-rt/lib/asan/asan_report.cpp deleted file mode 100644 index 2a38fabaf220..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_report.cpp +++ /dev/null @@ -1,571 +0,0 @@ -//===-- asan_report.cpp ---------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// This file contains error reporting code. -//===----------------------------------------------------------------------===// - -#include "asan_errors.h" -#include "asan_flags.h" -#include "asan_descriptions.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "asan_report.h" -#include "asan_scariness_score.h" -#include "asan_stack.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_report_decorator.h" -#include "sanitizer_common/sanitizer_stackdepot.h" -#include "sanitizer_common/sanitizer_symbolizer.h" - -namespace __asan { - -// -------------------- User-specified callbacks ----------------- {{{1 -static void (*error_report_callback)(const char*); -static char *error_message_buffer = nullptr; -static uptr error_message_buffer_pos = 0; -static Mutex error_message_buf_mutex; -static const unsigned kAsanBuggyPcPoolSize = 25; -static __sanitizer::atomic_uintptr_t AsanBuggyPcPool[kAsanBuggyPcPoolSize]; - -void AppendToErrorMessageBuffer(const char *buffer) { - Lock l(&error_message_buf_mutex); - if (!error_message_buffer) { - error_message_buffer = - (char*)MmapOrDieQuietly(kErrorMessageBufferSize, __func__); - error_message_buffer_pos = 0; - } - uptr length = internal_strlen(buffer); - RAW_CHECK(kErrorMessageBufferSize >= error_message_buffer_pos); - uptr remaining = kErrorMessageBufferSize - error_message_buffer_pos; - internal_strncpy(error_message_buffer + error_message_buffer_pos, - buffer, remaining); - error_message_buffer[kErrorMessageBufferSize - 1] = '\0'; - // FIXME: reallocate the buffer instead of truncating the message. - error_message_buffer_pos += Min(remaining, length); -} - -// ---------------------- Helper functions ----------------------- {{{1 - -void PrintMemoryByte(InternalScopedString *str, const char *before, u8 byte, - bool in_shadow, const char *after) { - Decorator d; - str->append("%s%s%x%x%s%s", before, - in_shadow ? d.ShadowByte(byte) : d.MemoryByte(), byte >> 4, - byte & 15, d.Default(), after); -} - -static void PrintZoneForPointer(uptr ptr, uptr zone_ptr, - const char *zone_name) { - if (zone_ptr) { - if (zone_name) { - Printf("malloc_zone_from_ptr(%p) = %p, which is %s\n", (void *)ptr, - (void *)zone_ptr, zone_name); - } else { - Printf("malloc_zone_from_ptr(%p) = %p, which doesn't have a name\n", - (void *)ptr, (void *)zone_ptr); - } - } else { - Printf("malloc_zone_from_ptr(%p) = 0\n", (void *)ptr); - } -} - -// ---------------------- Address Descriptions ------------------- {{{1 - -bool ParseFrameDescription(const char *frame_descr, - InternalMmapVector *vars) { - CHECK(frame_descr); - const char *p; - // This string is created by the compiler and has the following form: - // "n alloc_1 alloc_2 ... alloc_n" - // where alloc_i looks like "offset size len ObjectName" - // or "offset size len ObjectName:line". - uptr n_objects = (uptr)internal_simple_strtoll(frame_descr, &p, 10); - if (n_objects == 0) - return false; - - for (uptr i = 0; i < n_objects; i++) { - uptr beg = (uptr)internal_simple_strtoll(p, &p, 10); - uptr size = (uptr)internal_simple_strtoll(p, &p, 10); - uptr len = (uptr)internal_simple_strtoll(p, &p, 10); - if (beg == 0 || size == 0 || *p != ' ') { - return false; - } - p++; - char *colon_pos = internal_strchr(p, ':'); - uptr line = 0; - uptr name_len = len; - if (colon_pos != nullptr && colon_pos < p + len) { - name_len = colon_pos - p; - line = (uptr)internal_simple_strtoll(colon_pos + 1, nullptr, 10); - } - StackVarDescr var = {beg, size, p, name_len, line}; - vars->push_back(var); - p += len; - } - - return true; -} - -// -------------------- Different kinds of reports ----------------- {{{1 - -// Use ScopedInErrorReport to run common actions just before and -// immediately after printing error report. -class ScopedInErrorReport { - public: - explicit ScopedInErrorReport(bool fatal = false) - : halt_on_error_(fatal || flags()->halt_on_error) { - // Make sure the registry and sanitizer report mutexes are locked while - // we're printing an error report. - // We can lock them only here to avoid self-deadlock in case of - // recursive reports. - asanThreadRegistry().Lock(); - Printf( - "=================================================================\n"); - } - - ~ScopedInErrorReport() { - if (halt_on_error_ && !__sanitizer_acquire_crash_state()) { - asanThreadRegistry().Unlock(); - return; - } - ASAN_ON_ERROR(); - if (current_error_.IsValid()) current_error_.Print(); - - // Make sure the current thread is announced. - DescribeThread(GetCurrentThread()); - // We may want to grab this lock again when printing stats. - asanThreadRegistry().Unlock(); - // Print memory stats. - if (flags()->print_stats) - __asan_print_accumulated_stats(); - - if (common_flags()->print_cmdline) - PrintCmdline(); - - if (common_flags()->print_module_map == 2) - DumpProcessMap(); - - // Copy the message buffer so that we could start logging without holding a - // lock that gets acquired during printing. - InternalMmapVector buffer_copy(kErrorMessageBufferSize); - { - Lock l(&error_message_buf_mutex); - internal_memcpy(buffer_copy.data(), - error_message_buffer, kErrorMessageBufferSize); - // Clear error_message_buffer so that if we find other errors - // we don't re-log this error. - error_message_buffer_pos = 0; - } - - LogFullErrorReport(buffer_copy.data()); - - if (error_report_callback) { - error_report_callback(buffer_copy.data()); - } - - if (halt_on_error_ && common_flags()->abort_on_error) { - // On Android the message is truncated to 512 characters. - // FIXME: implement "compact" error format, possibly without, or with - // highly compressed stack traces? - // FIXME: or just use the summary line as abort message? - SetAbortMessage(buffer_copy.data()); - } - - // In halt_on_error = false mode, reset the current error object (before - // unlocking). - if (!halt_on_error_) - internal_memset(¤t_error_, 0, sizeof(current_error_)); - - if (halt_on_error_) { - Report("ABORTING\n"); - Die(); - } - } - - void ReportError(const ErrorDescription &description) { - // Can only report one error per ScopedInErrorReport. - CHECK_EQ(current_error_.kind, kErrorKindInvalid); - internal_memcpy(¤t_error_, &description, sizeof(current_error_)); - } - - static ErrorDescription &CurrentError() { - return current_error_; - } - - private: - ScopedErrorReportLock error_report_lock_; - // Error currently being reported. This enables the destructor to interact - // with the debugger and point it to an error description. - static ErrorDescription current_error_; - bool halt_on_error_; -}; - -ErrorDescription ScopedInErrorReport::current_error_(LINKER_INITIALIZED); - -void ReportDeadlySignal(const SignalContext &sig) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorDeadlySignal error(GetCurrentTidOrInvalid(), sig); - in_report.ReportError(error); -} - -void ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack) { - ScopedInErrorReport in_report; - ErrorDoubleFree error(GetCurrentTidOrInvalid(), free_stack, addr); - in_report.ReportError(error); -} - -void ReportNewDeleteTypeMismatch(uptr addr, uptr delete_size, - uptr delete_alignment, - BufferedStackTrace *free_stack) { - ScopedInErrorReport in_report; - ErrorNewDeleteTypeMismatch error(GetCurrentTidOrInvalid(), free_stack, addr, - delete_size, delete_alignment); - in_report.ReportError(error); -} - -void ReportFreeNotMalloced(uptr addr, BufferedStackTrace *free_stack) { - ScopedInErrorReport in_report; - ErrorFreeNotMalloced error(GetCurrentTidOrInvalid(), free_stack, addr); - in_report.ReportError(error); -} - -void ReportAllocTypeMismatch(uptr addr, BufferedStackTrace *free_stack, - AllocType alloc_type, - AllocType dealloc_type) { - ScopedInErrorReport in_report; - ErrorAllocTypeMismatch error(GetCurrentTidOrInvalid(), free_stack, addr, - alloc_type, dealloc_type); - in_report.ReportError(error); -} - -void ReportMallocUsableSizeNotOwned(uptr addr, BufferedStackTrace *stack) { - ScopedInErrorReport in_report; - ErrorMallocUsableSizeNotOwned error(GetCurrentTidOrInvalid(), stack, addr); - in_report.ReportError(error); -} - -void ReportSanitizerGetAllocatedSizeNotOwned(uptr addr, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report; - ErrorSanitizerGetAllocatedSizeNotOwned error(GetCurrentTidOrInvalid(), stack, - addr); - in_report.ReportError(error); -} - -void ReportCallocOverflow(uptr count, uptr size, BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorCallocOverflow error(GetCurrentTidOrInvalid(), stack, count, size); - in_report.ReportError(error); -} - -void ReportReallocArrayOverflow(uptr count, uptr size, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorReallocArrayOverflow error(GetCurrentTidOrInvalid(), stack, count, size); - in_report.ReportError(error); -} - -void ReportPvallocOverflow(uptr size, BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorPvallocOverflow error(GetCurrentTidOrInvalid(), stack, size); - in_report.ReportError(error); -} - -void ReportInvalidAllocationAlignment(uptr alignment, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorInvalidAllocationAlignment error(GetCurrentTidOrInvalid(), stack, - alignment); - in_report.ReportError(error); -} - -void ReportInvalidAlignedAllocAlignment(uptr size, uptr alignment, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorInvalidAlignedAllocAlignment error(GetCurrentTidOrInvalid(), stack, - size, alignment); - in_report.ReportError(error); -} - -void ReportInvalidPosixMemalignAlignment(uptr alignment, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorInvalidPosixMemalignAlignment error(GetCurrentTidOrInvalid(), stack, - alignment); - in_report.ReportError(error); -} - -void ReportAllocationSizeTooBig(uptr user_size, uptr total_size, uptr max_size, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorAllocationSizeTooBig error(GetCurrentTidOrInvalid(), stack, user_size, - total_size, max_size); - in_report.ReportError(error); -} - -void ReportRssLimitExceeded(BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorRssLimitExceeded error(GetCurrentTidOrInvalid(), stack); - in_report.ReportError(error); -} - -void ReportOutOfMemory(uptr requested_size, BufferedStackTrace *stack) { - ScopedInErrorReport in_report(/*fatal*/ true); - ErrorOutOfMemory error(GetCurrentTidOrInvalid(), stack, requested_size); - in_report.ReportError(error); -} - -void ReportStringFunctionMemoryRangesOverlap(const char *function, - const char *offset1, uptr length1, - const char *offset2, uptr length2, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report; - ErrorStringFunctionMemoryRangesOverlap error( - GetCurrentTidOrInvalid(), stack, (uptr)offset1, length1, (uptr)offset2, - length2, function); - in_report.ReportError(error); -} - -void ReportStringFunctionSizeOverflow(uptr offset, uptr size, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report; - ErrorStringFunctionSizeOverflow error(GetCurrentTidOrInvalid(), stack, offset, - size); - in_report.ReportError(error); -} - -void ReportBadParamsToAnnotateContiguousContainer(uptr beg, uptr end, - uptr old_mid, uptr new_mid, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report; - ErrorBadParamsToAnnotateContiguousContainer error( - GetCurrentTidOrInvalid(), stack, beg, end, old_mid, new_mid); - in_report.ReportError(error); -} - -void ReportODRViolation(const __asan_global *g1, u32 stack_id1, - const __asan_global *g2, u32 stack_id2) { - ScopedInErrorReport in_report; - ErrorODRViolation error(GetCurrentTidOrInvalid(), g1, stack_id1, g2, - stack_id2); - in_report.ReportError(error); -} - -// ----------------------- CheckForInvalidPointerPair ----------- {{{1 -static NOINLINE void ReportInvalidPointerPair(uptr pc, uptr bp, uptr sp, - uptr a1, uptr a2) { - ScopedInErrorReport in_report; - ErrorInvalidPointerPair error(GetCurrentTidOrInvalid(), pc, bp, sp, a1, a2); - in_report.ReportError(error); -} - -static bool IsInvalidPointerPair(uptr a1, uptr a2) { - if (a1 == a2) - return false; - - // 256B in shadow memory can be iterated quite fast - static const uptr kMaxOffset = 2048; - - uptr left = a1 < a2 ? a1 : a2; - uptr right = a1 < a2 ? a2 : a1; - uptr offset = right - left; - if (offset <= kMaxOffset) - return __asan_region_is_poisoned(left, offset); - - AsanThread *t = GetCurrentThread(); - - // check whether left is a stack memory pointer - if (uptr shadow_offset1 = t->GetStackVariableShadowStart(left)) { - uptr shadow_offset2 = t->GetStackVariableShadowStart(right); - return shadow_offset2 == 0 || shadow_offset1 != shadow_offset2; - } - - // check whether left is a heap memory address - HeapAddressDescription hdesc1, hdesc2; - if (GetHeapAddressInformation(left, 0, &hdesc1) && - hdesc1.chunk_access.access_type == kAccessTypeInside) - return !GetHeapAddressInformation(right, 0, &hdesc2) || - hdesc2.chunk_access.access_type != kAccessTypeInside || - hdesc1.chunk_access.chunk_begin != hdesc2.chunk_access.chunk_begin; - - // check whether left is an address of a global variable - GlobalAddressDescription gdesc1, gdesc2; - if (GetGlobalAddressInformation(left, 0, &gdesc1)) - return !GetGlobalAddressInformation(right - 1, 0, &gdesc2) || - !gdesc1.PointsInsideTheSameVariable(gdesc2); - - if (t->GetStackVariableShadowStart(right) || - GetHeapAddressInformation(right, 0, &hdesc2) || - GetGlobalAddressInformation(right - 1, 0, &gdesc2)) - return true; - - // At this point we know nothing about both a1 and a2 addresses. - return false; -} - -static inline void CheckForInvalidPointerPair(void *p1, void *p2) { - switch (flags()->detect_invalid_pointer_pairs) { - case 0: - return; - case 1: - if (p1 == nullptr || p2 == nullptr) - return; - break; - } - - uptr a1 = reinterpret_cast(p1); - uptr a2 = reinterpret_cast(p2); - - if (IsInvalidPointerPair(a1, a2)) { - GET_CALLER_PC_BP_SP; - ReportInvalidPointerPair(pc, bp, sp, a1, a2); - } -} -// ----------------------- Mac-specific reports ----------------- {{{1 - -void ReportMacMzReallocUnknown(uptr addr, uptr zone_ptr, const char *zone_name, - BufferedStackTrace *stack) { - ScopedInErrorReport in_report; - Printf( - "mz_realloc(%p) -- attempting to realloc unallocated memory.\n" - "This is an unrecoverable problem, exiting now.\n", - (void *)addr); - PrintZoneForPointer(addr, zone_ptr, zone_name); - stack->Print(); - DescribeAddressIfHeap(addr); -} - -// -------------- SuppressErrorReport -------------- {{{1 -// Avoid error reports duplicating for ASan recover mode. -static bool SuppressErrorReport(uptr pc) { - if (!common_flags()->suppress_equal_pcs) return false; - for (unsigned i = 0; i < kAsanBuggyPcPoolSize; i++) { - uptr cmp = atomic_load_relaxed(&AsanBuggyPcPool[i]); - if (cmp == 0 && atomic_compare_exchange_strong(&AsanBuggyPcPool[i], &cmp, - pc, memory_order_relaxed)) - return false; - if (cmp == pc) return true; - } - Die(); -} - -void ReportGenericError(uptr pc, uptr bp, uptr sp, uptr addr, bool is_write, - uptr access_size, u32 exp, bool fatal) { - if (__asan_test_only_reported_buggy_pointer) { - *__asan_test_only_reported_buggy_pointer = addr; - return; - } - if (!fatal && SuppressErrorReport(pc)) return; - ENABLE_FRAME_POINTER; - - // Optimization experiments. - // The experiments can be used to evaluate potential optimizations that remove - // instrumentation (assess false negatives). Instead of completely removing - // some instrumentation, compiler can emit special calls into runtime - // (e.g. __asan_report_exp_load1 instead of __asan_report_load1) and pass - // mask of experiments (exp). - // The reaction to a non-zero value of exp is to be defined. - (void)exp; - - ScopedInErrorReport in_report(fatal); - ErrorGeneric error(GetCurrentTidOrInvalid(), pc, bp, sp, addr, is_write, - access_size); - in_report.ReportError(error); -} - -} // namespace __asan - -// --------------------------- Interface --------------------- {{{1 -using namespace __asan; - -void __asan_report_error(uptr pc, uptr bp, uptr sp, uptr addr, int is_write, - uptr access_size, u32 exp) { - ENABLE_FRAME_POINTER; - bool fatal = flags()->halt_on_error; - ReportGenericError(pc, bp, sp, addr, is_write, access_size, exp, fatal); -} - -void NOINLINE __asan_set_error_report_callback(void (*callback)(const char*)) { - Lock l(&error_message_buf_mutex); - error_report_callback = callback; -} - -void __asan_describe_address(uptr addr) { - // Thread registry must be locked while we're describing an address. - asanThreadRegistry().Lock(); - PrintAddressDescription(addr, 1, ""); - asanThreadRegistry().Unlock(); -} - -int __asan_report_present() { - return ScopedInErrorReport::CurrentError().kind != kErrorKindInvalid; -} - -uptr __asan_get_report_pc() { - if (ScopedInErrorReport::CurrentError().kind == kErrorKindGeneric) - return ScopedInErrorReport::CurrentError().Generic.pc; - return 0; -} - -uptr __asan_get_report_bp() { - if (ScopedInErrorReport::CurrentError().kind == kErrorKindGeneric) - return ScopedInErrorReport::CurrentError().Generic.bp; - return 0; -} - -uptr __asan_get_report_sp() { - if (ScopedInErrorReport::CurrentError().kind == kErrorKindGeneric) - return ScopedInErrorReport::CurrentError().Generic.sp; - return 0; -} - -uptr __asan_get_report_address() { - ErrorDescription &err = ScopedInErrorReport::CurrentError(); - if (err.kind == kErrorKindGeneric) - return err.Generic.addr_description.Address(); - else if (err.kind == kErrorKindDoubleFree) - return err.DoubleFree.addr_description.addr; - return 0; -} - -int __asan_get_report_access_type() { - if (ScopedInErrorReport::CurrentError().kind == kErrorKindGeneric) - return ScopedInErrorReport::CurrentError().Generic.is_write; - return 0; -} - -uptr __asan_get_report_access_size() { - if (ScopedInErrorReport::CurrentError().kind == kErrorKindGeneric) - return ScopedInErrorReport::CurrentError().Generic.access_size; - return 0; -} - -const char *__asan_get_report_description() { - if (ScopedInErrorReport::CurrentError().kind == kErrorKindGeneric) - return ScopedInErrorReport::CurrentError().Generic.bug_descr; - return ScopedInErrorReport::CurrentError().Base.scariness.GetDescription(); -} - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_ptr_sub(void *a, void *b) { - CheckForInvalidPointerPair(a, b); -} -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_ptr_cmp(void *a, void *b) { - CheckForInvalidPointerPair(a, b); -} -} // extern "C" - -// Provide default implementation of __asan_on_error that does nothing -// and may be overriden by user. -SANITIZER_INTERFACE_WEAK_DEF(void, __asan_on_error, void) {} diff --git a/contrib/libs/clang14-rt/lib/asan/asan_report.h b/contrib/libs/clang14-rt/lib/asan/asan_report.h deleted file mode 100644 index dcf60894ef34..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_report.h +++ /dev/null @@ -1,99 +0,0 @@ -//===-- asan_report.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for error reporting functions. -//===----------------------------------------------------------------------===// - -#ifndef ASAN_REPORT_H -#define ASAN_REPORT_H - -#include "asan_allocator.h" -#include "asan_internal.h" -#include "asan_thread.h" - -namespace __asan { - -struct StackVarDescr { - uptr beg; - uptr size; - const char *name_pos; - uptr name_len; - uptr line; -}; - -// Returns the number of globals close to the provided address and copies -// them to "globals" array. -int GetGlobalsForAddress(uptr addr, __asan_global *globals, u32 *reg_sites, - int max_globals); - -const char *MaybeDemangleGlobalName(const char *name); -void PrintGlobalNameIfASCII(InternalScopedString *str, const __asan_global &g); -void PrintGlobalLocation(InternalScopedString *str, const __asan_global &g); - -void PrintMemoryByte(InternalScopedString *str, const char *before, u8 byte, - bool in_shadow, const char *after = "\n"); - -// The following functions prints address description depending -// on the memory type (shadow/heap/stack/global). -bool ParseFrameDescription(const char *frame_descr, - InternalMmapVector *vars); - -// Different kinds of error reports. -void ReportGenericError(uptr pc, uptr bp, uptr sp, uptr addr, bool is_write, - uptr access_size, u32 exp, bool fatal); -void ReportDeadlySignal(const SignalContext &sig); -void ReportNewDeleteTypeMismatch(uptr addr, uptr delete_size, - uptr delete_alignment, - BufferedStackTrace *free_stack); -void ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack); -void ReportFreeNotMalloced(uptr addr, BufferedStackTrace *free_stack); -void ReportAllocTypeMismatch(uptr addr, BufferedStackTrace *free_stack, - AllocType alloc_type, - AllocType dealloc_type); -void ReportMallocUsableSizeNotOwned(uptr addr, BufferedStackTrace *stack); -void ReportSanitizerGetAllocatedSizeNotOwned(uptr addr, - BufferedStackTrace *stack); -void ReportCallocOverflow(uptr count, uptr size, BufferedStackTrace *stack); -void ReportReallocArrayOverflow(uptr count, uptr size, - BufferedStackTrace *stack); -void ReportPvallocOverflow(uptr size, BufferedStackTrace *stack); -void ReportInvalidAllocationAlignment(uptr alignment, - BufferedStackTrace *stack); -void ReportInvalidAlignedAllocAlignment(uptr size, uptr alignment, - BufferedStackTrace *stack); -void ReportInvalidPosixMemalignAlignment(uptr alignment, - BufferedStackTrace *stack); -void ReportAllocationSizeTooBig(uptr user_size, uptr total_size, uptr max_size, - BufferedStackTrace *stack); -void ReportRssLimitExceeded(BufferedStackTrace *stack); -void ReportOutOfMemory(uptr requested_size, BufferedStackTrace *stack); -void ReportStringFunctionMemoryRangesOverlap(const char *function, - const char *offset1, uptr length1, - const char *offset2, uptr length2, - BufferedStackTrace *stack); -void ReportStringFunctionSizeOverflow(uptr offset, uptr size, - BufferedStackTrace *stack); -void ReportBadParamsToAnnotateContiguousContainer(uptr beg, uptr end, - uptr old_mid, uptr new_mid, - BufferedStackTrace *stack); - -void ReportODRViolation(const __asan_global *g1, u32 stack_id1, - const __asan_global *g2, u32 stack_id2); - -// Mac-specific errors and warnings. -void ReportMacMzReallocUnknown(uptr addr, uptr zone_ptr, - const char *zone_name, - BufferedStackTrace *stack); -void ReportMacCfReallocUnknown(uptr addr, uptr zone_ptr, - const char *zone_name, - BufferedStackTrace *stack); - -} // namespace __asan -#endif // ASAN_REPORT_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_rtl.cpp b/contrib/libs/clang14-rt/lib/asan/asan_rtl.cpp deleted file mode 100644 index f0bbbf32e6a6..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_rtl.cpp +++ /dev/null @@ -1,619 +0,0 @@ -//===-- asan_rtl.cpp ------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Main file of the ASan run-time library. -//===----------------------------------------------------------------------===// - -#include "asan_activation.h" -#include "asan_allocator.h" -#include "asan_fake_stack.h" -#include "asan_interceptors.h" -#include "asan_interface_internal.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "asan_poisoning.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "asan_stats.h" -#include "asan_suppressions.h" -#include "asan_thread.h" -#include "lsan/lsan_common.h" -#include "sanitizer_common/sanitizer_atomic.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_symbolizer.h" -#include "ubsan/ubsan_init.h" -#include "ubsan/ubsan_platform.h" - -uptr __asan_shadow_memory_dynamic_address; // Global interface symbol. -int __asan_option_detect_stack_use_after_return; // Global interface symbol. -uptr *__asan_test_only_reported_buggy_pointer; // Used only for testing asan. - -namespace __asan { - -uptr AsanMappingProfile[kAsanMappingProfileSize]; - -static void AsanDie() { - static atomic_uint32_t num_calls; - if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) { - // Don't die twice - run a busy loop. - while (1) { } - } - if (common_flags()->print_module_map >= 1) - DumpProcessMap(); - if (flags()->sleep_before_dying) { - Report("Sleeping for %d second(s)\n", flags()->sleep_before_dying); - SleepForSeconds(flags()->sleep_before_dying); - } - if (flags()->unmap_shadow_on_exit) { - if (kMidMemBeg) { - UnmapOrDie((void*)kLowShadowBeg, kMidMemBeg - kLowShadowBeg); - UnmapOrDie((void*)kMidMemEnd, kHighShadowEnd - kMidMemEnd); - } else { - if (kHighShadowEnd) - UnmapOrDie((void*)kLowShadowBeg, kHighShadowEnd - kLowShadowBeg); - } - } -} - -static void CheckUnwind() { - GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_check); - stack.Print(); -} - -// -------------------------- Globals --------------------- {{{1 -int asan_inited; -bool asan_init_is_running; - -#if !ASAN_FIXED_MAPPING -uptr kHighMemEnd, kMidMemBeg, kMidMemEnd; -#endif - -// -------------------------- Misc ---------------- {{{1 -void ShowStatsAndAbort() { - __asan_print_accumulated_stats(); - Die(); -} - -NOINLINE -static void ReportGenericErrorWrapper(uptr addr, bool is_write, int size, - int exp_arg, bool fatal) { - GET_CALLER_PC_BP_SP; - ReportGenericError(pc, bp, sp, addr, is_write, size, exp_arg, fatal); -} - -// --------------- LowLevelAllocateCallbac ---------- {{{1 -static void OnLowLevelAllocate(uptr ptr, uptr size) { - PoisonShadow(ptr, size, kAsanInternalHeapMagic); -} - -// -------------------------- Run-time entry ------------------- {{{1 -// exported functions -#define ASAN_REPORT_ERROR(type, is_write, size) \ -extern "C" NOINLINE INTERFACE_ATTRIBUTE \ -void __asan_report_ ## type ## size(uptr addr) { \ - GET_CALLER_PC_BP_SP; \ - ReportGenericError(pc, bp, sp, addr, is_write, size, 0, true); \ -} \ -extern "C" NOINLINE INTERFACE_ATTRIBUTE \ -void __asan_report_exp_ ## type ## size(uptr addr, u32 exp) { \ - GET_CALLER_PC_BP_SP; \ - ReportGenericError(pc, bp, sp, addr, is_write, size, exp, true); \ -} \ -extern "C" NOINLINE INTERFACE_ATTRIBUTE \ -void __asan_report_ ## type ## size ## _noabort(uptr addr) { \ - GET_CALLER_PC_BP_SP; \ - ReportGenericError(pc, bp, sp, addr, is_write, size, 0, false); \ -} \ - -ASAN_REPORT_ERROR(load, false, 1) -ASAN_REPORT_ERROR(load, false, 2) -ASAN_REPORT_ERROR(load, false, 4) -ASAN_REPORT_ERROR(load, false, 8) -ASAN_REPORT_ERROR(load, false, 16) -ASAN_REPORT_ERROR(store, true, 1) -ASAN_REPORT_ERROR(store, true, 2) -ASAN_REPORT_ERROR(store, true, 4) -ASAN_REPORT_ERROR(store, true, 8) -ASAN_REPORT_ERROR(store, true, 16) - -#define ASAN_REPORT_ERROR_N(type, is_write) \ -extern "C" NOINLINE INTERFACE_ATTRIBUTE \ -void __asan_report_ ## type ## _n(uptr addr, uptr size) { \ - GET_CALLER_PC_BP_SP; \ - ReportGenericError(pc, bp, sp, addr, is_write, size, 0, true); \ -} \ -extern "C" NOINLINE INTERFACE_ATTRIBUTE \ -void __asan_report_exp_ ## type ## _n(uptr addr, uptr size, u32 exp) { \ - GET_CALLER_PC_BP_SP; \ - ReportGenericError(pc, bp, sp, addr, is_write, size, exp, true); \ -} \ -extern "C" NOINLINE INTERFACE_ATTRIBUTE \ -void __asan_report_ ## type ## _n_noabort(uptr addr, uptr size) { \ - GET_CALLER_PC_BP_SP; \ - ReportGenericError(pc, bp, sp, addr, is_write, size, 0, false); \ -} \ - -ASAN_REPORT_ERROR_N(load, false) -ASAN_REPORT_ERROR_N(store, true) - -#define ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, exp_arg, fatal) \ - uptr sp = MEM_TO_SHADOW(addr); \ - uptr s = size <= ASAN_SHADOW_GRANULARITY ? *reinterpret_cast(sp) \ - : *reinterpret_cast(sp); \ - if (UNLIKELY(s)) { \ - if (UNLIKELY(size >= ASAN_SHADOW_GRANULARITY || \ - ((s8)((addr & (ASAN_SHADOW_GRANULARITY - 1)) + size - 1)) >= \ - (s8)s)) { \ - ReportGenericErrorWrapper(addr, is_write, size, exp_arg, fatal); \ - } \ - } - -#define ASAN_MEMORY_ACCESS_CALLBACK(type, is_write, size) \ - extern "C" NOINLINE INTERFACE_ATTRIBUTE \ - void __asan_##type##size(uptr addr) { \ - ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, 0, true) \ - } \ - extern "C" NOINLINE INTERFACE_ATTRIBUTE \ - void __asan_exp_##type##size(uptr addr, u32 exp) { \ - ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, exp, true) \ - } \ - extern "C" NOINLINE INTERFACE_ATTRIBUTE \ - void __asan_##type##size ## _noabort(uptr addr) { \ - ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, 0, false) \ - } \ - -ASAN_MEMORY_ACCESS_CALLBACK(load, false, 1) -ASAN_MEMORY_ACCESS_CALLBACK(load, false, 2) -ASAN_MEMORY_ACCESS_CALLBACK(load, false, 4) -ASAN_MEMORY_ACCESS_CALLBACK(load, false, 8) -ASAN_MEMORY_ACCESS_CALLBACK(load, false, 16) -ASAN_MEMORY_ACCESS_CALLBACK(store, true, 1) -ASAN_MEMORY_ACCESS_CALLBACK(store, true, 2) -ASAN_MEMORY_ACCESS_CALLBACK(store, true, 4) -ASAN_MEMORY_ACCESS_CALLBACK(store, true, 8) -ASAN_MEMORY_ACCESS_CALLBACK(store, true, 16) - -extern "C" -NOINLINE INTERFACE_ATTRIBUTE -void __asan_loadN(uptr addr, uptr size) { - if (__asan_region_is_poisoned(addr, size)) { - GET_CALLER_PC_BP_SP; - ReportGenericError(pc, bp, sp, addr, false, size, 0, true); - } -} - -extern "C" -NOINLINE INTERFACE_ATTRIBUTE -void __asan_exp_loadN(uptr addr, uptr size, u32 exp) { - if (__asan_region_is_poisoned(addr, size)) { - GET_CALLER_PC_BP_SP; - ReportGenericError(pc, bp, sp, addr, false, size, exp, true); - } -} - -extern "C" -NOINLINE INTERFACE_ATTRIBUTE -void __asan_loadN_noabort(uptr addr, uptr size) { - if (__asan_region_is_poisoned(addr, size)) { - GET_CALLER_PC_BP_SP; - ReportGenericError(pc, bp, sp, addr, false, size, 0, false); - } -} - -extern "C" -NOINLINE INTERFACE_ATTRIBUTE -void __asan_storeN(uptr addr, uptr size) { - if (__asan_region_is_poisoned(addr, size)) { - GET_CALLER_PC_BP_SP; - ReportGenericError(pc, bp, sp, addr, true, size, 0, true); - } -} - -extern "C" -NOINLINE INTERFACE_ATTRIBUTE -void __asan_exp_storeN(uptr addr, uptr size, u32 exp) { - if (__asan_region_is_poisoned(addr, size)) { - GET_CALLER_PC_BP_SP; - ReportGenericError(pc, bp, sp, addr, true, size, exp, true); - } -} - -extern "C" -NOINLINE INTERFACE_ATTRIBUTE -void __asan_storeN_noabort(uptr addr, uptr size) { - if (__asan_region_is_poisoned(addr, size)) { - GET_CALLER_PC_BP_SP; - ReportGenericError(pc, bp, sp, addr, true, size, 0, false); - } -} - -// Force the linker to keep the symbols for various ASan interface functions. -// We want to keep those in the executable in order to let the instrumented -// dynamic libraries access the symbol even if it is not used by the executable -// itself. This should help if the build system is removing dead code at link -// time. -static NOINLINE void force_interface_symbols() { - volatile int fake_condition = 0; // prevent dead condition elimination. - // __asan_report_* functions are noreturn, so we need a switch to prevent - // the compiler from removing any of them. - // clang-format off - switch (fake_condition) { - case 1: __asan_report_load1(0); break; - case 2: __asan_report_load2(0); break; - case 3: __asan_report_load4(0); break; - case 4: __asan_report_load8(0); break; - case 5: __asan_report_load16(0); break; - case 6: __asan_report_load_n(0, 0); break; - case 7: __asan_report_store1(0); break; - case 8: __asan_report_store2(0); break; - case 9: __asan_report_store4(0); break; - case 10: __asan_report_store8(0); break; - case 11: __asan_report_store16(0); break; - case 12: __asan_report_store_n(0, 0); break; - case 13: __asan_report_exp_load1(0, 0); break; - case 14: __asan_report_exp_load2(0, 0); break; - case 15: __asan_report_exp_load4(0, 0); break; - case 16: __asan_report_exp_load8(0, 0); break; - case 17: __asan_report_exp_load16(0, 0); break; - case 18: __asan_report_exp_load_n(0, 0, 0); break; - case 19: __asan_report_exp_store1(0, 0); break; - case 20: __asan_report_exp_store2(0, 0); break; - case 21: __asan_report_exp_store4(0, 0); break; - case 22: __asan_report_exp_store8(0, 0); break; - case 23: __asan_report_exp_store16(0, 0); break; - case 24: __asan_report_exp_store_n(0, 0, 0); break; - case 25: __asan_register_globals(nullptr, 0); break; - case 26: __asan_unregister_globals(nullptr, 0); break; - case 27: __asan_set_death_callback(nullptr); break; - case 28: __asan_set_error_report_callback(nullptr); break; - case 29: __asan_handle_no_return(); break; - case 30: __asan_address_is_poisoned(nullptr); break; - case 31: __asan_poison_memory_region(nullptr, 0); break; - case 32: __asan_unpoison_memory_region(nullptr, 0); break; - case 34: __asan_before_dynamic_init(nullptr); break; - case 35: __asan_after_dynamic_init(); break; - case 36: __asan_poison_stack_memory(0, 0); break; - case 37: __asan_unpoison_stack_memory(0, 0); break; - case 38: __asan_region_is_poisoned(0, 0); break; - case 39: __asan_describe_address(0); break; - case 40: __asan_set_shadow_00(0, 0); break; - case 41: __asan_set_shadow_f1(0, 0); break; - case 42: __asan_set_shadow_f2(0, 0); break; - case 43: __asan_set_shadow_f3(0, 0); break; - case 44: __asan_set_shadow_f5(0, 0); break; - case 45: __asan_set_shadow_f8(0, 0); break; - } - // clang-format on -} - -static void asan_atexit() { - Printf("AddressSanitizer exit stats:\n"); - __asan_print_accumulated_stats(); - // Print AsanMappingProfile. - for (uptr i = 0; i < kAsanMappingProfileSize; i++) { - if (AsanMappingProfile[i] == 0) continue; - Printf("asan_mapping.h:%zd -- %zd\n", i, AsanMappingProfile[i]); - } -} - -static void InitializeHighMemEnd() { -#if !ASAN_FIXED_MAPPING - kHighMemEnd = GetMaxUserVirtualAddress(); - // Increase kHighMemEnd to make sure it's properly - // aligned together with kHighMemBeg: - kHighMemEnd |= (GetMmapGranularity() << ASAN_SHADOW_SCALE) - 1; -#endif // !ASAN_FIXED_MAPPING - CHECK_EQ((kHighMemBeg % GetMmapGranularity()), 0); -} - -void PrintAddressSpaceLayout() { - if (kHighMemBeg) { - Printf("|| `[%p, %p]` || HighMem ||\n", - (void*)kHighMemBeg, (void*)kHighMemEnd); - Printf("|| `[%p, %p]` || HighShadow ||\n", - (void*)kHighShadowBeg, (void*)kHighShadowEnd); - } - if (kMidMemBeg) { - Printf("|| `[%p, %p]` || ShadowGap3 ||\n", - (void*)kShadowGap3Beg, (void*)kShadowGap3End); - Printf("|| `[%p, %p]` || MidMem ||\n", - (void*)kMidMemBeg, (void*)kMidMemEnd); - Printf("|| `[%p, %p]` || ShadowGap2 ||\n", - (void*)kShadowGap2Beg, (void*)kShadowGap2End); - Printf("|| `[%p, %p]` || MidShadow ||\n", - (void*)kMidShadowBeg, (void*)kMidShadowEnd); - } - Printf("|| `[%p, %p]` || ShadowGap ||\n", - (void*)kShadowGapBeg, (void*)kShadowGapEnd); - if (kLowShadowBeg) { - Printf("|| `[%p, %p]` || LowShadow ||\n", - (void*)kLowShadowBeg, (void*)kLowShadowEnd); - Printf("|| `[%p, %p]` || LowMem ||\n", - (void*)kLowMemBeg, (void*)kLowMemEnd); - } - Printf("MemToShadow(shadow): %p %p", - (void*)MEM_TO_SHADOW(kLowShadowBeg), - (void*)MEM_TO_SHADOW(kLowShadowEnd)); - if (kHighMemBeg) { - Printf(" %p %p", - (void*)MEM_TO_SHADOW(kHighShadowBeg), - (void*)MEM_TO_SHADOW(kHighShadowEnd)); - } - if (kMidMemBeg) { - Printf(" %p %p", - (void*)MEM_TO_SHADOW(kMidShadowBeg), - (void*)MEM_TO_SHADOW(kMidShadowEnd)); - } - Printf("\n"); - Printf("redzone=%zu\n", (uptr)flags()->redzone); - Printf("max_redzone=%zu\n", (uptr)flags()->max_redzone); - Printf("quarantine_size_mb=%zuM\n", (uptr)flags()->quarantine_size_mb); - Printf("thread_local_quarantine_size_kb=%zuK\n", - (uptr)flags()->thread_local_quarantine_size_kb); - Printf("malloc_context_size=%zu\n", - (uptr)common_flags()->malloc_context_size); - - Printf("SHADOW_SCALE: %d\n", (int)ASAN_SHADOW_SCALE); - Printf("SHADOW_GRANULARITY: %d\n", (int)ASAN_SHADOW_GRANULARITY); - Printf("SHADOW_OFFSET: 0x%zx\n", (uptr)ASAN_SHADOW_OFFSET); - CHECK(ASAN_SHADOW_SCALE >= 3 && ASAN_SHADOW_SCALE <= 7); - if (kMidMemBeg) - CHECK(kMidShadowBeg > kLowShadowEnd && - kMidMemBeg > kMidShadowEnd && - kHighShadowBeg > kMidMemEnd); -} - -static void AsanInitInternal() { - if (LIKELY(asan_inited)) return; - SanitizerToolName = "AddressSanitizer"; - CHECK(!asan_init_is_running && "ASan init calls itself!"); - asan_init_is_running = true; - - CacheBinaryName(); - - // Initialize flags. This must be done early, because most of the - // initialization steps look at flags(). - InitializeFlags(); - - // Stop performing init at this point if we are being loaded via - // dlopen() and the platform supports it. - if (SANITIZER_SUPPORTS_INIT_FOR_DLOPEN && UNLIKELY(HandleDlopenInit())) { - asan_init_is_running = false; - VReport(1, "AddressSanitizer init is being performed for dlopen().\n"); - return; - } - - AsanCheckIncompatibleRT(); - AsanCheckDynamicRTPrereqs(); - AvoidCVE_2016_2143(); - - SetCanPoisonMemory(flags()->poison_heap); - SetMallocContextSize(common_flags()->malloc_context_size); - - InitializePlatformExceptionHandlers(); - - InitializeHighMemEnd(); - - // Make sure we are not statically linked. - AsanDoesNotSupportStaticLinkage(); - - // Install tool-specific callbacks in sanitizer_common. - AddDieCallback(AsanDie); - SetCheckUnwindCallback(CheckUnwind); - SetPrintfAndReportCallback(AppendToErrorMessageBuffer); - - __sanitizer_set_report_path(common_flags()->log_path); - - __asan_option_detect_stack_use_after_return = - flags()->detect_stack_use_after_return; - - __sanitizer::InitializePlatformEarly(); - - // Re-exec ourselves if we need to set additional env or command line args. - MaybeReexec(); - - // Setup internal allocator callback. - SetLowLevelAllocateMinAlignment(ASAN_SHADOW_GRANULARITY); - SetLowLevelAllocateCallback(OnLowLevelAllocate); - - InitializeAsanInterceptors(); - CheckASLR(); - - // Enable system log ("adb logcat") on Android. - // Doing this before interceptors are initialized crashes in: - // AsanInitInternal -> android_log_write -> __interceptor_strcmp - AndroidLogInit(); - - ReplaceSystemMalloc(); - - DisableCoreDumperIfNecessary(); - - InitializeShadowMemory(); - - AsanTSDInit(PlatformTSDDtor); - InstallDeadlySignalHandlers(AsanOnDeadlySignal); - - AllocatorOptions allocator_options; - allocator_options.SetFrom(flags(), common_flags()); - InitializeAllocator(allocator_options); - - if (SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL) - MaybeStartBackgroudThread(); - - // On Linux AsanThread::ThreadStart() calls malloc() that's why asan_inited - // should be set to 1 prior to initializing the threads. - asan_inited = 1; - asan_init_is_running = false; - - if (flags()->atexit) - Atexit(asan_atexit); - - InitializeCoverage(common_flags()->coverage, common_flags()->coverage_dir); - - // Now that ASan runtime is (mostly) initialized, deactivate it if - // necessary, so that it can be re-activated when requested. - if (flags()->start_deactivated) - AsanDeactivate(); - - // interceptors - InitTlsSize(); - - // Create main thread. - AsanThread *main_thread = CreateMainThread(); - CHECK_EQ(0, main_thread->tid()); - force_interface_symbols(); // no-op. - SanitizerInitializeUnwinder(); - - if (CAN_SANITIZE_LEAKS) { - __lsan::InitCommonLsan(); - if (common_flags()->detect_leaks && common_flags()->leak_check_at_exit) { - if (flags()->halt_on_error) - Atexit(__lsan::DoLeakCheck); - else - Atexit(__lsan::DoRecoverableLeakCheckVoid); - } - } - -#if CAN_SANITIZE_UB - __ubsan::InitAsPlugin(); -#endif - - InitializeSuppressions(); - - if (CAN_SANITIZE_LEAKS) { - // LateInitialize() calls dlsym, which can allocate an error string buffer - // in the TLS. Let's ignore the allocation to avoid reporting a leak. - __lsan::ScopedInterceptorDisabler disabler; - Symbolizer::LateInitialize(); - } else { - Symbolizer::LateInitialize(); - } - - VReport(1, "AddressSanitizer Init done\n"); - - if (flags()->sleep_after_init) { - Report("Sleeping for %d second(s)\n", flags()->sleep_after_init); - SleepForSeconds(flags()->sleep_after_init); - } -} - -// Initialize as requested from some part of ASan runtime library (interceptors, -// allocator, etc). -void AsanInitFromRtl() { - AsanInitInternal(); -} - -#if ASAN_DYNAMIC -// Initialize runtime in case it's LD_PRELOAD-ed into unsanitized executable -// (and thus normal initializers from .preinit_array or modules haven't run). - -class AsanInitializer { - public: - AsanInitializer() { - AsanInitFromRtl(); - } -}; - -static AsanInitializer asan_initializer; -#endif // ASAN_DYNAMIC - -void UnpoisonStack(uptr bottom, uptr top, const char *type) { - static const uptr kMaxExpectedCleanupSize = 64 << 20; // 64M - if (top - bottom > kMaxExpectedCleanupSize) { - static bool reported_warning = false; - if (reported_warning) - return; - reported_warning = true; - Report( - "WARNING: ASan is ignoring requested __asan_handle_no_return: " - "stack type: %s top: %p; bottom %p; size: %p (%zd)\n" - "False positive error reports may follow\n" - "For details see " - "https://github.com/google/sanitizers/issues/189\n", - type, (void *)top, (void *)bottom, (void *)(top - bottom), - top - bottom); - return; - } - PoisonShadow(bottom, RoundUpTo(top - bottom, ASAN_SHADOW_GRANULARITY), 0); -} - -static void UnpoisonDefaultStack() { - uptr bottom, top; - - if (AsanThread *curr_thread = GetCurrentThread()) { - int local_stack; - const uptr page_size = GetPageSizeCached(); - top = curr_thread->stack_top(); - bottom = ((uptr)&local_stack - page_size) & ~(page_size - 1); - } else { - CHECK(!SANITIZER_FUCHSIA); - // If we haven't seen this thread, try asking the OS for stack bounds. - uptr tls_addr, tls_size, stack_size; - GetThreadStackAndTls(/*main=*/false, &bottom, &stack_size, &tls_addr, - &tls_size); - top = bottom + stack_size; - } - - UnpoisonStack(bottom, top, "default"); -} - -static void UnpoisonFakeStack() { - AsanThread *curr_thread = GetCurrentThread(); - if (!curr_thread) - return; - FakeStack *stack = curr_thread->get_fake_stack(); - if (!stack) - return; - stack->HandleNoReturn(); -} - -} // namespace __asan - -// ---------------------- Interface ---------------- {{{1 -using namespace __asan; - -void NOINLINE __asan_handle_no_return() { - if (asan_init_is_running) - return; - - if (!PlatformUnpoisonStacks()) - UnpoisonDefaultStack(); - - UnpoisonFakeStack(); -} - -extern "C" void *__asan_extra_spill_area() { - AsanThread *t = GetCurrentThread(); - CHECK(t); - return t->extra_spill_area(); -} - -void __asan_handle_vfork(void *sp) { - AsanThread *t = GetCurrentThread(); - CHECK(t); - uptr bottom = t->stack_bottom(); - PoisonShadow(bottom, (uptr)sp - bottom, 0); -} - -void NOINLINE __asan_set_death_callback(void (*callback)(void)) { - SetUserDieCallback(callback); -} - -// Initialize as requested from instrumented application code. -// We use this call as a trigger to wake up ASan from deactivated state. -void __asan_init() { - AsanActivate(); - AsanInitInternal(); -} - -void __asan_version_mismatch_check() { - // Do nothing. -} diff --git a/contrib/libs/clang14-rt/lib/asan/asan_rtl_static.cpp b/contrib/libs/clang14-rt/lib/asan/asan_rtl_static.cpp deleted file mode 100644 index 74e6eb0ddf1c..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_rtl_static.cpp +++ /dev/null @@ -1,15 +0,0 @@ -//===-- asan_static_rtl.cpp -----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Main file of the ASan run-time library. -//===----------------------------------------------------------------------===// - -// This file is empty for now. Main reason to have it is workaround for Windows -// build, which complains because no files are part of the asan_static lib. diff --git a/contrib/libs/clang14-rt/lib/asan/asan_rtl_x86_64.S b/contrib/libs/clang14-rt/lib/asan/asan_rtl_x86_64.S deleted file mode 100644 index d27db745ed67..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_rtl_x86_64.S +++ /dev/null @@ -1,146 +0,0 @@ -#include "asan_mapping.h" -#include "sanitizer_common/sanitizer_asm.h" - -#if defined(__x86_64__) -#include "sanitizer_common/sanitizer_platform.h" - -.section .text -.file "asan_rtl_x86_64.S" - -#define NAME(n, reg, op, s, i) n##_##op##_##i##_##s##_##reg - -#define FNAME(reg, op, s, i) NAME(__asan_check, reg, op, s, i) -#define RLABEL(reg, op, s, i) NAME(.return, reg, op, s, i) -#define CLABEL(reg, op, s, i) NAME(.check, reg, op, s, i) -#define FLABEL(reg, op, s, i) NAME(.fail, reg, op, s, i) - -#define BEGINF(reg, op, s, i) \ -.globl FNAME(reg, op, s, i) ;\ -.hidden FNAME(reg, op, s, i) ;\ -ASM_TYPE_FUNCTION(FNAME(reg, op, s, i)) ;\ -.cfi_startproc ;\ -FNAME(reg, op, s, i): ;\ - -#define ENDF .cfi_endproc ;\ - -// Access check functions for 1,2 and 4 byte types, which require extra checks. -#define ASAN_MEMORY_ACCESS_INITIAL_CHECK_ADD(reg, op, s) \ - mov %##reg,%r10 ;\ - shr $0x3,%r10 ;\ - movsbl ASAN_SHADOW_OFFSET_CONST(%r10),%r10d ;\ - test %r10d,%r10d ;\ - jne CLABEL(reg, op, s, add) ;\ -RLABEL(reg, op, s, add): ;\ - retq ;\ - -#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_1(reg, op, i) \ -CLABEL(reg, op, 1, i): ;\ - push %rcx ;\ - mov %##reg,%rcx ;\ - and $0x7,%ecx ;\ - cmp %r10d,%ecx ;\ - pop %rcx ;\ - jl RLABEL(reg, op, 1, i);\ - mov %##reg,%rdi ;\ - jmp __asan_report_##op##1@PLT ;\ - -#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_2(reg, op, i) \ -CLABEL(reg, op, 2, i): ;\ - push %rcx ;\ - mov %##reg,%rcx ;\ - and $0x7,%ecx ;\ - add $0x1,%ecx ;\ - cmp %r10d,%ecx ;\ - pop %rcx ;\ - jl RLABEL(reg, op, 2, i);\ - mov %##reg,%rdi ;\ - jmp __asan_report_##op##2@PLT ;\ - -#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_4(reg, op, i) \ -CLABEL(reg, op, 4, i): ;\ - push %rcx ;\ - mov %##reg,%rcx ;\ - and $0x7,%ecx ;\ - add $0x3,%ecx ;\ - cmp %r10d,%ecx ;\ - pop %rcx ;\ - jl RLABEL(reg, op, 4, i);\ - mov %##reg,%rdi ;\ - jmp __asan_report_##op##4@PLT ;\ - -#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_1(reg, op) \ -BEGINF(reg, op, 1, add) ;\ - ASAN_MEMORY_ACCESS_INITIAL_CHECK_ADD(reg, op, 1) ;\ - ASAN_MEMORY_ACCESS_EXTRA_CHECK_1(reg, op, add) ;\ -ENDF - -#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_2(reg, op) \ -BEGINF(reg, op, 2, add) ;\ - ASAN_MEMORY_ACCESS_INITIAL_CHECK_ADD(reg, op, 2) ;\ - ASAN_MEMORY_ACCESS_EXTRA_CHECK_2(reg, op, add) ;\ -ENDF - -#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_4(reg, op) \ -BEGINF(reg, op, 4, add) ;\ - ASAN_MEMORY_ACCESS_INITIAL_CHECK_ADD(reg, op, 4) ;\ - ASAN_MEMORY_ACCESS_EXTRA_CHECK_4(reg, op, add) ;\ -ENDF - -// Access check functions for 8 and 16 byte types: no extra checks required. -#define ASAN_MEMORY_ACCESS_CHECK_ADD(reg, op, s, c) \ - mov %##reg,%r10 ;\ - shr $0x3,%r10 ;\ - ##c $0x0,ASAN_SHADOW_OFFSET_CONST(%r10) ;\ - jne FLABEL(reg, op, s, add) ;\ - retq ;\ - -#define ASAN_MEMORY_ACCESS_FAIL(reg, op, s, i) \ -FLABEL(reg, op, s, i): ;\ - mov %##reg,%rdi ;\ - jmp __asan_report_##op##s@PLT;\ - -#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_8(reg, op) \ -BEGINF(reg, op, 8, add) ;\ - ASAN_MEMORY_ACCESS_CHECK_ADD(reg, op, 8, cmpb) ;\ - ASAN_MEMORY_ACCESS_FAIL(reg, op, 8, add) ;\ -ENDF - -#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_16(reg, op) \ -BEGINF(reg, op, 16, add) ;\ - ASAN_MEMORY_ACCESS_CHECK_ADD(reg, op, 16, cmpw) ;\ - ASAN_MEMORY_ACCESS_FAIL(reg, op, 16, add) ;\ -ENDF - -#define ASAN_MEMORY_ACCESS_CALLBACKS_ADD(reg) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_1(reg, load) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_1(reg, store) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_2(reg, load) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_2(reg, store) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_4(reg, load) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_4(reg, store) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_8(reg, load) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_8(reg, store) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_16(reg, load) \ -ASAN_MEMORY_ACCESS_CALLBACK_ADD_16(reg, store) \ - - -// Instantiate all but R10 and R11 callbacks. We are using PLTSafe class with -// the intrinsic, which guarantees that the code generation will never emit -// R10 or R11 callback. -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(RAX) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(RBX) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(RCX) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(RDX) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(RSI) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(RDI) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(RBP) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(R8) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(R9) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(R12) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(R13) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(R14) -ASAN_MEMORY_ACCESS_CALLBACKS_ADD(R15) - -#endif - -NO_EXEC_STACK_DIRECTIVE diff --git a/contrib/libs/clang14-rt/lib/asan/asan_scariness_score.h b/contrib/libs/clang14-rt/lib/asan/asan_scariness_score.h deleted file mode 100644 index 3932973c225e..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_scariness_score.h +++ /dev/null @@ -1,73 +0,0 @@ -//===-- asan_scariness_score.h ----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Compute the level of scariness of the error message. -// Don't expect any deep science here, just a set of heuristics that suggest -// that e.g. 1-byte-read-global-buffer-overflow is less scary than -// 8-byte-write-stack-use-after-return. -// -// Every error report has one or more features, such as memory access size, -// type (read or write), type of accessed memory (e.g. free-d heap, or a global -// redzone), etc. Every such feature has an int score and a string description. -// The overall score is the sum of all feature scores and the description -// is a concatenation of feature descriptions. -// Examples: -// 17 (4-byte-read-heap-buffer-overflow) -// 65 (multi-byte-write-stack-use-after-return) -// 10 (null-deref) -// -//===----------------------------------------------------------------------===// - -#ifndef ASAN_SCARINESS_SCORE_H -#define ASAN_SCARINESS_SCORE_H - -#include "asan_flags.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_libc.h" - -namespace __asan { -struct ScarinessScoreBase { - void Clear() { - descr[0] = 0; - score = 0; - } - void Scare(int add_to_score, const char *reason) { - if (descr[0]) - internal_strlcat(descr, "-", sizeof(descr)); - internal_strlcat(descr, reason, sizeof(descr)); - score += add_to_score; - } - int GetScore() const { return score; } - const char *GetDescription() const { return descr; } - void Print() const { - if (score && flags()->print_scariness) - Printf("SCARINESS: %d (%s)\n", score, descr); - } - static void PrintSimple(int score, const char *descr) { - ScarinessScoreBase SSB; - SSB.Clear(); - SSB.Scare(score, descr); - SSB.Print(); - } - - private: - int score; - char descr[1024]; -}; - -struct ScarinessScore : ScarinessScoreBase { - ScarinessScore() { - Clear(); - } -}; - -} // namespace __asan - -#endif // ASAN_SCARINESS_SCORE_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_shadow_setup.cpp b/contrib/libs/clang14-rt/lib/asan/asan_shadow_setup.cpp deleted file mode 100644 index fc6de39622b5..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_shadow_setup.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===-- asan_shadow_setup.cpp ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Set up the shadow memory. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_platform.h" - -// asan_fuchsia.cpp has their own InitializeShadowMemory implementation. -#if !SANITIZER_FUCHSIA - -# include "asan_internal.h" -# include "asan_mapping.h" - -namespace __asan { - -static void ProtectGap(uptr addr, uptr size) { - if (!flags()->protect_shadow_gap) { - // The shadow gap is unprotected, so there is a chance that someone - // is actually using this memory. Which means it needs a shadow... - uptr GapShadowBeg = RoundDownTo(MEM_TO_SHADOW(addr), GetPageSizeCached()); - uptr GapShadowEnd = - RoundUpTo(MEM_TO_SHADOW(addr + size), GetPageSizeCached()) - 1; - if (Verbosity()) - Printf( - "protect_shadow_gap=0:" - " not protecting shadow gap, allocating gap's shadow\n" - "|| `[%p, %p]` || ShadowGap's shadow ||\n", - (void*)GapShadowBeg, (void*)GapShadowEnd); - ReserveShadowMemoryRange(GapShadowBeg, GapShadowEnd, - "unprotected gap shadow"); - return; - } - __sanitizer::ProtectGap(addr, size, kZeroBaseShadowStart, - kZeroBaseMaxShadowStart); -} - -static void MaybeReportLinuxPIEBug() { -#if SANITIZER_LINUX && \ - (defined(__x86_64__) || defined(__aarch64__) || SANITIZER_RISCV64) - Report("This might be related to ELF_ET_DYN_BASE change in Linux 4.12.\n"); - Report( - "See https://github.com/google/sanitizers/issues/856 for possible " - "workarounds.\n"); -#endif -} - -void InitializeShadowMemory() { - // Set the shadow memory address to uninitialized. - __asan_shadow_memory_dynamic_address = kDefaultShadowSentinel; - - uptr shadow_start = kLowShadowBeg; - // Detect if a dynamic shadow address must used and find a available location - // when necessary. When dynamic address is used, the macro |kLowShadowBeg| - // expands to |__asan_shadow_memory_dynamic_address| which is - // |kDefaultShadowSentinel|. - bool full_shadow_is_available = false; - if (shadow_start == kDefaultShadowSentinel) { - shadow_start = FindDynamicShadowStart(); - if (SANITIZER_LINUX) full_shadow_is_available = true; - } - // Update the shadow memory address (potentially) used by instrumentation. - __asan_shadow_memory_dynamic_address = shadow_start; - - if (kLowShadowBeg) shadow_start -= GetMmapGranularity(); - - if (!full_shadow_is_available) - full_shadow_is_available = - MemoryRangeIsAvailable(shadow_start, kHighShadowEnd); - -#if SANITIZER_LINUX && defined(__x86_64__) && defined(_LP64) && \ - !ASAN_FIXED_MAPPING - if (!full_shadow_is_available) { - kMidMemBeg = kLowMemEnd < 0x3000000000ULL ? 0x3000000000ULL : 0; - kMidMemEnd = kLowMemEnd < 0x3000000000ULL ? 0x4fffffffffULL : 0; - } -#endif - - if (Verbosity()) PrintAddressSpaceLayout(); - - if (full_shadow_is_available) { - // mmap the low shadow plus at least one page at the left. - if (kLowShadowBeg) - ReserveShadowMemoryRange(shadow_start, kLowShadowEnd, "low shadow"); - // mmap the high shadow. - ReserveShadowMemoryRange(kHighShadowBeg, kHighShadowEnd, "high shadow"); - // protect the gap. - ProtectGap(kShadowGapBeg, kShadowGapEnd - kShadowGapBeg + 1); - CHECK_EQ(kShadowGapEnd, kHighShadowBeg - 1); - } else if (kMidMemBeg && - MemoryRangeIsAvailable(shadow_start, kMidMemBeg - 1) && - MemoryRangeIsAvailable(kMidMemEnd + 1, kHighShadowEnd)) { - CHECK(kLowShadowBeg != kLowShadowEnd); - // mmap the low shadow plus at least one page at the left. - ReserveShadowMemoryRange(shadow_start, kLowShadowEnd, "low shadow"); - // mmap the mid shadow. - ReserveShadowMemoryRange(kMidShadowBeg, kMidShadowEnd, "mid shadow"); - // mmap the high shadow. - ReserveShadowMemoryRange(kHighShadowBeg, kHighShadowEnd, "high shadow"); - // protect the gaps. - ProtectGap(kShadowGapBeg, kShadowGapEnd - kShadowGapBeg + 1); - ProtectGap(kShadowGap2Beg, kShadowGap2End - kShadowGap2Beg + 1); - ProtectGap(kShadowGap3Beg, kShadowGap3End - kShadowGap3Beg + 1); - } else { - Report( - "Shadow memory range interleaves with an existing memory mapping. " - "ASan cannot proceed correctly. ABORTING.\n"); - Report("ASan shadow was supposed to be located in the [%p-%p] range.\n", - (void*)shadow_start, (void*)kHighShadowEnd); - MaybeReportLinuxPIEBug(); - DumpProcessMap(); - Die(); - } -} - -} // namespace __asan - -#endif // !SANITIZER_FUCHSIA diff --git a/contrib/libs/clang14-rt/lib/asan/asan_stack.cpp b/contrib/libs/clang14-rt/lib/asan/asan_stack.cpp deleted file mode 100644 index 048295d6928a..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_stack.cpp +++ /dev/null @@ -1,89 +0,0 @@ -//===-- asan_stack.cpp ----------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Code for ASan stack trace. -//===----------------------------------------------------------------------===// -#include "asan_internal.h" -#include "asan_stack.h" -#include "sanitizer_common/sanitizer_atomic.h" - -namespace __asan { - -static atomic_uint32_t malloc_context_size; - -void SetMallocContextSize(u32 size) { - atomic_store(&malloc_context_size, size, memory_order_release); -} - -u32 GetMallocContextSize() { - return atomic_load(&malloc_context_size, memory_order_acquire); -} - -namespace { - -// ScopedUnwinding is a scope for stacktracing member of a context -class ScopedUnwinding { - public: - explicit ScopedUnwinding(AsanThread *t) : thread(t) { - if (thread) { - can_unwind = !thread->isUnwinding(); - thread->setUnwinding(true); - } - } - ~ScopedUnwinding() { - if (thread) - thread->setUnwinding(false); - } - - bool CanUnwind() const { return can_unwind; } - - private: - AsanThread *thread = nullptr; - bool can_unwind = true; -}; - -} // namespace - -} // namespace __asan - -void __sanitizer::BufferedStackTrace::UnwindImpl( - uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) { - using namespace __asan; - size = 0; - if (UNLIKELY(!asan_inited)) - return; - request_fast = StackTrace::WillUseFastUnwind(request_fast); - AsanThread *t = GetCurrentThread(); - ScopedUnwinding unwind_scope(t); - if (!unwind_scope.CanUnwind()) - return; - if (request_fast) { - if (t) { - Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(), - true); - } - return; - } - if (SANITIZER_MIPS && t && - !IsValidFrame(bp, t->stack_top(), t->stack_bottom())) - return; - Unwind(max_depth, pc, bp, context, t ? t->stack_top() : 0, - t ? t->stack_bottom() : 0, false); -} - -// ------------------ Interface -------------- {{{1 - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_print_stack_trace() { - using namespace __asan; - PRINT_CURRENT_STACK(); -} -} // extern "C" diff --git a/contrib/libs/clang14-rt/lib/asan/asan_stack.h b/contrib/libs/clang14-rt/lib/asan/asan_stack.h deleted file mode 100644 index b9575d2f427e..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_stack.h +++ /dev/null @@ -1,71 +0,0 @@ -//===-- asan_stack.h --------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for asan_stack.cpp. -//===----------------------------------------------------------------------===// - -#ifndef ASAN_STACK_H -#define ASAN_STACK_H - -#include "asan_flags.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_stacktrace.h" - -namespace __asan { - -static const u32 kDefaultMallocContextSize = 30; - -void SetMallocContextSize(u32 size); -u32 GetMallocContextSize(); - -} // namespace __asan - -// NOTE: A Rule of thumb is to retrieve stack trace in the interceptors -// as early as possible (in functions exposed to the user), as we generally -// don't want stack trace to contain functions from ASan internals. - -#define GET_STACK_TRACE(max_size, fast) \ - BufferedStackTrace stack; \ - if (max_size <= 2) { \ - stack.size = max_size; \ - if (max_size > 0) { \ - stack.top_frame_bp = GET_CURRENT_FRAME(); \ - stack.trace_buffer[0] = StackTrace::GetCurrentPc(); \ - if (max_size > 1) stack.trace_buffer[1] = GET_CALLER_PC(); \ - } \ - } else { \ - stack.Unwind(StackTrace::GetCurrentPc(), \ - GET_CURRENT_FRAME(), nullptr, fast, max_size); \ - } - -#define GET_STACK_TRACE_FATAL(pc, bp) \ - BufferedStackTrace stack; \ - stack.Unwind(pc, bp, nullptr, \ - common_flags()->fast_unwind_on_fatal) - -#define GET_STACK_TRACE_FATAL_HERE \ - GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal) - -#define GET_STACK_TRACE_THREAD \ - GET_STACK_TRACE(kStackTraceMax, true) - -#define GET_STACK_TRACE_MALLOC \ - GET_STACK_TRACE(GetMallocContextSize(), common_flags()->fast_unwind_on_malloc) - -#define GET_STACK_TRACE_FREE GET_STACK_TRACE_MALLOC - -#define PRINT_CURRENT_STACK() \ - { \ - GET_STACK_TRACE_FATAL_HERE; \ - stack.Print(); \ - } - -#endif // ASAN_STACK_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_stats.cpp b/contrib/libs/clang14-rt/lib/asan/asan_stats.cpp deleted file mode 100644 index 9a715ea76fee..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_stats.cpp +++ /dev/null @@ -1,173 +0,0 @@ -//===-- asan_stats.cpp ----------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Code related to statistics collected by AddressSanitizer. -//===----------------------------------------------------------------------===// -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "asan_stats.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_allocator_interface.h" -#include "sanitizer_common/sanitizer_mutex.h" -#include "sanitizer_common/sanitizer_stackdepot.h" - -namespace __asan { - -AsanStats::AsanStats() { - Clear(); -} - -void AsanStats::Clear() { - CHECK(REAL(memset)); - REAL(memset)(this, 0, sizeof(AsanStats)); -} - -static void PrintMallocStatsArray(const char *prefix, - uptr (&array)[kNumberOfSizeClasses]) { - Printf("%s", prefix); - for (uptr i = 0; i < kNumberOfSizeClasses; i++) { - if (!array[i]) continue; - Printf("%zu:%zu; ", i, array[i]); - } - Printf("\n"); -} - -void AsanStats::Print() { - Printf("Stats: %zuM malloced (%zuM for red zones) by %zu calls\n", - malloced>>20, malloced_redzones>>20, mallocs); - Printf("Stats: %zuM realloced by %zu calls\n", realloced>>20, reallocs); - Printf("Stats: %zuM freed by %zu calls\n", freed>>20, frees); - Printf("Stats: %zuM really freed by %zu calls\n", - really_freed>>20, real_frees); - Printf("Stats: %zuM (%zuM-%zuM) mmaped; %zu maps, %zu unmaps\n", - (mmaped-munmaped)>>20, mmaped>>20, munmaped>>20, - mmaps, munmaps); - - PrintMallocStatsArray(" mallocs by size class: ", malloced_by_size); - Printf("Stats: malloc large: %zu\n", malloc_large); -} - -void AsanStats::MergeFrom(const AsanStats *stats) { - uptr *dst_ptr = reinterpret_cast(this); - const uptr *src_ptr = reinterpret_cast(stats); - uptr num_fields = sizeof(*this) / sizeof(uptr); - for (uptr i = 0; i < num_fields; i++) - dst_ptr[i] += src_ptr[i]; -} - -static Mutex print_lock; - -static AsanStats unknown_thread_stats(LINKER_INITIALIZED); -static AsanStats dead_threads_stats(LINKER_INITIALIZED); -static Mutex dead_threads_stats_lock; -// Required for malloc_zone_statistics() on OS X. This can't be stored in -// per-thread AsanStats. -static uptr max_malloced_memory; - -static void MergeThreadStats(ThreadContextBase *tctx_base, void *arg) { - AsanStats *accumulated_stats = reinterpret_cast(arg); - AsanThreadContext *tctx = static_cast(tctx_base); - if (AsanThread *t = tctx->thread) - accumulated_stats->MergeFrom(&t->stats()); -} - -static void GetAccumulatedStats(AsanStats *stats) { - stats->Clear(); - { - ThreadRegistryLock l(&asanThreadRegistry()); - asanThreadRegistry() - .RunCallbackForEachThreadLocked(MergeThreadStats, stats); - } - stats->MergeFrom(&unknown_thread_stats); - { - Lock lock(&dead_threads_stats_lock); - stats->MergeFrom(&dead_threads_stats); - } - // This is not very accurate: we may miss allocation peaks that happen - // between two updates of accumulated_stats_. For more accurate bookkeeping - // the maximum should be updated on every malloc(), which is unacceptable. - if (max_malloced_memory < stats->malloced) { - max_malloced_memory = stats->malloced; - } -} - -void FlushToDeadThreadStats(AsanStats *stats) { - Lock lock(&dead_threads_stats_lock); - dead_threads_stats.MergeFrom(stats); - stats->Clear(); -} - -void FillMallocStatistics(AsanMallocStats *malloc_stats) { - AsanStats stats; - GetAccumulatedStats(&stats); - malloc_stats->blocks_in_use = stats.mallocs; - malloc_stats->size_in_use = stats.malloced; - malloc_stats->max_size_in_use = max_malloced_memory; - malloc_stats->size_allocated = stats.mmaped; -} - -AsanStats &GetCurrentThreadStats() { - AsanThread *t = GetCurrentThread(); - return (t) ? t->stats() : unknown_thread_stats; -} - -static void PrintAccumulatedStats() { - AsanStats stats; - GetAccumulatedStats(&stats); - // Use lock to keep reports from mixing up. - Lock lock(&print_lock); - stats.Print(); - StackDepotStats stack_depot_stats = StackDepotGetStats(); - Printf("Stats: StackDepot: %zd ids; %zdM allocated\n", - stack_depot_stats.n_uniq_ids, stack_depot_stats.allocated >> 20); - PrintInternalAllocatorStats(); -} - -} // namespace __asan - -// ---------------------- Interface ---------------- {{{1 -using namespace __asan; - -uptr __sanitizer_get_current_allocated_bytes() { - AsanStats stats; - GetAccumulatedStats(&stats); - uptr malloced = stats.malloced; - uptr freed = stats.freed; - // Return sane value if malloced < freed due to racy - // way we update accumulated stats. - return (malloced > freed) ? malloced - freed : 1; -} - -uptr __sanitizer_get_heap_size() { - AsanStats stats; - GetAccumulatedStats(&stats); - return stats.mmaped - stats.munmaped; -} - -uptr __sanitizer_get_free_bytes() { - AsanStats stats; - GetAccumulatedStats(&stats); - uptr total_free = stats.mmaped - - stats.munmaped - + stats.really_freed; - uptr total_used = stats.malloced - + stats.malloced_redzones; - // Return sane value if total_free < total_used due to racy - // way we update accumulated stats. - return (total_free > total_used) ? total_free - total_used : 1; -} - -uptr __sanitizer_get_unmapped_bytes() { - return 0; -} - -void __asan_print_accumulated_stats() { - PrintAccumulatedStats(); -} diff --git a/contrib/libs/clang14-rt/lib/asan/asan_stats.h b/contrib/libs/clang14-rt/lib/asan/asan_stats.h deleted file mode 100644 index d6da6534081f..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_stats.h +++ /dev/null @@ -1,71 +0,0 @@ -//===-- asan_stats.h --------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for statistics. -//===----------------------------------------------------------------------===// -#ifndef ASAN_STATS_H -#define ASAN_STATS_H - -#include "asan_allocator.h" -#include "asan_internal.h" - -namespace __asan { - -// AsanStats struct is NOT thread-safe. -// Each AsanThread has its own AsanStats, which are sometimes flushed -// to the accumulated AsanStats. -struct AsanStats { - // AsanStats must be a struct consisting of uptr fields only. - // When merging two AsanStats structs, we treat them as arrays of uptr. - uptr mallocs; - uptr malloced; - uptr malloced_redzones; - uptr frees; - uptr freed; - uptr real_frees; - uptr really_freed; - uptr reallocs; - uptr realloced; - uptr mmaps; - uptr mmaped; - uptr munmaps; - uptr munmaped; - uptr malloc_large; - uptr malloced_by_size[kNumberOfSizeClasses]; - - // Ctor for global AsanStats (accumulated stats for dead threads). - explicit AsanStats(LinkerInitialized) { } - // Creates empty stats. - AsanStats(); - - void Print(); // Prints formatted stats to stderr. - void Clear(); - void MergeFrom(const AsanStats *stats); -}; - -// Returns stats for GetCurrentThread(), or stats for fake "unknown thread" -// if GetCurrentThread() returns 0. -AsanStats &GetCurrentThreadStats(); -// Flushes a given stats into accumulated stats of dead threads. -void FlushToDeadThreadStats(AsanStats *stats); - -// A cross-platform equivalent of malloc_statistics_t on Mac OS. -struct AsanMallocStats { - uptr blocks_in_use; - uptr size_in_use; - uptr max_size_in_use; - uptr size_allocated; -}; - -void FillMallocStatistics(AsanMallocStats *malloc_stats); - -} // namespace __asan - -#endif // ASAN_STATS_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_suppressions.cpp b/contrib/libs/clang14-rt/lib/asan/asan_suppressions.cpp deleted file mode 100644 index 8cb2c3e3b9b6..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_suppressions.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//===-- asan_suppressions.cpp ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Issue suppression and suppression-related functions. -//===----------------------------------------------------------------------===// - -#include "asan_suppressions.h" - -#include "asan_stack.h" -#include "sanitizer_common/sanitizer_placement_new.h" -#include "sanitizer_common/sanitizer_suppressions.h" -#include "sanitizer_common/sanitizer_symbolizer.h" - -namespace __asan { - -ALIGNED(64) static char suppression_placeholder[sizeof(SuppressionContext)]; -static SuppressionContext *suppression_ctx = nullptr; -static const char kInterceptorName[] = "interceptor_name"; -static const char kInterceptorViaFunction[] = "interceptor_via_fun"; -static const char kInterceptorViaLibrary[] = "interceptor_via_lib"; -static const char kODRViolation[] = "odr_violation"; -static const char *kSuppressionTypes[] = { - kInterceptorName, kInterceptorViaFunction, kInterceptorViaLibrary, - kODRViolation}; - -SANITIZER_INTERFACE_WEAK_DEF(const char *, __asan_default_suppressions, void) { - return ""; -} - -void InitializeSuppressions() { - CHECK_EQ(nullptr, suppression_ctx); - suppression_ctx = new (suppression_placeholder) - SuppressionContext(kSuppressionTypes, ARRAY_SIZE(kSuppressionTypes)); - suppression_ctx->ParseFromFile(flags()->suppressions); - if (&__asan_default_suppressions) - suppression_ctx->Parse(__asan_default_suppressions()); -} - -bool IsInterceptorSuppressed(const char *interceptor_name) { - CHECK(suppression_ctx); - Suppression *s; - // Match "interceptor_name" suppressions. - return suppression_ctx->Match(interceptor_name, kInterceptorName, &s); -} - -bool HaveStackTraceBasedSuppressions() { - CHECK(suppression_ctx); - return suppression_ctx->HasSuppressionType(kInterceptorViaFunction) || - suppression_ctx->HasSuppressionType(kInterceptorViaLibrary); -} - -bool IsODRViolationSuppressed(const char *global_var_name) { - CHECK(suppression_ctx); - Suppression *s; - // Match "odr_violation" suppressions. - return suppression_ctx->Match(global_var_name, kODRViolation, &s); -} - -bool IsStackTraceSuppressed(const StackTrace *stack) { - if (!HaveStackTraceBasedSuppressions()) - return false; - - CHECK(suppression_ctx); - Symbolizer *symbolizer = Symbolizer::GetOrInit(); - Suppression *s; - for (uptr i = 0; i < stack->size && stack->trace[i]; i++) { - uptr addr = stack->trace[i]; - - if (suppression_ctx->HasSuppressionType(kInterceptorViaLibrary)) { - // Match "interceptor_via_lib" suppressions. - if (const char *module_name = symbolizer->GetModuleNameForPc(addr)) - if (suppression_ctx->Match(module_name, kInterceptorViaLibrary, &s)) - return true; - } - - if (suppression_ctx->HasSuppressionType(kInterceptorViaFunction)) { - SymbolizedStack *frames = symbolizer->SymbolizePC(addr); - CHECK(frames); - for (SymbolizedStack *cur = frames; cur; cur = cur->next) { - const char *function_name = cur->info.function; - if (!function_name) { - continue; - } - // Match "interceptor_via_fun" suppressions. - if (suppression_ctx->Match(function_name, kInterceptorViaFunction, - &s)) { - frames->ClearAll(); - return true; - } - } - frames->ClearAll(); - } - } - return false; -} - -} // namespace __asan diff --git a/contrib/libs/clang14-rt/lib/asan/asan_suppressions.h b/contrib/libs/clang14-rt/lib/asan/asan_suppressions.h deleted file mode 100644 index 121d4ddf1875..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_suppressions.h +++ /dev/null @@ -1,29 +0,0 @@ -//===-- asan_suppressions.h -------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for asan_suppressions.cpp. -//===----------------------------------------------------------------------===// -#ifndef ASAN_SUPPRESSIONS_H -#define ASAN_SUPPRESSIONS_H - -#include "asan_internal.h" -#include "sanitizer_common/sanitizer_stacktrace.h" - -namespace __asan { - -void InitializeSuppressions(); -bool IsInterceptorSuppressed(const char *interceptor_name); -bool HaveStackTraceBasedSuppressions(); -bool IsStackTraceSuppressed(const StackTrace *stack); -bool IsODRViolationSuppressed(const char *global_var_name); - -} // namespace __asan - -#endif // ASAN_SUPPRESSIONS_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_thread.cpp b/contrib/libs/clang14-rt/lib/asan/asan_thread.cpp deleted file mode 100644 index 2b06c3c4e7c0..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_thread.cpp +++ /dev/null @@ -1,558 +0,0 @@ -//===-- asan_thread.cpp ---------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Thread-related code. -//===----------------------------------------------------------------------===// -#include "asan_allocator.h" -#include "asan_interceptors.h" -#include "asan_poisoning.h" -#include "asan_stack.h" -#include "asan_thread.h" -#include "asan_mapping.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_placement_new.h" -#include "sanitizer_common/sanitizer_stackdepot.h" -#include "sanitizer_common/sanitizer_tls_get_addr.h" -#include "lsan/lsan_common.h" - -namespace __asan { - -// AsanThreadContext implementation. - -void AsanThreadContext::OnCreated(void *arg) { - CreateThreadContextArgs *args = static_cast(arg); - if (args->stack) - stack_id = StackDepotPut(*args->stack); - thread = args->thread; - thread->set_context(this); -} - -void AsanThreadContext::OnFinished() { - // Drop the link to the AsanThread object. - thread = nullptr; -} - -// MIPS requires aligned address -static ALIGNED(16) char thread_registry_placeholder[sizeof(ThreadRegistry)]; -static ThreadRegistry *asan_thread_registry; - -static Mutex mu_for_thread_context; -static LowLevelAllocator allocator_for_thread_context; - -static ThreadContextBase *GetAsanThreadContext(u32 tid) { - Lock lock(&mu_for_thread_context); - return new(allocator_for_thread_context) AsanThreadContext(tid); -} - -ThreadRegistry &asanThreadRegistry() { - static bool initialized; - // Don't worry about thread_safety - this should be called when there is - // a single thread. - if (!initialized) { - // Never reuse ASan threads: we store pointer to AsanThreadContext - // in TSD and can't reliably tell when no more TSD destructors will - // be called. It would be wrong to reuse AsanThreadContext for another - // thread before all TSD destructors will be called for it. - asan_thread_registry = - new (thread_registry_placeholder) ThreadRegistry(GetAsanThreadContext); - initialized = true; - } - return *asan_thread_registry; -} - -AsanThreadContext *GetThreadContextByTidLocked(u32 tid) { - return static_cast( - asanThreadRegistry().GetThreadLocked(tid)); -} - -// AsanThread implementation. - -AsanThread *AsanThread::Create(thread_callback_t start_routine, void *arg, - u32 parent_tid, StackTrace *stack, - bool detached) { - uptr PageSize = GetPageSizeCached(); - uptr size = RoundUpTo(sizeof(AsanThread), PageSize); - AsanThread *thread = (AsanThread*)MmapOrDie(size, __func__); - thread->start_routine_ = start_routine; - thread->arg_ = arg; - AsanThreadContext::CreateThreadContextArgs args = {thread, stack}; - asanThreadRegistry().CreateThread(0, detached, parent_tid, &args); - - return thread; -} - -void AsanThread::TSDDtor(void *tsd) { - AsanThreadContext *context = (AsanThreadContext*)tsd; - VReport(1, "T%d TSDDtor\n", context->tid); - if (context->thread) - context->thread->Destroy(); -} - -void AsanThread::Destroy() { - int tid = this->tid(); - VReport(1, "T%d exited\n", tid); - - bool was_running = - (asanThreadRegistry().FinishThread(tid) == ThreadStatusRunning); - if (was_running) { - if (AsanThread *thread = GetCurrentThread()) - CHECK_EQ(this, thread); - malloc_storage().CommitBack(); - if (common_flags()->use_sigaltstack) - UnsetAlternateSignalStack(); - FlushToDeadThreadStats(&stats_); - // We also clear the shadow on thread destruction because - // some code may still be executing in later TSD destructors - // and we don't want it to have any poisoned stack. - ClearShadowForThreadStackAndTLS(); - DeleteFakeStack(tid); - } else { - CHECK_NE(this, GetCurrentThread()); - } - uptr size = RoundUpTo(sizeof(AsanThread), GetPageSizeCached()); - UnmapOrDie(this, size); - if (was_running) - DTLS_Destroy(); -} - -void AsanThread::StartSwitchFiber(FakeStack **fake_stack_save, uptr bottom, - uptr size) { - if (atomic_load(&stack_switching_, memory_order_relaxed)) { - Report("ERROR: starting fiber switch while in fiber switch\n"); - Die(); - } - - next_stack_bottom_ = bottom; - next_stack_top_ = bottom + size; - atomic_store(&stack_switching_, 1, memory_order_release); - - FakeStack *current_fake_stack = fake_stack_; - if (fake_stack_save) - *fake_stack_save = fake_stack_; - fake_stack_ = nullptr; - SetTLSFakeStack(nullptr); - // if fake_stack_save is null, the fiber will die, delete the fakestack - if (!fake_stack_save && current_fake_stack) - current_fake_stack->Destroy(this->tid()); -} - -void AsanThread::FinishSwitchFiber(FakeStack *fake_stack_save, - uptr *bottom_old, - uptr *size_old) { - if (!atomic_load(&stack_switching_, memory_order_relaxed)) { - Report("ERROR: finishing a fiber switch that has not started\n"); - Die(); - } - - if (fake_stack_save) { - SetTLSFakeStack(fake_stack_save); - fake_stack_ = fake_stack_save; - } - - if (bottom_old) - *bottom_old = stack_bottom_; - if (size_old) - *size_old = stack_top_ - stack_bottom_; - stack_bottom_ = next_stack_bottom_; - stack_top_ = next_stack_top_; - atomic_store(&stack_switching_, 0, memory_order_release); - next_stack_top_ = 0; - next_stack_bottom_ = 0; -} - -inline AsanThread::StackBounds AsanThread::GetStackBounds() const { - if (!atomic_load(&stack_switching_, memory_order_acquire)) { - // Make sure the stack bounds are fully initialized. - if (stack_bottom_ >= stack_top_) return {0, 0}; - return {stack_bottom_, stack_top_}; - } - char local; - const uptr cur_stack = (uptr)&local; - // Note: need to check next stack first, because FinishSwitchFiber - // may be in process of overwriting stack_top_/bottom_. But in such case - // we are already on the next stack. - if (cur_stack >= next_stack_bottom_ && cur_stack < next_stack_top_) - return {next_stack_bottom_, next_stack_top_}; - return {stack_bottom_, stack_top_}; -} - -uptr AsanThread::stack_top() { - return GetStackBounds().top; -} - -uptr AsanThread::stack_bottom() { - return GetStackBounds().bottom; -} - -uptr AsanThread::stack_size() { - const auto bounds = GetStackBounds(); - return bounds.top - bounds.bottom; -} - -// We want to create the FakeStack lazily on the first use, but not earlier -// than the stack size is known and the procedure has to be async-signal safe. -FakeStack *AsanThread::AsyncSignalSafeLazyInitFakeStack() { - uptr stack_size = this->stack_size(); - if (stack_size == 0) // stack_size is not yet available, don't use FakeStack. - return nullptr; - uptr old_val = 0; - // fake_stack_ has 3 states: - // 0 -- not initialized - // 1 -- being initialized - // ptr -- initialized - // This CAS checks if the state was 0 and if so changes it to state 1, - // if that was successful, it initializes the pointer. - if (atomic_compare_exchange_strong( - reinterpret_cast(&fake_stack_), &old_val, 1UL, - memory_order_relaxed)) { - uptr stack_size_log = Log2(RoundUpToPowerOfTwo(stack_size)); - CHECK_LE(flags()->min_uar_stack_size_log, flags()->max_uar_stack_size_log); - stack_size_log = - Min(stack_size_log, static_cast(flags()->max_uar_stack_size_log)); - stack_size_log = - Max(stack_size_log, static_cast(flags()->min_uar_stack_size_log)); - fake_stack_ = FakeStack::Create(stack_size_log); - DCHECK_EQ(GetCurrentThread(), this); - SetTLSFakeStack(fake_stack_); - return fake_stack_; - } - return nullptr; -} - -void AsanThread::Init(const InitOptions *options) { - DCHECK_NE(tid(), kInvalidTid); - next_stack_top_ = next_stack_bottom_ = 0; - atomic_store(&stack_switching_, false, memory_order_release); - CHECK_EQ(this->stack_size(), 0U); - SetThreadStackAndTls(options); - if (stack_top_ != stack_bottom_) { - CHECK_GT(this->stack_size(), 0U); - CHECK(AddrIsInMem(stack_bottom_)); - CHECK(AddrIsInMem(stack_top_ - 1)); - } - ClearShadowForThreadStackAndTLS(); - fake_stack_ = nullptr; - if (__asan_option_detect_stack_use_after_return && - tid() == GetCurrentTidOrInvalid()) { - // AsyncSignalSafeLazyInitFakeStack makes use of threadlocals and must be - // called from the context of the thread it is initializing, not its parent. - // Most platforms call AsanThread::Init on the newly-spawned thread, but - // Fuchsia calls this function from the parent thread. To support that - // approach, we avoid calling AsyncSignalSafeLazyInitFakeStack here; it will - // be called by the new thread when it first attempts to access the fake - // stack. - AsyncSignalSafeLazyInitFakeStack(); - } - int local = 0; - VReport(1, "T%d: stack [%p,%p) size 0x%zx; local=%p\n", tid(), - (void *)stack_bottom_, (void *)stack_top_, stack_top_ - stack_bottom_, - (void *)&local); -} - -// Fuchsia doesn't use ThreadStart. -// asan_fuchsia.c definies CreateMainThread and SetThreadStackAndTls. -#if !SANITIZER_FUCHSIA - -thread_return_t AsanThread::ThreadStart(tid_t os_id) { - Init(); - asanThreadRegistry().StartThread(tid(), os_id, ThreadType::Regular, nullptr); - - if (common_flags()->use_sigaltstack) SetAlternateSignalStack(); - - if (!start_routine_) { - // start_routine_ == 0 if we're on the main thread or on one of the - // OS X libdispatch worker threads. But nobody is supposed to call - // ThreadStart() for the worker threads. - CHECK_EQ(tid(), 0); - return 0; - } - - thread_return_t res = start_routine_(arg_); - - // On POSIX systems we defer this to the TSD destructor. LSan will consider - // the thread's memory as non-live from the moment we call Destroy(), even - // though that memory might contain pointers to heap objects which will be - // cleaned up by a user-defined TSD destructor. Thus, calling Destroy() before - // the TSD destructors have run might cause false positives in LSan. - if (!SANITIZER_POSIX) - this->Destroy(); - - return res; -} - -AsanThread *CreateMainThread() { - AsanThread *main_thread = AsanThread::Create( - /* start_routine */ nullptr, /* arg */ nullptr, /* parent_tid */ kMainTid, - /* stack */ nullptr, /* detached */ true); - SetCurrentThread(main_thread); - main_thread->ThreadStart(internal_getpid()); - return main_thread; -} - -// This implementation doesn't use the argument, which is just passed down -// from the caller of Init (which see, above). It's only there to support -// OS-specific implementations that need more information passed through. -void AsanThread::SetThreadStackAndTls(const InitOptions *options) { - DCHECK_EQ(options, nullptr); - uptr tls_size = 0; - uptr stack_size = 0; - GetThreadStackAndTls(tid() == kMainTid, &stack_bottom_, &stack_size, - &tls_begin_, &tls_size); - stack_top_ = RoundDownTo(stack_bottom_ + stack_size, ASAN_SHADOW_GRANULARITY); - tls_end_ = tls_begin_ + tls_size; - dtls_ = DTLS_Get(); - - if (stack_top_ != stack_bottom_) { - int local; - CHECK(AddrIsInStack((uptr)&local)); - } -} - -#endif // !SANITIZER_FUCHSIA - -void AsanThread::ClearShadowForThreadStackAndTLS() { - if (stack_top_ != stack_bottom_) - PoisonShadow(stack_bottom_, stack_top_ - stack_bottom_, 0); - if (tls_begin_ != tls_end_) { - uptr tls_begin_aligned = RoundDownTo(tls_begin_, ASAN_SHADOW_GRANULARITY); - uptr tls_end_aligned = RoundUpTo(tls_end_, ASAN_SHADOW_GRANULARITY); - FastPoisonShadowPartialRightRedzone(tls_begin_aligned, - tls_end_ - tls_begin_aligned, - tls_end_aligned - tls_end_, 0); - } -} - -bool AsanThread::GetStackFrameAccessByAddr(uptr addr, - StackFrameAccess *access) { - if (stack_top_ == stack_bottom_) - return false; - - uptr bottom = 0; - if (AddrIsInStack(addr)) { - bottom = stack_bottom(); - } else if (FakeStack *fake_stack = get_fake_stack()) { - bottom = fake_stack->AddrIsInFakeStack(addr); - CHECK(bottom); - access->offset = addr - bottom; - access->frame_pc = ((uptr*)bottom)[2]; - access->frame_descr = (const char *)((uptr*)bottom)[1]; - return true; - } - uptr aligned_addr = RoundDownTo(addr, SANITIZER_WORDSIZE / 8); // align addr. - uptr mem_ptr = RoundDownTo(aligned_addr, ASAN_SHADOW_GRANULARITY); - u8 *shadow_ptr = (u8*)MemToShadow(aligned_addr); - u8 *shadow_bottom = (u8*)MemToShadow(bottom); - - while (shadow_ptr >= shadow_bottom && - *shadow_ptr != kAsanStackLeftRedzoneMagic) { - shadow_ptr--; - mem_ptr -= ASAN_SHADOW_GRANULARITY; - } - - while (shadow_ptr >= shadow_bottom && - *shadow_ptr == kAsanStackLeftRedzoneMagic) { - shadow_ptr--; - mem_ptr -= ASAN_SHADOW_GRANULARITY; - } - - if (shadow_ptr < shadow_bottom) { - return false; - } - - uptr *ptr = (uptr *)(mem_ptr + ASAN_SHADOW_GRANULARITY); - CHECK(ptr[0] == kCurrentStackFrameMagic); - access->offset = addr - (uptr)ptr; - access->frame_pc = ptr[2]; - access->frame_descr = (const char*)ptr[1]; - return true; -} - -uptr AsanThread::GetStackVariableShadowStart(uptr addr) { - uptr bottom = 0; - if (AddrIsInStack(addr)) { - bottom = stack_bottom(); - } else if (FakeStack *fake_stack = get_fake_stack()) { - bottom = fake_stack->AddrIsInFakeStack(addr); - if (bottom == 0) { - return 0; - } - } else { - return 0; - } - - uptr aligned_addr = RoundDownTo(addr, SANITIZER_WORDSIZE / 8); // align addr. - u8 *shadow_ptr = (u8*)MemToShadow(aligned_addr); - u8 *shadow_bottom = (u8*)MemToShadow(bottom); - - while (shadow_ptr >= shadow_bottom && - (*shadow_ptr != kAsanStackLeftRedzoneMagic && - *shadow_ptr != kAsanStackMidRedzoneMagic && - *shadow_ptr != kAsanStackRightRedzoneMagic)) - shadow_ptr--; - - return (uptr)shadow_ptr + 1; -} - -bool AsanThread::AddrIsInStack(uptr addr) { - const auto bounds = GetStackBounds(); - return addr >= bounds.bottom && addr < bounds.top; -} - -static bool ThreadStackContainsAddress(ThreadContextBase *tctx_base, - void *addr) { - AsanThreadContext *tctx = static_cast(tctx_base); - AsanThread *t = tctx->thread; - if (!t) - return false; - if (t->AddrIsInStack((uptr)addr)) - return true; - FakeStack *fake_stack = t->get_fake_stack(); - if (!fake_stack) - return false; - return fake_stack->AddrIsInFakeStack((uptr)addr); -} - -AsanThread *GetCurrentThread() { - AsanThreadContext *context = - reinterpret_cast(AsanTSDGet()); - if (!context) { - if (SANITIZER_ANDROID) { - // On Android, libc constructor is called _after_ asan_init, and cleans up - // TSD. Try to figure out if this is still the main thread by the stack - // address. We are not entirely sure that we have correct main thread - // limits, so only do this magic on Android, and only if the found thread - // is the main thread. - AsanThreadContext *tctx = GetThreadContextByTidLocked(kMainTid); - if (tctx && ThreadStackContainsAddress(tctx, &context)) { - SetCurrentThread(tctx->thread); - return tctx->thread; - } - } - return nullptr; - } - return context->thread; -} - -void SetCurrentThread(AsanThread *t) { - CHECK(t->context()); - VReport(2, "SetCurrentThread: %p for thread %p\n", (void *)t->context(), - (void *)GetThreadSelf()); - // Make sure we do not reset the current AsanThread. - CHECK_EQ(0, AsanTSDGet()); - AsanTSDSet(t->context()); - CHECK_EQ(t->context(), AsanTSDGet()); -} - -u32 GetCurrentTidOrInvalid() { - AsanThread *t = GetCurrentThread(); - return t ? t->tid() : kInvalidTid; -} - -AsanThread *FindThreadByStackAddress(uptr addr) { - asanThreadRegistry().CheckLocked(); - AsanThreadContext *tctx = static_cast( - asanThreadRegistry().FindThreadContextLocked(ThreadStackContainsAddress, - (void *)addr)); - return tctx ? tctx->thread : nullptr; -} - -void EnsureMainThreadIDIsCorrect() { - AsanThreadContext *context = - reinterpret_cast(AsanTSDGet()); - if (context && (context->tid == kMainTid)) - context->os_id = GetTid(); -} - -__asan::AsanThread *GetAsanThreadByOsIDLocked(tid_t os_id) { - __asan::AsanThreadContext *context = static_cast<__asan::AsanThreadContext *>( - __asan::asanThreadRegistry().FindThreadContextByOsIDLocked(os_id)); - if (!context) return nullptr; - return context->thread; -} -} // namespace __asan - -// --- Implementation of LSan-specific functions --- {{{1 -namespace __lsan { -bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end, - uptr *tls_begin, uptr *tls_end, uptr *cache_begin, - uptr *cache_end, DTLS **dtls) { - __asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id); - if (!t) return false; - *stack_begin = t->stack_bottom(); - *stack_end = t->stack_top(); - *tls_begin = t->tls_begin(); - *tls_end = t->tls_end(); - // ASan doesn't keep allocator caches in TLS, so these are unused. - *cache_begin = 0; - *cache_end = 0; - *dtls = t->dtls(); - return true; -} - -void GetAllThreadAllocatorCachesLocked(InternalMmapVector *caches) {} - -void ForEachExtraStackRange(tid_t os_id, RangeIteratorCallback callback, - void *arg) { - __asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id); - if (!t) - return; - __asan::FakeStack *fake_stack = t->get_fake_stack(); - if (!fake_stack) - return; - fake_stack->ForEachFakeFrame(callback, arg); -} - -void LockThreadRegistry() { - __asan::asanThreadRegistry().Lock(); -} - -void UnlockThreadRegistry() { - __asan::asanThreadRegistry().Unlock(); -} - -ThreadRegistry *GetThreadRegistryLocked() { - __asan::asanThreadRegistry().CheckLocked(); - return &__asan::asanThreadRegistry(); -} - -void EnsureMainThreadIDIsCorrect() { - __asan::EnsureMainThreadIDIsCorrect(); -} -} // namespace __lsan - -// ---------------------- Interface ---------------- {{{1 -using namespace __asan; - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_start_switch_fiber(void **fakestacksave, const void *bottom, - uptr size) { - AsanThread *t = GetCurrentThread(); - if (!t) { - VReport(1, "__asan_start_switch_fiber called from unknown thread\n"); - return; - } - t->StartSwitchFiber((FakeStack**)fakestacksave, (uptr)bottom, size); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_finish_switch_fiber(void* fakestack, - const void **bottom_old, - uptr *size_old) { - AsanThread *t = GetCurrentThread(); - if (!t) { - VReport(1, "__asan_finish_switch_fiber called from unknown thread\n"); - return; - } - t->FinishSwitchFiber((FakeStack*)fakestack, - (uptr*)bottom_old, - (uptr*)size_old); -} -} diff --git a/contrib/libs/clang14-rt/lib/asan/asan_thread.h b/contrib/libs/clang14-rt/lib/asan/asan_thread.h deleted file mode 100644 index 801a3960ec6c..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_thread.h +++ /dev/null @@ -1,188 +0,0 @@ -//===-- asan_thread.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// ASan-private header for asan_thread.cpp. -//===----------------------------------------------------------------------===// - -#ifndef ASAN_THREAD_H -#define ASAN_THREAD_H - -#include "asan_allocator.h" -#include "asan_internal.h" -#include "asan_fake_stack.h" -#include "asan_stats.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_thread_registry.h" - -namespace __sanitizer { -struct DTLS; -} // namespace __sanitizer - -namespace __asan { - -class AsanThread; - -// These objects are created for every thread and are never deleted, -// so we can find them by tid even if the thread is long dead. -class AsanThreadContext final : public ThreadContextBase { - public: - explicit AsanThreadContext(int tid) - : ThreadContextBase(tid), announced(false), - destructor_iterations(GetPthreadDestructorIterations()), stack_id(0), - thread(nullptr) {} - bool announced; - u8 destructor_iterations; - u32 stack_id; - AsanThread *thread; - - void OnCreated(void *arg) override; - void OnFinished() override; - - struct CreateThreadContextArgs { - AsanThread *thread; - StackTrace *stack; - }; -}; - -// AsanThreadContext objects are never freed, so we need many of them. -COMPILER_CHECK(sizeof(AsanThreadContext) <= 256); - -// AsanThread are stored in TSD and destroyed when the thread dies. -class AsanThread { - public: - static AsanThread *Create(thread_callback_t start_routine, void *arg, - u32 parent_tid, StackTrace *stack, bool detached); - static void TSDDtor(void *tsd); - void Destroy(); - - struct InitOptions; - void Init(const InitOptions *options = nullptr); - - thread_return_t ThreadStart(tid_t os_id); - - uptr stack_top(); - uptr stack_bottom(); - uptr stack_size(); - uptr tls_begin() { return tls_begin_; } - uptr tls_end() { return tls_end_; } - DTLS *dtls() { return dtls_; } - u32 tid() { return context_->tid; } - AsanThreadContext *context() { return context_; } - void set_context(AsanThreadContext *context) { context_ = context; } - - struct StackFrameAccess { - uptr offset; - uptr frame_pc; - const char *frame_descr; - }; - bool GetStackFrameAccessByAddr(uptr addr, StackFrameAccess *access); - - // Returns a pointer to the start of the stack variable's shadow memory. - uptr GetStackVariableShadowStart(uptr addr); - - bool AddrIsInStack(uptr addr); - - void DeleteFakeStack(int tid) { - if (!fake_stack_) return; - FakeStack *t = fake_stack_; - fake_stack_ = nullptr; - SetTLSFakeStack(nullptr); - t->Destroy(tid); - } - - void StartSwitchFiber(FakeStack **fake_stack_save, uptr bottom, uptr size); - void FinishSwitchFiber(FakeStack *fake_stack_save, uptr *bottom_old, - uptr *size_old); - - FakeStack *get_fake_stack() { - if (atomic_load(&stack_switching_, memory_order_relaxed)) - return nullptr; - if (reinterpret_cast(fake_stack_) <= 1) - return nullptr; - return fake_stack_; - } - - FakeStack *get_or_create_fake_stack() { - if (atomic_load(&stack_switching_, memory_order_relaxed)) - return nullptr; - if (reinterpret_cast(fake_stack_) <= 1) - return AsyncSignalSafeLazyInitFakeStack(); - return fake_stack_; - } - - // True is this thread is currently unwinding stack (i.e. collecting a stack - // trace). Used to prevent deadlocks on platforms where libc unwinder calls - // malloc internally. See PR17116 for more details. - bool isUnwinding() const { return unwinding_; } - void setUnwinding(bool b) { unwinding_ = b; } - - AsanThreadLocalMallocStorage &malloc_storage() { return malloc_storage_; } - AsanStats &stats() { return stats_; } - - void *extra_spill_area() { return &extra_spill_area_; } - - void *get_arg() { return arg_; } - - private: - // NOTE: There is no AsanThread constructor. It is allocated - // via mmap() and *must* be valid in zero-initialized state. - - void SetThreadStackAndTls(const InitOptions *options); - - void ClearShadowForThreadStackAndTLS(); - FakeStack *AsyncSignalSafeLazyInitFakeStack(); - - struct StackBounds { - uptr bottom; - uptr top; - }; - StackBounds GetStackBounds() const; - - AsanThreadContext *context_; - thread_callback_t start_routine_; - void *arg_; - - uptr stack_top_; - uptr stack_bottom_; - // these variables are used when the thread is about to switch stack - uptr next_stack_top_; - uptr next_stack_bottom_; - // true if switching is in progress - atomic_uint8_t stack_switching_; - - uptr tls_begin_; - uptr tls_end_; - DTLS *dtls_; - - FakeStack *fake_stack_; - AsanThreadLocalMallocStorage malloc_storage_; - AsanStats stats_; - bool unwinding_; - uptr extra_spill_area_; -}; - -// Returns a single instance of registry. -ThreadRegistry &asanThreadRegistry(); - -// Must be called under ThreadRegistryLock. -AsanThreadContext *GetThreadContextByTidLocked(u32 tid); - -// Get the current thread. May return 0. -AsanThread *GetCurrentThread(); -void SetCurrentThread(AsanThread *t); -u32 GetCurrentTidOrInvalid(); -AsanThread *FindThreadByStackAddress(uptr addr); - -// Used to handle fork(). -void EnsureMainThreadIDIsCorrect(); -} // namespace __asan - -#endif // ASAN_THREAD_H diff --git a/contrib/libs/clang14-rt/lib/asan/asan_win.cpp b/contrib/libs/clang14-rt/lib/asan/asan_win.cpp deleted file mode 100644 index 53a0e3bfd385..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/asan_win.cpp +++ /dev/null @@ -1,402 +0,0 @@ -//===-- asan_win.cpp ------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Windows-specific details. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include - -#include - -#include "asan_interceptors.h" -#include "asan_internal.h" -#include "asan_mapping.h" -#include "asan_report.h" -#include "asan_stack.h" -#include "asan_thread.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_mutex.h" -#include "sanitizer_common/sanitizer_win.h" -#include "sanitizer_common/sanitizer_win_defs.h" - -using namespace __asan; - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -int __asan_should_detect_stack_use_after_return() { - __asan_init(); - return __asan_option_detect_stack_use_after_return; -} - -SANITIZER_INTERFACE_ATTRIBUTE -uptr __asan_get_shadow_memory_dynamic_address() { - __asan_init(); - return __asan_shadow_memory_dynamic_address; -} -} // extern "C" - -// ---------------------- Windows-specific interceptors ---------------- {{{ -static LPTOP_LEVEL_EXCEPTION_FILTER default_seh_handler; -static LPTOP_LEVEL_EXCEPTION_FILTER user_seh_handler; - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -long __asan_unhandled_exception_filter(EXCEPTION_POINTERS *info) { - EXCEPTION_RECORD *exception_record = info->ExceptionRecord; - CONTEXT *context = info->ContextRecord; - - // FIXME: Handle EXCEPTION_STACK_OVERFLOW here. - - SignalContext sig(exception_record, context); - ReportDeadlySignal(sig); - UNREACHABLE("returned from reporting deadly signal"); -} - -// Wrapper SEH Handler. If the exception should be handled by asan, we call -// __asan_unhandled_exception_filter, otherwise, we execute the user provided -// exception handler or the default. -static long WINAPI SEHHandler(EXCEPTION_POINTERS *info) { - DWORD exception_code = info->ExceptionRecord->ExceptionCode; - if (__sanitizer::IsHandledDeadlyException(exception_code)) - return __asan_unhandled_exception_filter(info); - if (user_seh_handler) - return user_seh_handler(info); - // Bubble out to the default exception filter. - if (default_seh_handler) - return default_seh_handler(info); - return EXCEPTION_CONTINUE_SEARCH; -} - -INTERCEPTOR_WINAPI(LPTOP_LEVEL_EXCEPTION_FILTER, SetUnhandledExceptionFilter, - LPTOP_LEVEL_EXCEPTION_FILTER ExceptionFilter) { - CHECK(REAL(SetUnhandledExceptionFilter)); - if (ExceptionFilter == &SEHHandler) - return REAL(SetUnhandledExceptionFilter)(ExceptionFilter); - // We record the user provided exception handler to be called for all the - // exceptions unhandled by asan. - Swap(ExceptionFilter, user_seh_handler); - return ExceptionFilter; -} - -INTERCEPTOR_WINAPI(void, RtlRaiseException, EXCEPTION_RECORD *ExceptionRecord) { - CHECK(REAL(RtlRaiseException)); - // This is a noreturn function, unless it's one of the exceptions raised to - // communicate with the debugger, such as the one from OutputDebugString. - if (ExceptionRecord->ExceptionCode != DBG_PRINTEXCEPTION_C) - __asan_handle_no_return(); - REAL(RtlRaiseException)(ExceptionRecord); -} - -INTERCEPTOR_WINAPI(void, RaiseException, void *a, void *b, void *c, void *d) { - CHECK(REAL(RaiseException)); - __asan_handle_no_return(); - REAL(RaiseException)(a, b, c, d); -} - -#ifdef _WIN64 - -INTERCEPTOR_WINAPI(EXCEPTION_DISPOSITION, __C_specific_handler, - _EXCEPTION_RECORD *a, void *b, _CONTEXT *c, - _DISPATCHER_CONTEXT *d) { - CHECK(REAL(__C_specific_handler)); - __asan_handle_no_return(); - return REAL(__C_specific_handler)(a, b, c, d); -} - -#else - -INTERCEPTOR(int, _except_handler3, void *a, void *b, void *c, void *d) { - CHECK(REAL(_except_handler3)); - __asan_handle_no_return(); - return REAL(_except_handler3)(a, b, c, d); -} - -#if ASAN_DYNAMIC -// This handler is named differently in -MT and -MD CRTs. -#define _except_handler4 _except_handler4_common -#endif -INTERCEPTOR(int, _except_handler4, void *a, void *b, void *c, void *d) { - CHECK(REAL(_except_handler4)); - __asan_handle_no_return(); - return REAL(_except_handler4)(a, b, c, d); -} -#endif - -static thread_return_t THREAD_CALLING_CONV asan_thread_start(void *arg) { - AsanThread *t = (AsanThread *)arg; - SetCurrentThread(t); - return t->ThreadStart(GetTid()); -} - -INTERCEPTOR_WINAPI(HANDLE, CreateThread, LPSECURITY_ATTRIBUTES security, - SIZE_T stack_size, LPTHREAD_START_ROUTINE start_routine, - void *arg, DWORD thr_flags, DWORD *tid) { - // Strict init-order checking is thread-hostile. - if (flags()->strict_init_order) - StopInitOrderChecking(); - GET_STACK_TRACE_THREAD; - // FIXME: The CreateThread interceptor is not the same as a pthread_create - // one. This is a bandaid fix for PR22025. - bool detached = false; // FIXME: how can we determine it on Windows? - u32 current_tid = GetCurrentTidOrInvalid(); - AsanThread *t = - AsanThread::Create(start_routine, arg, current_tid, &stack, detached); - return REAL(CreateThread)(security, stack_size, asan_thread_start, t, - thr_flags, tid); -} - -// }}} - -namespace __asan { - -void InitializePlatformInterceptors() { - // The interceptors were not designed to be removable, so we have to keep this - // module alive for the life of the process. - HMODULE pinned; - CHECK(GetModuleHandleExW( - GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN, - (LPCWSTR)&InitializePlatformInterceptors, &pinned)); - - ASAN_INTERCEPT_FUNC(CreateThread); - ASAN_INTERCEPT_FUNC(SetUnhandledExceptionFilter); - -#ifdef _WIN64 - ASAN_INTERCEPT_FUNC(__C_specific_handler); -#else - ASAN_INTERCEPT_FUNC(_except_handler3); - ASAN_INTERCEPT_FUNC(_except_handler4); -#endif - - // Try to intercept kernel32!RaiseException, and if that fails, intercept - // ntdll!RtlRaiseException instead. - if (!::__interception::OverrideFunction("RaiseException", - (uptr)WRAP(RaiseException), - (uptr *)&REAL(RaiseException))) { - CHECK(::__interception::OverrideFunction("RtlRaiseException", - (uptr)WRAP(RtlRaiseException), - (uptr *)&REAL(RtlRaiseException))); - } -} - -void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { - UNIMPLEMENTED(); -} - -void FlushUnneededASanShadowMemory(uptr p, uptr size) { - // Since asan's mapping is compacting, the shadow chunk may be - // not page-aligned, so we only flush the page-aligned portion. - ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size)); -} - -// ---------------------- TSD ---------------- {{{ -static bool tsd_key_inited = false; - -static __declspec(thread) void *fake_tsd = 0; - -// https://docs.microsoft.com/en-us/windows/desktop/api/winternl/ns-winternl-_teb -// "[This structure may be altered in future versions of Windows. Applications -// should use the alternate functions listed in this topic.]" -typedef struct _TEB { - PVOID Reserved1[12]; - // PVOID ThreadLocalStoragePointer; is here, at the last field in Reserved1. - PVOID ProcessEnvironmentBlock; - PVOID Reserved2[399]; - BYTE Reserved3[1952]; - PVOID TlsSlots[64]; - BYTE Reserved4[8]; - PVOID Reserved5[26]; - PVOID ReservedForOle; - PVOID Reserved6[4]; - PVOID TlsExpansionSlots; -} TEB, *PTEB; - -constexpr size_t TEB_RESERVED_FIELDS_THREAD_LOCAL_STORAGE_OFFSET = 11; -BOOL IsTlsInitialized() { - PTEB teb = (PTEB)NtCurrentTeb(); - return teb->Reserved1[TEB_RESERVED_FIELDS_THREAD_LOCAL_STORAGE_OFFSET] != - nullptr; -} - -void AsanTSDInit(void (*destructor)(void *tsd)) { - // FIXME: we're ignoring the destructor for now. - tsd_key_inited = true; -} - -void *AsanTSDGet() { - CHECK(tsd_key_inited); - return IsTlsInitialized() ? fake_tsd : nullptr; -} - -void AsanTSDSet(void *tsd) { - CHECK(tsd_key_inited); - fake_tsd = tsd; -} - -void PlatformTSDDtor(void *tsd) { AsanThread::TSDDtor(tsd); } -// }}} - -// ---------------------- Various stuff ---------------- {{{ -void *AsanDoesNotSupportStaticLinkage() { -#if defined(_DEBUG) -#error Please build the runtime with a non-debug CRT: /MD or /MT -#endif - return 0; -} - -uptr FindDynamicShadowStart() { - return MapDynamicShadow(MemToShadowSize(kHighMemEnd), ASAN_SHADOW_SCALE, - /*min_shadow_base_alignment*/ 0, kHighMemEnd); -} - -void AsanCheckDynamicRTPrereqs() {} - -void AsanCheckIncompatibleRT() {} - -void ReadContextStack(void *context, uptr *stack, uptr *ssize) { - UNIMPLEMENTED(); -} - -void AsanOnDeadlySignal(int, void *siginfo, void *context) { UNIMPLEMENTED(); } - -bool PlatformUnpoisonStacks() { return false; } - -#if SANITIZER_WINDOWS64 -// Exception handler for dealing with shadow memory. -static LONG CALLBACK -ShadowExceptionHandler(PEXCEPTION_POINTERS exception_pointers) { - uptr page_size = GetPageSizeCached(); - // Only handle access violations. - if (exception_pointers->ExceptionRecord->ExceptionCode != - EXCEPTION_ACCESS_VIOLATION || - exception_pointers->ExceptionRecord->NumberParameters < 2) { - __asan_handle_no_return(); - return EXCEPTION_CONTINUE_SEARCH; - } - - // Only handle access violations that land within the shadow memory. - uptr addr = - (uptr)(exception_pointers->ExceptionRecord->ExceptionInformation[1]); - - // Check valid shadow range. - if (!AddrIsInShadow(addr)) { - __asan_handle_no_return(); - return EXCEPTION_CONTINUE_SEARCH; - } - - // This is an access violation while trying to read from the shadow. Commit - // the relevant page and let execution continue. - - // Determine the address of the page that is being accessed. - uptr page = RoundDownTo(addr, page_size); - - // Commit the page. - uptr result = - (uptr)::VirtualAlloc((LPVOID)page, page_size, MEM_COMMIT, PAGE_READWRITE); - if (result != page) - return EXCEPTION_CONTINUE_SEARCH; - - // The page mapping succeeded, so continue execution as usual. - return EXCEPTION_CONTINUE_EXECUTION; -} - -#endif - -void InitializePlatformExceptionHandlers() { -#if SANITIZER_WINDOWS64 - // On Win64, we map memory on demand with access violation handler. - // Install our exception handler. - CHECK(AddVectoredExceptionHandler(TRUE, &ShadowExceptionHandler)); -#endif -} - -bool IsSystemHeapAddress(uptr addr) { - return ::HeapValidate(GetProcessHeap(), 0, (void *)addr) != FALSE; -} - -// We want to install our own exception handler (EH) to print helpful reports -// on access violations and whatnot. Unfortunately, the CRT initializers assume -// they are run before any user code and drop any previously-installed EHs on -// the floor, so we can't install our handler inside __asan_init. -// (See crt0dat.c in the CRT sources for the details) -// -// Things get even more complicated with the dynamic runtime, as it finishes its -// initialization before the .exe module CRT begins to initialize. -// -// For the static runtime (-MT), it's enough to put a callback to -// __asan_set_seh_filter in the last section for C initializers. -// -// For the dynamic runtime (-MD), we want link the same -// asan_dynamic_runtime_thunk.lib to all the modules, thus __asan_set_seh_filter -// will be called for each instrumented module. This ensures that at least one -// __asan_set_seh_filter call happens after the .exe module CRT is initialized. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE int __asan_set_seh_filter() { - // We should only store the previous handler if it's not our own handler in - // order to avoid loops in the EH chain. - auto prev_seh_handler = SetUnhandledExceptionFilter(SEHHandler); - if (prev_seh_handler != &SEHHandler) - default_seh_handler = prev_seh_handler; - return 0; -} - -bool HandleDlopenInit() { - // Not supported on this platform. - static_assert(!SANITIZER_SUPPORTS_INIT_FOR_DLOPEN, - "Expected SANITIZER_SUPPORTS_INIT_FOR_DLOPEN to be false"); - return false; -} - -#if !ASAN_DYNAMIC -// The CRT runs initializers in this order: -// - C initializers, from XIA to XIZ -// - C++ initializers, from XCA to XCZ -// Prior to 2015, the CRT set the unhandled exception filter at priority XIY, -// near the end of C initialization. Starting in 2015, it was moved to the -// beginning of C++ initialization. We set our priority to XCAB to run -// immediately after the CRT runs. This way, our exception filter is called -// first and we can delegate to their filter if appropriate. -#pragma section(".CRT$XCAB", long, read) -__declspec(allocate(".CRT$XCAB")) int (*__intercept_seh)() = - __asan_set_seh_filter; - -// Piggyback on the TLS initialization callback directory to initialize asan as -// early as possible. Initializers in .CRT$XL* are called directly by ntdll, -// which run before the CRT. Users also add code to .CRT$XLC, so it's important -// to run our initializers first. -static void NTAPI asan_thread_init(void *module, DWORD reason, void *reserved) { - if (reason == DLL_PROCESS_ATTACH) - __asan_init(); -} - -#pragma section(".CRT$XLAB", long, read) -__declspec(allocate(".CRT$XLAB")) void(NTAPI *__asan_tls_init)( - void *, unsigned long, void *) = asan_thread_init; -#endif - -static void NTAPI asan_thread_exit(void *module, DWORD reason, void *reserved) { - if (reason == DLL_THREAD_DETACH) { - // Unpoison the thread's stack because the memory may be re-used. - NT_TIB *tib = (NT_TIB *)NtCurrentTeb(); - uptr stackSize = (uptr)tib->StackBase - (uptr)tib->StackLimit; - __asan_unpoison_memory_region(tib->StackLimit, stackSize); - } -} - -#pragma section(".CRT$XLY", long, read) -__declspec(allocate(".CRT$XLY")) void(NTAPI *__asan_tls_exit)( - void *, unsigned long, void *) = asan_thread_exit; - -WIN_FORCE_LINK(__asan_dso_reg_hook) - -// }}} -} // namespace __asan - -#endif // SANITIZER_WINDOWS diff --git a/contrib/libs/clang14-rt/lib/asan/ya.make b/contrib/libs/clang14-rt/lib/asan/ya.make deleted file mode 100644 index 981e911a7452..000000000000 --- a/contrib/libs/clang14-rt/lib/asan/ya.make +++ /dev/null @@ -1,162 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.asan${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DHAVE_RPC_XDR_H=0 - -DUBSAN_CAN_USE_CXXABI - -fcommon - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - asan/asan_activation.cpp - asan/asan_allocator.cpp - asan/asan_debugging.cpp - asan/asan_descriptions.cpp - asan/asan_errors.cpp - asan/asan_fake_stack.cpp - asan/asan_flags.cpp - asan/asan_fuchsia.cpp - asan/asan_globals.cpp - asan/asan_globals_win.cpp - asan/asan_interceptors.cpp - asan/asan_interceptors_memintrinsics.cpp - asan/asan_interceptors_vfork.S - asan/asan_linux.cpp - asan/asan_mac.cpp - asan/asan_malloc_linux.cpp - asan/asan_malloc_mac.cpp - asan/asan_malloc_win.cpp - asan/asan_memory_profile.cpp - asan/asan_poisoning.cpp - asan/asan_posix.cpp - asan/asan_preinit.cpp - asan/asan_premap_shadow.cpp - asan/asan_report.cpp - asan/asan_rtl.cpp - asan/asan_shadow_setup.cpp - asan/asan_stack.cpp - asan/asan_stats.cpp - asan/asan_suppressions.cpp - asan/asan_thread.cpp - asan/asan_win.cpp - interception/interception_linux.cpp - interception/interception_mac.cpp - interception/interception_type_test.cpp - interception/interception_win.cpp - lsan/lsan_common.cpp - lsan/lsan_common_fuchsia.cpp - lsan/lsan_common_linux.cpp - lsan/lsan_common_mac.cpp - sanitizer_common/sancov_flags.cpp - sanitizer_common/sanitizer_allocator.cpp - sanitizer_common/sanitizer_allocator_checks.cpp - sanitizer_common/sanitizer_allocator_report.cpp - sanitizer_common/sanitizer_chained_origin_depot.cpp - sanitizer_common/sanitizer_common.cpp - sanitizer_common/sanitizer_common_libcdep.cpp - sanitizer_common/sanitizer_coverage_fuchsia.cpp - sanitizer_common/sanitizer_coverage_libcdep_new.cpp - sanitizer_common/sanitizer_coverage_win_sections.cpp - sanitizer_common/sanitizer_deadlock_detector1.cpp - sanitizer_common/sanitizer_deadlock_detector2.cpp - sanitizer_common/sanitizer_errno.cpp - sanitizer_common/sanitizer_file.cpp - sanitizer_common/sanitizer_flag_parser.cpp - sanitizer_common/sanitizer_flags.cpp - sanitizer_common/sanitizer_fuchsia.cpp - sanitizer_common/sanitizer_libc.cpp - sanitizer_common/sanitizer_libignore.cpp - sanitizer_common/sanitizer_linux.cpp - sanitizer_common/sanitizer_linux_libcdep.cpp - sanitizer_common/sanitizer_linux_s390.cpp - sanitizer_common/sanitizer_mac.cpp - sanitizer_common/sanitizer_mac_libcdep.cpp - sanitizer_common/sanitizer_mutex.cpp - sanitizer_common/sanitizer_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_freebsd.cpp - sanitizer_common/sanitizer_platform_limits_linux.cpp - sanitizer_common/sanitizer_platform_limits_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_posix.cpp - sanitizer_common/sanitizer_platform_limits_solaris.cpp - sanitizer_common/sanitizer_posix.cpp - sanitizer_common/sanitizer_posix_libcdep.cpp - sanitizer_common/sanitizer_printf.cpp - sanitizer_common/sanitizer_procmaps_bsd.cpp - sanitizer_common/sanitizer_procmaps_common.cpp - sanitizer_common/sanitizer_procmaps_fuchsia.cpp - sanitizer_common/sanitizer_procmaps_linux.cpp - sanitizer_common/sanitizer_procmaps_mac.cpp - sanitizer_common/sanitizer_procmaps_solaris.cpp - sanitizer_common/sanitizer_solaris.cpp - sanitizer_common/sanitizer_stack_store.cpp - sanitizer_common/sanitizer_stackdepot.cpp - sanitizer_common/sanitizer_stacktrace.cpp - sanitizer_common/sanitizer_stacktrace_libcdep.cpp - sanitizer_common/sanitizer_stacktrace_printer.cpp - sanitizer_common/sanitizer_stacktrace_sparc.cpp - sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp - sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_mac.cpp - sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_win.cpp - sanitizer_common/sanitizer_suppressions.cpp - sanitizer_common/sanitizer_symbolizer.cpp - sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp - sanitizer_common/sanitizer_symbolizer_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_mac.cpp - sanitizer_common/sanitizer_symbolizer_markup.cpp - sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_report.cpp - sanitizer_common/sanitizer_symbolizer_win.cpp - sanitizer_common/sanitizer_termination.cpp - sanitizer_common/sanitizer_thread_registry.cpp - sanitizer_common/sanitizer_tls_get_addr.cpp - sanitizer_common/sanitizer_type_traits.cpp - sanitizer_common/sanitizer_unwind_linux_libcdep.cpp - sanitizer_common/sanitizer_unwind_win.cpp - sanitizer_common/sanitizer_win.cpp - ubsan/ubsan_diag.cpp - ubsan/ubsan_flags.cpp - ubsan/ubsan_handlers.cpp - ubsan/ubsan_init.cpp - ubsan/ubsan_monitor.cpp - ubsan/ubsan_value.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/asan_cxx/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/asan_cxx/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/asan_cxx/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/asan_cxx/ya.make b/contrib/libs/clang14-rt/lib/asan_cxx/ya.make deleted file mode 100644 index 9dad01171815..000000000000 --- a/contrib/libs/clang14-rt/lib/asan_cxx/ya.make +++ /dev/null @@ -1,54 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.asan_cxx${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DUBSAN_CAN_USE_CXXABI - -fcommon - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -frtti - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - asan/asan_new_delete.cpp - ubsan/ubsan_handlers_cxx.cpp - ubsan/ubsan_type_hash.cpp - ubsan/ubsan_type_hash_itanium.cpp - ubsan/ubsan_type_hash_win.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/asan_static/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/asan_static/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/asan_static/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/asan_static/ya.make b/contrib/libs/clang14-rt/lib/asan_static/ya.make deleted file mode 100644 index f721a6a6e309..000000000000 --- a/contrib/libs/clang14-rt/lib/asan_static/ya.make +++ /dev/null @@ -1,49 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.asan_static${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -fcommon - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib/asan) - -SRCS( - asan_rtl_static.cpp - asan_rtl_x86_64.S -) - -END() diff --git a/contrib/libs/clang14-rt/lib/builtins/README.txt b/contrib/libs/clang14-rt/lib/builtins/README.txt deleted file mode 100644 index 53d656d5086d..000000000000 --- a/contrib/libs/clang14-rt/lib/builtins/README.txt +++ /dev/null @@ -1,353 +0,0 @@ -Compiler-RT -================================ - -This directory and its subdirectories contain source code for the compiler -support routines. - -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - -================================ - -This is a replacement library for libgcc. Each function is contained -in its own file. Each function has a corresponding unit test under -test/Unit. - -A rudimentary script to test each file is in the file called -test/Unit/test. - -Here is the specification for this library: - -http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc - -Please note that the libgcc specification explicitly mentions actual types of -arguments and returned values being expressed with machine modes. -In some cases particular types such as "int", "unsigned", "long long", etc. -may be specified just as examples there. - -Here is a synopsis of the contents of this library: - -typedef int32_t si_int; -typedef uint32_t su_int; - -typedef int64_t di_int; -typedef uint64_t du_int; - -// Integral bit manipulation - -di_int __ashldi3(di_int a, si_int b); // a << b -ti_int __ashlti3(ti_int a, si_int b); // a << b - -di_int __ashrdi3(di_int a, si_int b); // a >> b arithmetic (sign fill) -ti_int __ashrti3(ti_int a, si_int b); // a >> b arithmetic (sign fill) -di_int __lshrdi3(di_int a, si_int b); // a >> b logical (zero fill) -ti_int __lshrti3(ti_int a, si_int b); // a >> b logical (zero fill) - -int __clzsi2(si_int a); // count leading zeros -int __clzdi2(di_int a); // count leading zeros -int __clzti2(ti_int a); // count leading zeros -int __ctzsi2(si_int a); // count trailing zeros -int __ctzdi2(di_int a); // count trailing zeros -int __ctzti2(ti_int a); // count trailing zeros - -int __ffssi2(si_int a); // find least significant 1 bit -int __ffsdi2(di_int a); // find least significant 1 bit -int __ffsti2(ti_int a); // find least significant 1 bit - -int __paritysi2(si_int a); // bit parity -int __paritydi2(di_int a); // bit parity -int __parityti2(ti_int a); // bit parity - -int __popcountsi2(si_int a); // bit population -int __popcountdi2(di_int a); // bit population -int __popcountti2(ti_int a); // bit population - -uint32_t __bswapsi2(uint32_t a); // a byteswapped -uint64_t __bswapdi2(uint64_t a); // a byteswapped - -// Integral arithmetic - -di_int __negdi2 (di_int a); // -a -ti_int __negti2 (ti_int a); // -a -di_int __muldi3 (di_int a, di_int b); // a * b -ti_int __multi3 (ti_int a, ti_int b); // a * b -si_int __divsi3 (si_int a, si_int b); // a / b signed -di_int __divdi3 (di_int a, di_int b); // a / b signed -ti_int __divti3 (ti_int a, ti_int b); // a / b signed -su_int __udivsi3 (su_int n, su_int d); // a / b unsigned -du_int __udivdi3 (du_int a, du_int b); // a / b unsigned -tu_int __udivti3 (tu_int a, tu_int b); // a / b unsigned -si_int __modsi3 (si_int a, si_int b); // a % b signed -di_int __moddi3 (di_int a, di_int b); // a % b signed -ti_int __modti3 (ti_int a, ti_int b); // a % b signed -su_int __umodsi3 (su_int a, su_int b); // a % b unsigned -du_int __umoddi3 (du_int a, du_int b); // a % b unsigned -tu_int __umodti3 (tu_int a, tu_int b); // a % b unsigned -du_int __udivmoddi4(du_int a, du_int b, du_int* rem); // a / b, *rem = a % b unsigned -tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); // a / b, *rem = a % b unsigned -su_int __udivmodsi4(su_int a, su_int b, su_int* rem); // a / b, *rem = a % b unsigned -si_int __divmodsi4(si_int a, si_int b, si_int* rem); // a / b, *rem = a % b signed -di_int __divmoddi4(di_int a, di_int b, di_int* rem); // a / b, *rem = a % b signed -ti_int __divmodti4(ti_int a, ti_int b, ti_int* rem); // a / b, *rem = a % b signed - - - -// Integral arithmetic with trapping overflow - -si_int __absvsi2(si_int a); // abs(a) -di_int __absvdi2(di_int a); // abs(a) -ti_int __absvti2(ti_int a); // abs(a) - -si_int __negvsi2(si_int a); // -a -di_int __negvdi2(di_int a); // -a -ti_int __negvti2(ti_int a); // -a - -si_int __addvsi3(si_int a, si_int b); // a + b -di_int __addvdi3(di_int a, di_int b); // a + b -ti_int __addvti3(ti_int a, ti_int b); // a + b - -si_int __subvsi3(si_int a, si_int b); // a - b -di_int __subvdi3(di_int a, di_int b); // a - b -ti_int __subvti3(ti_int a, ti_int b); // a - b - -si_int __mulvsi3(si_int a, si_int b); // a * b -di_int __mulvdi3(di_int a, di_int b); // a * b -ti_int __mulvti3(ti_int a, ti_int b); // a * b - - -// Integral arithmetic which returns if overflow - -si_int __mulosi4(si_int a, si_int b, int* overflow); // a * b, overflow set to one if result not in signed range -di_int __mulodi4(di_int a, di_int b, int* overflow); // a * b, overflow set to one if result not in signed range -ti_int __muloti4(ti_int a, ti_int b, int* overflow); // a * b, overflow set to - one if result not in signed range - - -// Integral comparison: a < b -> 0 -// a == b -> 1 -// a > b -> 2 - -si_int __cmpdi2 (di_int a, di_int b); -si_int __cmpti2 (ti_int a, ti_int b); -si_int __ucmpdi2(du_int a, du_int b); -si_int __ucmpti2(tu_int a, tu_int b); - -// Integral / floating point conversion - -di_int __fixsfdi( float a); -di_int __fixdfdi( double a); -di_int __fixxfdi(long double a); - -ti_int __fixsfti( float a); -ti_int __fixdfti( double a); -ti_int __fixxfti(long double a); -uint64_t __fixtfdi(long double input); // ppc only, doesn't match documentation - -su_int __fixunssfsi( float a); -su_int __fixunsdfsi( double a); -su_int __fixunsxfsi(long double a); - -du_int __fixunssfdi( float a); -du_int __fixunsdfdi( double a); -du_int __fixunsxfdi(long double a); - -tu_int __fixunssfti( float a); -tu_int __fixunsdfti( double a); -tu_int __fixunsxfti(long double a); -uint64_t __fixunstfdi(long double input); // ppc only - -float __floatdisf(di_int a); -double __floatdidf(di_int a); -long double __floatdixf(di_int a); -long double __floatditf(int64_t a); // ppc only - -float __floattisf(ti_int a); -double __floattidf(ti_int a); -long double __floattixf(ti_int a); - -float __floatundisf(du_int a); -double __floatundidf(du_int a); -long double __floatundixf(du_int a); -long double __floatunditf(uint64_t a); // ppc only - -float __floatuntisf(tu_int a); -double __floatuntidf(tu_int a); -long double __floatuntixf(tu_int a); - -// Floating point raised to integer power - -float __powisf2( float a, int b); // a ^ b -double __powidf2( double a, int b); // a ^ b -long double __powixf2(long double a, int b); // a ^ b -long double __powitf2(long double a, int b); // ppc only, a ^ b - -// Complex arithmetic - -// (a + ib) * (c + id) - - float _Complex __mulsc3( float a, float b, float c, float d); - double _Complex __muldc3(double a, double b, double c, double d); -long double _Complex __mulxc3(long double a, long double b, - long double c, long double d); -long double _Complex __multc3(long double a, long double b, - long double c, long double d); // ppc only - -// (a + ib) / (c + id) - - float _Complex __divsc3( float a, float b, float c, float d); - double _Complex __divdc3(double a, double b, double c, double d); -long double _Complex __divxc3(long double a, long double b, - long double c, long double d); -long double _Complex __divtc3(long double a, long double b, - long double c, long double d); // ppc only - - -// Runtime support - -// __clear_cache() is used to tell process that new instructions have been -// written to an address range. Necessary on processors that do not have -// a unified instruction and data cache. -void __clear_cache(void* start, void* end); - -// __enable_execute_stack() is used with nested functions when a trampoline -// function is written onto the stack and that page range needs to be made -// executable. -void __enable_execute_stack(void* addr); - -// __gcc_personality_v0() is normally only called by the system unwinder. -// C code (as opposed to C++) normally does not need a personality function -// because there are no catch clauses or destructors to be run. But there -// is a C language extension __attribute__((cleanup(func))) which marks local -// variables as needing the cleanup function "func" to be run when the -// variable goes out of scope. That includes when an exception is thrown, -// so a personality handler is needed. -_Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions, - uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject, - _Unwind_Context_t context); - -// for use with some implementations of assert() in -void __eprintf(const char* format, const char* assertion_expression, - const char* line, const char* file); - -// for systems with emulated thread local storage -void* __emutls_get_address(struct __emutls_control*); - - -// Power PC specific functions - -// There is no C interface to the saveFP/restFP functions. They are helper -// functions called by the prolog and epilog of functions that need to save -// a number of non-volatile float point registers. -saveFP -restFP - -// PowerPC has a standard template for trampoline functions. This function -// generates a custom trampoline function with the specific realFunc -// and localsPtr values. -void __trampoline_setup(uint32_t* trampOnStack, int trampSizeAllocated, - const void* realFunc, void* localsPtr); - -// adds two 128-bit double-double precision values ( x + y ) -long double __gcc_qadd(long double x, long double y); - -// subtracts two 128-bit double-double precision values ( x - y ) -long double __gcc_qsub(long double x, long double y); - -// multiples two 128-bit double-double precision values ( x * y ) -long double __gcc_qmul(long double x, long double y); - -// divides two 128-bit double-double precision values ( x / y ) -long double __gcc_qdiv(long double a, long double b); - - -// ARM specific functions - -// There is no C interface to the switch* functions. These helper functions -// are only needed by Thumb1 code for efficient switch table generation. -switch16 -switch32 -switch8 -switchu8 - -// There is no C interface to the *_vfp_d8_d15_regs functions. There are -// called in the prolog and epilog of Thumb1 functions. When the C++ ABI use -// SJLJ for exceptions, each function with a catch clause or destructors needs -// to save and restore all registers in it prolog and epilog. But there is -// no way to access vector and high float registers from thumb1 code, so the -// compiler must add call outs to these helper functions in the prolog and -// epilog. -restore_vfp_d8_d15_regs -save_vfp_d8_d15_regs - - -// Note: long ago ARM processors did not have floating point hardware support. -// Floating point was done in software and floating point parameters were -// passed in integer registers. When hardware support was added for floating -// point, new *vfp functions were added to do the same operations but with -// floating point parameters in floating point registers. - -// Undocumented functions - -float __addsf3vfp(float a, float b); // Appears to return a + b -double __adddf3vfp(double a, double b); // Appears to return a + b -float __divsf3vfp(float a, float b); // Appears to return a / b -double __divdf3vfp(double a, double b); // Appears to return a / b -int __eqsf2vfp(float a, float b); // Appears to return one - // iff a == b and neither is NaN. -int __eqdf2vfp(double a, double b); // Appears to return one - // iff a == b and neither is NaN. -double __extendsfdf2vfp(float a); // Appears to convert from - // float to double. -int __fixdfsivfp(double a); // Appears to convert from - // double to int. -int __fixsfsivfp(float a); // Appears to convert from - // float to int. -unsigned int __fixunssfsivfp(float a); // Appears to convert from - // float to unsigned int. -unsigned int __fixunsdfsivfp(double a); // Appears to convert from - // double to unsigned int. -double __floatsidfvfp(int a); // Appears to convert from - // int to double. -float __floatsisfvfp(int a); // Appears to convert from - // int to float. -double __floatunssidfvfp(unsigned int a); // Appears to convert from - // unsigned int to double. -float __floatunssisfvfp(unsigned int a); // Appears to convert from - // unsigned int to float. -int __gedf2vfp(double a, double b); // Appears to return __gedf2 - // (a >= b) -int __gesf2vfp(float a, float b); // Appears to return __gesf2 - // (a >= b) -int __gtdf2vfp(double a, double b); // Appears to return __gtdf2 - // (a > b) -int __gtsf2vfp(float a, float b); // Appears to return __gtsf2 - // (a > b) -int __ledf2vfp(double a, double b); // Appears to return __ledf2 - // (a <= b) -int __lesf2vfp(float a, float b); // Appears to return __lesf2 - // (a <= b) -int __ltdf2vfp(double a, double b); // Appears to return __ltdf2 - // (a < b) -int __ltsf2vfp(float a, float b); // Appears to return __ltsf2 - // (a < b) -double __muldf3vfp(double a, double b); // Appears to return a * b -float __mulsf3vfp(float a, float b); // Appears to return a * b -int __nedf2vfp(double a, double b); // Appears to return __nedf2 - // (a != b) -double __negdf2vfp(double a); // Appears to return -a -float __negsf2vfp(float a); // Appears to return -a -float __negsf2vfp(float a); // Appears to return -a -double __subdf3vfp(double a, double b); // Appears to return a - b -float __subsf3vfp(float a, float b); // Appears to return a - b -float __truncdfsf2vfp(double a); // Appears to convert from - // double to float. -int __unorddf2vfp(double a, double b); // Appears to return __unorddf2 -int __unordsf2vfp(float a, float b); // Appears to return __unordsf2 - - -Preconditions are listed for each function at the definition when there are any. -Any preconditions reflect the specification at -http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc. - -Assumptions are listed in "int_lib.h", and in individual files. Where possible -assumptions are checked at compile time. diff --git a/contrib/libs/clang14-rt/lib/builtins/assembly.h b/contrib/libs/clang14-rt/lib/builtins/assembly.h deleted file mode 100644 index 69a3d8620f92..000000000000 --- a/contrib/libs/clang14-rt/lib/builtins/assembly.h +++ /dev/null @@ -1,292 +0,0 @@ -//===-- assembly.h - compiler-rt assembler support macros -----------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines macros for use in compiler-rt assembler source. -// This file is not part of the interface of this library. -// -//===----------------------------------------------------------------------===// - -#ifndef COMPILERRT_ASSEMBLY_H -#define COMPILERRT_ASSEMBLY_H - -#if defined(__linux__) && defined(__CET__) -#if __has_include() -#include -#endif -#endif - -#if defined(__APPLE__) && defined(__aarch64__) -#define SEPARATOR %% -#else -#define SEPARATOR ; -#endif - -#if defined(__APPLE__) -#define HIDDEN(name) .private_extern name -#define LOCAL_LABEL(name) L_##name -// tell linker it can break up file at label boundaries -#define FILE_LEVEL_DIRECTIVE .subsections_via_symbols -#define SYMBOL_IS_FUNC(name) -#define CONST_SECTION .const - -#define NO_EXEC_STACK_DIRECTIVE - -#elif defined(__ELF__) - -#define HIDDEN(name) .hidden name -#define LOCAL_LABEL(name) .L_##name -#define FILE_LEVEL_DIRECTIVE -#if defined(__arm__) || defined(__aarch64__) -#define SYMBOL_IS_FUNC(name) .type name,%function -#else -#define SYMBOL_IS_FUNC(name) .type name,@function -#endif -#define CONST_SECTION .section .rodata - -#if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \ - defined(__linux__) -#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits -#else -#define NO_EXEC_STACK_DIRECTIVE -#endif - -#else // !__APPLE__ && !__ELF__ - -#define HIDDEN(name) -#define LOCAL_LABEL(name) .L ## name -#define FILE_LEVEL_DIRECTIVE -#define SYMBOL_IS_FUNC(name) \ - .def name SEPARATOR \ - .scl 2 SEPARATOR \ - .type 32 SEPARATOR \ - .endef -#define CONST_SECTION .section .rdata,"rd" - -#define NO_EXEC_STACK_DIRECTIVE - -#endif - -#if defined(__arm__) || defined(__aarch64__) -#define FUNC_ALIGN \ - .text SEPARATOR \ - .balign 16 SEPARATOR -#else -#define FUNC_ALIGN -#endif - -// BTI and PAC gnu property note -#define NT_GNU_PROPERTY_TYPE_0 5 -#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 -#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI 1 -#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC 2 - -#if defined(__ARM_FEATURE_BTI_DEFAULT) -#define BTI_FLAG GNU_PROPERTY_AARCH64_FEATURE_1_BTI -#else -#define BTI_FLAG 0 -#endif - -#if __ARM_FEATURE_PAC_DEFAULT & 3 -#define PAC_FLAG GNU_PROPERTY_AARCH64_FEATURE_1_PAC -#else -#define PAC_FLAG 0 -#endif - -#define GNU_PROPERTY(type, value) \ - .pushsection .note.gnu.property, "a" SEPARATOR \ - .p2align 3 SEPARATOR \ - .word 4 SEPARATOR \ - .word 16 SEPARATOR \ - .word NT_GNU_PROPERTY_TYPE_0 SEPARATOR \ - .asciz "GNU" SEPARATOR \ - .word type SEPARATOR \ - .word 4 SEPARATOR \ - .word value SEPARATOR \ - .word 0 SEPARATOR \ - .popsection - -#if BTI_FLAG != 0 -#define BTI_C hint #34 -#define BTI_J hint #36 -#else -#define BTI_C -#define BTI_J -#endif - -#if (BTI_FLAG | PAC_FLAG) != 0 -#define GNU_PROPERTY_BTI_PAC \ - GNU_PROPERTY(GNU_PROPERTY_AARCH64_FEATURE_1_AND, BTI_FLAG | PAC_FLAG) -#else -#define GNU_PROPERTY_BTI_PAC -#endif - -#if defined(__clang__) || defined(__GCC_HAVE_DWARF2_CFI_ASM) -#define CFI_START .cfi_startproc -#define CFI_END .cfi_endproc -#else -#define CFI_START -#define CFI_END -#endif - -#if defined(__arm__) - -// Determine actual [ARM][THUMB[1][2]] ISA using compiler predefined macros: -// - for '-mthumb -march=armv6' compiler defines '__thumb__' -// - for '-mthumb -march=armv7' compiler defines '__thumb__' and '__thumb2__' -#if defined(__thumb2__) || defined(__thumb__) -#define DEFINE_CODE_STATE .thumb SEPARATOR -#define DECLARE_FUNC_ENCODING .thumb_func SEPARATOR -#if defined(__thumb2__) -#define USE_THUMB_2 -#define IT(cond) it cond -#define ITT(cond) itt cond -#define ITE(cond) ite cond -#else -#define USE_THUMB_1 -#define IT(cond) -#define ITT(cond) -#define ITE(cond) -#endif // defined(__thumb__2) -#else // !defined(__thumb2__) && !defined(__thumb__) -#define DEFINE_CODE_STATE .arm SEPARATOR -#define DECLARE_FUNC_ENCODING -#define IT(cond) -#define ITT(cond) -#define ITE(cond) -#endif - -#if defined(USE_THUMB_1) && defined(USE_THUMB_2) -#error "USE_THUMB_1 and USE_THUMB_2 can't be defined together." -#endif - -#if defined(__ARM_ARCH_4T__) || __ARM_ARCH >= 5 -#define ARM_HAS_BX -#endif -#if !defined(__ARM_FEATURE_CLZ) && !defined(USE_THUMB_1) && \ - (__ARM_ARCH >= 6 || (__ARM_ARCH == 5 && !defined(__ARM_ARCH_5__))) -#define __ARM_FEATURE_CLZ -#endif - -#ifdef ARM_HAS_BX -#define JMP(r) bx r -#define JMPc(r, c) bx##c r -#else -#define JMP(r) mov pc, r -#define JMPc(r, c) mov##c pc, r -#endif - -// pop {pc} can't switch Thumb mode on ARMv4T -#if __ARM_ARCH >= 5 -#define POP_PC() pop {pc} -#else -#define POP_PC() \ - pop {ip}; \ - JMP(ip) -#endif - -#if defined(USE_THUMB_2) -#define WIDE(op) op.w -#else -#define WIDE(op) op -#endif -#else // !defined(__arm) -#define DECLARE_FUNC_ENCODING -#define DEFINE_CODE_STATE -#endif - -#define GLUE2_(a, b) a##b -#define GLUE(a, b) GLUE2_(a, b) -#define GLUE2(a, b) GLUE2_(a, b) -#define GLUE3_(a, b, c) a##b##c -#define GLUE3(a, b, c) GLUE3_(a, b, c) -#define GLUE4_(a, b, c, d) a##b##c##d -#define GLUE4(a, b, c, d) GLUE4_(a, b, c, d) - -#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name) - -#ifdef VISIBILITY_HIDDEN -#define DECLARE_SYMBOL_VISIBILITY(name) \ - HIDDEN(SYMBOL_NAME(name)) SEPARATOR -#define DECLARE_SYMBOL_VISIBILITY_UNMANGLED(name) \ - HIDDEN(name) SEPARATOR -#else -#define DECLARE_SYMBOL_VISIBILITY(name) -#define DECLARE_SYMBOL_VISIBILITY_UNMANGLED(name) -#endif - -#define DEFINE_COMPILERRT_FUNCTION(name) \ - DEFINE_CODE_STATE \ - FILE_LEVEL_DIRECTIVE SEPARATOR \ - .globl SYMBOL_NAME(name) SEPARATOR \ - SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ - DECLARE_SYMBOL_VISIBILITY(name) \ - DECLARE_FUNC_ENCODING \ - SYMBOL_NAME(name): - -#define DEFINE_COMPILERRT_THUMB_FUNCTION(name) \ - DEFINE_CODE_STATE \ - FILE_LEVEL_DIRECTIVE SEPARATOR \ - .globl SYMBOL_NAME(name) SEPARATOR \ - SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ - DECLARE_SYMBOL_VISIBILITY(name) SEPARATOR \ - .thumb_func SEPARATOR \ - SYMBOL_NAME(name): - -#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \ - DEFINE_CODE_STATE \ - FILE_LEVEL_DIRECTIVE SEPARATOR \ - .globl SYMBOL_NAME(name) SEPARATOR \ - SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ - HIDDEN(SYMBOL_NAME(name)) SEPARATOR \ - DECLARE_FUNC_ENCODING \ - SYMBOL_NAME(name): - -#define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \ - DEFINE_CODE_STATE \ - .globl name SEPARATOR \ - SYMBOL_IS_FUNC(name) SEPARATOR \ - HIDDEN(name) SEPARATOR \ - DECLARE_FUNC_ENCODING \ - name: - -#define DEFINE_COMPILERRT_OUTLINE_FUNCTION_UNMANGLED(name) \ - DEFINE_CODE_STATE \ - FUNC_ALIGN \ - .globl name SEPARATOR \ - SYMBOL_IS_FUNC(name) SEPARATOR \ - DECLARE_SYMBOL_VISIBILITY_UNMANGLED(name) SEPARATOR \ - CFI_START SEPARATOR \ - DECLARE_FUNC_ENCODING \ - name: SEPARATOR BTI_C - -#define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \ - .globl SYMBOL_NAME(name) SEPARATOR \ - SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ - DECLARE_SYMBOL_VISIBILITY(SYMBOL_NAME(name)) SEPARATOR \ - .set SYMBOL_NAME(name), SYMBOL_NAME(target) SEPARATOR - -#if defined(__ARM_EABI__) -#define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) \ - DEFINE_COMPILERRT_FUNCTION_ALIAS(aeabi_name, name) -#else -#define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) -#endif - -#ifdef __ELF__ -#define END_COMPILERRT_FUNCTION(name) \ - .size SYMBOL_NAME(name), . - SYMBOL_NAME(name) -#define END_COMPILERRT_OUTLINE_FUNCTION(name) \ - CFI_END SEPARATOR \ - .size SYMBOL_NAME(name), . - SYMBOL_NAME(name) -#else -#define END_COMPILERRT_FUNCTION(name) -#define END_COMPILERRT_OUTLINE_FUNCTION(name) \ - CFI_END -#endif - -#endif // COMPILERRT_ASSEMBLY_H diff --git a/contrib/libs/clang14-rt/lib/cfi/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/cfi/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/cfi/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/cfi/cfi.cpp b/contrib/libs/clang14-rt/lib/cfi/cfi.cpp deleted file mode 100644 index 6df3906467e4..000000000000 --- a/contrib/libs/clang14-rt/lib/cfi/cfi.cpp +++ /dev/null @@ -1,476 +0,0 @@ -//===-------- cfi.cpp -----------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements the runtime support for the cross-DSO CFI. -// -//===----------------------------------------------------------------------===// - -#include -#include - -#include "sanitizer_common/sanitizer_common.h" -#if SANITIZER_FREEBSD -#error #include -#endif -#include -#include -#include -#include - -#if SANITIZER_LINUX -typedef ElfW(Phdr) Elf_Phdr; -typedef ElfW(Ehdr) Elf_Ehdr; -typedef ElfW(Addr) Elf_Addr; -typedef ElfW(Sym) Elf_Sym; -typedef ElfW(Dyn) Elf_Dyn; -#elif SANITIZER_FREEBSD -#if SANITIZER_WORDSIZE == 64 -#define ElfW64_Dyn Elf_Dyn -#define ElfW64_Sym Elf_Sym -#else -#define ElfW32_Dyn Elf_Dyn -#define ElfW32_Sym Elf_Sym -#endif -#endif - -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_flag_parser.h" -#include "ubsan/ubsan_init.h" -#include "ubsan/ubsan_flags.h" - -#ifdef CFI_ENABLE_DIAG -#include "ubsan/ubsan_handlers.h" -#endif - -using namespace __sanitizer; - -namespace __cfi { - -#define kCfiShadowLimitsStorageSize 4096 // 1 page -// Lets hope that the data segment is mapped with 4K pages. -// The pointer to the cfi shadow region is stored at the start of this page. -// The rest of the page is unused and re-mapped read-only. -static union { - char space[kCfiShadowLimitsStorageSize]; - struct { - uptr start; - uptr size; - } limits; -} cfi_shadow_limits_storage - __attribute__((aligned(kCfiShadowLimitsStorageSize))); -static constexpr uptr kShadowGranularity = 12; -static constexpr uptr kShadowAlign = 1UL << kShadowGranularity; // 4096 - -static constexpr uint16_t kInvalidShadow = 0; -static constexpr uint16_t kUncheckedShadow = 0xFFFFU; - -// Get the start address of the CFI shadow region. -uptr GetShadow() { - return cfi_shadow_limits_storage.limits.start; -} - -uptr GetShadowSize() { - return cfi_shadow_limits_storage.limits.size; -} - -// This will only work while the shadow is not allocated. -void SetShadowSize(uptr size) { - cfi_shadow_limits_storage.limits.size = size; -} - -uptr MemToShadowOffset(uptr x) { - return (x >> kShadowGranularity) << 1; -} - -uint16_t *MemToShadow(uptr x, uptr shadow_base) { - return (uint16_t *)(shadow_base + MemToShadowOffset(x)); -} - -typedef int (*CFICheckFn)(u64, void *, void *); - -// This class reads and decodes the shadow contents. -class ShadowValue { - uptr addr; - uint16_t v; - explicit ShadowValue(uptr addr, uint16_t v) : addr(addr), v(v) {} - -public: - bool is_invalid() const { return v == kInvalidShadow; } - - bool is_unchecked() const { return v == kUncheckedShadow; } - - CFICheckFn get_cfi_check() const { - assert(!is_invalid() && !is_unchecked()); - uptr aligned_addr = addr & ~(kShadowAlign - 1); - uptr p = aligned_addr - (((uptr)v - 1) << kShadowGranularity); - return reinterpret_cast(p); - } - - // Load a shadow value for the given application memory address. - static const ShadowValue load(uptr addr) { - uptr shadow_base = GetShadow(); - uptr shadow_offset = MemToShadowOffset(addr); - if (shadow_offset > GetShadowSize()) - return ShadowValue(addr, kInvalidShadow); - else - return ShadowValue( - addr, *reinterpret_cast(shadow_base + shadow_offset)); - } -}; - -class ShadowBuilder { - uptr shadow_; - -public: - // Allocate a new empty shadow (for the entire address space) on the side. - void Start(); - // Mark the given address range as unchecked. - // This is used for uninstrumented libraries like libc. - // Any CFI check with a target in that range will pass. - void AddUnchecked(uptr begin, uptr end); - // Mark the given address range as belonging to a library with the given - // cfi_check function. - void Add(uptr begin, uptr end, uptr cfi_check); - // Finish shadow construction. Atomically switch the current active shadow - // region with the newly constructed one and deallocate the former. - void Install(); -}; - -void ShadowBuilder::Start() { - shadow_ = (uptr)MmapNoReserveOrDie(GetShadowSize(), "CFI shadow"); - VReport(1, "CFI: shadow at %zx .. %zx\n", shadow_, shadow_ + GetShadowSize()); -} - -void ShadowBuilder::AddUnchecked(uptr begin, uptr end) { - uint16_t *shadow_begin = MemToShadow(begin, shadow_); - uint16_t *shadow_end = MemToShadow(end - 1, shadow_) + 1; - // memset takes a byte, so our unchecked shadow value requires both bytes to - // be the same. Make sure we're ok during compilation. - static_assert((kUncheckedShadow & 0xff) == ((kUncheckedShadow >> 8) & 0xff), - "Both bytes of the 16-bit value must be the same!"); - memset(shadow_begin, kUncheckedShadow & 0xff, - (shadow_end - shadow_begin) * sizeof(*shadow_begin)); -} - -void ShadowBuilder::Add(uptr begin, uptr end, uptr cfi_check) { - assert((cfi_check & (kShadowAlign - 1)) == 0); - - // Don't fill anything below cfi_check. We can not represent those addresses - // in the shadow, and must make sure at codegen to place all valid call - // targets above cfi_check. - begin = Max(begin, cfi_check); - uint16_t *s = MemToShadow(begin, shadow_); - uint16_t *s_end = MemToShadow(end - 1, shadow_) + 1; - uint16_t sv = ((begin - cfi_check) >> kShadowGranularity) + 1; - for (; s < s_end; s++, sv++) - *s = sv; -} - -#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD -void ShadowBuilder::Install() { - MprotectReadOnly(shadow_, GetShadowSize()); - uptr main_shadow = GetShadow(); - if (main_shadow) { - // Update. -#if SANITIZER_LINUX - void *res = mremap((void *)shadow_, GetShadowSize(), GetShadowSize(), - MREMAP_MAYMOVE | MREMAP_FIXED, (void *)main_shadow); - CHECK(res != MAP_FAILED); -#elif SANITIZER_NETBSD - void *res = mremap((void *)shadow_, GetShadowSize(), (void *)main_shadow, - GetShadowSize(), MAP_FIXED); - CHECK(res != MAP_FAILED); -#else - void *res = MmapFixedOrDie(shadow_, GetShadowSize(), "cfi shadow"); - CHECK(res != MAP_FAILED); - ::memcpy(&shadow_, &main_shadow, GetShadowSize()); -#endif - } else { - // Initial setup. - CHECK_EQ(kCfiShadowLimitsStorageSize, GetPageSizeCached()); - CHECK_EQ(0, GetShadow()); - cfi_shadow_limits_storage.limits.start = shadow_; - MprotectReadOnly((uptr)&cfi_shadow_limits_storage, - sizeof(cfi_shadow_limits_storage)); - CHECK_EQ(shadow_, GetShadow()); - } -} -#else -#error not implemented -#endif - -// This is a workaround for a glibc bug: -// https://sourceware.org/bugzilla/show_bug.cgi?id=15199 -// Other platforms can, hopefully, just do -// dlopen(RTLD_NOLOAD | RTLD_LAZY) -// dlsym("__cfi_check"). -uptr find_cfi_check_in_dso(dl_phdr_info *info) { - const Elf_Dyn *dynamic = nullptr; - for (int i = 0; i < info->dlpi_phnum; ++i) { - if (info->dlpi_phdr[i].p_type == PT_DYNAMIC) { - dynamic = - (const Elf_Dyn *)(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr); - break; - } - } - if (!dynamic) return 0; - uptr strtab = 0, symtab = 0, strsz = 0; - for (const Elf_Dyn *p = dynamic; p->d_tag != PT_NULL; ++p) { - if (p->d_tag == DT_SYMTAB) - symtab = p->d_un.d_ptr; - else if (p->d_tag == DT_STRTAB) - strtab = p->d_un.d_ptr; - else if (p->d_tag == DT_STRSZ) - strsz = p->d_un.d_ptr; - } - - if (symtab > strtab) { - VReport(1, "Can not handle: symtab > strtab (%zx > %zx)\n", symtab, strtab); - return 0; - } - - // Verify that strtab and symtab are inside of the same LOAD segment. - // This excludes VDSO, which has (very high) bogus strtab and symtab pointers. - int phdr_idx; - for (phdr_idx = 0; phdr_idx < info->dlpi_phnum; phdr_idx++) { - const Elf_Phdr *phdr = &info->dlpi_phdr[phdr_idx]; - if (phdr->p_type == PT_LOAD) { - uptr beg = info->dlpi_addr + phdr->p_vaddr; - uptr end = beg + phdr->p_memsz; - if (strtab >= beg && strtab + strsz < end && symtab >= beg && - symtab < end) - break; - } - } - if (phdr_idx == info->dlpi_phnum) { - // Nope, either different segments or just bogus pointers. - // Can not handle this. - VReport(1, "Can not handle: symtab %zx, strtab %zx\n", symtab, strtab); - return 0; - } - - for (const Elf_Sym *p = (const Elf_Sym *)symtab; (Elf_Addr)p < strtab; - ++p) { - // There is no reliable way to find the end of the symbol table. In - // lld-produces files, there are other sections between symtab and strtab. - // Stop looking when the symbol name is not inside strtab. - if (p->st_name >= strsz) break; - char *name = (char*)(strtab + p->st_name); - if (strcmp(name, "__cfi_check") == 0) { - assert(p->st_info == ELF32_ST_INFO(STB_GLOBAL, STT_FUNC) || - p->st_info == ELF32_ST_INFO(STB_WEAK, STT_FUNC)); - uptr addr = info->dlpi_addr + p->st_value; - return addr; - } - } - return 0; -} - -int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *data) { - uptr cfi_check = find_cfi_check_in_dso(info); - if (cfi_check) - VReport(1, "Module '%s' __cfi_check %zx\n", info->dlpi_name, cfi_check); - - ShadowBuilder *b = reinterpret_cast(data); - - for (int i = 0; i < info->dlpi_phnum; i++) { - const Elf_Phdr *phdr = &info->dlpi_phdr[i]; - if (phdr->p_type == PT_LOAD) { - // Jump tables are in the executable segment. - // VTables are in the non-executable one. - // Need to fill shadow for both. - // FIXME: reject writable if vtables are in the r/o segment. Depend on - // PT_RELRO? - uptr cur_beg = info->dlpi_addr + phdr->p_vaddr; - uptr cur_end = cur_beg + phdr->p_memsz; - if (cfi_check) { - VReport(1, " %zx .. %zx\n", cur_beg, cur_end); - b->Add(cur_beg, cur_end, cfi_check); - } else { - b->AddUnchecked(cur_beg, cur_end); - } - } - } - return 0; -} - -// Init or update shadow for the current set of loaded libraries. -void UpdateShadow() { - ShadowBuilder b; - b.Start(); - dl_iterate_phdr(dl_iterate_phdr_cb, &b); - b.Install(); -} - -void InitShadow() { - CHECK_EQ(0, GetShadow()); - CHECK_EQ(0, GetShadowSize()); - - uptr vma = GetMaxUserVirtualAddress(); - // Shadow is 2 -> 2**kShadowGranularity. - SetShadowSize((vma >> (kShadowGranularity - 1)) + 1); - VReport(1, "CFI: VMA size %zx, shadow size %zx\n", vma, GetShadowSize()); - - UpdateShadow(); -} - -THREADLOCAL int in_loader; -Mutex shadow_update_lock; - -void EnterLoader() SANITIZER_NO_THREAD_SAFETY_ANALYSIS { - if (in_loader == 0) { - shadow_update_lock.Lock(); - } - ++in_loader; -} - -void ExitLoader() SANITIZER_NO_THREAD_SAFETY_ANALYSIS { - CHECK(in_loader > 0); - --in_loader; - UpdateShadow(); - if (in_loader == 0) { - shadow_update_lock.Unlock(); - } -} - -ALWAYS_INLINE void CfiSlowPathCommon(u64 CallSiteTypeId, void *Ptr, - void *DiagData) { - uptr Addr = (uptr)Ptr; - VReport(3, "__cfi_slowpath: %llx, %p\n", CallSiteTypeId, Ptr); - ShadowValue sv = ShadowValue::load(Addr); - if (sv.is_invalid()) { - VReport(1, "CFI: invalid memory region for a check target: %p\n", Ptr); -#ifdef CFI_ENABLE_DIAG - if (DiagData) { - __ubsan_handle_cfi_check_fail( - reinterpret_cast<__ubsan::CFICheckFailData *>(DiagData), Addr, false); - return; - } -#endif - Trap(); - } - if (sv.is_unchecked()) { - VReport(2, "CFI: unchecked call (shadow=FFFF): %p\n", Ptr); - return; - } - CFICheckFn cfi_check = sv.get_cfi_check(); - VReport(2, "__cfi_check at %p\n", (void *)cfi_check); - cfi_check(CallSiteTypeId, Ptr, DiagData); -} - -void InitializeFlags() { - SetCommonFlagsDefaults(); -#ifdef CFI_ENABLE_DIAG - __ubsan::Flags *uf = __ubsan::flags(); - uf->SetDefaults(); -#endif - - FlagParser cfi_parser; - RegisterCommonFlags(&cfi_parser); - cfi_parser.ParseStringFromEnv("CFI_OPTIONS"); - -#ifdef CFI_ENABLE_DIAG - FlagParser ubsan_parser; - __ubsan::RegisterUbsanFlags(&ubsan_parser, uf); - RegisterCommonFlags(&ubsan_parser); - - const char *ubsan_default_options = __ubsan_default_options(); - ubsan_parser.ParseString(ubsan_default_options); - ubsan_parser.ParseStringFromEnv("UBSAN_OPTIONS"); -#endif - - InitializeCommonFlags(); - - if (Verbosity()) - ReportUnrecognizedFlags(); - - if (common_flags()->help) { - cfi_parser.PrintFlagDescriptions(); - } -} - -} // namespace __cfi - -using namespace __cfi; - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void -__cfi_slowpath(u64 CallSiteTypeId, void *Ptr) { - CfiSlowPathCommon(CallSiteTypeId, Ptr, nullptr); -} - -#ifdef CFI_ENABLE_DIAG -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void -__cfi_slowpath_diag(u64 CallSiteTypeId, void *Ptr, void *DiagData) { - CfiSlowPathCommon(CallSiteTypeId, Ptr, DiagData); -} -#endif - -static void EnsureInterceptorsInitialized(); - -// Setup shadow for dlopen()ed libraries. -// The actual shadow setup happens after dlopen() returns, which means that -// a library can not be a target of any CFI checks while its constructors are -// running. It's unclear how to fix this without some extra help from libc. -// In glibc, mmap inside dlopen is not interceptable. -// Maybe a seccomp-bpf filter? -// We could insert a high-priority constructor into the library, but that would -// not help with the uninstrumented libraries. -INTERCEPTOR(void*, dlopen, const char *filename, int flag) { - EnsureInterceptorsInitialized(); - EnterLoader(); - void *handle = REAL(dlopen)(filename, flag); - ExitLoader(); - return handle; -} - -INTERCEPTOR(int, dlclose, void *handle) { - EnsureInterceptorsInitialized(); - EnterLoader(); - int res = REAL(dlclose)(handle); - ExitLoader(); - return res; -} - -static Mutex interceptor_init_lock; -static bool interceptors_inited = false; - -static void EnsureInterceptorsInitialized() { - Lock lock(&interceptor_init_lock); - if (interceptors_inited) - return; - - INTERCEPT_FUNCTION(dlopen); - INTERCEPT_FUNCTION(dlclose); - - interceptors_inited = true; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -#if !SANITIZER_CAN_USE_PREINIT_ARRAY -// On ELF platforms, the constructor is invoked using .preinit_array (see below) -__attribute__((constructor(0))) -#endif -void __cfi_init() { - SanitizerToolName = "CFI"; - InitializeFlags(); - InitShadow(); - -#ifdef CFI_ENABLE_DIAG - __ubsan::InitAsPlugin(); -#endif -} - -#if SANITIZER_CAN_USE_PREINIT_ARRAY -// On ELF platforms, run cfi initialization before any other constructors. -// On other platforms we use the constructor attribute to arrange to run our -// initialization early. -extern "C" { -__attribute__((section(".preinit_array"), - used)) void (*__cfi_preinit)(void) = __cfi_init; -} -#endif diff --git a/contrib/libs/clang14-rt/lib/cfi/ya.make b/contrib/libs/clang14-rt/lib/cfi/ya.make deleted file mode 100644 index f7f1c0b1b2ee..000000000000 --- a/contrib/libs/clang14-rt/lib/cfi/ya.make +++ /dev/null @@ -1,99 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.cfi${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DHAVE_RPC_XDR_H=0 - -fcommon - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - cfi/cfi.cpp - interception/interception_linux.cpp - interception/interception_mac.cpp - interception/interception_type_test.cpp - interception/interception_win.cpp - sanitizer_common/sanitizer_allocator.cpp - sanitizer_common/sanitizer_allocator_checks.cpp - sanitizer_common/sanitizer_common.cpp - sanitizer_common/sanitizer_common_libcdep.cpp - sanitizer_common/sanitizer_deadlock_detector1.cpp - sanitizer_common/sanitizer_deadlock_detector2.cpp - sanitizer_common/sanitizer_errno.cpp - sanitizer_common/sanitizer_file.cpp - sanitizer_common/sanitizer_flag_parser.cpp - sanitizer_common/sanitizer_flags.cpp - sanitizer_common/sanitizer_fuchsia.cpp - sanitizer_common/sanitizer_libc.cpp - sanitizer_common/sanitizer_libignore.cpp - sanitizer_common/sanitizer_linux.cpp - sanitizer_common/sanitizer_linux_libcdep.cpp - sanitizer_common/sanitizer_linux_s390.cpp - sanitizer_common/sanitizer_mac.cpp - sanitizer_common/sanitizer_mac_libcdep.cpp - sanitizer_common/sanitizer_mutex.cpp - sanitizer_common/sanitizer_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_freebsd.cpp - sanitizer_common/sanitizer_platform_limits_linux.cpp - sanitizer_common/sanitizer_platform_limits_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_posix.cpp - sanitizer_common/sanitizer_platform_limits_solaris.cpp - sanitizer_common/sanitizer_posix.cpp - sanitizer_common/sanitizer_posix_libcdep.cpp - sanitizer_common/sanitizer_printf.cpp - sanitizer_common/sanitizer_procmaps_bsd.cpp - sanitizer_common/sanitizer_procmaps_common.cpp - sanitizer_common/sanitizer_procmaps_fuchsia.cpp - sanitizer_common/sanitizer_procmaps_linux.cpp - sanitizer_common/sanitizer_procmaps_mac.cpp - sanitizer_common/sanitizer_procmaps_solaris.cpp - sanitizer_common/sanitizer_solaris.cpp - sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp - sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_mac.cpp - sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_win.cpp - sanitizer_common/sanitizer_suppressions.cpp - sanitizer_common/sanitizer_termination.cpp - sanitizer_common/sanitizer_thread_registry.cpp - sanitizer_common/sanitizer_tls_get_addr.cpp - sanitizer_common/sanitizer_type_traits.cpp - sanitizer_common/sanitizer_win.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/cfi_diag/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/cfi_diag/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/cfi_diag/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/cfi_diag/ya.make b/contrib/libs/clang14-rt/lib/cfi_diag/ya.make deleted file mode 100644 index 24924b397840..000000000000 --- a/contrib/libs/clang14-rt/lib/cfi_diag/ya.make +++ /dev/null @@ -1,129 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.cfi_diag${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DCFI_ENABLE_DIAG=1 - -DHAVE_RPC_XDR_H=0 - -DUBSAN_CAN_USE_CXXABI - -fcommon - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - cfi/cfi.cpp - interception/interception_linux.cpp - interception/interception_mac.cpp - interception/interception_type_test.cpp - interception/interception_win.cpp - sanitizer_common/sancov_flags.cpp - sanitizer_common/sanitizer_allocator.cpp - sanitizer_common/sanitizer_allocator_checks.cpp - sanitizer_common/sanitizer_allocator_report.cpp - sanitizer_common/sanitizer_chained_origin_depot.cpp - sanitizer_common/sanitizer_common.cpp - sanitizer_common/sanitizer_common_libcdep.cpp - sanitizer_common/sanitizer_coverage_fuchsia.cpp - sanitizer_common/sanitizer_coverage_libcdep_new.cpp - sanitizer_common/sanitizer_coverage_win_sections.cpp - sanitizer_common/sanitizer_deadlock_detector1.cpp - sanitizer_common/sanitizer_deadlock_detector2.cpp - sanitizer_common/sanitizer_errno.cpp - sanitizer_common/sanitizer_file.cpp - sanitizer_common/sanitizer_flag_parser.cpp - sanitizer_common/sanitizer_flags.cpp - sanitizer_common/sanitizer_fuchsia.cpp - sanitizer_common/sanitizer_libc.cpp - sanitizer_common/sanitizer_libignore.cpp - sanitizer_common/sanitizer_linux.cpp - sanitizer_common/sanitizer_linux_libcdep.cpp - sanitizer_common/sanitizer_linux_s390.cpp - sanitizer_common/sanitizer_mac.cpp - sanitizer_common/sanitizer_mac_libcdep.cpp - sanitizer_common/sanitizer_mutex.cpp - sanitizer_common/sanitizer_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_freebsd.cpp - sanitizer_common/sanitizer_platform_limits_linux.cpp - sanitizer_common/sanitizer_platform_limits_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_posix.cpp - sanitizer_common/sanitizer_platform_limits_solaris.cpp - sanitizer_common/sanitizer_posix.cpp - sanitizer_common/sanitizer_posix_libcdep.cpp - sanitizer_common/sanitizer_printf.cpp - sanitizer_common/sanitizer_procmaps_bsd.cpp - sanitizer_common/sanitizer_procmaps_common.cpp - sanitizer_common/sanitizer_procmaps_fuchsia.cpp - sanitizer_common/sanitizer_procmaps_linux.cpp - sanitizer_common/sanitizer_procmaps_mac.cpp - sanitizer_common/sanitizer_procmaps_solaris.cpp - sanitizer_common/sanitizer_solaris.cpp - sanitizer_common/sanitizer_stack_store.cpp - sanitizer_common/sanitizer_stackdepot.cpp - sanitizer_common/sanitizer_stacktrace.cpp - sanitizer_common/sanitizer_stacktrace_libcdep.cpp - sanitizer_common/sanitizer_stacktrace_printer.cpp - sanitizer_common/sanitizer_stacktrace_sparc.cpp - sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp - sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_mac.cpp - sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_win.cpp - sanitizer_common/sanitizer_suppressions.cpp - sanitizer_common/sanitizer_symbolizer.cpp - sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp - sanitizer_common/sanitizer_symbolizer_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_mac.cpp - sanitizer_common/sanitizer_symbolizer_markup.cpp - sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_report.cpp - sanitizer_common/sanitizer_symbolizer_win.cpp - sanitizer_common/sanitizer_termination.cpp - sanitizer_common/sanitizer_thread_registry.cpp - sanitizer_common/sanitizer_tls_get_addr.cpp - sanitizer_common/sanitizer_type_traits.cpp - sanitizer_common/sanitizer_unwind_linux_libcdep.cpp - sanitizer_common/sanitizer_unwind_win.cpp - sanitizer_common/sanitizer_win.cpp - ubsan/ubsan_diag.cpp - ubsan/ubsan_flags.cpp - ubsan/ubsan_handlers.cpp - ubsan/ubsan_init.cpp - ubsan/ubsan_monitor.cpp - ubsan/ubsan_value.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/dd/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/dd/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/dd/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/dd/ya.make b/contrib/libs/clang14-rt/lib/dd/ya.make deleted file mode 100644 index 569155996ccd..000000000000 --- a/contrib/libs/clang14-rt/lib/dd/ya.make +++ /dev/null @@ -1,100 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.dd${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DHAVE_RPC_XDR_H=0 - -fcommon - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - interception/interception_linux.cpp - interception/interception_mac.cpp - interception/interception_type_test.cpp - interception/interception_win.cpp - sanitizer_common/sanitizer_allocator.cpp - sanitizer_common/sanitizer_allocator_checks.cpp - sanitizer_common/sanitizer_common.cpp - sanitizer_common/sanitizer_common_libcdep.cpp - sanitizer_common/sanitizer_deadlock_detector1.cpp - sanitizer_common/sanitizer_deadlock_detector2.cpp - sanitizer_common/sanitizer_errno.cpp - sanitizer_common/sanitizer_file.cpp - sanitizer_common/sanitizer_flag_parser.cpp - sanitizer_common/sanitizer_flags.cpp - sanitizer_common/sanitizer_fuchsia.cpp - sanitizer_common/sanitizer_libc.cpp - sanitizer_common/sanitizer_libignore.cpp - sanitizer_common/sanitizer_linux.cpp - sanitizer_common/sanitizer_linux_libcdep.cpp - sanitizer_common/sanitizer_linux_s390.cpp - sanitizer_common/sanitizer_mac.cpp - sanitizer_common/sanitizer_mac_libcdep.cpp - sanitizer_common/sanitizer_mutex.cpp - sanitizer_common/sanitizer_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_freebsd.cpp - sanitizer_common/sanitizer_platform_limits_linux.cpp - sanitizer_common/sanitizer_platform_limits_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_posix.cpp - sanitizer_common/sanitizer_platform_limits_solaris.cpp - sanitizer_common/sanitizer_posix.cpp - sanitizer_common/sanitizer_posix_libcdep.cpp - sanitizer_common/sanitizer_printf.cpp - sanitizer_common/sanitizer_procmaps_bsd.cpp - sanitizer_common/sanitizer_procmaps_common.cpp - sanitizer_common/sanitizer_procmaps_fuchsia.cpp - sanitizer_common/sanitizer_procmaps_linux.cpp - sanitizer_common/sanitizer_procmaps_mac.cpp - sanitizer_common/sanitizer_procmaps_solaris.cpp - sanitizer_common/sanitizer_solaris.cpp - sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp - sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_mac.cpp - sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_win.cpp - sanitizer_common/sanitizer_suppressions.cpp - sanitizer_common/sanitizer_termination.cpp - sanitizer_common/sanitizer_thread_registry.cpp - sanitizer_common/sanitizer_tls_get_addr.cpp - sanitizer_common/sanitizer_type_traits.cpp - sanitizer_common/sanitizer_win.cpp - tsan/dd/dd_interceptors.cpp - tsan/dd/dd_rtl.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/dfsan/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/dfsan/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan.cpp b/contrib/libs/clang14-rt/lib/dfsan/dfsan.cpp deleted file mode 100644 index afb01c7d889e..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan.cpp +++ /dev/null @@ -1,1127 +0,0 @@ -//===-- dfsan.cpp ---------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// DataFlowSanitizer runtime. This file defines the public interface to -// DataFlowSanitizer as well as the definition of certain runtime functions -// called automatically by the compiler (specifically the instrumentation pass -// in llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp). -// -// The public interface is defined in include/sanitizer/dfsan_interface.h whose -// functions are prefixed dfsan_ while the compiler interface functions are -// prefixed __dfsan_. -//===----------------------------------------------------------------------===// - -#include "dfsan/dfsan.h" - -#include "dfsan/dfsan_chained_origin_depot.h" -#include "dfsan/dfsan_flags.h" -#include "dfsan/dfsan_origin.h" -#include "dfsan/dfsan_thread.h" -#include "sanitizer_common/sanitizer_atomic.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_file.h" -#include "sanitizer_common/sanitizer_flag_parser.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_report_decorator.h" -#include "sanitizer_common/sanitizer_stacktrace.h" - -using namespace __dfsan; - -Flags __dfsan::flags_data; - -// The size of TLS variables. These constants must be kept in sync with the ones -// in DataFlowSanitizer.cpp. -static const int kDFsanArgTlsSize = 800; -static const int kDFsanRetvalTlsSize = 800; -static const int kDFsanArgOriginTlsSize = 800; - -SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u64 - __dfsan_retval_tls[kDFsanRetvalTlsSize / sizeof(u64)]; -SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u32 __dfsan_retval_origin_tls; -SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u64 - __dfsan_arg_tls[kDFsanArgTlsSize / sizeof(u64)]; -SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u32 - __dfsan_arg_origin_tls[kDFsanArgOriginTlsSize / sizeof(u32)]; - -// Instrumented code may set this value in terms of -dfsan-track-origins. -// * undefined or 0: do not track origins. -// * 1: track origins at memory store operations. -// * 2: track origins at memory load and store operations. -// TODO: track callsites. -extern "C" SANITIZER_WEAK_ATTRIBUTE const int __dfsan_track_origins; - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE int dfsan_get_track_origins() { - return &__dfsan_track_origins ? __dfsan_track_origins : 0; -} - -// On Linux/x86_64, memory is laid out as follows: -// -// +--------------------+ 0x800000000000 (top of memory) -// | application 3 | -// +--------------------+ 0x700000000000 -// | invalid | -// +--------------------+ 0x610000000000 -// | origin 1 | -// +--------------------+ 0x600000000000 -// | application 2 | -// +--------------------+ 0x510000000000 -// | shadow 1 | -// +--------------------+ 0x500000000000 -// | invalid | -// +--------------------+ 0x400000000000 -// | origin 3 | -// +--------------------+ 0x300000000000 -// | shadow 3 | -// +--------------------+ 0x200000000000 -// | origin 2 | -// +--------------------+ 0x110000000000 -// | invalid | -// +--------------------+ 0x100000000000 -// | shadow 2 | -// +--------------------+ 0x010000000000 -// | application 1 | -// +--------------------+ 0x000000000000 -// -// MEM_TO_SHADOW(mem) = mem ^ 0x500000000000 -// SHADOW_TO_ORIGIN(shadow) = shadow + 0x100000000000 - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -dfsan_label __dfsan_union_load(const dfsan_label *ls, uptr n) { - dfsan_label label = ls[0]; - for (uptr i = 1; i != n; ++i) - label |= ls[i]; - return label; -} - -// Return the union of all the n labels from addr at the high 32 bit, and the -// origin of the first taint byte at the low 32 bit. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE u64 -__dfsan_load_label_and_origin(const void *addr, uptr n) { - dfsan_label label = 0; - u64 ret = 0; - uptr p = (uptr)addr; - dfsan_label *s = shadow_for((void *)p); - for (uptr i = 0; i < n; ++i) { - dfsan_label l = s[i]; - if (!l) - continue; - label |= l; - if (!ret) - ret = *(dfsan_origin *)origin_for((void *)(p + i)); - } - return ret | (u64)label << 32; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE -void __dfsan_unimplemented(char *fname) { - if (flags().warn_unimplemented) - Report("WARNING: DataFlowSanitizer: call to uninstrumented function %s\n", - fname); -} - -// Use '-mllvm -dfsan-debug-nonzero-labels' and break on this function -// to try to figure out where labels are being introduced in a nominally -// label-free program. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __dfsan_nonzero_label() { - if (flags().warn_nonzero_labels) - Report("WARNING: DataFlowSanitizer: saw nonzero label\n"); -} - -// Indirect call to an uninstrumented vararg function. We don't have a way of -// handling these at the moment. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void -__dfsan_vararg_wrapper(const char *fname) { - Report("FATAL: DataFlowSanitizer: unsupported indirect call to vararg " - "function %s\n", fname); - Die(); -} - -// Resolves the union of two labels. -SANITIZER_INTERFACE_ATTRIBUTE dfsan_label -dfsan_union(dfsan_label l1, dfsan_label l2) { - return l1 | l2; -} - -static const uptr kOriginAlign = sizeof(dfsan_origin); -static const uptr kOriginAlignMask = ~(kOriginAlign - 1UL); - -static uptr OriginAlignUp(uptr u) { - return (u + kOriginAlign - 1) & kOriginAlignMask; -} - -static uptr OriginAlignDown(uptr u) { return u & kOriginAlignMask; } - -// Return the origin of the first taint byte in the size bytes from the address -// addr. -static dfsan_origin GetOriginIfTainted(uptr addr, uptr size) { - for (uptr i = 0; i < size; ++i, ++addr) { - dfsan_label *s = shadow_for((void *)addr); - - if (*s) { - // Validate address region. - CHECK(MEM_IS_SHADOW(s)); - return *(dfsan_origin *)origin_for((void *)addr); - } - } - return 0; -} - -// For platforms which support slow unwinder only, we need to restrict the store -// context size to 1, basically only storing the current pc, because the slow -// unwinder which is based on libunwind is not async signal safe and causes -// random freezes in forking applications as well as in signal handlers. -// DFSan supports only Linux. So we do not restrict the store context size. -#define GET_STORE_STACK_TRACE_PC_BP(pc, bp) \ - BufferedStackTrace stack; \ - stack.Unwind(pc, bp, nullptr, true, flags().store_context_size); - -#define PRINT_CALLER_STACK_TRACE \ - { \ - GET_CALLER_PC_BP_SP; \ - (void)sp; \ - GET_STORE_STACK_TRACE_PC_BP(pc, bp) \ - stack.Print(); \ - } - -// Return a chain with the previous ID id and the current stack. -// from_init = true if this is the first chain of an origin tracking path. -static u32 ChainOrigin(u32 id, StackTrace *stack, bool from_init = false) { - // StackDepot is not async signal safe. Do not create new chains in a signal - // handler. - DFsanThread *t = GetCurrentThread(); - if (t && t->InSignalHandler()) - return id; - - // As an optimization the origin of an application byte is updated only when - // its shadow is non-zero. Because we are only interested in the origins of - // taint labels, it does not matter what origin a zero label has. This reduces - // memory write cost. MSan does similar optimization. The following invariant - // may not hold because of some bugs. We check the invariant to help debug. - if (!from_init && id == 0 && flags().check_origin_invariant) { - Printf(" DFSan found invalid origin invariant\n"); - PRINT_CALLER_STACK_TRACE - } - - Origin o = Origin::FromRawId(id); - stack->tag = StackTrace::TAG_UNKNOWN; - Origin chained = Origin::CreateChainedOrigin(o, stack); - return chained.raw_id(); -} - -static void ChainAndWriteOriginIfTainted(uptr src, uptr size, uptr dst, - StackTrace *stack) { - dfsan_origin o = GetOriginIfTainted(src, size); - if (o) { - o = ChainOrigin(o, stack); - *(dfsan_origin *)origin_for((void *)dst) = o; - } -} - -// Copy the origins of the size bytes from src to dst. The source and target -// memory ranges cannot be overlapped. This is used by memcpy. stack records the -// stack trace of the memcpy. When dst and src are not 4-byte aligned properly, -// origins at the unaligned address boundaries may be overwritten because four -// contiguous bytes share the same origin. -static void CopyOrigin(const void *dst, const void *src, uptr size, - StackTrace *stack) { - uptr d = (uptr)dst; - uptr beg = OriginAlignDown(d); - // Copy left unaligned origin if that memory is tainted. - if (beg < d) { - ChainAndWriteOriginIfTainted((uptr)src, beg + kOriginAlign - d, beg, stack); - beg += kOriginAlign; - } - - uptr end = OriginAlignDown(d + size); - // If both ends fall into the same 4-byte slot, we are done. - if (end < beg) - return; - - // Copy right unaligned origin if that memory is tainted. - if (end < d + size) - ChainAndWriteOriginIfTainted((uptr)src + (end - d), (d + size) - end, end, - stack); - - if (beg >= end) - return; - - // Align src up. - uptr src_a = OriginAlignUp((uptr)src); - dfsan_origin *src_o = origin_for((void *)src_a); - u32 *src_s = (u32 *)shadow_for((void *)src_a); - dfsan_origin *src_end = origin_for((void *)(src_a + (end - beg))); - dfsan_origin *dst_o = origin_for((void *)beg); - dfsan_origin last_src_o = 0; - dfsan_origin last_dst_o = 0; - for (; src_o < src_end; ++src_o, ++src_s, ++dst_o) { - if (!*src_s) - continue; - if (*src_o != last_src_o) { - last_src_o = *src_o; - last_dst_o = ChainOrigin(last_src_o, stack); - } - *dst_o = last_dst_o; - } -} - -// Copy the origins of the size bytes from src to dst. The source and target -// memory ranges may be overlapped. So the copy is done in a reverse order. -// This is used by memmove. stack records the stack trace of the memmove. -static void ReverseCopyOrigin(const void *dst, const void *src, uptr size, - StackTrace *stack) { - uptr d = (uptr)dst; - uptr end = OriginAlignDown(d + size); - - // Copy right unaligned origin if that memory is tainted. - if (end < d + size) - ChainAndWriteOriginIfTainted((uptr)src + (end - d), (d + size) - end, end, - stack); - - uptr beg = OriginAlignDown(d); - - if (beg + kOriginAlign < end) { - // Align src up. - uptr src_a = OriginAlignUp((uptr)src); - void *src_end = (void *)(src_a + end - beg - kOriginAlign); - dfsan_origin *src_end_o = origin_for(src_end); - u32 *src_end_s = (u32 *)shadow_for(src_end); - dfsan_origin *src_begin_o = origin_for((void *)src_a); - dfsan_origin *dst = origin_for((void *)(end - kOriginAlign)); - dfsan_origin last_src_o = 0; - dfsan_origin last_dst_o = 0; - for (; src_end_o >= src_begin_o; --src_end_o, --src_end_s, --dst) { - if (!*src_end_s) - continue; - if (*src_end_o != last_src_o) { - last_src_o = *src_end_o; - last_dst_o = ChainOrigin(last_src_o, stack); - } - *dst = last_dst_o; - } - } - - // Copy left unaligned origin if that memory is tainted. - if (beg < d) - ChainAndWriteOriginIfTainted((uptr)src, beg + kOriginAlign - d, beg, stack); -} - -// Copy or move the origins of the len bytes from src to dst. The source and -// target memory ranges may or may not be overlapped. This is used by memory -// transfer operations. stack records the stack trace of the memory transfer -// operation. -static void MoveOrigin(const void *dst, const void *src, uptr size, - StackTrace *stack) { - // Validate address regions. - if (!MEM_IS_SHADOW(shadow_for(dst)) || - !MEM_IS_SHADOW(shadow_for((void *)((uptr)dst + size))) || - !MEM_IS_SHADOW(shadow_for(src)) || - !MEM_IS_SHADOW(shadow_for((void *)((uptr)src + size)))) { - CHECK(false); - return; - } - // If destination origin range overlaps with source origin range, move - // origins by copying origins in a reverse order; otherwise, copy origins in - // a normal order. The orders of origin transfer are consistent with the - // orders of how memcpy and memmove transfer user data. - uptr src_aligned_beg = OriginAlignDown((uptr)src); - uptr src_aligned_end = OriginAlignDown((uptr)src + size); - uptr dst_aligned_beg = OriginAlignDown((uptr)dst); - if (dst_aligned_beg < src_aligned_end && dst_aligned_beg >= src_aligned_beg) - return ReverseCopyOrigin(dst, src, size, stack); - return CopyOrigin(dst, src, size, stack); -} - -// Set the size bytes from the addres dst to be the origin value. -static void SetOrigin(const void *dst, uptr size, u32 origin) { - if (size == 0) - return; - - // Origin mapping is 4 bytes per 4 bytes of application memory. - // Here we extend the range such that its left and right bounds are both - // 4 byte aligned. - uptr x = unaligned_origin_for((uptr)dst); - uptr beg = OriginAlignDown(x); - uptr end = OriginAlignUp(x + size); // align up. - u64 origin64 = ((u64)origin << 32) | origin; - // This is like memset, but the value is 32-bit. We unroll by 2 to write - // 64 bits at once. May want to unroll further to get 128-bit stores. - if (beg & 7ULL) { - if (*(u32 *)beg != origin) - *(u32 *)beg = origin; - beg += 4; - } - for (uptr addr = beg; addr < (end & ~7UL); addr += 8) { - if (*(u64 *)addr == origin64) - continue; - *(u64 *)addr = origin64; - } - if (end & 7ULL) - if (*(u32 *)(end - kOriginAlign) != origin) - *(u32 *)(end - kOriginAlign) = origin; -} - -#define RET_CHAIN_ORIGIN(id) \ - GET_CALLER_PC_BP_SP; \ - (void)sp; \ - GET_STORE_STACK_TRACE_PC_BP(pc, bp); \ - return ChainOrigin(id, &stack); - -// Return a new origin chain with the previous ID id and the current stack -// trace. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_origin -__dfsan_chain_origin(dfsan_origin id) { - RET_CHAIN_ORIGIN(id) -} - -// Return a new origin chain with the previous ID id and the current stack -// trace if the label is tainted. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_origin -__dfsan_chain_origin_if_tainted(dfsan_label label, dfsan_origin id) { - if (!label) - return id; - RET_CHAIN_ORIGIN(id) -} - -// Copy or move the origins of the len bytes from src to dst. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __dfsan_mem_origin_transfer( - const void *dst, const void *src, uptr len) { - if (src == dst) - return; - GET_CALLER_PC_BP; - GET_STORE_STACK_TRACE_PC_BP(pc, bp); - MoveOrigin(dst, src, len, &stack); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void dfsan_mem_origin_transfer( - const void *dst, const void *src, uptr len) { - __dfsan_mem_origin_transfer(dst, src, len); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void dfsan_mem_shadow_transfer( - void *dst, const void *src, uptr len) { - internal_memcpy((void *)__dfsan::shadow_for(dst), - (const void *)__dfsan::shadow_for(src), - len * sizeof(dfsan_label)); -} - -namespace __dfsan { - -bool dfsan_inited = false; -bool dfsan_init_is_running = false; - -void dfsan_copy_memory(void *dst, const void *src, uptr size) { - internal_memcpy(dst, src, size); - dfsan_mem_shadow_transfer(dst, src, size); - if (dfsan_get_track_origins()) - dfsan_mem_origin_transfer(dst, src, size); -} - -// Releases the pages within the origin address range. -static void ReleaseOrigins(void *addr, uptr size) { - const uptr beg_origin_addr = (uptr)__dfsan::origin_for(addr); - const void *end_addr = (void *)((uptr)addr + size); - const uptr end_origin_addr = (uptr)__dfsan::origin_for(end_addr); - - if (end_origin_addr - beg_origin_addr < - common_flags()->clear_shadow_mmap_threshold) - return; - - const uptr page_size = GetPageSizeCached(); - const uptr beg_aligned = RoundUpTo(beg_origin_addr, page_size); - const uptr end_aligned = RoundDownTo(end_origin_addr, page_size); - - if (!MmapFixedSuperNoReserve(beg_aligned, end_aligned - beg_aligned)) - Die(); -} - -static void WriteZeroShadowInRange(uptr beg, uptr end) { - // Don't write the label if it is already the value we need it to be. - // In a program where most addresses are not labeled, it is common that - // a page of shadow memory is entirely zeroed. The Linux copy-on-write - // implementation will share all of the zeroed pages, making a copy of a - // page when any value is written. The un-sharing will happen even if - // the value written does not change the value in memory. Avoiding the - // write when both |label| and |*labelp| are zero dramatically reduces - // the amount of real memory used by large programs. - if (!mem_is_zero((const char *)beg, end - beg)) - internal_memset((void *)beg, 0, end - beg); -} - -// Releases the pages within the shadow address range, and sets -// the shadow addresses not on the pages to be 0. -static void ReleaseOrClearShadows(void *addr, uptr size) { - const uptr beg_shadow_addr = (uptr)__dfsan::shadow_for(addr); - const void *end_addr = (void *)((uptr)addr + size); - const uptr end_shadow_addr = (uptr)__dfsan::shadow_for(end_addr); - - if (end_shadow_addr - beg_shadow_addr < - common_flags()->clear_shadow_mmap_threshold) { - WriteZeroShadowInRange(beg_shadow_addr, end_shadow_addr); - return; - } - - const uptr page_size = GetPageSizeCached(); - const uptr beg_aligned = RoundUpTo(beg_shadow_addr, page_size); - const uptr end_aligned = RoundDownTo(end_shadow_addr, page_size); - - if (beg_aligned >= end_aligned) { - WriteZeroShadowInRange(beg_shadow_addr, end_shadow_addr); - } else { - if (beg_aligned != beg_shadow_addr) - WriteZeroShadowInRange(beg_shadow_addr, beg_aligned); - if (end_aligned != end_shadow_addr) - WriteZeroShadowInRange(end_aligned, end_shadow_addr); - if (!MmapFixedSuperNoReserve(beg_aligned, end_aligned - beg_aligned)) - Die(); - } -} - -void SetShadow(dfsan_label label, void *addr, uptr size, dfsan_origin origin) { - if (0 != label) { - const uptr beg_shadow_addr = (uptr)__dfsan::shadow_for(addr); - internal_memset((void *)beg_shadow_addr, label, size); - if (dfsan_get_track_origins()) - SetOrigin(addr, size, origin); - return; - } - - if (dfsan_get_track_origins()) - ReleaseOrigins(addr, size); - - ReleaseOrClearShadows(addr, size); -} - -} // namespace __dfsan - -// If the label s is tainted, set the size bytes from the address p to be a new -// origin chain with the previous ID o and the current stack trace. This is -// used by instrumentation to reduce code size when too much code is inserted. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __dfsan_maybe_store_origin( - dfsan_label s, void *p, uptr size, dfsan_origin o) { - if (UNLIKELY(s)) { - GET_CALLER_PC_BP_SP; - (void)sp; - GET_STORE_STACK_TRACE_PC_BP(pc, bp); - SetOrigin(p, size, ChainOrigin(o, &stack)); - } -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __dfsan_set_label( - dfsan_label label, dfsan_origin origin, void *addr, uptr size) { - __dfsan::SetShadow(label, addr, size, origin); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void dfsan_set_label(dfsan_label label, void *addr, uptr size) { - dfsan_origin init_origin = 0; - if (label && dfsan_get_track_origins()) { - GET_CALLER_PC_BP; - GET_STORE_STACK_TRACE_PC_BP(pc, bp); - init_origin = ChainOrigin(0, &stack, true); - } - __dfsan::SetShadow(label, addr, size, init_origin); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void dfsan_add_label(dfsan_label label, void *addr, uptr size) { - if (0 == label) - return; - - if (dfsan_get_track_origins()) { - GET_CALLER_PC_BP; - GET_STORE_STACK_TRACE_PC_BP(pc, bp); - dfsan_origin init_origin = ChainOrigin(0, &stack, true); - SetOrigin(addr, size, init_origin); - } - - for (dfsan_label *labelp = shadow_for(addr); size != 0; --size, ++labelp) - *labelp |= label; -} - -// Unlike the other dfsan interface functions the behavior of this function -// depends on the label of one of its arguments. Hence it is implemented as a -// custom function. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_label -__dfsw_dfsan_get_label(long data, dfsan_label data_label, - dfsan_label *ret_label) { - *ret_label = 0; - return data_label; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_label __dfso_dfsan_get_label( - long data, dfsan_label data_label, dfsan_label *ret_label, - dfsan_origin data_origin, dfsan_origin *ret_origin) { - *ret_label = 0; - *ret_origin = 0; - return data_label; -} - -// This function is used if dfsan_get_origin is called when origin tracking is -// off. -extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_origin __dfsw_dfsan_get_origin( - long data, dfsan_label data_label, dfsan_label *ret_label) { - *ret_label = 0; - return 0; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_origin __dfso_dfsan_get_origin( - long data, dfsan_label data_label, dfsan_label *ret_label, - dfsan_origin data_origin, dfsan_origin *ret_origin) { - *ret_label = 0; - *ret_origin = 0; - return data_origin; -} - -SANITIZER_INTERFACE_ATTRIBUTE dfsan_label -dfsan_read_label(const void *addr, uptr size) { - if (size == 0) - return 0; - return __dfsan_union_load(shadow_for(addr), size); -} - -SANITIZER_INTERFACE_ATTRIBUTE dfsan_origin -dfsan_read_origin_of_first_taint(const void *addr, uptr size) { - return GetOriginIfTainted((uptr)addr, size); -} - -SANITIZER_INTERFACE_ATTRIBUTE void dfsan_set_label_origin(dfsan_label label, - dfsan_origin origin, - void *addr, - uptr size) { - __dfsan_set_label(label, origin, addr, size); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE int -dfsan_has_label(dfsan_label label, dfsan_label elem) { - return (label & elem) == elem; -} - -namespace __dfsan { - -typedef void (*dfsan_conditional_callback_t)(dfsan_label label, - dfsan_origin origin); -static dfsan_conditional_callback_t conditional_callback = nullptr; -static dfsan_label labels_in_signal_conditional = 0; - -static void ConditionalCallback(dfsan_label label, dfsan_origin origin) { - // Programs have many branches. For efficiency the conditional sink callback - // handler needs to ignore as many as possible as early as possible. - if (label == 0) { - return; - } - if (conditional_callback == nullptr) { - return; - } - - // This initial ConditionalCallback handler needs to be in here in dfsan - // runtime (rather than being an entirely user implemented hook) so that it - // has access to dfsan thread information. - DFsanThread *t = GetCurrentThread(); - // A callback operation which does useful work (like record the flow) will - // likely be too long executed in a signal handler. - if (t && t->InSignalHandler()) { - // Record set of labels used in signal handler for completeness. - labels_in_signal_conditional |= label; - return; - } - - conditional_callback(label, origin); -} - -} // namespace __dfsan - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void -__dfsan_conditional_callback_origin(dfsan_label label, dfsan_origin origin) { - __dfsan::ConditionalCallback(label, origin); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __dfsan_conditional_callback( - dfsan_label label) { - __dfsan::ConditionalCallback(label, 0); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void dfsan_set_conditional_callback( - __dfsan::dfsan_conditional_callback_t callback) { - __dfsan::conditional_callback = callback; -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_label -dfsan_get_labels_in_signal_conditional() { - return __dfsan::labels_in_signal_conditional; -} - -class Decorator : public __sanitizer::SanitizerCommonDecorator { - public: - Decorator() : SanitizerCommonDecorator() {} - const char *Origin() const { return Magenta(); } -}; - -namespace { - -void PrintNoOriginTrackingWarning() { - Decorator d; - Printf( - " %sDFSan: origin tracking is not enabled. Did you specify the " - "-dfsan-track-origins=1 option?%s\n", - d.Warning(), d.Default()); -} - -void PrintNoTaintWarning(const void *address) { - Decorator d; - Printf(" %sDFSan: no tainted value at %x%s\n", d.Warning(), address, - d.Default()); -} - -void PrintInvalidOriginWarning(dfsan_label label, const void *address) { - Decorator d; - Printf( - " %sTaint value 0x%x (at %p) has invalid origin tracking. This can " - "be a DFSan bug.%s\n", - d.Warning(), label, address, d.Default()); -} - -void PrintInvalidOriginIdWarning(dfsan_origin origin) { - Decorator d; - Printf( - " %sOrigin Id %d has invalid origin tracking. This can " - "be a DFSan bug.%s\n", - d.Warning(), origin, d.Default()); -} - -bool PrintOriginTraceFramesToStr(Origin o, InternalScopedString *out) { - Decorator d; - bool found = false; - - while (o.isChainedOrigin()) { - StackTrace stack; - dfsan_origin origin_id = o.raw_id(); - o = o.getNextChainedOrigin(&stack); - if (o.isChainedOrigin()) - out->append( - " %sOrigin value: 0x%x, Taint value was stored to memory at%s\n", - d.Origin(), origin_id, d.Default()); - else - out->append(" %sOrigin value: 0x%x, Taint value was created at%s\n", - d.Origin(), origin_id, d.Default()); - - // Includes a trailing newline, so no need to add it again. - stack.PrintTo(out); - found = true; - } - - return found; -} - -bool PrintOriginTraceToStr(const void *addr, const char *description, - InternalScopedString *out) { - CHECK(out); - CHECK(dfsan_get_track_origins()); - Decorator d; - - const dfsan_label label = *__dfsan::shadow_for(addr); - CHECK(label); - - const dfsan_origin origin = *__dfsan::origin_for(addr); - - out->append(" %sTaint value 0x%x (at %p) origin tracking (%s)%s\n", - d.Origin(), label, addr, description ? description : "", - d.Default()); - - Origin o = Origin::FromRawId(origin); - return PrintOriginTraceFramesToStr(o, out); -} - -} // namespace - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void dfsan_print_origin_trace( - const void *addr, const char *description) { - if (!dfsan_get_track_origins()) { - PrintNoOriginTrackingWarning(); - return; - } - - const dfsan_label label = *__dfsan::shadow_for(addr); - if (!label) { - PrintNoTaintWarning(addr); - return; - } - - InternalScopedString trace; - bool success = PrintOriginTraceToStr(addr, description, &trace); - - if (trace.length()) - Printf("%s", trace.data()); - - if (!success) - PrintInvalidOriginWarning(label, addr); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE uptr -dfsan_sprint_origin_trace(const void *addr, const char *description, - char *out_buf, uptr out_buf_size) { - CHECK(out_buf); - - if (!dfsan_get_track_origins()) { - PrintNoOriginTrackingWarning(); - return 0; - } - - const dfsan_label label = *__dfsan::shadow_for(addr); - if (!label) { - PrintNoTaintWarning(addr); - return 0; - } - - InternalScopedString trace; - bool success = PrintOriginTraceToStr(addr, description, &trace); - - if (!success) { - PrintInvalidOriginWarning(label, addr); - return 0; - } - - if (out_buf_size) { - internal_strncpy(out_buf, trace.data(), out_buf_size - 1); - out_buf[out_buf_size - 1] = '\0'; - } - - return trace.length(); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void dfsan_print_origin_id_trace( - dfsan_origin origin) { - if (!dfsan_get_track_origins()) { - PrintNoOriginTrackingWarning(); - return; - } - Origin o = Origin::FromRawId(origin); - - InternalScopedString trace; - bool success = PrintOriginTraceFramesToStr(o, &trace); - - if (trace.length()) - Printf("%s", trace.data()); - - if (!success) - PrintInvalidOriginIdWarning(origin); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE uptr dfsan_sprint_origin_id_trace( - dfsan_origin origin, char *out_buf, uptr out_buf_size) { - CHECK(out_buf); - - if (!dfsan_get_track_origins()) { - PrintNoOriginTrackingWarning(); - return 0; - } - Origin o = Origin::FromRawId(origin); - - InternalScopedString trace; - bool success = PrintOriginTraceFramesToStr(o, &trace); - - if (!success) { - PrintInvalidOriginIdWarning(origin); - return 0; - } - - if (out_buf_size) { - internal_strncpy(out_buf, trace.data(), out_buf_size - 1); - out_buf[out_buf_size - 1] = '\0'; - } - - return trace.length(); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_origin -dfsan_get_init_origin(const void *addr) { - if (!dfsan_get_track_origins()) - return 0; - - const dfsan_label label = *__dfsan::shadow_for(addr); - if (!label) - return 0; - - const dfsan_origin origin = *__dfsan::origin_for(addr); - - Origin o = Origin::FromRawId(origin); - dfsan_origin origin_id = o.raw_id(); - while (o.isChainedOrigin()) { - StackTrace stack; - origin_id = o.raw_id(); - o = o.getNextChainedOrigin(&stack); - } - return origin_id; -} - -void __sanitizer::BufferedStackTrace::UnwindImpl(uptr pc, uptr bp, - void *context, - bool request_fast, - u32 max_depth) { - using namespace __dfsan; - DFsanThread *t = GetCurrentThread(); - if (!t || !StackTrace::WillUseFastUnwind(request_fast)) { - return Unwind(max_depth, pc, bp, context, 0, 0, false); - } - Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(), true); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_print_stack_trace() { - GET_CALLER_PC_BP; - GET_STORE_STACK_TRACE_PC_BP(pc, bp); - stack.Print(); -} - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE uptr -dfsan_sprint_stack_trace(char *out_buf, uptr out_buf_size) { - CHECK(out_buf); - GET_CALLER_PC_BP; - GET_STORE_STACK_TRACE_PC_BP(pc, bp); - return stack.PrintTo(out_buf, out_buf_size); -} - -void Flags::SetDefaults() { -#define DFSAN_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue; -#include "dfsan_flags.inc" -#undef DFSAN_FLAG -} - -static void RegisterDfsanFlags(FlagParser *parser, Flags *f) { -#define DFSAN_FLAG(Type, Name, DefaultValue, Description) \ - RegisterFlag(parser, #Name, Description, &f->Name); -#include "dfsan_flags.inc" -#undef DFSAN_FLAG -} - -static void InitializeFlags() { - SetCommonFlagsDefaults(); - { - CommonFlags cf; - cf.CopyFrom(*common_flags()); - cf.intercept_tls_get_addr = true; - OverrideCommonFlags(cf); - } - flags().SetDefaults(); - - FlagParser parser; - RegisterCommonFlags(&parser); - RegisterDfsanFlags(&parser, &flags()); - parser.ParseStringFromEnv("DFSAN_OPTIONS"); - InitializeCommonFlags(); - if (Verbosity()) ReportUnrecognizedFlags(); - if (common_flags()->help) parser.PrintFlagDescriptions(); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void dfsan_clear_arg_tls(uptr offset, uptr size) { - internal_memset((void *)((uptr)__dfsan_arg_tls + offset), 0, size); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void dfsan_clear_thread_local_state() { - internal_memset(__dfsan_arg_tls, 0, sizeof(__dfsan_arg_tls)); - internal_memset(__dfsan_retval_tls, 0, sizeof(__dfsan_retval_tls)); - - if (dfsan_get_track_origins()) { - internal_memset(__dfsan_arg_origin_tls, 0, sizeof(__dfsan_arg_origin_tls)); - internal_memset(&__dfsan_retval_origin_tls, 0, - sizeof(__dfsan_retval_origin_tls)); - } -} - -extern "C" void dfsan_flush() { - const uptr maxVirtualAddress = GetMaxUserVirtualAddress(); - for (unsigned i = 0; i < kMemoryLayoutSize; ++i) { - uptr start = kMemoryLayout[i].start; - uptr end = kMemoryLayout[i].end; - uptr size = end - start; - MappingDesc::Type type = kMemoryLayout[i].type; - - if (type != MappingDesc::SHADOW && type != MappingDesc::ORIGIN) - continue; - - // Check if the segment should be mapped based on platform constraints. - if (start >= maxVirtualAddress) - continue; - - if (!MmapFixedSuperNoReserve(start, size, kMemoryLayout[i].name)) { - Printf("FATAL: DataFlowSanitizer: failed to clear memory region\n"); - Die(); - } - } - __dfsan::labels_in_signal_conditional = 0; -} - -// TODO: CheckMemoryLayoutSanity is based on msan. -// Consider refactoring these into a shared implementation. -static void CheckMemoryLayoutSanity() { - uptr prev_end = 0; - for (unsigned i = 0; i < kMemoryLayoutSize; ++i) { - uptr start = kMemoryLayout[i].start; - uptr end = kMemoryLayout[i].end; - MappingDesc::Type type = kMemoryLayout[i].type; - CHECK_LT(start, end); - CHECK_EQ(prev_end, start); - CHECK(addr_is_type(start, type)); - CHECK(addr_is_type((start + end) / 2, type)); - CHECK(addr_is_type(end - 1, type)); - if (type == MappingDesc::APP) { - uptr addr = start; - CHECK(MEM_IS_SHADOW(MEM_TO_SHADOW(addr))); - CHECK(MEM_IS_ORIGIN(MEM_TO_ORIGIN(addr))); - CHECK_EQ(MEM_TO_ORIGIN(addr), SHADOW_TO_ORIGIN(MEM_TO_SHADOW(addr))); - - addr = (start + end) / 2; - CHECK(MEM_IS_SHADOW(MEM_TO_SHADOW(addr))); - CHECK(MEM_IS_ORIGIN(MEM_TO_ORIGIN(addr))); - CHECK_EQ(MEM_TO_ORIGIN(addr), SHADOW_TO_ORIGIN(MEM_TO_SHADOW(addr))); - - addr = end - 1; - CHECK(MEM_IS_SHADOW(MEM_TO_SHADOW(addr))); - CHECK(MEM_IS_ORIGIN(MEM_TO_ORIGIN(addr))); - CHECK_EQ(MEM_TO_ORIGIN(addr), SHADOW_TO_ORIGIN(MEM_TO_SHADOW(addr))); - } - prev_end = end; - } -} - -// TODO: CheckMemoryRangeAvailability is based on msan. -// Consider refactoring these into a shared implementation. -static bool CheckMemoryRangeAvailability(uptr beg, uptr size) { - if (size > 0) { - uptr end = beg + size - 1; - if (!MemoryRangeIsAvailable(beg, end)) { - Printf("FATAL: Memory range %p - %p is not available.\n", beg, end); - return false; - } - } - return true; -} - -// TODO: ProtectMemoryRange is based on msan. -// Consider refactoring these into a shared implementation. -static bool ProtectMemoryRange(uptr beg, uptr size, const char *name) { - if (size > 0) { - void *addr = MmapFixedNoAccess(beg, size, name); - if (beg == 0 && addr) { - // Depending on the kernel configuration, we may not be able to protect - // the page at address zero. - uptr gap = 16 * GetPageSizeCached(); - beg += gap; - size -= gap; - addr = MmapFixedNoAccess(beg, size, name); - } - if ((uptr)addr != beg) { - uptr end = beg + size - 1; - Printf("FATAL: Cannot protect memory range %p - %p (%s).\n", beg, end, - name); - return false; - } - } - return true; -} - -// TODO: InitShadow is based on msan. -// Consider refactoring these into a shared implementation. -bool InitShadow(bool init_origins) { - // Let user know mapping parameters first. - VPrintf(1, "dfsan_init %p\n", (void *)&__dfsan::dfsan_init); - for (unsigned i = 0; i < kMemoryLayoutSize; ++i) - VPrintf(1, "%s: %zx - %zx\n", kMemoryLayout[i].name, kMemoryLayout[i].start, - kMemoryLayout[i].end - 1); - - CheckMemoryLayoutSanity(); - - if (!MEM_IS_APP(&__dfsan::dfsan_init)) { - Printf("FATAL: Code %p is out of application range. Non-PIE build?\n", - (uptr)&__dfsan::dfsan_init); - return false; - } - - const uptr maxVirtualAddress = GetMaxUserVirtualAddress(); - - for (unsigned i = 0; i < kMemoryLayoutSize; ++i) { - uptr start = kMemoryLayout[i].start; - uptr end = kMemoryLayout[i].end; - uptr size = end - start; - MappingDesc::Type type = kMemoryLayout[i].type; - - // Check if the segment should be mapped based on platform constraints. - if (start >= maxVirtualAddress) - continue; - - bool map = type == MappingDesc::SHADOW || - (init_origins && type == MappingDesc::ORIGIN); - bool protect = type == MappingDesc::INVALID || - (!init_origins && type == MappingDesc::ORIGIN); - CHECK(!(map && protect)); - if (!map && !protect) - CHECK(type == MappingDesc::APP); - if (map) { - if (!CheckMemoryRangeAvailability(start, size)) - return false; - if (!MmapFixedSuperNoReserve(start, size, kMemoryLayout[i].name)) - return false; - if (common_flags()->use_madv_dontdump) - DontDumpShadowMemory(start, size); - } - if (protect) { - if (!CheckMemoryRangeAvailability(start, size)) - return false; - if (!ProtectMemoryRange(start, size, kMemoryLayout[i].name)) - return false; - } - } - - return true; -} - -static void DFsanInit(int argc, char **argv, char **envp) { - CHECK(!dfsan_init_is_running); - if (dfsan_inited) - return; - dfsan_init_is_running = true; - SanitizerToolName = "DataflowSanitizer"; - - AvoidCVE_2016_2143(); - - InitializeFlags(); - - CheckASLR(); - - InitShadow(dfsan_get_track_origins()); - - initialize_interceptors(); - - // Set up threads - DFsanTSDInit(DFsanTSDDtor); - - dfsan_allocator_init(); - - DFsanThread *main_thread = DFsanThread::Create(nullptr, nullptr, nullptr); - SetCurrentThread(main_thread); - main_thread->Init(); - - dfsan_init_is_running = false; - dfsan_inited = true; -} - -namespace __dfsan { - -void dfsan_init() { DFsanInit(0, nullptr, nullptr); } - -} // namespace __dfsan - -#if SANITIZER_CAN_USE_PREINIT_ARRAY -__attribute__((section(".preinit_array"), - used)) static void (*dfsan_init_ptr)(int, char **, - char **) = DFsanInit; -#endif diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan.h b/contrib/libs/clang14-rt/lib/dfsan/dfsan.h deleted file mode 100644 index f3403dd44fa8..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan.h +++ /dev/null @@ -1,106 +0,0 @@ -//===-- dfsan.h -------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// Private DFSan header. -//===----------------------------------------------------------------------===// - -#ifndef DFSAN_H -#define DFSAN_H - -#include "sanitizer_common/sanitizer_internal_defs.h" - -#include "dfsan_platform.h" - -using __sanitizer::u32; -using __sanitizer::u8; -using __sanitizer::uptr; - -// Copy declarations from public sanitizer/dfsan_interface.h header here. -typedef u8 dfsan_label; -typedef u32 dfsan_origin; - -extern "C" { -void dfsan_add_label(dfsan_label label, void *addr, uptr size); -void dfsan_set_label(dfsan_label label, void *addr, uptr size); -dfsan_label dfsan_read_label(const void *addr, uptr size); -dfsan_label dfsan_union(dfsan_label l1, dfsan_label l2); -// Zero out [offset, offset+size) from __dfsan_arg_tls. -void dfsan_clear_arg_tls(uptr offset, uptr size); -// Zero out the TLS storage. -void dfsan_clear_thread_local_state(); - -// Return the origin associated with the first taint byte in the size bytes -// from the address addr. -dfsan_origin dfsan_read_origin_of_first_taint(const void *addr, uptr size); - -// Set the data within [addr, addr+size) with label and origin. -void dfsan_set_label_origin(dfsan_label label, dfsan_origin origin, void *addr, - uptr size); - -// Copy or move the origins of the len bytes from src to dst. -void dfsan_mem_origin_transfer(const void *dst, const void *src, uptr len); - -// Copy shadow bytes from src to dst. -// Note this preserves distinct taint labels at specific offsets. -void dfsan_mem_shadow_transfer(void *dst, const void *src, uptr len); -} // extern "C" - -template -void dfsan_set_label(dfsan_label label, T &data) { - dfsan_set_label(label, (void *)&data, sizeof(T)); -} - -namespace __dfsan { - -extern bool dfsan_inited; -extern bool dfsan_init_is_running; - -void initialize_interceptors(); - -inline dfsan_label *shadow_for(void *ptr) { - return (dfsan_label *)MEM_TO_SHADOW(ptr); -} - -inline const dfsan_label *shadow_for(const void *ptr) { - return shadow_for(const_cast(ptr)); -} - -inline uptr unaligned_origin_for(uptr ptr) { return MEM_TO_ORIGIN(ptr); } - -inline dfsan_origin *origin_for(void *ptr) { - auto aligned_addr = unaligned_origin_for(reinterpret_cast(ptr)) & - ~(sizeof(dfsan_origin) - 1); - return reinterpret_cast(aligned_addr); -} - -inline const dfsan_origin *origin_for(const void *ptr) { - return origin_for(const_cast(ptr)); -} - -void dfsan_copy_memory(void *dst, const void *src, uptr size); - -void dfsan_allocator_init(); -void dfsan_deallocate(void *ptr); - -void *dfsan_malloc(uptr size); -void *dfsan_calloc(uptr nmemb, uptr size); -void *dfsan_realloc(void *ptr, uptr size); -void *dfsan_reallocarray(void *ptr, uptr nmemb, uptr size); -void *dfsan_valloc(uptr size); -void *dfsan_pvalloc(uptr size); -void *dfsan_aligned_alloc(uptr alignment, uptr size); -void *dfsan_memalign(uptr alignment, uptr size); -int dfsan_posix_memalign(void **memptr, uptr alignment, uptr size); - -void dfsan_init(); - -} // namespace __dfsan - -#endif // DFSAN_H diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_allocator.cpp b/contrib/libs/clang14-rt/lib/dfsan/dfsan_allocator.cpp deleted file mode 100644 index c50aee7a55a0..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_allocator.cpp +++ /dev/null @@ -1,293 +0,0 @@ -//===-- dfsan_allocator.cpp -------------------------- --------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataflowSanitizer. -// -// DataflowSanitizer allocator. -//===----------------------------------------------------------------------===// - -#include "dfsan_allocator.h" - -#include "dfsan.h" -#include "dfsan_flags.h" -#include "dfsan_thread.h" -#include "sanitizer_common/sanitizer_allocator.h" -#include "sanitizer_common/sanitizer_allocator_checks.h" -#include "sanitizer_common/sanitizer_allocator_interface.h" -#include "sanitizer_common/sanitizer_allocator_report.h" -#include "sanitizer_common/sanitizer_errno.h" - -namespace __dfsan { - -struct Metadata { - uptr requested_size; -}; - -struct DFsanMapUnmapCallback { - void OnMap(uptr p, uptr size) const { dfsan_set_label(0, (void *)p, size); } - void OnUnmap(uptr p, uptr size) const { dfsan_set_label(0, (void *)p, size); } -}; - -static const uptr kAllocatorSpace = 0x700000000000ULL; -static const uptr kMaxAllowedMallocSize = 8UL << 30; - -struct AP64 { // Allocator64 parameters. Deliberately using a short name. - static const uptr kSpaceBeg = kAllocatorSpace; - static const uptr kSpaceSize = 0x40000000000; // 4T. - static const uptr kMetadataSize = sizeof(Metadata); - typedef DefaultSizeClassMap SizeClassMap; - typedef DFsanMapUnmapCallback MapUnmapCallback; - static const uptr kFlags = 0; - using AddressSpaceView = LocalAddressSpaceView; -}; - -typedef SizeClassAllocator64 PrimaryAllocator; - -typedef CombinedAllocator Allocator; -typedef Allocator::AllocatorCache AllocatorCache; - -static Allocator allocator; -static AllocatorCache fallback_allocator_cache; -static StaticSpinMutex fallback_mutex; - -static uptr max_malloc_size; - -void dfsan_allocator_init() { - SetAllocatorMayReturnNull(common_flags()->allocator_may_return_null); - allocator.Init(common_flags()->allocator_release_to_os_interval_ms); - if (common_flags()->max_allocation_size_mb) - max_malloc_size = Min(common_flags()->max_allocation_size_mb << 20, - kMaxAllowedMallocSize); - else - max_malloc_size = kMaxAllowedMallocSize; -} - -AllocatorCache *GetAllocatorCache(DFsanThreadLocalMallocStorage *ms) { - CHECK(ms); - CHECK_LE(sizeof(AllocatorCache), sizeof(ms->allocator_cache)); - return reinterpret_cast(ms->allocator_cache); -} - -void DFsanThreadLocalMallocStorage::CommitBack() { - allocator.SwallowCache(GetAllocatorCache(this)); -} - -static void *DFsanAllocate(uptr size, uptr alignment, bool zeroise) { - if (size > max_malloc_size) { - if (AllocatorMayReturnNull()) { - Report("WARNING: DataflowSanitizer failed to allocate 0x%zx bytes\n", - size); - return nullptr; - } - BufferedStackTrace stack; - ReportAllocationSizeTooBig(size, max_malloc_size, &stack); - } - if (UNLIKELY(IsRssLimitExceeded())) { - if (AllocatorMayReturnNull()) - return nullptr; - BufferedStackTrace stack; - ReportRssLimitExceeded(&stack); - } - DFsanThread *t = GetCurrentThread(); - void *allocated; - if (t) { - AllocatorCache *cache = GetAllocatorCache(&t->malloc_storage()); - allocated = allocator.Allocate(cache, size, alignment); - } else { - SpinMutexLock l(&fallback_mutex); - AllocatorCache *cache = &fallback_allocator_cache; - allocated = allocator.Allocate(cache, size, alignment); - } - if (UNLIKELY(!allocated)) { - SetAllocatorOutOfMemory(); - if (AllocatorMayReturnNull()) - return nullptr; - BufferedStackTrace stack; - ReportOutOfMemory(size, &stack); - } - Metadata *meta = - reinterpret_cast(allocator.GetMetaData(allocated)); - meta->requested_size = size; - if (zeroise) { - internal_memset(allocated, 0, size); - dfsan_set_label(0, allocated, size); - } else if (flags().zero_in_malloc) { - dfsan_set_label(0, allocated, size); - } - return allocated; -} - -void dfsan_deallocate(void *p) { - CHECK(p); - Metadata *meta = reinterpret_cast(allocator.GetMetaData(p)); - uptr size = meta->requested_size; - meta->requested_size = 0; - if (flags().zero_in_free) - dfsan_set_label(0, p, size); - DFsanThread *t = GetCurrentThread(); - if (t) { - AllocatorCache *cache = GetAllocatorCache(&t->malloc_storage()); - allocator.Deallocate(cache, p); - } else { - SpinMutexLock l(&fallback_mutex); - AllocatorCache *cache = &fallback_allocator_cache; - allocator.Deallocate(cache, p); - } -} - -void *DFsanReallocate(void *old_p, uptr new_size, uptr alignment) { - Metadata *meta = reinterpret_cast(allocator.GetMetaData(old_p)); - uptr old_size = meta->requested_size; - uptr actually_allocated_size = allocator.GetActuallyAllocatedSize(old_p); - if (new_size <= actually_allocated_size) { - // We are not reallocating here. - meta->requested_size = new_size; - if (new_size > old_size && flags().zero_in_malloc) - dfsan_set_label(0, (char *)old_p + old_size, new_size - old_size); - return old_p; - } - uptr memcpy_size = Min(new_size, old_size); - void *new_p = DFsanAllocate(new_size, alignment, false /*zeroise*/); - if (new_p) { - dfsan_copy_memory(new_p, old_p, memcpy_size); - dfsan_deallocate(old_p); - } - return new_p; -} - -void *DFsanCalloc(uptr nmemb, uptr size) { - if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { - if (AllocatorMayReturnNull()) - return nullptr; - BufferedStackTrace stack; - ReportCallocOverflow(nmemb, size, &stack); - } - return DFsanAllocate(nmemb * size, sizeof(u64), true /*zeroise*/); -} - -static uptr AllocationSize(const void *p) { - if (!p) - return 0; - const void *beg = allocator.GetBlockBegin(p); - if (beg != p) - return 0; - Metadata *b = (Metadata *)allocator.GetMetaData(p); - return b->requested_size; -} - -void *dfsan_malloc(uptr size) { - return SetErrnoOnNull(DFsanAllocate(size, sizeof(u64), false /*zeroise*/)); -} - -void *dfsan_calloc(uptr nmemb, uptr size) { - return SetErrnoOnNull(DFsanCalloc(nmemb, size)); -} - -void *dfsan_realloc(void *ptr, uptr size) { - if (!ptr) - return SetErrnoOnNull(DFsanAllocate(size, sizeof(u64), false /*zeroise*/)); - if (size == 0) { - dfsan_deallocate(ptr); - return nullptr; - } - return SetErrnoOnNull(DFsanReallocate(ptr, size, sizeof(u64))); -} - -void *dfsan_reallocarray(void *ptr, uptr nmemb, uptr size) { - if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { - errno = errno_ENOMEM; - if (AllocatorMayReturnNull()) - return nullptr; - BufferedStackTrace stack; - ReportReallocArrayOverflow(nmemb, size, &stack); - } - return dfsan_realloc(ptr, nmemb * size); -} - -void *dfsan_valloc(uptr size) { - return SetErrnoOnNull( - DFsanAllocate(size, GetPageSizeCached(), false /*zeroise*/)); -} - -void *dfsan_pvalloc(uptr size) { - uptr PageSize = GetPageSizeCached(); - if (UNLIKELY(CheckForPvallocOverflow(size, PageSize))) { - errno = errno_ENOMEM; - if (AllocatorMayReturnNull()) - return nullptr; - BufferedStackTrace stack; - ReportPvallocOverflow(size, &stack); - } - // pvalloc(0) should allocate one page. - size = size ? RoundUpTo(size, PageSize) : PageSize; - return SetErrnoOnNull(DFsanAllocate(size, PageSize, false /*zeroise*/)); -} - -void *dfsan_aligned_alloc(uptr alignment, uptr size) { - if (UNLIKELY(!CheckAlignedAllocAlignmentAndSize(alignment, size))) { - errno = errno_EINVAL; - if (AllocatorMayReturnNull()) - return nullptr; - BufferedStackTrace stack; - ReportInvalidAlignedAllocAlignment(size, alignment, &stack); - } - return SetErrnoOnNull(DFsanAllocate(size, alignment, false /*zeroise*/)); -} - -void *dfsan_memalign(uptr alignment, uptr size) { - if (UNLIKELY(!IsPowerOfTwo(alignment))) { - errno = errno_EINVAL; - if (AllocatorMayReturnNull()) - return nullptr; - BufferedStackTrace stack; - ReportInvalidAllocationAlignment(alignment, &stack); - } - return SetErrnoOnNull(DFsanAllocate(size, alignment, false /*zeroise*/)); -} - -int dfsan_posix_memalign(void **memptr, uptr alignment, uptr size) { - if (UNLIKELY(!CheckPosixMemalignAlignment(alignment))) { - if (AllocatorMayReturnNull()) - return errno_EINVAL; - BufferedStackTrace stack; - ReportInvalidPosixMemalignAlignment(alignment, &stack); - } - void *ptr = DFsanAllocate(size, alignment, false /*zeroise*/); - if (UNLIKELY(!ptr)) - // OOM error is already taken care of by DFsanAllocate. - return errno_ENOMEM; - CHECK(IsAligned((uptr)ptr, alignment)); - *memptr = ptr; - return 0; -} - -} // namespace __dfsan - -using namespace __dfsan; - -uptr __sanitizer_get_current_allocated_bytes() { - uptr stats[AllocatorStatCount]; - allocator.GetStats(stats); - return stats[AllocatorStatAllocated]; -} - -uptr __sanitizer_get_heap_size() { - uptr stats[AllocatorStatCount]; - allocator.GetStats(stats); - return stats[AllocatorStatMapped]; -} - -uptr __sanitizer_get_free_bytes() { return 1; } - -uptr __sanitizer_get_unmapped_bytes() { return 1; } - -uptr __sanitizer_get_estimated_allocated_size(uptr size) { return size; } - -int __sanitizer_get_ownership(const void *p) { return AllocationSize(p) != 0; } - -uptr __sanitizer_get_allocated_size(const void *p) { return AllocationSize(p); } diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_allocator.h b/contrib/libs/clang14-rt/lib/dfsan/dfsan_allocator.h deleted file mode 100644 index 3b4171b6314d..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_allocator.h +++ /dev/null @@ -1,30 +0,0 @@ -//===-- dfsan_allocator.h ---------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataflowSanitizer. -// -//===----------------------------------------------------------------------===// - -#ifndef DFSAN_ALLOCATOR_H -#define DFSAN_ALLOCATOR_H - -#include "sanitizer_common/sanitizer_common.h" - -namespace __dfsan { - -struct DFsanThreadLocalMallocStorage { - ALIGNED(8) uptr allocator_cache[96 * (512 * 8 + 16)]; // Opaque. - void CommitBack(); - - private: - // These objects are allocated via mmap() and are zero-initialized. - DFsanThreadLocalMallocStorage() {} -}; - -} // namespace __dfsan -#endif // DFSAN_ALLOCATOR_H diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_chained_origin_depot.cpp b/contrib/libs/clang14-rt/lib/dfsan/dfsan_chained_origin_depot.cpp deleted file mode 100644 index 9ec598bf2ce9..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_chained_origin_depot.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===-- dfsan_chained_origin_depot.cpp ------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// A storage for chained origins. -//===----------------------------------------------------------------------===// - -#include "dfsan_chained_origin_depot.h" - -namespace __dfsan { - -static ChainedOriginDepot chainedOriginDepot; - -ChainedOriginDepot* GetChainedOriginDepot() { return &chainedOriginDepot; } - -} // namespace __dfsan diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_chained_origin_depot.h b/contrib/libs/clang14-rt/lib/dfsan/dfsan_chained_origin_depot.h deleted file mode 100644 index d715ef707f41..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_chained_origin_depot.h +++ /dev/null @@ -1,26 +0,0 @@ -//===-- dfsan_chained_origin_depot.h ----------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// A storage for chained origins. -//===----------------------------------------------------------------------===// - -#ifndef DFSAN_CHAINED_ORIGIN_DEPOT_H -#define DFSAN_CHAINED_ORIGIN_DEPOT_H - -#include "sanitizer_common/sanitizer_chained_origin_depot.h" -#include "sanitizer_common/sanitizer_common.h" - -namespace __dfsan { - -ChainedOriginDepot* GetChainedOriginDepot(); - -} // namespace __dfsan - -#endif // DFSAN_CHAINED_ORIGIN_DEPOT_H diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_custom.cpp b/contrib/libs/clang14-rt/lib/dfsan/dfsan_custom.cpp deleted file mode 100644 index 1965d0ddff59..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_custom.cpp +++ /dev/null @@ -1,2529 +0,0 @@ -//===-- dfsan_custom.cpp --------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// This file defines the custom functions listed in done_abilist.txt. -//===----------------------------------------------------------------------===// - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dfsan/dfsan.h" -#include "dfsan/dfsan_chained_origin_depot.h" -#include "dfsan/dfsan_flags.h" -#include "dfsan/dfsan_thread.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "sanitizer_common/sanitizer_linux.h" -#include "sanitizer_common/sanitizer_stackdepot.h" - -using namespace __dfsan; - -#define CALL_WEAK_INTERCEPTOR_HOOK(f, ...) \ - do { \ - if (f) \ - f(__VA_ARGS__); \ - } while (false) -#define DECLARE_WEAK_INTERCEPTOR_HOOK(f, ...) \ -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void f(__VA_ARGS__); - -// Async-safe, non-reentrant spin lock. -class SignalSpinLocker { - public: - SignalSpinLocker() { - sigset_t all_set; - sigfillset(&all_set); - pthread_sigmask(SIG_SETMASK, &all_set, &saved_thread_mask_); - sigactions_mu.Lock(); - } - ~SignalSpinLocker() { - sigactions_mu.Unlock(); - pthread_sigmask(SIG_SETMASK, &saved_thread_mask_, nullptr); - } - - private: - static StaticSpinMutex sigactions_mu; - sigset_t saved_thread_mask_; - - SignalSpinLocker(const SignalSpinLocker &) = delete; - SignalSpinLocker &operator=(const SignalSpinLocker &) = delete; -}; - -StaticSpinMutex SignalSpinLocker::sigactions_mu; - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE int -__dfsw_stat(const char *path, struct stat *buf, dfsan_label path_label, - dfsan_label buf_label, dfsan_label *ret_label) { - int ret = stat(path, buf); - if (ret == 0) - dfsan_set_label(0, buf, sizeof(struct stat)); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_stat( - const char *path, struct stat *buf, dfsan_label path_label, - dfsan_label buf_label, dfsan_label *ret_label, dfsan_origin path_origin, - dfsan_origin buf_origin, dfsan_origin *ret_origin) { - int ret = __dfsw_stat(path, buf, path_label, buf_label, ret_label); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_fstat(int fd, struct stat *buf, - dfsan_label fd_label, - dfsan_label buf_label, - dfsan_label *ret_label) { - int ret = fstat(fd, buf); - if (ret == 0) - dfsan_set_label(0, buf, sizeof(struct stat)); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_fstat( - int fd, struct stat *buf, dfsan_label fd_label, dfsan_label buf_label, - dfsan_label *ret_label, dfsan_origin fd_origin, dfsan_origin buf_origin, - dfsan_origin *ret_origin) { - int ret = __dfsw_fstat(fd, buf, fd_label, buf_label, ret_label); - return ret; -} - -static char *dfsan_strchr_with_label(const char *s, int c, size_t *bytes_read, - dfsan_label s_label, dfsan_label c_label, - dfsan_label *ret_label) { - char *match_pos = nullptr; - for (size_t i = 0;; ++i) { - if (s[i] == c || s[i] == 0) { - // If s[i] is the \0 at the end of the string, and \0 is not the - // character we are searching for, then return null. - *bytes_read = i + 1; - match_pos = s[i] == 0 && c != 0 ? nullptr : const_cast(s + i); - break; - } - } - if (flags().strict_data_dependencies) - *ret_label = s_label; - else - *ret_label = dfsan_union(dfsan_read_label(s, *bytes_read), - dfsan_union(s_label, c_label)); - return match_pos; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfsw_strchr(const char *s, int c, - dfsan_label s_label, - dfsan_label c_label, - dfsan_label *ret_label) { - size_t bytes_read; - return dfsan_strchr_with_label(s, c, &bytes_read, s_label, c_label, - ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfso_strchr( - const char *s, int c, dfsan_label s_label, dfsan_label c_label, - dfsan_label *ret_label, dfsan_origin s_origin, dfsan_origin c_origin, - dfsan_origin *ret_origin) { - size_t bytes_read; - char *r = - dfsan_strchr_with_label(s, c, &bytes_read, s_label, c_label, ret_label); - if (flags().strict_data_dependencies) { - *ret_origin = s_origin; - } else if (*ret_label) { - dfsan_origin o = dfsan_read_origin_of_first_taint(s, bytes_read); - *ret_origin = o ? o : (s_label ? s_origin : c_origin); - } - return r; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfsw_strpbrk(const char *s, - const char *accept, - dfsan_label s_label, - dfsan_label accept_label, - dfsan_label *ret_label) { - const char *ret = strpbrk(s, accept); - if (flags().strict_data_dependencies) { - *ret_label = ret ? s_label : 0; - } else { - size_t s_bytes_read = (ret ? ret - s : strlen(s)) + 1; - *ret_label = - dfsan_union(dfsan_read_label(s, s_bytes_read), - dfsan_union(dfsan_read_label(accept, strlen(accept) + 1), - dfsan_union(s_label, accept_label))); - } - return const_cast(ret); -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfso_strpbrk( - const char *s, const char *accept, dfsan_label s_label, - dfsan_label accept_label, dfsan_label *ret_label, dfsan_origin s_origin, - dfsan_origin accept_origin, dfsan_origin *ret_origin) { - const char *ret = __dfsw_strpbrk(s, accept, s_label, accept_label, ret_label); - if (flags().strict_data_dependencies) { - if (ret) - *ret_origin = s_origin; - } else { - if (*ret_label) { - size_t s_bytes_read = (ret ? ret - s : strlen(s)) + 1; - dfsan_origin o = dfsan_read_origin_of_first_taint(s, s_bytes_read); - if (o) { - *ret_origin = o; - } else { - o = dfsan_read_origin_of_first_taint(accept, strlen(accept) + 1); - *ret_origin = o ? o : (s_label ? s_origin : accept_origin); - } - } - } - return const_cast(ret); -} - -static int dfsan_memcmp_bcmp(const void *s1, const void *s2, size_t n, - size_t *bytes_read) { - const char *cs1 = (const char *) s1, *cs2 = (const char *) s2; - for (size_t i = 0; i != n; ++i) { - if (cs1[i] != cs2[i]) { - *bytes_read = i + 1; - return cs1[i] - cs2[i]; - } - } - *bytes_read = n; - return 0; -} - -static dfsan_label dfsan_get_memcmp_label(const void *s1, const void *s2, - size_t pos) { - if (flags().strict_data_dependencies) - return 0; - return dfsan_union(dfsan_read_label(s1, pos), dfsan_read_label(s2, pos)); -} - -static void dfsan_get_memcmp_origin(const void *s1, const void *s2, size_t pos, - dfsan_label *ret_label, - dfsan_origin *ret_origin) { - *ret_label = dfsan_get_memcmp_label(s1, s2, pos); - if (*ret_label == 0) - return; - dfsan_origin o = dfsan_read_origin_of_first_taint(s1, pos); - *ret_origin = o ? o : dfsan_read_origin_of_first_taint(s2, pos); -} - -static int dfsan_memcmp_bcmp_label(const void *s1, const void *s2, size_t n, - dfsan_label *ret_label) { - size_t bytes_read; - int r = dfsan_memcmp_bcmp(s1, s2, n, &bytes_read); - *ret_label = dfsan_get_memcmp_label(s1, s2, bytes_read); - return r; -} - -static int dfsan_memcmp_bcmp_origin(const void *s1, const void *s2, size_t n, - dfsan_label *ret_label, - dfsan_origin *ret_origin) { - size_t bytes_read; - int r = dfsan_memcmp_bcmp(s1, s2, n, &bytes_read); - dfsan_get_memcmp_origin(s1, s2, bytes_read, ret_label, ret_origin); - return r; -} - -DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_memcmp, uptr caller_pc, - const void *s1, const void *s2, size_t n, - dfsan_label s1_label, dfsan_label s2_label, - dfsan_label n_label) - -DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_origin_memcmp, uptr caller_pc, - const void *s1, const void *s2, size_t n, - dfsan_label s1_label, dfsan_label s2_label, - dfsan_label n_label, dfsan_origin s1_origin, - dfsan_origin s2_origin, dfsan_origin n_origin) - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_memcmp(const void *s1, const void *s2, - size_t n, dfsan_label s1_label, - dfsan_label s2_label, - dfsan_label n_label, - dfsan_label *ret_label) { - CALL_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_memcmp, GET_CALLER_PC(), s1, s2, n, - s1_label, s2_label, n_label); - return dfsan_memcmp_bcmp_label(s1, s2, n, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_memcmp( - const void *s1, const void *s2, size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label, dfsan_label *ret_label, - dfsan_origin s1_origin, dfsan_origin s2_origin, dfsan_origin n_origin, - dfsan_origin *ret_origin) { - CALL_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_origin_memcmp, GET_CALLER_PC(), s1, - s2, n, s1_label, s2_label, n_label, s1_origin, - s2_origin, n_origin); - return dfsan_memcmp_bcmp_origin(s1, s2, n, ret_label, ret_origin); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_bcmp(const void *s1, const void *s2, - size_t n, dfsan_label s1_label, - dfsan_label s2_label, - dfsan_label n_label, - dfsan_label *ret_label) { - return dfsan_memcmp_bcmp_label(s1, s2, n, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_bcmp( - const void *s1, const void *s2, size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label, dfsan_label *ret_label, - dfsan_origin s1_origin, dfsan_origin s2_origin, dfsan_origin n_origin, - dfsan_origin *ret_origin) { - return dfsan_memcmp_bcmp_origin(s1, s2, n, ret_label, ret_origin); -} - -// When n == 0, compare strings without byte limit. -// When n > 0, compare the first (at most) n bytes of s1 and s2. -static int dfsan_strncmp(const char *s1, const char *s2, size_t n, - size_t *bytes_read) { - for (size_t i = 0;; ++i) { - if (s1[i] != s2[i] || s1[i] == 0 || s2[i] == 0 || (n > 0 && i == n - 1)) { - *bytes_read = i + 1; - return s1[i] - s2[i]; - } - } -} - -DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strcmp, uptr caller_pc, - const char *s1, const char *s2, - dfsan_label s1_label, dfsan_label s2_label) - -DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_origin_strcmp, uptr caller_pc, - const char *s1, const char *s2, - dfsan_label s1_label, dfsan_label s2_label, - dfsan_origin s1_origin, dfsan_origin s2_origin) - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_strcmp(const char *s1, const char *s2, - dfsan_label s1_label, - dfsan_label s2_label, - dfsan_label *ret_label) { - CALL_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strcmp, GET_CALLER_PC(), s1, s2, - s1_label, s2_label); - size_t bytes_read; - int r = dfsan_strncmp(s1, s2, 0, &bytes_read); - *ret_label = dfsan_get_memcmp_label(s1, s2, bytes_read); - return r; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_strcmp( - const char *s1, const char *s2, dfsan_label s1_label, dfsan_label s2_label, - dfsan_label *ret_label, dfsan_origin s1_origin, dfsan_origin s2_origin, - dfsan_origin *ret_origin) { - CALL_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_origin_strcmp, GET_CALLER_PC(), s1, - s2, s1_label, s2_label, s1_origin, s2_origin); - size_t bytes_read; - int r = dfsan_strncmp(s1, s2, 0, &bytes_read); - dfsan_get_memcmp_origin(s1, s2, bytes_read, ret_label, ret_origin); - return r; -} - -// When n == 0, compare strings without byte limit. -// When n > 0, compare the first (at most) n bytes of s1 and s2. -static int dfsan_strncasecmp(const char *s1, const char *s2, size_t n, - size_t *bytes_read) { - for (size_t i = 0;; ++i) { - char s1_lower = tolower(s1[i]); - char s2_lower = tolower(s2[i]); - - if (s1_lower != s2_lower || s1[i] == 0 || s2[i] == 0 || - (n > 0 && i == n - 1)) { - *bytes_read = i + 1; - return s1_lower - s2_lower; - } - } -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_strcasecmp(const char *s1, - const char *s2, - dfsan_label s1_label, - dfsan_label s2_label, - dfsan_label *ret_label) { - size_t bytes_read; - int r = dfsan_strncasecmp(s1, s2, 0, &bytes_read); - *ret_label = dfsan_get_memcmp_label(s1, s2, bytes_read); - return r; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_strcasecmp( - const char *s1, const char *s2, dfsan_label s1_label, dfsan_label s2_label, - dfsan_label *ret_label, dfsan_origin s1_origin, dfsan_origin s2_origin, - dfsan_origin *ret_origin) { - size_t bytes_read; - int r = dfsan_strncasecmp(s1, s2, 0, &bytes_read); - dfsan_get_memcmp_origin(s1, s2, bytes_read, ret_label, ret_origin); - return r; -} - -DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strncmp, uptr caller_pc, - const char *s1, const char *s2, size_t n, - dfsan_label s1_label, dfsan_label s2_label, - dfsan_label n_label) - -DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_origin_strncmp, uptr caller_pc, - const char *s1, const char *s2, size_t n, - dfsan_label s1_label, dfsan_label s2_label, - dfsan_label n_label, dfsan_origin s1_origin, - dfsan_origin s2_origin, dfsan_origin n_origin) - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_strncmp(const char *s1, const char *s2, - size_t n, dfsan_label s1_label, - dfsan_label s2_label, - dfsan_label n_label, - dfsan_label *ret_label) { - if (n == 0) { - *ret_label = 0; - return 0; - } - - CALL_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strncmp, GET_CALLER_PC(), s1, s2, - n, s1_label, s2_label, n_label); - - size_t bytes_read; - int r = dfsan_strncmp(s1, s2, n, &bytes_read); - *ret_label = dfsan_get_memcmp_label(s1, s2, bytes_read); - return r; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_strncmp( - const char *s1, const char *s2, size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label, dfsan_label *ret_label, - dfsan_origin s1_origin, dfsan_origin s2_origin, dfsan_origin n_origin, - dfsan_origin *ret_origin) { - if (n == 0) { - *ret_label = 0; - return 0; - } - - CALL_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_origin_strncmp, GET_CALLER_PC(), - s1, s2, n, s1_label, s2_label, n_label, s1_origin, - s2_origin, n_origin); - - size_t bytes_read; - int r = dfsan_strncmp(s1, s2, n, &bytes_read); - dfsan_get_memcmp_origin(s1, s2, bytes_read, ret_label, ret_origin); - return r; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_strncasecmp( - const char *s1, const char *s2, size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label, dfsan_label *ret_label) { - if (n == 0) { - *ret_label = 0; - return 0; - } - - size_t bytes_read; - int r = dfsan_strncasecmp(s1, s2, n, &bytes_read); - *ret_label = dfsan_get_memcmp_label(s1, s2, bytes_read); - return r; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_strncasecmp( - const char *s1, const char *s2, size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label, dfsan_label *ret_label, - dfsan_origin s1_origin, dfsan_origin s2_origin, dfsan_origin n_origin, - dfsan_origin *ret_origin) { - if (n == 0) { - *ret_label = 0; - return 0; - } - - size_t bytes_read; - int r = dfsan_strncasecmp(s1, s2, n, &bytes_read); - dfsan_get_memcmp_origin(s1, s2, bytes_read, ret_label, ret_origin); - return r; -} - - -SANITIZER_INTERFACE_ATTRIBUTE size_t -__dfsw_strlen(const char *s, dfsan_label s_label, dfsan_label *ret_label) { - size_t ret = strlen(s); - if (flags().strict_data_dependencies) { - *ret_label = 0; - } else { - *ret_label = dfsan_read_label(s, ret + 1); - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE size_t __dfso_strlen(const char *s, - dfsan_label s_label, - dfsan_label *ret_label, - dfsan_origin s_origin, - dfsan_origin *ret_origin) { - size_t ret = __dfsw_strlen(s, s_label, ret_label); - if (!flags().strict_data_dependencies) - *ret_origin = dfsan_read_origin_of_first_taint(s, ret + 1); - return ret; -} - -static void *dfsan_memmove(void *dest, const void *src, size_t n) { - dfsan_label *sdest = shadow_for(dest); - const dfsan_label *ssrc = shadow_for(src); - internal_memmove((void *)sdest, (const void *)ssrc, n * sizeof(dfsan_label)); - return internal_memmove(dest, src, n); -} - -static void *dfsan_memmove_with_origin(void *dest, const void *src, size_t n) { - dfsan_mem_origin_transfer(dest, src, n); - return dfsan_memmove(dest, src, n); -} - -static void *dfsan_memcpy(void *dest, const void *src, size_t n) { - dfsan_mem_shadow_transfer(dest, src, n); - return internal_memcpy(dest, src, n); -} - -static void *dfsan_memcpy_with_origin(void *dest, const void *src, size_t n) { - dfsan_mem_origin_transfer(dest, src, n); - return dfsan_memcpy(dest, src, n); -} - -static void dfsan_memset(void *s, int c, dfsan_label c_label, size_t n) { - internal_memset(s, c, n); - dfsan_set_label(c_label, s, n); -} - -static void dfsan_memset_with_origin(void *s, int c, dfsan_label c_label, - dfsan_origin c_origin, size_t n) { - internal_memset(s, c, n); - dfsan_set_label_origin(c_label, c_origin, s, n); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__dfsw_memcpy(void *dest, const void *src, size_t n, - dfsan_label dest_label, dfsan_label src_label, - dfsan_label n_label, dfsan_label *ret_label) { - *ret_label = dest_label; - return dfsan_memcpy(dest, src, n); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__dfso_memcpy(void *dest, const void *src, size_t n, - dfsan_label dest_label, dfsan_label src_label, - dfsan_label n_label, dfsan_label *ret_label, - dfsan_origin dest_origin, dfsan_origin src_origin, - dfsan_origin n_origin, dfsan_origin *ret_origin) { - *ret_label = dest_label; - *ret_origin = dest_origin; - return dfsan_memcpy_with_origin(dest, src, n); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__dfsw_memmove(void *dest, const void *src, size_t n, - dfsan_label dest_label, dfsan_label src_label, - dfsan_label n_label, dfsan_label *ret_label) { - *ret_label = dest_label; - return dfsan_memmove(dest, src, n); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__dfso_memmove(void *dest, const void *src, size_t n, - dfsan_label dest_label, dfsan_label src_label, - dfsan_label n_label, dfsan_label *ret_label, - dfsan_origin dest_origin, dfsan_origin src_origin, - dfsan_origin n_origin, dfsan_origin *ret_origin) { - *ret_label = dest_label; - *ret_origin = dest_origin; - return dfsan_memmove_with_origin(dest, src, n); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__dfsw_memset(void *s, int c, size_t n, - dfsan_label s_label, dfsan_label c_label, - dfsan_label n_label, dfsan_label *ret_label) { - dfsan_memset(s, c, c_label, n); - *ret_label = s_label; - return s; -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__dfso_memset(void *s, int c, size_t n, dfsan_label s_label, - dfsan_label c_label, dfsan_label n_label, - dfsan_label *ret_label, dfsan_origin s_origin, - dfsan_origin c_origin, dfsan_origin n_origin, - dfsan_origin *ret_origin) { - dfsan_memset_with_origin(s, c, c_label, c_origin, n); - *ret_label = s_label; - *ret_origin = s_origin; - return s; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfsw_strcat(char *dest, const char *src, - dfsan_label dest_label, - dfsan_label src_label, - dfsan_label *ret_label) { - size_t dest_len = strlen(dest); - char *ret = strcat(dest, src); - dfsan_mem_shadow_transfer(dest + dest_len, src, strlen(src)); - *ret_label = dest_label; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfso_strcat( - char *dest, const char *src, dfsan_label dest_label, dfsan_label src_label, - dfsan_label *ret_label, dfsan_origin dest_origin, dfsan_origin src_origin, - dfsan_origin *ret_origin) { - size_t dest_len = strlen(dest); - char *ret = strcat(dest, src); - size_t src_len = strlen(src); - dfsan_mem_origin_transfer(dest + dest_len, src, src_len); - dfsan_mem_shadow_transfer(dest + dest_len, src, src_len); - *ret_label = dest_label; - *ret_origin = dest_origin; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE char * -__dfsw_strdup(const char *s, dfsan_label s_label, dfsan_label *ret_label) { - size_t len = strlen(s); - void *p = malloc(len+1); - dfsan_memcpy(p, s, len+1); - *ret_label = 0; - return static_cast(p); -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfso_strdup(const char *s, - dfsan_label s_label, - dfsan_label *ret_label, - dfsan_origin s_origin, - dfsan_origin *ret_origin) { - size_t len = strlen(s); - void *p = malloc(len + 1); - dfsan_memcpy_with_origin(p, s, len + 1); - *ret_label = 0; - return static_cast(p); -} - -SANITIZER_INTERFACE_ATTRIBUTE char * -__dfsw_strncpy(char *s1, const char *s2, size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label, - dfsan_label *ret_label) { - size_t len = strlen(s2); - if (len < n) { - dfsan_memcpy(s1, s2, len+1); - dfsan_memset(s1+len+1, 0, 0, n-len-1); - } else { - dfsan_memcpy(s1, s2, n); - } - - *ret_label = s1_label; - return s1; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfso_strncpy( - char *s1, const char *s2, size_t n, dfsan_label s1_label, - dfsan_label s2_label, dfsan_label n_label, dfsan_label *ret_label, - dfsan_origin s1_origin, dfsan_origin s2_origin, dfsan_origin n_origin, - dfsan_origin *ret_origin) { - size_t len = strlen(s2); - if (len < n) { - dfsan_memcpy_with_origin(s1, s2, len + 1); - dfsan_memset_with_origin(s1 + len + 1, 0, 0, 0, n - len - 1); - } else { - dfsan_memcpy_with_origin(s1, s2, n); - } - - *ret_label = s1_label; - *ret_origin = s1_origin; - return s1; -} - -SANITIZER_INTERFACE_ATTRIBUTE ssize_t -__dfsw_pread(int fd, void *buf, size_t count, off_t offset, - dfsan_label fd_label, dfsan_label buf_label, - dfsan_label count_label, dfsan_label offset_label, - dfsan_label *ret_label) { - ssize_t ret = pread(fd, buf, count, offset); - if (ret > 0) - dfsan_set_label(0, buf, ret); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE ssize_t __dfso_pread( - int fd, void *buf, size_t count, off_t offset, dfsan_label fd_label, - dfsan_label buf_label, dfsan_label count_label, dfsan_label offset_label, - dfsan_label *ret_label, dfsan_origin fd_origin, dfsan_origin buf_origin, - dfsan_origin count_origin, dfsan_label offset_origin, - dfsan_origin *ret_origin) { - return __dfsw_pread(fd, buf, count, offset, fd_label, buf_label, count_label, - offset_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE ssize_t -__dfsw_read(int fd, void *buf, size_t count, - dfsan_label fd_label, dfsan_label buf_label, - dfsan_label count_label, - dfsan_label *ret_label) { - ssize_t ret = read(fd, buf, count); - if (ret > 0) - dfsan_set_label(0, buf, ret); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE ssize_t __dfso_read( - int fd, void *buf, size_t count, dfsan_label fd_label, - dfsan_label buf_label, dfsan_label count_label, dfsan_label *ret_label, - dfsan_origin fd_origin, dfsan_origin buf_origin, dfsan_origin count_origin, - dfsan_origin *ret_origin) { - return __dfsw_read(fd, buf, count, fd_label, buf_label, count_label, - ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_clock_gettime(clockid_t clk_id, - struct timespec *tp, - dfsan_label clk_id_label, - dfsan_label tp_label, - dfsan_label *ret_label) { - int ret = clock_gettime(clk_id, tp); - if (ret == 0) - dfsan_set_label(0, tp, sizeof(struct timespec)); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_clock_gettime( - clockid_t clk_id, struct timespec *tp, dfsan_label clk_id_label, - dfsan_label tp_label, dfsan_label *ret_label, dfsan_origin clk_id_origin, - dfsan_origin tp_origin, dfsan_origin *ret_origin) { - return __dfsw_clock_gettime(clk_id, tp, clk_id_label, tp_label, ret_label); -} - -static void dfsan_set_zero_label(const void *ptr, uptr size) { - dfsan_set_label(0, const_cast(ptr), size); -} - -// dlopen() ultimately calls mmap() down inside the loader, which generally -// doesn't participate in dynamic symbol resolution. Therefore we won't -// intercept its calls to mmap, and we have to hook it here. -SANITIZER_INTERFACE_ATTRIBUTE void * -__dfsw_dlopen(const char *filename, int flag, dfsan_label filename_label, - dfsan_label flag_label, dfsan_label *ret_label) { - void *handle = dlopen(filename, flag); - link_map *map = GET_LINK_MAP_BY_DLOPEN_HANDLE(handle); - if (map) - ForEachMappedRegion(map, dfsan_set_zero_label); - *ret_label = 0; - return handle; -} - -SANITIZER_INTERFACE_ATTRIBUTE void *__dfso_dlopen( - const char *filename, int flag, dfsan_label filename_label, - dfsan_label flag_label, dfsan_label *ret_label, - dfsan_origin filename_origin, dfsan_origin flag_origin, - dfsan_origin *ret_origin) { - return __dfsw_dlopen(filename, flag, filename_label, flag_label, ret_label); -} - -static void *DFsanThreadStartFunc(void *arg) { - DFsanThread *t = (DFsanThread *)arg; - SetCurrentThread(t); - t->Init(); - SetSigProcMask(&t->starting_sigset_, nullptr); - return t->ThreadStart(); -} - -static int dfsan_pthread_create(pthread_t *thread, const pthread_attr_t *attr, - void *start_routine_trampoline, - void *start_routine, void *arg, - dfsan_label *ret_label, - bool track_origins = false) { - pthread_attr_t myattr; - if (!attr) { - pthread_attr_init(&myattr); - attr = &myattr; - } - - // Ensure that the thread stack is large enough to hold all TLS data. - AdjustStackSize((void *)(const_cast(attr))); - - DFsanThread *t = - DFsanThread::Create(start_routine_trampoline, - (thread_callback_t)start_routine, arg, track_origins); - ScopedBlockSignals block(&t->starting_sigset_); - int res = pthread_create(thread, attr, DFsanThreadStartFunc, t); - - if (attr == &myattr) - pthread_attr_destroy(&myattr); - *ret_label = 0; - return res; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_pthread_create( - pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine_trampoline)(void *, void *, dfsan_label, - dfsan_label *), - void *start_routine, void *arg, dfsan_label thread_label, - dfsan_label attr_label, dfsan_label start_routine_label, - dfsan_label arg_label, dfsan_label *ret_label) { - return dfsan_pthread_create(thread, attr, (void *)start_routine_trampoline, - start_routine, arg, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_pthread_create( - pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine_trampoline)(void *, void *, dfsan_label, - dfsan_label *, dfsan_origin, - dfsan_origin *), - void *start_routine, void *arg, dfsan_label thread_label, - dfsan_label attr_label, dfsan_label start_routine_label, - dfsan_label arg_label, dfsan_label *ret_label, dfsan_origin thread_origin, - dfsan_origin attr_origin, dfsan_origin start_routine_origin, - dfsan_origin arg_origin, dfsan_origin *ret_origin) { - return dfsan_pthread_create(thread, attr, (void *)start_routine_trampoline, - start_routine, arg, ret_label, true); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_pthread_join(pthread_t thread, - void **retval, - dfsan_label thread_label, - dfsan_label retval_label, - dfsan_label *ret_label) { - int ret = pthread_join(thread, retval); - if (ret == 0 && retval) - dfsan_set_label(0, retval, sizeof(*retval)); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_pthread_join( - pthread_t thread, void **retval, dfsan_label thread_label, - dfsan_label retval_label, dfsan_label *ret_label, - dfsan_origin thread_origin, dfsan_origin retval_origin, - dfsan_origin *ret_origin) { - return __dfsw_pthread_join(thread, retval, thread_label, retval_label, - ret_label); -} - -struct dl_iterate_phdr_info { - int (*callback_trampoline)(void *callback, struct dl_phdr_info *info, - size_t size, void *data, dfsan_label info_label, - dfsan_label size_label, dfsan_label data_label, - dfsan_label *ret_label); - void *callback; - void *data; -}; - -struct dl_iterate_phdr_origin_info { - int (*callback_trampoline)(void *callback, struct dl_phdr_info *info, - size_t size, void *data, dfsan_label info_label, - dfsan_label size_label, dfsan_label data_label, - dfsan_label *ret_label, dfsan_origin info_origin, - dfsan_origin size_origin, dfsan_origin data_origin, - dfsan_origin *ret_origin); - void *callback; - void *data; -}; - -int dl_iterate_phdr_cb(struct dl_phdr_info *info, size_t size, void *data) { - dl_iterate_phdr_info *dipi = (dl_iterate_phdr_info *)data; - dfsan_set_label(0, *info); - dfsan_set_label(0, const_cast(info->dlpi_name), - strlen(info->dlpi_name) + 1); - dfsan_set_label( - 0, const_cast(reinterpret_cast(info->dlpi_phdr)), - sizeof(*info->dlpi_phdr) * info->dlpi_phnum); - dfsan_label ret_label; - return dipi->callback_trampoline(dipi->callback, info, size, dipi->data, 0, 0, - 0, &ret_label); -} - -int dl_iterate_phdr_origin_cb(struct dl_phdr_info *info, size_t size, - void *data) { - dl_iterate_phdr_origin_info *dipi = (dl_iterate_phdr_origin_info *)data; - dfsan_set_label(0, *info); - dfsan_set_label(0, const_cast(info->dlpi_name), - strlen(info->dlpi_name) + 1); - dfsan_set_label( - 0, const_cast(reinterpret_cast(info->dlpi_phdr)), - sizeof(*info->dlpi_phdr) * info->dlpi_phnum); - dfsan_label ret_label; - dfsan_origin ret_origin; - return dipi->callback_trampoline(dipi->callback, info, size, dipi->data, 0, 0, - 0, &ret_label, 0, 0, 0, &ret_origin); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_dl_iterate_phdr( - int (*callback_trampoline)(void *callback, struct dl_phdr_info *info, - size_t size, void *data, dfsan_label info_label, - dfsan_label size_label, dfsan_label data_label, - dfsan_label *ret_label), - void *callback, void *data, dfsan_label callback_label, - dfsan_label data_label, dfsan_label *ret_label) { - dl_iterate_phdr_info dipi = { callback_trampoline, callback, data }; - *ret_label = 0; - return dl_iterate_phdr(dl_iterate_phdr_cb, &dipi); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_dl_iterate_phdr( - int (*callback_trampoline)(void *callback, struct dl_phdr_info *info, - size_t size, void *data, dfsan_label info_label, - dfsan_label size_label, dfsan_label data_label, - dfsan_label *ret_label, dfsan_origin info_origin, - dfsan_origin size_origin, - dfsan_origin data_origin, - dfsan_origin *ret_origin), - void *callback, void *data, dfsan_label callback_label, - dfsan_label data_label, dfsan_label *ret_label, - dfsan_origin callback_origin, dfsan_origin data_origin, - dfsan_origin *ret_origin) { - dl_iterate_phdr_origin_info dipi = {callback_trampoline, callback, data}; - *ret_label = 0; - return dl_iterate_phdr(dl_iterate_phdr_origin_cb, &dipi); -} - -// This function is only available for glibc 2.27 or newer. Mark it weak so -// linking succeeds with older glibcs. -SANITIZER_WEAK_ATTRIBUTE void _dl_get_tls_static_info(size_t *sizep, - size_t *alignp); - -SANITIZER_INTERFACE_ATTRIBUTE void __dfsw__dl_get_tls_static_info( - size_t *sizep, size_t *alignp, dfsan_label sizep_label, - dfsan_label alignp_label) { - assert(_dl_get_tls_static_info); - _dl_get_tls_static_info(sizep, alignp); - dfsan_set_label(0, sizep, sizeof(*sizep)); - dfsan_set_label(0, alignp, sizeof(*alignp)); -} - -SANITIZER_INTERFACE_ATTRIBUTE void __dfso__dl_get_tls_static_info( - size_t *sizep, size_t *alignp, dfsan_label sizep_label, - dfsan_label alignp_label, dfsan_origin sizep_origin, - dfsan_origin alignp_origin) { - __dfsw__dl_get_tls_static_info(sizep, alignp, sizep_label, alignp_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfsw_ctime_r(const time_t *timep, char *buf, dfsan_label timep_label, - dfsan_label buf_label, dfsan_label *ret_label) { - char *ret = ctime_r(timep, buf); - if (ret) { - dfsan_set_label(dfsan_read_label(timep, sizeof(time_t)), buf, - strlen(buf) + 1); - *ret_label = buf_label; - } else { - *ret_label = 0; - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfso_ctime_r(const time_t *timep, char *buf, dfsan_label timep_label, - dfsan_label buf_label, dfsan_label *ret_label, - dfsan_origin timep_origin, dfsan_origin buf_origin, - dfsan_origin *ret_origin) { - char *ret = ctime_r(timep, buf); - if (ret) { - dfsan_set_label_origin( - dfsan_read_label(timep, sizeof(time_t)), - dfsan_read_origin_of_first_taint(timep, sizeof(time_t)), buf, - strlen(buf) + 1); - *ret_label = buf_label; - *ret_origin = buf_origin; - } else { - *ret_label = 0; - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfsw_fgets(char *s, int size, FILE *stream, dfsan_label s_label, - dfsan_label size_label, dfsan_label stream_label, - dfsan_label *ret_label) { - char *ret = fgets(s, size, stream); - if (ret) { - dfsan_set_label(0, ret, strlen(ret) + 1); - *ret_label = s_label; - } else { - *ret_label = 0; - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfso_fgets(char *s, int size, FILE *stream, dfsan_label s_label, - dfsan_label size_label, dfsan_label stream_label, - dfsan_label *ret_label, dfsan_origin s_origin, - dfsan_origin size_origin, dfsan_origin stream_origin, - dfsan_origin *ret_origin) { - char *ret = __dfsw_fgets(s, size, stream, s_label, size_label, stream_label, - ret_label); - if (ret) - *ret_origin = s_origin; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfsw_getcwd(char *buf, size_t size, dfsan_label buf_label, - dfsan_label size_label, dfsan_label *ret_label) { - char *ret = getcwd(buf, size); - if (ret) { - dfsan_set_label(0, ret, strlen(ret) + 1); - *ret_label = buf_label; - } else { - *ret_label = 0; - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfso_getcwd(char *buf, size_t size, dfsan_label buf_label, - dfsan_label size_label, dfsan_label *ret_label, - dfsan_origin buf_origin, dfsan_origin size_origin, - dfsan_origin *ret_origin) { - char *ret = __dfsw_getcwd(buf, size, buf_label, size_label, ret_label); - if (ret) - *ret_origin = buf_origin; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfsw_get_current_dir_name(dfsan_label *ret_label) { - char *ret = get_current_dir_name(); - if (ret) - dfsan_set_label(0, ret, strlen(ret) + 1); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfso_get_current_dir_name(dfsan_label *ret_label, - dfsan_origin *ret_origin) { - return __dfsw_get_current_dir_name(ret_label); -} - -// This function is only available for glibc 2.25 or newer. Mark it weak so -// linking succeeds with older glibcs. -SANITIZER_WEAK_ATTRIBUTE int getentropy(void *buffer, size_t length); - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_getentropy(void *buffer, size_t length, - dfsan_label buffer_label, - dfsan_label length_label, - dfsan_label *ret_label) { - int ret = getentropy(buffer, length); - if (ret == 0) { - dfsan_set_label(0, buffer, length); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_getentropy(void *buffer, size_t length, - dfsan_label buffer_label, - dfsan_label length_label, - dfsan_label *ret_label, - dfsan_origin buffer_origin, - dfsan_origin length_origin, - dfsan_origin *ret_origin) { - return __dfsw_getentropy(buffer, length, buffer_label, length_label, - ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_gethostname(char *name, size_t len, dfsan_label name_label, - dfsan_label len_label, dfsan_label *ret_label) { - int ret = gethostname(name, len); - if (ret == 0) { - dfsan_set_label(0, name, strlen(name) + 1); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_gethostname(char *name, size_t len, dfsan_label name_label, - dfsan_label len_label, dfsan_label *ret_label, - dfsan_origin name_origin, dfsan_origin len_origin, - dfsan_label *ret_origin) { - return __dfsw_gethostname(name, len, name_label, len_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_getrlimit(int resource, struct rlimit *rlim, - dfsan_label resource_label, dfsan_label rlim_label, - dfsan_label *ret_label) { - int ret = getrlimit(resource, rlim); - if (ret == 0) { - dfsan_set_label(0, rlim, sizeof(struct rlimit)); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_getrlimit(int resource, struct rlimit *rlim, - dfsan_label resource_label, dfsan_label rlim_label, - dfsan_label *ret_label, dfsan_origin resource_origin, - dfsan_origin rlim_origin, dfsan_origin *ret_origin) { - return __dfsw_getrlimit(resource, rlim, resource_label, rlim_label, - ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_getrusage(int who, struct rusage *usage, dfsan_label who_label, - dfsan_label usage_label, dfsan_label *ret_label) { - int ret = getrusage(who, usage); - if (ret == 0) { - dfsan_set_label(0, usage, sizeof(struct rusage)); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_getrusage(int who, struct rusage *usage, dfsan_label who_label, - dfsan_label usage_label, dfsan_label *ret_label, - dfsan_origin who_origin, dfsan_origin usage_origin, - dfsan_label *ret_origin) { - return __dfsw_getrusage(who, usage, who_label, usage_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfsw_strcpy(char *dest, const char *src, dfsan_label dst_label, - dfsan_label src_label, dfsan_label *ret_label) { - char *ret = strcpy(dest, src); - if (ret) { - dfsan_mem_shadow_transfer(dest, src, strlen(src) + 1); - } - *ret_label = dst_label; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -char *__dfso_strcpy(char *dest, const char *src, dfsan_label dst_label, - dfsan_label src_label, dfsan_label *ret_label, - dfsan_origin dst_origin, dfsan_origin src_origin, - dfsan_origin *ret_origin) { - char *ret = strcpy(dest, src); - if (ret) { - size_t str_len = strlen(src) + 1; - dfsan_mem_origin_transfer(dest, src, str_len); - dfsan_mem_shadow_transfer(dest, src, str_len); - } - *ret_label = dst_label; - *ret_origin = dst_origin; - return ret; -} - -static long int dfsan_strtol(const char *nptr, char **endptr, int base, - char **tmp_endptr) { - assert(tmp_endptr); - long int ret = strtol(nptr, tmp_endptr, base); - if (endptr) - *endptr = *tmp_endptr; - return ret; -} - -static void dfsan_strtolong_label(const char *nptr, const char *tmp_endptr, - dfsan_label base_label, - dfsan_label *ret_label) { - if (tmp_endptr > nptr) { - // If *tmp_endptr is '\0' include its label as well. - *ret_label = dfsan_union( - base_label, - dfsan_read_label(nptr, tmp_endptr - nptr + (*tmp_endptr ? 0 : 1))); - } else { - *ret_label = 0; - } -} - -static void dfsan_strtolong_origin(const char *nptr, const char *tmp_endptr, - dfsan_label base_label, - dfsan_label *ret_label, - dfsan_origin base_origin, - dfsan_origin *ret_origin) { - if (tmp_endptr > nptr) { - // When multiple inputs are tainted, we propagate one of its origins. - // Because checking if base_label is tainted does not need additional - // computation, we prefer to propagating base_origin. - *ret_origin = base_label - ? base_origin - : dfsan_read_origin_of_first_taint( - nptr, tmp_endptr - nptr + (*tmp_endptr ? 0 : 1)); - } -} - -SANITIZER_INTERFACE_ATTRIBUTE -long int __dfsw_strtol(const char *nptr, char **endptr, int base, - dfsan_label nptr_label, dfsan_label endptr_label, - dfsan_label base_label, dfsan_label *ret_label) { - char *tmp_endptr; - long int ret = dfsan_strtol(nptr, endptr, base, &tmp_endptr); - dfsan_strtolong_label(nptr, tmp_endptr, base_label, ret_label); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -long int __dfso_strtol(const char *nptr, char **endptr, int base, - dfsan_label nptr_label, dfsan_label endptr_label, - dfsan_label base_label, dfsan_label *ret_label, - dfsan_origin nptr_origin, dfsan_origin endptr_origin, - dfsan_origin base_origin, dfsan_origin *ret_origin) { - char *tmp_endptr; - long int ret = dfsan_strtol(nptr, endptr, base, &tmp_endptr); - dfsan_strtolong_label(nptr, tmp_endptr, base_label, ret_label); - dfsan_strtolong_origin(nptr, tmp_endptr, base_label, ret_label, base_origin, - ret_origin); - return ret; -} - -static double dfsan_strtod(const char *nptr, char **endptr, char **tmp_endptr) { - assert(tmp_endptr); - double ret = strtod(nptr, tmp_endptr); - if (endptr) - *endptr = *tmp_endptr; - return ret; -} - -static void dfsan_strtod_label(const char *nptr, const char *tmp_endptr, - dfsan_label *ret_label) { - if (tmp_endptr > nptr) { - // If *tmp_endptr is '\0' include its label as well. - *ret_label = dfsan_read_label( - nptr, - tmp_endptr - nptr + (*tmp_endptr ? 0 : 1)); - } else { - *ret_label = 0; - } -} - -SANITIZER_INTERFACE_ATTRIBUTE -double __dfsw_strtod(const char *nptr, char **endptr, dfsan_label nptr_label, - dfsan_label endptr_label, dfsan_label *ret_label) { - char *tmp_endptr; - double ret = dfsan_strtod(nptr, endptr, &tmp_endptr); - dfsan_strtod_label(nptr, tmp_endptr, ret_label); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -double __dfso_strtod(const char *nptr, char **endptr, dfsan_label nptr_label, - dfsan_label endptr_label, dfsan_label *ret_label, - dfsan_origin nptr_origin, dfsan_origin endptr_origin, - dfsan_origin *ret_origin) { - char *tmp_endptr; - double ret = dfsan_strtod(nptr, endptr, &tmp_endptr); - dfsan_strtod_label(nptr, tmp_endptr, ret_label); - if (tmp_endptr > nptr) { - // If *tmp_endptr is '\0' include its label as well. - *ret_origin = dfsan_read_origin_of_first_taint( - nptr, tmp_endptr - nptr + (*tmp_endptr ? 0 : 1)); - } else { - *ret_origin = 0; - } - return ret; -} - -static long long int dfsan_strtoll(const char *nptr, char **endptr, int base, - char **tmp_endptr) { - assert(tmp_endptr); - long long int ret = strtoll(nptr, tmp_endptr, base); - if (endptr) - *endptr = *tmp_endptr; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -long long int __dfsw_strtoll(const char *nptr, char **endptr, int base, - dfsan_label nptr_label, dfsan_label endptr_label, - dfsan_label base_label, dfsan_label *ret_label) { - char *tmp_endptr; - long long int ret = dfsan_strtoll(nptr, endptr, base, &tmp_endptr); - dfsan_strtolong_label(nptr, tmp_endptr, base_label, ret_label); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -long long int __dfso_strtoll(const char *nptr, char **endptr, int base, - dfsan_label nptr_label, dfsan_label endptr_label, - dfsan_label base_label, dfsan_label *ret_label, - dfsan_origin nptr_origin, - dfsan_origin endptr_origin, - dfsan_origin base_origin, - dfsan_origin *ret_origin) { - char *tmp_endptr; - long long int ret = dfsan_strtoll(nptr, endptr, base, &tmp_endptr); - dfsan_strtolong_label(nptr, tmp_endptr, base_label, ret_label); - dfsan_strtolong_origin(nptr, tmp_endptr, base_label, ret_label, base_origin, - ret_origin); - return ret; -} - -static unsigned long int dfsan_strtoul(const char *nptr, char **endptr, - int base, char **tmp_endptr) { - assert(tmp_endptr); - unsigned long int ret = strtoul(nptr, tmp_endptr, base); - if (endptr) - *endptr = *tmp_endptr; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -unsigned long int __dfsw_strtoul(const char *nptr, char **endptr, int base, - dfsan_label nptr_label, dfsan_label endptr_label, - dfsan_label base_label, dfsan_label *ret_label) { - char *tmp_endptr; - unsigned long int ret = dfsan_strtoul(nptr, endptr, base, &tmp_endptr); - dfsan_strtolong_label(nptr, tmp_endptr, base_label, ret_label); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -unsigned long int __dfso_strtoul( - const char *nptr, char **endptr, int base, dfsan_label nptr_label, - dfsan_label endptr_label, dfsan_label base_label, dfsan_label *ret_label, - dfsan_origin nptr_origin, dfsan_origin endptr_origin, - dfsan_origin base_origin, dfsan_origin *ret_origin) { - char *tmp_endptr; - unsigned long int ret = dfsan_strtoul(nptr, endptr, base, &tmp_endptr); - dfsan_strtolong_label(nptr, tmp_endptr, base_label, ret_label); - dfsan_strtolong_origin(nptr, tmp_endptr, base_label, ret_label, base_origin, - ret_origin); - return ret; -} - -static long long unsigned int dfsan_strtoull(const char *nptr, char **endptr, - int base, char **tmp_endptr) { - assert(tmp_endptr); - long long unsigned int ret = strtoull(nptr, tmp_endptr, base); - if (endptr) - *endptr = *tmp_endptr; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -long long unsigned int __dfsw_strtoull(const char *nptr, char **endptr, - int base, dfsan_label nptr_label, - dfsan_label endptr_label, - dfsan_label base_label, - dfsan_label *ret_label) { - char *tmp_endptr; - long long unsigned int ret = dfsan_strtoull(nptr, endptr, base, &tmp_endptr); - dfsan_strtolong_label(nptr, tmp_endptr, base_label, ret_label); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -long long unsigned int __dfso_strtoull( - const char *nptr, char **endptr, int base, dfsan_label nptr_label, - dfsan_label endptr_label, dfsan_label base_label, dfsan_label *ret_label, - dfsan_origin nptr_origin, dfsan_origin endptr_origin, - dfsan_origin base_origin, dfsan_origin *ret_origin) { - char *tmp_endptr; - long long unsigned int ret = dfsan_strtoull(nptr, endptr, base, &tmp_endptr); - dfsan_strtolong_label(nptr, tmp_endptr, base_label, ret_label); - dfsan_strtolong_origin(nptr, tmp_endptr, base_label, ret_label, base_origin, - ret_origin); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -time_t __dfsw_time(time_t *t, dfsan_label t_label, dfsan_label *ret_label) { - time_t ret = time(t); - if (ret != (time_t) -1 && t) { - dfsan_set_label(0, t, sizeof(time_t)); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -time_t __dfso_time(time_t *t, dfsan_label t_label, dfsan_label *ret_label, - dfsan_origin t_origin, dfsan_origin *ret_origin) { - return __dfsw_time(t, t_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_inet_pton(int af, const char *src, void *dst, dfsan_label af_label, - dfsan_label src_label, dfsan_label dst_label, - dfsan_label *ret_label) { - int ret = inet_pton(af, src, dst); - if (ret == 1) { - dfsan_set_label(dfsan_read_label(src, strlen(src) + 1), dst, - af == AF_INET ? sizeof(struct in_addr) : sizeof(in6_addr)); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_inet_pton(int af, const char *src, void *dst, dfsan_label af_label, - dfsan_label src_label, dfsan_label dst_label, - dfsan_label *ret_label, dfsan_origin af_origin, - dfsan_origin src_origin, dfsan_origin dst_origin, - dfsan_origin *ret_origin) { - int ret = inet_pton(af, src, dst); - if (ret == 1) { - int src_len = strlen(src) + 1; - dfsan_set_label_origin( - dfsan_read_label(src, src_len), - dfsan_read_origin_of_first_taint(src, src_len), dst, - af == AF_INET ? sizeof(struct in_addr) : sizeof(in6_addr)); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -struct tm *__dfsw_localtime_r(const time_t *timep, struct tm *result, - dfsan_label timep_label, dfsan_label result_label, - dfsan_label *ret_label) { - struct tm *ret = localtime_r(timep, result); - if (ret) { - dfsan_set_label(dfsan_read_label(timep, sizeof(time_t)), result, - sizeof(struct tm)); - *ret_label = result_label; - } else { - *ret_label = 0; - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -struct tm *__dfso_localtime_r(const time_t *timep, struct tm *result, - dfsan_label timep_label, dfsan_label result_label, - dfsan_label *ret_label, dfsan_origin timep_origin, - dfsan_origin result_origin, - dfsan_origin *ret_origin) { - struct tm *ret = localtime_r(timep, result); - if (ret) { - dfsan_set_label_origin( - dfsan_read_label(timep, sizeof(time_t)), - dfsan_read_origin_of_first_taint(timep, sizeof(time_t)), result, - sizeof(struct tm)); - *ret_label = result_label; - *ret_origin = result_origin; - } else { - *ret_label = 0; - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_getpwuid_r(id_t uid, struct passwd *pwd, - char *buf, size_t buflen, struct passwd **result, - dfsan_label uid_label, dfsan_label pwd_label, - dfsan_label buf_label, dfsan_label buflen_label, - dfsan_label result_label, dfsan_label *ret_label) { - // Store the data in pwd, the strings referenced from pwd in buf, and the - // address of pwd in *result. On failure, NULL is stored in *result. - int ret = getpwuid_r(uid, pwd, buf, buflen, result); - if (ret == 0) { - dfsan_set_label(0, pwd, sizeof(struct passwd)); - dfsan_set_label(0, buf, strlen(buf) + 1); - } - *ret_label = 0; - dfsan_set_label(0, result, sizeof(struct passwd*)); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_getpwuid_r(id_t uid, struct passwd *pwd, char *buf, size_t buflen, - struct passwd **result, dfsan_label uid_label, - dfsan_label pwd_label, dfsan_label buf_label, - dfsan_label buflen_label, dfsan_label result_label, - dfsan_label *ret_label, dfsan_origin uid_origin, - dfsan_origin pwd_origin, dfsan_origin buf_origin, - dfsan_origin buflen_origin, dfsan_origin result_origin, - dfsan_origin *ret_origin) { - return __dfsw_getpwuid_r(uid, pwd, buf, buflen, result, uid_label, pwd_label, - buf_label, buflen_label, result_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_epoll_wait(int epfd, struct epoll_event *events, int maxevents, - int timeout, dfsan_label epfd_label, - dfsan_label events_label, dfsan_label maxevents_label, - dfsan_label timeout_label, dfsan_label *ret_label) { - int ret = epoll_wait(epfd, events, maxevents, timeout); - if (ret > 0) - dfsan_set_label(0, events, ret * sizeof(*events)); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_epoll_wait(int epfd, struct epoll_event *events, int maxevents, - int timeout, dfsan_label epfd_label, - dfsan_label events_label, dfsan_label maxevents_label, - dfsan_label timeout_label, dfsan_label *ret_label, - dfsan_origin epfd_origin, dfsan_origin events_origin, - dfsan_origin maxevents_origin, - dfsan_origin timeout_origin, dfsan_origin *ret_origin) { - return __dfsw_epoll_wait(epfd, events, maxevents, timeout, epfd_label, - events_label, maxevents_label, timeout_label, - ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_poll(struct pollfd *fds, nfds_t nfds, int timeout, - dfsan_label dfs_label, dfsan_label nfds_label, - dfsan_label timeout_label, dfsan_label *ret_label) { - int ret = poll(fds, nfds, timeout); - if (ret >= 0) { - for (; nfds > 0; --nfds) { - dfsan_set_label(0, &fds[nfds - 1].revents, sizeof(fds[nfds - 1].revents)); - } - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_poll(struct pollfd *fds, nfds_t nfds, int timeout, - dfsan_label dfs_label, dfsan_label nfds_label, - dfsan_label timeout_label, dfsan_label *ret_label, - dfsan_origin dfs_origin, dfsan_origin nfds_origin, - dfsan_origin timeout_origin, dfsan_origin *ret_origin) { - return __dfsw_poll(fds, nfds, timeout, dfs_label, nfds_label, timeout_label, - ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_select(int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout, - dfsan_label nfds_label, dfsan_label readfds_label, - dfsan_label writefds_label, dfsan_label exceptfds_label, - dfsan_label timeout_label, dfsan_label *ret_label) { - int ret = select(nfds, readfds, writefds, exceptfds, timeout); - // Clear everything (also on error) since their content is either set or - // undefined. - if (readfds) { - dfsan_set_label(0, readfds, sizeof(fd_set)); - } - if (writefds) { - dfsan_set_label(0, writefds, sizeof(fd_set)); - } - if (exceptfds) { - dfsan_set_label(0, exceptfds, sizeof(fd_set)); - } - dfsan_set_label(0, timeout, sizeof(struct timeval)); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_select(int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout, - dfsan_label nfds_label, dfsan_label readfds_label, - dfsan_label writefds_label, dfsan_label exceptfds_label, - dfsan_label timeout_label, dfsan_label *ret_label, - dfsan_origin nfds_origin, dfsan_origin readfds_origin, - dfsan_origin writefds_origin, dfsan_origin exceptfds_origin, - dfsan_origin timeout_origin, dfsan_origin *ret_origin) { - return __dfsw_select(nfds, readfds, writefds, exceptfds, timeout, nfds_label, - readfds_label, writefds_label, exceptfds_label, - timeout_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask, - dfsan_label pid_label, - dfsan_label cpusetsize_label, - dfsan_label mask_label, dfsan_label *ret_label) { - int ret = sched_getaffinity(pid, cpusetsize, mask); - if (ret == 0) { - dfsan_set_label(0, mask, cpusetsize); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask, - dfsan_label pid_label, - dfsan_label cpusetsize_label, - dfsan_label mask_label, dfsan_label *ret_label, - dfsan_origin pid_origin, - dfsan_origin cpusetsize_origin, - dfsan_origin mask_origin, - dfsan_origin *ret_origin) { - return __dfsw_sched_getaffinity(pid, cpusetsize, mask, pid_label, - cpusetsize_label, mask_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_sigemptyset(sigset_t *set, dfsan_label set_label, - dfsan_label *ret_label) { - int ret = sigemptyset(set); - dfsan_set_label(0, set, sizeof(sigset_t)); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_sigemptyset(sigset_t *set, dfsan_label set_label, - dfsan_label *ret_label, dfsan_origin set_origin, - dfsan_origin *ret_origin) { - return __dfsw_sigemptyset(set, set_label, ret_label); -} - -class SignalHandlerScope { - public: - SignalHandlerScope() { - if (DFsanThread *t = GetCurrentThread()) - t->EnterSignalHandler(); - } - ~SignalHandlerScope() { - if (DFsanThread *t = GetCurrentThread()) - t->LeaveSignalHandler(); - } -}; - -// Clear DFSan runtime TLS state at the end of a scope. -// -// Implementation must be async-signal-safe and use small data size, because -// instances of this class may live on the signal handler stack. -// -// DFSan uses TLS to pass metadata of arguments and return values. When an -// instrumented function accesses the TLS, if a signal callback happens, and the -// callback calls other instrumented functions with updating the same TLS, the -// TLS is in an inconsistent state after the callback ends. This may cause -// either under-tainting or over-tainting. -// -// The current implementation simply resets TLS at restore. This prevents from -// over-tainting. Although under-tainting may still happen, a taint flow can be -// found eventually if we run a DFSan-instrumented program multiple times. The -// alternative option is saving the entire TLS. However the TLS storage takes -// 2k bytes, and signal calls could be nested. So it does not seem worth. -class ScopedClearThreadLocalState { - public: - ScopedClearThreadLocalState() {} - ~ScopedClearThreadLocalState() { dfsan_clear_thread_local_state(); } -}; - -// SignalSpinLocker::sigactions_mu guarantees atomicity of sigaction() calls. -const int kMaxSignals = 1024; -static atomic_uintptr_t sigactions[kMaxSignals]; - -static void SignalHandler(int signo) { - SignalHandlerScope signal_handler_scope; - ScopedClearThreadLocalState scoped_clear_tls; - - // Clear shadows for all inputs provided by system. This is why DFSan - // instrumentation generates a trampoline function to each function pointer, - // and uses the trampoline to clear shadows. However sigaction does not use - // a function pointer directly, so we have to do this manually. - dfsan_clear_arg_tls(0, sizeof(dfsan_label)); - - typedef void (*signal_cb)(int x); - signal_cb cb = - (signal_cb)atomic_load(&sigactions[signo], memory_order_relaxed); - cb(signo); -} - -static void SignalAction(int signo, siginfo_t *si, void *uc) { - SignalHandlerScope signal_handler_scope; - ScopedClearThreadLocalState scoped_clear_tls; - - // Clear shadows for all inputs provided by system. Similar to SignalHandler. - dfsan_clear_arg_tls(0, 3 * sizeof(dfsan_label)); - dfsan_set_label(0, si, sizeof(*si)); - dfsan_set_label(0, uc, sizeof(ucontext_t)); - - typedef void (*sigaction_cb)(int, siginfo_t *, void *); - sigaction_cb cb = - (sigaction_cb)atomic_load(&sigactions[signo], memory_order_relaxed); - cb(signo, si, uc); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_sigaction(int signum, const struct sigaction *act, - struct sigaction *oldact, dfsan_label signum_label, - dfsan_label act_label, dfsan_label oldact_label, - dfsan_label *ret_label) { - CHECK_LT(signum, kMaxSignals); - SignalSpinLocker lock; - uptr old_cb = atomic_load(&sigactions[signum], memory_order_relaxed); - struct sigaction new_act; - struct sigaction *pnew_act = act ? &new_act : nullptr; - if (act) { - internal_memcpy(pnew_act, act, sizeof(struct sigaction)); - if (pnew_act->sa_flags & SA_SIGINFO) { - uptr cb = (uptr)(pnew_act->sa_sigaction); - if (cb != (uptr)SIG_IGN && cb != (uptr)SIG_DFL) { - atomic_store(&sigactions[signum], cb, memory_order_relaxed); - pnew_act->sa_sigaction = SignalAction; - } - } else { - uptr cb = (uptr)(pnew_act->sa_handler); - if (cb != (uptr)SIG_IGN && cb != (uptr)SIG_DFL) { - atomic_store(&sigactions[signum], cb, memory_order_relaxed); - pnew_act->sa_handler = SignalHandler; - } - } - } - - int ret = sigaction(signum, pnew_act, oldact); - - if (ret == 0 && oldact) { - if (oldact->sa_flags & SA_SIGINFO) { - if (oldact->sa_sigaction == SignalAction) - oldact->sa_sigaction = (decltype(oldact->sa_sigaction))old_cb; - } else { - if (oldact->sa_handler == SignalHandler) - oldact->sa_handler = (decltype(oldact->sa_handler))old_cb; - } - } - - if (oldact) { - dfsan_set_label(0, oldact, sizeof(struct sigaction)); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_sigaction(int signum, const struct sigaction *act, - struct sigaction *oldact, dfsan_label signum_label, - dfsan_label act_label, dfsan_label oldact_label, - dfsan_label *ret_label, dfsan_origin signum_origin, - dfsan_origin act_origin, dfsan_origin oldact_origin, - dfsan_origin *ret_origin) { - return __dfsw_sigaction(signum, act, oldact, signum_label, act_label, - oldact_label, ret_label); -} - -static sighandler_t dfsan_signal(int signum, sighandler_t handler, - dfsan_label *ret_label) { - CHECK_LT(signum, kMaxSignals); - SignalSpinLocker lock; - uptr old_cb = atomic_load(&sigactions[signum], memory_order_relaxed); - if (handler != SIG_IGN && handler != SIG_DFL) { - atomic_store(&sigactions[signum], (uptr)handler, memory_order_relaxed); - handler = &SignalHandler; - } - - sighandler_t ret = signal(signum, handler); - - if (ret == SignalHandler) - ret = (sighandler_t)old_cb; - - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -sighandler_t __dfsw_signal(int signum, - void *(*handler_trampoline)(void *, int, dfsan_label, - dfsan_label *), - sighandler_t handler, dfsan_label signum_label, - dfsan_label handler_label, dfsan_label *ret_label) { - return dfsan_signal(signum, handler, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -sighandler_t __dfso_signal( - int signum, - void *(*handler_trampoline)(void *, int, dfsan_label, dfsan_label *, - dfsan_origin, dfsan_origin *), - sighandler_t handler, dfsan_label signum_label, dfsan_label handler_label, - dfsan_label *ret_label, dfsan_origin signum_origin, - dfsan_origin handler_origin, dfsan_origin *ret_origin) { - return dfsan_signal(signum, handler, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_sigaltstack(const stack_t *ss, stack_t *old_ss, dfsan_label ss_label, - dfsan_label old_ss_label, dfsan_label *ret_label) { - int ret = sigaltstack(ss, old_ss); - if (ret != -1 && old_ss) - dfsan_set_label(0, old_ss, sizeof(*old_ss)); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_sigaltstack(const stack_t *ss, stack_t *old_ss, dfsan_label ss_label, - dfsan_label old_ss_label, dfsan_label *ret_label, - dfsan_origin ss_origin, dfsan_origin old_ss_origin, - dfsan_origin *ret_origin) { - return __dfsw_sigaltstack(ss, old_ss, ss_label, old_ss_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_gettimeofday(struct timeval *tv, struct timezone *tz, - dfsan_label tv_label, dfsan_label tz_label, - dfsan_label *ret_label) { - int ret = gettimeofday(tv, tz); - if (tv) { - dfsan_set_label(0, tv, sizeof(struct timeval)); - } - if (tz) { - dfsan_set_label(0, tz, sizeof(struct timezone)); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_gettimeofday(struct timeval *tv, struct timezone *tz, - dfsan_label tv_label, dfsan_label tz_label, - dfsan_label *ret_label, dfsan_origin tv_origin, - dfsan_origin tz_origin, dfsan_origin *ret_origin) { - return __dfsw_gettimeofday(tv, tz, tv_label, tz_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE void *__dfsw_memchr(void *s, int c, size_t n, - dfsan_label s_label, - dfsan_label c_label, - dfsan_label n_label, - dfsan_label *ret_label) { - void *ret = memchr(s, c, n); - if (flags().strict_data_dependencies) { - *ret_label = ret ? s_label : 0; - } else { - size_t len = - ret ? reinterpret_cast(ret) - reinterpret_cast(s) + 1 - : n; - *ret_label = - dfsan_union(dfsan_read_label(s, len), dfsan_union(s_label, c_label)); - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE void *__dfso_memchr( - void *s, int c, size_t n, dfsan_label s_label, dfsan_label c_label, - dfsan_label n_label, dfsan_label *ret_label, dfsan_origin s_origin, - dfsan_origin c_origin, dfsan_origin n_origin, dfsan_origin *ret_origin) { - void *ret = __dfsw_memchr(s, c, n, s_label, c_label, n_label, ret_label); - if (flags().strict_data_dependencies) { - if (ret) - *ret_origin = s_origin; - } else { - size_t len = - ret ? reinterpret_cast(ret) - reinterpret_cast(s) + 1 - : n; - dfsan_origin o = dfsan_read_origin_of_first_taint(s, len); - *ret_origin = o ? o : (s_label ? s_origin : c_origin); - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfsw_strrchr(char *s, int c, - dfsan_label s_label, - dfsan_label c_label, - dfsan_label *ret_label) { - char *ret = strrchr(s, c); - if (flags().strict_data_dependencies) { - *ret_label = ret ? s_label : 0; - } else { - *ret_label = - dfsan_union(dfsan_read_label(s, strlen(s) + 1), - dfsan_union(s_label, c_label)); - } - - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfso_strrchr( - char *s, int c, dfsan_label s_label, dfsan_label c_label, - dfsan_label *ret_label, dfsan_origin s_origin, dfsan_origin c_origin, - dfsan_origin *ret_origin) { - char *ret = __dfsw_strrchr(s, c, s_label, c_label, ret_label); - if (flags().strict_data_dependencies) { - if (ret) - *ret_origin = s_origin; - } else { - size_t s_len = strlen(s) + 1; - dfsan_origin o = dfsan_read_origin_of_first_taint(s, s_len); - *ret_origin = o ? o : (s_label ? s_origin : c_origin); - } - - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfsw_strstr(char *haystack, char *needle, - dfsan_label haystack_label, - dfsan_label needle_label, - dfsan_label *ret_label) { - char *ret = strstr(haystack, needle); - if (flags().strict_data_dependencies) { - *ret_label = ret ? haystack_label : 0; - } else { - size_t len = ret ? ret + strlen(needle) - haystack : strlen(haystack) + 1; - *ret_label = - dfsan_union(dfsan_read_label(haystack, len), - dfsan_union(dfsan_read_label(needle, strlen(needle) + 1), - dfsan_union(haystack_label, needle_label))); - } - - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE char *__dfso_strstr(char *haystack, char *needle, - dfsan_label haystack_label, - dfsan_label needle_label, - dfsan_label *ret_label, - dfsan_origin haystack_origin, - dfsan_origin needle_origin, - dfsan_origin *ret_origin) { - char *ret = - __dfsw_strstr(haystack, needle, haystack_label, needle_label, ret_label); - if (flags().strict_data_dependencies) { - if (ret) - *ret_origin = haystack_origin; - } else { - size_t needle_len = strlen(needle); - size_t len = ret ? ret + needle_len - haystack : strlen(haystack) + 1; - dfsan_origin o = dfsan_read_origin_of_first_taint(haystack, len); - if (o) { - *ret_origin = o; - } else { - o = dfsan_read_origin_of_first_taint(needle, needle_len + 1); - *ret_origin = o ? o : (haystack_label ? haystack_origin : needle_origin); - } - } - - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_nanosleep(const struct timespec *req, - struct timespec *rem, - dfsan_label req_label, - dfsan_label rem_label, - dfsan_label *ret_label) { - int ret = nanosleep(req, rem); - *ret_label = 0; - if (ret == -1) { - // Interrupted by a signal, rem is filled with the remaining time. - dfsan_set_label(0, rem, sizeof(struct timespec)); - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_nanosleep( - const struct timespec *req, struct timespec *rem, dfsan_label req_label, - dfsan_label rem_label, dfsan_label *ret_label, dfsan_origin req_origin, - dfsan_origin rem_origin, dfsan_origin *ret_origin) { - return __dfsw_nanosleep(req, rem, req_label, rem_label, ret_label); -} - -static void clear_msghdr_labels(size_t bytes_written, struct msghdr *msg) { - dfsan_set_label(0, msg, sizeof(*msg)); - dfsan_set_label(0, msg->msg_name, msg->msg_namelen); - dfsan_set_label(0, msg->msg_control, msg->msg_controllen); - for (size_t i = 0; bytes_written > 0; ++i) { - assert(i < msg->msg_iovlen); - struct iovec *iov = &msg->msg_iov[i]; - size_t iov_written = - bytes_written < iov->iov_len ? bytes_written : iov->iov_len; - dfsan_set_label(0, iov->iov_base, iov_written); - bytes_written -= iov_written; - } -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_recvmmsg( - int sockfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, - struct timespec *timeout, dfsan_label sockfd_label, - dfsan_label msgvec_label, dfsan_label vlen_label, dfsan_label flags_label, - dfsan_label timeout_label, dfsan_label *ret_label) { - int ret = recvmmsg(sockfd, msgvec, vlen, flags, timeout); - for (int i = 0; i < ret; ++i) { - dfsan_set_label(0, &msgvec[i].msg_len, sizeof(msgvec[i].msg_len)); - clear_msghdr_labels(msgvec[i].msg_len, &msgvec[i].msg_hdr); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_recvmmsg( - int sockfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, - struct timespec *timeout, dfsan_label sockfd_label, - dfsan_label msgvec_label, dfsan_label vlen_label, dfsan_label flags_label, - dfsan_label timeout_label, dfsan_label *ret_label, - dfsan_origin sockfd_origin, dfsan_origin msgvec_origin, - dfsan_origin vlen_origin, dfsan_origin flags_origin, - dfsan_origin timeout_origin, dfsan_origin *ret_origin) { - return __dfsw_recvmmsg(sockfd, msgvec, vlen, flags, timeout, sockfd_label, - msgvec_label, vlen_label, flags_label, timeout_label, - ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE ssize_t __dfsw_recvmsg( - int sockfd, struct msghdr *msg, int flags, dfsan_label sockfd_label, - dfsan_label msg_label, dfsan_label flags_label, dfsan_label *ret_label) { - ssize_t ret = recvmsg(sockfd, msg, flags); - if (ret >= 0) - clear_msghdr_labels(ret, msg); - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE ssize_t __dfso_recvmsg( - int sockfd, struct msghdr *msg, int flags, dfsan_label sockfd_label, - dfsan_label msg_label, dfsan_label flags_label, dfsan_label *ret_label, - dfsan_origin sockfd_origin, dfsan_origin msg_origin, - dfsan_origin flags_origin, dfsan_origin *ret_origin) { - return __dfsw_recvmsg(sockfd, msg, flags, sockfd_label, msg_label, - flags_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE int -__dfsw_socketpair(int domain, int type, int protocol, int sv[2], - dfsan_label domain_label, dfsan_label type_label, - dfsan_label protocol_label, dfsan_label sv_label, - dfsan_label *ret_label) { - int ret = socketpair(domain, type, protocol, sv); - *ret_label = 0; - if (ret == 0) { - dfsan_set_label(0, sv, sizeof(*sv) * 2); - } - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_socketpair( - int domain, int type, int protocol, int sv[2], dfsan_label domain_label, - dfsan_label type_label, dfsan_label protocol_label, dfsan_label sv_label, - dfsan_label *ret_label, dfsan_origin domain_origin, - dfsan_origin type_origin, dfsan_origin protocol_origin, - dfsan_origin sv_origin, dfsan_origin *ret_origin) { - return __dfsw_socketpair(domain, type, protocol, sv, domain_label, type_label, - protocol_label, sv_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_getsockopt( - int sockfd, int level, int optname, void *optval, socklen_t *optlen, - dfsan_label sockfd_label, dfsan_label level_label, - dfsan_label optname_label, dfsan_label optval_label, - dfsan_label optlen_label, dfsan_label *ret_label) { - int ret = getsockopt(sockfd, level, optname, optval, optlen); - if (ret != -1 && optval && optlen) { - dfsan_set_label(0, optlen, sizeof(*optlen)); - dfsan_set_label(0, optval, *optlen); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_getsockopt( - int sockfd, int level, int optname, void *optval, socklen_t *optlen, - dfsan_label sockfd_label, dfsan_label level_label, - dfsan_label optname_label, dfsan_label optval_label, - dfsan_label optlen_label, dfsan_label *ret_label, - dfsan_origin sockfd_origin, dfsan_origin level_origin, - dfsan_origin optname_origin, dfsan_origin optval_origin, - dfsan_origin optlen_origin, dfsan_origin *ret_origin) { - return __dfsw_getsockopt(sockfd, level, optname, optval, optlen, sockfd_label, - level_label, optname_label, optval_label, - optlen_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_getsockname( - int sockfd, struct sockaddr *addr, socklen_t *addrlen, - dfsan_label sockfd_label, dfsan_label addr_label, dfsan_label addrlen_label, - dfsan_label *ret_label) { - socklen_t origlen = addrlen ? *addrlen : 0; - int ret = getsockname(sockfd, addr, addrlen); - if (ret != -1 && addr && addrlen) { - socklen_t written_bytes = origlen < *addrlen ? origlen : *addrlen; - dfsan_set_label(0, addrlen, sizeof(*addrlen)); - dfsan_set_label(0, addr, written_bytes); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_getsockname( - int sockfd, struct sockaddr *addr, socklen_t *addrlen, - dfsan_label sockfd_label, dfsan_label addr_label, dfsan_label addrlen_label, - dfsan_label *ret_label, dfsan_origin sockfd_origin, - dfsan_origin addr_origin, dfsan_origin addrlen_origin, - dfsan_origin *ret_origin) { - return __dfsw_getsockname(sockfd, addr, addrlen, sockfd_label, addr_label, - addrlen_label, ret_label); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_getpeername( - int sockfd, struct sockaddr *addr, socklen_t *addrlen, - dfsan_label sockfd_label, dfsan_label addr_label, dfsan_label addrlen_label, - dfsan_label *ret_label) { - socklen_t origlen = addrlen ? *addrlen : 0; - int ret = getpeername(sockfd, addr, addrlen); - if (ret != -1 && addr && addrlen) { - socklen_t written_bytes = origlen < *addrlen ? origlen : *addrlen; - dfsan_set_label(0, addrlen, sizeof(*addrlen)); - dfsan_set_label(0, addr, written_bytes); - } - *ret_label = 0; - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_getpeername( - int sockfd, struct sockaddr *addr, socklen_t *addrlen, - dfsan_label sockfd_label, dfsan_label addr_label, dfsan_label addrlen_label, - dfsan_label *ret_label, dfsan_origin sockfd_origin, - dfsan_origin addr_origin, dfsan_origin addrlen_origin, - dfsan_origin *ret_origin) { - return __dfsw_getpeername(sockfd, addr, addrlen, sockfd_label, addr_label, - addrlen_label, ret_label); -} - -// Type of the trampoline function passed to the custom version of -// dfsan_set_write_callback. -typedef void (*write_trampoline_t)( - void *callback, - int fd, const void *buf, ssize_t count, - dfsan_label fd_label, dfsan_label buf_label, dfsan_label count_label); - -typedef void (*write_origin_trampoline_t)( - void *callback, int fd, const void *buf, ssize_t count, - dfsan_label fd_label, dfsan_label buf_label, dfsan_label count_label, - dfsan_origin fd_origin, dfsan_origin buf_origin, dfsan_origin count_origin); - -// Calls to dfsan_set_write_callback() set the values in this struct. -// Calls to the custom version of write() read (and invoke) them. -static struct { - write_trampoline_t write_callback_trampoline = nullptr; - void *write_callback = nullptr; -} write_callback_info; - -static struct { - write_origin_trampoline_t write_callback_trampoline = nullptr; - void *write_callback = nullptr; -} write_origin_callback_info; - -SANITIZER_INTERFACE_ATTRIBUTE void -__dfsw_dfsan_set_write_callback( - write_trampoline_t write_callback_trampoline, - void *write_callback, - dfsan_label write_callback_label, - dfsan_label *ret_label) { - write_callback_info.write_callback_trampoline = write_callback_trampoline; - write_callback_info.write_callback = write_callback; -} - -SANITIZER_INTERFACE_ATTRIBUTE void __dfso_dfsan_set_write_callback( - write_origin_trampoline_t write_callback_trampoline, void *write_callback, - dfsan_label write_callback_label, dfsan_label *ret_label, - dfsan_origin write_callback_origin, dfsan_origin *ret_origin) { - write_origin_callback_info.write_callback_trampoline = - write_callback_trampoline; - write_origin_callback_info.write_callback = write_callback; -} - -SANITIZER_INTERFACE_ATTRIBUTE int -__dfsw_write(int fd, const void *buf, size_t count, - dfsan_label fd_label, dfsan_label buf_label, - dfsan_label count_label, dfsan_label *ret_label) { - if (write_callback_info.write_callback) { - write_callback_info.write_callback_trampoline( - write_callback_info.write_callback, - fd, buf, count, - fd_label, buf_label, count_label); - } - - *ret_label = 0; - return write(fd, buf, count); -} - -SANITIZER_INTERFACE_ATTRIBUTE int __dfso_write( - int fd, const void *buf, size_t count, dfsan_label fd_label, - dfsan_label buf_label, dfsan_label count_label, dfsan_label *ret_label, - dfsan_origin fd_origin, dfsan_origin buf_origin, dfsan_origin count_origin, - dfsan_origin *ret_origin) { - if (write_origin_callback_info.write_callback) { - write_origin_callback_info.write_callback_trampoline( - write_origin_callback_info.write_callback, fd, buf, count, fd_label, - buf_label, count_label, fd_origin, buf_origin, count_origin); - } - - *ret_label = 0; - return write(fd, buf, count); -} -} // namespace __dfsan - -// Type used to extract a dfsan_label with va_arg() -typedef int dfsan_label_va; - -// Formats a chunk either a constant string or a single format directive (e.g., -// '%.3f'). -struct Formatter { - Formatter(char *str_, const char *fmt_, size_t size_) - : str(str_), str_off(0), size(size_), fmt_start(fmt_), fmt_cur(fmt_), - width(-1) {} - - int format() { - char *tmp_fmt = build_format_string(); - int retval = - snprintf(str + str_off, str_off < size ? size - str_off : 0, tmp_fmt, - 0 /* used only to avoid warnings */); - free(tmp_fmt); - return retval; - } - - template int format(T arg) { - char *tmp_fmt = build_format_string(); - int retval; - if (width >= 0) { - retval = snprintf(str + str_off, str_off < size ? size - str_off : 0, - tmp_fmt, width, arg); - } else { - retval = snprintf(str + str_off, str_off < size ? size - str_off : 0, - tmp_fmt, arg); - } - free(tmp_fmt); - return retval; - } - - char *build_format_string() { - size_t fmt_size = fmt_cur - fmt_start + 1; - char *new_fmt = (char *)malloc(fmt_size + 1); - assert(new_fmt); - internal_memcpy(new_fmt, fmt_start, fmt_size); - new_fmt[fmt_size] = '\0'; - return new_fmt; - } - - char *str_cur() { return str + str_off; } - - size_t num_written_bytes(int retval) { - if (retval < 0) { - return 0; - } - - size_t num_avail = str_off < size ? size - str_off : 0; - if (num_avail == 0) { - return 0; - } - - size_t num_written = retval; - // A return value of {v,}snprintf of size or more means that the output was - // truncated. - if (num_written >= num_avail) { - num_written -= num_avail; - } - - return num_written; - } - - char *str; - size_t str_off; - size_t size; - const char *fmt_start; - const char *fmt_cur; - int width; -}; - -// Formats the input and propagates the input labels to the output. The output -// is stored in 'str'. 'size' bounds the number of output bytes. 'format' and -// 'ap' are the format string and the list of arguments for formatting. Returns -// the return value vsnprintf would return. -// -// The function tokenizes the format string in chunks representing either a -// constant string or a single format directive (e.g., '%.3f') and formats each -// chunk independently into the output string. This approach allows to figure -// out which bytes of the output string depends on which argument and thus to -// propagate labels more precisely. -// -// WARNING: This implementation does not support conversion specifiers with -// positional arguments. -static int format_buffer(char *str, size_t size, const char *fmt, - dfsan_label *va_labels, dfsan_label *ret_label, - dfsan_origin *va_origins, dfsan_origin *ret_origin, - va_list ap) { - Formatter formatter(str, fmt, size); - - while (*formatter.fmt_cur) { - formatter.fmt_start = formatter.fmt_cur; - formatter.width = -1; - int retval = 0; - - if (*formatter.fmt_cur != '%') { - // Ordinary character. Consume all the characters until a '%' or the end - // of the string. - for (; *(formatter.fmt_cur + 1) && *(formatter.fmt_cur + 1) != '%'; - ++formatter.fmt_cur) {} - retval = formatter.format(); - dfsan_set_label(0, formatter.str_cur(), - formatter.num_written_bytes(retval)); - } else { - // Conversion directive. Consume all the characters until a conversion - // specifier or the end of the string. - bool end_fmt = false; - for (; *formatter.fmt_cur && !end_fmt; ) { - switch (*++formatter.fmt_cur) { - case 'd': - case 'i': - case 'o': - case 'u': - case 'x': - case 'X': - switch (*(formatter.fmt_cur - 1)) { - case 'h': - // Also covers the 'hh' case (since the size of the arg is still - // an int). - retval = formatter.format(va_arg(ap, int)); - break; - case 'l': - if (formatter.fmt_cur - formatter.fmt_start >= 2 && - *(formatter.fmt_cur - 2) == 'l') { - retval = formatter.format(va_arg(ap, long long int)); - } else { - retval = formatter.format(va_arg(ap, long int)); - } - break; - case 'q': - retval = formatter.format(va_arg(ap, long long int)); - break; - case 'j': - retval = formatter.format(va_arg(ap, intmax_t)); - break; - case 'z': - case 't': - retval = formatter.format(va_arg(ap, size_t)); - break; - default: - retval = formatter.format(va_arg(ap, int)); - } - if (va_origins == nullptr) - dfsan_set_label(*va_labels++, formatter.str_cur(), - formatter.num_written_bytes(retval)); - else - dfsan_set_label_origin(*va_labels++, *va_origins++, - formatter.str_cur(), - formatter.num_written_bytes(retval)); - end_fmt = true; - break; - - case 'a': - case 'A': - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - if (*(formatter.fmt_cur - 1) == 'L') { - retval = formatter.format(va_arg(ap, long double)); - } else { - retval = formatter.format(va_arg(ap, double)); - } - if (va_origins == nullptr) - dfsan_set_label(*va_labels++, formatter.str_cur(), - formatter.num_written_bytes(retval)); - else - dfsan_set_label_origin(*va_labels++, *va_origins++, - formatter.str_cur(), - formatter.num_written_bytes(retval)); - end_fmt = true; - break; - - case 'c': - retval = formatter.format(va_arg(ap, int)); - if (va_origins == nullptr) - dfsan_set_label(*va_labels++, formatter.str_cur(), - formatter.num_written_bytes(retval)); - else - dfsan_set_label_origin(*va_labels++, *va_origins++, - formatter.str_cur(), - formatter.num_written_bytes(retval)); - end_fmt = true; - break; - - case 's': { - char *arg = va_arg(ap, char *); - retval = formatter.format(arg); - if (va_origins) { - va_origins++; - dfsan_mem_origin_transfer(formatter.str_cur(), arg, - formatter.num_written_bytes(retval)); - } - va_labels++; - dfsan_mem_shadow_transfer(formatter.str_cur(), arg, - formatter.num_written_bytes(retval)); - end_fmt = true; - break; - } - - case 'p': - retval = formatter.format(va_arg(ap, void *)); - if (va_origins == nullptr) - dfsan_set_label(*va_labels++, formatter.str_cur(), - formatter.num_written_bytes(retval)); - else - dfsan_set_label_origin(*va_labels++, *va_origins++, - formatter.str_cur(), - formatter.num_written_bytes(retval)); - end_fmt = true; - break; - - case 'n': { - int *ptr = va_arg(ap, int *); - *ptr = (int)formatter.str_off; - va_labels++; - if (va_origins) - va_origins++; - dfsan_set_label(0, ptr, sizeof(ptr)); - end_fmt = true; - break; - } - - case '%': - retval = formatter.format(); - dfsan_set_label(0, formatter.str_cur(), - formatter.num_written_bytes(retval)); - end_fmt = true; - break; - - case '*': - formatter.width = va_arg(ap, int); - va_labels++; - if (va_origins) - va_origins++; - break; - - default: - break; - } - } - } - - if (retval < 0) { - return retval; - } - - formatter.fmt_cur++; - formatter.str_off += retval; - } - - *ret_label = 0; - if (ret_origin) - *ret_origin = 0; - - // Number of bytes written in total. - return formatter.str_off; -} - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_sprintf(char *str, const char *format, dfsan_label str_label, - dfsan_label format_label, dfsan_label *va_labels, - dfsan_label *ret_label, ...) { - va_list ap; - va_start(ap, ret_label); - int ret = format_buffer(str, ~0ul, format, va_labels, ret_label, nullptr, - nullptr, ap); - va_end(ap); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_sprintf(char *str, const char *format, dfsan_label str_label, - dfsan_label format_label, dfsan_label *va_labels, - dfsan_label *ret_label, dfsan_origin str_origin, - dfsan_origin format_origin, dfsan_origin *va_origins, - dfsan_origin *ret_origin, ...) { - va_list ap; - va_start(ap, ret_origin); - int ret = format_buffer(str, ~0ul, format, va_labels, ret_label, va_origins, - ret_origin, ap); - va_end(ap); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfsw_snprintf(char *str, size_t size, const char *format, - dfsan_label str_label, dfsan_label size_label, - dfsan_label format_label, dfsan_label *va_labels, - dfsan_label *ret_label, ...) { - va_list ap; - va_start(ap, ret_label); - int ret = format_buffer(str, size, format, va_labels, ret_label, nullptr, - nullptr, ap); - va_end(ap); - return ret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __dfso_snprintf(char *str, size_t size, const char *format, - dfsan_label str_label, dfsan_label size_label, - dfsan_label format_label, dfsan_label *va_labels, - dfsan_label *ret_label, dfsan_origin str_origin, - dfsan_origin size_origin, dfsan_origin format_origin, - dfsan_origin *va_origins, dfsan_origin *ret_origin, ...) { - va_list ap; - va_start(ap, ret_origin); - int ret = format_buffer(str, size, format, va_labels, ret_label, va_origins, - ret_origin, ap); - va_end(ap); - return ret; -} - -static void BeforeFork() { - StackDepotLockAll(); - GetChainedOriginDepot()->LockAll(); -} - -static void AfterFork() { - GetChainedOriginDepot()->UnlockAll(); - StackDepotUnlockAll(); -} - -SANITIZER_INTERFACE_ATTRIBUTE -pid_t __dfsw_fork(dfsan_label *ret_label) { - pid_t pid = fork(); - *ret_label = 0; - return pid; -} - -SANITIZER_INTERFACE_ATTRIBUTE -pid_t __dfso_fork(dfsan_label *ret_label, dfsan_origin *ret_origin) { - BeforeFork(); - pid_t pid = __dfsw_fork(ret_label); - AfterFork(); - return pid; -} - -// Default empty implementations (weak). Users should redefine them. -SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_pc_guard, u32 *) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_pc_guard_init, u32 *, - u32 *) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_pcs_init, const uptr *beg, - const uptr *end) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_pc_indir, void) {} - -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_cmp, void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_cmp1, void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_cmp2, void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_cmp4, void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_cmp8, void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_const_cmp1, - void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_const_cmp2, - void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_const_cmp4, - void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_const_cmp8, - void) {} -SANITIZER_INTERFACE_WEAK_DEF(void, __dfsw___sanitizer_cov_trace_switch, void) {} -} // extern "C" diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_flags.h b/contrib/libs/clang14-rt/lib/dfsan/dfsan_flags.h deleted file mode 100644 index ec7edf6112a9..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_flags.h +++ /dev/null @@ -1,32 +0,0 @@ -//===-- dfsan_flags.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// DFSan flags. -//===----------------------------------------------------------------------===// - -#ifndef DFSAN_FLAGS_H -#define DFSAN_FLAGS_H - -namespace __dfsan { - -struct Flags { -#define DFSAN_FLAG(Type, Name, DefaultValue, Description) Type Name; -#include "dfsan_flags.inc" -#undef DFSAN_FLAG - - void SetDefaults(); -}; - -extern Flags flags_data; -inline Flags &flags() { return flags_data; } - -} // namespace __dfsan - -#endif // DFSAN_FLAGS_H diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_flags.inc b/contrib/libs/clang14-rt/lib/dfsan/dfsan_flags.inc deleted file mode 100644 index 67fda0eee490..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_flags.inc +++ /dev/null @@ -1,43 +0,0 @@ -//===-- dfsan_flags.inc -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// DFSan runtime flags. -// -//===----------------------------------------------------------------------===// -#ifndef DFSAN_FLAG -# error "Define DFSAN_FLAG prior to including this file!" -#endif - -// DFSAN_FLAG(Type, Name, DefaultValue, Description) -// See COMMON_FLAG in sanitizer_flags.inc for more details. - -DFSAN_FLAG(bool, warn_unimplemented, false, - "Whether to warn on unimplemented functions.") -DFSAN_FLAG(bool, warn_nonzero_labels, false, - "Whether to warn on unimplemented functions.") -DFSAN_FLAG( - bool, strict_data_dependencies, true, - "Whether to propagate labels only when there is an obvious data dependency" - "(e.g., when comparing strings, ignore the fact that the output of the" - "comparison might be data-dependent on the content of the strings). This" - "applies only to the custom functions defined in 'custom.c'.") -DFSAN_FLAG( - int, origin_history_size, Origin::kMaxDepth, - "The limit of origin chain length. Non-positive values mean unlimited.") -DFSAN_FLAG( - int, origin_history_per_stack_limit, 20000, - "The limit of origin node's references count. " - "Non-positive values mean unlimited.") -DFSAN_FLAG(int, store_context_size, 20, - "The depth limit of origin tracking stack traces.") -DFSAN_FLAG(bool, check_origin_invariant, false, - "Whether to check if the origin invariant holds.") -DFSAN_FLAG(bool, zero_in_malloc, true, - "Whether to zero shadow space of new allocated memory.") -DFSAN_FLAG(bool, zero_in_free, true, - "Whether to zero shadow space of deallocated memory.") diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_interceptors.cpp b/contrib/libs/clang14-rt/lib/dfsan/dfsan_interceptors.cpp deleted file mode 100644 index d8fb9ea86618..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_interceptors.cpp +++ /dev/null @@ -1,220 +0,0 @@ -//===-- dfsan_interceptors.cpp --------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// Interceptors for standard library functions. -//===----------------------------------------------------------------------===// - -#include -#include - -#include "dfsan/dfsan.h" -#include "dfsan/dfsan_thread.h" -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_allocator_dlsym.h" -#include "sanitizer_common/sanitizer_allocator_interface.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_errno.h" -#include "sanitizer_common/sanitizer_platform_limits_posix.h" -#include "sanitizer_common/sanitizer_posix.h" -#include "sanitizer_common/sanitizer_tls_get_addr.h" - -using namespace __sanitizer; - -static bool interceptors_initialized; - -struct DlsymAlloc : public DlSymAllocator { - static bool UseImpl() { return !__dfsan::dfsan_inited; } -}; - -INTERCEPTOR(void *, reallocarray, void *ptr, SIZE_T nmemb, SIZE_T size) { - return __dfsan::dfsan_reallocarray(ptr, nmemb, size); -} - -INTERCEPTOR(void *, __libc_memalign, SIZE_T alignment, SIZE_T size) { - void *ptr = __dfsan::dfsan_memalign(alignment, size); - if (ptr) - DTLS_on_libc_memalign(ptr, size); - return ptr; -} - -INTERCEPTOR(void *, aligned_alloc, SIZE_T alignment, SIZE_T size) { - return __dfsan::dfsan_aligned_alloc(alignment, size); -} - -INTERCEPTOR(void *, calloc, SIZE_T nmemb, SIZE_T size) { - if (DlsymAlloc::Use()) - return DlsymAlloc::Callocate(nmemb, size); - return __dfsan::dfsan_calloc(nmemb, size); -} - -INTERCEPTOR(void *, realloc, void *ptr, SIZE_T size) { - if (DlsymAlloc::Use() || DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Realloc(ptr, size); - return __dfsan::dfsan_realloc(ptr, size); -} - -INTERCEPTOR(void *, malloc, SIZE_T size) { - if (DlsymAlloc::Use()) - return DlsymAlloc::Allocate(size); - return __dfsan::dfsan_malloc(size); -} - -INTERCEPTOR(void, free, void *ptr) { - if (!ptr) - return; - if (DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Free(ptr); - return __dfsan::dfsan_deallocate(ptr); -} - -INTERCEPTOR(void, cfree, void *ptr) { - if (!ptr) - return; - if (DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Free(ptr); - return __dfsan::dfsan_deallocate(ptr); -} - -INTERCEPTOR(int, posix_memalign, void **memptr, SIZE_T alignment, SIZE_T size) { - CHECK_NE(memptr, 0); - int res = __dfsan::dfsan_posix_memalign(memptr, alignment, size); - if (!res) - dfsan_set_label(0, memptr, sizeof(*memptr)); - return res; -} - -INTERCEPTOR(void *, memalign, SIZE_T alignment, SIZE_T size) { - return __dfsan::dfsan_memalign(alignment, size); -} - -INTERCEPTOR(void *, valloc, SIZE_T size) { return __dfsan::dfsan_valloc(size); } - -INTERCEPTOR(void *, pvalloc, SIZE_T size) { - return __dfsan::dfsan_pvalloc(size); -} - -INTERCEPTOR(void, mallinfo, __sanitizer_struct_mallinfo *sret) { - internal_memset(sret, 0, sizeof(*sret)); - dfsan_set_label(0, sret, sizeof(*sret)); -} - -INTERCEPTOR(int, mallopt, int cmd, int value) { return 0; } - -INTERCEPTOR(void, malloc_stats, void) { - // FIXME: implement, but don't call REAL(malloc_stats)! -} - -INTERCEPTOR(uptr, malloc_usable_size, void *ptr) { - return __sanitizer_get_allocated_size(ptr); -} - -#define ENSURE_DFSAN_INITED() \ - do { \ - CHECK(!__dfsan::dfsan_init_is_running); \ - if (!__dfsan::dfsan_inited) { \ - __dfsan::dfsan_init(); \ - } \ - } while (0) - -#define COMMON_INTERCEPTOR_ENTER(func, ...) \ - if (__dfsan::dfsan_init_is_running) \ - return REAL(func)(__VA_ARGS__); \ - ENSURE_DFSAN_INITED(); \ - dfsan_set_label(0, __errno_location(), sizeof(int)); - -INTERCEPTOR(void *, mmap, void *addr, SIZE_T length, int prot, int flags, - int fd, OFF_T offset) { - if (common_flags()->detect_write_exec) - ReportMmapWriteExec(prot, flags); - if (!__dfsan::dfsan_inited) - return (void *)internal_mmap(addr, length, prot, flags, fd, offset); - COMMON_INTERCEPTOR_ENTER(mmap, addr, length, prot, flags, fd, offset); - void *res = REAL(mmap)(addr, length, prot, flags, fd, offset); - if (res != (void *)-1) { - dfsan_set_label(0, res, RoundUpTo(length, GetPageSizeCached())); - } - return res; -} - -INTERCEPTOR(void *, mmap64, void *addr, SIZE_T length, int prot, int flags, - int fd, OFF64_T offset) { - if (common_flags()->detect_write_exec) - ReportMmapWriteExec(prot, flags); - if (!__dfsan::dfsan_inited) - return (void *)internal_mmap(addr, length, prot, flags, fd, offset); - COMMON_INTERCEPTOR_ENTER(mmap64, addr, length, prot, flags, fd, offset); - void *res = REAL(mmap64)(addr, length, prot, flags, fd, offset); - if (res != (void *)-1) { - dfsan_set_label(0, res, RoundUpTo(length, GetPageSizeCached())); - } - return res; -} - -INTERCEPTOR(int, munmap, void *addr, SIZE_T length) { - if (!__dfsan::dfsan_inited) - return internal_munmap(addr, length); - COMMON_INTERCEPTOR_ENTER(munmap, addr, length); - int res = REAL(munmap)(addr, length); - if (res != -1) - dfsan_set_label(0, addr, RoundUpTo(length, GetPageSizeCached())); - return res; -} - -#define COMMON_INTERCEPTOR_GET_TLS_RANGE(begin, end) \ - if (__dfsan::DFsanThread *t = __dfsan::GetCurrentThread()) { \ - *begin = t->tls_begin(); \ - *end = t->tls_end(); \ - } else { \ - *begin = *end = 0; \ - } -#define COMMON_INTERCEPTOR_INITIALIZE_RANGE(ptr, size) \ - dfsan_set_label(0, ptr, size) - -INTERCEPTOR(void *, __tls_get_addr, void *arg) { - COMMON_INTERCEPTOR_ENTER(__tls_get_addr, arg); - void *res = REAL(__tls_get_addr)(arg); - uptr tls_begin, tls_end; - COMMON_INTERCEPTOR_GET_TLS_RANGE(&tls_begin, &tls_end); - DTLS::DTV *dtv = DTLS_on_tls_get_addr(arg, res, tls_begin, tls_end); - if (dtv) { - // New DTLS block has been allocated. - COMMON_INTERCEPTOR_INITIALIZE_RANGE((void *)dtv->beg, dtv->size); - } - return res; -} - -namespace __dfsan { -void initialize_interceptors() { - CHECK(!interceptors_initialized); - - INTERCEPT_FUNCTION(aligned_alloc); - INTERCEPT_FUNCTION(calloc); - INTERCEPT_FUNCTION(cfree); - INTERCEPT_FUNCTION(free); - INTERCEPT_FUNCTION(mallinfo); - INTERCEPT_FUNCTION(malloc); - INTERCEPT_FUNCTION(malloc_stats); - INTERCEPT_FUNCTION(malloc_usable_size); - INTERCEPT_FUNCTION(mallopt); - INTERCEPT_FUNCTION(memalign); - INTERCEPT_FUNCTION(mmap); - INTERCEPT_FUNCTION(mmap64); - INTERCEPT_FUNCTION(munmap); - INTERCEPT_FUNCTION(posix_memalign); - INTERCEPT_FUNCTION(pvalloc); - INTERCEPT_FUNCTION(realloc); - INTERCEPT_FUNCTION(reallocarray); - INTERCEPT_FUNCTION(valloc); - INTERCEPT_FUNCTION(__tls_get_addr); - INTERCEPT_FUNCTION(__libc_memalign); - - interceptors_initialized = true; -} -} // namespace __dfsan diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_new_delete.cpp b/contrib/libs/clang14-rt/lib/dfsan/dfsan_new_delete.cpp deleted file mode 100644 index 7ac906e81077..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_new_delete.cpp +++ /dev/null @@ -1,124 +0,0 @@ -//===-- dfsan_new_delete.cpp ----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataflowSanitizer. -// -// Interceptors for operators new and delete. -//===----------------------------------------------------------------------===// - -#include - -#include "dfsan.h" -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_allocator.h" -#include "sanitizer_common/sanitizer_allocator_report.h" - -using namespace __dfsan; - -// Fake std::nothrow_t and std::align_val_t to avoid including . -namespace std { -struct nothrow_t {}; -enum class align_val_t : size_t {}; -} // namespace std - -// TODO(alekseys): throw std::bad_alloc instead of dying on OOM. -#define OPERATOR_NEW_BODY(nothrow) \ - void *res = dfsan_malloc(size); \ - if (!nothrow && UNLIKELY(!res)) { \ - BufferedStackTrace stack; \ - ReportOutOfMemory(size, &stack); \ - } \ - return res -#define OPERATOR_NEW_BODY_ALIGN(nothrow) \ - void *res = dfsan_memalign((uptr)align, size); \ - if (!nothrow && UNLIKELY(!res)) { \ - BufferedStackTrace stack; \ - ReportOutOfMemory(size, &stack); \ - } \ - return res; - -INTERCEPTOR_ATTRIBUTE -void *operator new(size_t size) { OPERATOR_NEW_BODY(false /*nothrow*/); } -INTERCEPTOR_ATTRIBUTE -void *operator new[](size_t size) { OPERATOR_NEW_BODY(false /*nothrow*/); } -INTERCEPTOR_ATTRIBUTE -void *operator new(size_t size, std::nothrow_t const &) { - OPERATOR_NEW_BODY(true /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE -void *operator new[](size_t size, std::nothrow_t const &) { - OPERATOR_NEW_BODY(true /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE -void *operator new(size_t size, std::align_val_t align) { - OPERATOR_NEW_BODY_ALIGN(false /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE -void *operator new[](size_t size, std::align_val_t align) { - OPERATOR_NEW_BODY_ALIGN(false /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE -void *operator new(size_t size, std::align_val_t align, - std::nothrow_t const &) { - OPERATOR_NEW_BODY_ALIGN(true /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE -void *operator new[](size_t size, std::align_val_t align, - std::nothrow_t const &) { - OPERATOR_NEW_BODY_ALIGN(true /*nothrow*/); -} - -#define OPERATOR_DELETE_BODY \ - if (ptr) \ - dfsan_deallocate(ptr) - -INTERCEPTOR_ATTRIBUTE -void operator delete(void *ptr)NOEXCEPT { OPERATOR_DELETE_BODY; } -INTERCEPTOR_ATTRIBUTE -void operator delete[](void *ptr) NOEXCEPT { OPERATOR_DELETE_BODY; } -INTERCEPTOR_ATTRIBUTE -void operator delete(void *ptr, std::nothrow_t const &) { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE -void operator delete[](void *ptr, std::nothrow_t const &) { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE -void operator delete(void *ptr, size_t size)NOEXCEPT { OPERATOR_DELETE_BODY; } -INTERCEPTOR_ATTRIBUTE -void operator delete[](void *ptr, size_t size) NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE -void operator delete(void *ptr, std::align_val_t align)NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE -void operator delete[](void *ptr, std::align_val_t align) NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE -void operator delete(void *ptr, std::align_val_t align, - std::nothrow_t const &) { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE -void operator delete[](void *ptr, std::align_val_t align, - std::nothrow_t const &) { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE -void operator delete(void *ptr, size_t size, std::align_val_t align)NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE -void operator delete[](void *ptr, size_t size, - std::align_val_t align) NOEXCEPT { - OPERATOR_DELETE_BODY; -} diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_origin.h b/contrib/libs/clang14-rt/lib/dfsan/dfsan_origin.h deleted file mode 100644 index 89fd7f99599f..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_origin.h +++ /dev/null @@ -1,127 +0,0 @@ -//===-- dfsan_origin.h ----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// Origin id utils. -//===----------------------------------------------------------------------===// - -#ifndef DFSAN_ORIGIN_H -#define DFSAN_ORIGIN_H - -#include "dfsan_chained_origin_depot.h" -#include "dfsan_flags.h" -#include "sanitizer_common/sanitizer_stackdepot.h" - -namespace __dfsan { - -// Origin handling. -// -// Origin is a 32-bit identifier that is attached to any taint value in the -// program and describes how this memory came to be tainted. -// -// Chained origin id is like: -// zzzz xxxx xxxx xxxx -// -// Chained origin id describes an event of storing a taint value to -// memory. The xxx part is a value of ChainedOriginDepot, which is a mapping of -// (stack_id, prev_id) -> id, where -// * stack_id describes the event. -// StackDepot keeps a mapping between those and corresponding stack traces. -// * prev_id is another origin id that describes the earlier part of the -// taint value history. 0 prev_id indicates the start of a chain. -// Following a chain of prev_id provides the full recorded history of a taint -// value. -// -// This, effectively, defines a forest where nodes are points in value history -// marked with origin ids, and edges are events that are marked with stack_id. -// -// The "zzzz" bits of chained origin id are used to store the length of the -// origin chain. - -class Origin { - public: - static bool isValidId(u32 id) { return id != 0; } - - u32 raw_id() const { return raw_id_; } - - bool isChainedOrigin() const { return Origin::isValidId(raw_id_); } - - u32 getChainedId() const { - CHECK(Origin::isValidId(raw_id_)); - return raw_id_ & kChainedIdMask; - } - - // Returns the next origin in the chain and the current stack trace. - // - // It scans a partition of StackDepot linearly, and is used only by origin - // tracking report. - Origin getNextChainedOrigin(StackTrace *stack) const { - CHECK(Origin::isValidId(raw_id_)); - u32 prev_id; - u32 stack_id = GetChainedOriginDepot()->Get(getChainedId(), &prev_id); - if (stack) - *stack = StackDepotGet(stack_id); - return Origin(prev_id); - } - - static Origin CreateChainedOrigin(Origin prev, StackTrace *stack) { - int depth = prev.isChainedOrigin() ? prev.depth() : -1; - // depth is the length of the chain minus 1. - // origin_history_size of 0 means unlimited depth. - if (flags().origin_history_size > 0) { - ++depth; - if (depth >= flags().origin_history_size || depth > kMaxDepth) - return prev; - } - - StackDepotHandle h = StackDepotPut_WithHandle(*stack); - if (!h.valid()) - return prev; - - if (flags().origin_history_per_stack_limit > 0) { - int use_count = h.use_count(); - if (use_count > flags().origin_history_per_stack_limit) - return prev; - } - - u32 chained_id; - bool inserted = - GetChainedOriginDepot()->Put(h.id(), prev.raw_id(), &chained_id); - CHECK((chained_id & kChainedIdMask) == chained_id); - - if (inserted && flags().origin_history_per_stack_limit > 0) - h.inc_use_count_unsafe(); - - return Origin((depth << kDepthShift) | chained_id); - } - - static Origin FromRawId(u32 id) { return Origin(id); } - - private: - static const int kDepthBits = 4; - static const int kDepthShift = 32 - kDepthBits; - - static const u32 kChainedIdMask = ((u32)-1) >> kDepthBits; - - u32 raw_id_; - - explicit Origin(u32 raw_id) : raw_id_(raw_id) {} - - int depth() const { - CHECK(isChainedOrigin()); - return (raw_id_ >> kDepthShift) & ((1 << kDepthBits) - 1); - } - - public: - static const int kMaxDepth = (1 << kDepthBits) - 1; -}; - -} // namespace __dfsan - -#endif // DFSAN_ORIGIN_H diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_platform.h b/contrib/libs/clang14-rt/lib/dfsan/dfsan_platform.h deleted file mode 100644 index 9b4333ee99d0..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_platform.h +++ /dev/null @@ -1,88 +0,0 @@ -//===-- dfsan_platform.h ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -// Platform specific information for DFSan. -//===----------------------------------------------------------------------===// - -#ifndef DFSAN_PLATFORM_H -#define DFSAN_PLATFORM_H - -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_platform.h" - -namespace __dfsan { - -using __sanitizer::uptr; - -// TODO: The memory mapping code to setup a 1:1 shadow is based on msan. -// Consider refactoring these into a shared implementation. - -struct MappingDesc { - uptr start; - uptr end; - enum Type { INVALID, APP, SHADOW, ORIGIN } type; - const char *name; -}; - -#if SANITIZER_LINUX && SANITIZER_WORDSIZE == 64 - -// All of the following configurations are supported. -// ASLR disabled: main executable and DSOs at 0x555550000000 -// PIE and ASLR: main executable and DSOs at 0x7f0000000000 -// non-PIE: main executable below 0x100000000, DSOs at 0x7f0000000000 -// Heap at 0x700000000000. -const MappingDesc kMemoryLayout[] = { - {0x000000000000ULL, 0x010000000000ULL, MappingDesc::APP, "app-1"}, - {0x010000000000ULL, 0x100000000000ULL, MappingDesc::SHADOW, "shadow-2"}, - {0x100000000000ULL, 0x110000000000ULL, MappingDesc::INVALID, "invalid"}, - {0x110000000000ULL, 0x200000000000ULL, MappingDesc::ORIGIN, "origin-2"}, - {0x200000000000ULL, 0x300000000000ULL, MappingDesc::SHADOW, "shadow-3"}, - {0x300000000000ULL, 0x400000000000ULL, MappingDesc::ORIGIN, "origin-3"}, - {0x400000000000ULL, 0x500000000000ULL, MappingDesc::INVALID, "invalid"}, - {0x500000000000ULL, 0x510000000000ULL, MappingDesc::SHADOW, "shadow-1"}, - {0x510000000000ULL, 0x600000000000ULL, MappingDesc::APP, "app-2"}, - {0x600000000000ULL, 0x610000000000ULL, MappingDesc::ORIGIN, "origin-1"}, - {0x610000000000ULL, 0x700000000000ULL, MappingDesc::INVALID, "invalid"}, - {0x700000000000ULL, 0x800000000000ULL, MappingDesc::APP, "app-3"}}; -# define MEM_TO_SHADOW(mem) (((uptr)(mem)) ^ 0x500000000000ULL) -# define SHADOW_TO_ORIGIN(mem) (((uptr)(mem)) + 0x100000000000ULL) - -#else -# error "Unsupported platform" -#endif - -const uptr kMemoryLayoutSize = sizeof(kMemoryLayout) / sizeof(kMemoryLayout[0]); - -#define MEM_TO_ORIGIN(mem) (SHADOW_TO_ORIGIN(MEM_TO_SHADOW((mem)))) - -#ifndef __clang__ -__attribute__((optimize("unroll-loops"))) -#endif -inline bool -addr_is_type(uptr addr, MappingDesc::Type mapping_type) { -// It is critical for performance that this loop is unrolled (because then it is -// simplified into just a few constant comparisons). -#ifdef __clang__ -# pragma unroll -#endif - for (unsigned i = 0; i < kMemoryLayoutSize; ++i) - if (kMemoryLayout[i].type == mapping_type && - addr >= kMemoryLayout[i].start && addr < kMemoryLayout[i].end) - return true; - return false; -} - -#define MEM_IS_APP(mem) addr_is_type((uptr)(mem), MappingDesc::APP) -#define MEM_IS_SHADOW(mem) addr_is_type((uptr)(mem), MappingDesc::SHADOW) -#define MEM_IS_ORIGIN(mem) addr_is_type((uptr)(mem), MappingDesc::ORIGIN) - -} // namespace __dfsan - -#endif diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_thread.cpp b/contrib/libs/clang14-rt/lib/dfsan/dfsan_thread.cpp deleted file mode 100644 index df7e4d9b7421..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_thread.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "dfsan_thread.h" - -#include - -#include "dfsan.h" -#include "sanitizer_common/sanitizer_tls_get_addr.h" - -namespace __dfsan { - -DFsanThread *DFsanThread::Create(void *start_routine_trampoline, - thread_callback_t start_routine, void *arg, - bool track_origins) { - uptr PageSize = GetPageSizeCached(); - uptr size = RoundUpTo(sizeof(DFsanThread), PageSize); - DFsanThread *thread = (DFsanThread *)MmapOrDie(size, __func__); - thread->start_routine_trampoline_ = start_routine_trampoline; - thread->start_routine_ = start_routine; - thread->arg_ = arg; - thread->track_origins_ = track_origins; - thread->destructor_iterations_ = GetPthreadDestructorIterations(); - - return thread; -} - -void DFsanThread::SetThreadStackAndTls() { - uptr tls_size = 0; - uptr stack_size = 0; - GetThreadStackAndTls(IsMainThread(), &stack_.bottom, &stack_size, &tls_begin_, - &tls_size); - stack_.top = stack_.bottom + stack_size; - tls_end_ = tls_begin_ + tls_size; - - int local; - CHECK(AddrIsInStack((uptr)&local)); -} - -void DFsanThread::ClearShadowForThreadStackAndTLS() { - dfsan_set_label(0, (void *)stack_.bottom, stack_.top - stack_.bottom); - if (tls_begin_ != tls_end_) - dfsan_set_label(0, (void *)tls_begin_, tls_end_ - tls_begin_); - DTLS *dtls = DTLS_Get(); - CHECK_NE(dtls, 0); - ForEachDVT(dtls, [](const DTLS::DTV &dtv, int id) { - dfsan_set_label(0, (void *)(dtv.beg), dtv.size); - }); -} - -void DFsanThread::Init() { - SetThreadStackAndTls(); - ClearShadowForThreadStackAndTLS(); -} - -void DFsanThread::TSDDtor(void *tsd) { - DFsanThread *t = (DFsanThread *)tsd; - t->Destroy(); -} - -void DFsanThread::Destroy() { - malloc_storage().CommitBack(); - // We also clear the shadow on thread destruction because - // some code may still be executing in later TSD destructors - // and we don't want it to have any poisoned stack. - ClearShadowForThreadStackAndTLS(); - uptr size = RoundUpTo(sizeof(DFsanThread), GetPageSizeCached()); - UnmapOrDie(this, size); - DTLS_Destroy(); -} - -thread_return_t DFsanThread::ThreadStart() { - if (!start_routine_) { - // start_routine_ == 0 if we're on the main thread or on one of the - // OS X libdispatch worker threads. But nobody is supposed to call - // ThreadStart() for the worker threads. - return 0; - } - - CHECK(start_routine_trampoline_); - - typedef void *(*thread_callback_trampoline_t)(void *, void *, dfsan_label, - dfsan_label *); - typedef void *(*thread_callback_origin_trampoline_t)( - void *, void *, dfsan_label, dfsan_label *, dfsan_origin, dfsan_origin *); - - dfsan_label ret_label; - if (!track_origins_) - return ((thread_callback_trampoline_t) - start_routine_trampoline_)((void *)start_routine_, arg_, 0, - &ret_label); - - dfsan_origin ret_origin; - return ((thread_callback_origin_trampoline_t) - start_routine_trampoline_)((void *)start_routine_, arg_, 0, - &ret_label, 0, &ret_origin); -} - -DFsanThread::StackBounds DFsanThread::GetStackBounds() const { - return {stack_.bottom, stack_.top}; -} - -uptr DFsanThread::stack_top() { return GetStackBounds().top; } - -uptr DFsanThread::stack_bottom() { return GetStackBounds().bottom; } - -bool DFsanThread::AddrIsInStack(uptr addr) { - const auto bounds = GetStackBounds(); - return addr >= bounds.bottom && addr < bounds.top; -} - -static pthread_key_t tsd_key; -static bool tsd_key_inited = false; - -void DFsanTSDInit(void (*destructor)(void *tsd)) { - CHECK(!tsd_key_inited); - tsd_key_inited = true; - CHECK_EQ(0, pthread_key_create(&tsd_key, destructor)); -} - -static THREADLOCAL DFsanThread *dfsan_current_thread; - -DFsanThread *GetCurrentThread() { return dfsan_current_thread; } - -void SetCurrentThread(DFsanThread *t) { - // Make sure we do not reset the current DFsanThread. - CHECK_EQ(0, dfsan_current_thread); - dfsan_current_thread = t; - // Make sure that DFsanTSDDtor gets called at the end. - CHECK(tsd_key_inited); - pthread_setspecific(tsd_key, t); -} - -void DFsanTSDDtor(void *tsd) { - DFsanThread *t = (DFsanThread *)tsd; - if (t->destructor_iterations_ > 1) { - t->destructor_iterations_--; - CHECK_EQ(0, pthread_setspecific(tsd_key, tsd)); - return; - } - dfsan_current_thread = nullptr; - // Make sure that signal handler can not see a stale current thread pointer. - atomic_signal_fence(memory_order_seq_cst); - DFsanThread::TSDDtor(tsd); -} - -} // namespace __dfsan diff --git a/contrib/libs/clang14-rt/lib/dfsan/dfsan_thread.h b/contrib/libs/clang14-rt/lib/dfsan/dfsan_thread.h deleted file mode 100644 index 1c33a1854997..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/dfsan_thread.h +++ /dev/null @@ -1,84 +0,0 @@ -//===-- dfsan_thread.h ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of DataFlowSanitizer. -// -//===----------------------------------------------------------------------===// - -#ifndef DFSAN_THREAD_H -#define DFSAN_THREAD_H - -#include "dfsan_allocator.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_posix.h" - -namespace __dfsan { - -class DFsanThread { - public: - // NOTE: There is no DFsanThread constructor. It is allocated - // via mmap() and *must* be valid in zero-initialized state. - - static DFsanThread *Create(void *start_routine_trampoline, - thread_callback_t start_routine, void *arg, - bool track_origins = false); - static void TSDDtor(void *tsd); - void Destroy(); - - void Init(); // Should be called from the thread itself. - thread_return_t ThreadStart(); - - uptr stack_top(); - uptr stack_bottom(); - uptr tls_begin() { return tls_begin_; } - uptr tls_end() { return tls_end_; } - bool IsMainThread() { return start_routine_ == nullptr; } - - bool InSignalHandler() { return in_signal_handler_; } - void EnterSignalHandler() { in_signal_handler_++; } - void LeaveSignalHandler() { in_signal_handler_--; } - - DFsanThreadLocalMallocStorage &malloc_storage() { return malloc_storage_; } - - int destructor_iterations_; - __sanitizer_sigset_t starting_sigset_; - - private: - void SetThreadStackAndTls(); - void ClearShadowForThreadStackAndTLS(); - struct StackBounds { - uptr bottom; - uptr top; - }; - StackBounds GetStackBounds() const; - - bool AddrIsInStack(uptr addr); - - void *start_routine_trampoline_; - thread_callback_t start_routine_; - void *arg_; - bool track_origins_; - - StackBounds stack_; - - uptr tls_begin_; - uptr tls_end_; - - unsigned in_signal_handler_; - - DFsanThreadLocalMallocStorage malloc_storage_; -}; - -DFsanThread *GetCurrentThread(); -void SetCurrentThread(DFsanThread *t); -void DFsanTSDInit(void (*destructor)(void *tsd)); -void DFsanTSDDtor(void *tsd); - -} // namespace __dfsan - -#endif // DFSAN_THREAD_H diff --git a/contrib/libs/clang14-rt/lib/dfsan/ya.make b/contrib/libs/clang14-rt/lib/dfsan/ya.make deleted file mode 100644 index eff6cc4a97f7..000000000000 --- a/contrib/libs/clang14-rt/lib/dfsan/ya.make +++ /dev/null @@ -1,125 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.dfsan${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DHAVE_RPC_XDR_H=0 - -fPIE - -fcommon - -ffreestanding - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - dfsan/dfsan.cpp - dfsan/dfsan_allocator.cpp - dfsan/dfsan_chained_origin_depot.cpp - dfsan/dfsan_custom.cpp - dfsan/dfsan_interceptors.cpp - dfsan/dfsan_new_delete.cpp - dfsan/dfsan_thread.cpp - interception/interception_linux.cpp - interception/interception_mac.cpp - interception/interception_type_test.cpp - interception/interception_win.cpp - sanitizer_common/sanitizer_allocator.cpp - sanitizer_common/sanitizer_allocator_checks.cpp - sanitizer_common/sanitizer_allocator_report.cpp - sanitizer_common/sanitizer_chained_origin_depot.cpp - sanitizer_common/sanitizer_common.cpp - sanitizer_common/sanitizer_common_libcdep.cpp - sanitizer_common/sanitizer_deadlock_detector1.cpp - sanitizer_common/sanitizer_deadlock_detector2.cpp - sanitizer_common/sanitizer_errno.cpp - sanitizer_common/sanitizer_file.cpp - sanitizer_common/sanitizer_flag_parser.cpp - sanitizer_common/sanitizer_flags.cpp - sanitizer_common/sanitizer_fuchsia.cpp - sanitizer_common/sanitizer_libc.cpp - sanitizer_common/sanitizer_libignore.cpp - sanitizer_common/sanitizer_linux.cpp - sanitizer_common/sanitizer_linux_libcdep.cpp - sanitizer_common/sanitizer_linux_s390.cpp - sanitizer_common/sanitizer_mac.cpp - sanitizer_common/sanitizer_mac_libcdep.cpp - sanitizer_common/sanitizer_mutex.cpp - sanitizer_common/sanitizer_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_freebsd.cpp - sanitizer_common/sanitizer_platform_limits_linux.cpp - sanitizer_common/sanitizer_platform_limits_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_posix.cpp - sanitizer_common/sanitizer_platform_limits_solaris.cpp - sanitizer_common/sanitizer_posix.cpp - sanitizer_common/sanitizer_posix_libcdep.cpp - sanitizer_common/sanitizer_printf.cpp - sanitizer_common/sanitizer_procmaps_bsd.cpp - sanitizer_common/sanitizer_procmaps_common.cpp - sanitizer_common/sanitizer_procmaps_fuchsia.cpp - sanitizer_common/sanitizer_procmaps_linux.cpp - sanitizer_common/sanitizer_procmaps_mac.cpp - sanitizer_common/sanitizer_procmaps_solaris.cpp - sanitizer_common/sanitizer_solaris.cpp - sanitizer_common/sanitizer_stack_store.cpp - sanitizer_common/sanitizer_stackdepot.cpp - sanitizer_common/sanitizer_stacktrace.cpp - sanitizer_common/sanitizer_stacktrace_libcdep.cpp - sanitizer_common/sanitizer_stacktrace_printer.cpp - sanitizer_common/sanitizer_stacktrace_sparc.cpp - sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp - sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_mac.cpp - sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_win.cpp - sanitizer_common/sanitizer_suppressions.cpp - sanitizer_common/sanitizer_symbolizer.cpp - sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp - sanitizer_common/sanitizer_symbolizer_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_mac.cpp - sanitizer_common/sanitizer_symbolizer_markup.cpp - sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_report.cpp - sanitizer_common/sanitizer_symbolizer_win.cpp - sanitizer_common/sanitizer_termination.cpp - sanitizer_common/sanitizer_thread_registry.cpp - sanitizer_common/sanitizer_tls_get_addr.cpp - sanitizer_common/sanitizer_type_traits.cpp - sanitizer_common/sanitizer_unwind_linux_libcdep.cpp - sanitizer_common/sanitizer_unwind_win.cpp - sanitizer_common/sanitizer_win.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/gwp_asan/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/common.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/common.cpp deleted file mode 100644 index b0f6c58bf496..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/common.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//===-- common.cpp ----------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/common.h" -#include "gwp_asan/stack_trace_compressor.h" - -#include - -using AllocationMetadata = gwp_asan::AllocationMetadata; -using Error = gwp_asan::Error; - -namespace gwp_asan { - -const char *ErrorToString(const Error &E) { - switch (E) { - case Error::UNKNOWN: - return "Unknown"; - case Error::USE_AFTER_FREE: - return "Use After Free"; - case Error::DOUBLE_FREE: - return "Double Free"; - case Error::INVALID_FREE: - return "Invalid (Wild) Free"; - case Error::BUFFER_OVERFLOW: - return "Buffer Overflow"; - case Error::BUFFER_UNDERFLOW: - return "Buffer Underflow"; - } - __builtin_trap(); -} - -constexpr size_t AllocationMetadata::kStackFrameStorageBytes; -constexpr size_t AllocationMetadata::kMaxTraceLengthToCollect; - -void AllocationMetadata::RecordAllocation(uintptr_t AllocAddr, - size_t AllocSize) { - Addr = AllocAddr; - RequestedSize = AllocSize; - IsDeallocated = false; - - AllocationTrace.ThreadID = getThreadID(); - DeallocationTrace.TraceSize = 0; - DeallocationTrace.ThreadID = kInvalidThreadID; -} - -void AllocationMetadata::RecordDeallocation() { - IsDeallocated = true; - DeallocationTrace.ThreadID = getThreadID(); -} - -void AllocationMetadata::CallSiteInfo::RecordBacktrace( - options::Backtrace_t Backtrace) { - TraceSize = 0; - if (!Backtrace) - return; - - uintptr_t UncompressedBuffer[kMaxTraceLengthToCollect]; - size_t BacktraceLength = - Backtrace(UncompressedBuffer, kMaxTraceLengthToCollect); - // Backtrace() returns the number of available frames, which may be greater - // than the number of frames in the buffer. In this case, we need to only pack - // the number of frames that are in the buffer. - if (BacktraceLength > kMaxTraceLengthToCollect) - BacktraceLength = kMaxTraceLengthToCollect; - TraceSize = - compression::pack(UncompressedBuffer, BacktraceLength, CompressedTrace, - AllocationMetadata::kStackFrameStorageBytes); -} - -size_t AllocatorState::maximumAllocationSize() const { return PageSize; } - -uintptr_t AllocatorState::slotToAddr(size_t N) const { - return GuardedPagePool + (PageSize * (1 + N)) + (maximumAllocationSize() * N); -} - -bool AllocatorState::isGuardPage(uintptr_t Ptr) const { - assert(pointerIsMine(reinterpret_cast(Ptr))); - size_t PageOffsetFromPoolStart = (Ptr - GuardedPagePool) / PageSize; - size_t PagesPerSlot = maximumAllocationSize() / PageSize; - return (PageOffsetFromPoolStart % (PagesPerSlot + 1)) == 0; -} - -static size_t addrToSlot(const AllocatorState *State, uintptr_t Ptr) { - size_t ByteOffsetFromPoolStart = Ptr - State->GuardedPagePool; - return ByteOffsetFromPoolStart / - (State->maximumAllocationSize() + State->PageSize); -} - -size_t AllocatorState::getNearestSlot(uintptr_t Ptr) const { - if (Ptr <= GuardedPagePool + PageSize) - return 0; - if (Ptr > GuardedPagePoolEnd - PageSize) - return MaxSimultaneousAllocations - 1; - - if (!isGuardPage(Ptr)) - return addrToSlot(this, Ptr); - - if (Ptr % PageSize <= PageSize / 2) - return addrToSlot(this, Ptr - PageSize); // Round down. - return addrToSlot(this, Ptr + PageSize); // Round up. -} - -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/common.h b/contrib/libs/clang14-rt/lib/gwp_asan/common.h deleted file mode 100644 index 6b238ad9ecbd..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/common.h +++ /dev/null @@ -1,182 +0,0 @@ -//===-- common.h ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// This file contains code that is common between the crash handler and the -// GuardedPoolAllocator. - -#ifndef GWP_ASAN_COMMON_H_ -#define GWP_ASAN_COMMON_H_ - -#include "gwp_asan/definitions.h" -#include "gwp_asan/options.h" - -#include -#include - -namespace gwp_asan { - -// Magic header that resides in the AllocatorState so that GWP-ASan bugreports -// can be understood by tools at different versions. Out-of-process crash -// handlers, like crashpad on Fuchsia, take the raw contents of the -// AllocationMetatada array and the AllocatorState, and shove them into the -// minidump. Online unpacking of these structs needs to know from which version -// of GWP-ASan it's extracting the information, as the structures are not -// stable. -struct AllocatorVersionMagic { - // The values are copied into the structure at runtime, during - // `GuardedPoolAllocator::init()` so that GWP-ASan remains completely in the - // `.bss` segment. - static constexpr uint8_t kAllocatorVersionMagic[4] = {'A', 'S', 'A', 'N'}; - uint8_t Magic[4] = {}; - // Update the version number when the AllocatorState or AllocationMetadata - // change. - static constexpr uint16_t kAllocatorVersion = 1; - uint16_t Version = 0; - uint16_t Reserved = 0; -}; - -enum class Error : uint8_t { - UNKNOWN, - USE_AFTER_FREE, - DOUBLE_FREE, - INVALID_FREE, - BUFFER_OVERFLOW, - BUFFER_UNDERFLOW -}; - -const char *ErrorToString(const Error &E); - -static constexpr uint64_t kInvalidThreadID = UINT64_MAX; -// Get the current thread ID, or kInvalidThreadID if failure. Note: This -// implementation is platform-specific. -uint64_t getThreadID(); - -// This struct contains all the metadata recorded about a single allocation made -// by GWP-ASan. If `AllocationMetadata.Addr` is zero, the metadata is non-valid. -struct AllocationMetadata { - // The number of bytes used to store a compressed stack frame. On 64-bit - // platforms, assuming a compression ratio of 50%, this should allow us to - // store ~64 frames per trace. - static constexpr size_t kStackFrameStorageBytes = 256; - - // Maximum number of stack frames to collect on allocation/deallocation. The - // actual number of collected frames may be less than this as the stack - // frames are compressed into a fixed memory range. - static constexpr size_t kMaxTraceLengthToCollect = 128; - - // Records the given allocation metadata into this struct. - void RecordAllocation(uintptr_t Addr, size_t RequestedSize); - // Record that this allocation is now deallocated. - void RecordDeallocation(); - - struct CallSiteInfo { - // Record the current backtrace to this callsite. - void RecordBacktrace(options::Backtrace_t Backtrace); - - // The compressed backtrace to the allocation/deallocation. - uint8_t CompressedTrace[kStackFrameStorageBytes]; - // The thread ID for this trace, or kInvalidThreadID if not available. - uint64_t ThreadID = kInvalidThreadID; - // The size of the compressed trace (in bytes). Zero indicates that no - // trace was collected. - size_t TraceSize = 0; - }; - - // The address of this allocation. If zero, the rest of this struct isn't - // valid, as the allocation has never occurred. - uintptr_t Addr = 0; - // Represents the actual size of the allocation. - size_t RequestedSize = 0; - - CallSiteInfo AllocationTrace; - CallSiteInfo DeallocationTrace; - - // Whether this allocation has been deallocated yet. - bool IsDeallocated = false; -}; - -// This holds the state that's shared between the GWP-ASan allocator and the -// crash handler. This, in conjunction with the Metadata array, forms the entire -// set of information required for understanding a GWP-ASan crash. -struct AllocatorState { - constexpr AllocatorState() {} - AllocatorVersionMagic VersionMagic{}; - - // Returns whether the provided pointer is a current sampled allocation that - // is owned by this pool. - GWP_ASAN_ALWAYS_INLINE bool pointerIsMine(const void *Ptr) const { - uintptr_t P = reinterpret_cast(Ptr); - return P < GuardedPagePoolEnd && GuardedPagePool <= P; - } - - // Returns the address of the N-th guarded slot. - uintptr_t slotToAddr(size_t N) const; - - // Returns the largest allocation that is supported by this pool. - size_t maximumAllocationSize() const; - - // Gets the nearest slot to the provided address. - size_t getNearestSlot(uintptr_t Ptr) const; - - // Returns whether the provided pointer is a guard page or not. The pointer - // must be within memory owned by this pool, else the result is undefined. - bool isGuardPage(uintptr_t Ptr) const; - - // The number of guarded slots that this pool holds. - size_t MaxSimultaneousAllocations = 0; - - // Pointer to the pool of guarded slots. Note that this points to the start of - // the pool (which is a guard page), not a pointer to the first guarded page. - uintptr_t GuardedPagePool = 0; - uintptr_t GuardedPagePoolEnd = 0; - - // Cached page size for this system in bytes. - size_t PageSize = 0; - - // The type and address of an internally-detected failure. For INVALID_FREE - // and DOUBLE_FREE, these errors are detected in GWP-ASan, which will set - // these values and terminate the process. - Error FailureType = Error::UNKNOWN; - uintptr_t FailureAddress = 0; -}; - -// Below are various compile-time checks that the layout of the internal -// GWP-ASan structures are undisturbed. If they are disturbed, the version magic -// number needs to be increased by one, and the asserts need to be updated. -// Out-of-process crash handlers, like breakpad/crashpad, may copy the internal -// GWP-ASan structures into a minidump for offline reconstruction of the crash. -// In order to accomplish this, the offline reconstructor needs to know the -// version of GWP-ASan internal structures that it's unpacking (along with the -// architecture-specific layout info, which is left as an exercise to the crash -// handler). -static_assert(offsetof(AllocatorState, VersionMagic) == 0, ""); -static_assert(sizeof(AllocatorVersionMagic) == 8, ""); -#if defined(__x86_64__) -static_assert(sizeof(AllocatorState) == 56, ""); -static_assert(offsetof(AllocatorState, FailureAddress) == 48, ""); -static_assert(sizeof(AllocationMetadata) == 568, ""); -static_assert(offsetof(AllocationMetadata, IsDeallocated) == 560, ""); -#elif defined(__aarch64__) -static_assert(sizeof(AllocatorState) == 56, ""); -static_assert(offsetof(AllocatorState, FailureAddress) == 48, ""); -static_assert(sizeof(AllocationMetadata) == 568, ""); -static_assert(offsetof(AllocationMetadata, IsDeallocated) == 560, ""); -#elif defined(__i386__) -static_assert(sizeof(AllocatorState) == 32, ""); -static_assert(offsetof(AllocatorState, FailureAddress) == 28, ""); -static_assert(sizeof(AllocationMetadata) == 548, ""); -static_assert(offsetof(AllocationMetadata, IsDeallocated) == 544, ""); -#elif defined(__arm__) -static_assert(sizeof(AllocatorState) == 32, ""); -static_assert(offsetof(AllocatorState, FailureAddress) == 28, ""); -static_assert(sizeof(AllocationMetadata) == 560, ""); -static_assert(offsetof(AllocationMetadata, IsDeallocated) == 552, ""); -#endif // defined($ARCHITECTURE) - -} // namespace gwp_asan -#endif // GWP_ASAN_COMMON_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/crash_handler.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/crash_handler.cpp deleted file mode 100644 index 6b4c39edb294..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/crash_handler.cpp +++ /dev/null @@ -1,154 +0,0 @@ -//===-- crash_handler.cpp ---------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/common.h" -#include "gwp_asan/stack_trace_compressor.h" - -#include -#include -#include - -using AllocationMetadata = gwp_asan::AllocationMetadata; -using Error = gwp_asan::Error; - -#ifdef __cplusplus -extern "C" { -#endif - -bool __gwp_asan_error_is_mine(const gwp_asan::AllocatorState *State, - uintptr_t ErrorPtr) { - assert(State && "State should not be nullptr."); - if (State->FailureType != Error::UNKNOWN && State->FailureAddress != 0) - return true; - - return ErrorPtr < State->GuardedPagePoolEnd && - State->GuardedPagePool <= ErrorPtr; -} - -uintptr_t -__gwp_asan_get_internal_crash_address(const gwp_asan::AllocatorState *State) { - return State->FailureAddress; -} - -static const AllocationMetadata * -addrToMetadata(const gwp_asan::AllocatorState *State, - const AllocationMetadata *Metadata, uintptr_t Ptr) { - // Note - Similar implementation in guarded_pool_allocator.cpp. - return &Metadata[State->getNearestSlot(Ptr)]; -} - -gwp_asan::Error -__gwp_asan_diagnose_error(const gwp_asan::AllocatorState *State, - const gwp_asan::AllocationMetadata *Metadata, - uintptr_t ErrorPtr) { - if (!__gwp_asan_error_is_mine(State, ErrorPtr)) - return Error::UNKNOWN; - - if (State->FailureType != Error::UNKNOWN) - return State->FailureType; - - // Let's try and figure out what the source of this error is. - if (State->isGuardPage(ErrorPtr)) { - size_t Slot = State->getNearestSlot(ErrorPtr); - const AllocationMetadata *SlotMeta = - addrToMetadata(State, Metadata, State->slotToAddr(Slot)); - - // Ensure that this slot was allocated once upon a time. - if (!SlotMeta->Addr) - return Error::UNKNOWN; - - if (SlotMeta->Addr < ErrorPtr) - return Error::BUFFER_OVERFLOW; - return Error::BUFFER_UNDERFLOW; - } - - // Access wasn't a guard page, check for use-after-free. - const AllocationMetadata *SlotMeta = - addrToMetadata(State, Metadata, ErrorPtr); - if (SlotMeta->IsDeallocated) { - return Error::USE_AFTER_FREE; - } - - // If we have reached here, the error is still unknown. - return Error::UNKNOWN; -} - -const gwp_asan::AllocationMetadata * -__gwp_asan_get_metadata(const gwp_asan::AllocatorState *State, - const gwp_asan::AllocationMetadata *Metadata, - uintptr_t ErrorPtr) { - if (!__gwp_asan_error_is_mine(State, ErrorPtr)) - return nullptr; - - if (ErrorPtr >= State->GuardedPagePoolEnd || - State->GuardedPagePool > ErrorPtr) - return nullptr; - - const AllocationMetadata *Meta = addrToMetadata(State, Metadata, ErrorPtr); - if (Meta->Addr == 0) - return nullptr; - - return Meta; -} - -uintptr_t __gwp_asan_get_allocation_address( - const gwp_asan::AllocationMetadata *AllocationMeta) { - return AllocationMeta->Addr; -} - -size_t __gwp_asan_get_allocation_size( - const gwp_asan::AllocationMetadata *AllocationMeta) { - return AllocationMeta->RequestedSize; -} - -uint64_t __gwp_asan_get_allocation_thread_id( - const gwp_asan::AllocationMetadata *AllocationMeta) { - return AllocationMeta->AllocationTrace.ThreadID; -} - -size_t __gwp_asan_get_allocation_trace( - const gwp_asan::AllocationMetadata *AllocationMeta, uintptr_t *Buffer, - size_t BufferLen) { - uintptr_t UncompressedBuffer[AllocationMetadata::kMaxTraceLengthToCollect]; - size_t UnpackedLength = gwp_asan::compression::unpack( - AllocationMeta->AllocationTrace.CompressedTrace, - AllocationMeta->AllocationTrace.TraceSize, UncompressedBuffer, - AllocationMetadata::kMaxTraceLengthToCollect); - if (UnpackedLength < BufferLen) - BufferLen = UnpackedLength; - memcpy(Buffer, UncompressedBuffer, BufferLen * sizeof(*Buffer)); - return UnpackedLength; -} - -bool __gwp_asan_is_deallocated( - const gwp_asan::AllocationMetadata *AllocationMeta) { - return AllocationMeta->IsDeallocated; -} - -uint64_t __gwp_asan_get_deallocation_thread_id( - const gwp_asan::AllocationMetadata *AllocationMeta) { - return AllocationMeta->DeallocationTrace.ThreadID; -} - -size_t __gwp_asan_get_deallocation_trace( - const gwp_asan::AllocationMetadata *AllocationMeta, uintptr_t *Buffer, - size_t BufferLen) { - uintptr_t UncompressedBuffer[AllocationMetadata::kMaxTraceLengthToCollect]; - size_t UnpackedLength = gwp_asan::compression::unpack( - AllocationMeta->DeallocationTrace.CompressedTrace, - AllocationMeta->DeallocationTrace.TraceSize, UncompressedBuffer, - AllocationMetadata::kMaxTraceLengthToCollect); - if (UnpackedLength < BufferLen) - BufferLen = UnpackedLength; - memcpy(Buffer, UncompressedBuffer, BufferLen * sizeof(*Buffer)); - return UnpackedLength; -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/crash_handler.h b/contrib/libs/clang14-rt/lib/gwp_asan/crash_handler.h deleted file mode 100644 index 4a95069dac58..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/crash_handler.h +++ /dev/null @@ -1,125 +0,0 @@ -//===-- crash_handler.h -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// This file contains interface functions that can be called by an in-process or -// out-of-process crash handler after the process has terminated. Functions in -// this interface are never thread safe. For an in-process crash handler, the -// handler should call GuardedPoolAllocator::disable() to stop any other threads -// from retrieving new GWP-ASan allocations, which may corrupt the metadata. -#ifndef GWP_ASAN_INTERFACE_H_ -#define GWP_ASAN_INTERFACE_H_ - -#include "gwp_asan/common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// When a process crashes, there are three possible outcomes: -// 1. The crash is unrelated to GWP-ASan - in which case this function returns -// false. -// 2. The crash is internally detected within GWP-ASan itself (e.g. a -// double-free bug is caught in GuardedPoolAllocator::deallocate(), and -// GWP-ASan will terminate the process). In this case - this function -// returns true. -// 3. The crash is caused by a memory error at `AccessPtr` that's caught by the -// system, but GWP-ASan is responsible for the allocation. In this case - -// the function also returns true. -// This function takes an optional `AccessPtr` parameter. If the pointer that -// was attempted to be accessed is available, you should provide it here. In the -// case of some internally-detected errors, the crash may manifest as an abort -// or trap may or may not have an associated pointer. In these cases, the -// pointer can be obtained by a call to __gwp_asan_get_internal_crash_address. -bool __gwp_asan_error_is_mine(const gwp_asan::AllocatorState *State, - uintptr_t ErrorPtr = 0u); - -// Diagnose and return the type of error that occurred at `ErrorPtr`. If -// `ErrorPtr` is unrelated to GWP-ASan, or if the error type cannot be deduced, -// this function returns Error::UNKNOWN. -gwp_asan::Error -__gwp_asan_diagnose_error(const gwp_asan::AllocatorState *State, - const gwp_asan::AllocationMetadata *Metadata, - uintptr_t ErrorPtr); - -// For internally-detected errors (double free, invalid free), this function -// returns the pointer that the error occurred at. If the error is unrelated to -// GWP-ASan, or if the error was caused by a non-internally detected failure, -// this function returns zero. -uintptr_t -__gwp_asan_get_internal_crash_address(const gwp_asan::AllocatorState *State); - -// Returns a pointer to the metadata for the allocation that's responsible for -// the crash. This metadata should not be dereferenced directly due to API -// compatibility issues, but should be instead passed to functions below for -// information retrieval. Returns nullptr if there is no metadata available for -// this crash. -const gwp_asan::AllocationMetadata * -__gwp_asan_get_metadata(const gwp_asan::AllocatorState *State, - const gwp_asan::AllocationMetadata *Metadata, - uintptr_t ErrorPtr); - -// +---------------------------------------------------------------------------+ -// | Error Information Functions | -// +---------------------------------------------------------------------------+ -// Functions below return information about the type of error that was caught by -// GWP-ASan, or information about the allocation that caused the error. These -// functions generally take an `AllocationMeta` argument, which should be -// retrieved via. __gwp_asan_get_metadata. - -// Returns the start of the allocation whose metadata is in `AllocationMeta`. -uintptr_t __gwp_asan_get_allocation_address( - const gwp_asan::AllocationMetadata *AllocationMeta); - -// Returns the size of the allocation whose metadata is in `AllocationMeta` -size_t __gwp_asan_get_allocation_size( - const gwp_asan::AllocationMetadata *AllocationMeta); - -// Returns the Thread ID that allocated the memory that caused the error at -// `ErrorPtr`. This function may not be called if __gwp_asan_has_metadata() -// returns false. -uint64_t __gwp_asan_get_allocation_thread_id( - const gwp_asan::AllocationMetadata *AllocationMeta); - -// Retrieve the allocation trace for the allocation whose metadata is in -// `AllocationMeta`, and place it into the provided `Buffer` that has at least -// `BufferLen` elements. This function returns the number of frames that would -// have been written into `Buffer` if the space was available (i.e. however many -// frames were stored by GWP-ASan). A return value greater than `BufferLen` -// indicates that the trace was truncated when storing to `Buffer`. -size_t __gwp_asan_get_allocation_trace( - const gwp_asan::AllocationMetadata *AllocationMeta, uintptr_t *Buffer, - size_t BufferLen); - -// Returns whether the allocation whose metadata is in `AllocationMeta` has been -// deallocated. This function may not be called if __gwp_asan_has_metadata() -// returns false. -bool __gwp_asan_is_deallocated( - const gwp_asan::AllocationMetadata *AllocationMeta); - -// Returns the Thread ID that deallocated the memory whose metadata is in -// `AllocationMeta`. This function may not be called if -// __gwp_asan_is_deallocated() returns false. -uint64_t __gwp_asan_get_deallocation_thread_id( - const gwp_asan::AllocationMetadata *AllocationMeta); - -// Retrieve the deallocation trace for the allocation whose metadata is in -// `AllocationMeta`, and place it into the provided `Buffer` that has at least -// `BufferLen` elements. This function returns the number of frames that would -// have been written into `Buffer` if the space was available (i.e. however many -// frames were stored by GWP-ASan). A return value greater than `BufferLen` -// indicates that the trace was truncated when storing to `Buffer`. This -// function may not be called if __gwp_asan_is_deallocated() returns false. -size_t __gwp_asan_get_deallocation_trace( - const gwp_asan::AllocationMetadata *AllocationMeta, uintptr_t *Buffer, - size_t BufferLen); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // GWP_ASAN_INTERFACE_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/definitions.h b/contrib/libs/clang14-rt/lib/gwp_asan/definitions.h deleted file mode 100644 index bec029038934..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/definitions.h +++ /dev/null @@ -1,20 +0,0 @@ -//===-- definitions.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_DEFINITIONS_H_ -#define GWP_ASAN_DEFINITIONS_H_ - -#define GWP_ASAN_TLS_INITIAL_EXEC \ - __thread __attribute__((tls_model("initial-exec"))) - -#define GWP_ASAN_UNLIKELY(X) __builtin_expect(!!(X), 0) -#define GWP_ASAN_ALWAYS_INLINE inline __attribute__((always_inline)) - -#define GWP_ASAN_WEAK __attribute__((weak)) - -#endif // GWP_ASAN_DEFINITIONS_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/guarded_pool_allocator.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/guarded_pool_allocator.cpp deleted file mode 100644 index 7096b428764c..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/guarded_pool_allocator.cpp +++ /dev/null @@ -1,361 +0,0 @@ -//===-- guarded_pool_allocator.cpp ------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/guarded_pool_allocator.h" - -#include "gwp_asan/options.h" -#include "gwp_asan/utilities.h" - -#include -#include - -using AllocationMetadata = gwp_asan::AllocationMetadata; -using Error = gwp_asan::Error; - -namespace gwp_asan { -namespace { -// Forward declare the pointer to the singleton version of this class. -// Instantiated during initialisation, this allows the signal handler -// to find this class in order to deduce the root cause of failures. Must not be -// referenced by users outside this translation unit, in order to avoid -// init-order-fiasco. -GuardedPoolAllocator *SingletonPtr = nullptr; - -size_t roundUpTo(size_t Size, size_t Boundary) { - return (Size + Boundary - 1) & ~(Boundary - 1); -} - -uintptr_t getPageAddr(uintptr_t Ptr, uintptr_t PageSize) { - return Ptr & ~(PageSize - 1); -} - -bool isPowerOfTwo(uintptr_t X) { return (X & (X - 1)) == 0; } -} // anonymous namespace - -// Gets the singleton implementation of this class. Thread-compatible until -// init() is called, thread-safe afterwards. -GuardedPoolAllocator *GuardedPoolAllocator::getSingleton() { - return SingletonPtr; -} - -void GuardedPoolAllocator::init(const options::Options &Opts) { - // Note: We return from the constructor here if GWP-ASan is not available. - // This will stop heap-allocation of class members, as well as mmap() of the - // guarded slots. - if (!Opts.Enabled || Opts.SampleRate == 0 || - Opts.MaxSimultaneousAllocations == 0) - return; - - Check(Opts.SampleRate >= 0, "GWP-ASan Error: SampleRate is < 0."); - Check(Opts.SampleRate < (1 << 30), "GWP-ASan Error: SampleRate is >= 2^30."); - Check(Opts.MaxSimultaneousAllocations >= 0, - "GWP-ASan Error: MaxSimultaneousAllocations is < 0."); - - SingletonPtr = this; - Backtrace = Opts.Backtrace; - - State.VersionMagic = {{AllocatorVersionMagic::kAllocatorVersionMagic[0], - AllocatorVersionMagic::kAllocatorVersionMagic[1], - AllocatorVersionMagic::kAllocatorVersionMagic[2], - AllocatorVersionMagic::kAllocatorVersionMagic[3]}, - AllocatorVersionMagic::kAllocatorVersion, - 0}; - - State.MaxSimultaneousAllocations = Opts.MaxSimultaneousAllocations; - - const size_t PageSize = getPlatformPageSize(); - // getPageAddr() and roundUpTo() assume the page size to be a power of 2. - assert((PageSize & (PageSize - 1)) == 0); - State.PageSize = PageSize; - - size_t PoolBytesRequired = - PageSize * (1 + State.MaxSimultaneousAllocations) + - State.MaxSimultaneousAllocations * State.maximumAllocationSize(); - assert(PoolBytesRequired % PageSize == 0); - void *GuardedPoolMemory = reserveGuardedPool(PoolBytesRequired); - - size_t BytesRequired = - roundUpTo(State.MaxSimultaneousAllocations * sizeof(*Metadata), PageSize); - Metadata = reinterpret_cast( - map(BytesRequired, kGwpAsanMetadataName)); - - // Allocate memory and set up the free pages queue. - BytesRequired = roundUpTo( - State.MaxSimultaneousAllocations * sizeof(*FreeSlots), PageSize); - FreeSlots = - reinterpret_cast(map(BytesRequired, kGwpAsanFreeSlotsName)); - - // Multiply the sample rate by 2 to give a good, fast approximation for (1 / - // SampleRate) chance of sampling. - if (Opts.SampleRate != 1) - AdjustedSampleRatePlusOne = static_cast(Opts.SampleRate) * 2 + 1; - else - AdjustedSampleRatePlusOne = 2; - - initPRNG(); - getThreadLocals()->NextSampleCounter = - ((getRandomUnsigned32() % (AdjustedSampleRatePlusOne - 1)) + 1) & - ThreadLocalPackedVariables::NextSampleCounterMask; - - State.GuardedPagePool = reinterpret_cast(GuardedPoolMemory); - State.GuardedPagePoolEnd = - reinterpret_cast(GuardedPoolMemory) + PoolBytesRequired; - - if (Opts.InstallForkHandlers) - installAtFork(); -} - -void GuardedPoolAllocator::disable() { - PoolMutex.lock(); - BacktraceMutex.lock(); -} - -void GuardedPoolAllocator::enable() { - PoolMutex.unlock(); - BacktraceMutex.unlock(); -} - -void GuardedPoolAllocator::iterate(void *Base, size_t Size, iterate_callback Cb, - void *Arg) { - uintptr_t Start = reinterpret_cast(Base); - for (size_t i = 0; i < State.MaxSimultaneousAllocations; ++i) { - const AllocationMetadata &Meta = Metadata[i]; - if (Meta.Addr && !Meta.IsDeallocated && Meta.Addr >= Start && - Meta.Addr < Start + Size) - Cb(Meta.Addr, Meta.RequestedSize, Arg); - } -} - -void GuardedPoolAllocator::uninitTestOnly() { - if (State.GuardedPagePool) { - unreserveGuardedPool(); - State.GuardedPagePool = 0; - State.GuardedPagePoolEnd = 0; - } - if (Metadata) { - unmap(Metadata, - roundUpTo(State.MaxSimultaneousAllocations * sizeof(*Metadata), - State.PageSize)); - Metadata = nullptr; - } - if (FreeSlots) { - unmap(FreeSlots, - roundUpTo(State.MaxSimultaneousAllocations * sizeof(*FreeSlots), - State.PageSize)); - FreeSlots = nullptr; - } - *getThreadLocals() = ThreadLocalPackedVariables(); -} - -// Note, minimum backing allocation size in GWP-ASan is always one page, and -// each slot could potentially be multiple pages (but always in -// page-increments). Thus, for anything that requires less than page size -// alignment, we don't need to allocate extra padding to ensure the alignment -// can be met. -size_t GuardedPoolAllocator::getRequiredBackingSize(size_t Size, - size_t Alignment, - size_t PageSize) { - assert(isPowerOfTwo(Alignment) && "Alignment must be a power of two!"); - assert(Alignment != 0 && "Alignment should be non-zero"); - assert(Size != 0 && "Size should be non-zero"); - - if (Alignment <= PageSize) - return Size; - - return Size + Alignment - PageSize; -} - -uintptr_t GuardedPoolAllocator::alignUp(uintptr_t Ptr, size_t Alignment) { - assert(isPowerOfTwo(Alignment) && "Alignment must be a power of two!"); - assert(Alignment != 0 && "Alignment should be non-zero"); - if ((Ptr & (Alignment - 1)) == 0) - return Ptr; - - Ptr += Alignment - (Ptr & (Alignment - 1)); - return Ptr; -} - -uintptr_t GuardedPoolAllocator::alignDown(uintptr_t Ptr, size_t Alignment) { - assert(isPowerOfTwo(Alignment) && "Alignment must be a power of two!"); - assert(Alignment != 0 && "Alignment should be non-zero"); - if ((Ptr & (Alignment - 1)) == 0) - return Ptr; - - Ptr -= Ptr & (Alignment - 1); - return Ptr; -} - -void *GuardedPoolAllocator::allocate(size_t Size, size_t Alignment) { - // GuardedPagePoolEnd == 0 when GWP-ASan is disabled. If we are disabled, fall - // back to the supporting allocator. - if (State.GuardedPagePoolEnd == 0) { - getThreadLocals()->NextSampleCounter = - (AdjustedSampleRatePlusOne - 1) & - ThreadLocalPackedVariables::NextSampleCounterMask; - return nullptr; - } - - if (Size == 0) - Size = 1; - if (Alignment == 0) - Alignment = alignof(max_align_t); - - if (!isPowerOfTwo(Alignment) || Alignment > State.maximumAllocationSize() || - Size > State.maximumAllocationSize()) - return nullptr; - - size_t BackingSize = getRequiredBackingSize(Size, Alignment, State.PageSize); - if (BackingSize > State.maximumAllocationSize()) - return nullptr; - - // Protect against recursivity. - if (getThreadLocals()->RecursiveGuard) - return nullptr; - ScopedRecursiveGuard SRG; - - size_t Index; - { - ScopedLock L(PoolMutex); - Index = reserveSlot(); - } - - if (Index == kInvalidSlotID) - return nullptr; - - uintptr_t SlotStart = State.slotToAddr(Index); - AllocationMetadata *Meta = addrToMetadata(SlotStart); - uintptr_t SlotEnd = State.slotToAddr(Index) + State.maximumAllocationSize(); - uintptr_t UserPtr; - // Randomly choose whether to left-align or right-align the allocation, and - // then apply the necessary adjustments to get an aligned pointer. - if (getRandomUnsigned32() % 2 == 0) - UserPtr = alignUp(SlotStart, Alignment); - else - UserPtr = alignDown(SlotEnd - Size, Alignment); - - assert(UserPtr >= SlotStart); - assert(UserPtr + Size <= SlotEnd); - - // If a slot is multiple pages in size, and the allocation takes up a single - // page, we can improve overflow detection by leaving the unused pages as - // unmapped. - const size_t PageSize = State.PageSize; - allocateInGuardedPool( - reinterpret_cast(getPageAddr(UserPtr, PageSize)), - roundUpTo(Size, PageSize)); - - Meta->RecordAllocation(UserPtr, Size); - { - ScopedLock UL(BacktraceMutex); - Meta->AllocationTrace.RecordBacktrace(Backtrace); - } - - return reinterpret_cast(UserPtr); -} - -void GuardedPoolAllocator::trapOnAddress(uintptr_t Address, Error E) { - State.FailureType = E; - State.FailureAddress = Address; - - // Raise a SEGV by touching first guard page. - volatile char *p = reinterpret_cast(State.GuardedPagePool); - *p = 0; - // Normally, would be __builtin_unreachable(), but because of - // https://bugs.llvm.org/show_bug.cgi?id=47480, unreachable will DCE the - // volatile store above, even though it has side effects. - __builtin_trap(); -} - -void GuardedPoolAllocator::stop() { - getThreadLocals()->RecursiveGuard = true; - PoolMutex.tryLock(); -} - -void GuardedPoolAllocator::deallocate(void *Ptr) { - assert(pointerIsMine(Ptr) && "Pointer is not mine!"); - uintptr_t UPtr = reinterpret_cast(Ptr); - size_t Slot = State.getNearestSlot(UPtr); - uintptr_t SlotStart = State.slotToAddr(Slot); - AllocationMetadata *Meta = addrToMetadata(UPtr); - if (Meta->Addr != UPtr) { - // If multiple errors occur at the same time, use the first one. - ScopedLock L(PoolMutex); - trapOnAddress(UPtr, Error::INVALID_FREE); - } - - // Intentionally scope the mutex here, so that other threads can access the - // pool during the expensive markInaccessible() call. - { - ScopedLock L(PoolMutex); - if (Meta->IsDeallocated) { - trapOnAddress(UPtr, Error::DOUBLE_FREE); - } - - // Ensure that the deallocation is recorded before marking the page as - // inaccessible. Otherwise, a racy use-after-free will have inconsistent - // metadata. - Meta->RecordDeallocation(); - - // Ensure that the unwinder is not called if the recursive flag is set, - // otherwise non-reentrant unwinders may deadlock. - if (!getThreadLocals()->RecursiveGuard) { - ScopedRecursiveGuard SRG; - ScopedLock UL(BacktraceMutex); - Meta->DeallocationTrace.RecordBacktrace(Backtrace); - } - } - - deallocateInGuardedPool(reinterpret_cast(SlotStart), - State.maximumAllocationSize()); - - // And finally, lock again to release the slot back into the pool. - ScopedLock L(PoolMutex); - freeSlot(Slot); -} - -size_t GuardedPoolAllocator::getSize(const void *Ptr) { - assert(pointerIsMine(Ptr)); - ScopedLock L(PoolMutex); - AllocationMetadata *Meta = addrToMetadata(reinterpret_cast(Ptr)); - assert(Meta->Addr == reinterpret_cast(Ptr)); - return Meta->RequestedSize; -} - -AllocationMetadata *GuardedPoolAllocator::addrToMetadata(uintptr_t Ptr) const { - return &Metadata[State.getNearestSlot(Ptr)]; -} - -size_t GuardedPoolAllocator::reserveSlot() { - // Avoid potential reuse of a slot before we have made at least a single - // allocation in each slot. Helps with our use-after-free detection. - if (NumSampledAllocations < State.MaxSimultaneousAllocations) - return NumSampledAllocations++; - - if (FreeSlotsLength == 0) - return kInvalidSlotID; - - size_t ReservedIndex = getRandomUnsigned32() % FreeSlotsLength; - size_t SlotIndex = FreeSlots[ReservedIndex]; - FreeSlots[ReservedIndex] = FreeSlots[--FreeSlotsLength]; - return SlotIndex; -} - -void GuardedPoolAllocator::freeSlot(size_t SlotIndex) { - assert(FreeSlotsLength < State.MaxSimultaneousAllocations); - FreeSlots[FreeSlotsLength++] = SlotIndex; -} - -uint32_t GuardedPoolAllocator::getRandomUnsigned32() { - uint32_t RandomState = getThreadLocals()->RandomState; - RandomState ^= RandomState << 13; - RandomState ^= RandomState >> 17; - RandomState ^= RandomState << 5; - getThreadLocals()->RandomState = RandomState; - return RandomState; -} -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/guarded_pool_allocator.h b/contrib/libs/clang14-rt/lib/gwp_asan/guarded_pool_allocator.h deleted file mode 100644 index 6d2ce2576c13..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/guarded_pool_allocator.h +++ /dev/null @@ -1,249 +0,0 @@ -//===-- guarded_pool_allocator.h --------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_GUARDED_POOL_ALLOCATOR_H_ -#define GWP_ASAN_GUARDED_POOL_ALLOCATOR_H_ - -#include "gwp_asan/common.h" -#include "gwp_asan/definitions.h" -#include "gwp_asan/mutex.h" -#include "gwp_asan/options.h" -#include "gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h" // IWYU pragma: keep -#include "gwp_asan/platform_specific/guarded_pool_allocator_posix.h" // IWYU pragma: keep -#include "gwp_asan/platform_specific/guarded_pool_allocator_tls.h" - -#include -#include -// IWYU pragma: no_include <__stddef_max_align_t.h> - -namespace gwp_asan { -// This class is the primary implementation of the allocator portion of GWP- -// ASan. It is the sole owner of the pool of sequentially allocated guarded -// slots. It should always be treated as a singleton. - -// Functions in the public interface of this class are thread-compatible until -// init() is called, at which point they become thread-safe (unless specified -// otherwise). -class GuardedPoolAllocator { -public: - // Name of the GWP-ASan mapping that for `Metadata`. - static constexpr const char *kGwpAsanMetadataName = "GWP-ASan Metadata"; - - // During program startup, we must ensure that memory allocations do not land - // in this allocation pool if the allocator decides to runtime-disable - // GWP-ASan. The constructor value-initialises the class such that if no - // further initialisation takes place, calls to shouldSample() and - // pointerIsMine() will return false. - constexpr GuardedPoolAllocator() {} - GuardedPoolAllocator(const GuardedPoolAllocator &) = delete; - GuardedPoolAllocator &operator=(const GuardedPoolAllocator &) = delete; - - // Note: This class is expected to be a singleton for the lifetime of the - // program. If this object is initialised, it will leak the guarded page pool - // and metadata allocations during destruction. We can't clean up these areas - // as this may cause a use-after-free on shutdown. - ~GuardedPoolAllocator() = default; - - // Initialise the rest of the members of this class. Create the allocation - // pool using the provided options. See options.inc for runtime configuration - // options. - void init(const options::Options &Opts); - void uninitTestOnly(); - - // Functions exported for libmemunreachable's use on Android. disable() - // installs a lock in the allocator that prevents any thread from being able - // to allocate memory, until enable() is called. - void disable(); - void enable(); - - typedef void (*iterate_callback)(uintptr_t base, size_t size, void *arg); - // Execute the callback Cb for every allocation the lies in [Base, Base + - // Size). Must be called while the allocator is disabled. The callback can not - // allocate. - void iterate(void *Base, size_t Size, iterate_callback Cb, void *Arg); - - // This function is used to signal the allocator to indefinitely stop - // functioning, as a crash has occurred. This stops the allocator from - // servicing any further allocations permanently. - void stop(); - - // Return whether the allocation should be randomly chosen for sampling. - GWP_ASAN_ALWAYS_INLINE bool shouldSample() { - // NextSampleCounter == 0 means we "should regenerate the counter". - // == 1 means we "should sample this allocation". - // AdjustedSampleRatePlusOne is designed to intentionally underflow. This - // class must be valid when zero-initialised, and we wish to sample as - // infrequently as possible when this is the case, hence we underflow to - // UINT32_MAX. - if (GWP_ASAN_UNLIKELY(getThreadLocals()->NextSampleCounter == 0)) - getThreadLocals()->NextSampleCounter = - ((getRandomUnsigned32() % (AdjustedSampleRatePlusOne - 1)) + 1) & - ThreadLocalPackedVariables::NextSampleCounterMask; - - return GWP_ASAN_UNLIKELY(--getThreadLocals()->NextSampleCounter == 0); - } - - // Returns whether the provided pointer is a current sampled allocation that - // is owned by this pool. - GWP_ASAN_ALWAYS_INLINE bool pointerIsMine(const void *Ptr) const { - return State.pointerIsMine(Ptr); - } - - // Allocate memory in a guarded slot, with the specified `Alignment`. Returns - // nullptr if the pool is empty, if the alignnment is not a power of two, or - // if the size/alignment makes the allocation too large for this pool to - // handle. By default, uses strong alignment (i.e. `max_align_t`), see - // http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2293.htm for discussion of - // alignment issues in the standard. - void *allocate(size_t Size, size_t Alignment = alignof(max_align_t)); - - // Deallocate memory in a guarded slot. The provided pointer must have been - // allocated using this pool. This will set the guarded slot as inaccessible. - void deallocate(void *Ptr); - - // Returns the size of the allocation at Ptr. - size_t getSize(const void *Ptr); - - // Returns a pointer to the Metadata region, or nullptr if it doesn't exist. - const AllocationMetadata *getMetadataRegion() const { return Metadata; } - - // Returns a pointer to the AllocatorState region. - const AllocatorState *getAllocatorState() const { return &State; } - - // Exposed as protected for testing. -protected: - // Returns the actual allocation size required to service an allocation with - // the provided Size and Alignment. - static size_t getRequiredBackingSize(size_t Size, size_t Alignment, - size_t PageSize); - - // Returns the provided pointer that meets the specified alignment, depending - // on whether it's left or right aligned. - static uintptr_t alignUp(uintptr_t Ptr, size_t Alignment); - static uintptr_t alignDown(uintptr_t Ptr, size_t Alignment); - -private: - // Name of actively-occupied slot mappings. - static constexpr const char *kGwpAsanAliveSlotName = "GWP-ASan Alive Slot"; - // Name of the guard pages. This includes all slots that are not actively in - // use (i.e. were never used, or have been free()'d).) - static constexpr const char *kGwpAsanGuardPageName = "GWP-ASan Guard Page"; - // Name of the mapping for `FreeSlots`. - static constexpr const char *kGwpAsanFreeSlotsName = "GWP-ASan Metadata"; - - static constexpr size_t kInvalidSlotID = SIZE_MAX; - - // These functions anonymously map memory or change the permissions of mapped - // memory into this process in a platform-specific way. Pointer and size - // arguments are expected to be page-aligned. These functions will never - // return on error, instead electing to kill the calling process on failure. - // The pool memory is initially reserved and inaccessible, and RW mappings are - // subsequently created and destroyed via allocateInGuardedPool() and - // deallocateInGuardedPool(). Each mapping is named on platforms that support - // it, primarily Android. This name must be a statically allocated string, as - // the Android kernel uses the string pointer directly. - void *map(size_t Size, const char *Name) const; - void unmap(void *Ptr, size_t Size) const; - - // The pool is managed separately, as some platforms (particularly Fuchsia) - // manage virtual memory regions as a chunk where individual pages can still - // have separate permissions. These platforms maintain metadata about the - // region in order to perform operations. The pool is unique as it's the only - // thing in GWP-ASan that treats pages in a single VM region on an individual - // basis for page protection. - // The pointer returned by reserveGuardedPool() is the reserved address range - // of (at least) Size bytes. - void *reserveGuardedPool(size_t Size); - // allocateInGuardedPool() Ptr and Size must be a subrange of the previously - // reserved pool range. - void allocateInGuardedPool(void *Ptr, size_t Size) const; - // deallocateInGuardedPool() Ptr and Size must be an exact pair previously - // passed to allocateInGuardedPool(). - void deallocateInGuardedPool(void *Ptr, size_t Size) const; - void unreserveGuardedPool(); - - // Get the page size from the platform-specific implementation. Only needs to - // be called once, and the result should be cached in PageSize in this class. - static size_t getPlatformPageSize(); - - // Returns a pointer to the metadata for the owned pointer. If the pointer is - // not owned by this pool, the result is undefined. - AllocationMetadata *addrToMetadata(uintptr_t Ptr) const; - - // Reserve a slot for a new guarded allocation. Returns kInvalidSlotID if no - // slot is available to be reserved. - size_t reserveSlot(); - - // Unreserve the guarded slot. - void freeSlot(size_t SlotIndex); - - // Raise a SEGV and set the corresponding fields in the Allocator's State in - // order to tell the crash handler what happened. Used when errors are - // detected internally (Double Free, Invalid Free). - void trapOnAddress(uintptr_t Address, Error E); - - static GuardedPoolAllocator *getSingleton(); - - // Install a pthread_atfork handler. - void installAtFork(); - - gwp_asan::AllocatorState State; - - // A mutex to protect the guarded slot and metadata pool for this class. - Mutex PoolMutex; - // Some unwinders can grab the libdl lock. In order to provide atfork - // protection, we need to ensure that we allow an unwinding thread to release - // the libdl lock before forking. - Mutex BacktraceMutex; - // Record the number allocations that we've sampled. We store this amount so - // that we don't randomly choose to recycle a slot that previously had an - // allocation before all the slots have been utilised. - size_t NumSampledAllocations = 0; - // Pointer to the allocation metadata (allocation/deallocation stack traces), - // if any. - AllocationMetadata *Metadata = nullptr; - - // Pointer to an array of free slot indexes. - size_t *FreeSlots = nullptr; - // The current length of the list of free slots. - size_t FreeSlotsLength = 0; - - // See options.{h, inc} for more information. - bool PerfectlyRightAlign = false; - - // Backtrace function provided by the supporting allocator. See `options.h` - // for more information. - options::Backtrace_t Backtrace = nullptr; - - // The adjusted sample rate for allocation sampling. Default *must* be - // nonzero, as dynamic initialisation may call malloc (e.g. from libstdc++) - // before GPA::init() is called. This would cause an error in shouldSample(), - // where we would calculate modulo zero. This value is set UINT32_MAX, as when - // GWP-ASan is disabled, we wish to never spend wasted cycles recalculating - // the sample rate. - uint32_t AdjustedSampleRatePlusOne = 0; - - // Additional platform specific data structure for the guarded pool mapping. - PlatformSpecificMapData GuardedPagePoolPlatformData = {}; - - class ScopedRecursiveGuard { - public: - ScopedRecursiveGuard() { getThreadLocals()->RecursiveGuard = true; } - ~ScopedRecursiveGuard() { getThreadLocals()->RecursiveGuard = false; } - }; - - // Initialise the PRNG, platform-specific. - void initPRNG(); - - // xorshift (32-bit output), extremely fast PRNG that uses arithmetic - // operations only. Seeded using platform-specific mechanisms by initPRNG(). - uint32_t getRandomUnsigned32(); -}; -} // namespace gwp_asan - -#endif // GWP_ASAN_GUARDED_POOL_ALLOCATOR_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/mutex.h b/contrib/libs/clang14-rt/lib/gwp_asan/mutex.h deleted file mode 100644 index 34b91a2880dd..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/mutex.h +++ /dev/null @@ -1,42 +0,0 @@ -//===-- mutex.h -------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_MUTEX_H_ -#define GWP_ASAN_MUTEX_H_ - -#include "gwp_asan/platform_specific/mutex_fuchsia.h" // IWYU pragma: keep -#include "gwp_asan/platform_specific/mutex_posix.h" // IWYU pragma: keep - -namespace gwp_asan { -class Mutex final : PlatformMutex { -public: - constexpr Mutex() = default; - ~Mutex() = default; - Mutex(const Mutex &) = delete; - Mutex &operator=(const Mutex &) = delete; - // Lock the mutex. - void lock(); - // Nonblocking trylock of the mutex. Returns true if the lock was acquired. - bool tryLock(); - // Unlock the mutex. - void unlock(); -}; - -class ScopedLock { -public: - explicit ScopedLock(Mutex &Mx) : Mu(Mx) { Mu.lock(); } - ~ScopedLock() { Mu.unlock(); } - ScopedLock(const ScopedLock &) = delete; - ScopedLock &operator=(const ScopedLock &) = delete; - -private: - Mutex Μ -}; -} // namespace gwp_asan - -#endif // GWP_ASAN_MUTEX_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/optional/backtrace.h b/contrib/libs/clang14-rt/lib/gwp_asan/optional/backtrace.h deleted file mode 100644 index 9bb12af206a5..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/optional/backtrace.h +++ /dev/null @@ -1,53 +0,0 @@ -//===-- backtrace.h ---------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_OPTIONAL_BACKTRACE_H_ -#define GWP_ASAN_OPTIONAL_BACKTRACE_H_ - -#include "gwp_asan/optional/printf.h" -#include "gwp_asan/options.h" - -namespace gwp_asan { -namespace backtrace { -// ================================ Description ================================ -// This function shall take the backtrace provided in `TraceBuffer`, and print -// it in a human-readable format using `Print`. Generally, this function shall -// resolve raw pointers to section offsets and print them with the following -// sanitizer-common format: -// " #{frame_number} {pointer} in {function name} ({binary name}+{offset}" -// e.g. " #5 0x420459 in _start (/tmp/uaf+0x420459)" -// This format allows the backtrace to be symbolized offline successfully using -// llvm-symbolizer. -// =================================== Notes =================================== -// This function may directly or indirectly call malloc(), as the -// GuardedPoolAllocator contains a reentrancy barrier to prevent infinite -// recursion. Any allocation made inside this function will be served by the -// supporting allocator, and will not have GWP-ASan protections. -typedef void (*PrintBacktrace_t)(uintptr_t *TraceBuffer, size_t TraceLength, - Printf_t Print); - -// Returns a function pointer to a backtrace function that's suitable for -// unwinding through a signal handler. This is important primarily for frame- -// pointer based unwinders, DWARF or other unwinders can simply provide the -// normal backtrace function as the implementation here. On POSIX, SignalContext -// should be the `ucontext_t` from the signal handler. -typedef size_t (*SegvBacktrace_t)(uintptr_t *TraceBuffer, size_t Size, - void *SignalContext); - -// Returns platform-specific provided implementations of Backtrace_t for use -// inside the GWP-ASan core allocator. -options::Backtrace_t getBacktraceFunction(); - -// Returns platform-specific provided implementations of PrintBacktrace_t and -// SegvBacktrace_t for use in the optional SEGV handler. -PrintBacktrace_t getPrintBacktraceFunction(); -SegvBacktrace_t getSegvBacktraceFunction(); -} // namespace backtrace -} // namespace gwp_asan - -#endif // GWP_ASAN_OPTIONAL_BACKTRACE_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp deleted file mode 100644 index ea8e72be287d..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===-- backtrace_linux_libc.cpp --------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include -#include -#include -#include -#include -#include - -#include "gwp_asan/definitions.h" -#include "gwp_asan/optional/backtrace.h" -#include "gwp_asan/optional/printf.h" -#include "gwp_asan/options.h" - -namespace { -size_t Backtrace(uintptr_t *TraceBuffer, size_t Size) { - static_assert(sizeof(uintptr_t) == sizeof(void *), "uintptr_t is not void*"); - - return backtrace(reinterpret_cast(TraceBuffer), Size); -} - -// We don't need any custom handling for the Segv backtrace - the libc unwinder -// has no problems with unwinding through a signal handler. Force inlining here -// to avoid the additional frame. -GWP_ASAN_ALWAYS_INLINE size_t SegvBacktrace(uintptr_t *TraceBuffer, size_t Size, - void * /*Context*/) { - return Backtrace(TraceBuffer, Size); -} - -static void PrintBacktrace(uintptr_t *Trace, size_t TraceLength, - gwp_asan::Printf_t Printf) { - if (TraceLength == 0) { - Printf(" \n\n"); - return; - } - - char **BacktraceSymbols = - backtrace_symbols(reinterpret_cast(Trace), TraceLength); - - for (size_t i = 0; i < TraceLength; ++i) { - if (!BacktraceSymbols) - Printf(" #%zu %p\n", i, Trace[i]); - else - Printf(" #%zu %s\n", i, BacktraceSymbols[i]); - } - - Printf("\n"); - if (BacktraceSymbols) - free(BacktraceSymbols); -} -} // anonymous namespace - -namespace gwp_asan { -namespace backtrace { - -options::Backtrace_t getBacktraceFunction() { return Backtrace; } -PrintBacktrace_t getPrintBacktraceFunction() { return PrintBacktrace; } -SegvBacktrace_t getSegvBacktraceFunction() { return SegvBacktrace; } - -} // namespace backtrace -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/optional/options_parser.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/optional/options_parser.cpp deleted file mode 100644 index 60234124e8ed..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/optional/options_parser.cpp +++ /dev/null @@ -1,258 +0,0 @@ -//===-- options_parser.cpp --------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/optional/options_parser.h" -#include "gwp_asan/optional/printf.h" -#include "gwp_asan/utilities.h" - -#include -#include -#include -#include -#include - -namespace { -enum class OptionType : uint8_t { - OT_bool, - OT_int, -}; - -#define InvokeIfNonNull(Printf, ...) \ - do { \ - if (Printf) \ - Printf(__VA_ARGS__); \ - } while (0); - -class OptionParser { -public: - explicit OptionParser(gwp_asan::Printf_t PrintfForWarnings) - : Printf(PrintfForWarnings) {} - void registerOption(const char *Name, const char *Desc, OptionType Type, - void *Var); - void parseString(const char *S); - void printOptionDescriptions(); - -private: - // Calculate at compile-time how many options are available. -#define GWP_ASAN_OPTION(...) +1 - static constexpr size_t MaxOptions = 0 -#include "gwp_asan/options.inc" - ; -#undef GWP_ASAN_OPTION - - struct Option { - const char *Name; - const char *Desc; - OptionType Type; - void *Var; - } Options[MaxOptions]; - - size_t NumberOfOptions = 0; - const char *Buffer = nullptr; - uintptr_t Pos = 0; - gwp_asan::Printf_t Printf = nullptr; - - void skipWhitespace(); - void parseOptions(); - bool parseOption(); - bool setOptionToValue(const char *Name, const char *Value); -}; - -void OptionParser::printOptionDescriptions() { - InvokeIfNonNull(Printf, "GWP-ASan: Available options:\n"); - for (size_t I = 0; I < NumberOfOptions; ++I) - InvokeIfNonNull(Printf, "\t%s\n\t\t- %s\n", Options[I].Name, - Options[I].Desc); -} - -bool isSeparator(char C) { - return C == ' ' || C == ',' || C == ':' || C == '\n' || C == '\t' || - C == '\r'; -} - -bool isSeparatorOrNull(char C) { return !C || isSeparator(C); } - -void OptionParser::skipWhitespace() { - while (isSeparator(Buffer[Pos])) - ++Pos; -} - -bool OptionParser::parseOption() { - const uintptr_t NameStart = Pos; - while (Buffer[Pos] != '=' && !isSeparatorOrNull(Buffer[Pos])) - ++Pos; - - const char *Name = Buffer + NameStart; - if (Buffer[Pos] != '=') { - InvokeIfNonNull(Printf, "GWP-ASan: Expected '=' when parsing option '%s'.", - Name); - return false; - } - const uintptr_t ValueStart = ++Pos; - const char *Value; - if (Buffer[Pos] == '\'' || Buffer[Pos] == '"') { - const char Quote = Buffer[Pos++]; - while (Buffer[Pos] != 0 && Buffer[Pos] != Quote) - ++Pos; - if (Buffer[Pos] == 0) { - InvokeIfNonNull(Printf, "GWP-ASan: Unterminated string in option '%s'.", - Name); - return false; - } - Value = Buffer + ValueStart + 1; - ++Pos; // consume the closing quote - } else { - while (!isSeparatorOrNull(Buffer[Pos])) - ++Pos; - Value = Buffer + ValueStart; - } - - return setOptionToValue(Name, Value); -} - -void OptionParser::parseOptions() { - while (true) { - skipWhitespace(); - if (Buffer[Pos] == 0) - break; - if (!parseOption()) { - InvokeIfNonNull(Printf, "GWP-ASan: Options parsing failed.\n"); - return; - } - } -} - -void OptionParser::parseString(const char *S) { - if (!S) - return; - Buffer = S; - Pos = 0; - parseOptions(); -} - -bool parseBool(const char *Value, bool *b) { - if (strncmp(Value, "0", 1) == 0 || strncmp(Value, "no", 2) == 0 || - strncmp(Value, "false", 5) == 0) { - *b = false; - return true; - } - if (strncmp(Value, "1", 1) == 0 || strncmp(Value, "yes", 3) == 0 || - strncmp(Value, "true", 4) == 0) { - *b = true; - return true; - } - return false; -} - -bool OptionParser::setOptionToValue(const char *Name, const char *Value) { - for (size_t I = 0; I < NumberOfOptions; ++I) { - const uintptr_t Len = strlen(Options[I].Name); - if (strncmp(Name, Options[I].Name, Len) != 0 || Name[Len] != '=') - continue; - bool Ok = false; - switch (Options[I].Type) { - case OptionType::OT_bool: - Ok = parseBool(Value, reinterpret_cast(Options[I].Var)); - if (!Ok) - InvokeIfNonNull( - Printf, "GWP-ASan: Invalid boolean value '%s' for option '%s'.\n", - Value, Options[I].Name); - break; - case OptionType::OT_int: - char *ValueEnd; - *reinterpret_cast(Options[I].Var) = - static_cast(strtol(Value, &ValueEnd, 10)); - Ok = - *ValueEnd == '"' || *ValueEnd == '\'' || isSeparatorOrNull(*ValueEnd); - if (!Ok) - InvokeIfNonNull( - Printf, "GWP-ASan: Invalid integer value '%s' for option '%s'.\n", - Value, Options[I].Name); - break; - } - return Ok; - } - - InvokeIfNonNull(Printf, "GWP-ASan: Unknown option '%s'.", Name); - return true; -} - -void OptionParser::registerOption(const char *Name, const char *Desc, - OptionType Type, void *Var) { - assert(NumberOfOptions < MaxOptions && - "GWP-ASan Error: Ran out of space for options.\n"); - Options[NumberOfOptions].Name = Name; - Options[NumberOfOptions].Desc = Desc; - Options[NumberOfOptions].Type = Type; - Options[NumberOfOptions].Var = Var; - ++NumberOfOptions; -} - -void registerGwpAsanOptions(OptionParser *parser, - gwp_asan::options::Options *o) { -#define GWP_ASAN_OPTION(Type, Name, DefaultValue, Description) \ - parser->registerOption(#Name, Description, OptionType::OT_##Type, &o->Name); -#include "gwp_asan/options.inc" -#undef GWP_ASAN_OPTION -} - -const char *getGwpAsanDefaultOptions() { - return (__gwp_asan_default_options) ? __gwp_asan_default_options() : ""; -} - -gwp_asan::options::Options *getOptionsInternal() { - static gwp_asan::options::Options GwpAsanOptions; - return &GwpAsanOptions; -} -} // anonymous namespace - -namespace gwp_asan { -namespace options { - -void initOptions(const char *OptionsStr, Printf_t PrintfForWarnings) { - Options *o = getOptionsInternal(); - o->setDefaults(); - - OptionParser Parser(PrintfForWarnings); - registerGwpAsanOptions(&Parser, o); - - // Override from the weak function definition in this executable. - Parser.parseString(getGwpAsanDefaultOptions()); - - // Override from the provided options string. - Parser.parseString(OptionsStr); - - if (o->help) - Parser.printOptionDescriptions(); - - if (!o->Enabled) - return; - - if (o->MaxSimultaneousAllocations <= 0) { - InvokeIfNonNull( - PrintfForWarnings, - "GWP-ASan ERROR: MaxSimultaneousAllocations must be > 0 when GWP-ASan " - "is enabled.\n"); - o->Enabled = false; - } - if (o->SampleRate <= 0) { - InvokeIfNonNull( - PrintfForWarnings, - "GWP-ASan ERROR: SampleRate must be > 0 when GWP-ASan is enabled.\n"); - o->Enabled = false; - } -} - -void initOptions(Printf_t PrintfForWarnings) { - initOptions(getenv("GWP_ASAN_OPTIONS"), PrintfForWarnings); -} - -Options &getOptions() { return *getOptionsInternal(); } - -} // namespace options -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/optional/options_parser.h b/contrib/libs/clang14-rt/lib/gwp_asan/optional/options_parser.h deleted file mode 100644 index a5a062801f8f..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/optional/options_parser.h +++ /dev/null @@ -1,31 +0,0 @@ -//===-- options_parser.h ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_ -#define GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_ - -#include "gwp_asan/optional/printf.h" -#include "gwp_asan/options.h" - -namespace gwp_asan { -namespace options { -// Parse the options from the GWP_ASAN_OPTIONS environment variable. -void initOptions(Printf_t PrintfForWarnings = nullptr); -// Parse the options from the provided string. -void initOptions(const char *OptionsStr, Printf_t PrintfForWarnings = nullptr); -// Returns the initialised options. Call initOptions() prior to calling this -// function. -Options &getOptions(); -} // namespace options -} // namespace gwp_asan - -extern "C" { -__attribute__((weak)) const char *__gwp_asan_default_options(); -} - -#endif // GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/optional/printf.h b/contrib/libs/clang14-rt/lib/gwp_asan/optional/printf.h deleted file mode 100644 index 1004a2c24989..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/optional/printf.h +++ /dev/null @@ -1,33 +0,0 @@ -//===-- printf.h ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_OPTIONAL_PRINTF_H_ -#define GWP_ASAN_OPTIONAL_PRINTF_H_ - -namespace gwp_asan { - -// ================================ Requirements =============================== -// This function is required to be provided by the supporting allocator iff the -// allocator wants to use any of the optional components. -// ================================ Description ================================ -// This function shall produce output according to a strict subset of the C -// standard library's printf() family. This function must support printing the -// following formats: -// 1. integers: "%([0-9]*)?(z|ll)?{d,u,x,X}" -// 2. pointers: "%p" -// 3. strings: "%[-]([0-9]*)?(\\.\\*)?s" -// 4. chars: "%c" -// This function must be implemented in a signal-safe manner, and thus must not -// malloc(). -// =================================== Notes =================================== -// This function has a slightly different signature than the C standard -// library's printf(). Notably, it returns 'void' rather than 'int'. -typedef void (*Printf_t)(const char *Format, ...); - -} // namespace gwp_asan -#endif // GWP_ASAN_OPTIONAL_PRINTF_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/optional/segv_handler.h b/contrib/libs/clang14-rt/lib/gwp_asan/optional/segv_handler.h deleted file mode 100644 index 87d9fe1dff17..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/optional/segv_handler.h +++ /dev/null @@ -1,33 +0,0 @@ -//===-- segv_handler.h ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_OPTIONAL_SEGV_HANDLER_H_ -#define GWP_ASAN_OPTIONAL_SEGV_HANDLER_H_ - -#include "gwp_asan/guarded_pool_allocator.h" -#include "gwp_asan/optional/backtrace.h" -#include "gwp_asan/optional/printf.h" - -namespace gwp_asan { -namespace segv_handler { -// Install the SIGSEGV crash handler for printing use-after-free and heap- -// buffer-{under|over}flow exceptions if the user asked for it. This is platform -// specific as even though POSIX and Windows both support registering handlers -// through signal(), we have to use platform-specific signal handlers to obtain -// the address that caused the SIGSEGV exception. GPA->init() must be called -// before this function. -void installSignalHandlers(gwp_asan::GuardedPoolAllocator *GPA, Printf_t Printf, - gwp_asan::backtrace::PrintBacktrace_t PrintBacktrace, - gwp_asan::backtrace::SegvBacktrace_t SegvBacktrace); - -// Uninistall the signal handlers, test-only. -void uninstallSignalHandlers(); -} // namespace segv_handler -} // namespace gwp_asan - -#endif // GWP_ASAN_OPTIONAL_SEGV_HANDLER_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/optional/segv_handler_posix.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/optional/segv_handler_posix.cpp deleted file mode 100644 index 5c9bb9f3a2e7..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/optional/segv_handler_posix.cpp +++ /dev/null @@ -1,225 +0,0 @@ -//===-- segv_handler_posix.cpp ----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/common.h" -#include "gwp_asan/crash_handler.h" -#include "gwp_asan/guarded_pool_allocator.h" -#include "gwp_asan/optional/segv_handler.h" -#include "gwp_asan/options.h" - -// RHEL creates the PRIu64 format macro (for printing uint64_t's) only when this -// macro is defined before including . -#ifndef __STDC_FORMAT_MACROS -#define __STDC_FORMAT_MACROS 1 -#endif - -#include -#include -#include -#include - -using gwp_asan::AllocationMetadata; -using gwp_asan::Error; -using gwp_asan::GuardedPoolAllocator; -using gwp_asan::Printf_t; -using gwp_asan::backtrace::PrintBacktrace_t; -using gwp_asan::backtrace::SegvBacktrace_t; - -namespace { - -struct ScopedEndOfReportDecorator { - ScopedEndOfReportDecorator(gwp_asan::Printf_t Printf) : Printf(Printf) {} - ~ScopedEndOfReportDecorator() { Printf("*** End GWP-ASan report ***\n"); } - gwp_asan::Printf_t Printf; -}; - -// Prints the provided error and metadata information. -void printHeader(Error E, uintptr_t AccessPtr, - const gwp_asan::AllocationMetadata *Metadata, - Printf_t Printf) { - // Print using intermediate strings. Platforms like Android don't like when - // you print multiple times to the same line, as there may be a newline - // appended to a log file automatically per Printf() call. - constexpr size_t kDescriptionBufferLen = 128; - char DescriptionBuffer[kDescriptionBufferLen] = ""; - if (E != Error::UNKNOWN && Metadata != nullptr) { - uintptr_t Address = __gwp_asan_get_allocation_address(Metadata); - size_t Size = __gwp_asan_get_allocation_size(Metadata); - if (E == Error::USE_AFTER_FREE) { - snprintf(DescriptionBuffer, kDescriptionBufferLen, - "(%zu byte%s into a %zu-byte allocation at 0x%zx) ", - AccessPtr - Address, (AccessPtr - Address == 1) ? "" : "s", Size, - Address); - } else if (AccessPtr < Address) { - snprintf(DescriptionBuffer, kDescriptionBufferLen, - "(%zu byte%s to the left of a %zu-byte allocation at 0x%zx) ", - Address - AccessPtr, (Address - AccessPtr == 1) ? "" : "s", Size, - Address); - } else if (AccessPtr > Address) { - snprintf(DescriptionBuffer, kDescriptionBufferLen, - "(%zu byte%s to the right of a %zu-byte allocation at 0x%zx) ", - AccessPtr - Address, (AccessPtr - Address == 1) ? "" : "s", Size, - Address); - } else { - snprintf(DescriptionBuffer, kDescriptionBufferLen, - "(a %zu-byte allocation) ", Size); - } - } - - // Possible number of digits of a 64-bit number: ceil(log10(2^64)) == 20. Add - // a null terminator, and round to the nearest 8-byte boundary. - uint64_t ThreadID = gwp_asan::getThreadID(); - constexpr size_t kThreadBufferLen = 24; - char ThreadBuffer[kThreadBufferLen]; - if (ThreadID == gwp_asan::kInvalidThreadID) - snprintf(ThreadBuffer, kThreadBufferLen, ""); - else - snprintf(ThreadBuffer, kThreadBufferLen, "%" PRIu64, ThreadID); - - Printf("%s at 0x%zx %sby thread %s here:\n", gwp_asan::ErrorToString(E), - AccessPtr, DescriptionBuffer, ThreadBuffer); -} - -void dumpReport(uintptr_t ErrorPtr, const gwp_asan::AllocatorState *State, - const gwp_asan::AllocationMetadata *Metadata, - SegvBacktrace_t SegvBacktrace, Printf_t Printf, - PrintBacktrace_t PrintBacktrace, void *Context) { - assert(State && "dumpReport missing Allocator State."); - assert(Metadata && "dumpReport missing Metadata."); - assert(Printf && "dumpReport missing Printf."); - - if (!__gwp_asan_error_is_mine(State, ErrorPtr)) - return; - - Printf("*** GWP-ASan detected a memory error ***\n"); - ScopedEndOfReportDecorator Decorator(Printf); - - uintptr_t InternalErrorPtr = __gwp_asan_get_internal_crash_address(State); - if (InternalErrorPtr != 0u) - ErrorPtr = InternalErrorPtr; - - Error E = __gwp_asan_diagnose_error(State, Metadata, ErrorPtr); - - if (E == Error::UNKNOWN) { - Printf("GWP-ASan cannot provide any more information about this error. " - "This may occur due to a wild memory access into the GWP-ASan pool, " - "or an overflow/underflow that is > 512B in length.\n"); - return; - } - - const gwp_asan::AllocationMetadata *AllocMeta = - __gwp_asan_get_metadata(State, Metadata, ErrorPtr); - - // Print the error header. - printHeader(E, ErrorPtr, AllocMeta, Printf); - - // Print the fault backtrace. - static constexpr unsigned kMaximumStackFramesForCrashTrace = 512; - uintptr_t Trace[kMaximumStackFramesForCrashTrace]; - size_t TraceLength = - SegvBacktrace(Trace, kMaximumStackFramesForCrashTrace, Context); - - PrintBacktrace(Trace, TraceLength, Printf); - - if (AllocMeta == nullptr) - return; - - // Maybe print the deallocation trace. - if (__gwp_asan_is_deallocated(AllocMeta)) { - uint64_t ThreadID = __gwp_asan_get_deallocation_thread_id(AllocMeta); - if (ThreadID == gwp_asan::kInvalidThreadID) - Printf("0x%zx was deallocated by thread here:\n", ErrorPtr); - else - Printf("0x%zx was deallocated by thread %zu here:\n", ErrorPtr, ThreadID); - TraceLength = __gwp_asan_get_deallocation_trace( - AllocMeta, Trace, kMaximumStackFramesForCrashTrace); - PrintBacktrace(Trace, TraceLength, Printf); - } - - // Print the allocation trace. - uint64_t ThreadID = __gwp_asan_get_allocation_thread_id(AllocMeta); - if (ThreadID == gwp_asan::kInvalidThreadID) - Printf("0x%zx was allocated by thread here:\n", ErrorPtr); - else - Printf("0x%zx was allocated by thread %zu here:\n", ErrorPtr, ThreadID); - TraceLength = __gwp_asan_get_allocation_trace( - AllocMeta, Trace, kMaximumStackFramesForCrashTrace); - PrintBacktrace(Trace, TraceLength, Printf); -} - -struct sigaction PreviousHandler; -bool SignalHandlerInstalled; -gwp_asan::GuardedPoolAllocator *GPAForSignalHandler; -Printf_t PrintfForSignalHandler; -PrintBacktrace_t PrintBacktraceForSignalHandler; -SegvBacktrace_t BacktraceForSignalHandler; - -static void sigSegvHandler(int sig, siginfo_t *info, void *ucontext) { - if (GPAForSignalHandler) { - GPAForSignalHandler->stop(); - - dumpReport(reinterpret_cast(info->si_addr), - GPAForSignalHandler->getAllocatorState(), - GPAForSignalHandler->getMetadataRegion(), - BacktraceForSignalHandler, PrintfForSignalHandler, - PrintBacktraceForSignalHandler, ucontext); - } - - // Process any previous handlers. - if (PreviousHandler.sa_flags & SA_SIGINFO) { - PreviousHandler.sa_sigaction(sig, info, ucontext); - } else if (PreviousHandler.sa_handler == SIG_DFL) { - // If the previous handler was the default handler, cause a core dump. - signal(SIGSEGV, SIG_DFL); - raise(SIGSEGV); - } else if (PreviousHandler.sa_handler == SIG_IGN) { - // If the previous segv handler was SIGIGN, crash iff we were responsible - // for the crash. - if (__gwp_asan_error_is_mine(GPAForSignalHandler->getAllocatorState(), - reinterpret_cast(info->si_addr))) { - signal(SIGSEGV, SIG_DFL); - raise(SIGSEGV); - } - } else { - PreviousHandler.sa_handler(sig); - } -} -} // anonymous namespace - -namespace gwp_asan { -namespace segv_handler { - -void installSignalHandlers(gwp_asan::GuardedPoolAllocator *GPA, Printf_t Printf, - PrintBacktrace_t PrintBacktrace, - SegvBacktrace_t SegvBacktrace) { - assert(GPA && "GPA wasn't provided to installSignalHandlers."); - assert(Printf && "Printf wasn't provided to installSignalHandlers."); - assert(PrintBacktrace && - "PrintBacktrace wasn't provided to installSignalHandlers."); - assert(SegvBacktrace && - "SegvBacktrace wasn't provided to installSignalHandlers."); - GPAForSignalHandler = GPA; - PrintfForSignalHandler = Printf; - PrintBacktraceForSignalHandler = PrintBacktrace; - BacktraceForSignalHandler = SegvBacktrace; - - struct sigaction Action = {}; - Action.sa_sigaction = sigSegvHandler; - Action.sa_flags = SA_SIGINFO; - sigaction(SIGSEGV, &Action, &PreviousHandler); - SignalHandlerInstalled = true; -} - -void uninstallSignalHandlers() { - if (SignalHandlerInstalled) { - sigaction(SIGSEGV, &PreviousHandler, nullptr); - SignalHandlerInstalled = false; - } -} -} // namespace segv_handler -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/options.h b/contrib/libs/clang14-rt/lib/gwp_asan/options.h deleted file mode 100644 index 6fb43108b5de..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/options.h +++ /dev/null @@ -1,57 +0,0 @@ -//===-- options.h -----------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_OPTIONS_H_ -#define GWP_ASAN_OPTIONS_H_ - -#include -#include - -namespace gwp_asan { -namespace options { -// ================================ Requirements =============================== -// This function is required to be either implemented by the supporting -// allocator, or one of the two provided implementations may be used -// (RTGwpAsanBacktraceLibc or RTGwpAsanBacktraceSanitizerCommon). -// ================================ Description ================================ -// This function shall collect the backtrace for the calling thread and place -// the result in `TraceBuffer`. This function should elide itself and all frames -// below itself from `TraceBuffer`, i.e. the caller's frame should be in -// TraceBuffer[0], and subsequent frames 1..n into TraceBuffer[1..n], where a -// maximum of `Size` frames are stored. Returns the number of frames stored into -// `TraceBuffer`, and zero on failure. If the return value of this function is -// equal to `Size`, it may indicate that the backtrace is truncated. -// =================================== Notes =================================== -// This function may directly or indirectly call malloc(), as the -// GuardedPoolAllocator contains a reentrancy barrier to prevent infinite -// recursion. Any allocation made inside this function will be served by the -// supporting allocator, and will not have GWP-ASan protections. -typedef size_t (*Backtrace_t)(uintptr_t *TraceBuffer, size_t Size); - -struct Options { - Backtrace_t Backtrace = nullptr; - - // Read the options from the included definitions file. -#define GWP_ASAN_OPTION(Type, Name, DefaultValue, Description) \ - Type Name = DefaultValue; -#include "gwp_asan/options.inc" -#undef GWP_ASAN_OPTION - - void setDefaults() { -#define GWP_ASAN_OPTION(Type, Name, DefaultValue, Description) \ - Name = DefaultValue; -#include "gwp_asan/options.inc" -#undef GWP_ASAN_OPTION - - Backtrace = nullptr; - } -}; -} // namespace options -} // namespace gwp_asan - -#endif // GWP_ASAN_OPTIONS_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/options.inc b/contrib/libs/clang14-rt/lib/gwp_asan/options.inc deleted file mode 100644 index 9900a2ac40df..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/options.inc +++ /dev/null @@ -1,69 +0,0 @@ -//===-- options.inc ---------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_OPTION -#error "Define GWP_ASAN_OPTION prior to including this file!" -#endif - -#ifndef GWP_ASAN_DEFAULT_ENABLED -#define GWP_ASAN_DEFAULT_ENABLED true -#endif - -#ifndef GWP_ASAN_STRINGIFY -#define GWP_ASAN_STRINGIFY(S) GWP_ASAN_STRINGIFY_(S) -#define GWP_ASAN_STRINGIFY_(S) #S -#endif - -GWP_ASAN_OPTION(bool, Enabled, GWP_ASAN_DEFAULT_ENABLED, - "Is GWP-ASan enabled? Defaults to " GWP_ASAN_STRINGIFY( - GWP_ASAN_DEFAULT_ENABLED) ".") - -GWP_ASAN_OPTION(int, MaxSimultaneousAllocations, 16, - "Number of simultaneously-guarded allocations available in the " - "pool. Defaults to 16.") - -GWP_ASAN_OPTION(int, SampleRate, 5000, - "The probability (1 / SampleRate) that an allocation is " - "selected for GWP-ASan sampling. Default is 5000. Sample rates " - "up to (2^30 - 1) are supported.") - -// Developer note - This option is not actually processed by GWP-ASan itself. It -// is included here so that a user can specify whether they want signal handlers -// or not. The supporting allocator should inspect this value to see whether -// signal handlers need to be installed, and then use -// crash_handler::installSignalHandlers() in order to install the handlers. Note -// that in order to support signal handlers, you will need to link against the -// optional crash_handler component. -GWP_ASAN_OPTION( - bool, InstallSignalHandlers, true, - "Install GWP-ASan signal handlers for SIGSEGV during dynamic loading. This " - "allows better error reports by providing stack traces for allocation and " - "deallocation when reporting a memory error. GWP-ASan's signal handler " - "will forward the signal to any previously-installed handler, and user " - "programs that install further signal handlers should make sure they do " - "the same. Note, if the previously installed SIGSEGV handler is SIG_IGN, " - "we terminate the process after dumping the error report.") - -GWP_ASAN_OPTION(bool, InstallForkHandlers, true, - "Install GWP-ASan atfork handlers to acquire internal locks " - "before fork and release them after.") - -GWP_ASAN_OPTION(bool, help, false, "Print a summary of the available options.") - -// ============================================================================= -// ==== WARNING -// ============================================================================= -// If you are adding flags to GWP-ASan, please note that GWP-ASan flag strings -// may be parsed by trusted system components (on Android, GWP-ASan flag strings -// are parsed by libc during the dynamic loader). This means that GWP-ASan -// should never feature flags like log paths on disk, because this can lead to -// arbitrary file write and thus privilege escalation. For an example, see the -// setuid ASan log_path exploits: https://www.exploit-db.com/exploits/46241. -// -// Please place all new flags above this warning, so that the warning always -// stays at the bottom. diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/common_posix.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/common_posix.cpp deleted file mode 100644 index 0637fc2a4245..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/common_posix.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===-- common_posix.cpp ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/common.h" - -#include -#include // IWYU pragma: keep -// IWYU pragma: no_include -#include - -namespace gwp_asan { - -uint64_t getThreadID() { -#ifdef SYS_gettid - return syscall(SYS_gettid); -#else - return kInvalidThreadID; -#endif -} - -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h deleted file mode 100644 index 0295f6f71345..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h +++ /dev/null @@ -1,22 +0,0 @@ -//===-- guarded_pool_allocator_fuchsia.h ------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#if defined(__Fuchsia__) -#ifndef GWP_ASAN_GUARDED_POOL_ALLOCATOR_FUCHSIA_H_ -#define GWP_ASAN_GUARDED_POOL_ALLOCATOR_FUCHSIA_H_ - -#error #include - -namespace gwp_asan { -struct PlatformSpecificMapData { - zx_handle_t Vmar; -}; -} // namespace gwp_asan - -#endif // GWP_ASAN_GUARDED_POOL_ALLOCATOR_FUCHSIA_H_ -#endif // defined(__Fuchsia__) diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp deleted file mode 100644 index adb7330a431e..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp +++ /dev/null @@ -1,111 +0,0 @@ -//===-- guarded_pool_allocator_posix.cpp ------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/common.h" -#include "gwp_asan/guarded_pool_allocator.h" -#include "gwp_asan/platform_specific/guarded_pool_allocator_tls.h" -#include "gwp_asan/utilities.h" - -#include -#include -#include -#include -#include -#include -#include - -#ifdef ANDROID -#include -#define PR_SET_VMA 0x53564d41 -#define PR_SET_VMA_ANON_NAME 0 -#endif // ANDROID - -namespace { -void MaybeSetMappingName(void *Mapping, size_t Size, const char *Name) { -#ifdef ANDROID - prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, Mapping, Size, Name); -#endif // ANDROID - // Anonymous mapping names are only supported on Android. - return; -} -} // anonymous namespace - -namespace gwp_asan { - -void GuardedPoolAllocator::initPRNG() { - getThreadLocals()->RandomState = - static_cast(time(nullptr) + getThreadID()); -} - -void *GuardedPoolAllocator::map(size_t Size, const char *Name) const { - assert((Size % State.PageSize) == 0); - void *Ptr = mmap(nullptr, Size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - Check(Ptr != MAP_FAILED, "Failed to map guarded pool allocator memory"); - MaybeSetMappingName(Ptr, Size, Name); - return Ptr; -} - -void GuardedPoolAllocator::unmap(void *Ptr, size_t Size) const { - assert((reinterpret_cast(Ptr) % State.PageSize) == 0); - assert((Size % State.PageSize) == 0); - Check(munmap(Ptr, Size) == 0, - "Failed to unmap guarded pool allocator memory."); -} - -void *GuardedPoolAllocator::reserveGuardedPool(size_t Size) { - assert((Size % State.PageSize) == 0); - void *Ptr = - mmap(nullptr, Size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - Check(Ptr != MAP_FAILED, "Failed to reserve guarded pool allocator memory"); - MaybeSetMappingName(Ptr, Size, kGwpAsanGuardPageName); - return Ptr; -} - -void GuardedPoolAllocator::unreserveGuardedPool() { - unmap(reinterpret_cast(State.GuardedPagePool), - State.GuardedPagePoolEnd - State.GuardedPagePool); -} - -void GuardedPoolAllocator::allocateInGuardedPool(void *Ptr, size_t Size) const { - assert((reinterpret_cast(Ptr) % State.PageSize) == 0); - assert((Size % State.PageSize) == 0); - Check(mprotect(Ptr, Size, PROT_READ | PROT_WRITE) == 0, - "Failed to allocate in guarded pool allocator memory"); - MaybeSetMappingName(Ptr, Size, kGwpAsanAliveSlotName); -} - -void GuardedPoolAllocator::deallocateInGuardedPool(void *Ptr, - size_t Size) const { - assert((reinterpret_cast(Ptr) % State.PageSize) == 0); - assert((Size % State.PageSize) == 0); - // mmap() a PROT_NONE page over the address to release it to the system, if - // we used mprotect() here the system would count pages in the quarantine - // against the RSS. - Check(mmap(Ptr, Size, PROT_NONE, MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, -1, - 0) != MAP_FAILED, - "Failed to deallocate in guarded pool allocator memory"); - MaybeSetMappingName(Ptr, Size, kGwpAsanGuardPageName); -} - -size_t GuardedPoolAllocator::getPlatformPageSize() { - return sysconf(_SC_PAGESIZE); -} - -void GuardedPoolAllocator::installAtFork() { - auto Disable = []() { - if (auto *S = getSingleton()) - S->disable(); - }; - auto Enable = []() { - if (auto *S = getSingleton()) - S->enable(); - }; - pthread_atfork(Disable, Enable, Enable); -} -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h deleted file mode 100644 index 7f4ba0d8ccd1..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h +++ /dev/null @@ -1,18 +0,0 @@ -//===-- guarded_pool_allocator_posix.h --------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#if defined(__unix__) -#ifndef GWP_ASAN_GUARDED_POOL_ALLOCATOR_POSIX_H_ -#define GWP_ASAN_GUARDED_POOL_ALLOCATOR_POSIX_H_ - -namespace gwp_asan { -struct PlatformSpecificMapData {}; -} // namespace gwp_asan - -#endif // GWP_ASAN_GUARDED_POOL_ALLOCATOR_POSIX_H_ -#endif // defined(__unix__) diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h deleted file mode 100644 index 7421ba16fbda..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h +++ /dev/null @@ -1,55 +0,0 @@ -//===-- guarded_pool_allocator_tls.h ----------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_GUARDED_POOL_ALLOCATOR_TLS_H_ -#define GWP_ASAN_GUARDED_POOL_ALLOCATOR_TLS_H_ - -#include "gwp_asan/definitions.h" - -#include - -namespace gwp_asan { -// Pack the thread local variables into a struct to ensure that they're in -// the same cache line for performance reasons. These are the most touched -// variables in GWP-ASan. -struct ThreadLocalPackedVariables { - constexpr ThreadLocalPackedVariables() - : RandomState(0xacd979ce), NextSampleCounter(0), RecursiveGuard(false) {} - // Initialised to a magic constant so that an uninitialised GWP-ASan won't - // regenerate its sample counter for as long as possible. The xorshift32() - // algorithm used below results in getRandomUnsigned32(0xacd979ce) == - // 0xfffffffe. - uint32_t RandomState; - // Thread-local decrementing counter that indicates that a given allocation - // should be sampled when it reaches zero. - uint32_t NextSampleCounter : 31; - // The mask is needed to silence conversion errors. - static const uint32_t NextSampleCounterMask = (1U << 31) - 1; - // Guard against recursivity. Unwinders often contain complex behaviour that - // may not be safe for the allocator (i.e. the unwinder calls dlopen(), - // which calls malloc()). When recursive behaviour is detected, we will - // automatically fall back to the supporting allocator to supply the - // allocation. - bool RecursiveGuard : 1; -}; -static_assert(sizeof(ThreadLocalPackedVariables) == sizeof(uint64_t), - "thread local data does not fit in a uint64_t"); -} // namespace gwp_asan - -#ifdef GWP_ASAN_PLATFORM_TLS_HEADER -#error #include GWP_ASAN_PLATFORM_TLS_HEADER -#else -namespace gwp_asan { -inline ThreadLocalPackedVariables *getThreadLocals() { - alignas(8) static GWP_ASAN_TLS_INITIAL_EXEC ThreadLocalPackedVariables Locals; - return &Locals; -} -} // namespace gwp_asan -#endif // GWP_ASAN_PLATFORM_TLS_HEADER - -#endif // GWP_ASAN_GUARDED_POOL_ALLOCATOR_TLS_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.h b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.h deleted file mode 100644 index db53b47dcd80..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.h +++ /dev/null @@ -1,23 +0,0 @@ -//===-- mutex_fuchsia.h -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#if defined(__Fuchsia__) -#ifndef GWP_ASAN_MUTEX_FUCHSIA_H_ -#define GWP_ASAN_MUTEX_FUCHSIA_H_ - -#error #include - -namespace gwp_asan { -class PlatformMutex { -protected: - sync_mutex_t Mu = {}; -}; -} // namespace gwp_asan - -#endif // GWP_ASAN_MUTEX_FUCHSIA_H_ -#endif // defined(__Fuchsia__) diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_posix.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_posix.cpp deleted file mode 100644 index 8bd405e1074c..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_posix.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===-- mutex_posix.cpp -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/mutex.h" - -#include -#include - -namespace gwp_asan { -void Mutex::lock() { - int Status = pthread_mutex_lock(&Mu); - assert(Status == 0); - // Remove warning for non-debug builds. - (void)Status; -} - -bool Mutex::tryLock() { return pthread_mutex_trylock(&Mu) == 0; } - -void Mutex::unlock() { - int Status = pthread_mutex_unlock(&Mu); - assert(Status == 0); - // Remove warning for non-debug builds. - (void)Status; -} -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_posix.h b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_posix.h deleted file mode 100644 index 7f0239198f56..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_posix.h +++ /dev/null @@ -1,23 +0,0 @@ -//===-- mutex_posix.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#if defined(__unix__) -#ifndef GWP_ASAN_MUTEX_POSIX_H_ -#define GWP_ASAN_MUTEX_POSIX_H_ - -#include - -namespace gwp_asan { -class PlatformMutex { -protected: - pthread_mutex_t Mu = PTHREAD_MUTEX_INITIALIZER; -}; -} // namespace gwp_asan - -#endif // GWP_ASAN_MUTEX_POSIX_H_ -#endif // defined(__unix__) diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp deleted file mode 100644 index 735796305509..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===-- utilities_posix.cpp -------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include // IWYU pragma: keep (for __BIONIC__ macro) - -#ifdef __BIONIC__ -#include "gwp_asan/definitions.h" -#include -extern "C" GWP_ASAN_WEAK void android_set_abort_message(const char *); -#else // __BIONIC__ -#include -#endif - -namespace gwp_asan { -void die(const char *Message) { -#ifdef __BIONIC__ - if (&android_set_abort_message != nullptr) - android_set_abort_message(Message); - abort(); -#else // __BIONIC__ - fprintf(stderr, "%s", Message); - __builtin_trap(); -#endif // __BIONIC__ -} -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/stack_trace_compressor.cpp b/contrib/libs/clang14-rt/lib/gwp_asan/stack_trace_compressor.cpp deleted file mode 100644 index ca3167fb83a8..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/stack_trace_compressor.cpp +++ /dev/null @@ -1,111 +0,0 @@ -//===-- stack_trace_compressor.cpp ------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "gwp_asan/stack_trace_compressor.h" - -namespace gwp_asan { -namespace compression { -namespace { -// Encodes `Value` as a variable-length integer to `Out`. Returns zero if there -// was not enough space in the output buffer to write the complete varInt. -// Otherwise returns the length of the encoded integer. -size_t varIntEncode(uintptr_t Value, uint8_t *Out, size_t OutLen) { - for (size_t i = 0; i < OutLen; ++i) { - Out[i] = Value & 0x7f; - Value >>= 7; - if (!Value) - return i + 1; - - Out[i] |= 0x80; - } - - return 0; -} - -// Decodes a variable-length integer to `Out`. Returns zero if the integer was -// too large to be represented in a uintptr_t, or if the input buffer finished -// before the integer was decoded (either case meaning that the `In` does not -// point to a valid varInt buffer). Otherwise, returns the number of bytes that -// were used to store the decoded integer. -size_t varIntDecode(const uint8_t *In, size_t InLen, uintptr_t *Out) { - *Out = 0; - uint8_t Shift = 0; - - for (size_t i = 0; i < InLen; ++i) { - *Out |= (static_cast(In[i]) & 0x7f) << Shift; - - if (In[i] < 0x80) - return i + 1; - - Shift += 7; - - // Disallow overflowing the range of the output integer. - if (Shift >= sizeof(uintptr_t) * 8) - return 0; - } - return 0; -} - -uintptr_t zigzagEncode(uintptr_t Value) { - uintptr_t Encoded = Value << 1; - if (static_cast(Value) >= 0) - return Encoded; - return ~Encoded; -} - -uintptr_t zigzagDecode(uintptr_t Value) { - uintptr_t Decoded = Value >> 1; - if (!(Value & 1)) - return Decoded; - return ~Decoded; -} -} // anonymous namespace - -size_t pack(const uintptr_t *Unpacked, size_t UnpackedSize, uint8_t *Packed, - size_t PackedMaxSize) { - size_t Index = 0; - for (size_t CurrentDepth = 0; CurrentDepth < UnpackedSize; CurrentDepth++) { - uintptr_t Diff = Unpacked[CurrentDepth]; - if (CurrentDepth > 0) - Diff -= Unpacked[CurrentDepth - 1]; - size_t EncodedLength = - varIntEncode(zigzagEncode(Diff), Packed + Index, PackedMaxSize - Index); - if (!EncodedLength) - break; - - Index += EncodedLength; - } - - return Index; -} - -size_t unpack(const uint8_t *Packed, size_t PackedSize, uintptr_t *Unpacked, - size_t UnpackedMaxSize) { - size_t CurrentDepth; - size_t Index = 0; - for (CurrentDepth = 0; CurrentDepth < UnpackedMaxSize; CurrentDepth++) { - uintptr_t EncodedDiff; - size_t DecodedLength = - varIntDecode(Packed + Index, PackedSize - Index, &EncodedDiff); - if (!DecodedLength) - break; - Index += DecodedLength; - - Unpacked[CurrentDepth] = zigzagDecode(EncodedDiff); - if (CurrentDepth > 0) - Unpacked[CurrentDepth] += Unpacked[CurrentDepth - 1]; - } - - if (Index != PackedSize && CurrentDepth != UnpackedMaxSize) - return 0; - - return CurrentDepth; -} - -} // namespace compression -} // namespace gwp_asan diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/stack_trace_compressor.h b/contrib/libs/clang14-rt/lib/gwp_asan/stack_trace_compressor.h deleted file mode 100644 index dcbd9a3c1f0a..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/stack_trace_compressor.h +++ /dev/null @@ -1,38 +0,0 @@ -//===-- stack_trace_compressor.h --------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_STACK_TRACE_COMPRESSOR_ -#define GWP_ASAN_STACK_TRACE_COMPRESSOR_ - -#include -#include - -// These functions implement stack frame compression and decompression. We store -// the zig-zag encoded pointer difference between frame[i] and frame[i - 1] as -// a variable-length integer. This can reduce the memory overhead of stack -// traces by 50%. - -namespace gwp_asan { -namespace compression { - -// For the stack trace in `Unpacked` with length `UnpackedSize`, pack it into -// the buffer `Packed` maximum length `PackedMaxSize`. The return value is the -// number of bytes that were written to the output buffer. -size_t pack(const uintptr_t *Unpacked, size_t UnpackedSize, uint8_t *Packed, - size_t PackedMaxSize); - -// From the packed stack trace in `Packed` of length `PackedSize`, write the -// unpacked stack trace of maximum length `UnpackedMaxSize` into `Unpacked`. -// Returns the number of full entries unpacked, or zero on error. -size_t unpack(const uint8_t *Packed, size_t PackedSize, uintptr_t *Unpacked, - size_t UnpackedMaxSize); - -} // namespace compression -} // namespace gwp_asan - -#endif // GWP_ASAN_STACK_TRACE_COMPRESSOR_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/utilities.h b/contrib/libs/clang14-rt/lib/gwp_asan/utilities.h deleted file mode 100644 index d8bc0e491a3d..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/utilities.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- utilities.h ---------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef GWP_ASAN_UTILITIES_H_ -#define GWP_ASAN_UTILITIES_H_ - -#include "gwp_asan/definitions.h" - -#include - -namespace gwp_asan { -// Terminates in a platform-specific way with `Message`. -void die(const char *Message); - -// Checks that `Condition` is true, otherwise dies with `Message`. -GWP_ASAN_ALWAYS_INLINE void Check(bool Condition, const char *Message) { - if (Condition) - return; - die(Message); -} -} // namespace gwp_asan - -#endif // GWP_ASAN_UTILITIES_H_ diff --git a/contrib/libs/clang14-rt/lib/gwp_asan/ya.make b/contrib/libs/clang14-rt/lib/gwp_asan/ya.make deleted file mode 100644 index b18ea8bd2169..000000000000 --- a/contrib/libs/clang14-rt/lib/gwp_asan/ya.make +++ /dev/null @@ -1,54 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.gwp_asan${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -fcommon - -fno-builtin - -fno-exceptions - -fno-lto - -fno-omit-frame-pointer - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCS( - common.cpp - crash_handler.cpp - guarded_pool_allocator.cpp - platform_specific/common_posix.cpp - platform_specific/guarded_pool_allocator_posix.cpp - platform_specific/mutex_posix.cpp - platform_specific/utilities_posix.cpp - stack_trace_compressor.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/hwasan/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/hwasan/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan.cpp deleted file mode 100644 index 6f0ea64472c6..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan.cpp +++ /dev/null @@ -1,599 +0,0 @@ -//===-- hwasan.cpp --------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// HWAddressSanitizer runtime. -//===----------------------------------------------------------------------===// - -#include "hwasan.h" - -#include "hwasan_checks.h" -#include "hwasan_dynamic_shadow.h" -#include "hwasan_globals.h" -#include "hwasan_mapping.h" -#include "hwasan_poisoning.h" -#include "hwasan_report.h" -#include "hwasan_thread.h" -#include "hwasan_thread_list.h" -#include "sanitizer_common/sanitizer_atomic.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_flag_parser.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_libc.h" -#include "sanitizer_common/sanitizer_procmaps.h" -#include "sanitizer_common/sanitizer_stackdepot.h" -#include "sanitizer_common/sanitizer_stacktrace.h" -#include "sanitizer_common/sanitizer_symbolizer.h" -#include "ubsan/ubsan_flags.h" -#include "ubsan/ubsan_init.h" - -// ACHTUNG! No system header includes in this file. - -using namespace __sanitizer; - -namespace __hwasan { - -static Flags hwasan_flags; - -Flags *flags() { - return &hwasan_flags; -} - -int hwasan_inited = 0; -int hwasan_instrumentation_inited = 0; -bool hwasan_init_is_running; - -int hwasan_report_count = 0; - -uptr kLowShadowStart; -uptr kLowShadowEnd; -uptr kHighShadowStart; -uptr kHighShadowEnd; - -void Flags::SetDefaults() { -#define HWASAN_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue; -#include "hwasan_flags.inc" -#undef HWASAN_FLAG -} - -static void RegisterHwasanFlags(FlagParser *parser, Flags *f) { -#define HWASAN_FLAG(Type, Name, DefaultValue, Description) \ - RegisterFlag(parser, #Name, Description, &f->Name); -#include "hwasan_flags.inc" -#undef HWASAN_FLAG -} - -static void InitializeFlags() { - SetCommonFlagsDefaults(); - { - CommonFlags cf; - cf.CopyFrom(*common_flags()); - cf.external_symbolizer_path = GetEnv("HWASAN_SYMBOLIZER_PATH"); - cf.malloc_context_size = 20; - cf.handle_ioctl = true; - // FIXME: test and enable. - cf.check_printf = false; - cf.intercept_tls_get_addr = true; - cf.exitcode = 99; - // 8 shadow pages ~512kB, small enough to cover common stack sizes. - cf.clear_shadow_mmap_threshold = 4096 * (SANITIZER_ANDROID ? 2 : 8); - // Sigtrap is used in error reporting. - cf.handle_sigtrap = kHandleSignalExclusive; - -#if SANITIZER_ANDROID - // Let platform handle other signals. It is better at reporting them then we - // are. - cf.handle_segv = kHandleSignalNo; - cf.handle_sigbus = kHandleSignalNo; - cf.handle_abort = kHandleSignalNo; - cf.handle_sigill = kHandleSignalNo; - cf.handle_sigfpe = kHandleSignalNo; -#endif - OverrideCommonFlags(cf); - } - - Flags *f = flags(); - f->SetDefaults(); - - FlagParser parser; - RegisterHwasanFlags(&parser, f); - RegisterCommonFlags(&parser); - -#if HWASAN_CONTAINS_UBSAN - __ubsan::Flags *uf = __ubsan::flags(); - uf->SetDefaults(); - - FlagParser ubsan_parser; - __ubsan::RegisterUbsanFlags(&ubsan_parser, uf); - RegisterCommonFlags(&ubsan_parser); -#endif - - // Override from user-specified string. - if (__hwasan_default_options) - parser.ParseString(__hwasan_default_options()); -#if HWASAN_CONTAINS_UBSAN - const char *ubsan_default_options = __ubsan_default_options(); - ubsan_parser.ParseString(ubsan_default_options); -#endif - - parser.ParseStringFromEnv("HWASAN_OPTIONS"); -#if HWASAN_CONTAINS_UBSAN - ubsan_parser.ParseStringFromEnv("UBSAN_OPTIONS"); -#endif - - InitializeCommonFlags(); - - if (Verbosity()) ReportUnrecognizedFlags(); - - if (common_flags()->help) parser.PrintFlagDescriptions(); -} - -static void CheckUnwind() { - GET_FATAL_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME()); - stack.Print(); -} - -static void HwasanFormatMemoryUsage(InternalScopedString &s) { - HwasanThreadList &thread_list = hwasanThreadList(); - auto thread_stats = thread_list.GetThreadStats(); - auto sds = StackDepotGetStats(); - AllocatorStatCounters asc; - GetAllocatorStats(asc); - s.append( - "HWASAN pid: %d rss: %zd threads: %zd stacks: %zd" - " thr_aux: %zd stack_depot: %zd uniq_stacks: %zd" - " heap: %zd", - internal_getpid(), GetRSS(), thread_stats.n_live_threads, - thread_stats.total_stack_size, - thread_stats.n_live_threads * thread_list.MemoryUsedPerThread(), - sds.allocated, sds.n_uniq_ids, asc[AllocatorStatMapped]); -} - -#if SANITIZER_ANDROID -static constexpr uptr kMemoryUsageBufferSize = 4096; - -static char *memory_usage_buffer = nullptr; - -static void InitMemoryUsage() { - memory_usage_buffer = - (char *)MmapOrDie(kMemoryUsageBufferSize, "memory usage string"); - CHECK(memory_usage_buffer); - memory_usage_buffer[0] = '\0'; - DecorateMapping((uptr)memory_usage_buffer, kMemoryUsageBufferSize, - memory_usage_buffer); -} - -void UpdateMemoryUsage() { - if (!flags()->export_memory_stats) - return; - if (!memory_usage_buffer) - InitMemoryUsage(); - InternalScopedString s; - HwasanFormatMemoryUsage(s); - internal_strncpy(memory_usage_buffer, s.data(), kMemoryUsageBufferSize - 1); - memory_usage_buffer[kMemoryUsageBufferSize - 1] = '\0'; -} -#else -void UpdateMemoryUsage() {} -#endif - -void HwasanAtExit() { - if (common_flags()->print_module_map) - DumpProcessMap(); - if (flags()->print_stats && (flags()->atexit || hwasan_report_count > 0)) - ReportStats(); - if (hwasan_report_count > 0) { - // ReportAtExitStatistics(); - if (common_flags()->exitcode) - internal__exit(common_flags()->exitcode); - } -} - -void HandleTagMismatch(AccessInfo ai, uptr pc, uptr frame, void *uc, - uptr *registers_frame) { - InternalMmapVector stack_buffer(1); - BufferedStackTrace *stack = stack_buffer.data(); - stack->Reset(); - stack->Unwind(pc, frame, uc, common_flags()->fast_unwind_on_fatal); - - // The second stack frame contains the failure __hwasan_check function, as - // we have a stack frame for the registers saved in __hwasan_tag_mismatch that - // we wish to ignore. This (currently) only occurs on AArch64, as x64 - // implementations use SIGTRAP to implement the failure, and thus do not go - // through the stack saver. - if (registers_frame && stack->trace && stack->size > 0) { - stack->trace++; - stack->size--; - } - - bool fatal = flags()->halt_on_error || !ai.recover; - ReportTagMismatch(stack, ai.addr, ai.size, ai.is_store, fatal, - registers_frame); -} - -void HwasanTagMismatch(uptr addr, uptr access_info, uptr *registers_frame, - size_t outsize) { - __hwasan::AccessInfo ai; - ai.is_store = access_info & 0x10; - ai.is_load = !ai.is_store; - ai.recover = access_info & 0x20; - ai.addr = addr; - if ((access_info & 0xf) == 0xf) - ai.size = outsize; - else - ai.size = 1 << (access_info & 0xf); - - HandleTagMismatch(ai, (uptr)__builtin_return_address(0), - (uptr)__builtin_frame_address(0), nullptr, registers_frame); - __builtin_unreachable(); -} - -Thread *GetCurrentThread() { - uptr *ThreadLongPtr = GetCurrentThreadLongPtr(); - if (UNLIKELY(*ThreadLongPtr == 0)) - return nullptr; - auto *R = (StackAllocationsRingBuffer *)ThreadLongPtr; - return hwasanThreadList().GetThreadByBufferAddress((uptr)R->Next()); -} - -} // namespace __hwasan - -using namespace __hwasan; - -void __sanitizer::BufferedStackTrace::UnwindImpl( - uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) { - Thread *t = GetCurrentThread(); - if (!t) { - // The thread is still being created, or has already been destroyed. - size = 0; - return; - } - Unwind(max_depth, pc, bp, context, t->stack_top(), t->stack_bottom(), - request_fast); -} - -static bool InitializeSingleGlobal(const hwasan_global &global) { - uptr full_granule_size = RoundDownTo(global.size(), 16); - TagMemoryAligned(global.addr(), full_granule_size, global.tag()); - if (global.size() % 16) - TagMemoryAligned(global.addr() + full_granule_size, 16, global.size() % 16); - return false; -} - -static void InitLoadedGlobals() { - dl_iterate_phdr( - [](dl_phdr_info *info, size_t /* size */, void * /* data */) -> int { - for (const hwasan_global &global : HwasanGlobalsFor( - info->dlpi_addr, info->dlpi_phdr, info->dlpi_phnum)) - InitializeSingleGlobal(global); - return 0; - }, - nullptr); -} - -// Prepare to run instrumented code on the main thread. -static void InitInstrumentation() { - if (hwasan_instrumentation_inited) return; - - InitializeOsSupport(); - - if (!InitShadow()) { - Printf("FATAL: HWAddressSanitizer cannot mmap the shadow memory.\n"); - DumpProcessMap(); - Die(); - } - - InitThreads(); - - hwasan_instrumentation_inited = 1; -} - -// Interface. - -uptr __hwasan_shadow_memory_dynamic_address; // Global interface symbol. - -// This function was used by the old frame descriptor mechanism. We keep it -// around to avoid breaking ABI. -void __hwasan_init_frames(uptr beg, uptr end) {} - -void __hwasan_init_static() { - InitShadowGOT(); - InitInstrumentation(); - - // In the non-static code path we call dl_iterate_phdr here. But at this point - // libc might not have been initialized enough for dl_iterate_phdr to work. - // Fortunately, since this is a statically linked executable we can use the - // linker-defined symbol __ehdr_start to find the only relevant set of phdrs. - extern ElfW(Ehdr) __ehdr_start; - for (const hwasan_global &global : HwasanGlobalsFor( - /* base */ 0, - reinterpret_cast( - reinterpret_cast(&__ehdr_start) + - __ehdr_start.e_phoff), - __ehdr_start.e_phnum)) - InitializeSingleGlobal(global); -} - -__attribute__((constructor(0))) void __hwasan_init() { - CHECK(!hwasan_init_is_running); - if (hwasan_inited) return; - hwasan_init_is_running = 1; - SanitizerToolName = "HWAddressSanitizer"; - - InitTlsSize(); - - CacheBinaryName(); - InitializeFlags(); - - // Install tool-specific callbacks in sanitizer_common. - SetCheckUnwindCallback(CheckUnwind); - - __sanitizer_set_report_path(common_flags()->log_path); - - AndroidTestTlsSlot(); - - DisableCoreDumperIfNecessary(); - - InitInstrumentation(); - InitLoadedGlobals(); - - // Needs to be called here because flags()->random_tags might not have been - // initialized when InitInstrumentation() was called. - GetCurrentThread()->EnsureRandomStateInited(); - - SetPrintfAndReportCallback(AppendToErrorMessageBuffer); - // This may call libc -> needs initialized shadow. - AndroidLogInit(); - - InitializeInterceptors(); - InstallDeadlySignalHandlers(HwasanOnDeadlySignal); - InstallAtExitHandler(); // Needs __cxa_atexit interceptor. - - InitializeCoverage(common_flags()->coverage, common_flags()->coverage_dir); - - HwasanTSDInit(); - HwasanTSDThreadInit(); - - HwasanAllocatorInit(); - HwasanInstallAtForkHandler(); - -#if HWASAN_CONTAINS_UBSAN - __ubsan::InitAsPlugin(); -#endif - - VPrintf(1, "HWAddressSanitizer init done\n"); - - hwasan_init_is_running = 0; - hwasan_inited = 1; -} - -void __hwasan_library_loaded(ElfW(Addr) base, const ElfW(Phdr) * phdr, - ElfW(Half) phnum) { - for (const hwasan_global &global : HwasanGlobalsFor(base, phdr, phnum)) - InitializeSingleGlobal(global); -} - -void __hwasan_library_unloaded(ElfW(Addr) base, const ElfW(Phdr) * phdr, - ElfW(Half) phnum) { - for (; phnum != 0; ++phdr, --phnum) - if (phdr->p_type == PT_LOAD) - TagMemory(base + phdr->p_vaddr, phdr->p_memsz, 0); -} - -void __hwasan_print_shadow(const void *p, uptr sz) { - uptr ptr_raw = UntagAddr(reinterpret_cast(p)); - uptr shadow_first = MemToShadow(ptr_raw); - uptr shadow_last = MemToShadow(ptr_raw + sz - 1); - Printf("HWASan shadow map for %zx .. %zx (pointer tag %x)\n", ptr_raw, - ptr_raw + sz, GetTagFromPointer((uptr)p)); - for (uptr s = shadow_first; s <= shadow_last; ++s) { - tag_t mem_tag = *reinterpret_cast(s); - uptr granule_addr = ShadowToMem(s); - if (mem_tag && mem_tag < kShadowAlignment) - Printf(" %zx: %02x(%02x)\n", granule_addr, mem_tag, - *reinterpret_cast(granule_addr + kShadowAlignment - 1)); - else - Printf(" %zx: %02x\n", granule_addr, mem_tag); - } -} - -sptr __hwasan_test_shadow(const void *p, uptr sz) { - if (sz == 0) - return -1; - tag_t ptr_tag = GetTagFromPointer((uptr)p); - uptr ptr_raw = UntagAddr(reinterpret_cast(p)); - uptr shadow_first = MemToShadow(ptr_raw); - uptr shadow_last = MemToShadow(ptr_raw + sz - 1); - for (uptr s = shadow_first; s <= shadow_last; ++s) - if (*(tag_t *)s != ptr_tag) { - sptr offset = ShadowToMem(s) - ptr_raw; - return offset < 0 ? 0 : offset; - } - return -1; -} - -u16 __sanitizer_unaligned_load16(const uu16 *p) { - return *p; -} -u32 __sanitizer_unaligned_load32(const uu32 *p) { - return *p; -} -u64 __sanitizer_unaligned_load64(const uu64 *p) { - return *p; -} -void __sanitizer_unaligned_store16(uu16 *p, u16 x) { - *p = x; -} -void __sanitizer_unaligned_store32(uu32 *p, u32 x) { - *p = x; -} -void __sanitizer_unaligned_store64(uu64 *p, u64 x) { - *p = x; -} - -void __hwasan_loadN(uptr p, uptr sz) { - CheckAddressSized(p, sz); -} -void __hwasan_load1(uptr p) { - CheckAddress(p); -} -void __hwasan_load2(uptr p) { - CheckAddress(p); -} -void __hwasan_load4(uptr p) { - CheckAddress(p); -} -void __hwasan_load8(uptr p) { - CheckAddress(p); -} -void __hwasan_load16(uptr p) { - CheckAddress(p); -} - -void __hwasan_loadN_noabort(uptr p, uptr sz) { - CheckAddressSized(p, sz); -} -void __hwasan_load1_noabort(uptr p) { - CheckAddress(p); -} -void __hwasan_load2_noabort(uptr p) { - CheckAddress(p); -} -void __hwasan_load4_noabort(uptr p) { - CheckAddress(p); -} -void __hwasan_load8_noabort(uptr p) { - CheckAddress(p); -} -void __hwasan_load16_noabort(uptr p) { - CheckAddress(p); -} - -void __hwasan_storeN(uptr p, uptr sz) { - CheckAddressSized(p, sz); -} -void __hwasan_store1(uptr p) { - CheckAddress(p); -} -void __hwasan_store2(uptr p) { - CheckAddress(p); -} -void __hwasan_store4(uptr p) { - CheckAddress(p); -} -void __hwasan_store8(uptr p) { - CheckAddress(p); -} -void __hwasan_store16(uptr p) { - CheckAddress(p); -} - -void __hwasan_storeN_noabort(uptr p, uptr sz) { - CheckAddressSized(p, sz); -} -void __hwasan_store1_noabort(uptr p) { - CheckAddress(p); -} -void __hwasan_store2_noabort(uptr p) { - CheckAddress(p); -} -void __hwasan_store4_noabort(uptr p) { - CheckAddress(p); -} -void __hwasan_store8_noabort(uptr p) { - CheckAddress(p); -} -void __hwasan_store16_noabort(uptr p) { - CheckAddress(p); -} - -void __hwasan_tag_memory(uptr p, u8 tag, uptr sz) { - TagMemoryAligned(p, sz, tag); -} - -uptr __hwasan_tag_pointer(uptr p, u8 tag) { - return AddTagToPointer(p, tag); -} - -void __hwasan_handle_longjmp(const void *sp_dst) { - uptr dst = (uptr)sp_dst; - // HWASan does not support tagged SP. - CHECK(GetTagFromPointer(dst) == 0); - - uptr sp = (uptr)__builtin_frame_address(0); - static const uptr kMaxExpectedCleanupSize = 64 << 20; // 64M - if (dst < sp || dst - sp > kMaxExpectedCleanupSize) { - Report( - "WARNING: HWASan is ignoring requested __hwasan_handle_longjmp: " - "stack top: %p; target %p; distance: %p (%zd)\n" - "False positive error reports may follow\n", - (void *)sp, (void *)dst, dst - sp); - return; - } - TagMemory(sp, dst - sp, 0); -} - -void __hwasan_handle_vfork(const void *sp_dst) { - uptr sp = (uptr)sp_dst; - Thread *t = GetCurrentThread(); - CHECK(t); - uptr top = t->stack_top(); - uptr bottom = t->stack_bottom(); - if (top == 0 || bottom == 0 || sp < bottom || sp >= top) { - Report( - "WARNING: HWASan is ignoring requested __hwasan_handle_vfork: " - "stack top: %zx; current %zx; bottom: %zx \n" - "False positive error reports may follow\n", - top, sp, bottom); - return; - } - TagMemory(bottom, sp - bottom, 0); -} - -extern "C" void *__hwasan_extra_spill_area() { - Thread *t = GetCurrentThread(); - return &t->vfork_spill(); -} - -void __hwasan_print_memory_usage() { - InternalScopedString s; - HwasanFormatMemoryUsage(s); - Printf("%s\n", s.data()); -} - -static const u8 kFallbackTag = 0xBB & kTagMask; - -u8 __hwasan_generate_tag() { - Thread *t = GetCurrentThread(); - if (!t) return kFallbackTag; - return t->GenerateRandomTag(); -} - -#if !SANITIZER_SUPPORTS_WEAK_HOOKS -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -const char* __hwasan_default_options() { return ""; } -} // extern "C" -#endif - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_print_stack_trace() { - GET_FATAL_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME()); - stack.Print(); -} - -// Entry point for interoperability between __hwasan_tag_mismatch (ASM) and the -// rest of the mismatch handling code (C++). -void __hwasan_tag_mismatch4(uptr addr, uptr access_info, uptr *registers_frame, - size_t outsize) { - __hwasan::HwasanTagMismatch(addr, access_info, registers_frame, outsize); -} - -} // extern "C" diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan.h deleted file mode 100644 index 371c43f3cbde..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan.h +++ /dev/null @@ -1,227 +0,0 @@ -//===-- hwasan.h ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Private Hwasan header. -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_H -#define HWASAN_H - -#include "hwasan_flags.h" -#include "hwasan_interface_internal.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "sanitizer_common/sanitizer_stacktrace.h" -#include "ubsan/ubsan_platform.h" - -#ifndef HWASAN_CONTAINS_UBSAN -# define HWASAN_CONTAINS_UBSAN CAN_SANITIZE_UB -#endif - -#ifndef HWASAN_WITH_INTERCEPTORS -#define HWASAN_WITH_INTERCEPTORS 0 -#endif - -#ifndef HWASAN_REPLACE_OPERATORS_NEW_AND_DELETE -#define HWASAN_REPLACE_OPERATORS_NEW_AND_DELETE HWASAN_WITH_INTERCEPTORS -#endif - -typedef u8 tag_t; - -#if defined(HWASAN_ALIASING_MODE) -# if !defined(__x86_64__) -# error Aliasing mode is only supported on x86_64 -# endif -// Tags are done in middle bits using userspace aliasing. -constexpr unsigned kAddressTagShift = 39; -constexpr unsigned kTagBits = 3; - -// The alias region is placed next to the shadow so the upper bits of all -// taggable addresses matches the upper bits of the shadow base. This shift -// value determines which upper bits must match. It has a floor of 44 since the -// shadow is always 8TB. -// TODO(morehouse): In alias mode we can shrink the shadow and use a -// simpler/faster shadow calculation. -constexpr unsigned kTaggableRegionCheckShift = - __sanitizer::Max(kAddressTagShift + kTagBits + 1U, 44U); -#elif defined(__x86_64__) -// Tags are done in upper bits using Intel LAM. -constexpr unsigned kAddressTagShift = 57; -constexpr unsigned kTagBits = 6; -#else -// TBI (Top Byte Ignore) feature of AArch64: bits [63:56] are ignored in address -// translation and can be used to store a tag. -constexpr unsigned kAddressTagShift = 56; -constexpr unsigned kTagBits = 8; -#endif // defined(HWASAN_ALIASING_MODE) - -// Mask for extracting tag bits from the lower 8 bits. -constexpr uptr kTagMask = (1UL << kTagBits) - 1; - -// Mask for extracting tag bits from full pointers. -constexpr uptr kAddressTagMask = kTagMask << kAddressTagShift; - -// Minimal alignment of the shadow base address. Determines the space available -// for threads and stack histories. This is an ABI constant. -const unsigned kShadowBaseAlignment = 32; - -const unsigned kRecordAddrBaseTagShift = 3; -const unsigned kRecordFPShift = 48; -const unsigned kRecordFPLShift = 4; -const unsigned kRecordFPModulus = 1 << (64 - kRecordFPShift + kRecordFPLShift); - -static inline tag_t GetTagFromPointer(uptr p) { - return (p >> kAddressTagShift) & kTagMask; -} - -static inline uptr UntagAddr(uptr tagged_addr) { - return tagged_addr & ~kAddressTagMask; -} - -static inline void *UntagPtr(const void *tagged_ptr) { - return reinterpret_cast( - UntagAddr(reinterpret_cast(tagged_ptr))); -} - -static inline uptr AddTagToPointer(uptr p, tag_t tag) { - return (p & ~kAddressTagMask) | ((uptr)tag << kAddressTagShift); -} - -namespace __hwasan { - -extern int hwasan_inited; -extern bool hwasan_init_is_running; -extern int hwasan_report_count; - -bool InitShadow(); -void InitializeOsSupport(); -void InitThreads(); -void InitializeInterceptors(); - -void HwasanAllocatorInit(); -void HwasanAllocatorLock(); -void HwasanAllocatorUnlock(); - -void *hwasan_malloc(uptr size, StackTrace *stack); -void *hwasan_calloc(uptr nmemb, uptr size, StackTrace *stack); -void *hwasan_realloc(void *ptr, uptr size, StackTrace *stack); -void *hwasan_reallocarray(void *ptr, uptr nmemb, uptr size, StackTrace *stack); -void *hwasan_valloc(uptr size, StackTrace *stack); -void *hwasan_pvalloc(uptr size, StackTrace *stack); -void *hwasan_aligned_alloc(uptr alignment, uptr size, StackTrace *stack); -void *hwasan_memalign(uptr alignment, uptr size, StackTrace *stack); -int hwasan_posix_memalign(void **memptr, uptr alignment, uptr size, - StackTrace *stack); -void hwasan_free(void *ptr, StackTrace *stack); - -void InstallAtExitHandler(); - -#define GET_MALLOC_STACK_TRACE \ - BufferedStackTrace stack; \ - if (hwasan_inited) \ - stack.Unwind(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \ - nullptr, common_flags()->fast_unwind_on_malloc, \ - common_flags()->malloc_context_size) - -#define GET_FATAL_STACK_TRACE_PC_BP(pc, bp) \ - BufferedStackTrace stack; \ - if (hwasan_inited) \ - stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal) - -void HwasanTSDInit(); -void HwasanTSDThreadInit(); -void HwasanAtExit(); - -void HwasanOnDeadlySignal(int signo, void *info, void *context); - -void HwasanInstallAtForkHandler(); - -void UpdateMemoryUsage(); - -void AppendToErrorMessageBuffer(const char *buffer); - -void AndroidTestTlsSlot(); - -// This is a compiler-generated struct that can be shared between hwasan -// implementations. -struct AccessInfo { - uptr addr; - uptr size; - bool is_store; - bool is_load; - bool recover; -}; - -// Given access info and frame information, unwind the stack and report the tag -// mismatch. -void HandleTagMismatch(AccessInfo ai, uptr pc, uptr frame, void *uc, - uptr *registers_frame = nullptr); - -// This dispatches to HandleTagMismatch but sets up the AccessInfo, program -// counter, and frame pointer. -void HwasanTagMismatch(uptr addr, uptr access_info, uptr *registers_frame, - size_t outsize); - -} // namespace __hwasan - -#define HWASAN_MALLOC_HOOK(ptr, size) \ - do { \ - if (&__sanitizer_malloc_hook) { \ - __sanitizer_malloc_hook(ptr, size); \ - } \ - RunMallocHooks(ptr, size); \ - } while (false) -#define HWASAN_FREE_HOOK(ptr) \ - do { \ - if (&__sanitizer_free_hook) { \ - __sanitizer_free_hook(ptr); \ - } \ - RunFreeHooks(ptr); \ - } while (false) - -#if HWASAN_WITH_INTERCEPTORS -// For both bionic and glibc __sigset_t is an unsigned long. -typedef unsigned long __hw_sigset_t; -// Setjmp and longjmp implementations are platform specific, and hence the -// interception code is platform specific too. -# if defined(__aarch64__) -constexpr size_t kHwRegisterBufSize = 22; -# elif defined(__x86_64__) -constexpr size_t kHwRegisterBufSize = 8; -# endif -typedef unsigned long long __hw_register_buf[kHwRegisterBufSize]; -struct __hw_jmp_buf_struct { - // NOTE: The machine-dependent definition of `__sigsetjmp' - // assume that a `__hw_jmp_buf' begins with a `__hw_register_buf' and that - // `__mask_was_saved' follows it. Do not move these members or add others - // before it. - // - // We add a __magic field to our struct to catch cases where libc's setjmp - // populated the jmp_buf instead of our interceptor. - __hw_register_buf __jmpbuf; // Calling environment. - unsigned __mask_was_saved : 1; // Saved the signal mask? - unsigned __magic : 31; // Used to distinguish __hw_jmp_buf from jmp_buf. - __hw_sigset_t __saved_mask; // Saved signal mask. -}; -typedef struct __hw_jmp_buf_struct __hw_jmp_buf[1]; -typedef struct __hw_jmp_buf_struct __hw_sigjmp_buf[1]; -constexpr unsigned kHwJmpBufMagic = 0x248ACE77; -#endif // HWASAN_WITH_INTERCEPTORS - -#define ENSURE_HWASAN_INITED() \ - do { \ - CHECK(!hwasan_init_is_running); \ - if (!hwasan_inited) { \ - __hwasan_init(); \ - } \ - } while (0) - -#endif // HWASAN_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocation_functions.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocation_functions.cpp deleted file mode 100644 index 9cd82dbabd19..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocation_functions.cpp +++ /dev/null @@ -1,175 +0,0 @@ -//===-- hwasan_allocation_functions.cpp -----------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Definitions for __sanitizer allocation functions. -// -//===----------------------------------------------------------------------===// - -#include "hwasan.h" -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_allocator_dlsym.h" -#include "sanitizer_common/sanitizer_allocator_interface.h" -#include "sanitizer_common/sanitizer_tls_get_addr.h" - -#if !SANITIZER_FUCHSIA - -using namespace __hwasan; - -struct DlsymAlloc : public DlSymAllocator { - static bool UseImpl() { return !hwasan_inited; } -}; - -extern "C" { - -SANITIZER_INTERFACE_ATTRIBUTE -int __sanitizer_posix_memalign(void **memptr, uptr alignment, uptr size) { - GET_MALLOC_STACK_TRACE; - CHECK_NE(memptr, 0); - int res = hwasan_posix_memalign(memptr, alignment, size, &stack); - return res; -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer_memalign(uptr alignment, uptr size) { - GET_MALLOC_STACK_TRACE; - return hwasan_memalign(alignment, size, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer_aligned_alloc(uptr alignment, uptr size) { - GET_MALLOC_STACK_TRACE; - return hwasan_aligned_alloc(alignment, size, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer___libc_memalign(uptr alignment, uptr size) { - GET_MALLOC_STACK_TRACE; - void *ptr = hwasan_memalign(alignment, size, &stack); - if (ptr) - DTLS_on_libc_memalign(ptr, size); - return ptr; -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer_valloc(uptr size) { - GET_MALLOC_STACK_TRACE; - return hwasan_valloc(size, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer_pvalloc(uptr size) { - GET_MALLOC_STACK_TRACE; - return hwasan_pvalloc(size, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_free(void *ptr) { - if (!ptr) - return; - if (DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Free(ptr); - GET_MALLOC_STACK_TRACE; - hwasan_free(ptr, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_cfree(void *ptr) { - if (!ptr) - return; - if (DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Free(ptr); - GET_MALLOC_STACK_TRACE; - hwasan_free(ptr, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -uptr __sanitizer_malloc_usable_size(const void *ptr) { - return __sanitizer_get_allocated_size(ptr); -} - -SANITIZER_INTERFACE_ATTRIBUTE -struct __sanitizer_struct_mallinfo __sanitizer_mallinfo() { - __sanitizer_struct_mallinfo sret; - internal_memset(&sret, 0, sizeof(sret)); - return sret; -} - -SANITIZER_INTERFACE_ATTRIBUTE -int __sanitizer_mallopt(int cmd, int value) { return 0; } - -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_malloc_stats(void) { - // FIXME: implement, but don't call REAL(malloc_stats)! -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer_calloc(uptr nmemb, uptr size) { - if (DlsymAlloc::Use()) - return DlsymAlloc::Callocate(nmemb, size); - GET_MALLOC_STACK_TRACE; - return hwasan_calloc(nmemb, size, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer_realloc(void *ptr, uptr size) { - if (DlsymAlloc::Use() || DlsymAlloc::PointerIsMine(ptr)) - return DlsymAlloc::Realloc(ptr, size); - GET_MALLOC_STACK_TRACE; - return hwasan_realloc(ptr, size, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer_reallocarray(void *ptr, uptr nmemb, uptr size) { - GET_MALLOC_STACK_TRACE; - return hwasan_reallocarray(ptr, nmemb, size, &stack); -} - -SANITIZER_INTERFACE_ATTRIBUTE -void *__sanitizer_malloc(uptr size) { - if (UNLIKELY(!hwasan_init_is_running)) - ENSURE_HWASAN_INITED(); - if (DlsymAlloc::Use()) - return DlsymAlloc::Allocate(size); - GET_MALLOC_STACK_TRACE; - return hwasan_malloc(size, &stack); -} - -} // extern "C" - -#if HWASAN_WITH_INTERCEPTORS -# define INTERCEPTOR_ALIAS(RET, FN, ARGS...) \ - extern "C" SANITIZER_INTERFACE_ATTRIBUTE RET WRAP(FN)(ARGS) \ - ALIAS("__sanitizer_" #FN); \ - extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE RET FN( \ - ARGS) ALIAS("__sanitizer_" #FN) - -INTERCEPTOR_ALIAS(int, posix_memalign, void **memptr, SIZE_T alignment, - SIZE_T size); -INTERCEPTOR_ALIAS(void *, aligned_alloc, SIZE_T alignment, SIZE_T size); -INTERCEPTOR_ALIAS(void *, __libc_memalign, SIZE_T alignment, SIZE_T size); -INTERCEPTOR_ALIAS(void *, valloc, SIZE_T size); -INTERCEPTOR_ALIAS(void, free, void *ptr); -INTERCEPTOR_ALIAS(uptr, malloc_usable_size, const void *ptr); -INTERCEPTOR_ALIAS(void *, calloc, SIZE_T nmemb, SIZE_T size); -INTERCEPTOR_ALIAS(void *, realloc, void *ptr, SIZE_T size); -INTERCEPTOR_ALIAS(void *, reallocarray, void *ptr, SIZE_T nmemb, SIZE_T size); -INTERCEPTOR_ALIAS(void *, malloc, SIZE_T size); - -# if !SANITIZER_FREEBSD && !SANITIZER_NETBSD -INTERCEPTOR_ALIAS(void *, memalign, SIZE_T alignment, SIZE_T size); -INTERCEPTOR_ALIAS(void *, pvalloc, SIZE_T size); -INTERCEPTOR_ALIAS(void, cfree, void *ptr); -INTERCEPTOR_ALIAS(__sanitizer_struct_mallinfo, mallinfo); -INTERCEPTOR_ALIAS(int, mallopt, int cmd, int value); -INTERCEPTOR_ALIAS(void, malloc_stats, void); -# endif -#endif // #if HWASAN_WITH_INTERCEPTORS - -#endif // SANITIZER_FUCHSIA diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocator.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocator.cpp deleted file mode 100644 index 84e183f2384f..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocator.cpp +++ /dev/null @@ -1,484 +0,0 @@ -//===-- hwasan_allocator.cpp ------------------------ ---------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// HWAddressSanitizer allocator. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_atomic.h" -#include "sanitizer_common/sanitizer_errno.h" -#include "sanitizer_common/sanitizer_stackdepot.h" -#include "hwasan.h" -#include "hwasan_allocator.h" -#include "hwasan_checks.h" -#include "hwasan_mapping.h" -#include "hwasan_malloc_bisect.h" -#include "hwasan_thread.h" -#include "hwasan_report.h" - -namespace __hwasan { - -static Allocator allocator; -static AllocatorCache fallback_allocator_cache; -static SpinMutex fallback_mutex; -static atomic_uint8_t hwasan_allocator_tagging_enabled; - -static constexpr tag_t kFallbackAllocTag = 0xBB & kTagMask; -static constexpr tag_t kFallbackFreeTag = 0xBC; - -enum RightAlignMode { - kRightAlignNever, - kRightAlignSometimes, - kRightAlignAlways -}; - -// Initialized in HwasanAllocatorInit, an never changed. -static ALIGNED(16) u8 tail_magic[kShadowAlignment - 1]; - -bool HwasanChunkView::IsAllocated() const { - return metadata_ && metadata_->alloc_context_id && - metadata_->get_requested_size(); -} - -// Aligns the 'addr' right to the granule boundary. -static uptr AlignRight(uptr addr, uptr requested_size) { - uptr tail_size = requested_size % kShadowAlignment; - if (!tail_size) return addr; - return addr + kShadowAlignment - tail_size; -} - -uptr HwasanChunkView::Beg() const { - if (metadata_ && metadata_->right_aligned) - return AlignRight(block_, metadata_->get_requested_size()); - return block_; -} -uptr HwasanChunkView::End() const { - return Beg() + UsedSize(); -} -uptr HwasanChunkView::UsedSize() const { - return metadata_->get_requested_size(); -} -u32 HwasanChunkView::GetAllocStackId() const { - return metadata_->alloc_context_id; -} - -uptr HwasanChunkView::ActualSize() const { - return allocator.GetActuallyAllocatedSize(reinterpret_cast(block_)); -} - -bool HwasanChunkView::FromSmallHeap() const { - return allocator.FromPrimary(reinterpret_cast(block_)); -} - -void GetAllocatorStats(AllocatorStatCounters s) { - allocator.GetStats(s); -} - -uptr GetAliasRegionStart() { -#if defined(HWASAN_ALIASING_MODE) - constexpr uptr kAliasRegionOffset = 1ULL << (kTaggableRegionCheckShift - 1); - uptr AliasRegionStart = - __hwasan_shadow_memory_dynamic_address + kAliasRegionOffset; - - CHECK_EQ(AliasRegionStart >> kTaggableRegionCheckShift, - __hwasan_shadow_memory_dynamic_address >> kTaggableRegionCheckShift); - CHECK_EQ( - (AliasRegionStart + kAliasRegionOffset - 1) >> kTaggableRegionCheckShift, - __hwasan_shadow_memory_dynamic_address >> kTaggableRegionCheckShift); - return AliasRegionStart; -#else - return 0; -#endif -} - -void HwasanAllocatorInit() { - atomic_store_relaxed(&hwasan_allocator_tagging_enabled, - !flags()->disable_allocator_tagging); - SetAllocatorMayReturnNull(common_flags()->allocator_may_return_null); - allocator.Init(common_flags()->allocator_release_to_os_interval_ms, - GetAliasRegionStart()); - for (uptr i = 0; i < sizeof(tail_magic); i++) - tail_magic[i] = GetCurrentThread()->GenerateRandomTag(); -} - -void HwasanAllocatorLock() { allocator.ForceLock(); } - -void HwasanAllocatorUnlock() { allocator.ForceUnlock(); } - -void AllocatorSwallowThreadLocalCache(AllocatorCache *cache) { - allocator.SwallowCache(cache); -} - -static uptr TaggedSize(uptr size) { - if (!size) size = 1; - uptr new_size = RoundUpTo(size, kShadowAlignment); - CHECK_GE(new_size, size); - return new_size; -} - -static void *HwasanAllocate(StackTrace *stack, uptr orig_size, uptr alignment, - bool zeroise) { - if (orig_size > kMaxAllowedMallocSize) { - if (AllocatorMayReturnNull()) { - Report("WARNING: HWAddressSanitizer failed to allocate 0x%zx bytes\n", - orig_size); - return nullptr; - } - ReportAllocationSizeTooBig(orig_size, kMaxAllowedMallocSize, stack); - } - if (UNLIKELY(IsRssLimitExceeded())) { - if (AllocatorMayReturnNull()) - return nullptr; - ReportRssLimitExceeded(stack); - } - - alignment = Max(alignment, kShadowAlignment); - uptr size = TaggedSize(orig_size); - Thread *t = GetCurrentThread(); - void *allocated; - if (t) { - allocated = allocator.Allocate(t->allocator_cache(), size, alignment); - } else { - SpinMutexLock l(&fallback_mutex); - AllocatorCache *cache = &fallback_allocator_cache; - allocated = allocator.Allocate(cache, size, alignment); - } - if (UNLIKELY(!allocated)) { - SetAllocatorOutOfMemory(); - if (AllocatorMayReturnNull()) - return nullptr; - ReportOutOfMemory(size, stack); - } - Metadata *meta = - reinterpret_cast(allocator.GetMetaData(allocated)); - meta->set_requested_size(orig_size); - meta->alloc_context_id = StackDepotPut(*stack); - meta->right_aligned = false; - if (zeroise) { - internal_memset(allocated, 0, size); - } else if (flags()->max_malloc_fill_size > 0) { - uptr fill_size = Min(size, (uptr)flags()->max_malloc_fill_size); - internal_memset(allocated, flags()->malloc_fill_byte, fill_size); - } - if (size != orig_size) { - u8 *tail = reinterpret_cast(allocated) + orig_size; - uptr tail_length = size - orig_size; - internal_memcpy(tail, tail_magic, tail_length - 1); - // Short granule is excluded from magic tail, so we explicitly untag. - tail[tail_length - 1] = 0; - } - - void *user_ptr = allocated; - // Tagging can only be skipped when both tag_in_malloc and tag_in_free are - // false. When tag_in_malloc = false and tag_in_free = true malloc needs to - // retag to 0. - if (InTaggableRegion(reinterpret_cast(user_ptr)) && - (flags()->tag_in_malloc || flags()->tag_in_free) && - atomic_load_relaxed(&hwasan_allocator_tagging_enabled)) { - if (flags()->tag_in_malloc && malloc_bisect(stack, orig_size)) { - tag_t tag = t ? t->GenerateRandomTag() : kFallbackAllocTag; - uptr tag_size = orig_size ? orig_size : 1; - uptr full_granule_size = RoundDownTo(tag_size, kShadowAlignment); - user_ptr = - (void *)TagMemoryAligned((uptr)user_ptr, full_granule_size, tag); - if (full_granule_size != tag_size) { - u8 *short_granule = - reinterpret_cast(allocated) + full_granule_size; - TagMemoryAligned((uptr)short_granule, kShadowAlignment, - tag_size % kShadowAlignment); - short_granule[kShadowAlignment - 1] = tag; - } - } else { - user_ptr = (void *)TagMemoryAligned((uptr)user_ptr, size, 0); - } - } - - HWASAN_MALLOC_HOOK(user_ptr, size); - return user_ptr; -} - -static bool PointerAndMemoryTagsMatch(void *tagged_ptr) { - CHECK(tagged_ptr); - uptr tagged_uptr = reinterpret_cast(tagged_ptr); - if (!InTaggableRegion(tagged_uptr)) - return true; - tag_t mem_tag = *reinterpret_cast( - MemToShadow(reinterpret_cast(UntagPtr(tagged_ptr)))); - return PossiblyShortTagMatches(mem_tag, tagged_uptr, 1); -} - -static bool CheckInvalidFree(StackTrace *stack, void *untagged_ptr, - void *tagged_ptr) { - // This function can return true if halt_on_error is false. - if (!MemIsApp(reinterpret_cast(untagged_ptr)) || - !PointerAndMemoryTagsMatch(tagged_ptr)) { - ReportInvalidFree(stack, reinterpret_cast(tagged_ptr)); - return true; - } - return false; -} - -static void HwasanDeallocate(StackTrace *stack, void *tagged_ptr) { - CHECK(tagged_ptr); - HWASAN_FREE_HOOK(tagged_ptr); - - bool in_taggable_region = - InTaggableRegion(reinterpret_cast(tagged_ptr)); - void *untagged_ptr = in_taggable_region ? UntagPtr(tagged_ptr) : tagged_ptr; - - if (CheckInvalidFree(stack, untagged_ptr, tagged_ptr)) - return; - - void *aligned_ptr = reinterpret_cast( - RoundDownTo(reinterpret_cast(untagged_ptr), kShadowAlignment)); - tag_t pointer_tag = GetTagFromPointer(reinterpret_cast(tagged_ptr)); - Metadata *meta = - reinterpret_cast(allocator.GetMetaData(aligned_ptr)); - if (!meta) { - ReportInvalidFree(stack, reinterpret_cast(tagged_ptr)); - return; - } - uptr orig_size = meta->get_requested_size(); - u32 free_context_id = StackDepotPut(*stack); - u32 alloc_context_id = meta->alloc_context_id; - - // Check tail magic. - uptr tagged_size = TaggedSize(orig_size); - if (flags()->free_checks_tail_magic && orig_size && - tagged_size != orig_size) { - uptr tail_size = tagged_size - orig_size - 1; - CHECK_LT(tail_size, kShadowAlignment); - void *tail_beg = reinterpret_cast( - reinterpret_cast(aligned_ptr) + orig_size); - tag_t short_granule_memtag = *(reinterpret_cast( - reinterpret_cast(tail_beg) + tail_size)); - if (tail_size && - (internal_memcmp(tail_beg, tail_magic, tail_size) || - (in_taggable_region && pointer_tag != short_granule_memtag))) - ReportTailOverwritten(stack, reinterpret_cast(tagged_ptr), - orig_size, tail_magic); - } - - meta->set_requested_size(0); - meta->alloc_context_id = 0; - // This memory will not be reused by anyone else, so we are free to keep it - // poisoned. - Thread *t = GetCurrentThread(); - if (flags()->max_free_fill_size > 0) { - uptr fill_size = - Min(TaggedSize(orig_size), (uptr)flags()->max_free_fill_size); - internal_memset(aligned_ptr, flags()->free_fill_byte, fill_size); - } - if (in_taggable_region && flags()->tag_in_free && malloc_bisect(stack, 0) && - atomic_load_relaxed(&hwasan_allocator_tagging_enabled)) { - // Always store full 8-bit tags on free to maximize UAF detection. - tag_t tag; - if (t) { - // Make sure we are not using a short granule tag as a poison tag. This - // would make us attempt to read the memory on a UaF. - // The tag can be zero if tagging is disabled on this thread. - do { - tag = t->GenerateRandomTag(/*num_bits=*/8); - } while ( - UNLIKELY((tag < kShadowAlignment || tag == pointer_tag) && tag != 0)); - } else { - static_assert(kFallbackFreeTag >= kShadowAlignment, - "fallback tag must not be a short granule tag."); - tag = kFallbackFreeTag; - } - TagMemoryAligned(reinterpret_cast(aligned_ptr), TaggedSize(orig_size), - tag); - } - if (t) { - allocator.Deallocate(t->allocator_cache(), aligned_ptr); - if (auto *ha = t->heap_allocations()) - ha->push({reinterpret_cast(tagged_ptr), alloc_context_id, - free_context_id, static_cast(orig_size)}); - } else { - SpinMutexLock l(&fallback_mutex); - AllocatorCache *cache = &fallback_allocator_cache; - allocator.Deallocate(cache, aligned_ptr); - } -} - -static void *HwasanReallocate(StackTrace *stack, void *tagged_ptr_old, - uptr new_size, uptr alignment) { - void *untagged_ptr_old = - InTaggableRegion(reinterpret_cast(tagged_ptr_old)) - ? UntagPtr(tagged_ptr_old) - : tagged_ptr_old; - if (CheckInvalidFree(stack, untagged_ptr_old, tagged_ptr_old)) - return nullptr; - void *tagged_ptr_new = - HwasanAllocate(stack, new_size, alignment, false /*zeroise*/); - if (tagged_ptr_old && tagged_ptr_new) { - Metadata *meta = - reinterpret_cast(allocator.GetMetaData(untagged_ptr_old)); - internal_memcpy( - UntagPtr(tagged_ptr_new), untagged_ptr_old, - Min(new_size, static_cast(meta->get_requested_size()))); - HwasanDeallocate(stack, tagged_ptr_old); - } - return tagged_ptr_new; -} - -static void *HwasanCalloc(StackTrace *stack, uptr nmemb, uptr size) { - if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { - if (AllocatorMayReturnNull()) - return nullptr; - ReportCallocOverflow(nmemb, size, stack); - } - return HwasanAllocate(stack, nmemb * size, sizeof(u64), true); -} - -HwasanChunkView FindHeapChunkByAddress(uptr address) { - if (!allocator.PointerIsMine(reinterpret_cast(address))) - return HwasanChunkView(); - void *block = allocator.GetBlockBegin(reinterpret_cast(address)); - if (!block) - return HwasanChunkView(); - Metadata *metadata = - reinterpret_cast(allocator.GetMetaData(block)); - return HwasanChunkView(reinterpret_cast(block), metadata); -} - -static uptr AllocationSize(const void *tagged_ptr) { - const void *untagged_ptr = UntagPtr(tagged_ptr); - if (!untagged_ptr) return 0; - const void *beg = allocator.GetBlockBegin(untagged_ptr); - Metadata *b = (Metadata *)allocator.GetMetaData(untagged_ptr); - if (b->right_aligned) { - if (beg != reinterpret_cast(RoundDownTo( - reinterpret_cast(untagged_ptr), kShadowAlignment))) - return 0; - } else { - if (beg != untagged_ptr) return 0; - } - return b->get_requested_size(); -} - -void *hwasan_malloc(uptr size, StackTrace *stack) { - return SetErrnoOnNull(HwasanAllocate(stack, size, sizeof(u64), false)); -} - -void *hwasan_calloc(uptr nmemb, uptr size, StackTrace *stack) { - return SetErrnoOnNull(HwasanCalloc(stack, nmemb, size)); -} - -void *hwasan_realloc(void *ptr, uptr size, StackTrace *stack) { - if (!ptr) - return SetErrnoOnNull(HwasanAllocate(stack, size, sizeof(u64), false)); - if (size == 0) { - HwasanDeallocate(stack, ptr); - return nullptr; - } - return SetErrnoOnNull(HwasanReallocate(stack, ptr, size, sizeof(u64))); -} - -void *hwasan_reallocarray(void *ptr, uptr nmemb, uptr size, StackTrace *stack) { - if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { - errno = errno_ENOMEM; - if (AllocatorMayReturnNull()) - return nullptr; - ReportReallocArrayOverflow(nmemb, size, stack); - } - return hwasan_realloc(ptr, nmemb * size, stack); -} - -void *hwasan_valloc(uptr size, StackTrace *stack) { - return SetErrnoOnNull( - HwasanAllocate(stack, size, GetPageSizeCached(), false)); -} - -void *hwasan_pvalloc(uptr size, StackTrace *stack) { - uptr PageSize = GetPageSizeCached(); - if (UNLIKELY(CheckForPvallocOverflow(size, PageSize))) { - errno = errno_ENOMEM; - if (AllocatorMayReturnNull()) - return nullptr; - ReportPvallocOverflow(size, stack); - } - // pvalloc(0) should allocate one page. - size = size ? RoundUpTo(size, PageSize) : PageSize; - return SetErrnoOnNull(HwasanAllocate(stack, size, PageSize, false)); -} - -void *hwasan_aligned_alloc(uptr alignment, uptr size, StackTrace *stack) { - if (UNLIKELY(!CheckAlignedAllocAlignmentAndSize(alignment, size))) { - errno = errno_EINVAL; - if (AllocatorMayReturnNull()) - return nullptr; - ReportInvalidAlignedAllocAlignment(size, alignment, stack); - } - return SetErrnoOnNull(HwasanAllocate(stack, size, alignment, false)); -} - -void *hwasan_memalign(uptr alignment, uptr size, StackTrace *stack) { - if (UNLIKELY(!IsPowerOfTwo(alignment))) { - errno = errno_EINVAL; - if (AllocatorMayReturnNull()) - return nullptr; - ReportInvalidAllocationAlignment(alignment, stack); - } - return SetErrnoOnNull(HwasanAllocate(stack, size, alignment, false)); -} - -int hwasan_posix_memalign(void **memptr, uptr alignment, uptr size, - StackTrace *stack) { - if (UNLIKELY(!CheckPosixMemalignAlignment(alignment))) { - if (AllocatorMayReturnNull()) - return errno_EINVAL; - ReportInvalidPosixMemalignAlignment(alignment, stack); - } - void *ptr = HwasanAllocate(stack, size, alignment, false); - if (UNLIKELY(!ptr)) - // OOM error is already taken care of by HwasanAllocate. - return errno_ENOMEM; - CHECK(IsAligned((uptr)ptr, alignment)); - *memptr = ptr; - return 0; -} - -void hwasan_free(void *ptr, StackTrace *stack) { - return HwasanDeallocate(stack, ptr); -} - -} // namespace __hwasan - -using namespace __hwasan; - -void __hwasan_enable_allocator_tagging() { - atomic_store_relaxed(&hwasan_allocator_tagging_enabled, 1); -} - -void __hwasan_disable_allocator_tagging() { - atomic_store_relaxed(&hwasan_allocator_tagging_enabled, 0); -} - -uptr __sanitizer_get_current_allocated_bytes() { - uptr stats[AllocatorStatCount]; - allocator.GetStats(stats); - return stats[AllocatorStatAllocated]; -} - -uptr __sanitizer_get_heap_size() { - uptr stats[AllocatorStatCount]; - allocator.GetStats(stats); - return stats[AllocatorStatMapped]; -} - -uptr __sanitizer_get_free_bytes() { return 1; } - -uptr __sanitizer_get_unmapped_bytes() { return 1; } - -uptr __sanitizer_get_estimated_allocated_size(uptr size) { return size; } - -int __sanitizer_get_ownership(const void *p) { return AllocationSize(p) != 0; } - -uptr __sanitizer_get_allocated_size(const void *p) { return AllocationSize(p); } diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocator.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocator.h deleted file mode 100644 index 35c3d6b4bf43..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_allocator.h +++ /dev/null @@ -1,125 +0,0 @@ -//===-- hwasan_allocator.h --------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_ALLOCATOR_H -#define HWASAN_ALLOCATOR_H - -#include "hwasan.h" -#include "hwasan_interface_internal.h" -#include "hwasan_mapping.h" -#include "hwasan_poisoning.h" -#include "sanitizer_common/sanitizer_allocator.h" -#include "sanitizer_common/sanitizer_allocator_checks.h" -#include "sanitizer_common/sanitizer_allocator_interface.h" -#include "sanitizer_common/sanitizer_allocator_report.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_ring_buffer.h" - -#if !defined(__aarch64__) && !defined(__x86_64__) -#error Unsupported platform -#endif - -namespace __hwasan { - -struct Metadata { - u32 requested_size_low; - u32 requested_size_high : 31; - u32 right_aligned : 1; - u32 alloc_context_id; - u64 get_requested_size() { - return (static_cast(requested_size_high) << 32) + requested_size_low; - } - void set_requested_size(u64 size) { - requested_size_low = size & ((1ul << 32) - 1); - requested_size_high = size >> 32; - } -}; - -struct HwasanMapUnmapCallback { - void OnMap(uptr p, uptr size) const { UpdateMemoryUsage(); } - void OnUnmap(uptr p, uptr size) const { - // We are about to unmap a chunk of user memory. - // It can return as user-requested mmap() or another thread stack. - // Make it accessible with zero-tagged pointer. - TagMemory(p, size, 0); - } -}; - -static const uptr kMaxAllowedMallocSize = 1UL << 40; // 1T - -struct AP64 { - static const uptr kSpaceBeg = ~0ULL; - -#if defined(HWASAN_ALIASING_MODE) - static const uptr kSpaceSize = 1ULL << kAddressTagShift; -#else - static const uptr kSpaceSize = 0x2000000000ULL; -#endif - static const uptr kMetadataSize = sizeof(Metadata); - typedef __sanitizer::VeryDenseSizeClassMap SizeClassMap; - using AddressSpaceView = LocalAddressSpaceView; - typedef HwasanMapUnmapCallback MapUnmapCallback; - static const uptr kFlags = 0; -}; -typedef SizeClassAllocator64 PrimaryAllocator; -typedef CombinedAllocator Allocator; -typedef Allocator::AllocatorCache AllocatorCache; - -void AllocatorSwallowThreadLocalCache(AllocatorCache *cache); - -class HwasanChunkView { - public: - HwasanChunkView() : block_(0), metadata_(nullptr) {} - HwasanChunkView(uptr block, Metadata *metadata) - : block_(block), metadata_(metadata) {} - bool IsAllocated() const; // Checks if the memory is currently allocated - uptr Beg() const; // First byte of user memory - uptr End() const; // Last byte of user memory - uptr UsedSize() const; // Size requested by the user - uptr ActualSize() const; // Size allocated by the allocator. - u32 GetAllocStackId() const; - bool FromSmallHeap() const; - private: - uptr block_; - Metadata *const metadata_; -}; - -HwasanChunkView FindHeapChunkByAddress(uptr address); - -// Information about one (de)allocation that happened in the past. -// These are recorded in a thread-local ring buffer. -// TODO: this is currently 24 bytes (20 bytes + alignment). -// Compress it to 16 bytes or extend it to be more useful. -struct HeapAllocationRecord { - uptr tagged_addr; - u32 alloc_context_id; - u32 free_context_id; - u32 requested_size; -}; - -typedef RingBuffer HeapAllocationsRingBuffer; - -void GetAllocatorStats(AllocatorStatCounters s); - -inline bool InTaggableRegion(uptr addr) { -#if defined(HWASAN_ALIASING_MODE) - // Aliases are mapped next to shadow so that the upper bits match the shadow - // base. - return (addr >> kTaggableRegionCheckShift) == - (GetShadowOffset() >> kTaggableRegionCheckShift); -#endif - return true; -} - -} // namespace __hwasan - -#endif // HWASAN_ALLOCATOR_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_checks.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_checks.h deleted file mode 100644 index ab543ea88beb..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_checks.h +++ /dev/null @@ -1,127 +0,0 @@ -//===-- hwasan_checks.h -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_CHECKS_H -#define HWASAN_CHECKS_H - -#include "hwasan_allocator.h" -#include "hwasan_mapping.h" -#include "sanitizer_common/sanitizer_common.h" - -namespace __hwasan { -template -__attribute__((always_inline)) static void SigTrap(uptr p) { -#if defined(__aarch64__) - (void)p; - // 0x900 is added to do not interfere with the kernel use of lower values of - // brk immediate. - register uptr x0 asm("x0") = p; - asm("brk %1\n\t" ::"r"(x0), "n"(0x900 + X)); -#elif defined(__x86_64__) - // INT3 + NOP DWORD ptr [EAX + X] to pass X to our signal handler, 5 bytes - // total. The pointer is passed via rdi. - // 0x40 is added as a safeguard, to help distinguish our trap from others and - // to avoid 0 offsets in the command (otherwise it'll be reduced to a - // different nop command, the three bytes one). - asm volatile( - "int3\n" - "nopl %c0(%%rax)\n" ::"n"(0x40 + X), - "D"(p)); -#else - // FIXME: not always sigill. - __builtin_trap(); -#endif - // __builtin_unreachable(); -} - -// Version with access size which is not power of 2 -template -__attribute__((always_inline)) static void SigTrap(uptr p, uptr size) { -#if defined(__aarch64__) - register uptr x0 asm("x0") = p; - register uptr x1 asm("x1") = size; - asm("brk %2\n\t" ::"r"(x0), "r"(x1), "n"(0x900 + X)); -#elif defined(__x86_64__) - // Size is stored in rsi. - asm volatile( - "int3\n" - "nopl %c0(%%rax)\n" ::"n"(0x40 + X), - "D"(p), "S"(size)); -#else - __builtin_trap(); -#endif - // __builtin_unreachable(); -} - -__attribute__((always_inline, nodebug)) static bool PossiblyShortTagMatches( - tag_t mem_tag, uptr ptr, uptr sz) { - tag_t ptr_tag = GetTagFromPointer(ptr); - if (ptr_tag == mem_tag) - return true; - if (mem_tag >= kShadowAlignment) - return false; - if ((ptr & (kShadowAlignment - 1)) + sz > mem_tag) - return false; -#ifndef __aarch64__ - ptr = UntagAddr(ptr); -#endif - return *(u8 *)(ptr | (kShadowAlignment - 1)) == ptr_tag; -} - -enum class ErrorAction { Abort, Recover }; -enum class AccessType { Load, Store }; - -template -__attribute__((always_inline, nodebug)) static void CheckAddress(uptr p) { - if (!InTaggableRegion(p)) - return; - uptr ptr_raw = p & ~kAddressTagMask; - tag_t mem_tag = *(tag_t *)MemToShadow(ptr_raw); - if (UNLIKELY(!PossiblyShortTagMatches(mem_tag, p, 1 << LogSize))) { - SigTrap<0x20 * (EA == ErrorAction::Recover) + - 0x10 * (AT == AccessType::Store) + LogSize>(p); - if (EA == ErrorAction::Abort) - __builtin_unreachable(); - } -} - -template -__attribute__((always_inline, nodebug)) static void CheckAddressSized(uptr p, - uptr sz) { - if (sz == 0 || !InTaggableRegion(p)) - return; - tag_t ptr_tag = GetTagFromPointer(p); - uptr ptr_raw = p & ~kAddressTagMask; - tag_t *shadow_first = (tag_t *)MemToShadow(ptr_raw); - tag_t *shadow_last = (tag_t *)MemToShadow(ptr_raw + sz); - for (tag_t *t = shadow_first; t < shadow_last; ++t) - if (UNLIKELY(ptr_tag != *t)) { - SigTrap<0x20 * (EA == ErrorAction::Recover) + - 0x10 * (AT == AccessType::Store) + 0xf>(p, sz); - if (EA == ErrorAction::Abort) - __builtin_unreachable(); - } - uptr end = p + sz; - uptr tail_sz = end & 0xf; - if (UNLIKELY(tail_sz != 0 && - !PossiblyShortTagMatches( - *shadow_last, end & ~(kShadowAlignment - 1), tail_sz))) { - SigTrap<0x20 * (EA == ErrorAction::Recover) + - 0x10 * (AT == AccessType::Store) + 0xf>(p, sz); - if (EA == ErrorAction::Abort) - __builtin_unreachable(); - } -} - -} // end namespace __hwasan - -#endif // HWASAN_CHECKS_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_dynamic_shadow.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_dynamic_shadow.cpp deleted file mode 100644 index 7642ba6c0bf0..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_dynamic_shadow.cpp +++ /dev/null @@ -1,143 +0,0 @@ -//===-- hwasan_dynamic_shadow.cpp -------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file is a part of HWAddressSanitizer. It reserves dynamic shadow memory -/// region and handles ifunc resolver case, when necessary. -/// -//===----------------------------------------------------------------------===// - -#include "hwasan_dynamic_shadow.h" - -#include -#include - -#include "hwasan.h" -#include "hwasan_mapping.h" -#include "hwasan_thread_list.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_posix.h" - -// The code in this file needs to run in an unrelocated binary. It should not -// access any external symbol, including its own non-hidden globals. - -#if SANITIZER_ANDROID -extern "C" { - -INTERFACE_ATTRIBUTE void __hwasan_shadow(); -decltype(__hwasan_shadow)* __hwasan_premap_shadow(); - -} // extern "C" - -namespace __hwasan { - -// Conservative upper limit. -static uptr PremapShadowSize() { - return RoundUpTo(GetMaxVirtualAddress() >> kShadowScale, - GetMmapGranularity()); -} - -static uptr PremapShadow() { - return MapDynamicShadow(PremapShadowSize(), kShadowScale, - kShadowBaseAlignment, kHighMemEnd); -} - -static bool IsPremapShadowAvailable() { - const uptr shadow = reinterpret_cast(&__hwasan_shadow); - const uptr resolver = reinterpret_cast(&__hwasan_premap_shadow); - // shadow == resolver is how Android KitKat and older handles ifunc. - // shadow == 0 just in case. - return shadow != 0 && shadow != resolver; -} - -static uptr FindPremappedShadowStart(uptr shadow_size_bytes) { - const uptr granularity = GetMmapGranularity(); - const uptr shadow_start = reinterpret_cast(&__hwasan_shadow); - const uptr premap_shadow_size = PremapShadowSize(); - const uptr shadow_size = RoundUpTo(shadow_size_bytes, granularity); - - // We may have mapped too much. Release extra memory. - UnmapFromTo(shadow_start + shadow_size, shadow_start + premap_shadow_size); - return shadow_start; -} - -} // namespace __hwasan - -extern "C" { - -decltype(__hwasan_shadow)* __hwasan_premap_shadow() { - // The resolver might be called multiple times. Map the shadow just once. - static __sanitizer::uptr shadow = 0; - if (!shadow) - shadow = __hwasan::PremapShadow(); - return reinterpret_cast(shadow); -} - -// __hwasan_shadow is a "function" that has the same address as the first byte -// of the shadow mapping. -INTERFACE_ATTRIBUTE __attribute__((ifunc("__hwasan_premap_shadow"))) -void __hwasan_shadow(); - -extern __attribute((weak, visibility("hidden"))) ElfW(Rela) __rela_iplt_start[], - __rela_iplt_end[]; - -} // extern "C" - -namespace __hwasan { - -void InitShadowGOT() { - // Call the ifunc resolver for __hwasan_shadow and fill in its GOT entry. This - // needs to be done before other ifunc resolvers (which are handled by libc) - // because a resolver might read __hwasan_shadow. - typedef ElfW(Addr) (*ifunc_resolver_t)(void); - for (ElfW(Rela) *r = __rela_iplt_start; r != __rela_iplt_end; ++r) { - ElfW(Addr)* offset = reinterpret_cast(r->r_offset); - ElfW(Addr) resolver = r->r_addend; - if (resolver == reinterpret_cast(&__hwasan_premap_shadow)) { - *offset = reinterpret_cast(resolver)(); - break; - } - } -} - -uptr FindDynamicShadowStart(uptr shadow_size_bytes) { - if (IsPremapShadowAvailable()) - return FindPremappedShadowStart(shadow_size_bytes); - return MapDynamicShadow(shadow_size_bytes, kShadowScale, kShadowBaseAlignment, - kHighMemEnd); -} - -} // namespace __hwasan - -#elif SANITIZER_FUCHSIA - -namespace __hwasan { - -void InitShadowGOT() {} - -} // namespace __hwasan - -#else -namespace __hwasan { - -void InitShadowGOT() {} - -uptr FindDynamicShadowStart(uptr shadow_size_bytes) { -# if defined(HWASAN_ALIASING_MODE) - constexpr uptr kAliasSize = 1ULL << kAddressTagShift; - constexpr uptr kNumAliases = 1ULL << kTagBits; - return MapDynamicShadowAndAliases(shadow_size_bytes, kAliasSize, kNumAliases, - RingBufferSize()); -# endif - return MapDynamicShadow(shadow_size_bytes, kShadowScale, kShadowBaseAlignment, - kHighMemEnd); -} - -} // namespace __hwasan - -#endif // SANITIZER_ANDROID diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_dynamic_shadow.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_dynamic_shadow.h deleted file mode 100644 index 3c2e7c716a34..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_dynamic_shadow.h +++ /dev/null @@ -1,27 +0,0 @@ -//===-- hwasan_dynamic_shadow.h ---------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file is a part of HWAddressSanitizer. It reserves dynamic shadow memory -/// region. -/// -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_PREMAP_SHADOW_H -#define HWASAN_PREMAP_SHADOW_H - -#include "sanitizer_common/sanitizer_internal_defs.h" - -namespace __hwasan { - -uptr FindDynamicShadowStart(uptr shadow_size_bytes); -void InitShadowGOT(); - -} // namespace __hwasan - -#endif // HWASAN_PREMAP_SHADOW_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_exceptions.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_exceptions.cpp deleted file mode 100644 index 6ed1da335428..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_exceptions.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===-- hwasan_exceptions.cpp ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// HWAddressSanitizer runtime. -//===----------------------------------------------------------------------===// - -#include "hwasan_poisoning.h" -#include "sanitizer_common/sanitizer_common.h" - -#include - -using namespace __hwasan; -using namespace __sanitizer; - -typedef _Unwind_Reason_Code PersonalityFn(int version, _Unwind_Action actions, - uint64_t exception_class, - _Unwind_Exception* unwind_exception, - _Unwind_Context* context); - -// Pointers to the _Unwind_GetGR and _Unwind_GetCFA functions are passed in -// instead of being called directly. This is to handle cases where the unwinder -// is statically linked and the sanitizer runtime and the program are linked -// against different unwinders. The _Unwind_Context data structure is opaque so -// it may be incompatible between unwinders. -typedef uintptr_t GetGRFn(_Unwind_Context* context, int index); -typedef uintptr_t GetCFAFn(_Unwind_Context* context); - -extern "C" SANITIZER_INTERFACE_ATTRIBUTE _Unwind_Reason_Code -__hwasan_personality_wrapper(int version, _Unwind_Action actions, - uint64_t exception_class, - _Unwind_Exception* unwind_exception, - _Unwind_Context* context, - PersonalityFn* real_personality, GetGRFn* get_gr, - GetCFAFn* get_cfa) { - _Unwind_Reason_Code rc; - if (real_personality) - rc = real_personality(version, actions, exception_class, unwind_exception, - context); - else - rc = _URC_CONTINUE_UNWIND; - - // We only untag frames without a landing pad because landing pads are - // responsible for untagging the stack themselves if they resume. - // - // Here we assume that the frame record appears after any locals. This is not - // required by AAPCS but is a requirement for HWASAN instrumented functions. - if ((actions & _UA_CLEANUP_PHASE) && rc == _URC_CONTINUE_UNWIND) { -#if defined(__x86_64__) - uptr fp = get_gr(context, 6); // rbp -#elif defined(__aarch64__) - uptr fp = get_gr(context, 29); // x29 -#else -#error Unsupported architecture -#endif - uptr sp = get_cfa(context); - TagMemory(sp, fp - sp, 0); - } - - return rc; -} diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_flags.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_flags.h deleted file mode 100644 index b17750158d02..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_flags.h +++ /dev/null @@ -1,31 +0,0 @@ -//===-- hwasan_flags.h ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -//===----------------------------------------------------------------------===// -#ifndef HWASAN_FLAGS_H -#define HWASAN_FLAGS_H - -#include "sanitizer_common/sanitizer_internal_defs.h" - -namespace __hwasan { - -struct Flags { -#define HWASAN_FLAG(Type, Name, DefaultValue, Description) Type Name; -#include "hwasan_flags.inc" -#undef HWASAN_FLAG - - void SetDefaults(); -}; - -Flags *flags(); - -} // namespace __hwasan - -#endif // HWASAN_FLAGS_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_flags.inc b/contrib/libs/clang14-rt/lib/hwasan/hwasan_flags.inc deleted file mode 100644 index 18ea47f981be..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_flags.inc +++ /dev/null @@ -1,83 +0,0 @@ -//===-- hwasan_flags.inc ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Hwasan runtime flags. -// -//===----------------------------------------------------------------------===// -#ifndef HWASAN_FLAG -# error "Define HWASAN_FLAG prior to including this file!" -#endif - -// HWASAN_FLAG(Type, Name, DefaultValue, Description) -// See COMMON_FLAG in sanitizer_flags.inc for more details. - -HWASAN_FLAG(bool, verbose_threads, false, - "inform on thread creation/destruction") -HWASAN_FLAG(bool, tag_in_malloc, true, "") -HWASAN_FLAG(bool, tag_in_free, true, "") -HWASAN_FLAG(bool, print_stats, false, "") -HWASAN_FLAG(bool, halt_on_error, true, "") -HWASAN_FLAG(bool, atexit, false, "") - -// Test only flag to disable malloc/realloc/free memory tagging on startup. -// Tagging can be reenabled with __hwasan_enable_allocator_tagging(). -HWASAN_FLAG(bool, disable_allocator_tagging, false, "") - -// If false, use simple increment of a thread local counter to generate new -// tags. -HWASAN_FLAG(bool, random_tags, true, "") - -HWASAN_FLAG( - int, max_malloc_fill_size, 0, - "HWASan allocator flag. max_malloc_fill_size is the maximal amount of " - "bytes that will be filled with malloc_fill_byte on malloc.") - -HWASAN_FLAG(bool, free_checks_tail_magic, 1, - "If set, free() will check the magic values " - "to the right of the allocated object " - "if the allocation size is not a divident of the granule size") -HWASAN_FLAG( - int, max_free_fill_size, 0, - "HWASan allocator flag. max_free_fill_size is the maximal amount of " - "bytes that will be filled with free_fill_byte during free.") -HWASAN_FLAG(int, malloc_fill_byte, 0xbe, - "Value used to fill the newly allocated memory.") -HWASAN_FLAG(int, free_fill_byte, 0x55, - "Value used to fill deallocated memory.") -HWASAN_FLAG(int, heap_history_size, 1023, - "The number of heap (de)allocations remembered per thread. " - "Affects the quality of heap-related reports, but not the ability " - "to find bugs.") -HWASAN_FLAG(bool, export_memory_stats, true, - "Export up-to-date memory stats through /proc") -HWASAN_FLAG(int, stack_history_size, 1024, - "The number of stack frames remembered per thread. " - "Affects the quality of stack-related reports, but not the ability " - "to find bugs.") - -// Malloc / free bisection. Only tag malloc and free calls when a hash of -// allocation size and stack trace is between malloc_bisect_left and -// malloc_bisect_right (both inclusive). [0, 0] range is special and disables -// bisection (i.e. everything is tagged). Once the range is narrowed down -// enough, use malloc_bisect_dump to see interesting allocations. -HWASAN_FLAG(uptr, malloc_bisect_left, 0, - "Left bound of malloc bisection, inclusive.") -HWASAN_FLAG(uptr, malloc_bisect_right, 0, - "Right bound of malloc bisection, inclusive.") -HWASAN_FLAG(bool, malloc_bisect_dump, false, - "Print all allocations within [malloc_bisect_left, " - "malloc_bisect_right] range ") - - -// Exit if we fail to enable the AArch64 kernel ABI relaxation which allows -// tagged pointers in syscalls. This is the default, but being able to disable -// that behaviour is useful for running the testsuite on more platforms (the -// testsuite can run since we manually ensure any pointer arguments to syscalls -// are untagged before the call. -HWASAN_FLAG(bool, fail_without_syscall_abi, true, - "Exit if fail to request relaxed syscall ABI.") diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_fuchsia.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_fuchsia.cpp deleted file mode 100644 index 94e5c5fb69c7..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_fuchsia.cpp +++ /dev/null @@ -1,215 +0,0 @@ -//===-- hwasan_fuchsia.cpp --------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file is a part of HWAddressSanitizer and contains Fuchsia-specific -/// code. -/// -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_fuchsia.h" -#if SANITIZER_FUCHSIA - -#include "hwasan.h" -#include "hwasan_interface_internal.h" -#include "hwasan_report.h" -#include "hwasan_thread.h" -#include "hwasan_thread_list.h" - -// This TLS variable contains the location of the stack ring buffer and can be -// used to always find the hwasan thread object associated with the current -// running thread. -[[gnu::tls_model("initial-exec")]] -SANITIZER_INTERFACE_ATTRIBUTE -THREADLOCAL uptr __hwasan_tls; - -namespace __hwasan { - -bool InitShadow() { - __sanitizer::InitShadowBounds(); - CHECK_NE(__sanitizer::ShadowBounds.shadow_limit, 0); - - // These variables are used by MemIsShadow for asserting we have a correct - // shadow address. On Fuchsia, we only have one region of shadow, so the - // bounds of Low shadow can be zero while High shadow represents the true - // bounds. Note that these are inclusive ranges. - kLowShadowStart = 0; - kLowShadowEnd = 0; - kHighShadowStart = __sanitizer::ShadowBounds.shadow_base; - kHighShadowEnd = __sanitizer::ShadowBounds.shadow_limit - 1; - - return true; -} - -bool MemIsApp(uptr p) { - CHECK(GetTagFromPointer(p) == 0); - return __sanitizer::ShadowBounds.shadow_limit <= p && - p <= (__sanitizer::ShadowBounds.memory_limit - 1); -} - -// These are known parameters passed to the hwasan runtime on thread creation. -struct Thread::InitState { - uptr stack_bottom, stack_top; -}; - -static void FinishThreadInitialization(Thread *thread); - -void InitThreads() { - // This is the minimal alignment needed for the storage where hwasan threads - // and their stack ring buffers are placed. This alignment is necessary so the - // stack ring buffer can perform a simple calculation to get the next element - // in the RB. The instructions for this calculation are emitted by the - // compiler. (Full explanation in hwasan_thread_list.h.) - uptr alloc_size = UINT64_C(1) << kShadowBaseAlignment; - uptr thread_start = reinterpret_cast( - MmapAlignedOrDieOnFatalError(alloc_size, alloc_size, __func__)); - - InitThreadList(thread_start, alloc_size); - - // Create the hwasan thread object for the current (main) thread. Stack info - // for this thread is known from information passed via - // __sanitizer_startup_hook. - const Thread::InitState state = { - .stack_bottom = __sanitizer::MainThreadStackBase, - .stack_top = - __sanitizer::MainThreadStackBase + __sanitizer::MainThreadStackSize, - }; - FinishThreadInitialization(hwasanThreadList().CreateCurrentThread(&state)); -} - -uptr *GetCurrentThreadLongPtr() { return &__hwasan_tls; } - -// This is called from the parent thread before the new thread is created. Here -// we can propagate known info like the stack bounds to Thread::Init before -// jumping into the thread. We cannot initialize the stack ring buffer yet since -// we have not entered the new thread. -static void *BeforeThreadCreateHook(uptr user_id, bool detached, - const char *name, uptr stack_bottom, - uptr stack_size) { - const Thread::InitState state = { - .stack_bottom = stack_bottom, - .stack_top = stack_bottom + stack_size, - }; - return hwasanThreadList().CreateCurrentThread(&state); -} - -// This sets the stack top and bottom according to the InitState passed to -// CreateCurrentThread above. -void Thread::InitStackAndTls(const InitState *state) { - CHECK_NE(state->stack_bottom, 0); - CHECK_NE(state->stack_top, 0); - stack_bottom_ = state->stack_bottom; - stack_top_ = state->stack_top; - tls_end_ = tls_begin_ = 0; -} - -// This is called after creating a new thread with the pointer returned by -// BeforeThreadCreateHook. We are still in the creating thread and should check -// if it was actually created correctly. -static void ThreadCreateHook(void *hook, bool aborted) { - Thread *thread = static_cast(hook); - if (!aborted) { - // The thread was created successfully. - // ThreadStartHook can already be running in the new thread. - } else { - // The thread wasn't created after all. - // Clean up everything we set up in BeforeThreadCreateHook. - atomic_signal_fence(memory_order_seq_cst); - hwasanThreadList().ReleaseThread(thread); - } -} - -// This is called in the newly-created thread before it runs anything else, -// with the pointer returned by BeforeThreadCreateHook (above). Here we can -// setup the stack ring buffer. -static void ThreadStartHook(void *hook, thrd_t self) { - Thread *thread = static_cast(hook); - FinishThreadInitialization(thread); - thread->EnsureRandomStateInited(); -} - -// This is the function that sets up the stack ring buffer and enables us to use -// GetCurrentThread. This function should only be called while IN the thread -// that we want to create the hwasan thread object for so __hwasan_tls can be -// properly referenced. -static void FinishThreadInitialization(Thread *thread) { - CHECK_NE(thread, nullptr); - - // The ring buffer is located immediately before the thread object. - uptr stack_buffer_size = hwasanThreadList().GetRingBufferSize(); - uptr stack_buffer_start = reinterpret_cast(thread) - stack_buffer_size; - thread->InitStackRingBuffer(stack_buffer_start, stack_buffer_size); -} - -static void ThreadExitHook(void *hook, thrd_t self) { - Thread *thread = static_cast(hook); - atomic_signal_fence(memory_order_seq_cst); - hwasanThreadList().ReleaseThread(thread); -} - -uptr TagMemoryAligned(uptr p, uptr size, tag_t tag) { - CHECK(IsAligned(p, kShadowAlignment)); - CHECK(IsAligned(size, kShadowAlignment)); - __sanitizer_fill_shadow(p, size, tag, - common_flags()->clear_shadow_mmap_threshold); - return AddTagToPointer(p, tag); -} - -// Not implemented because Fuchsia does not use signal handlers. -void HwasanOnDeadlySignal(int signo, void *info, void *context) {} - -// Not implemented because Fuchsia does not use interceptors. -void InitializeInterceptors() {} - -// Not implemented because this is only relevant for Android. -void AndroidTestTlsSlot() {} - -// TSD was normally used on linux as a means of calling the hwasan thread exit -// handler passed to pthread_key_create. This is not needed on Fuchsia because -// we will be using __sanitizer_thread_exit_hook. -void HwasanTSDInit() {} -void HwasanTSDThreadInit() {} - -// On linux, this just would call `atexit(HwasanAtExit)`. The functions in -// HwasanAtExit are unimplemented for Fuchsia and effectively no-ops, so this -// function is unneeded. -void InstallAtExitHandler() {} - -void HwasanInstallAtForkHandler() {} - -// TODO(fxbug.dev/81499): Once we finalize the tagged pointer ABI in zircon, we should come back -// here and implement the appropriate check that TBI is enabled. -void InitializeOsSupport() {} - -} // namespace __hwasan - -extern "C" { - -void *__sanitizer_before_thread_create_hook(thrd_t thread, bool detached, - const char *name, void *stack_base, - size_t stack_size) { - return __hwasan::BeforeThreadCreateHook( - reinterpret_cast(thread), detached, name, - reinterpret_cast(stack_base), stack_size); -} - -void __sanitizer_thread_create_hook(void *hook, thrd_t thread, int error) { - __hwasan::ThreadCreateHook(hook, error != thrd_success); -} - -void __sanitizer_thread_start_hook(void *hook, thrd_t self) { - __hwasan::ThreadStartHook(hook, reinterpret_cast(self)); -} - -void __sanitizer_thread_exit_hook(void *hook, thrd_t self) { - __hwasan::ThreadExitHook(hook, self); -} - -} // extern "C" - -#endif // SANITIZER_FUCHSIA diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_globals.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_globals.cpp deleted file mode 100644 index d71bcd792e1f..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_globals.cpp +++ /dev/null @@ -1,91 +0,0 @@ -//===-- hwasan_globals.cpp ------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// HWAddressSanitizer globals-specific runtime. -//===----------------------------------------------------------------------===// - -#include "hwasan_globals.h" - -namespace __hwasan { - -enum { NT_LLVM_HWASAN_GLOBALS = 3 }; -struct hwasan_global_note { - s32 begin_relptr; - s32 end_relptr; -}; - -// Check that the given library meets the code model requirements for tagged -// globals. These properties are not checked at link time so they need to be -// checked at runtime. -static void CheckCodeModel(ElfW(Addr) base, const ElfW(Phdr) * phdr, - ElfW(Half) phnum) { - ElfW(Addr) min_addr = -1ull, max_addr = 0; - for (unsigned i = 0; i != phnum; ++i) { - if (phdr[i].p_type != PT_LOAD) - continue; - ElfW(Addr) lo = base + phdr[i].p_vaddr, hi = lo + phdr[i].p_memsz; - if (min_addr > lo) - min_addr = lo; - if (max_addr < hi) - max_addr = hi; - } - - if (max_addr - min_addr > 1ull << 32) { - Report("FATAL: HWAddressSanitizer: library size exceeds 2^32\n"); - Die(); - } - if (max_addr > 1ull << 48) { - Report("FATAL: HWAddressSanitizer: library loaded above address 2^48\n"); - Die(); - } -} - -ArrayRef HwasanGlobalsFor(ElfW(Addr) base, - const ElfW(Phdr) * phdr, - ElfW(Half) phnum) { - // Read the phdrs from this DSO. - for (unsigned i = 0; i != phnum; ++i) { - if (phdr[i].p_type != PT_NOTE) - continue; - - const char *note = reinterpret_cast(base + phdr[i].p_vaddr); - const char *nend = note + phdr[i].p_memsz; - - // Traverse all the notes until we find a HWASan note. - while (note < nend) { - auto *nhdr = reinterpret_cast(note); - const char *name = note + sizeof(ElfW(Nhdr)); - const char *desc = name + RoundUpTo(nhdr->n_namesz, 4); - - // Discard non-HWASan-Globals notes. - if (nhdr->n_type != NT_LLVM_HWASAN_GLOBALS || - internal_strcmp(name, "LLVM") != 0) { - note = desc + RoundUpTo(nhdr->n_descsz, 4); - continue; - } - - // Only libraries with instrumented globals need to be checked against the - // code model since they use relocations that aren't checked at link time. - CheckCodeModel(base, phdr, phnum); - - auto *global_note = reinterpret_cast(desc); - auto *globals_begin = reinterpret_cast( - note + global_note->begin_relptr); - auto *globals_end = reinterpret_cast( - note + global_note->end_relptr); - - return {globals_begin, globals_end}; - } - } - - return {}; -} - -} // namespace __hwasan diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_globals.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_globals.h deleted file mode 100644 index fd7adf7a0588..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_globals.h +++ /dev/null @@ -1,49 +0,0 @@ -//===-- hwasan_globals.h ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Private Hwasan header. -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_GLOBALS_H -#define HWASAN_GLOBALS_H - -#include - -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_internal_defs.h" - -namespace __hwasan { -// This object should only ever be casted over the global (i.e. not constructed) -// in the ELF PT_NOTE in order for `addr()` to work correctly. -struct hwasan_global { - // The size of this global variable. Note that the size in the descriptor is - // max 1 << 24. Larger globals have multiple descriptors. - uptr size() const { return info & 0xffffff; } - // The fully-relocated address of this global. - uptr addr() const { return reinterpret_cast(this) + gv_relptr; } - // The static tag of this global. - u8 tag() const { return info >> 24; }; - - // The relative address between the start of the descriptor for the HWASan - // global (in the PT_NOTE), and the fully relocated address of the global. - s32 gv_relptr; - u32 info; -}; - -// Walk through the specific DSO (as specified by the base, phdr, and phnum), -// and return the range of the [beginning, end) of the HWASan globals descriptor -// array. -ArrayRef HwasanGlobalsFor(ElfW(Addr) base, - const ElfW(Phdr) * phdr, - ElfW(Half) phnum); - -} // namespace __hwasan - -#endif // HWASAN_GLOBALS_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_interceptors.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_interceptors.cpp deleted file mode 100644 index 8dc886e587e7..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_interceptors.cpp +++ /dev/null @@ -1,205 +0,0 @@ -//===-- hwasan_interceptors.cpp -------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Interceptors for standard library functions. -// -// FIXME: move as many interceptors as possible into -// sanitizer_common/sanitizer_common_interceptors.h -//===----------------------------------------------------------------------===// - -#include "interception/interception.h" -#include "hwasan.h" -#include "hwasan_thread.h" -#include "sanitizer_common/sanitizer_stackdepot.h" - -#if !SANITIZER_FUCHSIA - -using namespace __hwasan; - -#if HWASAN_WITH_INTERCEPTORS - -struct ThreadStartArg { - thread_callback_t callback; - void *param; -}; - -static void *HwasanThreadStartFunc(void *arg) { - __hwasan_thread_enter(); - ThreadStartArg A = *reinterpret_cast(arg); - UnmapOrDie(arg, GetPageSizeCached()); - return A.callback(A.param); -} - -INTERCEPTOR(int, pthread_create, void *th, void *attr, void *(*callback)(void*), - void * param) { - ScopedTaggingDisabler disabler; - ThreadStartArg *A = reinterpret_cast (MmapOrDie( - GetPageSizeCached(), "pthread_create")); - *A = {callback, param}; - int res = REAL(pthread_create)(th, attr, &HwasanThreadStartFunc, A); - return res; -} - -INTERCEPTOR(int, pthread_join, void *t, void **arg) { - return REAL(pthread_join)(t, arg); -} - -DEFINE_REAL_PTHREAD_FUNCTIONS - -DEFINE_REAL(int, vfork) -DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(int, vfork) - -// Get and/or change the set of blocked signals. -extern "C" int sigprocmask(int __how, const __hw_sigset_t *__restrict __set, - __hw_sigset_t *__restrict __oset); -#define SIG_BLOCK 0 -#define SIG_SETMASK 2 -extern "C" int __sigjmp_save(__hw_sigjmp_buf env, int savemask) { - env[0].__magic = kHwJmpBufMagic; - env[0].__mask_was_saved = - (savemask && sigprocmask(SIG_BLOCK, (__hw_sigset_t *)0, - &env[0].__saved_mask) == 0); - return 0; -} - -static void __attribute__((always_inline)) -InternalLongjmp(__hw_register_buf env, int retval) { -# if defined(__aarch64__) - constexpr size_t kSpIndex = 13; -# elif defined(__x86_64__) - constexpr size_t kSpIndex = 6; -# endif - - // Clear all memory tags on the stack between here and where we're going. - unsigned long long stack_pointer = env[kSpIndex]; - // The stack pointer should never be tagged, so we don't need to clear the - // tag for this function call. - __hwasan_handle_longjmp((void *)stack_pointer); - - // Run code for handling a longjmp. - // Need to use a register that isn't going to be loaded from the environment - // buffer -- hence why we need to specify the register to use. - // Must implement this ourselves, since we don't know the order of registers - // in different libc implementations and many implementations mangle the - // stack pointer so we can't use it without knowing the demangling scheme. -# if defined(__aarch64__) - register long int retval_tmp asm("x1") = retval; - register void *env_address asm("x0") = &env[0]; - asm volatile("ldp x19, x20, [%0, #0<<3];" - "ldp x21, x22, [%0, #2<<3];" - "ldp x23, x24, [%0, #4<<3];" - "ldp x25, x26, [%0, #6<<3];" - "ldp x27, x28, [%0, #8<<3];" - "ldp x29, x30, [%0, #10<<3];" - "ldp d8, d9, [%0, #14<<3];" - "ldp d10, d11, [%0, #16<<3];" - "ldp d12, d13, [%0, #18<<3];" - "ldp d14, d15, [%0, #20<<3];" - "ldr x5, [%0, #13<<3];" - "mov sp, x5;" - // Return the value requested to return through arguments. - // This should be in x1 given what we requested above. - "cmp %1, #0;" - "mov x0, #1;" - "csel x0, %1, x0, ne;" - "br x30;" - : "+r"(env_address) - : "r"(retval_tmp)); -# elif defined(__x86_64__) - register long int retval_tmp asm("%rsi") = retval; - register void *env_address asm("%rdi") = &env[0]; - asm volatile( - // Restore registers. - "mov (0*8)(%0),%%rbx;" - "mov (1*8)(%0),%%rbp;" - "mov (2*8)(%0),%%r12;" - "mov (3*8)(%0),%%r13;" - "mov (4*8)(%0),%%r14;" - "mov (5*8)(%0),%%r15;" - "mov (6*8)(%0),%%rsp;" - "mov (7*8)(%0),%%rdx;" - // Return 1 if retval is 0. - "mov $1,%%rax;" - "test %1,%1;" - "cmovnz %1,%%rax;" - "jmp *%%rdx;" ::"r"(env_address), - "r"(retval_tmp)); -# endif -} - -INTERCEPTOR(void, siglongjmp, __hw_sigjmp_buf env, int val) { - if (env[0].__magic != kHwJmpBufMagic) { - Printf( - "WARNING: Unexpected bad jmp_buf. Either setjmp was not called or " - "there is a bug in HWASan.\n"); - return REAL(siglongjmp)(env, val); - } - - if (env[0].__mask_was_saved) - // Restore the saved signal mask. - (void)sigprocmask(SIG_SETMASK, &env[0].__saved_mask, - (__hw_sigset_t *)0); - InternalLongjmp(env[0].__jmpbuf, val); -} - -// Required since glibc libpthread calls __libc_longjmp on pthread_exit, and -// _setjmp on start_thread. Hence we have to intercept the longjmp on -// pthread_exit so the __hw_jmp_buf order matches. -INTERCEPTOR(void, __libc_longjmp, __hw_jmp_buf env, int val) { - if (env[0].__magic != kHwJmpBufMagic) - return REAL(__libc_longjmp)(env, val); - InternalLongjmp(env[0].__jmpbuf, val); -} - -INTERCEPTOR(void, longjmp, __hw_jmp_buf env, int val) { - if (env[0].__magic != kHwJmpBufMagic) { - Printf( - "WARNING: Unexpected bad jmp_buf. Either setjmp was not called or " - "there is a bug in HWASan.\n"); - return REAL(longjmp)(env, val); - } - InternalLongjmp(env[0].__jmpbuf, val); -} -#undef SIG_BLOCK -#undef SIG_SETMASK - -# endif // HWASAN_WITH_INTERCEPTORS - -namespace __hwasan { - -int OnExit() { - // FIXME: ask frontend whether we need to return failure. - return 0; -} - -} // namespace __hwasan - -namespace __hwasan { - -void InitializeInterceptors() { - static int inited = 0; - CHECK_EQ(inited, 0); - -#if HWASAN_WITH_INTERCEPTORS -#if defined(__linux__) - INTERCEPT_FUNCTION(__libc_longjmp); - INTERCEPT_FUNCTION(longjmp); - INTERCEPT_FUNCTION(siglongjmp); - INTERCEPT_FUNCTION(vfork); -#endif // __linux__ - INTERCEPT_FUNCTION(pthread_create); - INTERCEPT_FUNCTION(pthread_join); -# endif - - inited = 1; -} -} // namespace __hwasan - -#endif // #if !SANITIZER_FUCHSIA diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_interceptors_vfork.S b/contrib/libs/clang14-rt/lib/hwasan/hwasan_interceptors_vfork.S deleted file mode 100644 index fd20825e3dac..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_interceptors_vfork.S +++ /dev/null @@ -1,14 +0,0 @@ -#include "sanitizer_common/sanitizer_asm.h" -#include "builtins/assembly.h" - -#if defined(__linux__) && HWASAN_WITH_INTERCEPTORS -#define COMMON_INTERCEPTOR_SPILL_AREA __hwasan_extra_spill_area -#define COMMON_INTERCEPTOR_HANDLE_VFORK __hwasan_handle_vfork -#include "sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S" -#include "sanitizer_common/sanitizer_common_interceptors_vfork_riscv64.inc.S" -#include "sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S" -#endif - -NO_EXEC_STACK_DIRECTIVE - -GNU_PROPERTY_BTI_PAC diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_interface_internal.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_interface_internal.h deleted file mode 100644 index ef771add411c..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_interface_internal.h +++ /dev/null @@ -1,182 +0,0 @@ -//===-- hwasan_interface_internal.h -----------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Private Hwasan interface header. -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_INTERFACE_INTERNAL_H -#define HWASAN_INTERFACE_INTERNAL_H - -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "sanitizer_common/sanitizer_platform_limits_posix.h" -#include - -extern "C" { - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_init_static(); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_init(); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_library_loaded(ElfW(Addr) base, const ElfW(Phdr) * phdr, - ElfW(Half) phnum); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_library_unloaded(ElfW(Addr) base, const ElfW(Phdr) * phdr, - ElfW(Half) phnum); - -using __sanitizer::uptr; -using __sanitizer::sptr; -using __sanitizer::uu64; -using __sanitizer::uu32; -using __sanitizer::uu16; -using __sanitizer::u64; -using __sanitizer::u32; -using __sanitizer::u16; -using __sanitizer::u8; - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_init_frames(uptr, uptr); - -SANITIZER_INTERFACE_ATTRIBUTE -extern uptr __hwasan_shadow_memory_dynamic_address; - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_loadN(uptr, uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load1(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load2(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load4(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load8(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load16(uptr); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_loadN_noabort(uptr, uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load1_noabort(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load2_noabort(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load4_noabort(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load8_noabort(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_load16_noabort(uptr); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_storeN(uptr, uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store1(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store2(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store4(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store8(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store16(uptr); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_storeN_noabort(uptr, uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store1_noabort(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store2_noabort(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store4_noabort(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store8_noabort(uptr); -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_store16_noabort(uptr); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_tag_memory(uptr p, u8 tag, uptr sz); - -SANITIZER_INTERFACE_ATTRIBUTE -uptr __hwasan_tag_pointer(uptr p, u8 tag); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_tag_mismatch(uptr addr, u8 ts); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_tag_mismatch4(uptr addr, uptr access_info, uptr *registers_frame, - size_t outsize); - -SANITIZER_INTERFACE_ATTRIBUTE -u8 __hwasan_generate_tag(); - -// Returns the offset of the first tag mismatch or -1 if the whole range is -// good. -SANITIZER_INTERFACE_ATTRIBUTE -sptr __hwasan_test_shadow(const void *x, uptr size); - -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -/* OPTIONAL */ const char* __hwasan_default_options(); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_print_shadow(const void *x, uptr size); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_handle_longjmp(const void *sp_dst); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_handle_vfork(const void *sp_dst); - -SANITIZER_INTERFACE_ATTRIBUTE -u16 __sanitizer_unaligned_load16(const uu16 *p); - -SANITIZER_INTERFACE_ATTRIBUTE -u32 __sanitizer_unaligned_load32(const uu32 *p); - -SANITIZER_INTERFACE_ATTRIBUTE -u64 __sanitizer_unaligned_load64(const uu64 *p); - -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_unaligned_store16(uu16 *p, u16 x); - -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_unaligned_store32(uu32 *p, u32 x); - -SANITIZER_INTERFACE_ATTRIBUTE -void __sanitizer_unaligned_store64(uu64 *p, u64 x); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_enable_allocator_tagging(); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_disable_allocator_tagging(); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_thread_enter(); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_thread_exit(); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_print_memory_usage(); - -SANITIZER_INTERFACE_ATTRIBUTE -void *__hwasan_memcpy(void *dst, const void *src, uptr size); -SANITIZER_INTERFACE_ATTRIBUTE -void *__hwasan_memset(void *s, int c, uptr n); -SANITIZER_INTERFACE_ATTRIBUTE -void *__hwasan_memmove(void *dest, const void *src, uptr n); - -SANITIZER_INTERFACE_ATTRIBUTE -void __hwasan_set_error_report_callback(void (*callback)(const char *)); -} // extern "C" - -#endif // HWASAN_INTERFACE_INTERNAL_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_linux.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_linux.cpp deleted file mode 100644 index ba9e23621cc2..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_linux.cpp +++ /dev/null @@ -1,447 +0,0 @@ -//===-- hwasan_linux.cpp ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file is a part of HWAddressSanitizer and contains Linux-, NetBSD- and -/// FreeBSD-specific code. -/// -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# include "hwasan.h" -# include "hwasan_dynamic_shadow.h" -# include "hwasan_interface_internal.h" -# include "hwasan_mapping.h" -# include "hwasan_report.h" -# include "hwasan_thread.h" -# include "hwasan_thread_list.h" -# include "sanitizer_common/sanitizer_common.h" -# include "sanitizer_common/sanitizer_procmaps.h" -# include "sanitizer_common/sanitizer_stackdepot.h" - -// Configurations of HWASAN_WITH_INTERCEPTORS and SANITIZER_ANDROID. -// -// HWASAN_WITH_INTERCEPTORS=OFF, SANITIZER_ANDROID=OFF -// Not currently tested. -// HWASAN_WITH_INTERCEPTORS=OFF, SANITIZER_ANDROID=ON -// Integration tests downstream exist. -// HWASAN_WITH_INTERCEPTORS=ON, SANITIZER_ANDROID=OFF -// Tested with check-hwasan on x86_64-linux. -// HWASAN_WITH_INTERCEPTORS=ON, SANITIZER_ANDROID=ON -// Tested with check-hwasan on aarch64-linux-android. -# if !SANITIZER_ANDROID -SANITIZER_INTERFACE_ATTRIBUTE -THREADLOCAL uptr __hwasan_tls; -# endif - -namespace __hwasan { - -// With the zero shadow base we can not actually map pages starting from 0. -// This constant is somewhat arbitrary. -constexpr uptr kZeroBaseShadowStart = 0; -constexpr uptr kZeroBaseMaxShadowStart = 1 << 18; - -static void ProtectGap(uptr addr, uptr size) { - __sanitizer::ProtectGap(addr, size, kZeroBaseShadowStart, - kZeroBaseMaxShadowStart); -} - -uptr kLowMemStart; -uptr kLowMemEnd; -uptr kHighMemStart; -uptr kHighMemEnd; - -static void PrintRange(uptr start, uptr end, const char *name) { - Printf("|| [%p, %p] || %.*s ||\n", (void *)start, (void *)end, 10, name); -} - -static void PrintAddressSpaceLayout() { - PrintRange(kHighMemStart, kHighMemEnd, "HighMem"); - if (kHighShadowEnd + 1 < kHighMemStart) - PrintRange(kHighShadowEnd + 1, kHighMemStart - 1, "ShadowGap"); - else - CHECK_EQ(kHighShadowEnd + 1, kHighMemStart); - PrintRange(kHighShadowStart, kHighShadowEnd, "HighShadow"); - if (kLowShadowEnd + 1 < kHighShadowStart) - PrintRange(kLowShadowEnd + 1, kHighShadowStart - 1, "ShadowGap"); - else - CHECK_EQ(kLowMemEnd + 1, kHighShadowStart); - PrintRange(kLowShadowStart, kLowShadowEnd, "LowShadow"); - if (kLowMemEnd + 1 < kLowShadowStart) - PrintRange(kLowMemEnd + 1, kLowShadowStart - 1, "ShadowGap"); - else - CHECK_EQ(kLowMemEnd + 1, kLowShadowStart); - PrintRange(kLowMemStart, kLowMemEnd, "LowMem"); - CHECK_EQ(0, kLowMemStart); -} - -static uptr GetHighMemEnd() { - // HighMem covers the upper part of the address space. - uptr max_address = GetMaxUserVirtualAddress(); - // Adjust max address to make sure that kHighMemEnd and kHighMemStart are - // properly aligned: - max_address |= (GetMmapGranularity() << kShadowScale) - 1; - return max_address; -} - -static void InitializeShadowBaseAddress(uptr shadow_size_bytes) { - __hwasan_shadow_memory_dynamic_address = - FindDynamicShadowStart(shadow_size_bytes); -} - -void InitializeOsSupport() { -# define PR_SET_TAGGED_ADDR_CTRL 55 -# define PR_GET_TAGGED_ADDR_CTRL 56 -# define PR_TAGGED_ADDR_ENABLE (1UL << 0) - // Check we're running on a kernel that can use the tagged address ABI. - int local_errno = 0; - if (internal_iserror(internal_prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0), - &local_errno) && - local_errno == EINVAL) { -# if SANITIZER_ANDROID || defined(HWASAN_ALIASING_MODE) - // Some older Android kernels have the tagged pointer ABI on - // unconditionally, and hence don't have the tagged-addr prctl while still - // allow the ABI. - // If targeting Android and the prctl is not around we assume this is the - // case. - return; -# else - if (flags()->fail_without_syscall_abi) { - Printf( - "FATAL: " - "HWAddressSanitizer requires a kernel with tagged address ABI.\n"); - Die(); - } -# endif - } - - // Turn on the tagged address ABI. - if ((internal_iserror(internal_prctl(PR_SET_TAGGED_ADDR_CTRL, - PR_TAGGED_ADDR_ENABLE, 0, 0, 0)) || - !internal_prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0))) { -# if defined(__x86_64__) && !defined(HWASAN_ALIASING_MODE) - // Try the new prctl API for Intel LAM. The API is based on a currently - // unsubmitted patch to the Linux kernel (as of May 2021) and is thus - // subject to change. Patch is here: - // https://lore.kernel.org/linux-mm/20210205151631.43511-12-kirill.shutemov@linux.intel.com/ - int tag_bits = kTagBits; - int tag_shift = kAddressTagShift; - if (!internal_iserror( - internal_prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, - reinterpret_cast(&tag_bits), - reinterpret_cast(&tag_shift), 0))) { - CHECK_EQ(tag_bits, kTagBits); - CHECK_EQ(tag_shift, kAddressTagShift); - return; - } -# endif // defined(__x86_64__) && !defined(HWASAN_ALIASING_MODE) - if (flags()->fail_without_syscall_abi) { - Printf( - "FATAL: HWAddressSanitizer failed to enable tagged address syscall " - "ABI.\nSuggest check `sysctl abi.tagged_addr_disabled` " - "configuration.\n"); - Die(); - } - } -# undef PR_SET_TAGGED_ADDR_CTRL -# undef PR_GET_TAGGED_ADDR_CTRL -# undef PR_TAGGED_ADDR_ENABLE -} - -bool InitShadow() { - // Define the entire memory range. - kHighMemEnd = GetHighMemEnd(); - - // Determine shadow memory base offset. - InitializeShadowBaseAddress(MemToShadowSize(kHighMemEnd)); - - // Place the low memory first. - kLowMemEnd = __hwasan_shadow_memory_dynamic_address - 1; - kLowMemStart = 0; - - // Define the low shadow based on the already placed low memory. - kLowShadowEnd = MemToShadow(kLowMemEnd); - kLowShadowStart = __hwasan_shadow_memory_dynamic_address; - - // High shadow takes whatever memory is left up there (making sure it is not - // interfering with low memory in the fixed case). - kHighShadowEnd = MemToShadow(kHighMemEnd); - kHighShadowStart = Max(kLowMemEnd, MemToShadow(kHighShadowEnd)) + 1; - - // High memory starts where allocated shadow allows. - kHighMemStart = ShadowToMem(kHighShadowStart); - - // Check the sanity of the defined memory ranges (there might be gaps). - CHECK_EQ(kHighMemStart % GetMmapGranularity(), 0); - CHECK_GT(kHighMemStart, kHighShadowEnd); - CHECK_GT(kHighShadowEnd, kHighShadowStart); - CHECK_GT(kHighShadowStart, kLowMemEnd); - CHECK_GT(kLowMemEnd, kLowMemStart); - CHECK_GT(kLowShadowEnd, kLowShadowStart); - CHECK_GT(kLowShadowStart, kLowMemEnd); - - if (Verbosity()) - PrintAddressSpaceLayout(); - - // Reserve shadow memory. - ReserveShadowMemoryRange(kLowShadowStart, kLowShadowEnd, "low shadow"); - ReserveShadowMemoryRange(kHighShadowStart, kHighShadowEnd, "high shadow"); - - // Protect all the gaps. - ProtectGap(0, Min(kLowMemStart, kLowShadowStart)); - if (kLowMemEnd + 1 < kLowShadowStart) - ProtectGap(kLowMemEnd + 1, kLowShadowStart - kLowMemEnd - 1); - if (kLowShadowEnd + 1 < kHighShadowStart) - ProtectGap(kLowShadowEnd + 1, kHighShadowStart - kLowShadowEnd - 1); - if (kHighShadowEnd + 1 < kHighMemStart) - ProtectGap(kHighShadowEnd + 1, kHighMemStart - kHighShadowEnd - 1); - - return true; -} - -void InitThreads() { - CHECK(__hwasan_shadow_memory_dynamic_address); - uptr guard_page_size = GetMmapGranularity(); - uptr thread_space_start = - __hwasan_shadow_memory_dynamic_address - (1ULL << kShadowBaseAlignment); - uptr thread_space_end = - __hwasan_shadow_memory_dynamic_address - guard_page_size; - ReserveShadowMemoryRange(thread_space_start, thread_space_end - 1, - "hwasan threads", /*madvise_shadow*/ false); - ProtectGap(thread_space_end, - __hwasan_shadow_memory_dynamic_address - thread_space_end); - InitThreadList(thread_space_start, thread_space_end - thread_space_start); - hwasanThreadList().CreateCurrentThread(); -} - -bool MemIsApp(uptr p) { -// Memory outside the alias range has non-zero tags. -# if !defined(HWASAN_ALIASING_MODE) - CHECK(GetTagFromPointer(p) == 0); -# endif - - return (p >= kHighMemStart && p <= kHighMemEnd) || - (p >= kLowMemStart && p <= kLowMemEnd); -} - -void InstallAtExitHandler() { atexit(HwasanAtExit); } - -// ---------------------- TSD ---------------- {{{1 - -extern "C" void __hwasan_thread_enter() { - hwasanThreadList().CreateCurrentThread()->EnsureRandomStateInited(); -} - -extern "C" void __hwasan_thread_exit() { - Thread *t = GetCurrentThread(); - // Make sure that signal handler can not see a stale current thread pointer. - atomic_signal_fence(memory_order_seq_cst); - if (t) - hwasanThreadList().ReleaseThread(t); -} - -# if HWASAN_WITH_INTERCEPTORS -static pthread_key_t tsd_key; -static bool tsd_key_inited = false; - -void HwasanTSDThreadInit() { - if (tsd_key_inited) - CHECK_EQ(0, pthread_setspecific(tsd_key, - (void *)GetPthreadDestructorIterations())); -} - -void HwasanTSDDtor(void *tsd) { - uptr iterations = (uptr)tsd; - if (iterations > 1) { - CHECK_EQ(0, pthread_setspecific(tsd_key, (void *)(iterations - 1))); - return; - } - __hwasan_thread_exit(); -} - -void HwasanTSDInit() { - CHECK(!tsd_key_inited); - tsd_key_inited = true; - CHECK_EQ(0, pthread_key_create(&tsd_key, HwasanTSDDtor)); -} -# else -void HwasanTSDInit() {} -void HwasanTSDThreadInit() {} -# endif - -# if SANITIZER_ANDROID -uptr *GetCurrentThreadLongPtr() { return (uptr *)get_android_tls_ptr(); } -# else -uptr *GetCurrentThreadLongPtr() { return &__hwasan_tls; } -# endif - -# if SANITIZER_ANDROID -void AndroidTestTlsSlot() { - uptr kMagicValue = 0x010203040A0B0C0D; - uptr *tls_ptr = GetCurrentThreadLongPtr(); - uptr old_value = *tls_ptr; - *tls_ptr = kMagicValue; - dlerror(); - if (*(uptr *)get_android_tls_ptr() != kMagicValue) { - Printf( - "ERROR: Incompatible version of Android: TLS_SLOT_SANITIZER(6) is used " - "for dlerror().\n"); - Die(); - } - *tls_ptr = old_value; -} -# else -void AndroidTestTlsSlot() {} -# endif - -static AccessInfo GetAccessInfo(siginfo_t *info, ucontext_t *uc) { - // Access type is passed in a platform dependent way (see below) and encoded - // as 0xXY, where X&1 is 1 for store, 0 for load, and X&2 is 1 if the error is - // recoverable. Valid values of Y are 0 to 4, which are interpreted as - // log2(access_size), and 0xF, which means that access size is passed via - // platform dependent register (see below). -# if defined(__aarch64__) - // Access type is encoded in BRK immediate as 0x900 + 0xXY. For Y == 0xF, - // access size is stored in X1 register. Access address is always in X0 - // register. - uptr pc = (uptr)info->si_addr; - const unsigned code = ((*(u32 *)pc) >> 5) & 0xffff; - if ((code & 0xff00) != 0x900) - return AccessInfo{}; // Not ours. - - const bool is_store = code & 0x10; - const bool recover = code & 0x20; - const uptr addr = uc->uc_mcontext.regs[0]; - const unsigned size_log = code & 0xf; - if (size_log > 4 && size_log != 0xf) - return AccessInfo{}; // Not ours. - const uptr size = size_log == 0xf ? uc->uc_mcontext.regs[1] : 1U << size_log; - -# elif defined(__x86_64__) - // Access type is encoded in the instruction following INT3 as - // NOP DWORD ptr [EAX + 0x40 + 0xXY]. For Y == 0xF, access size is stored in - // RSI register. Access address is always in RDI register. - uptr pc = (uptr)uc->uc_mcontext.gregs[REG_RIP]; - uint8_t *nop = (uint8_t *)pc; - if (*nop != 0x0f || *(nop + 1) != 0x1f || *(nop + 2) != 0x40 || - *(nop + 3) < 0x40) - return AccessInfo{}; // Not ours. - const unsigned code = *(nop + 3); - - const bool is_store = code & 0x10; - const bool recover = code & 0x20; - const uptr addr = uc->uc_mcontext.gregs[REG_RDI]; - const unsigned size_log = code & 0xf; - if (size_log > 4 && size_log != 0xf) - return AccessInfo{}; // Not ours. - const uptr size = - size_log == 0xf ? uc->uc_mcontext.gregs[REG_RSI] : 1U << size_log; - -# else -# error Unsupported architecture -# endif - - return AccessInfo{addr, size, is_store, !is_store, recover}; -} - -static bool HwasanOnSIGTRAP(int signo, siginfo_t *info, ucontext_t *uc) { - AccessInfo ai = GetAccessInfo(info, uc); - if (!ai.is_store && !ai.is_load) - return false; - - SignalContext sig{info, uc}; - HandleTagMismatch(ai, StackTrace::GetNextInstructionPc(sig.pc), sig.bp, uc); - -# if defined(__aarch64__) - uc->uc_mcontext.pc += 4; -# elif defined(__x86_64__) -# else -# error Unsupported architecture -# endif - return true; -} - -static void OnStackUnwind(const SignalContext &sig, const void *, - BufferedStackTrace *stack) { - stack->Unwind(StackTrace::GetNextInstructionPc(sig.pc), sig.bp, sig.context, - common_flags()->fast_unwind_on_fatal); -} - -void HwasanOnDeadlySignal(int signo, void *info, void *context) { - // Probably a tag mismatch. - if (signo == SIGTRAP) - if (HwasanOnSIGTRAP(signo, (siginfo_t *)info, (ucontext_t *)context)) - return; - - HandleDeadlySignal(info, context, GetTid(), &OnStackUnwind, nullptr); -} - -void Thread::InitStackAndTls(const InitState *) { - uptr tls_size; - uptr stack_size; - GetThreadStackAndTls(IsMainThread(), &stack_bottom_, &stack_size, &tls_begin_, - &tls_size); - stack_top_ = stack_bottom_ + stack_size; - tls_end_ = tls_begin_ + tls_size; -} - -uptr TagMemoryAligned(uptr p, uptr size, tag_t tag) { - CHECK(IsAligned(p, kShadowAlignment)); - CHECK(IsAligned(size, kShadowAlignment)); - uptr shadow_start = MemToShadow(p); - uptr shadow_size = MemToShadowSize(size); - - uptr page_size = GetPageSizeCached(); - uptr page_start = RoundUpTo(shadow_start, page_size); - uptr page_end = RoundDownTo(shadow_start + shadow_size, page_size); - uptr threshold = common_flags()->clear_shadow_mmap_threshold; - if (SANITIZER_LINUX && - UNLIKELY(page_end >= page_start + threshold && tag == 0)) { - internal_memset((void *)shadow_start, tag, page_start - shadow_start); - internal_memset((void *)page_end, tag, - shadow_start + shadow_size - page_end); - // For an anonymous private mapping MADV_DONTNEED will return a zero page on - // Linux. - ReleaseMemoryPagesToOSAndZeroFill(page_start, page_end); - } else { - internal_memset((void *)shadow_start, tag, shadow_size); - } - return AddTagToPointer(p, tag); -} - -void HwasanInstallAtForkHandler() { - auto before = []() { - HwasanAllocatorLock(); - StackDepotLockAll(); - }; - auto after = []() { - StackDepotUnlockAll(); - HwasanAllocatorUnlock(); - }; - pthread_atfork(before, after, after); -} - -} // namespace __hwasan - -#endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_malloc_bisect.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_malloc_bisect.h deleted file mode 100644 index 7d134e8c4b7f..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_malloc_bisect.h +++ /dev/null @@ -1,50 +0,0 @@ -//===-- hwasan_malloc_bisect.h ----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_hash.h" -#include "hwasan.h" - -namespace __hwasan { - -static u32 malloc_hash(StackTrace *stack, uptr orig_size) { - uptr len = Min(stack->size, (unsigned)7); - MurMur2HashBuilder H(len); - H.add(orig_size); - // Start with frame #1 to skip __sanitizer_malloc frame, which is - // (a) almost always the same (well, could be operator new or new[]) - // (b) can change hashes when compiler-rt is rebuilt, invalidating previous - // bisection results. - // Because of ASLR, use only offset inside the page. - for (uptr i = 1; i < len; ++i) H.add(((u32)stack->trace[i]) & 0xFFF); - return H.get(); -} - -static inline bool malloc_bisect(StackTrace *stack, uptr orig_size) { - uptr left = flags()->malloc_bisect_left; - uptr right = flags()->malloc_bisect_right; - if (LIKELY(left == 0 && right == 0)) - return true; - if (!stack) - return true; - // Allow malloc_bisect_right > (u32)(-1) to avoid spelling the latter in - // decimal. - uptr h = (uptr)malloc_hash(stack, orig_size); - if (h < left || h > right) - return false; - if (flags()->malloc_bisect_dump) { - Printf("[alloc] %u %zu\n", h, orig_size); - stack->Print(); - } - return true; -} - -} // namespace __hwasan diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_mapping.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_mapping.h deleted file mode 100644 index 79a143632f6a..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_mapping.h +++ /dev/null @@ -1,75 +0,0 @@ -//===-- hwasan_mapping.h ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file is a part of HWAddressSanitizer and defines memory mapping. -/// -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_MAPPING_H -#define HWASAN_MAPPING_H - -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "hwasan_interface_internal.h" - -// Typical mapping on Linux/x86_64: -// with dynamic shadow mapped at [0x770d59f40000, 0x7f0d59f40000]: -// || [0x7f0d59f40000, 0x7fffffffffff] || HighMem || -// || [0x7efe2f934000, 0x7f0d59f3ffff] || HighShadow || -// || [0x7e7e2f934000, 0x7efe2f933fff] || ShadowGap || -// || [0x770d59f40000, 0x7e7e2f933fff] || LowShadow || -// || [0x000000000000, 0x770d59f3ffff] || LowMem || - -// Typical mapping on Android/AArch64 -// with dynamic shadow mapped: [0x007477480000, 0x007c77480000]: -// || [0x007c77480000, 0x007fffffffff] || HighMem || -// || [0x007c3ebc8000, 0x007c7747ffff] || HighShadow || -// || [0x007bbebc8000, 0x007c3ebc7fff] || ShadowGap || -// || [0x007477480000, 0x007bbebc7fff] || LowShadow || -// || [0x000000000000, 0x00747747ffff] || LowMem || - -// Reasonable values are 4 (for 1/16th shadow) and 6 (for 1/64th). -constexpr uptr kShadowScale = 4; -constexpr uptr kShadowAlignment = 1ULL << kShadowScale; - -namespace __hwasan { - -extern uptr kLowMemStart; -extern uptr kLowMemEnd; -extern uptr kLowShadowEnd; -extern uptr kLowShadowStart; -extern uptr kHighShadowStart; -extern uptr kHighShadowEnd; -extern uptr kHighMemStart; -extern uptr kHighMemEnd; - -inline uptr GetShadowOffset() { - return SANITIZER_FUCHSIA ? 0 : __hwasan_shadow_memory_dynamic_address; -} -inline uptr MemToShadow(uptr untagged_addr) { - return (untagged_addr >> kShadowScale) + GetShadowOffset(); -} -inline uptr ShadowToMem(uptr shadow_addr) { - return (shadow_addr - GetShadowOffset()) << kShadowScale; -} -inline uptr MemToShadowSize(uptr size) { - return size >> kShadowScale; -} - -bool MemIsApp(uptr p); - -inline bool MemIsShadow(uptr p) { - return (kLowShadowStart <= p && p <= kLowShadowEnd) || - (kHighShadowStart <= p && p <= kHighShadowEnd); -} - -uptr GetAliasRegionStart(); - -} // namespace __hwasan - -#endif // HWASAN_MAPPING_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_memintrinsics.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_memintrinsics.cpp deleted file mode 100644 index ea7f5ce40b07..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_memintrinsics.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===-- hwasan_memintrinsics.cpp --------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file is a part of HWAddressSanitizer and contains HWASAN versions of -/// memset, memcpy and memmove -/// -//===----------------------------------------------------------------------===// - -#include -#include "hwasan.h" -#include "hwasan_checks.h" -#include "hwasan_flags.h" -#include "hwasan_interface_internal.h" -#include "sanitizer_common/sanitizer_libc.h" - -using namespace __hwasan; - -void *__hwasan_memset(void *block, int c, uptr size) { - CheckAddressSized( - reinterpret_cast(block), size); - return memset(block, c, size); -} - -void *__hwasan_memcpy(void *to, const void *from, uptr size) { - CheckAddressSized( - reinterpret_cast(to), size); - CheckAddressSized( - reinterpret_cast(from), size); - return memcpy(to, from, size); -} - -void *__hwasan_memmove(void *to, const void *from, uptr size) { - CheckAddressSized( - reinterpret_cast(to), size); - CheckAddressSized( - reinterpret_cast(from), size); - return memmove(to, from, size); -} diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_new_delete.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_new_delete.cpp deleted file mode 100644 index 4e057a651e1d..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_new_delete.cpp +++ /dev/null @@ -1,135 +0,0 @@ -//===-- hwasan_new_delete.cpp ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Interceptors for operators new and delete. -//===----------------------------------------------------------------------===// - -#include "hwasan.h" -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_allocator.h" -#include "sanitizer_common/sanitizer_allocator_report.h" - -#include -#include - -#if HWASAN_REPLACE_OPERATORS_NEW_AND_DELETE - -// TODO(alekseys): throw std::bad_alloc instead of dying on OOM. -#define OPERATOR_NEW_BODY(nothrow) \ - GET_MALLOC_STACK_TRACE; \ - void *res = hwasan_malloc(size, &stack);\ - if (!nothrow && UNLIKELY(!res)) ReportOutOfMemory(size, &stack);\ - return res -#define OPERATOR_NEW_ALIGN_BODY(nothrow) \ - GET_MALLOC_STACK_TRACE; \ - void *res = hwasan_aligned_alloc(static_cast(align), size, &stack); \ - if (!nothrow && UNLIKELY(!res)) \ - ReportOutOfMemory(size, &stack); \ - return res - -#define OPERATOR_DELETE_BODY \ - GET_MALLOC_STACK_TRACE; \ - if (ptr) hwasan_free(ptr, &stack) - -#elif defined(__ANDROID__) - -// We don't actually want to intercept operator new and delete on Android, but -// since we previously released a runtime that intercepted these functions, -// removing the interceptors would break ABI. Therefore we simply forward to -// malloc and free. -#define OPERATOR_NEW_BODY(nothrow) return malloc(size) -#define OPERATOR_DELETE_BODY free(ptr) - -#endif - -#ifdef OPERATOR_NEW_BODY - -using namespace __hwasan; - -// Fake std::nothrow_t to avoid including . -namespace std { - struct nothrow_t {}; -} // namespace std - - - -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -void *operator new(size_t size) { OPERATOR_NEW_BODY(false /*nothrow*/); } -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -void *operator new[](size_t size) { OPERATOR_NEW_BODY(false /*nothrow*/); } -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -void *operator new(size_t size, std::nothrow_t const&) { - OPERATOR_NEW_BODY(true /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -void *operator new[](size_t size, std::nothrow_t const&) { - OPERATOR_NEW_BODY(true /*nothrow*/); -} - -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void operator delete(void *ptr) - NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void operator delete[]( - void *ptr) NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void operator delete( - void *ptr, std::nothrow_t const &) { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void operator delete[]( - void *ptr, std::nothrow_t const &) { - OPERATOR_DELETE_BODY; -} - -#endif // OPERATOR_NEW_BODY - -#ifdef OPERATOR_NEW_ALIGN_BODY - -namespace std { -enum class align_val_t : size_t {}; -} // namespace std - -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void *operator new( - size_t size, std::align_val_t align) { - OPERATOR_NEW_ALIGN_BODY(false /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void *operator new[]( - size_t size, std::align_val_t align) { - OPERATOR_NEW_ALIGN_BODY(false /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void *operator new( - size_t size, std::align_val_t align, std::nothrow_t const &) { - OPERATOR_NEW_ALIGN_BODY(true /*nothrow*/); -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void *operator new[]( - size_t size, std::align_val_t align, std::nothrow_t const &) { - OPERATOR_NEW_ALIGN_BODY(true /*nothrow*/); -} - -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void operator delete( - void *ptr, std::align_val_t align) NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void operator delete[]( - void *ptr, std::align_val_t) NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void operator delete( - void *ptr, std::align_val_t, std::nothrow_t const &) NOEXCEPT { - OPERATOR_DELETE_BODY; -} -INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void operator delete[]( - void *ptr, std::align_val_t, std::nothrow_t const &) NOEXCEPT { - OPERATOR_DELETE_BODY; -} - -#endif // OPERATOR_NEW_ALIGN_BODY diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_poisoning.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_poisoning.cpp deleted file mode 100644 index 5aafdb1884b5..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_poisoning.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===-- hwasan_poisoning.cpp ------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -//===----------------------------------------------------------------------===// - -#include "hwasan_poisoning.h" - -#include "hwasan_mapping.h" -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_linux.h" - -namespace __hwasan { - -uptr TagMemory(uptr p, uptr size, tag_t tag) { - uptr start = RoundDownTo(p, kShadowAlignment); - uptr end = RoundUpTo(p + size, kShadowAlignment); - return TagMemoryAligned(start, end - start, tag); -} - -} // namespace __hwasan diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_poisoning.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_poisoning.h deleted file mode 100644 index 61751f7d252e..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_poisoning.h +++ /dev/null @@ -1,24 +0,0 @@ -//===-- hwasan_poisoning.h --------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_POISONING_H -#define HWASAN_POISONING_H - -#include "hwasan.h" - -namespace __hwasan { -uptr TagMemory(uptr p, uptr size, tag_t tag); -uptr TagMemoryAligned(uptr p, uptr size, tag_t tag); - -} // namespace __hwasan - -#endif // HWASAN_POISONING_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_report.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_report.cpp deleted file mode 100644 index 66d3d155d409..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_report.cpp +++ /dev/null @@ -1,781 +0,0 @@ -//===-- hwasan_report.cpp -------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Error reporting. -//===----------------------------------------------------------------------===// - -#include "hwasan_report.h" - -#include - -#include "hwasan.h" -#include "hwasan_allocator.h" -#include "hwasan_globals.h" -#include "hwasan_mapping.h" -#include "hwasan_thread.h" -#include "hwasan_thread_list.h" -#include "sanitizer_common/sanitizer_allocator_internal.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_flags.h" -#include "sanitizer_common/sanitizer_mutex.h" -#include "sanitizer_common/sanitizer_report_decorator.h" -#include "sanitizer_common/sanitizer_stackdepot.h" -#include "sanitizer_common/sanitizer_stacktrace_printer.h" -#include "sanitizer_common/sanitizer_symbolizer.h" - -using namespace __sanitizer; - -namespace __hwasan { - -class ScopedReport { - public: - ScopedReport(bool fatal = false) : error_message_(1), fatal(fatal) { - Lock lock(&error_message_lock_); - error_message_ptr_ = fatal ? &error_message_ : nullptr; - ++hwasan_report_count; - } - - ~ScopedReport() { - void (*report_cb)(const char *); - { - Lock lock(&error_message_lock_); - report_cb = error_report_callback_; - error_message_ptr_ = nullptr; - } - if (report_cb) - report_cb(error_message_.data()); - if (fatal) - SetAbortMessage(error_message_.data()); - if (common_flags()->print_module_map >= 2 || - (fatal && common_flags()->print_module_map)) - DumpProcessMap(); - if (fatal) - Die(); - } - - static void MaybeAppendToErrorMessage(const char *msg) { - Lock lock(&error_message_lock_); - if (!error_message_ptr_) - return; - uptr len = internal_strlen(msg); - uptr old_size = error_message_ptr_->size(); - error_message_ptr_->resize(old_size + len); - // overwrite old trailing '\0', keep new trailing '\0' untouched. - internal_memcpy(&(*error_message_ptr_)[old_size - 1], msg, len); - } - - static void SetErrorReportCallback(void (*callback)(const char *)) { - Lock lock(&error_message_lock_); - error_report_callback_ = callback; - } - - private: - ScopedErrorReportLock error_report_lock_; - InternalMmapVector error_message_; - bool fatal; - - static InternalMmapVector *error_message_ptr_; - static Mutex error_message_lock_; - static void (*error_report_callback_)(const char *); -}; - -InternalMmapVector *ScopedReport::error_message_ptr_; -Mutex ScopedReport::error_message_lock_; -void (*ScopedReport::error_report_callback_)(const char *); - -// If there is an active ScopedReport, append to its error message. -void AppendToErrorMessageBuffer(const char *buffer) { - ScopedReport::MaybeAppendToErrorMessage(buffer); -} - -static StackTrace GetStackTraceFromId(u32 id) { - CHECK(id); - StackTrace res = StackDepotGet(id); - CHECK(res.trace); - return res; -} - -// A RAII object that holds a copy of the current thread stack ring buffer. -// The actual stack buffer may change while we are iterating over it (for -// example, Printf may call syslog() which can itself be built with hwasan). -class SavedStackAllocations { - public: - SavedStackAllocations(StackAllocationsRingBuffer *rb) { - uptr size = rb->size() * sizeof(uptr); - void *storage = - MmapAlignedOrDieOnFatalError(size, size * 2, "saved stack allocations"); - new (&rb_) StackAllocationsRingBuffer(*rb, storage); - } - - ~SavedStackAllocations() { - StackAllocationsRingBuffer *rb = get(); - UnmapOrDie(rb->StartOfStorage(), rb->size() * sizeof(uptr)); - } - - StackAllocationsRingBuffer *get() { - return (StackAllocationsRingBuffer *)&rb_; - } - - private: - uptr rb_; -}; - -class Decorator: public __sanitizer::SanitizerCommonDecorator { - public: - Decorator() : SanitizerCommonDecorator() { } - const char *Access() { return Blue(); } - const char *Allocation() const { return Magenta(); } - const char *Origin() const { return Magenta(); } - const char *Name() const { return Green(); } - const char *Location() { return Green(); } - const char *Thread() { return Green(); } -}; - -static bool FindHeapAllocation(HeapAllocationsRingBuffer *rb, uptr tagged_addr, - HeapAllocationRecord *har, uptr *ring_index, - uptr *num_matching_addrs, - uptr *num_matching_addrs_4b) { - if (!rb) return false; - - *num_matching_addrs = 0; - *num_matching_addrs_4b = 0; - for (uptr i = 0, size = rb->size(); i < size; i++) { - auto h = (*rb)[i]; - if (h.tagged_addr <= tagged_addr && - h.tagged_addr + h.requested_size > tagged_addr) { - *har = h; - *ring_index = i; - return true; - } - - // Measure the number of heap ring buffer entries that would have matched - // if we had only one entry per address (e.g. if the ring buffer data was - // stored at the address itself). This will help us tune the allocator - // implementation for MTE. - if (UntagAddr(h.tagged_addr) <= UntagAddr(tagged_addr) && - UntagAddr(h.tagged_addr) + h.requested_size > UntagAddr(tagged_addr)) { - ++*num_matching_addrs; - } - - // Measure the number of heap ring buffer entries that would have matched - // if we only had 4 tag bits, which is the case for MTE. - auto untag_4b = [](uptr p) { - return p & ((1ULL << 60) - 1); - }; - if (untag_4b(h.tagged_addr) <= untag_4b(tagged_addr) && - untag_4b(h.tagged_addr) + h.requested_size > untag_4b(tagged_addr)) { - ++*num_matching_addrs_4b; - } - } - return false; -} - -static void PrintStackAllocations(StackAllocationsRingBuffer *sa, - tag_t addr_tag, uptr untagged_addr) { - uptr frames = Min((uptr)flags()->stack_history_size, sa->size()); - bool found_local = false; - for (uptr i = 0; i < frames; i++) { - const uptr *record_addr = &(*sa)[i]; - uptr record = *record_addr; - if (!record) - break; - tag_t base_tag = - reinterpret_cast(record_addr) >> kRecordAddrBaseTagShift; - uptr fp = (record >> kRecordFPShift) << kRecordFPLShift; - uptr pc_mask = (1ULL << kRecordFPShift) - 1; - uptr pc = record & pc_mask; - FrameInfo frame; - if (Symbolizer::GetOrInit()->SymbolizeFrame(pc, &frame)) { - for (LocalInfo &local : frame.locals) { - if (!local.has_frame_offset || !local.has_size || !local.has_tag_offset) - continue; - tag_t obj_tag = base_tag ^ local.tag_offset; - if (obj_tag != addr_tag) - continue; - // Calculate the offset from the object address to the faulting - // address. Because we only store bits 4-19 of FP (bits 0-3 are - // guaranteed to be zero), the calculation is performed mod 2^20 and may - // harmlessly underflow if the address mod 2^20 is below the object - // address. - uptr obj_offset = - (untagged_addr - fp - local.frame_offset) & (kRecordFPModulus - 1); - if (obj_offset >= local.size) - continue; - if (!found_local) { - Printf("Potentially referenced stack objects:\n"); - found_local = true; - } - Printf(" %s in %s %s:%d\n", local.name, local.function_name, - local.decl_file, local.decl_line); - } - frame.Clear(); - } - } - - if (found_local) - return; - - // We didn't find any locals. Most likely we don't have symbols, so dump - // the information that we have for offline analysis. - InternalScopedString frame_desc; - Printf("Previously allocated frames:\n"); - for (uptr i = 0; i < frames; i++) { - const uptr *record_addr = &(*sa)[i]; - uptr record = *record_addr; - if (!record) - break; - uptr pc_mask = (1ULL << 48) - 1; - uptr pc = record & pc_mask; - frame_desc.append(" record_addr:0x%zx record:0x%zx", - reinterpret_cast(record_addr), record); - if (SymbolizedStack *frame = Symbolizer::GetOrInit()->SymbolizePC(pc)) { - RenderFrame(&frame_desc, " %F %L", 0, frame->info.address, &frame->info, - common_flags()->symbolize_vs_style, - common_flags()->strip_path_prefix); - frame->ClearAll(); - } - Printf("%s\n", frame_desc.data()); - frame_desc.clear(); - } -} - -// Returns true if tag == *tag_ptr, reading tags from short granules if -// necessary. This may return a false positive if tags 1-15 are used as a -// regular tag rather than a short granule marker. -static bool TagsEqual(tag_t tag, tag_t *tag_ptr) { - if (tag == *tag_ptr) - return true; - if (*tag_ptr == 0 || *tag_ptr > kShadowAlignment - 1) - return false; - uptr mem = ShadowToMem(reinterpret_cast(tag_ptr)); - tag_t inline_tag = *reinterpret_cast(mem + kShadowAlignment - 1); - return tag == inline_tag; -} - -// HWASan globals store the size of the global in the descriptor. In cases where -// we don't have a binary with symbols, we can't grab the size of the global -// from the debug info - but we might be able to retrieve it from the -// descriptor. Returns zero if the lookup failed. -static uptr GetGlobalSizeFromDescriptor(uptr ptr) { - // Find the ELF object that this global resides in. - Dl_info info; - if (dladdr(reinterpret_cast(ptr), &info) == 0) - return 0; - auto *ehdr = reinterpret_cast(info.dli_fbase); - auto *phdr_begin = reinterpret_cast( - reinterpret_cast(ehdr) + ehdr->e_phoff); - - // Get the load bias. This is normally the same as the dli_fbase address on - // position-independent code, but can be different on non-PIE executables, - // binaries using LLD's partitioning feature, or binaries compiled with a - // linker script. - ElfW(Addr) load_bias = 0; - for (const auto &phdr : - ArrayRef(phdr_begin, phdr_begin + ehdr->e_phnum)) { - if (phdr.p_type != PT_LOAD || phdr.p_offset != 0) - continue; - load_bias = reinterpret_cast(ehdr) - phdr.p_vaddr; - break; - } - - // Walk all globals in this ELF object, looking for the one we're interested - // in. Once we find it, we can stop iterating and return the size of the - // global we're interested in. - for (const hwasan_global &global : - HwasanGlobalsFor(load_bias, phdr_begin, ehdr->e_phnum)) - if (global.addr() <= ptr && ptr < global.addr() + global.size()) - return global.size(); - - return 0; -} - -static void ShowHeapOrGlobalCandidate(uptr untagged_addr, tag_t *candidate, - tag_t *left, tag_t *right) { - Decorator d; - uptr mem = ShadowToMem(reinterpret_cast(candidate)); - HwasanChunkView chunk = FindHeapChunkByAddress(mem); - if (chunk.IsAllocated()) { - uptr offset; - const char *whence; - if (untagged_addr < chunk.End() && untagged_addr >= chunk.Beg()) { - offset = untagged_addr - chunk.Beg(); - whence = "inside"; - } else if (candidate == left) { - offset = untagged_addr - chunk.End(); - whence = "to the right of"; - } else { - offset = chunk.Beg() - untagged_addr; - whence = "to the left of"; - } - Printf("%s", d.Error()); - Printf("\nCause: heap-buffer-overflow\n"); - Printf("%s", d.Default()); - Printf("%s", d.Location()); - Printf("%p is located %zd bytes %s %zd-byte region [%p,%p)\n", - untagged_addr, offset, whence, chunk.UsedSize(), chunk.Beg(), - chunk.End()); - Printf("%s", d.Allocation()); - Printf("allocated here:\n"); - Printf("%s", d.Default()); - GetStackTraceFromId(chunk.GetAllocStackId()).Print(); - return; - } - // Check whether the address points into a loaded library. If so, this is - // most likely a global variable. - const char *module_name; - uptr module_address; - Symbolizer *sym = Symbolizer::GetOrInit(); - if (sym->GetModuleNameAndOffsetForPC(mem, &module_name, &module_address)) { - Printf("%s", d.Error()); - Printf("\nCause: global-overflow\n"); - Printf("%s", d.Default()); - DataInfo info; - Printf("%s", d.Location()); - if (sym->SymbolizeData(mem, &info) && info.start) { - Printf( - "%p is located %zd bytes to the %s of %zd-byte global variable " - "%s [%p,%p) in %s\n", - untagged_addr, - candidate == left ? untagged_addr - (info.start + info.size) - : info.start - untagged_addr, - candidate == left ? "right" : "left", info.size, info.name, - info.start, info.start + info.size, module_name); - } else { - uptr size = GetGlobalSizeFromDescriptor(mem); - if (size == 0) - // We couldn't find the size of the global from the descriptors. - Printf( - "%p is located to the %s of a global variable in " - "\n #0 0x%x (%s+0x%x)\n", - untagged_addr, candidate == left ? "right" : "left", mem, - module_name, module_address); - else - Printf( - "%p is located to the %s of a %zd-byte global variable in " - "\n #0 0x%x (%s+0x%x)\n", - untagged_addr, candidate == left ? "right" : "left", size, mem, - module_name, module_address); - } - Printf("%s", d.Default()); - } -} - -void PrintAddressDescription( - uptr tagged_addr, uptr access_size, - StackAllocationsRingBuffer *current_stack_allocations) { - Decorator d; - int num_descriptions_printed = 0; - uptr untagged_addr = UntagAddr(tagged_addr); - - if (MemIsShadow(untagged_addr)) { - Printf("%s%p is HWAsan shadow memory.\n%s", d.Location(), untagged_addr, - d.Default()); - return; - } - - // Print some very basic information about the address, if it's a heap. - HwasanChunkView chunk = FindHeapChunkByAddress(untagged_addr); - if (uptr beg = chunk.Beg()) { - uptr size = chunk.ActualSize(); - Printf("%s[%p,%p) is a %s %s heap chunk; " - "size: %zd offset: %zd\n%s", - d.Location(), - beg, beg + size, - chunk.FromSmallHeap() ? "small" : "large", - chunk.IsAllocated() ? "allocated" : "unallocated", - size, untagged_addr - beg, - d.Default()); - } - - tag_t addr_tag = GetTagFromPointer(tagged_addr); - - bool on_stack = false; - // Check stack first. If the address is on the stack of a live thread, we - // know it cannot be a heap / global overflow. - hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { - if (t->AddrIsInStack(untagged_addr)) { - on_stack = true; - // TODO(fmayer): figure out how to distinguish use-after-return and - // stack-buffer-overflow. - Printf("%s", d.Error()); - Printf("\nCause: stack tag-mismatch\n"); - Printf("%s", d.Location()); - Printf("Address %p is located in stack of thread T%zd\n", untagged_addr, - t->unique_id()); - Printf("%s", d.Default()); - t->Announce(); - - auto *sa = (t == GetCurrentThread() && current_stack_allocations) - ? current_stack_allocations - : t->stack_allocations(); - PrintStackAllocations(sa, addr_tag, untagged_addr); - num_descriptions_printed++; - } - }); - - // Check if this looks like a heap buffer overflow by scanning - // the shadow left and right and looking for the first adjacent - // object with a different memory tag. If that tag matches addr_tag, - // check the allocator if it has a live chunk there. - tag_t *tag_ptr = reinterpret_cast(MemToShadow(untagged_addr)); - tag_t *candidate = nullptr, *left = tag_ptr, *right = tag_ptr; - uptr candidate_distance = 0; - for (; candidate_distance < 1000; candidate_distance++) { - if (MemIsShadow(reinterpret_cast(left)) && - TagsEqual(addr_tag, left)) { - candidate = left; - break; - } - --left; - if (MemIsShadow(reinterpret_cast(right)) && - TagsEqual(addr_tag, right)) { - candidate = right; - break; - } - ++right; - } - - constexpr auto kCloseCandidateDistance = 1; - - if (!on_stack && candidate && candidate_distance <= kCloseCandidateDistance) { - ShowHeapOrGlobalCandidate(untagged_addr, candidate, left, right); - num_descriptions_printed++; - } - - hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { - // Scan all threads' ring buffers to find if it's a heap-use-after-free. - HeapAllocationRecord har; - uptr ring_index, num_matching_addrs, num_matching_addrs_4b; - if (FindHeapAllocation(t->heap_allocations(), tagged_addr, &har, - &ring_index, &num_matching_addrs, - &num_matching_addrs_4b)) { - Printf("%s", d.Error()); - Printf("\nCause: use-after-free\n"); - Printf("%s", d.Location()); - Printf("%p is located %zd bytes inside of %zd-byte region [%p,%p)\n", - untagged_addr, untagged_addr - UntagAddr(har.tagged_addr), - har.requested_size, UntagAddr(har.tagged_addr), - UntagAddr(har.tagged_addr) + har.requested_size); - Printf("%s", d.Allocation()); - Printf("freed by thread T%zd here:\n", t->unique_id()); - Printf("%s", d.Default()); - GetStackTraceFromId(har.free_context_id).Print(); - - Printf("%s", d.Allocation()); - Printf("previously allocated here:\n", t); - Printf("%s", d.Default()); - GetStackTraceFromId(har.alloc_context_id).Print(); - - // Print a developer note: the index of this heap object - // in the thread's deallocation ring buffer. - Printf("hwasan_dev_note_heap_rb_distance: %zd %zd\n", ring_index + 1, - flags()->heap_history_size); - Printf("hwasan_dev_note_num_matching_addrs: %zd\n", num_matching_addrs); - Printf("hwasan_dev_note_num_matching_addrs_4b: %zd\n", - num_matching_addrs_4b); - - t->Announce(); - num_descriptions_printed++; - } - }); - - if (candidate && num_descriptions_printed == 0) { - ShowHeapOrGlobalCandidate(untagged_addr, candidate, left, right); - num_descriptions_printed++; - } - - // Print the remaining threads, as an extra information, 1 line per thread. - hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); }); - - if (!num_descriptions_printed) - // We exhausted our possibilities. Bail out. - Printf("HWAddressSanitizer can not describe address in more detail.\n"); - if (num_descriptions_printed > 1) { - Printf( - "There are %d potential causes, printed above in order " - "of likeliness.\n", - num_descriptions_printed); - } -} - -void ReportStats() {} - -static void PrintTagInfoAroundAddr(tag_t *tag_ptr, uptr num_rows, - void (*print_tag)(InternalScopedString &s, - tag_t *tag)) { - const uptr row_len = 16; // better be power of two. - tag_t *center_row_beg = reinterpret_cast( - RoundDownTo(reinterpret_cast(tag_ptr), row_len)); - tag_t *beg_row = center_row_beg - row_len * (num_rows / 2); - tag_t *end_row = center_row_beg + row_len * ((num_rows + 1) / 2); - InternalScopedString s; - for (tag_t *row = beg_row; row < end_row; row += row_len) { - s.append("%s", row == center_row_beg ? "=>" : " "); - s.append("%p:", (void *)row); - for (uptr i = 0; i < row_len; i++) { - s.append("%s", row + i == tag_ptr ? "[" : " "); - print_tag(s, &row[i]); - s.append("%s", row + i == tag_ptr ? "]" : " "); - } - s.append("\n"); - } - Printf("%s", s.data()); -} - -static void PrintTagsAroundAddr(tag_t *tag_ptr) { - Printf( - "Memory tags around the buggy address (one tag corresponds to %zd " - "bytes):\n", kShadowAlignment); - PrintTagInfoAroundAddr(tag_ptr, 17, [](InternalScopedString &s, tag_t *tag) { - s.append("%02x", *tag); - }); - - Printf( - "Tags for short granules around the buggy address (one tag corresponds " - "to %zd bytes):\n", - kShadowAlignment); - PrintTagInfoAroundAddr(tag_ptr, 3, [](InternalScopedString &s, tag_t *tag) { - if (*tag >= 1 && *tag <= kShadowAlignment) { - uptr granule_addr = ShadowToMem(reinterpret_cast(tag)); - s.append("%02x", - *reinterpret_cast(granule_addr + kShadowAlignment - 1)); - } else { - s.append(".."); - } - }); - Printf( - "See " - "https://clang.llvm.org/docs/" - "HardwareAssistedAddressSanitizerDesign.html#short-granules for a " - "description of short granule tags\n"); -} - -uptr GetTopPc(StackTrace *stack) { - return stack->size ? StackTrace::GetPreviousInstructionPc(stack->trace[0]) - : 0; -} - -void ReportInvalidFree(StackTrace *stack, uptr tagged_addr) { - ScopedReport R(flags()->halt_on_error); - - uptr untagged_addr = UntagAddr(tagged_addr); - tag_t ptr_tag = GetTagFromPointer(tagged_addr); - tag_t *tag_ptr = nullptr; - tag_t mem_tag = 0; - if (MemIsApp(untagged_addr)) { - tag_ptr = reinterpret_cast(MemToShadow(untagged_addr)); - if (MemIsShadow(reinterpret_cast(tag_ptr))) - mem_tag = *tag_ptr; - else - tag_ptr = nullptr; - } - Decorator d; - Printf("%s", d.Error()); - uptr pc = GetTopPc(stack); - const char *bug_type = "invalid-free"; - const Thread *thread = GetCurrentThread(); - if (thread) { - Report("ERROR: %s: %s on address %p at pc %p on thread T%zd\n", - SanitizerToolName, bug_type, untagged_addr, pc, thread->unique_id()); - } else { - Report("ERROR: %s: %s on address %p at pc %p on unknown thread\n", - SanitizerToolName, bug_type, untagged_addr, pc); - } - Printf("%s", d.Access()); - if (tag_ptr) - Printf("tags: %02x/%02x (ptr/mem)\n", ptr_tag, mem_tag); - Printf("%s", d.Default()); - - stack->Print(); - - PrintAddressDescription(tagged_addr, 0, nullptr); - - if (tag_ptr) - PrintTagsAroundAddr(tag_ptr); - - ReportErrorSummary(bug_type, stack); -} - -void ReportTailOverwritten(StackTrace *stack, uptr tagged_addr, uptr orig_size, - const u8 *expected) { - uptr tail_size = kShadowAlignment - (orig_size % kShadowAlignment); - u8 actual_expected[kShadowAlignment]; - internal_memcpy(actual_expected, expected, tail_size); - tag_t ptr_tag = GetTagFromPointer(tagged_addr); - // Short granule is stashed in the last byte of the magic string. To avoid - // confusion, make the expected magic string contain the short granule tag. - if (orig_size % kShadowAlignment != 0) { - actual_expected[tail_size - 1] = ptr_tag; - } - - ScopedReport R(flags()->halt_on_error); - Decorator d; - uptr untagged_addr = UntagAddr(tagged_addr); - Printf("%s", d.Error()); - const char *bug_type = "allocation-tail-overwritten"; - Report("ERROR: %s: %s; heap object [%p,%p) of size %zd\n", SanitizerToolName, - bug_type, untagged_addr, untagged_addr + orig_size, orig_size); - Printf("\n%s", d.Default()); - Printf( - "Stack of invalid access unknown. Issue detected at deallocation " - "time.\n"); - Printf("%s", d.Allocation()); - Printf("deallocated here:\n"); - Printf("%s", d.Default()); - stack->Print(); - HwasanChunkView chunk = FindHeapChunkByAddress(untagged_addr); - if (chunk.Beg()) { - Printf("%s", d.Allocation()); - Printf("allocated here:\n"); - Printf("%s", d.Default()); - GetStackTraceFromId(chunk.GetAllocStackId()).Print(); - } - - InternalScopedString s; - CHECK_GT(tail_size, 0U); - CHECK_LT(tail_size, kShadowAlignment); - u8 *tail = reinterpret_cast(untagged_addr + orig_size); - s.append("Tail contains: "); - for (uptr i = 0; i < kShadowAlignment - tail_size; i++) - s.append(".. "); - for (uptr i = 0; i < tail_size; i++) - s.append("%02x ", tail[i]); - s.append("\n"); - s.append("Expected: "); - for (uptr i = 0; i < kShadowAlignment - tail_size; i++) - s.append(".. "); - for (uptr i = 0; i < tail_size; i++) s.append("%02x ", actual_expected[i]); - s.append("\n"); - s.append(" "); - for (uptr i = 0; i < kShadowAlignment - tail_size; i++) - s.append(" "); - for (uptr i = 0; i < tail_size; i++) - s.append("%s ", actual_expected[i] != tail[i] ? "^^" : " "); - - s.append("\nThis error occurs when a buffer overflow overwrites memory\n" - "to the right of a heap object, but within the %zd-byte granule, e.g.\n" - " char *x = new char[20];\n" - " x[25] = 42;\n" - "%s does not detect such bugs in uninstrumented code at the time of write," - "\nbut can detect them at the time of free/delete.\n" - "To disable this feature set HWASAN_OPTIONS=free_checks_tail_magic=0\n", - kShadowAlignment, SanitizerToolName); - Printf("%s", s.data()); - GetCurrentThread()->Announce(); - - tag_t *tag_ptr = reinterpret_cast(MemToShadow(untagged_addr)); - PrintTagsAroundAddr(tag_ptr); - - ReportErrorSummary(bug_type, stack); -} - -void ReportTagMismatch(StackTrace *stack, uptr tagged_addr, uptr access_size, - bool is_store, bool fatal, uptr *registers_frame) { - ScopedReport R(fatal); - SavedStackAllocations current_stack_allocations( - GetCurrentThread()->stack_allocations()); - - Decorator d; - uptr untagged_addr = UntagAddr(tagged_addr); - // TODO: when possible, try to print heap-use-after-free, etc. - const char *bug_type = "tag-mismatch"; - uptr pc = GetTopPc(stack); - Printf("%s", d.Error()); - Report("ERROR: %s: %s on address %p at pc %p\n", SanitizerToolName, bug_type, - untagged_addr, pc); - - Thread *t = GetCurrentThread(); - - sptr offset = - __hwasan_test_shadow(reinterpret_cast(tagged_addr), access_size); - CHECK(offset >= 0 && offset < static_cast(access_size)); - tag_t ptr_tag = GetTagFromPointer(tagged_addr); - tag_t *tag_ptr = - reinterpret_cast(MemToShadow(untagged_addr + offset)); - tag_t mem_tag = *tag_ptr; - - Printf("%s", d.Access()); - if (mem_tag && mem_tag < kShadowAlignment) { - tag_t *granule_ptr = reinterpret_cast((untagged_addr + offset) & - ~(kShadowAlignment - 1)); - // If offset is 0, (untagged_addr + offset) is not aligned to granules. - // This is the offset of the leftmost accessed byte within the bad granule. - u8 in_granule_offset = (untagged_addr + offset) & (kShadowAlignment - 1); - tag_t short_tag = granule_ptr[kShadowAlignment - 1]; - // The first mismatch was a short granule that matched the ptr_tag. - if (short_tag == ptr_tag) { - // If the access starts after the end of the short granule, then the first - // bad byte is the first byte of the access; otherwise it is the first - // byte past the end of the short granule - if (mem_tag > in_granule_offset) { - offset += mem_tag - in_granule_offset; - } - } - Printf( - "%s of size %zu at %p tags: %02x/%02x(%02x) (ptr/mem) in thread T%zd\n", - is_store ? "WRITE" : "READ", access_size, untagged_addr, ptr_tag, - mem_tag, short_tag, t->unique_id()); - } else { - Printf("%s of size %zu at %p tags: %02x/%02x (ptr/mem) in thread T%zd\n", - is_store ? "WRITE" : "READ", access_size, untagged_addr, ptr_tag, - mem_tag, t->unique_id()); - } - if (offset != 0) - Printf("Invalid access starting at offset %zu\n", offset); - Printf("%s", d.Default()); - - stack->Print(); - - PrintAddressDescription(tagged_addr, access_size, - current_stack_allocations.get()); - t->Announce(); - - PrintTagsAroundAddr(tag_ptr); - - if (registers_frame) - ReportRegisters(registers_frame, pc); - - ReportErrorSummary(bug_type, stack); -} - -// See the frame breakdown defined in __hwasan_tag_mismatch (from -// hwasan_tag_mismatch_aarch64.S). -void ReportRegisters(uptr *frame, uptr pc) { - Printf("Registers where the failure occurred (pc %p):\n", pc); - - // We explicitly print a single line (4 registers/line) each iteration to - // reduce the amount of logcat error messages printed. Each Printf() will - // result in a new logcat line, irrespective of whether a newline is present, - // and so we wish to reduce the number of Printf() calls we have to make. - Printf(" x0 %016llx x1 %016llx x2 %016llx x3 %016llx\n", - frame[0], frame[1], frame[2], frame[3]); - Printf(" x4 %016llx x5 %016llx x6 %016llx x7 %016llx\n", - frame[4], frame[5], frame[6], frame[7]); - Printf(" x8 %016llx x9 %016llx x10 %016llx x11 %016llx\n", - frame[8], frame[9], frame[10], frame[11]); - Printf(" x12 %016llx x13 %016llx x14 %016llx x15 %016llx\n", - frame[12], frame[13], frame[14], frame[15]); - Printf(" x16 %016llx x17 %016llx x18 %016llx x19 %016llx\n", - frame[16], frame[17], frame[18], frame[19]); - Printf(" x20 %016llx x21 %016llx x22 %016llx x23 %016llx\n", - frame[20], frame[21], frame[22], frame[23]); - Printf(" x24 %016llx x25 %016llx x26 %016llx x27 %016llx\n", - frame[24], frame[25], frame[26], frame[27]); - // hwasan_check* reduces the stack pointer by 256, then __hwasan_tag_mismatch - // passes it to this function. - Printf(" x28 %016llx x29 %016llx x30 %016llx sp %016llx\n", frame[28], - frame[29], frame[30], reinterpret_cast(frame) + 256); -} - -} // namespace __hwasan - -void __hwasan_set_error_report_callback(void (*callback)(const char *)) { - __hwasan::ScopedReport::SetErrorReportCallback(callback); -} diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_report.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_report.h deleted file mode 100644 index de86c38fc01f..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_report.h +++ /dev/null @@ -1,35 +0,0 @@ -//===-- hwasan_report.h -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file is a part of HWAddressSanitizer. HWASan-private header for error -/// reporting functions. -/// -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_REPORT_H -#define HWASAN_REPORT_H - -#include "sanitizer_common/sanitizer_internal_defs.h" -#include "sanitizer_common/sanitizer_stacktrace.h" - -namespace __hwasan { - -void ReportStats(); -void ReportTagMismatch(StackTrace *stack, uptr addr, uptr access_size, - bool is_store, bool fatal, uptr *registers_frame); -void ReportInvalidFree(StackTrace *stack, uptr addr); -void ReportTailOverwritten(StackTrace *stack, uptr addr, uptr orig_size, - const u8 *expected); -void ReportRegisters(uptr *registers_frame, uptr pc); -void ReportAtExitStatistics(); - - -} // namespace __hwasan - -#endif // HWASAN_REPORT_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_setjmp_aarch64.S b/contrib/libs/clang14-rt/lib/hwasan/hwasan_setjmp_aarch64.S deleted file mode 100644 index 744748a5101f..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_setjmp_aarch64.S +++ /dev/null @@ -1,101 +0,0 @@ -//===-- hwasan_setjmp_aarch64.S -------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// HWAddressSanitizer runtime. -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_asm.h" -#include "builtins/assembly.h" - -#if HWASAN_WITH_INTERCEPTORS && defined(__aarch64__) -#include "sanitizer_common/sanitizer_platform.h" - -// We want to save the context of the calling function. -// That requires -// 1) No modification of the link register by this function. -// 2) No modification of the stack pointer by this function. -// 3) (no modification of any other saved register, but that's not really going -// to occur, and hence isn't as much of a worry). -// -// There's essentially no way to ensure that the compiler will not modify the -// stack pointer when compiling a C function. -// Hence we have to write this function in assembly. - -.section .text -.file "hwasan_setjmp_aarch64.S" - -.global __interceptor_setjmp -ASM_TYPE_FUNCTION(__interceptor_setjmp) -__interceptor_setjmp: - CFI_STARTPROC - BTI_C - mov x1, #0 - b __interceptor_sigsetjmp - CFI_ENDPROC -ASM_SIZE(__interceptor_setjmp) - -#if SANITIZER_ANDROID -// Bionic also defines a function `setjmp` that calls `sigsetjmp` saving the -// current signal. -.global __interceptor_setjmp_bionic -ASM_TYPE_FUNCTION(__interceptor_setjmp_bionic) -__interceptor_setjmp_bionic: - CFI_STARTPROC - BTI_C - mov x1, #1 - b __interceptor_sigsetjmp - CFI_ENDPROC -ASM_SIZE(__interceptor_setjmp_bionic) -#endif - -.global __interceptor_sigsetjmp -ASM_TYPE_FUNCTION(__interceptor_sigsetjmp) -__interceptor_sigsetjmp: - CFI_STARTPROC - BTI_C - stp x19, x20, [x0, #0<<3] - stp x21, x22, [x0, #2<<3] - stp x23, x24, [x0, #4<<3] - stp x25, x26, [x0, #6<<3] - stp x27, x28, [x0, #8<<3] - stp x29, x30, [x0, #10<<3] - stp d8, d9, [x0, #14<<3] - stp d10, d11, [x0, #16<<3] - stp d12, d13, [x0, #18<<3] - stp d14, d15, [x0, #20<<3] - mov x2, sp - str x2, [x0, #13<<3] - // We always have the second argument to __sigjmp_save (savemask) set, since - // the _setjmp function above has set it for us as `false`. - // This function is defined in hwasan_interceptors.cc - b __sigjmp_save - CFI_ENDPROC -ASM_SIZE(__interceptor_sigsetjmp) - - -.macro WEAK_ALIAS first second - .weak \second - .equ \second\(), \first -.endm - -#if SANITIZER_ANDROID -WEAK_ALIAS __interceptor_sigsetjmp, sigsetjmp -WEAK_ALIAS __interceptor_setjmp_bionic, setjmp -#else -WEAK_ALIAS __interceptor_sigsetjmp, __sigsetjmp -#endif - -WEAK_ALIAS __interceptor_setjmp, _setjmp -#endif - -// We do not need executable stack. -NO_EXEC_STACK_DIRECTIVE - -GNU_PROPERTY_BTI_PAC diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_setjmp_x86_64.S b/contrib/libs/clang14-rt/lib/hwasan/hwasan_setjmp_x86_64.S deleted file mode 100644 index 7566c1ea0a57..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_setjmp_x86_64.S +++ /dev/null @@ -1,82 +0,0 @@ -//===-- hwasan_setjmp_x86_64.S --------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// setjmp interceptor for x86_64. -// -//===----------------------------------------------------------------------===// - -#include "sanitizer_common/sanitizer_asm.h" - -#if HWASAN_WITH_INTERCEPTORS && defined(__x86_64__) -#include "sanitizer_common/sanitizer_platform.h" - -// We want to save the context of the calling function. -// That requires -// 1) No modification of the return address by this function. -// 2) No modification of the stack pointer by this function. -// 3) (no modification of any other saved register, but that's not really going -// to occur, and hence isn't as much of a worry). -// -// There's essentially no way to ensure that the compiler will not modify the -// stack pointer when compiling a C function. -// Hence we have to write this function in assembly. -// -// TODO: Handle Intel CET. - -.section .text -.file "hwasan_setjmp_x86_64.S" - -.global __interceptor_setjmp -ASM_TYPE_FUNCTION(__interceptor_setjmp) -__interceptor_setjmp: - CFI_STARTPROC - _CET_ENDBR - xorl %esi, %esi - jmp __interceptor_sigsetjmp - CFI_ENDPROC -ASM_SIZE(__interceptor_setjmp) - -.global __interceptor_sigsetjmp -ASM_TYPE_FUNCTION(__interceptor_sigsetjmp) -__interceptor_sigsetjmp: - CFI_STARTPROC - _CET_ENDBR - - // Save callee save registers. - mov %rbx, (0*8)(%rdi) - mov %rbp, (1*8)(%rdi) - mov %r12, (2*8)(%rdi) - mov %r13, (3*8)(%rdi) - mov %r14, (4*8)(%rdi) - mov %r15, (5*8)(%rdi) - - // Save SP as it was in caller's frame. - lea 8(%rsp), %rdx - mov %rdx, (6*8)(%rdi) - - // Save return address. - mov (%rsp), %rax - mov %rax, (7*8)(%rdi) - - jmp __sigjmp_save - - CFI_ENDPROC -ASM_SIZE(__interceptor_sigsetjmp) - - -.macro WEAK_ALIAS first second - .weak \second - .equ \second\(), \first -.endm - -WEAK_ALIAS __interceptor_sigsetjmp, __sigsetjmp -WEAK_ALIAS __interceptor_setjmp, _setjmp -#endif - -// We do not need executable stack. -NO_EXEC_STACK_DIRECTIVE diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_tag_mismatch_aarch64.S b/contrib/libs/clang14-rt/lib/hwasan/hwasan_tag_mismatch_aarch64.S deleted file mode 100644 index bcb0df420190..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_tag_mismatch_aarch64.S +++ /dev/null @@ -1,158 +0,0 @@ -#include "sanitizer_common/sanitizer_asm.h" -#include "builtins/assembly.h" - -// The content of this file is AArch64-only: -#if defined(__aarch64__) - -// The responsibility of the HWASan entry point in compiler-rt is to primarily -// readjust the stack from the callee and save the current register values to -// the stack. -// This entry point function should be called from a __hwasan_check_* symbol. -// These are generated during a lowering pass in the backend, and are found in -// AArch64AsmPrinter::EmitHwasanMemaccessSymbols(). Please look there for -// further information. -// The __hwasan_check_* caller of this function should have expanded the stack -// and saved the previous values of x0, x1, x29, and x30. This function will -// "consume" these saved values and treats it as part of its own stack frame. -// In this sense, the __hwasan_check_* callee and this function "share" a stack -// frame. This allows us to omit having unwinding information (.cfi_*) present -// in every __hwasan_check_* function, therefore reducing binary size. This is -// particularly important as hwasan_check_* instances are duplicated in every -// translation unit where HWASan is enabled. -// This function calls HwasanTagMismatch to step back into the C++ code that -// completes the stack unwinding and error printing. This function is is not -// permitted to return. - - -// Frame from __hwasan_check_: -// | ... | -// | ... | -// | Previous stack frames... | -// +=================================+ -// | Unused 8-bytes for maintaining | -// | 16-byte SP alignment. | -// +---------------------------------+ -// | Return address (x30) for caller | -// | of __hwasan_check_*. | -// +---------------------------------+ -// | Frame address (x29) for caller | -// | of __hwasan_check_* | -// +---------------------------------+ <-- [SP + 232] -// | ... | -// | | -// | Stack frame space for x2 - x28. | -// | | -// | ... | -// +---------------------------------+ <-- [SP + 16] -// | | -// | Saved x1, as __hwasan_check_* | -// | clobbers it. | -// +---------------------------------+ -// | Saved x0, likewise above. | -// +---------------------------------+ <-- [x30 / SP] - -// This function takes two arguments: -// * x0: The data address. -// * x1: The encoded access info for the failing access. - -// This function has two entry points. The first, __hwasan_tag_mismatch, is used -// by clients that were compiled without short tag checks (i.e. binaries built -// by older compilers and binaries targeting older runtimes). In this case the -// outlined tag check will be missing the code handling short tags (which won't -// be used in the binary's own stack variables but may be used on the heap -// or stack variables in other binaries), so the check needs to be done here. -// -// The second, __hwasan_tag_mismatch_v2, is used by binaries targeting newer -// runtimes. This entry point bypasses the short tag check since it will have -// already been done as part of the outlined tag check. Since tag mismatches are -// uncommon, there isn't a significant performance benefit to being able to -// bypass the check; the main benefits are that we can sometimes avoid -// clobbering the x17 register in error reports, and that the program will have -// a runtime dependency on the __hwasan_tag_mismatch_v2 symbol therefore it will -// fail to start up given an older (i.e. incompatible) runtime. -.section .text -.file "hwasan_tag_mismatch_aarch64.S" -.global __hwasan_tag_mismatch -.type __hwasan_tag_mismatch, %function -__hwasan_tag_mismatch: - BTI_J - - // Compute the granule position one past the end of the access. - mov x16, #1 - and x17, x1, #0xf - lsl x16, x16, x17 - and x17, x0, #0xf - add x17, x16, x17 - - // Load the shadow byte again and check whether it is a short tag within the - // range of the granule position computed above. - ubfx x16, x0, #4, #52 - ldrb w16, [x9, x16] - cmp w16, #0xf - b.hi __hwasan_tag_mismatch_v2 - cmp w16, w17 - b.lo __hwasan_tag_mismatch_v2 - - // Load the real tag from the last byte of the granule and compare against - // the pointer tag. - orr x16, x0, #0xf - ldrb w16, [x16] - cmp x16, x0, lsr #56 - b.ne __hwasan_tag_mismatch_v2 - - // Restore x0, x1 and sp to their values from before the __hwasan_tag_mismatch - // call and resume execution. - ldp x0, x1, [sp], #256 - ret - -.global __hwasan_tag_mismatch_v2 -.type __hwasan_tag_mismatch_v2, %function -__hwasan_tag_mismatch_v2: - CFI_STARTPROC - BTI_J - - // Set the CFA to be the return address for caller of __hwasan_check_*. Note - // that we do not emit CFI predicates to describe the contents of this stack - // frame, as this proxy entry point should never be debugged. The contents - // are static and are handled by the unwinder after calling - // __hwasan_tag_mismatch. The frame pointer is already correctly setup - // by __hwasan_check_*. - add x29, sp, #232 - CFI_DEF_CFA(w29, 24) - CFI_OFFSET(w30, -16) - CFI_OFFSET(w29, -24) - - // Save the rest of the registers into the preallocated space left by - // __hwasan_check. - str x28, [sp, #224] - stp x26, x27, [sp, #208] - stp x24, x25, [sp, #192] - stp x22, x23, [sp, #176] - stp x20, x21, [sp, #160] - stp x18, x19, [sp, #144] - stp x16, x17, [sp, #128] - stp x14, x15, [sp, #112] - stp x12, x13, [sp, #96] - stp x10, x11, [sp, #80] - stp x8, x9, [sp, #64] - stp x6, x7, [sp, #48] - stp x4, x5, [sp, #32] - stp x2, x3, [sp, #16] - - // Pass the address of the frame to __hwasan_tag_mismatch4, so that it can - // extract the saved registers from this frame without having to worry about - // finding this frame. - mov x2, sp - - bl __hwasan_tag_mismatch4 - CFI_ENDPROC - -.Lfunc_end0: - .size __hwasan_tag_mismatch, .Lfunc_end0-__hwasan_tag_mismatch - -#endif // defined(__aarch64__) - -// We do not need executable stack. -NO_EXEC_STACK_DIRECTIVE - -GNU_PROPERTY_BTI_PAC diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread.cpp deleted file mode 100644 index c776ae179cec..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread.cpp +++ /dev/null @@ -1,150 +0,0 @@ - -#include "hwasan_thread.h" - -#include "hwasan.h" -#include "hwasan_interface_internal.h" -#include "hwasan_mapping.h" -#include "hwasan_poisoning.h" -#include "sanitizer_common/sanitizer_atomic.h" -#include "sanitizer_common/sanitizer_file.h" -#include "sanitizer_common/sanitizer_placement_new.h" -#include "sanitizer_common/sanitizer_tls_get_addr.h" - -namespace __hwasan { - -static u32 RandomSeed() { - u32 seed; - do { - if (UNLIKELY(!GetRandom(reinterpret_cast(&seed), sizeof(seed), - /*blocking=*/false))) { - seed = static_cast( - (NanoTime() >> 12) ^ - (reinterpret_cast(__builtin_frame_address(0)) >> 4)); - } - } while (!seed); - return seed; -} - -void Thread::InitRandomState() { - random_state_ = flags()->random_tags ? RandomSeed() : unique_id_; - random_state_inited_ = true; - - // Push a random number of zeros onto the ring buffer so that the first stack - // tag base will be random. - for (tag_t i = 0, e = GenerateRandomTag(); i != e; ++i) - stack_allocations_->push(0); -} - -void Thread::Init(uptr stack_buffer_start, uptr stack_buffer_size, - const InitState *state) { - CHECK_EQ(0, unique_id_); // try to catch bad stack reuse - CHECK_EQ(0, stack_top_); - CHECK_EQ(0, stack_bottom_); - - static atomic_uint64_t unique_id; - unique_id_ = atomic_fetch_add(&unique_id, 1, memory_order_relaxed); - - if (auto sz = flags()->heap_history_size) - heap_allocations_ = HeapAllocationsRingBuffer::New(sz); - -#if !SANITIZER_FUCHSIA - // Do not initialize the stack ring buffer just yet on Fuchsia. Threads will - // be initialized before we enter the thread itself, so we will instead call - // this later. - InitStackRingBuffer(stack_buffer_start, stack_buffer_size); -#endif - InitStackAndTls(state); -} - -void Thread::InitStackRingBuffer(uptr stack_buffer_start, - uptr stack_buffer_size) { - HwasanTSDThreadInit(); // Only needed with interceptors. - uptr *ThreadLong = GetCurrentThreadLongPtr(); - // The following implicitly sets (this) as the current thread. - stack_allocations_ = new (ThreadLong) - StackAllocationsRingBuffer((void *)stack_buffer_start, stack_buffer_size); - // Check that it worked. - CHECK_EQ(GetCurrentThread(), this); - - // ScopedTaggingDisable needs GetCurrentThread to be set up. - ScopedTaggingDisabler disabler; - - if (stack_bottom_) { - int local; - CHECK(AddrIsInStack((uptr)&local)); - CHECK(MemIsApp(stack_bottom_)); - CHECK(MemIsApp(stack_top_ - 1)); - } - - if (flags()->verbose_threads) { - if (IsMainThread()) { - Printf("sizeof(Thread): %zd sizeof(HeapRB): %zd sizeof(StackRB): %zd\n", - sizeof(Thread), heap_allocations_->SizeInBytes(), - stack_allocations_->size() * sizeof(uptr)); - } - Print("Creating : "); - } -} - -void Thread::ClearShadowForThreadStackAndTLS() { - if (stack_top_ != stack_bottom_) - TagMemory(stack_bottom_, stack_top_ - stack_bottom_, 0); - if (tls_begin_ != tls_end_) - TagMemory(tls_begin_, tls_end_ - tls_begin_, 0); -} - -void Thread::Destroy() { - if (flags()->verbose_threads) - Print("Destroying: "); - AllocatorSwallowThreadLocalCache(allocator_cache()); - ClearShadowForThreadStackAndTLS(); - if (heap_allocations_) - heap_allocations_->Delete(); - DTLS_Destroy(); - // Unregister this as the current thread. - // Instrumented code can not run on this thread from this point onwards, but - // malloc/free can still be served. Glibc may call free() very late, after all - // TSD destructors are done. - CHECK_EQ(GetCurrentThread(), this); - *GetCurrentThreadLongPtr() = 0; -} - -void Thread::Print(const char *Prefix) { - Printf("%sT%zd %p stack: [%p,%p) sz: %zd tls: [%p,%p)\n", Prefix, unique_id_, - (void *)this, stack_bottom(), stack_top(), - stack_top() - stack_bottom(), tls_begin(), tls_end()); -} - -static u32 xorshift(u32 state) { - state ^= state << 13; - state ^= state >> 17; - state ^= state << 5; - return state; -} - -// Generate a (pseudo-)random non-zero tag. -tag_t Thread::GenerateRandomTag(uptr num_bits) { - DCHECK_GT(num_bits, 0); - if (tagging_disabled_) - return 0; - tag_t tag; - const uptr tag_mask = (1ULL << num_bits) - 1; - do { - if (flags()->random_tags) { - if (!random_buffer_) { - EnsureRandomStateInited(); - random_buffer_ = random_state_ = xorshift(random_state_); - } - CHECK(random_buffer_); - tag = random_buffer_ & tag_mask; - random_buffer_ >>= num_bits; - } else { - EnsureRandomStateInited(); - random_state_ += 1; - tag = random_state_ & tag_mask; - } - } while (!tag); - return tag; -} - -} // namespace __hwasan diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread.h deleted file mode 100644 index 3db7c1a9454f..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread.h +++ /dev/null @@ -1,113 +0,0 @@ -//===-- hwasan_thread.h -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -//===----------------------------------------------------------------------===// - -#ifndef HWASAN_THREAD_H -#define HWASAN_THREAD_H - -#include "hwasan_allocator.h" -#include "sanitizer_common/sanitizer_common.h" -#include "sanitizer_common/sanitizer_ring_buffer.h" - -namespace __hwasan { - -typedef __sanitizer::CompactRingBuffer StackAllocationsRingBuffer; - -class Thread { - public: - // These are optional parameters that can be passed to Init. - struct InitState; - - void Init(uptr stack_buffer_start, uptr stack_buffer_size, - const InitState *state = nullptr); - - void InitStackAndTls(const InitState *state = nullptr); - - // Must be called from the thread itself. - void InitStackRingBuffer(uptr stack_buffer_start, uptr stack_buffer_size); - - inline void EnsureRandomStateInited() { - if (UNLIKELY(!random_state_inited_)) - InitRandomState(); - } - - void Destroy(); - - uptr stack_top() { return stack_top_; } - uptr stack_bottom() { return stack_bottom_; } - uptr stack_size() { return stack_top() - stack_bottom(); } - uptr tls_begin() { return tls_begin_; } - uptr tls_end() { return tls_end_; } - bool IsMainThread() { return unique_id_ == 0; } - - bool AddrIsInStack(uptr addr) { - return addr >= stack_bottom_ && addr < stack_top_; - } - - AllocatorCache *allocator_cache() { return &allocator_cache_; } - HeapAllocationsRingBuffer *heap_allocations() { return heap_allocations_; } - StackAllocationsRingBuffer *stack_allocations() { return stack_allocations_; } - - tag_t GenerateRandomTag(uptr num_bits = kTagBits); - - void DisableTagging() { tagging_disabled_++; } - void EnableTagging() { tagging_disabled_--; } - - u64 unique_id() const { return unique_id_; } - void Announce() { - if (announced_) return; - announced_ = true; - Print("Thread: "); - } - - uptr &vfork_spill() { return vfork_spill_; } - - private: - // NOTE: There is no Thread constructor. It is allocated - // via mmap() and *must* be valid in zero-initialized state. - void ClearShadowForThreadStackAndTLS(); - void Print(const char *prefix); - void InitRandomState(); - uptr vfork_spill_; - uptr stack_top_; - uptr stack_bottom_; - uptr tls_begin_; - uptr tls_end_; - - u32 random_state_; - u32 random_buffer_; - - AllocatorCache allocator_cache_; - HeapAllocationsRingBuffer *heap_allocations_; - StackAllocationsRingBuffer *stack_allocations_; - - u64 unique_id_; // counting from zero. - - u32 tagging_disabled_; // if non-zero, malloc uses zero tag in this thread. - - bool announced_; - - bool random_state_inited_; // Whether InitRandomState() has been called. - - friend struct ThreadListHead; -}; - -Thread *GetCurrentThread(); -uptr *GetCurrentThreadLongPtr(); - -struct ScopedTaggingDisabler { - ScopedTaggingDisabler() { GetCurrentThread()->DisableTagging(); } - ~ScopedTaggingDisabler() { GetCurrentThread()->EnableTagging(); } -}; - -} // namespace __hwasan - -#endif // HWASAN_THREAD_H diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread_list.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread_list.cpp deleted file mode 100644 index fa46e658b69d..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread_list.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "hwasan_thread_list.h" - -namespace __hwasan { -static ALIGNED(16) char thread_list_placeholder[sizeof(HwasanThreadList)]; -static HwasanThreadList *hwasan_thread_list; - -HwasanThreadList &hwasanThreadList() { return *hwasan_thread_list; } - -void InitThreadList(uptr storage, uptr size) { - CHECK(hwasan_thread_list == nullptr); - hwasan_thread_list = - new (thread_list_placeholder) HwasanThreadList(storage, size); -} - -} // namespace __hwasan diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread_list.h b/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread_list.h deleted file mode 100644 index 15916a802d6e..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_thread_list.h +++ /dev/null @@ -1,205 +0,0 @@ -//===-- hwasan_thread_list.h ------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -//===----------------------------------------------------------------------===// - -// HwasanThreadList is a registry for live threads, as well as an allocator for -// HwasanThread objects and their stack history ring buffers. There are -// constraints on memory layout of the shadow region and CompactRingBuffer that -// are part of the ABI contract between compiler-rt and llvm. -// -// * Start of the shadow memory region is aligned to 2**kShadowBaseAlignment. -// * All stack ring buffers are located within (2**kShadowBaseAlignment) -// sized region below and adjacent to the shadow region. -// * Each ring buffer has a size of (2**N)*4096 where N is in [0, 8), and is -// aligned to twice its size. The value of N can be different for each buffer. -// -// These constrains guarantee that, given an address A of any element of the -// ring buffer, -// A_next = (A + sizeof(uptr)) & ~((1 << (N + 13)) - 1) -// is the address of the next element of that ring buffer (with wrap-around). -// And, with K = kShadowBaseAlignment, -// S = (A | ((1 << K) - 1)) + 1 -// (align up to kShadowBaseAlignment) is the start of the shadow region. -// -// These calculations are used in compiler instrumentation to update the ring -// buffer and obtain the base address of shadow using only two inputs: address -// of the current element of the ring buffer, and N (i.e. size of the ring -// buffer). Since the value of N is very limited, we pack both inputs into a -// single thread-local word as -// (1 << (N + 56)) | A -// See the implementation of class CompactRingBuffer, which is what is stored in -// said thread-local word. -// -// Note the unusual way of aligning up the address of the shadow: -// (A | ((1 << K) - 1)) + 1 -// It is only correct if A is not already equal to the shadow base address, but -// it saves 2 instructions on AArch64. - -#include "hwasan.h" -#include "hwasan_allocator.h" -#include "hwasan_flags.h" -#include "hwasan_thread.h" - -#include "sanitizer_common/sanitizer_placement_new.h" - -namespace __hwasan { - -static uptr RingBufferSize() { - uptr desired_bytes = flags()->stack_history_size * sizeof(uptr); - // FIXME: increase the limit to 8 once this bug is fixed: - // https://bugs.llvm.org/show_bug.cgi?id=39030 - for (int shift = 1; shift < 7; ++shift) { - uptr size = 4096 * (1ULL << shift); - if (size >= desired_bytes) - return size; - } - Printf("stack history size too large: %d\n", flags()->stack_history_size); - CHECK(0); - return 0; -} - -struct ThreadStats { - uptr n_live_threads; - uptr total_stack_size; -}; - -class HwasanThreadList { - public: - HwasanThreadList(uptr storage, uptr size) - : free_space_(storage), free_space_end_(storage + size) { - // [storage, storage + size) is used as a vector of - // thread_alloc_size_-sized, ring_buffer_size_*2-aligned elements. - // Each element contains - // * a ring buffer at offset 0, - // * a Thread object at offset ring_buffer_size_. - ring_buffer_size_ = RingBufferSize(); - thread_alloc_size_ = - RoundUpTo(ring_buffer_size_ + sizeof(Thread), ring_buffer_size_ * 2); - } - - Thread *CreateCurrentThread(const Thread::InitState *state = nullptr) { - Thread *t = nullptr; - { - SpinMutexLock l(&free_list_mutex_); - if (!free_list_.empty()) { - t = free_list_.back(); - free_list_.pop_back(); - } - } - if (t) { - uptr start = (uptr)t - ring_buffer_size_; - internal_memset((void *)start, 0, ring_buffer_size_ + sizeof(Thread)); - } else { - t = AllocThread(); - } - { - SpinMutexLock l(&live_list_mutex_); - live_list_.push_back(t); - } - t->Init((uptr)t - ring_buffer_size_, ring_buffer_size_, state); - AddThreadStats(t); - return t; - } - - void DontNeedThread(Thread *t) { - uptr start = (uptr)t - ring_buffer_size_; - ReleaseMemoryPagesToOS(start, start + thread_alloc_size_); - } - - void RemoveThreadFromLiveList(Thread *t) { - SpinMutexLock l(&live_list_mutex_); - for (Thread *&t2 : live_list_) - if (t2 == t) { - // To remove t2, copy the last element of the list in t2's position, and - // pop_back(). This works even if t2 is itself the last element. - t2 = live_list_.back(); - live_list_.pop_back(); - return; - } - CHECK(0 && "thread not found in live list"); - } - - void ReleaseThread(Thread *t) { - RemoveThreadStats(t); - t->Destroy(); - DontNeedThread(t); - RemoveThreadFromLiveList(t); - SpinMutexLock l(&free_list_mutex_); - free_list_.push_back(t); - } - - Thread *GetThreadByBufferAddress(uptr p) { - return (Thread *)(RoundDownTo(p, ring_buffer_size_ * 2) + - ring_buffer_size_); - } - - uptr MemoryUsedPerThread() { - uptr res = sizeof(Thread) + ring_buffer_size_; - if (auto sz = flags()->heap_history_size) - res += HeapAllocationsRingBuffer::SizeInBytes(sz); - return res; - } - - template - void VisitAllLiveThreads(CB cb) { - SpinMutexLock l(&live_list_mutex_); - for (Thread *t : live_list_) cb(t); - } - - void AddThreadStats(Thread *t) { - SpinMutexLock l(&stats_mutex_); - stats_.n_live_threads++; - stats_.total_stack_size += t->stack_size(); - } - - void RemoveThreadStats(Thread *t) { - SpinMutexLock l(&stats_mutex_); - stats_.n_live_threads--; - stats_.total_stack_size -= t->stack_size(); - } - - ThreadStats GetThreadStats() { - SpinMutexLock l(&stats_mutex_); - return stats_; - } - - uptr GetRingBufferSize() const { return ring_buffer_size_; } - - private: - Thread *AllocThread() { - SpinMutexLock l(&free_space_mutex_); - uptr align = ring_buffer_size_ * 2; - CHECK(IsAligned(free_space_, align)); - Thread *t = (Thread *)(free_space_ + ring_buffer_size_); - free_space_ += thread_alloc_size_; - CHECK(free_space_ <= free_space_end_ && "out of thread memory"); - return t; - } - - SpinMutex free_space_mutex_; - uptr free_space_; - uptr free_space_end_; - uptr ring_buffer_size_; - uptr thread_alloc_size_; - - SpinMutex free_list_mutex_; - InternalMmapVector free_list_; - SpinMutex live_list_mutex_; - InternalMmapVector live_list_; - - ThreadStats stats_; - SpinMutex stats_mutex_; -}; - -void InitThreadList(uptr storage, uptr size); -HwasanThreadList &hwasanThreadList(); - -} // namespace __hwasan diff --git a/contrib/libs/clang14-rt/lib/hwasan/hwasan_type_test.cpp b/contrib/libs/clang14-rt/lib/hwasan/hwasan_type_test.cpp deleted file mode 100644 index 5307073fb40b..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/hwasan_type_test.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===-- hwasan_type_test.cpp ------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of HWAddressSanitizer. -// -// Compile-time tests of the internal type definitions. -//===----------------------------------------------------------------------===// - -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_platform_limits_posix.h" -#include "hwasan.h" -#include - -#define CHECK_TYPE_SIZE_FITS(TYPE) \ - COMPILER_CHECK(sizeof(__hw_##TYPE) <= sizeof(TYPE)) - -#if HWASAN_WITH_INTERCEPTORS -CHECK_TYPE_SIZE_FITS(jmp_buf); -CHECK_TYPE_SIZE_FITS(sigjmp_buf); -#endif diff --git a/contrib/libs/clang14-rt/lib/hwasan/ya.make b/contrib/libs/clang14-rt/lib/hwasan/ya.make deleted file mode 100644 index 1de1825fc425..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan/ya.make +++ /dev/null @@ -1,148 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.hwasan${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DHAVE_RPC_XDR_H=0 - -DHWASAN_WITH_INTERCEPTORS=1 - -DUBSAN_CAN_USE_CXXABI - -fcommon - -ffreestanding - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - hwasan/hwasan.cpp - hwasan/hwasan_allocation_functions.cpp - hwasan/hwasan_allocator.cpp - hwasan/hwasan_dynamic_shadow.cpp - hwasan/hwasan_exceptions.cpp - hwasan/hwasan_fuchsia.cpp - hwasan/hwasan_globals.cpp - hwasan/hwasan_interceptors.cpp - hwasan/hwasan_interceptors_vfork.S - hwasan/hwasan_linux.cpp - hwasan/hwasan_memintrinsics.cpp - hwasan/hwasan_poisoning.cpp - hwasan/hwasan_report.cpp - hwasan/hwasan_setjmp_aarch64.S - hwasan/hwasan_setjmp_x86_64.S - hwasan/hwasan_tag_mismatch_aarch64.S - hwasan/hwasan_thread.cpp - hwasan/hwasan_thread_list.cpp - hwasan/hwasan_type_test.cpp - interception/interception_linux.cpp - interception/interception_mac.cpp - interception/interception_type_test.cpp - interception/interception_win.cpp - sanitizer_common/sancov_flags.cpp - sanitizer_common/sanitizer_allocator.cpp - sanitizer_common/sanitizer_allocator_checks.cpp - sanitizer_common/sanitizer_allocator_report.cpp - sanitizer_common/sanitizer_chained_origin_depot.cpp - sanitizer_common/sanitizer_common.cpp - sanitizer_common/sanitizer_common_libcdep.cpp - sanitizer_common/sanitizer_coverage_fuchsia.cpp - sanitizer_common/sanitizer_coverage_libcdep_new.cpp - sanitizer_common/sanitizer_coverage_win_sections.cpp - sanitizer_common/sanitizer_deadlock_detector1.cpp - sanitizer_common/sanitizer_deadlock_detector2.cpp - sanitizer_common/sanitizer_errno.cpp - sanitizer_common/sanitizer_file.cpp - sanitizer_common/sanitizer_flag_parser.cpp - sanitizer_common/sanitizer_flags.cpp - sanitizer_common/sanitizer_fuchsia.cpp - sanitizer_common/sanitizer_libc.cpp - sanitizer_common/sanitizer_libignore.cpp - sanitizer_common/sanitizer_linux.cpp - sanitizer_common/sanitizer_linux_libcdep.cpp - sanitizer_common/sanitizer_linux_s390.cpp - sanitizer_common/sanitizer_mac.cpp - sanitizer_common/sanitizer_mac_libcdep.cpp - sanitizer_common/sanitizer_mutex.cpp - sanitizer_common/sanitizer_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_freebsd.cpp - sanitizer_common/sanitizer_platform_limits_linux.cpp - sanitizer_common/sanitizer_platform_limits_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_posix.cpp - sanitizer_common/sanitizer_platform_limits_solaris.cpp - sanitizer_common/sanitizer_posix.cpp - sanitizer_common/sanitizer_posix_libcdep.cpp - sanitizer_common/sanitizer_printf.cpp - sanitizer_common/sanitizer_procmaps_bsd.cpp - sanitizer_common/sanitizer_procmaps_common.cpp - sanitizer_common/sanitizer_procmaps_fuchsia.cpp - sanitizer_common/sanitizer_procmaps_linux.cpp - sanitizer_common/sanitizer_procmaps_mac.cpp - sanitizer_common/sanitizer_procmaps_solaris.cpp - sanitizer_common/sanitizer_solaris.cpp - sanitizer_common/sanitizer_stack_store.cpp - sanitizer_common/sanitizer_stackdepot.cpp - sanitizer_common/sanitizer_stacktrace.cpp - sanitizer_common/sanitizer_stacktrace_libcdep.cpp - sanitizer_common/sanitizer_stacktrace_printer.cpp - sanitizer_common/sanitizer_stacktrace_sparc.cpp - sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp - sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_mac.cpp - sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_win.cpp - sanitizer_common/sanitizer_suppressions.cpp - sanitizer_common/sanitizer_symbolizer.cpp - sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp - sanitizer_common/sanitizer_symbolizer_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_mac.cpp - sanitizer_common/sanitizer_symbolizer_markup.cpp - sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_report.cpp - sanitizer_common/sanitizer_symbolizer_win.cpp - sanitizer_common/sanitizer_termination.cpp - sanitizer_common/sanitizer_thread_registry.cpp - sanitizer_common/sanitizer_tls_get_addr.cpp - sanitizer_common/sanitizer_type_traits.cpp - sanitizer_common/sanitizer_unwind_linux_libcdep.cpp - sanitizer_common/sanitizer_unwind_win.cpp - sanitizer_common/sanitizer_win.cpp - ubsan/ubsan_diag.cpp - ubsan/ubsan_flags.cpp - ubsan/ubsan_handlers.cpp - ubsan/ubsan_init.cpp - ubsan/ubsan_monitor.cpp - ubsan/ubsan_value.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/hwasan_aliases/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/hwasan_aliases/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan_aliases/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/hwasan_aliases/ya.make b/contrib/libs/clang14-rt/lib/hwasan_aliases/ya.make deleted file mode 100644 index c7acf21b637f..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan_aliases/ya.make +++ /dev/null @@ -1,149 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.hwasan_aliases${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DHAVE_RPC_XDR_H=0 - -DHWASAN_ALIASING_MODE - -DHWASAN_WITH_INTERCEPTORS=1 - -DUBSAN_CAN_USE_CXXABI - -fcommon - -ffreestanding - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - hwasan/hwasan.cpp - hwasan/hwasan_allocation_functions.cpp - hwasan/hwasan_allocator.cpp - hwasan/hwasan_dynamic_shadow.cpp - hwasan/hwasan_exceptions.cpp - hwasan/hwasan_fuchsia.cpp - hwasan/hwasan_globals.cpp - hwasan/hwasan_interceptors.cpp - hwasan/hwasan_interceptors_vfork.S - hwasan/hwasan_linux.cpp - hwasan/hwasan_memintrinsics.cpp - hwasan/hwasan_poisoning.cpp - hwasan/hwasan_report.cpp - hwasan/hwasan_setjmp_aarch64.S - hwasan/hwasan_setjmp_x86_64.S - hwasan/hwasan_tag_mismatch_aarch64.S - hwasan/hwasan_thread.cpp - hwasan/hwasan_thread_list.cpp - hwasan/hwasan_type_test.cpp - interception/interception_linux.cpp - interception/interception_mac.cpp - interception/interception_type_test.cpp - interception/interception_win.cpp - sanitizer_common/sancov_flags.cpp - sanitizer_common/sanitizer_allocator.cpp - sanitizer_common/sanitizer_allocator_checks.cpp - sanitizer_common/sanitizer_allocator_report.cpp - sanitizer_common/sanitizer_chained_origin_depot.cpp - sanitizer_common/sanitizer_common.cpp - sanitizer_common/sanitizer_common_libcdep.cpp - sanitizer_common/sanitizer_coverage_fuchsia.cpp - sanitizer_common/sanitizer_coverage_libcdep_new.cpp - sanitizer_common/sanitizer_coverage_win_sections.cpp - sanitizer_common/sanitizer_deadlock_detector1.cpp - sanitizer_common/sanitizer_deadlock_detector2.cpp - sanitizer_common/sanitizer_errno.cpp - sanitizer_common/sanitizer_file.cpp - sanitizer_common/sanitizer_flag_parser.cpp - sanitizer_common/sanitizer_flags.cpp - sanitizer_common/sanitizer_fuchsia.cpp - sanitizer_common/sanitizer_libc.cpp - sanitizer_common/sanitizer_libignore.cpp - sanitizer_common/sanitizer_linux.cpp - sanitizer_common/sanitizer_linux_libcdep.cpp - sanitizer_common/sanitizer_linux_s390.cpp - sanitizer_common/sanitizer_mac.cpp - sanitizer_common/sanitizer_mac_libcdep.cpp - sanitizer_common/sanitizer_mutex.cpp - sanitizer_common/sanitizer_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_freebsd.cpp - sanitizer_common/sanitizer_platform_limits_linux.cpp - sanitizer_common/sanitizer_platform_limits_netbsd.cpp - sanitizer_common/sanitizer_platform_limits_posix.cpp - sanitizer_common/sanitizer_platform_limits_solaris.cpp - sanitizer_common/sanitizer_posix.cpp - sanitizer_common/sanitizer_posix_libcdep.cpp - sanitizer_common/sanitizer_printf.cpp - sanitizer_common/sanitizer_procmaps_bsd.cpp - sanitizer_common/sanitizer_procmaps_common.cpp - sanitizer_common/sanitizer_procmaps_fuchsia.cpp - sanitizer_common/sanitizer_procmaps_linux.cpp - sanitizer_common/sanitizer_procmaps_mac.cpp - sanitizer_common/sanitizer_procmaps_solaris.cpp - sanitizer_common/sanitizer_solaris.cpp - sanitizer_common/sanitizer_stack_store.cpp - sanitizer_common/sanitizer_stackdepot.cpp - sanitizer_common/sanitizer_stacktrace.cpp - sanitizer_common/sanitizer_stacktrace_libcdep.cpp - sanitizer_common/sanitizer_stacktrace_printer.cpp - sanitizer_common/sanitizer_stacktrace_sparc.cpp - sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp - sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_mac.cpp - sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp - sanitizer_common/sanitizer_stoptheworld_win.cpp - sanitizer_common/sanitizer_suppressions.cpp - sanitizer_common/sanitizer_symbolizer.cpp - sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp - sanitizer_common/sanitizer_symbolizer_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_mac.cpp - sanitizer_common/sanitizer_symbolizer_markup.cpp - sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp - sanitizer_common/sanitizer_symbolizer_report.cpp - sanitizer_common/sanitizer_symbolizer_win.cpp - sanitizer_common/sanitizer_termination.cpp - sanitizer_common/sanitizer_thread_registry.cpp - sanitizer_common/sanitizer_tls_get_addr.cpp - sanitizer_common/sanitizer_type_traits.cpp - sanitizer_common/sanitizer_unwind_linux_libcdep.cpp - sanitizer_common/sanitizer_unwind_win.cpp - sanitizer_common/sanitizer_win.cpp - ubsan/ubsan_diag.cpp - ubsan/ubsan_flags.cpp - ubsan/ubsan_handlers.cpp - ubsan/ubsan_init.cpp - ubsan/ubsan_monitor.cpp - ubsan/ubsan_value.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/hwasan_aliases_cxx/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/hwasan_aliases_cxx/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan_aliases_cxx/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/hwasan_aliases_cxx/ya.make b/contrib/libs/clang14-rt/lib/hwasan_aliases_cxx/ya.make deleted file mode 100644 index e3dfcd6fede6..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan_aliases_cxx/ya.make +++ /dev/null @@ -1,56 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.hwasan_aliases_cxx${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DHWASAN_WITH_INTERCEPTORS=1 - -DUBSAN_CAN_USE_CXXABI - -fcommon - -ffreestanding - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -frtti - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - hwasan/hwasan_new_delete.cpp - ubsan/ubsan_handlers_cxx.cpp - ubsan/ubsan_type_hash.cpp - ubsan/ubsan_type_hash_itanium.cpp - ubsan/ubsan_type_hash_win.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/hwasan_cxx/.yandex_meta/licenses.list.txt b/contrib/libs/clang14-rt/lib/hwasan_cxx/.yandex_meta/licenses.list.txt deleted file mode 100644 index 591a53066f13..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan_cxx/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,366 +0,0 @@ -====================Apache-2.0==================== - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -====================Apache-2.0 WITH LLVM-exception==================== ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - - -====================Apache-2.0 WITH LLVM-exception==================== -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================Apache-2.0 WITH LLVM-exception==================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: - - -====================Apache-2.0 WITH LLVM-exception==================== -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -|* See https://llvm.org/LICENSE.txt for license information. - - -====================Apache-2.0 WITH LLVM-exception==================== -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - - -====================COPYRIGHT==================== - InitCache(c); - TransferBatch *b = allocator->AllocateBatch(&stats_, this, class_id); - if (UNLIKELY(!b)) - - -====================COPYRIGHT==================== -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT - - -====================COPYRIGHT==================== -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - - -====================File: CREDITS.TXT==================== -This file is a partial list of people who have contributed to the LLVM/CompilerRT -project. If you have contributed a patch or made some other contribution to -LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Craig van Vliet -E: cvanvliet@auroraux.org -W: http://www.auroraux.org -D: Code style and Readability fixes. - -N: Edward O'Callaghan -E: eocallaghan@auroraux.org -W: http://www.auroraux.org -D: CMake'ify Compiler-RT build system -D: Maintain Solaris & AuroraUX ports of Compiler-RT - -N: Howard Hinnant -E: hhinnant@apple.com -D: Architect and primary author of compiler-rt - -N: Guan-Hong Liu -E: koviankevin@hotmail.com -D: IEEE Quad-precision functions - -N: Joerg Sonnenberger -E: joerg@NetBSD.org -D: Maintains NetBSD port. - -N: Matt Thomas -E: matt@NetBSD.org -D: ARM improvements. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================NCSA==================== -Compiler-RT is open source software. You may freely distribute it under the -terms of the license agreement found in LICENSE.txt. - - -====================NCSA==================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): - - -====================NCSA==================== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - - -====================NCSA==================== -University of Illinois/NCSA -Open Source License - - -====================NCSA AND MIT==================== -The compiler_rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. diff --git a/contrib/libs/clang14-rt/lib/hwasan_cxx/ya.make b/contrib/libs/clang14-rt/lib/hwasan_cxx/ya.make deleted file mode 100644 index e71c396ea88b..000000000000 --- a/contrib/libs/clang14-rt/lib/hwasan_cxx/ya.make +++ /dev/null @@ -1,56 +0,0 @@ -# Generated by devtools/yamaker. - -INCLUDE(${ARCADIA_ROOT}/build/platform/clang/arch.cmake) - -LIBRARY(clang_rt.hwasan_cxx${CLANG_RT_SUFFIX}) - -VERSION(14.0.6) - -LICENSE( - Apache-2.0 AND - Apache-2.0 WITH LLVM-exception AND - MIT AND - NCSA -) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -SUBSCRIBER(g:cpp-contrib) - -ADDINCL( - contrib/libs/clang14-rt/lib -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -NO_SANITIZE() - -CFLAGS( - -DHWASAN_WITH_INTERCEPTORS=1 - -DUBSAN_CAN_USE_CXXABI - -fcommon - -ffreestanding - -fno-builtin - -fno-exceptions - -fno-lto - -fno-rtti - -fno-stack-protector - -fomit-frame-pointer - -frtti - -funwind-tables - -fvisibility=hidden -) - -SRCDIR(contrib/libs/clang14-rt/lib) - -SRCS( - hwasan/hwasan_new_delete.cpp - ubsan/ubsan_handlers_cxx.cpp - ubsan/ubsan_type_hash.cpp - ubsan/ubsan_type_hash_itanium.cpp - ubsan/ubsan_type_hash_win.cpp -) - -END() diff --git a/contrib/libs/clang14-rt/lib/interception/interception.h b/contrib/libs/clang14-rt/lib/interception/interception.h deleted file mode 100644 index 7f2ecbb5ee0f..000000000000 --- a/contrib/libs/clang14-rt/lib/interception/interception.h +++ /dev/null @@ -1,295 +0,0 @@ -//===-- interception.h ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Machinery for providing replacements/wrappers for system functions. -//===----------------------------------------------------------------------===// - -#ifndef INTERCEPTION_H -#define INTERCEPTION_H - -#include "sanitizer_common/sanitizer_internal_defs.h" - -#if !SANITIZER_LINUX && !SANITIZER_FREEBSD && !SANITIZER_MAC && \ - !SANITIZER_NETBSD && !SANITIZER_WINDOWS && !SANITIZER_FUCHSIA && \ - !SANITIZER_SOLARIS -# error "Interception doesn't work on this operating system." -#endif - -// These typedefs should be used only in the interceptor definitions to replace -// the standard system types (e.g. SSIZE_T instead of ssize_t) -typedef __sanitizer::uptr SIZE_T; -typedef __sanitizer::sptr SSIZE_T; -typedef __sanitizer::sptr PTRDIFF_T; -typedef __sanitizer::s64 INTMAX_T; -typedef __sanitizer::u64 UINTMAX_T; -typedef __sanitizer::OFF_T OFF_T; -typedef __sanitizer::OFF64_T OFF64_T; - -// How to add an interceptor: -// Suppose you need to wrap/replace system function (generally, from libc): -// int foo(const char *bar, double baz); -// You'll need to: -// 1) define INTERCEPTOR(int, foo, const char *bar, double baz) { ... } in -// your source file. See the notes below for cases when -// INTERCEPTOR_WITH_SUFFIX(...) should be used instead. -// 2) Call "INTERCEPT_FUNCTION(foo)" prior to the first call of "foo". -// INTERCEPT_FUNCTION(foo) evaluates to "true" iff the function was -// intercepted successfully. -// You can access original function by calling REAL(foo)(bar, baz). -// By default, REAL(foo) will be visible only inside your interceptor, and if -// you want to use it in other parts of RTL, you'll need to: -// 3a) add DECLARE_REAL(int, foo, const char*, double) to a -// header file. -// However, if the call "INTERCEPT_FUNCTION(foo)" and definition for -// INTERCEPTOR(..., foo, ...) are in different files, you'll instead need to: -// 3b) add DECLARE_REAL_AND_INTERCEPTOR(int, foo, const char*, double) -// to a header file. - -// Notes: 1. Things may not work properly if macro INTERCEPTOR(...) {...} or -// DECLARE_REAL(...) are located inside namespaces. -// 2. On Mac you can also use: "OVERRIDE_FUNCTION(foo, zoo)" to -// effectively redirect calls from "foo" to "zoo". In this case -// you aren't required to implement -// INTERCEPTOR(int, foo, const char *bar, double baz) {...} -// but instead you'll have to add -// DECLARE_REAL(int, foo, const char *bar, double baz) in your -// source file (to define a pointer to overriden function). -// 3. Some Mac functions have symbol variants discriminated by -// additional suffixes, e.g. _$UNIX2003 (see -// https://developer.apple.com/library/mac/#releasenotes/Darwin/SymbolVariantsRelNotes/index.html -// for more details). To intercept such functions you need to use the -// INTERCEPTOR_WITH_SUFFIX(...) macro. - -// How it works: -// To replace system functions on Linux we just need to declare functions -// with same names in our library and then obtain the real function pointers -// using dlsym(). -// There is one complication. A user may also intercept some of the functions -// we intercept. To resolve this we declare our interceptors with __interceptor_ -// prefix, and then make actual interceptors weak aliases to __interceptor_ -// functions. -// -// This is not so on Mac OS, where the two-level namespace makes -// our replacement functions invisible to other libraries. This may be overcomed -// using the DYLD_FORCE_FLAT_NAMESPACE, but some errors loading the shared -// libraries in Chromium were noticed when doing so. -// Instead we create a dylib containing a __DATA,__interpose section that -// associates library functions with their wrappers. When this dylib is -// preloaded before an executable using DYLD_INSERT_LIBRARIES, it routes all -// the calls to interposed functions done through stubs to the wrapper -// functions. -// As it's decided at compile time which functions are to be intercepted on Mac, -// INTERCEPT_FUNCTION() is effectively a no-op on this system. - -#if SANITIZER_MAC -#include // For __DARWIN_ALIAS_C(). - -// Just a pair of pointers. -struct interpose_substitution { - const __sanitizer::uptr replacement; - const __sanitizer::uptr original; -}; - -// For a function foo() create a global pair of pointers { wrap_foo, foo } in -// the __DATA,__interpose section. -// As a result all the calls to foo() will be routed to wrap_foo() at runtime. -#define INTERPOSER(func_name) __attribute__((used)) \ -const interpose_substitution substitution_##func_name[] \ - __attribute__((section("__DATA, __interpose"))) = { \ - { reinterpret_cast(WRAP(func_name)), \ - reinterpret_cast(func_name) } \ -} - -// For a function foo() and a wrapper function bar() create a global pair -// of pointers { bar, foo } in the __DATA,__interpose section. -// As a result all the calls to foo() will be routed to bar() at runtime. -#define INTERPOSER_2(func_name, wrapper_name) __attribute__((used)) \ -const interpose_substitution substitution_##func_name[] \ - __attribute__((section("__DATA, __interpose"))) = { \ - { reinterpret_cast(wrapper_name), \ - reinterpret_cast(func_name) } \ -} - -# define WRAP(x) wrap_##x -# define WRAPPER_NAME(x) "wrap_"#x -# define INTERCEPTOR_ATTRIBUTE -# define DECLARE_WRAPPER(ret_type, func, ...) - -#elif SANITIZER_WINDOWS -# define WRAP(x) __asan_wrap_##x -# define WRAPPER_NAME(x) "__asan_wrap_"#x -# define INTERCEPTOR_ATTRIBUTE __declspec(dllexport) -# define DECLARE_WRAPPER(ret_type, func, ...) \ - extern "C" ret_type func(__VA_ARGS__); -# define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \ - extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__); -#elif SANITIZER_FREEBSD || SANITIZER_NETBSD -# define WRAP(x) __interceptor_ ## x -# define WRAPPER_NAME(x) "__interceptor_" #x -# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) -// FreeBSD's dynamic linker (incompliantly) gives non-weak symbols higher -// priority than weak ones so weak aliases won't work for indirect calls -// in position-independent (-fPIC / -fPIE) mode. -# define DECLARE_WRAPPER(ret_type, func, ...) \ - extern "C" ret_type func(__VA_ARGS__) \ - __attribute__((alias("__interceptor_" #func), visibility("default"))); -#elif !SANITIZER_FUCHSIA -# define WRAP(x) __interceptor_ ## x -# define WRAPPER_NAME(x) "__interceptor_" #x -# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) -# define DECLARE_WRAPPER(ret_type, func, ...) \ - extern "C" ret_type func(__VA_ARGS__) \ - __attribute__((weak, alias("__interceptor_" #func), visibility("default"))); -#endif - -#if SANITIZER_FUCHSIA -// There is no general interception at all on Fuchsia. -// Sanitizer runtimes just define functions directly to preempt them, -// and have bespoke ways to access the underlying libc functions. -# error #include -# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) -# define REAL(x) __unsanitized_##x -# define DECLARE_REAL(ret_type, func, ...) -#elif !SANITIZER_MAC -# define PTR_TO_REAL(x) real_##x -# define REAL(x) __interception::PTR_TO_REAL(x) -# define FUNC_TYPE(x) x##_type - -# define DECLARE_REAL(ret_type, func, ...) \ - typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \ - namespace __interception { \ - extern FUNC_TYPE(func) PTR_TO_REAL(func); \ - } -# define ASSIGN_REAL(dst, src) REAL(dst) = REAL(src) -#else // SANITIZER_MAC -# define REAL(x) x -# define DECLARE_REAL(ret_type, func, ...) \ - extern "C" ret_type func(__VA_ARGS__); -# define ASSIGN_REAL(x, y) -#endif // SANITIZER_MAC - -#if !SANITIZER_FUCHSIA -# define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) \ - DECLARE_REAL(ret_type, func, __VA_ARGS__) \ - extern "C" ret_type WRAP(func)(__VA_ARGS__); -// Declare an interceptor and its wrapper defined in a different translation -// unit (ex. asm). -# define DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(ret_type, func, ...) \ - extern "C" ret_type WRAP(func)(__VA_ARGS__); \ - extern "C" ret_type func(__VA_ARGS__); -#else -# define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) -# define DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(ret_type, func, ...) -#endif - -// Generally, you don't need to use DEFINE_REAL by itself, as INTERCEPTOR -// macros does its job. In exceptional cases you may need to call REAL(foo) -// without defining INTERCEPTOR(..., foo, ...). For example, if you override -// foo with an interceptor for other function. -#if !SANITIZER_MAC && !SANITIZER_FUCHSIA -# define DEFINE_REAL(ret_type, func, ...) \ - typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \ - namespace __interception { \ - FUNC_TYPE(func) PTR_TO_REAL(func); \ - } -#else -# define DEFINE_REAL(ret_type, func, ...) -#endif - -#if SANITIZER_FUCHSIA - -// We need to define the __interceptor_func name just to get -// sanitizer_common/scripts/gen_dynamic_list.py to export func. -// But we don't need to export __interceptor_func to get that. -#define INTERCEPTOR(ret_type, func, ...) \ - extern "C"[[ gnu::alias(#func), gnu::visibility("hidden") ]] ret_type \ - __interceptor_##func(__VA_ARGS__); \ - extern "C" INTERCEPTOR_ATTRIBUTE ret_type func(__VA_ARGS__) - -#elif !SANITIZER_MAC - -#define INTERCEPTOR(ret_type, func, ...) \ - DEFINE_REAL(ret_type, func, __VA_ARGS__) \ - DECLARE_WRAPPER(ret_type, func, __VA_ARGS__) \ - extern "C" \ - INTERCEPTOR_ATTRIBUTE \ - ret_type WRAP(func)(__VA_ARGS__) - -// We don't need INTERCEPTOR_WITH_SUFFIX on non-Darwin for now. -#define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \ - INTERCEPTOR(ret_type, func, __VA_ARGS__) - -#else // SANITIZER_MAC - -#define INTERCEPTOR_ZZZ(suffix, ret_type, func, ...) \ - extern "C" ret_type func(__VA_ARGS__) suffix; \ - extern "C" ret_type WRAP(func)(__VA_ARGS__); \ - INTERPOSER(func); \ - extern "C" INTERCEPTOR_ATTRIBUTE ret_type WRAP(func)(__VA_ARGS__) - -#define INTERCEPTOR(ret_type, func, ...) \ - INTERCEPTOR_ZZZ(/*no symbol variants*/, ret_type, func, __VA_ARGS__) - -#define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \ - INTERCEPTOR_ZZZ(__DARWIN_ALIAS_C(func), ret_type, func, __VA_ARGS__) - -// Override |overridee| with |overrider|. -#define OVERRIDE_FUNCTION(overridee, overrider) \ - INTERPOSER_2(overridee, WRAP(overrider)) -#endif - -#if SANITIZER_WINDOWS -# define INTERCEPTOR_WINAPI(ret_type, func, ...) \ - typedef ret_type (__stdcall *FUNC_TYPE(func))(__VA_ARGS__); \ - namespace __interception { \ - FUNC_TYPE(func) PTR_TO_REAL(func); \ - } \ - extern "C" \ - INTERCEPTOR_ATTRIBUTE \ - ret_type __stdcall WRAP(func)(__VA_ARGS__) -#endif - -// ISO C++ forbids casting between pointer-to-function and pointer-to-object, -// so we use casting via an integral type __interception::uptr, -// assuming that system is POSIX-compliant. Using other hacks seem -// challenging, as we don't even pass function type to -// INTERCEPT_FUNCTION macro, only its name. -namespace __interception { -#if defined(_WIN64) -typedef unsigned long long uptr; -#else -typedef unsigned long uptr; -#endif // _WIN64 -} // namespace __interception - -#define INCLUDED_FROM_INTERCEPTION_LIB - -#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \ - SANITIZER_SOLARIS - -# include "interception_linux.h" -# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) -# define INTERCEPT_FUNCTION_VER(func, symver) \ - INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) -#elif SANITIZER_MAC -# include "interception_mac.h" -# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_MAC(func) -# define INTERCEPT_FUNCTION_VER(func, symver) \ - INTERCEPT_FUNCTION_VER_MAC(func, symver) -#elif SANITIZER_WINDOWS -# include "interception_win.h" -# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_WIN(func) -# define INTERCEPT_FUNCTION_VER(func, symver) \ - INTERCEPT_FUNCTION_VER_WIN(func, symver) -#endif - -#undef INCLUDED_FROM_INTERCEPTION_LIB - -#endif // INTERCEPTION_H diff --git a/contrib/libs/clang14-rt/lib/interception/interception_linux.cpp b/contrib/libs/clang14-rt/lib/interception/interception_linux.cpp deleted file mode 100644 index 5111a87f0a6c..000000000000 --- a/contrib/libs/clang14-rt/lib/interception/interception_linux.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===-- interception_linux.cpp ----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Linux-specific interception methods. -//===----------------------------------------------------------------------===// - -#include "interception.h" - -#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \ - SANITIZER_SOLARIS - -#include // for dlsym() and dlvsym() - -namespace __interception { - -#if SANITIZER_NETBSD -static int StrCmp(const char *s1, const char *s2) { - while (true) { - if (*s1 != *s2) - return false; - if (*s1 == 0) - return true; - s1++; - s2++; - } -} -#endif - -static void *GetFuncAddr(const char *name, uptr wrapper_addr) { -#if SANITIZER_NETBSD - // FIXME: Find a better way to handle renames - if (StrCmp(name, "sigaction")) - name = "__sigaction14"; -#endif - void *addr = dlsym(RTLD_NEXT, name); - if (!addr) { - // If the lookup using RTLD_NEXT failed, the sanitizer runtime library is - // later in the library search order than the DSO that we are trying to - // intercept, which means that we cannot intercept this function. We still - // want the address of the real definition, though, so look it up using - // RTLD_DEFAULT. - addr = dlsym(RTLD_DEFAULT, name); - - // In case `name' is not loaded, dlsym ends up finding the actual wrapper. - // We don't want to intercept the wrapper and have it point to itself. - if ((uptr)addr == wrapper_addr) - addr = nullptr; - } - return addr; -} - -bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func, - uptr wrapper) { - void *addr = GetFuncAddr(name, wrapper); - *ptr_to_real = (uptr)addr; - return addr && (func == wrapper); -} - -// dlvsym is a GNU extension supported by some other platforms. -#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD -static void *GetFuncAddr(const char *name, const char *ver) { - return dlvsym(RTLD_NEXT, name, ver); -} - -bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real, - uptr func, uptr wrapper) { - void *addr = GetFuncAddr(name, ver); - *ptr_to_real = (uptr)addr; - return addr && (func == wrapper); -} -#endif // SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD - -} // namespace __interception - -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || - // SANITIZER_SOLARIS diff --git a/contrib/libs/clang14-rt/lib/interception/interception_linux.h b/contrib/libs/clang14-rt/lib/interception/interception_linux.h deleted file mode 100644 index a08f8cb98c40..000000000000 --- a/contrib/libs/clang14-rt/lib/interception/interception_linux.h +++ /dev/null @@ -1,53 +0,0 @@ -//===-- interception_linux.h ------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Linux-specific interception methods. -//===----------------------------------------------------------------------===// - -#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \ - SANITIZER_SOLARIS - -#if !defined(INCLUDED_FROM_INTERCEPTION_LIB) -# error "interception_linux.h should be included from interception library only" -#endif - -#ifndef INTERCEPTION_LINUX_H -#define INTERCEPTION_LINUX_H - -namespace __interception { -bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func, - uptr wrapper); -bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real, - uptr func, uptr wrapper); -} // namespace __interception - -#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \ - ::__interception::InterceptFunction( \ - #func, \ - (::__interception::uptr *) & REAL(func), \ - (::__interception::uptr) & (func), \ - (::__interception::uptr) & WRAP(func)) - -// dlvsym is a GNU extension supported by some other platforms. -#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD -#define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ - ::__interception::InterceptFunction( \ - #func, symver, \ - (::__interception::uptr *) & REAL(func), \ - (::__interception::uptr) & (func), \ - (::__interception::uptr) & WRAP(func)) -#else -#define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ - INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) -#endif // SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD - -#endif // INTERCEPTION_LINUX_H -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || - // SANITIZER_SOLARIS diff --git a/contrib/libs/clang14-rt/lib/interception/interception_mac.cpp b/contrib/libs/clang14-rt/lib/interception/interception_mac.cpp deleted file mode 100644 index fb6eadcff597..000000000000 --- a/contrib/libs/clang14-rt/lib/interception/interception_mac.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===-- interception_mac.cpp ------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Mac-specific interception methods. -//===----------------------------------------------------------------------===// - -#include "interception.h" - -#if SANITIZER_MAC - -#endif // SANITIZER_MAC diff --git a/contrib/libs/clang14-rt/lib/interception/interception_mac.h b/contrib/libs/clang14-rt/lib/interception/interception_mac.h deleted file mode 100644 index eddedb8959c4..000000000000 --- a/contrib/libs/clang14-rt/lib/interception/interception_mac.h +++ /dev/null @@ -1,27 +0,0 @@ -//===-- interception_mac.h --------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Mac-specific interception methods. -//===----------------------------------------------------------------------===// - -#if SANITIZER_MAC - -#if !defined(INCLUDED_FROM_INTERCEPTION_LIB) -# error "interception_mac.h should be included from interception.h only" -#endif - -#ifndef INTERCEPTION_MAC_H -#define INTERCEPTION_MAC_H - -#define INTERCEPT_FUNCTION_MAC(func) -#define INTERCEPT_FUNCTION_VER_MAC(func, symver) - -#endif // INTERCEPTION_MAC_H -#endif // SANITIZER_MAC diff --git a/contrib/libs/clang14-rt/lib/interception/interception_type_test.cpp b/contrib/libs/clang14-rt/lib/interception/interception_type_test.cpp deleted file mode 100644 index a611604a700c..000000000000 --- a/contrib/libs/clang14-rt/lib/interception/interception_type_test.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===-- interception_type_test.cpp ------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Compile-time tests of the internal type definitions. -//===----------------------------------------------------------------------===// - -#include "interception.h" - -#if SANITIZER_LINUX || SANITIZER_MAC - -#include -#include -#include - -COMPILER_CHECK(sizeof(::SIZE_T) == sizeof(size_t)); -COMPILER_CHECK(sizeof(::SSIZE_T) == sizeof(ssize_t)); -COMPILER_CHECK(sizeof(::PTRDIFF_T) == sizeof(ptrdiff_t)); -COMPILER_CHECK(sizeof(::INTMAX_T) == sizeof(intmax_t)); - -#if !SANITIZER_MAC -COMPILER_CHECK(sizeof(::OFF64_T) == sizeof(off64_t)); -#endif - -// The following are the cases when pread (and friends) is used instead of -// pread64. In those cases we need OFF_T to match off_t. We don't care about the -// rest (they depend on _FILE_OFFSET_BITS setting when building an application). -# if SANITIZER_ANDROID || !defined _FILE_OFFSET_BITS || \ - _FILE_OFFSET_BITS != 64 -COMPILER_CHECK(sizeof(::OFF_T) == sizeof(off_t)); -# endif - -#endif diff --git a/contrib/libs/clang14-rt/lib/interception/interception_win.cpp b/contrib/libs/clang14-rt/lib/interception/interception_win.cpp deleted file mode 100644 index 10b893391f47..000000000000 --- a/contrib/libs/clang14-rt/lib/interception/interception_win.cpp +++ /dev/null @@ -1,1071 +0,0 @@ -//===-- interception_linux.cpp ----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file is a part of AddressSanitizer, an address sanity checker. -// -// Windows-specific interception methods. -// -// This file is implementing several hooking techniques to intercept calls -// to functions. The hooks are dynamically installed by modifying the assembly -// code. -// -// The hooking techniques are making assumptions on the way the code is -// generated and are safe under these assumptions. -// -// On 64-bit architecture, there is no direct 64-bit jump instruction. To allow -// arbitrary branching on the whole memory space, the notion of trampoline -// region is used. A trampoline region is a memory space withing 2G boundary -// where it is safe to add custom assembly code to build 64-bit jumps. -// -// Hooking techniques -// ================== -// -// 1) Detour -// -// The Detour hooking technique is assuming the presence of an header with -// padding and an overridable 2-bytes nop instruction (mov edi, edi). The -// nop instruction can safely be replaced by a 2-bytes jump without any need -// to save the instruction. A jump to the target is encoded in the function -// header and the nop instruction is replaced by a short jump to the header. -// -// head: 5 x nop head: jmp -// func: mov edi, edi --> func: jmp short -// [...] real: [...] -// -// This technique is only implemented on 32-bit architecture. -// Most of the time, Windows API are hookable with the detour technique. -// -// 2) Redirect Jump -// -// The redirect jump is applicable when the first instruction is a direct -// jump. The instruction is replaced by jump to the hook. -// -// func: jmp