From baa2a43cd81c7f40d70c4c56e36c1690eadea4de Mon Sep 17 00:00:00 2001 From: snermolaev Date: Tue, 21 Oct 2025 05:05:02 +0300 Subject: [PATCH 01/55] BUNDLE_OUTPUT macro for additional modules outputs commit_hash:917e243f0ac57950881b0a52d975499ca0ed323f --- build/scripts/bundle_output.py | 44 ++++++++++++++++++++++++++++++++++ build/scripts/ya.make | 1 + build/ymake.core.conf | 19 +++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 build/scripts/bundle_output.py 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/ymake.core.conf b/build/ymake.core.conf index 2e853fb4b5cf..b593c5893d61 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -2823,6 +2823,25 @@ macro _BUNDLE_TARGET(Target, Destination, Suffix) { .SEM=target_commands-ITEM && target_commands-macro copy_file && target_commands-args ${result:Target}$Suffix ${noauto;output:Destination} && target_commands-flags src_is_depend } +### @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) ### ### Sets a timeout on test execution From e44fe1d7ec641f59530524e9aefb9365bda3c976 Mon Sep 17 00:00:00 2001 From: mikhailche Date: Tue, 21 Oct 2025 07:16:00 +0300 Subject: [PATCH 02/55] Improve DEFAULT_*_JAVA_SRCS_LAYOUT docs commit_hash:d94f2f05ef062c16ba7ad619b89cc8c71679e06b --- build/conf/java.conf | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/build/conf/java.conf b/build/conf/java.conf index 117c23fa8ced..2a26b69a17a2 100644 --- a/build/conf/java.conf +++ b/build/conf/java.conf @@ -519,8 +519,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 +532,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 From 767f2c5eb2fe824bcbafcb09f0478a8c6cc0a9f1 Mon Sep 17 00:00:00 2001 From: ilnurkh Date: Tue, 21 Oct 2025 09:49:10 +0300 Subject: [PATCH 03/55] Add GetOrEmplace for TMaybe commit_hash:3e9ec510809df7c44c56a28e1795cb6363d54e9f --- util/generic/maybe.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/util/generic/maybe.h b/util/generic/maybe.h index 0dfcfdcaaa33..cf35931e02c1 100644 --- a/util/generic/maybe.h +++ b/util/generic/maybe.h @@ -303,6 +303,28 @@ class TMaybe: private TMaybeBase { return *this; } + template + T& GetOrEmplace(Args&&... args) { + if (!Defined()) { + Init(std::forward(args)...); + } + return *Data(); + } + + template + T& Emplace(Args&&... args) { + Clear(); + Init(std::forward(args)...); + return *Data(); + } + + template + T& emplace(Args&&... args) { + Clear(); + Init(std::forward(args)...); + return *Data(); + } + template T& ConstructInPlace(Args&&... args) { Clear(); From f7a051493b9244fe7df62b1d0f9b559f1713df10 Mon Sep 17 00:00:00 2001 From: robot-contrib Date: Tue, 21 Oct 2025 10:20:43 +0300 Subject: [PATCH 04/55] Update contrib/libs/croaring to 4.4.2 commit_hash:6b64a5932722c9ca89d74fcb2c0ebd7667013472 --- contrib/libs/croaring/.yandex_meta/override.nix | 4 ++-- contrib/libs/croaring/README.md | 2 +- contrib/libs/croaring/include/roaring/roaring_version.h | 4 ++-- contrib/libs/croaring/ya.make | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/libs/croaring/.yandex_meta/override.nix b/contrib/libs/croaring/.yandex_meta/override.nix index 0937e4a70cf0..0b43f517a6a2 100644 --- a/contrib/libs/croaring/.yandex_meta/override.nix +++ b/contrib/libs/croaring/.yandex_meta/override.nix @@ -1,12 +1,12 @@ pkgs: attrs: with pkgs; with attrs; rec { pname = "croaring"; - version = "4.4.1"; + version = "4.4.2"; src = fetchFromGitHub { owner = "RoaringBitmap"; repo = "CRoaring"; rev = "v${version}"; - hash = "sha256-IpDmqosQYISfDE0o28bJqe4omRs+MgyJyjQJaLnAEso="; + hash = "sha256-ACFcbg+IdpRIQlqsqb1wtIT+N7zOW9fR+faDajSUM8c="; }; patches = []; diff --git a/contrib/libs/croaring/README.md b/contrib/libs/croaring/README.md index 4dad111d9cac..6e901cd35e2c 100644 --- a/contrib/libs/croaring/README.md +++ b/contrib/libs/croaring/README.md @@ -48,7 +48,7 @@ Bitsets, also called bitmaps, are commonly used as fast data structures. Unfortu Roaring bitmaps are compressed bitmaps which tend to outperform conventional compressed bitmaps such as WAH, EWAH or Concise. They are used by several major systems such as [Apache Lucene][lucene] and derivative systems such as [Solr][solr] and -[Elasticsearch][elasticsearch], [Metamarkets' Druid][druid], [LinkedIn Pinot][pinot], [Netflix Atlas][atlas], [Apache Spark][spark], [OpenSearchServer][opensearchserver], [Cloud Torrent][cloudtorrent], [Whoosh][whoosh], [InfluxDB](https://www.influxdata.com), [Pilosa][pilosa], [Bleve](http://www.blevesearch.com), [Microsoft Visual Studio Team Services (VSTS)][vsts], and eBay's [Apache Kylin][kylin]. The CRoaring library is used in several systems such as [Apache Doris](http://doris.incubator.apache.org), [ClickHouse](https://github.com/ClickHouse/ClickHouse), [Redpanda](https://github.com/redpanda-data/redpanda), [YDB](https://ydb.tech), [Alibaba Tair](https://www.alibabacloud.com/help/en/redis/developer-reference/tairroaring-command), and [StarRocks](https://github.com/StarRocks/starrocks). The YouTube SQL Engine, [Google Procella](https://research.google/pubs/pub48388/), uses Roaring bitmaps for indexing. +[Elasticsearch][elasticsearch], [Metamarkets' Druid][druid], [LinkedIn Pinot][pinot], [Netflix Atlas][atlas], [Apache Spark][spark], [OpenSearchServer][opensearchserver], [Cloud Torrent][cloudtorrent], [Whoosh][whoosh], [InfluxDB](https://www.influxdata.com), [Pilosa][pilosa], [Bleve](http://www.blevesearch.com), [Microsoft Visual Studio Team Services (VSTS)][vsts], and eBay's [Apache Kylin][kylin]. The CRoaring library is used in several systems such as [Apache Doris](http://doris.incubator.apache.org), [ClickHouse](https://github.com/ClickHouse/ClickHouse), [Redpanda](https://github.com/redpanda-data/redpanda), [YDB](https://ydb.tech), [Alibaba Tair](https://www.alibabacloud.com/help/en/redis/developer-reference/tairroaring-command), [clice](https://github.com/clice-io/clice), and [StarRocks](https://github.com/StarRocks/starrocks). The YouTube SQL Engine, [Google Procella](https://research.google/pubs/pub48388/), uses Roaring bitmaps for indexing. We published a peer-reviewed article on the design and evaluation of this library: diff --git a/contrib/libs/croaring/include/roaring/roaring_version.h b/contrib/libs/croaring/include/roaring/roaring_version.h index c453aec78095..8d6af7c88a9d 100644 --- a/contrib/libs/croaring/include/roaring/roaring_version.h +++ b/contrib/libs/croaring/include/roaring/roaring_version.h @@ -2,11 +2,11 @@ // /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand #ifndef ROARING_INCLUDE_ROARING_VERSION #define ROARING_INCLUDE_ROARING_VERSION -#define ROARING_VERSION "4.4.1" +#define ROARING_VERSION "4.4.2" enum { ROARING_VERSION_MAJOR = 4, ROARING_VERSION_MINOR = 4, - ROARING_VERSION_REVISION = 1 + ROARING_VERSION_REVISION = 2 }; #endif // ROARING_INCLUDE_ROARING_VERSION // clang-format on \ No newline at end of file diff --git a/contrib/libs/croaring/ya.make b/contrib/libs/croaring/ya.make index 2300d1d1817b..c83a471eb1ed 100644 --- a/contrib/libs/croaring/ya.make +++ b/contrib/libs/croaring/ya.make @@ -10,9 +10,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(4.4.1) +VERSION(4.4.2) -ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.4.1.tar.gz) +ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.4.2.tar.gz) ADDINCL( GLOBAL contrib/libs/croaring/include From 89b6a9fcaf345dba54c9041fa0b404f1fb4eb64d Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Tue, 21 Oct 2025 10:58:31 +0300 Subject: [PATCH 05/55] Intermediate changes commit_hash:7559344da5c2facb873c98b244b75db040397437 --- contrib/python/frozenlist/.dist-info/METADATA | 48 ++++++++++++++++++- .../python/frozenlist/frozenlist/__init__.py | 2 +- contrib/python/frozenlist/ya.make | 2 +- contrib/python/multidict/.dist-info/METADATA | 3 +- .../python/multidict/multidict/__init__.py | 17 +++---- .../multidict/tests/isolated/multidict_pop.py | 4 +- contrib/python/multidict/tests/test_istr.py | 15 +++--- contrib/python/multidict/ya.make | 2 +- 8 files changed, 70 insertions(+), 23 deletions(-) diff --git a/contrib/python/frozenlist/.dist-info/METADATA b/contrib/python/frozenlist/.dist-info/METADATA index 2618ac44b34c..30d66530bc93 100644 --- a/contrib/python/frozenlist/.dist-info/METADATA +++ b/contrib/python/frozenlist/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: frozenlist -Version: 1.7.0 +Version: 1.8.0 Summary: A list-like structure which implements collections.abc.MutableSequence Home-page: https://github.com/aio-libs/frozenlist Maintainer: aiohttp team @@ -28,6 +28,7 @@ Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.9 @@ -161,6 +162,51 @@ Changelog .. towncrier release notes start +v1.8.0 +====== + +*(2025-10-05)* + + +Contributor-facing changes +-------------------------- + +- The ``reusable-cibuildwheel.yml`` workflow has been refactored to + be more generic and ``ci-cd.yml`` now holds all the configuration + toggles -- by `@webknjaz `__. + + *Related issues and pull requests on GitHub:* + `#668 `__. + +- When building wheels, the source distribution is now passed directly + to the ``cibuildwheel`` invocation -- by `@webknjaz `__. + + *Related issues and pull requests on GitHub:* + `#669 `__. + +- Builds and tests have been added to + ``ci-cd.yml`` for arm64 Windows wheels -- by `@finnagin `__. + + *Related issues and pull requests on GitHub:* + `#677 `__. + +- Started building wheels for CPython 3.14 -- by `@kumaraditya303 `__. + + *Related issues and pull requests on GitHub:* + `#681 `__, `#682 `__. + +- Removed ``--config-settings=pure-python=false`` from ``requirements/dev.txt``. + Developers on CPython still get accelerated builds by default. To explicitly build + a pure Python wheel, use ``pip install -e . --config-settings=pure-python=true`` + -- by `@bdraco `__. + + *Related issues and pull requests on GitHub:* + `#687 `__. + + +---- + + v1.7.0 ====== diff --git a/contrib/python/frozenlist/frozenlist/__init__.py b/contrib/python/frozenlist/frozenlist/__init__.py index a8019adadcf2..41c859588035 100644 --- a/contrib/python/frozenlist/frozenlist/__init__.py +++ b/contrib/python/frozenlist/frozenlist/__init__.py @@ -3,7 +3,7 @@ from collections.abc import MutableSequence from functools import total_ordering -__version__ = "1.7.0" +__version__ = "1.8.0" __all__ = ("FrozenList", "PyFrozenList") # type: Tuple[str, ...] diff --git a/contrib/python/frozenlist/ya.make b/contrib/python/frozenlist/ya.make index d749776980f0..3ee6b6818999 100644 --- a/contrib/python/frozenlist/ya.make +++ b/contrib/python/frozenlist/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(1.7.0) +VERSION(1.8.0) LICENSE(Apache-2.0) diff --git a/contrib/python/multidict/.dist-info/METADATA b/contrib/python/multidict/.dist-info/METADATA index b136b6cf70cc..1ab8dd6468c5 100644 --- a/contrib/python/multidict/.dist-info/METADATA +++ b/contrib/python/multidict/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: multidict -Version: 6.6.4 +Version: 6.7.0 Summary: multidict implementation Home-page: https://github.com/aio-libs/multidict Author: Andrew Svetlov @@ -24,6 +24,7 @@ Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 Requires-Python: >=3.9 Description-Content-Type: text/x-rst License-File: LICENSE diff --git a/contrib/python/multidict/multidict/__init__.py b/contrib/python/multidict/multidict/__init__.py index bd03149defce..a688932e52f4 100644 --- a/contrib/python/multidict/multidict/__init__.py +++ b/contrib/python/multidict/multidict/__init__.py @@ -1,4 +1,5 @@ -"""Multidict implementation. +""" +Multidict implementation. HTTP Headers and URL query string require specific data structure: multidict. It behaves mostly like a dict but it can have @@ -11,18 +12,18 @@ from ._compat import USE_EXTENSIONS __all__ = ( - "MultiMapping", - "MutableMultiMapping", - "MultiDictProxy", + "CIMultiDict", "CIMultiDictProxy", "MultiDict", - "CIMultiDict", - "upstr", - "istr", + "MultiDictProxy", + "MultiMapping", + "MutableMultiMapping", "getversion", + "istr", + "upstr", ) -__version__ = "6.6.4" +__version__ = "6.7.0" if TYPE_CHECKING or not USE_EXTENSIONS: diff --git a/contrib/python/multidict/tests/isolated/multidict_pop.py b/contrib/python/multidict/tests/isolated/multidict_pop.py index daced359e650..89fcce11c7b8 100644 --- a/contrib/python/multidict/tests/isolated/multidict_pop.py +++ b/contrib/python/multidict/tests/isolated/multidict_pop.py @@ -23,13 +23,15 @@ def get_memory_usage() -> int: return memory_info.rss / (1024 * 1024) # type: ignore[no-any-return] +initial_memory_usage = get_memory_usage() + keys = [f"X-Any-{i}" for i in range(100)] headers = {key: key * 2 for key in keys} def check_for_leak() -> None: trim_ram() - usage = get_memory_usage() + usage = get_memory_usage() - initial_memory_usage assert usage < 50, f"Memory leaked at: {usage} MB" diff --git a/contrib/python/multidict/tests/test_istr.py b/contrib/python/multidict/tests/test_istr.py index f02a23593334..029f579b339a 100644 --- a/contrib/python/multidict/tests/test_istr.py +++ b/contrib/python/multidict/tests/test_istr.py @@ -5,7 +5,6 @@ import pytest IMPLEMENTATION = getattr(sys, "implementation") # to suppress mypy error -GIL_ENABLED = getattr(sys, "_is_gil_enabled", lambda: True)() def test_ctor(case_insensitive_str_class: Type[str]) -> None: @@ -64,16 +63,14 @@ def _create_strs() -> None: IMPLEMENTATION.name != "cpython", reason="PyPy has different GC implementation", ) -@pytest.mark.skipif( - not GIL_ENABLED, - reason="free threading has different GC implementation", -) -def test_leak(create_istrs: Callable[[], None]) -> None: +def test_leak( + create_istrs: Callable[[], None], case_insensitive_str_class: Type[str] +) -> None: gc.collect() - cnt = len(gc.get_objects()) for _ in range(10000): create_istrs() gc.collect() - cnt2 = len(gc.get_objects()) - assert abs(cnt - cnt2) < 10 # on other GC impls these numbers are not equal + assert not any( + isinstance(obj, case_insensitive_str_class) for obj in gc.get_objects() + ) diff --git a/contrib/python/multidict/ya.make b/contrib/python/multidict/ya.make index aad90e18cfb9..4e447c884d0d 100644 --- a/contrib/python/multidict/ya.make +++ b/contrib/python/multidict/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.6.4) +VERSION(6.7.0) LICENSE(Apache-2.0) From dc6cda1621b0ec969f36ed44dfdd6ec0efdd81b2 Mon Sep 17 00:00:00 2001 From: robot-ya-builder Date: Tue, 21 Oct 2025 11:03:50 +0300 Subject: [PATCH 06/55] Automatic release build for ya_bin, os_test_tool, test_tool, os_ya Update tools: ya_bin, os_test_tool, test_tool, os_ya commit_hash:2fbc1c3d60d3b426569cbbac459126044e1b1ed5 --- build/mapping.conf.json | 2 ++ build/platform/test_tool/host.ya.make.inc | 10 +++++----- build/platform/test_tool/host_os.ya.make.inc | 10 +++++----- ya | 20 ++++++++++---------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/build/mapping.conf.json b/build/mapping.conf.json index 4d9a9158ad6f..b35740f50521 100644 --- a/build/mapping.conf.json +++ b/build/mapping.conf.json @@ -461,6 +461,7 @@ "3968796477": "{registry_endpoint}/3968796477", "3968796981": "{registry_endpoint}/3968796981", "3968797636": "{registry_endpoint}/3968797636", + "10050129395": "{registry_endpoint}/10050129395", "5486713852": "{registry_endpoint}/5486713852", "5514352253": "{registry_endpoint}/5514352253", "5523579199": "{registry_endpoint}/5523579199", @@ -2241,6 +2242,7 @@ "3968796477": "devtools/ya/test/programs/flake8/py3/flake8 for linux-aarch64", "3968796981": "devtools/ya/test/programs/flake8/py3/flake8 for linux-ppc64le", "3968797636": "devtools/ya/test/programs/flake8/py3/flake8 for win32", + "10050129395": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5486713852": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5514352253": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5523579199": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", diff --git a/build/platform/test_tool/host.ya.make.inc b/build/platform/test_tool/host.ya.make.inc index b1ee16c56337..7e100581ff1f 100644 --- a/build/platform/test_tool/host.ya.make.inc +++ b/build/platform/test_tool/host.ya.make.inc @@ -1,12 +1,12 @@ IF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985369410) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050211675) ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_ARM64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985365495) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050207070) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985375160) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050219731) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_AARCH64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985362301) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050203832) ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985372335) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050216120) ENDIF() diff --git a/build/platform/test_tool/host_os.ya.make.inc b/build/platform/test_tool/host_os.ya.make.inc index 6ede13a99b01..6e28a9519b36 100644 --- a/build/platform/test_tool/host_os.ya.make.inc +++ b/build/platform/test_tool/host_os.ya.make.inc @@ -1,12 +1,12 @@ IF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985347260) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050119334) ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_ARM64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985344210) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050114246) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985353571) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050129395) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_AARCH64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985341289) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050109489) ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985350661) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050124173) ENDIF() diff --git a/ya b/ya index e18b361759d2..02588e49a1e6 100755 --- a/ya +++ b/ya @@ -39,33 +39,33 @@ REGISTRY_ENDPOINT = os.environ.get("YA_REGISTRY_ENDPOINT", "https://devtools-reg PLATFORM_MAP = { "data": { "win32": { - "md5": "a712addc784890ce75a167142a082fa8", + "md5": "722083ed92162b7a8739d96818a73c11", "urls": [ - f"{REGISTRY_ENDPOINT}/9985394570" + f"{REGISTRY_ENDPOINT}/10050213201" ] }, "darwin": { - "md5": "fc35ba4887e39f26d947c326984ebc3e", + "md5": "f48c19b8940a7d46a3907fa722584eab", "urls": [ - f"{REGISTRY_ENDPOINT}/9985390713" + f"{REGISTRY_ENDPOINT}/10050208723" ] }, "darwin-arm64": { - "md5": "0d46439fee9ed381dbdad09e2e5cc6a1", + "md5": "8fd3324c7e6e6b7025982294e0f4466d", "urls": [ - f"{REGISTRY_ENDPOINT}/9985386916" + f"{REGISTRY_ENDPOINT}/10050205181" ] }, "linux-aarch64": { - "md5": "fa8f1231599daa34a0cf75c909a8089e", + "md5": "447c23c1035d6942988867178daf29c3", "urls": [ - f"{REGISTRY_ENDPOINT}/9985383917" + f"{REGISTRY_ENDPOINT}/10050201300" ] }, "linux": { - "md5": "0ce0099a335ef1ee19d6a4c3bac5f045", + "md5": "c448c3d3c0e5a06f69c9c97d8af08067", "urls": [ - f"{REGISTRY_ENDPOINT}/9985398958" + f"{REGISTRY_ENDPOINT}/10050217041" ] } } From 207bc9c6de5173423125bfebe6d5e40cfbcbded3 Mon Sep 17 00:00:00 2001 From: apachee Date: Tue, 21 Oct 2025 11:43:42 +0300 Subject: [PATCH 07/55] Revert defaulted equality operator for yson struct commit_hash:f6cb89c3fb117035812d75104cede006abcb3652 --- yt/yt/core/concurrency/config.cpp | 7 +++++++ yt/yt/core/concurrency/config.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/yt/yt/core/concurrency/config.cpp b/yt/yt/core/concurrency/config.cpp index 1badd603f7fa..fffc2d0d693e 100644 --- a/yt/yt/core/concurrency/config.cpp +++ b/yt/yt/core/concurrency/config.cpp @@ -100,6 +100,13 @@ void TRelativeThroughputThrottlerConfig::Register(TRegistrar registrar) //////////////////////////////////////////////////////////////////////////////// +bool TThroughputThrottlerConfig::operator==(const NConcurrency::TThroughputThrottlerConfig& other) +{ + return Limit == other.Limit && Period == other.Period; +} + +//////////////////////////////////////////////////////////////////////////////// + void TPrefetchingThrottlerConfig::Register(TRegistrar registrar) { registrar.Parameter("enable", &TThis::Enable) diff --git a/yt/yt/core/concurrency/config.h b/yt/yt/core/concurrency/config.h index 01fc98027b38..20639a7be2ef 100644 --- a/yt/yt/core/concurrency/config.h +++ b/yt/yt/core/concurrency/config.h @@ -87,7 +87,7 @@ struct TThroughputThrottlerConfig static TThroughputThrottlerConfigPtr Create(std::optional limit); - bool operator==(const TThroughputThrottlerConfig& other) const = default; + bool operator==(const TThroughputThrottlerConfig& other); REGISTER_YSON_STRUCT(TThroughputThrottlerConfig); From 1577dd56ef2543ebadd158d172af102a4f121481 Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Tue, 21 Oct 2025 13:40:16 +0300 Subject: [PATCH 08/55] Intermediate changes commit_hash:d9cd0ae2ed233aa254faf0dc5776fd4def81464f --- .../.yandex_meta/__init__.py | 4 +- .../.yandex_meta/override.nix | 3 + .../aiohappyeyeballs/.dist-info/METADATA | 123 +++++ contrib/python/aiohappyeyeballs/LICENSE | 279 +++++++++++ contrib/python/aiohappyeyeballs/README.md | 96 ++++ .../aiohappyeyeballs/__init__.py | 14 + .../aiohappyeyeballs/_staggered.py | 207 ++++++++ .../aiohappyeyeballs/aiohappyeyeballs/impl.py | 259 ++++++++++ .../aiohappyeyeballs/py.typed | 0 .../aiohappyeyeballs/types.py | 17 + .../aiohappyeyeballs/utils.py | 97 ++++ contrib/python/aiohappyeyeballs/ya.make | 26 + contrib/python/aiohttp/.dist-info/METADATA | 11 +- contrib/python/aiohttp/README.rst | 3 +- contrib/python/aiohttp/aiohttp/__init__.py | 82 ++-- contrib/python/aiohttp/aiohttp/_helpers.pyx | 22 +- .../python/aiohttp/aiohttp/_http_parser.pyx | 19 +- contrib/python/aiohttp/aiohttp/abc.py | 31 +- .../python/aiohttp/aiohttp/base_protocol.py | 3 +- contrib/python/aiohttp/aiohttp/client.py | 408 ++++++++++------ .../aiohttp/aiohttp/client_exceptions.py | 79 ++- .../python/aiohttp/aiohttp/client_proto.py | 30 +- .../python/aiohttp/aiohttp/client_reqrep.py | 173 +++++-- contrib/python/aiohttp/aiohttp/client_ws.py | 205 +++++--- .../aiohttp/aiohttp/compression_utils.py | 8 +- contrib/python/aiohttp/aiohttp/connector.py | 241 +++++++--- contrib/python/aiohttp/aiohttp/cookiejar.py | 230 +++++---- contrib/python/aiohttp/aiohttp/helpers.py | 159 +++--- .../python/aiohttp/aiohttp/http_exceptions.py | 1 - contrib/python/aiohttp/aiohttp/http_parser.py | 49 +- .../python/aiohttp/aiohttp/http_websocket.py | 451 +++++++++--------- contrib/python/aiohttp/aiohttp/http_writer.py | 7 +- contrib/python/aiohttp/aiohttp/multipart.py | 80 +++- contrib/python/aiohttp/aiohttp/payload.py | 45 +- .../aiohttp/aiohttp/payload_streamer.py | 3 + .../python/aiohttp/aiohttp/pytest_plugin.py | 52 +- contrib/python/aiohttp/aiohttp/resolver.py | 107 +++-- contrib/python/aiohttp/aiohttp/streams.py | 3 + contrib/python/aiohttp/aiohttp/test_utils.py | 162 ++++--- contrib/python/aiohttp/aiohttp/tracing.py | 72 +-- contrib/python/aiohttp/aiohttp/typedefs.py | 23 +- contrib/python/aiohttp/aiohttp/web.py | 37 +- contrib/python/aiohttp/aiohttp/web_app.py | 76 +-- .../aiohttp/aiohttp/web_fileresponse.py | 141 ++++-- .../python/aiohttp/aiohttp/web_middlewares.py | 7 +- .../python/aiohttp/aiohttp/web_protocol.py | 170 ++++--- contrib/python/aiohttp/aiohttp/web_request.py | 46 +- .../python/aiohttp/aiohttp/web_response.py | 68 ++- .../python/aiohttp/aiohttp/web_routedef.py | 6 +- contrib/python/aiohttp/aiohttp/web_runner.py | 18 +- contrib/python/aiohttp/aiohttp/web_server.py | 11 +- .../aiohttp/aiohttp/web_urldispatcher.py | 225 +++++---- contrib/python/aiohttp/aiohttp/web_ws.py | 187 +++++--- .../patches/04-force-content-type.patch | 12 + .../04-pr11265-support-aiosignal-1.4.patch | 109 ++--- ...sable-retries-on-oidemponent-methods.patch | 11 + .../aiohttp/patches/06-mypy-silence.patch | 61 +++ .../patches/07-dont-throw-at-newline.patch | 12 + .../patches/99-rep-get-running-loop.sh | 4 + contrib/python/aiohttp/ya.make | 3 +- 60 files changed, 3639 insertions(+), 1449 deletions(-) create mode 100644 contrib/python/aiohappyeyeballs/.dist-info/METADATA create mode 100644 contrib/python/aiohappyeyeballs/LICENSE create mode 100644 contrib/python/aiohappyeyeballs/README.md create mode 100644 contrib/python/aiohappyeyeballs/aiohappyeyeballs/__init__.py create mode 100644 contrib/python/aiohappyeyeballs/aiohappyeyeballs/_staggered.py create mode 100644 contrib/python/aiohappyeyeballs/aiohappyeyeballs/impl.py create mode 100644 contrib/python/aiohappyeyeballs/aiohappyeyeballs/py.typed create mode 100644 contrib/python/aiohappyeyeballs/aiohappyeyeballs/types.py create mode 100644 contrib/python/aiohappyeyeballs/aiohappyeyeballs/utils.py create mode 100644 contrib/python/aiohappyeyeballs/ya.make create mode 100644 contrib/python/aiohttp/patches/04-force-content-type.patch create mode 100644 contrib/python/aiohttp/patches/05-disable-retries-on-oidemponent-methods.patch create mode 100644 contrib/python/aiohttp/patches/06-mypy-silence.patch create mode 100644 contrib/python/aiohttp/patches/07-dont-throw-at-newline.patch create mode 100644 contrib/python/aiohttp/patches/99-rep-get-running-loop.sh diff --git a/contrib/libs/opentelemetry-cpp/.yandex_meta/__init__.py b/contrib/libs/opentelemetry-cpp/.yandex_meta/__init__.py index 0a5419431590..2a0ce19a2bc3 100644 --- a/contrib/libs/opentelemetry-cpp/.yandex_meta/__init__.py +++ b/contrib/libs/opentelemetry-cpp/.yandex_meta/__init__.py @@ -4,10 +4,10 @@ def post_install(self): with self.yamakes["."] as m: - m.CFLAGS.remove("-DOPENTELEMETRY_STL_VERSION=2023") m.CFLAGS.remove("-DPROTOBUF_USE_DLLS") - m.CFLAGS.remove("-DOPENTELEMETRY_ABI_VERSION_NO=1") + m.CFLAGS.remove("-DOPENTELEMETRY_STL_VERSION=2023") m.CFLAGS.append(GLOBAL("-DOPENTELEMETRY_STL_VERSION=2023")) + m.CFLAGS.remove("-DOPENTELEMETRY_ABI_VERSION_NO=2") m.CFLAGS.append(GLOBAL("-DOPENTELEMETRY_ABI_VERSION_NO=2")) self.yamakes["api"] = self.module( diff --git a/contrib/libs/opentelemetry-cpp/.yandex_meta/override.nix b/contrib/libs/opentelemetry-cpp/.yandex_meta/override.nix index 099158ca59d1..4b596e52d989 100644 --- a/contrib/libs/opentelemetry-cpp/.yandex_meta/override.nix +++ b/contrib/libs/opentelemetry-cpp/.yandex_meta/override.nix @@ -30,5 +30,8 @@ pkgs: attrs: with pkgs; rec { "-DWITH_OTLP_HTTP=ON" "-DWITH_OTLP_GRPC=ON" + + "-DWITH_ABI_VERSION_1=OFF" + "-DWITH_ABI_VERSION_2=ON" ]; } diff --git a/contrib/python/aiohappyeyeballs/.dist-info/METADATA b/contrib/python/aiohappyeyeballs/.dist-info/METADATA new file mode 100644 index 000000000000..c632040d66bf --- /dev/null +++ b/contrib/python/aiohappyeyeballs/.dist-info/METADATA @@ -0,0 +1,123 @@ +Metadata-Version: 2.3 +Name: aiohappyeyeballs +Version: 2.6.1 +Summary: Happy Eyeballs for asyncio +License: PSF-2.0 +Author: J. Nick Koston +Author-email: nick@koston.org +Requires-Python: >=3.9 +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Topic :: Software Development :: Libraries +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: License :: OSI Approved :: Python Software Foundation License +Project-URL: Bug Tracker, https://github.com/aio-libs/aiohappyeyeballs/issues +Project-URL: Changelog, https://github.com/aio-libs/aiohappyeyeballs/blob/main/CHANGELOG.md +Project-URL: Documentation, https://aiohappyeyeballs.readthedocs.io +Project-URL: Repository, https://github.com/aio-libs/aiohappyeyeballs +Description-Content-Type: text/markdown + +# aiohappyeyeballs + +

+ + CI Status + + + Documentation Status + + + Test coverage percentage + +

+

+ + Poetry + + + Ruff + + + pre-commit + +

+

+ + PyPI Version + + Supported Python versions + License +

+ +--- + +**Documentation**: https://aiohappyeyeballs.readthedocs.io + +**Source Code**: https://github.com/aio-libs/aiohappyeyeballs + +--- + +[Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs) +([RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html)) + +## Use case + +This library exists to allow connecting with +[Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs) +([RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html)) +when you +already have a list of addrinfo and not a DNS name. + +The stdlib version of `loop.create_connection()` +will only work when you pass in an unresolved name which +is not a good fit when using DNS caching or resolving +names via another method such as `zeroconf`. + +## Installation + +Install this via pip (or your favourite package manager): + +`pip install aiohappyeyeballs` + +## License + +[aiohappyeyeballs is licensed under the same terms as cpython itself.](https://github.com/python/cpython/blob/main/LICENSE) + +## Example usage + +```python + +addr_infos = await loop.getaddrinfo("example.org", 80) + +socket = await start_connection(addr_infos) +socket = await start_connection(addr_infos, local_addr_infos=local_addr_infos, happy_eyeballs_delay=0.2) + +transport, protocol = await loop.create_connection( + MyProtocol, sock=socket, ...) + +# Remove the first address for each family from addr_info +pop_addr_infos_interleave(addr_info, 1) + +# Remove all matching address from addr_info +remove_addr_infos(addr_info, "dead::beef::") + +# Convert a local_addr to local_addr_infos +local_addr_infos = addr_to_addr_infos(("127.0.0.1",0)) +``` + +## Credits + +This package contains code from cpython and is licensed under the same terms as cpython itself. + +This package was created with +[Copier](https://copier.readthedocs.io/) and the +[browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template) +project template. + diff --git a/contrib/python/aiohappyeyeballs/LICENSE b/contrib/python/aiohappyeyeballs/LICENSE new file mode 100644 index 000000000000..f26bcf4d2de6 --- /dev/null +++ b/contrib/python/aiohappyeyeballs/LICENSE @@ -0,0 +1,279 @@ +A. HISTORY OF THE SOFTWARE +========================== + +Python was created in the early 1990s by Guido van Rossum at Stichting +Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands +as a successor of a language called ABC. Guido remains Python's +principal author, although it includes many contributions from others. + +In 1995, Guido continued his work on Python at the Corporation for +National Research Initiatives (CNRI, see https://www.cnri.reston.va.us) +in Reston, Virginia where he released several versions of the +software. + +In May 2000, Guido and the Python core development team moved to +BeOpen.com to form the BeOpen PythonLabs team. In October of the same +year, the PythonLabs team moved to Digital Creations, which became +Zope Corporation. In 2001, the Python Software Foundation (PSF, see +https://www.python.org/psf/) was formed, a non-profit organization +created specifically to own Python-related Intellectual Property. +Zope Corporation was a sponsoring member of the PSF. + +All Python releases are Open Source (see https://opensource.org for +the Open Source Definition). Historically, most, but not all, Python +releases have also been GPL-compatible; the table below summarizes +the various releases. + + Release Derived Year Owner GPL- + from compatible? (1) + + 0.9.0 thru 1.2 1991-1995 CWI yes + 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes + 1.6 1.5.2 2000 CNRI no + 2.0 1.6 2000 BeOpen.com no + 1.6.1 1.6 2001 CNRI yes (2) + 2.1 2.0+1.6.1 2001 PSF no + 2.0.1 2.0+1.6.1 2001 PSF yes + 2.1.1 2.1+2.0.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes + 2.2 and above 2.1.1 2001-now PSF yes + +Footnotes: + +(1) GPL-compatible doesn't mean that we're distributing Python under + the GPL. All Python licenses, unlike the GPL, let you distribute + a modified version without making your changes open source. The + GPL-compatible licenses make it possible to combine Python with + other software that is released under the GPL; the others don't. + +(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, + because its license has a choice of law clause. According to + CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 + is "not incompatible" with the GPL. + +Thanks to the many outside volunteers who have worked under Guido's +direction to make these releases possible. + + +B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON +=============================================================== + +Python software and documentation are licensed under the +Python Software Foundation License Version 2. + +Starting with Python 3.8.6, examples, recipes, and other code in +the documentation are dual licensed under the PSF License Version 2 +and the Zero-Clause BSD license. + +Some software incorporated into Python is under different licenses. +The licenses are listed with code falling under that license. + + +PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 +-------------------------------------------- + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using this software ("Python") in source or binary form and +its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF hereby +grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, +analyze, test, perform and/or display publicly, prepare derivative works, +distribute, and otherwise use Python alone or in any derivative version, +provided, however, that PSF's License Agreement and PSF's notice of copyright, +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation; +All Rights Reserved" are retained in Python alone or in any derivative version +prepared by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python. + +4. PSF is making Python available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 +------------------------------------------- + +BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 + +1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an +office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the +Individual or Organization ("Licensee") accessing and otherwise using +this software in source or binary form and its associated +documentation ("the Software"). + +2. Subject to the terms and conditions of this BeOpen Python License +Agreement, BeOpen hereby grants Licensee a non-exclusive, +royalty-free, world-wide license to reproduce, analyze, test, perform +and/or display publicly, prepare derivative works, distribute, and +otherwise use the Software alone or in any derivative version, +provided, however, that the BeOpen Python License is retained in the +Software, alone or in any derivative version prepared by Licensee. + +3. BeOpen is making the Software available to Licensee on an "AS IS" +basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE +SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS +AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY +DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +5. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +6. This License Agreement shall be governed by and interpreted in all +respects by the law of the State of California, excluding conflict of +law provisions. Nothing in this License Agreement shall be deemed to +create any relationship of agency, partnership, or joint venture +between BeOpen and Licensee. This License Agreement does not grant +permission to use BeOpen trademarks or trade names in a trademark +sense to endorse or promote products or services of Licensee, or any +third party. As an exception, the "BeOpen Python" logos available at +http://www.pythonlabs.com/logos.html may be used according to the +permissions granted on that web page. + +7. By copying, installing or otherwise using the software, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 +--------------------------------------- + +1. This LICENSE AGREEMENT is between the Corporation for National +Research Initiatives, having an office at 1895 Preston White Drive, +Reston, VA 20191 ("CNRI"), and the Individual or Organization +("Licensee") accessing and otherwise using Python 1.6.1 software in +source or binary form and its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, CNRI +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 1.6.1 +alone or in any derivative version, provided, however, that CNRI's +License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) +1995-2001 Corporation for National Research Initiatives; All Rights +Reserved" are retained in Python 1.6.1 alone or in any derivative +version prepared by Licensee. Alternately, in lieu of CNRI's License +Agreement, Licensee may substitute the following text (omitting the +quotes): "Python 1.6.1 is made available subject to the terms and +conditions in CNRI's License Agreement. This Agreement together with +Python 1.6.1 may be located on the internet using the following +unique, persistent identifier (known as a handle): 1895.22/1013. This +Agreement may also be obtained from a proxy server on the internet +using the following URL: http://hdl.handle.net/1895.22/1013". + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 1.6.1 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 1.6.1. + +4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" +basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. This License Agreement shall be governed by the federal +intellectual property law of the United States, including without +limitation the federal copyright law, and, to the extent such +U.S. federal law does not apply, by the law of the Commonwealth of +Virginia, excluding Virginia's conflict of law provisions. +Notwithstanding the foregoing, with regard to derivative works based +on Python 1.6.1 that incorporate non-separable material that was +previously distributed under the GNU General Public License (GPL), the +law of the Commonwealth of Virginia shall govern this License +Agreement only as to issues arising under or with respect to +Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this +License Agreement shall be deemed to create any relationship of +agency, partnership, or joint venture between CNRI and Licensee. This +License Agreement does not grant permission to use CNRI trademarks or +trade name in a trademark sense to endorse or promote products or +services of Licensee, or any third party. + +8. By clicking on the "ACCEPT" button where indicated, or by copying, +installing or otherwise using Python 1.6.1, Licensee agrees to be +bound by the terms and conditions of this License Agreement. + + ACCEPT + + +CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 +-------------------------------------------------- + +Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, +The Netherlands. All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION +---------------------------------------------------------------------- + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/contrib/python/aiohappyeyeballs/README.md b/contrib/python/aiohappyeyeballs/README.md new file mode 100644 index 000000000000..a1cbd9953853 --- /dev/null +++ b/contrib/python/aiohappyeyeballs/README.md @@ -0,0 +1,96 @@ +# aiohappyeyeballs + +

+ + CI Status + + + Documentation Status + + + Test coverage percentage + +

+

+ + Poetry + + + Ruff + + + pre-commit + +

+

+ + PyPI Version + + Supported Python versions + License +

+ +--- + +**Documentation**: https://aiohappyeyeballs.readthedocs.io + +**Source Code**: https://github.com/aio-libs/aiohappyeyeballs + +--- + +[Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs) +([RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html)) + +## Use case + +This library exists to allow connecting with +[Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs) +([RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html)) +when you +already have a list of addrinfo and not a DNS name. + +The stdlib version of `loop.create_connection()` +will only work when you pass in an unresolved name which +is not a good fit when using DNS caching or resolving +names via another method such as `zeroconf`. + +## Installation + +Install this via pip (or your favourite package manager): + +`pip install aiohappyeyeballs` + +## License + +[aiohappyeyeballs is licensed under the same terms as cpython itself.](https://github.com/python/cpython/blob/main/LICENSE) + +## Example usage + +```python + +addr_infos = await loop.getaddrinfo("example.org", 80) + +socket = await start_connection(addr_infos) +socket = await start_connection(addr_infos, local_addr_infos=local_addr_infos, happy_eyeballs_delay=0.2) + +transport, protocol = await loop.create_connection( + MyProtocol, sock=socket, ...) + +# Remove the first address for each family from addr_info +pop_addr_infos_interleave(addr_info, 1) + +# Remove all matching address from addr_info +remove_addr_infos(addr_info, "dead::beef::") + +# Convert a local_addr to local_addr_infos +local_addr_infos = addr_to_addr_infos(("127.0.0.1",0)) +``` + +## Credits + +This package contains code from cpython and is licensed under the same terms as cpython itself. + +This package was created with +[Copier](https://copier.readthedocs.io/) and the +[browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template) +project template. diff --git a/contrib/python/aiohappyeyeballs/aiohappyeyeballs/__init__.py b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/__init__.py new file mode 100644 index 000000000000..71c689cc83ff --- /dev/null +++ b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/__init__.py @@ -0,0 +1,14 @@ +__version__ = "2.6.1" + +from .impl import start_connection +from .types import AddrInfoType, SocketFactoryType +from .utils import addr_to_addr_infos, pop_addr_infos_interleave, remove_addr_infos + +__all__ = ( + "AddrInfoType", + "SocketFactoryType", + "addr_to_addr_infos", + "pop_addr_infos_interleave", + "remove_addr_infos", + "start_connection", +) diff --git a/contrib/python/aiohappyeyeballs/aiohappyeyeballs/_staggered.py b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/_staggered.py new file mode 100644 index 000000000000..9a4ba7205eda --- /dev/null +++ b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/_staggered.py @@ -0,0 +1,207 @@ +import asyncio +import contextlib + +# PY3.9: Import Callable from typing until we drop Python 3.9 support +# https://github.com/python/cpython/issues/87131 +from typing import ( + TYPE_CHECKING, + Any, + Awaitable, + Callable, + Iterable, + List, + Optional, + Set, + Tuple, + TypeVar, + Union, +) + +_T = TypeVar("_T") + +RE_RAISE_EXCEPTIONS = (SystemExit, KeyboardInterrupt) + + +def _set_result(wait_next: "asyncio.Future[None]") -> None: + """Set the result of a future if it is not already done.""" + if not wait_next.done(): + wait_next.set_result(None) + + +async def _wait_one( + futures: "Iterable[asyncio.Future[Any]]", + loop: asyncio.AbstractEventLoop, +) -> _T: + """Wait for the first future to complete.""" + wait_next = loop.create_future() + + def _on_completion(fut: "asyncio.Future[Any]") -> None: + if not wait_next.done(): + wait_next.set_result(fut) + + for f in futures: + f.add_done_callback(_on_completion) + + try: + return await wait_next + finally: + for f in futures: + f.remove_done_callback(_on_completion) + + +async def staggered_race( + coro_fns: Iterable[Callable[[], Awaitable[_T]]], + delay: Optional[float], + *, + loop: Optional[asyncio.AbstractEventLoop] = None, +) -> Tuple[Optional[_T], Optional[int], List[Optional[BaseException]]]: + """ + Run coroutines with staggered start times and take the first to finish. + + This method takes an iterable of coroutine functions. The first one is + started immediately. From then on, whenever the immediately preceding one + fails (raises an exception), or when *delay* seconds has passed, the next + coroutine is started. This continues until one of the coroutines complete + successfully, in which case all others are cancelled, or until all + coroutines fail. + + The coroutines provided should be well-behaved in the following way: + + * They should only ``return`` if completed successfully. + + * They should always raise an exception if they did not complete + successfully. In particular, if they handle cancellation, they should + probably reraise, like this:: + + try: + # do work + except asyncio.CancelledError: + # undo partially completed work + raise + + Args: + ---- + coro_fns: an iterable of coroutine functions, i.e. callables that + return a coroutine object when called. Use ``functools.partial`` or + lambdas to pass arguments. + + delay: amount of time, in seconds, between starting coroutines. If + ``None``, the coroutines will run sequentially. + + loop: the event loop to use. If ``None``, the running loop is used. + + Returns: + ------- + tuple *(winner_result, winner_index, exceptions)* where + + - *winner_result*: the result of the winning coroutine, or ``None`` + if no coroutines won. + + - *winner_index*: the index of the winning coroutine in + ``coro_fns``, or ``None`` if no coroutines won. If the winning + coroutine may return None on success, *winner_index* can be used + to definitively determine whether any coroutine won. + + - *exceptions*: list of exceptions returned by the coroutines. + ``len(exceptions)`` is equal to the number of coroutines actually + started, and the order is the same as in ``coro_fns``. The winning + coroutine's entry is ``None``. + + """ + loop = loop or asyncio.get_running_loop() + exceptions: List[Optional[BaseException]] = [] + tasks: Set[asyncio.Task[Optional[Tuple[_T, int]]]] = set() + + async def run_one_coro( + coro_fn: Callable[[], Awaitable[_T]], + this_index: int, + start_next: "asyncio.Future[None]", + ) -> Optional[Tuple[_T, int]]: + """ + Run a single coroutine. + + If the coroutine fails, set the exception in the exceptions list and + start the next coroutine by setting the result of the start_next. + + If the coroutine succeeds, return the result and the index of the + coroutine in the coro_fns list. + + If SystemExit or KeyboardInterrupt is raised, re-raise it. + """ + try: + result = await coro_fn() + except RE_RAISE_EXCEPTIONS: + raise + except BaseException as e: + exceptions[this_index] = e + _set_result(start_next) # Kickstart the next coroutine + return None + + return result, this_index + + start_next_timer: Optional[asyncio.TimerHandle] = None + start_next: Optional[asyncio.Future[None]] + task: asyncio.Task[Optional[Tuple[_T, int]]] + done: Union[asyncio.Future[None], asyncio.Task[Optional[Tuple[_T, int]]]] + coro_iter = iter(coro_fns) + this_index = -1 + try: + while True: + if coro_fn := next(coro_iter, None): + this_index += 1 + exceptions.append(None) + start_next = loop.create_future() + task = loop.create_task(run_one_coro(coro_fn, this_index, start_next)) + tasks.add(task) + start_next_timer = ( + loop.call_later(delay, _set_result, start_next) if delay else None + ) + elif not tasks: + # We exhausted the coro_fns list and no tasks are running + # so we have no winner and all coroutines failed. + break + + while tasks or start_next: + done = await _wait_one( + (*tasks, start_next) if start_next else tasks, loop + ) + if done is start_next: + # The current task has failed or the timer has expired + # so we need to start the next task. + start_next = None + if start_next_timer: + start_next_timer.cancel() + start_next_timer = None + + # Break out of the task waiting loop to start the next + # task. + break + + if TYPE_CHECKING: + assert isinstance(done, asyncio.Task) + + tasks.remove(done) + if winner := done.result(): + return *winner, exceptions + finally: + # We either have: + # - a winner + # - all tasks failed + # - a KeyboardInterrupt or SystemExit. + + # + # If the timer is still running, cancel it. + # + if start_next_timer: + start_next_timer.cancel() + + # + # If there are any tasks left, cancel them and than + # wait them so they fill the exceptions list. + # + for task in tasks: + task.cancel() + with contextlib.suppress(asyncio.CancelledError): + await task + + return None, None, exceptions diff --git a/contrib/python/aiohappyeyeballs/aiohappyeyeballs/impl.py b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/impl.py new file mode 100644 index 000000000000..8f3919a0c959 --- /dev/null +++ b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/impl.py @@ -0,0 +1,259 @@ +"""Base implementation.""" + +import asyncio +import collections +import contextlib +import functools +import itertools +import socket +from typing import List, Optional, Sequence, Set, Union + +from . import _staggered +from .types import AddrInfoType, SocketFactoryType + + +async def start_connection( + addr_infos: Sequence[AddrInfoType], + *, + local_addr_infos: Optional[Sequence[AddrInfoType]] = None, + happy_eyeballs_delay: Optional[float] = None, + interleave: Optional[int] = None, + loop: Optional[asyncio.AbstractEventLoop] = None, + socket_factory: Optional[SocketFactoryType] = None, +) -> socket.socket: + """ + Connect to a TCP server. + + Create a socket connection to a specified destination. The + destination is specified as a list of AddrInfoType tuples as + returned from getaddrinfo(). + + The arguments are, in order: + + * ``family``: the address family, e.g. ``socket.AF_INET`` or + ``socket.AF_INET6``. + * ``type``: the socket type, e.g. ``socket.SOCK_STREAM`` or + ``socket.SOCK_DGRAM``. + * ``proto``: the protocol, e.g. ``socket.IPPROTO_TCP`` or + ``socket.IPPROTO_UDP``. + * ``canonname``: the canonical name of the address, e.g. + ``"www.python.org"``. + * ``sockaddr``: the socket address + + This method is a coroutine which will try to establish the connection + in the background. When successful, the coroutine returns a + socket. + + The expected use case is to use this method in conjunction with + loop.create_connection() to establish a connection to a server:: + + socket = await start_connection(addr_infos) + transport, protocol = await loop.create_connection( + MyProtocol, sock=socket, ...) + """ + if not (current_loop := loop): + current_loop = asyncio.get_running_loop() + + single_addr_info = len(addr_infos) == 1 + + if happy_eyeballs_delay is not None and interleave is None: + # If using happy eyeballs, default to interleave addresses by family + interleave = 1 + + if interleave and not single_addr_info: + addr_infos = _interleave_addrinfos(addr_infos, interleave) + + sock: Optional[socket.socket] = None + # uvloop can raise RuntimeError instead of OSError + exceptions: List[List[Union[OSError, RuntimeError]]] = [] + if happy_eyeballs_delay is None or single_addr_info: + # not using happy eyeballs + for addrinfo in addr_infos: + try: + sock = await _connect_sock( + current_loop, + exceptions, + addrinfo, + local_addr_infos, + None, + socket_factory, + ) + break + except (RuntimeError, OSError): + continue + else: # using happy eyeballs + open_sockets: Set[socket.socket] = set() + try: + sock, _, _ = await _staggered.staggered_race( + ( + functools.partial( + _connect_sock, + current_loop, + exceptions, + addrinfo, + local_addr_infos, + open_sockets, + socket_factory, + ) + for addrinfo in addr_infos + ), + happy_eyeballs_delay, + ) + finally: + # If we have a winner, staggered_race will + # cancel the other tasks, however there is a + # small race window where any of the other tasks + # can be done before they are cancelled which + # will leave the socket open. To avoid this problem + # we pass a set to _connect_sock to keep track of + # the open sockets and close them here if there + # are any "runner up" sockets. + for s in open_sockets: + if s is not sock: + with contextlib.suppress(OSError): + s.close() + open_sockets = None # type: ignore[assignment] + + if sock is None: + all_exceptions = [exc for sub in exceptions for exc in sub] + try: + first_exception = all_exceptions[0] + if len(all_exceptions) == 1: + raise first_exception + else: + # If they all have the same str(), raise one. + model = str(first_exception) + if all(str(exc) == model for exc in all_exceptions): + raise first_exception + # Raise a combined exception so the user can see all + # the various error messages. + msg = "Multiple exceptions: {}".format( + ", ".join(str(exc) for exc in all_exceptions) + ) + # If the errno is the same for all exceptions, raise + # an OSError with that errno. + if isinstance(first_exception, OSError): + first_errno = first_exception.errno + if all( + isinstance(exc, OSError) and exc.errno == first_errno + for exc in all_exceptions + ): + raise OSError(first_errno, msg) + elif isinstance(first_exception, RuntimeError) and all( + isinstance(exc, RuntimeError) for exc in all_exceptions + ): + raise RuntimeError(msg) + # We have a mix of OSError and RuntimeError + # so we have to pick which one to raise. + # and we raise OSError for compatibility + raise OSError(msg) + finally: + all_exceptions = None # type: ignore[assignment] + exceptions = None # type: ignore[assignment] + + return sock + + +async def _connect_sock( + loop: asyncio.AbstractEventLoop, + exceptions: List[List[Union[OSError, RuntimeError]]], + addr_info: AddrInfoType, + local_addr_infos: Optional[Sequence[AddrInfoType]] = None, + open_sockets: Optional[Set[socket.socket]] = None, + socket_factory: Optional[SocketFactoryType] = None, +) -> socket.socket: + """ + Create, bind and connect one socket. + + If open_sockets is passed, add the socket to the set of open sockets. + Any failure caught here will remove the socket from the set and close it. + + Callers can use this set to close any sockets that are not the winner + of all staggered tasks in the result there are runner up sockets aka + multiple winners. + """ + my_exceptions: List[Union[OSError, RuntimeError]] = [] + exceptions.append(my_exceptions) + family, type_, proto, _, address = addr_info + sock = None + try: + if socket_factory is not None: + sock = socket_factory(addr_info) + else: + sock = socket.socket(family=family, type=type_, proto=proto) + if open_sockets is not None: + open_sockets.add(sock) + sock.setblocking(False) + if local_addr_infos is not None: + for lfamily, _, _, _, laddr in local_addr_infos: + # skip local addresses of different family + if lfamily != family: + continue + try: + sock.bind(laddr) + break + except OSError as exc: + msg = ( + f"error while attempting to bind on " + f"address {laddr!r}: " + f"{(exc.strerror or '').lower()}" + ) + exc = OSError(exc.errno, msg) + my_exceptions.append(exc) + else: # all bind attempts failed + if my_exceptions: + raise my_exceptions.pop() + else: + raise OSError(f"no matching local address with {family=} found") + await loop.sock_connect(sock, address) + return sock + except (RuntimeError, OSError) as exc: + my_exceptions.append(exc) + if sock is not None: + if open_sockets is not None: + open_sockets.remove(sock) + try: + sock.close() + except OSError as e: + my_exceptions.append(e) + raise + raise + except: + if sock is not None: + if open_sockets is not None: + open_sockets.remove(sock) + try: + sock.close() + except OSError as e: + my_exceptions.append(e) + raise + raise + finally: + exceptions = my_exceptions = None # type: ignore[assignment] + + +def _interleave_addrinfos( + addrinfos: Sequence[AddrInfoType], first_address_family_count: int = 1 +) -> List[AddrInfoType]: + """Interleave list of addrinfo tuples by family.""" + # Group addresses by family + addrinfos_by_family: collections.OrderedDict[int, List[AddrInfoType]] = ( + collections.OrderedDict() + ) + for addr in addrinfos: + family = addr[0] + if family not in addrinfos_by_family: + addrinfos_by_family[family] = [] + addrinfos_by_family[family].append(addr) + addrinfos_lists = list(addrinfos_by_family.values()) + + reordered: List[AddrInfoType] = [] + if first_address_family_count > 1: + reordered.extend(addrinfos_lists[0][: first_address_family_count - 1]) + del addrinfos_lists[0][: first_address_family_count - 1] + reordered.extend( + a + for a in itertools.chain.from_iterable(itertools.zip_longest(*addrinfos_lists)) + if a is not None + ) + return reordered diff --git a/contrib/python/aiohappyeyeballs/aiohappyeyeballs/py.typed b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/py.typed new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/contrib/python/aiohappyeyeballs/aiohappyeyeballs/types.py b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/types.py new file mode 100644 index 000000000000..e8c75074e7ab --- /dev/null +++ b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/types.py @@ -0,0 +1,17 @@ +"""Types for aiohappyeyeballs.""" + +import socket + +# PY3.9: Import Callable from typing until we drop Python 3.9 support +# https://github.com/python/cpython/issues/87131 +from typing import Callable, Tuple, Union + +AddrInfoType = Tuple[ + Union[int, socket.AddressFamily], + Union[int, socket.SocketKind], + int, + str, + Tuple, # type: ignore[type-arg] +] + +SocketFactoryType = Callable[[AddrInfoType], socket.socket] diff --git a/contrib/python/aiohappyeyeballs/aiohappyeyeballs/utils.py b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/utils.py new file mode 100644 index 000000000000..ea29adb9be9e --- /dev/null +++ b/contrib/python/aiohappyeyeballs/aiohappyeyeballs/utils.py @@ -0,0 +1,97 @@ +"""Utility functions for aiohappyeyeballs.""" + +import ipaddress +import socket +from typing import Dict, List, Optional, Tuple, Union + +from .types import AddrInfoType + + +def addr_to_addr_infos( + addr: Optional[ + Union[Tuple[str, int, int, int], Tuple[str, int, int], Tuple[str, int]] + ], +) -> Optional[List[AddrInfoType]]: + """Convert an address tuple to a list of addr_info tuples.""" + if addr is None: + return None + host = addr[0] + port = addr[1] + is_ipv6 = ":" in host + if is_ipv6: + flowinfo = 0 + scopeid = 0 + addr_len = len(addr) + if addr_len >= 4: + scopeid = addr[3] # type: ignore[misc] + if addr_len >= 3: + flowinfo = addr[2] # type: ignore[misc] + addr = (host, port, flowinfo, scopeid) + family = socket.AF_INET6 + else: + addr = (host, port) + family = socket.AF_INET + return [(family, socket.SOCK_STREAM, socket.IPPROTO_TCP, "", addr)] + + +def pop_addr_infos_interleave( + addr_infos: List[AddrInfoType], interleave: Optional[int] = None +) -> None: + """ + Pop addr_info from the list of addr_infos by family up to interleave times. + + The interleave parameter is used to know how many addr_infos for + each family should be popped of the top of the list. + """ + seen: Dict[int, int] = {} + if interleave is None: + interleave = 1 + to_remove: List[AddrInfoType] = [] + for addr_info in addr_infos: + family = addr_info[0] + if family not in seen: + seen[family] = 0 + if seen[family] < interleave: + to_remove.append(addr_info) + seen[family] += 1 + for addr_info in to_remove: + addr_infos.remove(addr_info) + + +def _addr_tuple_to_ip_address( + addr: Union[Tuple[str, int], Tuple[str, int, int, int]], +) -> Union[ + Tuple[ipaddress.IPv4Address, int], Tuple[ipaddress.IPv6Address, int, int, int] +]: + """Convert an address tuple to an IPv4Address.""" + return (ipaddress.ip_address(addr[0]), *addr[1:]) + + +def remove_addr_infos( + addr_infos: List[AddrInfoType], + addr: Union[Tuple[str, int], Tuple[str, int, int, int]], +) -> None: + """ + Remove an address from the list of addr_infos. + + The addr value is typically the return value of + sock.getpeername(). + """ + bad_addrs_infos: List[AddrInfoType] = [] + for addr_info in addr_infos: + if addr_info[-1] == addr: + bad_addrs_infos.append(addr_info) + if bad_addrs_infos: + for bad_addr_info in bad_addrs_infos: + addr_infos.remove(bad_addr_info) + return + # Slow path in case addr is formatted differently + match_addr = _addr_tuple_to_ip_address(addr) + for addr_info in addr_infos: + if match_addr == _addr_tuple_to_ip_address(addr_info[-1]): + bad_addrs_infos.append(addr_info) + if bad_addrs_infos: + for bad_addr_info in bad_addrs_infos: + addr_infos.remove(bad_addr_info) + return + raise ValueError(f"Address {addr} not found in addr_infos") diff --git a/contrib/python/aiohappyeyeballs/ya.make b/contrib/python/aiohappyeyeballs/ya.make new file mode 100644 index 000000000000..55dc6c9940ef --- /dev/null +++ b/contrib/python/aiohappyeyeballs/ya.make @@ -0,0 +1,26 @@ +# Generated by devtools/yamaker (pypi). + +PY3_LIBRARY() + +VERSION(2.6.1) + +LICENSE(Python-2.0) + +NO_LINT() + +PY_SRCS( + TOP_LEVEL + aiohappyeyeballs/__init__.py + aiohappyeyeballs/_staggered.py + aiohappyeyeballs/impl.py + aiohappyeyeballs/types.py + aiohappyeyeballs/utils.py +) + +RESOURCE_FILES( + PREFIX contrib/python/aiohappyeyeballs/ + .dist-info/METADATA + aiohappyeyeballs/py.typed +) + +END() diff --git a/contrib/python/aiohttp/.dist-info/METADATA b/contrib/python/aiohttp/.dist-info/METADATA index cd3126491368..7ad8cef0fd3b 100644 --- a/contrib/python/aiohttp/.dist-info/METADATA +++ b/contrib/python/aiohttp/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: aiohttp -Version: 3.9.5 +Version: 3.10.6 Summary: Async http client/server framework (asyncio) Home-page: https://github.com/aio-libs/aiohttp Maintainer: aiohttp team @@ -28,20 +28,22 @@ Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 Classifier: Topic :: Internet :: WWW/HTTP Requires-Python: >=3.8 Description-Content-Type: text/x-rst License-File: LICENSE.txt +Requires-Dist: aiohappyeyeballs >=2.3.0 Requires-Dist: aiosignal >=1.1.2 Requires-Dist: attrs >=17.3.0 Requires-Dist: frozenlist >=1.1.1 Requires-Dist: multidict <7.0,>=4.5 -Requires-Dist: yarl <2.0,>=1.0 +Requires-Dist: yarl <2.0,>=1.12.0 Requires-Dist: async-timeout <5.0,>=4.0 ; python_version < "3.11" Provides-Extra: speedups Requires-Dist: brotlicffi ; (platform_python_implementation != "CPython") and extra == 'speedups' Requires-Dist: Brotli ; (platform_python_implementation == "CPython") and extra == 'speedups' -Requires-Dist: aiodns ; (sys_platform == "linux" or sys_platform == "darwin") and extra == 'speedups' +Requires-Dist: aiodns >=3.2.0 ; (sys_platform == "linux" or sys_platform == "darwin") and extra == 'speedups' ================================== Async http client/server framework @@ -193,7 +195,7 @@ Communication channels *aio-libs Discussions*: https://github.com/aio-libs/aiohttp/discussions -*gitter chat* https://gitter.im/aio-libs/Lobby +*Matrix*: `#aio-libs:matrix.org `_ We support `Stack Overflow `_. @@ -202,7 +204,6 @@ Please add *aiohttp* tag to your question there. Requirements ============ -- async-timeout_ - attrs_ - multidict_ - yarl_ diff --git a/contrib/python/aiohttp/README.rst b/contrib/python/aiohttp/README.rst index 90b7f713577e..470ced9b29cb 100644 --- a/contrib/python/aiohttp/README.rst +++ b/contrib/python/aiohttp/README.rst @@ -148,7 +148,7 @@ Communication channels *aio-libs Discussions*: https://github.com/aio-libs/aiohttp/discussions -*gitter chat* https://gitter.im/aio-libs/Lobby +*Matrix*: `#aio-libs:matrix.org `_ We support `Stack Overflow `_. @@ -157,7 +157,6 @@ Please add *aiohttp* tag to your question there. Requirements ============ -- async-timeout_ - attrs_ - multidict_ - yarl_ diff --git a/contrib/python/aiohttp/aiohttp/__init__.py b/contrib/python/aiohttp/aiohttp/__init__.py index e82e790b46af..8830d3409401 100644 --- a/contrib/python/aiohttp/aiohttp/__init__.py +++ b/contrib/python/aiohttp/aiohttp/__init__.py @@ -1,40 +1,48 @@ -__version__ = "3.9.5" +__version__ = "3.10.6" from typing import TYPE_CHECKING, Tuple from . import hdrs as hdrs from .client import ( - BaseConnector as BaseConnector, - ClientConnectionError as ClientConnectionError, - ClientConnectorCertificateError as ClientConnectorCertificateError, - ClientConnectorError as ClientConnectorError, - ClientConnectorSSLError as ClientConnectorSSLError, - ClientError as ClientError, - ClientHttpProxyError as ClientHttpProxyError, - ClientOSError as ClientOSError, - ClientPayloadError as ClientPayloadError, - ClientProxyConnectionError as ClientProxyConnectionError, - ClientRequest as ClientRequest, - ClientResponse as ClientResponse, - ClientResponseError as ClientResponseError, - ClientSession as ClientSession, - ClientSSLError as ClientSSLError, - ClientTimeout as ClientTimeout, - ClientWebSocketResponse as ClientWebSocketResponse, - ContentTypeError as ContentTypeError, - Fingerprint as Fingerprint, - InvalidURL as InvalidURL, - NamedPipeConnector as NamedPipeConnector, - RequestInfo as RequestInfo, - ServerConnectionError as ServerConnectionError, - ServerDisconnectedError as ServerDisconnectedError, - ServerFingerprintMismatch as ServerFingerprintMismatch, - ServerTimeoutError as ServerTimeoutError, - TCPConnector as TCPConnector, - TooManyRedirects as TooManyRedirects, - UnixConnector as UnixConnector, - WSServerHandshakeError as WSServerHandshakeError, - request as request, + BaseConnector, + ClientConnectionError, + ClientConnectionResetError, + ClientConnectorCertificateError, + ClientConnectorError, + ClientConnectorSSLError, + ClientError, + ClientHttpProxyError, + ClientOSError, + ClientPayloadError, + ClientProxyConnectionError, + ClientRequest, + ClientResponse, + ClientResponseError, + ClientSession, + ClientSSLError, + ClientTimeout, + ClientWebSocketResponse, + ConnectionTimeoutError, + ContentTypeError, + Fingerprint, + InvalidURL, + InvalidUrlClientError, + InvalidUrlRedirectClientError, + NamedPipeConnector, + NonHttpUrlClientError, + NonHttpUrlRedirectClientError, + RedirectClientError, + RequestInfo, + ServerConnectionError, + ServerDisconnectedError, + ServerFingerprintMismatch, + ServerTimeoutError, + SocketTimeoutError, + TCPConnector, + TooManyRedirects, + UnixConnector, + WSServerHandshakeError, + request, ) from .cookiejar import CookieJar as CookieJar, DummyCookieJar as DummyCookieJar from .formdata import FormData as FormData @@ -99,6 +107,7 @@ TraceRequestChunkSentParams as TraceRequestChunkSentParams, TraceRequestEndParams as TraceRequestEndParams, TraceRequestExceptionParams as TraceRequestExceptionParams, + TraceRequestHeadersSentParams as TraceRequestHeadersSentParams, TraceRequestRedirectParams as TraceRequestRedirectParams, TraceRequestStartParams as TraceRequestStartParams, TraceResponseChunkReceivedParams as TraceResponseChunkReceivedParams, @@ -116,6 +125,7 @@ # client "BaseConnector", "ClientConnectionError", + "ClientConnectionResetError", "ClientConnectorCertificateError", "ClientConnectorError", "ClientConnectorSSLError", @@ -131,14 +141,21 @@ "ClientSession", "ClientTimeout", "ClientWebSocketResponse", + "ConnectionTimeoutError", "ContentTypeError", "Fingerprint", "InvalidURL", + "InvalidUrlClientError", + "InvalidUrlRedirectClientError", + "NonHttpUrlClientError", + "NonHttpUrlRedirectClientError", + "RedirectClientError", "RequestInfo", "ServerConnectionError", "ServerDisconnectedError", "ServerFingerprintMismatch", "ServerTimeoutError", + "SocketTimeoutError", "TCPConnector", "TooManyRedirects", "UnixConnector", @@ -210,6 +227,7 @@ "TraceRequestChunkSentParams", "TraceRequestEndParams", "TraceRequestExceptionParams", + "TraceRequestHeadersSentParams", "TraceRequestRedirectParams", "TraceRequestStartParams", "TraceResponseChunkReceivedParams", diff --git a/contrib/python/aiohttp/aiohttp/_helpers.pyx b/contrib/python/aiohttp/aiohttp/_helpers.pyx index 665f367c5dec..5f089225dc85 100644 --- a/contrib/python/aiohttp/aiohttp/_helpers.pyx +++ b/contrib/python/aiohttp/aiohttp/_helpers.pyx @@ -1,3 +1,6 @@ + +cdef _sentinel = object() + cdef class reify: """Use as a class method decorator. It operates almost exactly like the Python `@property` decorator, but it puts the result of the @@ -19,17 +22,14 @@ cdef class reify: return self.wrapped.__doc__ def __get__(self, inst, owner): - try: - try: - return inst._cache[self.name] - except KeyError: - val = self.wrapped(inst) - inst._cache[self.name] = val - return val - except AttributeError: - if inst is None: - return self - raise + if inst is None: + return self + cdef dict cache = inst._cache + val = cache.get(self.name, _sentinel) + if val is _sentinel: + val = self.wrapped(inst) + cache[self.name] = val + return val def __set__(self, inst, value): raise AttributeError("reified property is read-only") diff --git a/contrib/python/aiohttp/aiohttp/_http_parser.pyx b/contrib/python/aiohttp/aiohttp/_http_parser.pyx index ec6edb2dfec9..8e82c0fd77f2 100644 --- a/contrib/python/aiohttp/aiohttp/_http_parser.pyx +++ b/contrib/python/aiohttp/aiohttp/_http_parser.pyx @@ -47,6 +47,7 @@ include "_headers.pxi" from aiohttp cimport _find_header +ALLOWED_UPGRADES = frozenset({"websocket"}) DEF DEFAULT_FREELIST_SIZE = 250 cdef extern from "Python.h": @@ -417,7 +418,6 @@ cdef class HttpParser: cdef _on_headers_complete(self): self._process_header() - method = http_method_str(self._cparser.method) should_close = not cparser.llhttp_should_keep_alive(self._cparser) upgrade = self._cparser.upgrade chunked = self._cparser.flags & cparser.F_CHUNKED @@ -425,8 +425,13 @@ cdef class HttpParser: raw_headers = tuple(self._raw_headers) headers = CIMultiDictProxy(self._headers) - if upgrade or self._cparser.method == cparser.HTTP_CONNECT: - self._upgraded = True + if self._cparser.type == cparser.HTTP_REQUEST: + allowed = upgrade and headers.get("upgrade", "").lower() in ALLOWED_UPGRADES + if allowed or self._cparser.method == cparser.HTTP_CONNECT: + self._upgraded = True + else: + if upgrade and self._cparser.status_code == 101: + self._upgraded = True # do not support old websocket spec if SEC_WEBSOCKET_KEY1 in headers: @@ -441,6 +446,7 @@ cdef class HttpParser: encoding = enc if self._cparser.type == cparser.HTTP_REQUEST: + method = http_method_str(self._cparser.method) msg = _new_request_message( method, self._path, self.http_version(), headers, raw_headers, @@ -565,7 +571,7 @@ cdef class HttpParser: if self._upgraded: return messages, True, data[nb:] else: - return messages, False, b'' + return messages, False, b"" def set_upgraded(self, val): self._upgraded = val @@ -748,10 +754,7 @@ cdef int cb_on_headers_complete(cparser.llhttp_t* parser) except -1: pyparser._last_error = exc return -1 else: - if ( - pyparser._cparser.upgrade or - pyparser._cparser.method == cparser.HTTP_CONNECT - ): + if pyparser._upgraded or pyparser._cparser.method == cparser.HTTP_CONNECT: return 2 else: return 0 diff --git a/contrib/python/aiohttp/aiohttp/abc.py b/contrib/python/aiohttp/aiohttp/abc.py index ee838998997e..b309bcffe019 100644 --- a/contrib/python/aiohttp/aiohttp/abc.py +++ b/contrib/python/aiohttp/aiohttp/abc.py @@ -1,5 +1,6 @@ import asyncio import logging +import socket from abc import ABC, abstractmethod from collections.abc import Sized from http.cookies import BaseCookie, Morsel @@ -14,12 +15,12 @@ List, Optional, Tuple, + TypedDict, ) from multidict import CIMultiDict from yarl import URL -from .helpers import get_running_loop from .typedefs import LooseCookies if TYPE_CHECKING: @@ -119,11 +120,35 @@ def __await__(self) -> Generator[Any, None, StreamResponse]: """Execute the view handler.""" +class ResolveResult(TypedDict): + """Resolve result. + + This is the result returned from an AbstractResolver's + resolve method. + + :param hostname: The hostname that was provided. + :param host: The IP address that was resolved. + :param port: The port that was resolved. + :param family: The address family that was resolved. + :param proto: The protocol that was resolved. + :param flags: The flags that were resolved. + """ + + hostname: str + host: str + port: int + family: int + proto: int + flags: int + + class AbstractResolver(ABC): """Abstract DNS resolver.""" @abstractmethod - async def resolve(self, host: str, port: int, family: int) -> List[Dict[str, Any]]: + async def resolve( + self, host: str, port: int = 0, family: socket.AddressFamily = socket.AF_INET + ) -> List[ResolveResult]: """Return IP address for given hostname""" @abstractmethod @@ -144,7 +169,7 @@ class AbstractCookieJar(Sized, IterableBase): """Abstract Cookie Jar.""" def __init__(self, *, loop: Optional[asyncio.AbstractEventLoop] = None) -> None: - self._loop = get_running_loop(loop) + self._loop = loop or asyncio.get_event_loop() @abstractmethod def clear(self, predicate: Optional[ClearCookiePredicate] = None) -> None: diff --git a/contrib/python/aiohttp/aiohttp/base_protocol.py b/contrib/python/aiohttp/aiohttp/base_protocol.py index dc1f24f99cd2..2fc2fa658856 100644 --- a/contrib/python/aiohttp/aiohttp/base_protocol.py +++ b/contrib/python/aiohttp/aiohttp/base_protocol.py @@ -1,6 +1,7 @@ import asyncio from typing import Optional, cast +from .client_exceptions import ClientConnectionResetError from .helpers import set_exception from .tcp_helpers import tcp_nodelay @@ -85,7 +86,7 @@ def connection_lost(self, exc: Optional[BaseException]) -> None: async def _drain_helper(self) -> None: if not self.connected: - raise ConnectionResetError("Connection lost") + raise ClientConnectionResetError("Connection lost") if not self._paused: return waiter = self._drain_waiter diff --git a/contrib/python/aiohttp/aiohttp/client.py b/contrib/python/aiohttp/aiohttp/client.py index 32d2c3b71195..186105bee9f5 100644 --- a/contrib/python/aiohttp/aiohttp/client.py +++ b/contrib/python/aiohttp/aiohttp/client.py @@ -9,7 +9,7 @@ import traceback import warnings from contextlib import suppress -from types import SimpleNamespace, TracebackType +from types import TracebackType from typing import ( TYPE_CHECKING, Any, @@ -27,6 +27,7 @@ Set, Tuple, Type, + TypedDict, TypeVar, Union, ) @@ -38,25 +39,33 @@ from . import hdrs, http, payload from .abc import AbstractCookieJar from .client_exceptions import ( - ClientConnectionError as ClientConnectionError, - ClientConnectorCertificateError as ClientConnectorCertificateError, - ClientConnectorError as ClientConnectorError, - ClientConnectorSSLError as ClientConnectorSSLError, - ClientError as ClientError, - ClientHttpProxyError as ClientHttpProxyError, - ClientOSError as ClientOSError, - ClientPayloadError as ClientPayloadError, - ClientProxyConnectionError as ClientProxyConnectionError, - ClientResponseError as ClientResponseError, - ClientSSLError as ClientSSLError, - ContentTypeError as ContentTypeError, - InvalidURL as InvalidURL, - ServerConnectionError as ServerConnectionError, - ServerDisconnectedError as ServerDisconnectedError, - ServerFingerprintMismatch as ServerFingerprintMismatch, - ServerTimeoutError as ServerTimeoutError, - TooManyRedirects as TooManyRedirects, - WSServerHandshakeError as WSServerHandshakeError, + ClientConnectionError, + ClientConnectionResetError, + ClientConnectorCertificateError, + ClientConnectorError, + ClientConnectorSSLError, + ClientError, + ClientHttpProxyError, + ClientOSError, + ClientPayloadError, + ClientProxyConnectionError, + ClientResponseError, + ClientSSLError, + ConnectionTimeoutError, + ContentTypeError, + InvalidURL, + InvalidUrlClientError, + InvalidUrlRedirectClientError, + NonHttpUrlClientError, + NonHttpUrlRedirectClientError, + RedirectClientError, + ServerConnectionError, + ServerDisconnectedError, + ServerFingerprintMismatch, + ServerTimeoutError, + SocketTimeoutError, + TooManyRedirects, + WSServerHandshakeError, ) from .client_reqrep import ( ClientRequest as ClientRequest, @@ -67,6 +76,7 @@ ) from .client_ws import ClientWebSocketResponse as ClientWebSocketResponse from .connector import ( + HTTP_AND_EMPTY_SCHEMA_SET, BaseConnector as BaseConnector, NamedPipeConnector as NamedPipeConnector, TCPConnector as TCPConnector, @@ -80,7 +90,6 @@ TimeoutHandle, ceil_timeout, get_env_proxy_for_url, - get_running_loop, method_must_be_empty_body, sentinel, strip_auth_from_url, @@ -89,11 +98,12 @@ from .http_websocket import WSHandshakeError, WSMessage, ws_ext_gen, ws_ext_parse from .streams import FlowControlDataQueue from .tracing import Trace, TraceConfig -from .typedefs import JSONEncoder, LooseCookies, LooseHeaders, StrOrURL +from .typedefs import JSONEncoder, LooseCookies, LooseHeaders, Query, StrOrURL __all__ = ( # client_exceptions "ClientConnectionError", + "ClientConnectionResetError", "ClientConnectorCertificateError", "ClientConnectorError", "ClientConnectorSSLError", @@ -104,12 +114,19 @@ "ClientProxyConnectionError", "ClientResponseError", "ClientSSLError", + "ConnectionTimeoutError", "ContentTypeError", "InvalidURL", + "InvalidUrlClientError", + "RedirectClientError", + "NonHttpUrlClientError", + "InvalidUrlRedirectClientError", + "NonHttpUrlRedirectClientError", "ServerConnectionError", "ServerDisconnectedError", "ServerFingerprintMismatch", "ServerTimeoutError", + "SocketTimeoutError", "TooManyRedirects", "WSServerHandshakeError", # client_reqrep @@ -136,6 +153,37 @@ else: SSLContext = None +if sys.version_info >= (3, 11) and TYPE_CHECKING: + from typing import Unpack + + +class _RequestOptions(TypedDict, total=False): + params: Query + data: Any + json: Any + cookies: Union[LooseCookies, None] + headers: Union[LooseHeaders, None] + skip_auto_headers: Union[Iterable[str], None] + auth: Union[BasicAuth, None] + allow_redirects: bool + max_redirects: int + compress: Union[str, bool, None] + chunked: Union[bool, None] + expect100: bool + raise_for_status: Union[None, bool, Callable[[ClientResponse], Awaitable[None]]] + read_until_eof: bool + proxy: Union[StrOrURL, None] + proxy_auth: Union[BasicAuth, None] + timeout: "Union[ClientTimeout, _SENTINEL, int, float, None]" + ssl: Union[SSLContext, bool, Fingerprint] + server_hostname: Union[str, None] + proxy_headers: Union[LooseHeaders, None] + trace_request_ctx: Any #Union[Mapping[str, str], None] + read_bufsize: Union[int, None] + auto_decompress: Union[bool, None] + max_line_size: Union[int, None] + max_field_size: Union[int, None] + @attr.s(auto_attribs=True, frozen=True, slots=True) class ClientTimeout: @@ -162,7 +210,10 @@ class ClientTimeout: # 5 Minute default read timeout DEFAULT_TIMEOUT: Final[ClientTimeout] = ClientTimeout(total=5 * 60) -_RetType = TypeVar("_RetType") +# https://www.rfc-editor.org/rfc/rfc9110#section-9.2.2 +IDEMPOTENT_METHODS = frozenset({"GET", "HEAD", "OPTIONS", "TRACE", "PUT", "DELETE"}) + +_RetType = TypeVar("_RetType", ClientResponse, ClientWebSocketResponse) _CharsetResolver = Callable[[ClientResponse, bytes], str] @@ -237,6 +288,21 @@ def __init__( # We initialise _connector to None immediately, as it's referenced in __del__() # and could cause issues if an exception occurs during initialisation. self._connector: Optional[BaseConnector] = None + + if loop is None: + if connector is not None: + loop = connector._loop + + loop = loop or asyncio.get_event_loop() + + if base_url is None or isinstance(base_url, URL): + self._base_url: Optional[URL] = base_url + else: + self._base_url = URL(base_url) + assert ( + self._base_url.origin() == self._base_url + ), "Only absolute URLs without path part are supported" + if timeout is sentinel or timeout is None: self._timeout = DEFAULT_TIMEOUT if read_timeout is not sentinel: @@ -272,19 +338,6 @@ def __init__( "conflict, please setup " "timeout.connect" ) - if loop is None: - if connector is not None: - loop = connector._loop - - loop = get_running_loop(loop) - - if base_url is None or isinstance(base_url, URL): - self._base_url: Optional[URL] = base_url - else: - self._base_url = URL(base_url) - assert ( - self._base_url.origin() == self._base_url - ), "Only absolute URLs without path part are supported" if connector is None: connector = TCPConnector(loop=loop) @@ -369,11 +422,22 @@ def __del__(self, _warnings: Any = warnings) -> None: context["source_traceback"] = self._source_traceback self._loop.call_exception_handler(context) - def request( - self, method: str, url: StrOrURL, **kwargs: Any - ) -> "_RequestContextManager": - """Perform HTTP request.""" - return _RequestContextManager(self._request(method, url, **kwargs)) + if sys.version_info >= (3, 11) and TYPE_CHECKING: + + def request( + self, + method: str, + url: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> "_RequestContextManager": ... + + else: + + def request( + self, method: str, url: StrOrURL, **kwargs: Any + ) -> "_RequestContextManager": + """Perform HTTP request.""" + return _RequestContextManager(self._request(method, url, **kwargs)) def _build_url(self, str_or_url: StrOrURL) -> URL: url = URL(str_or_url) @@ -388,7 +452,7 @@ async def _request( method: str, str_or_url: StrOrURL, *, - params: Optional[Mapping[str, str]] = None, + params: Query = None, data: Any = None, json: Any = None, cookies: Optional[LooseCookies] = None, @@ -397,7 +461,7 @@ async def _request( auth: Optional[BasicAuth] = None, allow_redirects: bool = True, max_redirects: int = 10, - compress: Optional[str] = None, + compress: Union[str, bool, None] = None, chunked: Optional[bool] = None, expect100: bool = False, raise_for_status: Union[ @@ -413,7 +477,7 @@ async def _request( ssl: Union[SSLContext, bool, Fingerprint] = True, server_hostname: Optional[str] = None, proxy_headers: Optional[LooseHeaders] = None, - trace_request_ctx: Optional[SimpleNamespace] = None, + trace_request_ctx: Optional[Mapping[str, str]] = None, read_bufsize: Optional[int] = None, auto_decompress: Optional[bool] = None, max_line_size: Optional[int] = None, @@ -451,7 +515,11 @@ async def _request( try: url = self._build_url(str_or_url) except ValueError as e: - raise InvalidURL(str_or_url) from e + raise InvalidUrlClientError(str_or_url) from e + + assert self._connector is not None + if url.scheme not in self._connector.allowed_protocol_schema_set: + raise NonHttpUrlClientError(url) skip_headers = set(self._skip_auto_headers) if skip_auto_headers is not None: @@ -505,8 +573,19 @@ async def _request( timer = tm.timer() try: with timer: + # https://www.rfc-editor.org/rfc/rfc9112.html#name-retrying-requests + retry_persistent_connection = False #method in IDEMPOTENT_METHODS while True: url, auth_from_url = strip_auth_from_url(url) + if not url.raw_host: + # NOTE: Bail early, otherwise, causes `InvalidURL` through + # NOTE: `self._request_class()` below. + err_exc_cls = ( + InvalidUrlRedirectClientError + if redirects + else InvalidUrlClientError + ) + raise err_exc_cls(url) if auth and auth_from_url: raise ValueError( "Cannot combine AUTH argument with " @@ -550,7 +629,7 @@ async def _request( url, params=params, headers=headers, - skip_auto_headers=skip_headers, + skip_auto_headers=skip_headers if skip_headers else None, data=data, cookies=all_cookies, auth=auth, @@ -577,13 +656,12 @@ async def _request( real_timeout.connect, ceil_threshold=real_timeout.ceil_threshold, ): - assert self._connector is not None conn = await self._connector.connect( req, traces=traces, timeout=real_timeout ) except asyncio.TimeoutError as exc: - raise ServerTimeoutError( - "Connection timeout " "to host {}".format(url) + raise ConnectionTimeoutError( + f"Connection timeout to host {url}" ) from exc assert conn.transport is not None @@ -612,6 +690,11 @@ async def _request( except BaseException: conn.close() raise + except (ClientOSError, ServerDisconnectedError): + if retry_persistent_connection: + retry_persistent_connection = False + continue + raise except ClientError: raise except OSError as exc: @@ -659,25 +742,35 @@ async def _request( resp.release() try: - parsed_url = URL( + parsed_redirect_url = URL( r_url, encoded=not self._requote_redirect_url ) - except ValueError as e: - raise InvalidURL(r_url) from e + raise InvalidUrlRedirectClientError( + r_url, + "Server attempted redirecting to a location that does not look like a URL", + ) from e - scheme = parsed_url.scheme - if scheme not in ("http", "https", ""): + scheme = parsed_redirect_url.scheme + if scheme not in HTTP_AND_EMPTY_SCHEMA_SET: resp.close() - raise ValueError("Can redirect only to http or https") + raise NonHttpUrlRedirectClientError(r_url) elif not scheme: - parsed_url = url.join(parsed_url) + parsed_redirect_url = url.join(parsed_redirect_url) - if url.origin() != parsed_url.origin(): + try: + redirect_origin = parsed_redirect_url.origin() + except ValueError as origin_val_err: + raise InvalidUrlRedirectClientError( + parsed_redirect_url, + "Invalid redirect URL origin", + ) from origin_val_err + + if url.origin() != redirect_origin: auth = None headers.pop(hdrs.AUTHORIZATION, None) - url = parsed_url + url = parsed_redirect_url params = {} resp.release() continue @@ -736,11 +829,11 @@ def ws_connect( heartbeat: Optional[float] = None, auth: Optional[BasicAuth] = None, origin: Optional[str] = None, - params: Optional[Mapping[str, str]] = None, + params: Query = None, headers: Optional[LooseHeaders] = None, proxy: Optional[StrOrURL] = None, proxy_auth: Optional[BasicAuth] = None, - ssl: Union[SSLContext, bool, None, Fingerprint] = True, + ssl: Union[SSLContext, bool, Fingerprint] = True, verify_ssl: Optional[bool] = None, fingerprint: Optional[bytes] = None, ssl_context: Optional[SSLContext] = None, @@ -788,11 +881,11 @@ async def _ws_connect( heartbeat: Optional[float] = None, auth: Optional[BasicAuth] = None, origin: Optional[str] = None, - params: Optional[Mapping[str, str]] = None, + params: Query = None, headers: Optional[LooseHeaders] = None, proxy: Optional[StrOrURL] = None, proxy_auth: Optional[BasicAuth] = None, - ssl: Optional[Union[SSLContext, bool, Fingerprint]] = True, + ssl: Union[SSLContext, bool, Fingerprint] = True, verify_ssl: Optional[bool] = None, fingerprint: Optional[bytes] = None, ssl_context: Optional[SSLContext] = None, @@ -828,6 +921,11 @@ async def _ws_connect( # For the sake of backward compatibility, if user passes in None, convert it to True if ssl is None: + warnings.warn( + "ssl=None is deprecated, please use ssl=True", + DeprecationWarning, + stacklevel=2, + ) ssl = True ssl = _merge_ssl_params(ssl, verify_ssl, ssl_context, fingerprint) @@ -922,6 +1020,16 @@ async def _ws_connect( assert conn is not None conn_proto = conn.protocol assert conn_proto is not None + + # For WS connection the read_timeout must be either receive_timeout or greater + # None == no timeout, i.e. infinite timeout, so None is the max timeout possible + if receive_timeout is None: + # Reset regardless + conn_proto.read_timeout = receive_timeout + elif conn_proto.read_timeout is not None: + # If read_timeout was set check which wins + conn_proto.read_timeout = max(receive_timeout, conn_proto.read_timeout) + transport = conn.transport assert transport is not None reader: FlowControlDataQueue[WSMessage] = FlowControlDataQueue( @@ -970,61 +1078,111 @@ def _prepare_headers(self, headers: Optional[LooseHeaders]) -> "CIMultiDict[str] added_names.add(key) return result - def get( - self, url: StrOrURL, *, allow_redirects: bool = True, **kwargs: Any - ) -> "_RequestContextManager": - """Perform HTTP GET request.""" - return _RequestContextManager( - self._request(hdrs.METH_GET, url, allow_redirects=allow_redirects, **kwargs) - ) + if sys.version_info >= (3, 11) and TYPE_CHECKING: + + def get( + self, + url: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> "_RequestContextManager": ... + + def options( + self, + url: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> "_RequestContextManager": ... + + def head( + self, + url: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> "_RequestContextManager": ... + + def post( + self, + url: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> "_RequestContextManager": ... + + def put( + self, + url: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> "_RequestContextManager": ... + + def patch( + self, + url: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> "_RequestContextManager": ... + + def delete( + self, + url: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> "_RequestContextManager": ... + + else: + + def get( + self, url: StrOrURL, *, allow_redirects: bool = True, **kwargs: Any + ) -> "_RequestContextManager": + """Perform HTTP GET request.""" + return _RequestContextManager( + self._request( + hdrs.METH_GET, url, allow_redirects=allow_redirects, **kwargs + ) + ) - def options( - self, url: StrOrURL, *, allow_redirects: bool = True, **kwargs: Any - ) -> "_RequestContextManager": - """Perform HTTP OPTIONS request.""" - return _RequestContextManager( - self._request( - hdrs.METH_OPTIONS, url, allow_redirects=allow_redirects, **kwargs + def options( + self, url: StrOrURL, *, allow_redirects: bool = True, **kwargs: Any + ) -> "_RequestContextManager": + """Perform HTTP OPTIONS request.""" + return _RequestContextManager( + self._request( + hdrs.METH_OPTIONS, url, allow_redirects=allow_redirects, **kwargs + ) ) - ) - def head( - self, url: StrOrURL, *, allow_redirects: bool = False, **kwargs: Any - ) -> "_RequestContextManager": - """Perform HTTP HEAD request.""" - return _RequestContextManager( - self._request( - hdrs.METH_HEAD, url, allow_redirects=allow_redirects, **kwargs + def head( + self, url: StrOrURL, *, allow_redirects: bool = False, **kwargs: Any + ) -> "_RequestContextManager": + """Perform HTTP HEAD request.""" + return _RequestContextManager( + self._request( + hdrs.METH_HEAD, url, allow_redirects=allow_redirects, **kwargs + ) ) - ) - def post( - self, url: StrOrURL, *, data: Any = None, **kwargs: Any - ) -> "_RequestContextManager": - """Perform HTTP POST request.""" - return _RequestContextManager( - self._request(hdrs.METH_POST, url, data=data, **kwargs) - ) + def post( + self, url: StrOrURL, *, data: Any = None, **kwargs: Any + ) -> "_RequestContextManager": + """Perform HTTP POST request.""" + return _RequestContextManager( + self._request(hdrs.METH_POST, url, data=data, **kwargs) + ) - def put( - self, url: StrOrURL, *, data: Any = None, **kwargs: Any - ) -> "_RequestContextManager": - """Perform HTTP PUT request.""" - return _RequestContextManager( - self._request(hdrs.METH_PUT, url, data=data, **kwargs) - ) + def put( + self, url: StrOrURL, *, data: Any = None, **kwargs: Any + ) -> "_RequestContextManager": + """Perform HTTP PUT request.""" + return _RequestContextManager( + self._request(hdrs.METH_PUT, url, data=data, **kwargs) + ) - def patch( - self, url: StrOrURL, *, data: Any = None, **kwargs: Any - ) -> "_RequestContextManager": - """Perform HTTP PATCH request.""" - return _RequestContextManager( - self._request(hdrs.METH_PATCH, url, data=data, **kwargs) - ) + def patch( + self, url: StrOrURL, *, data: Any = None, **kwargs: Any + ) -> "_RequestContextManager": + """Perform HTTP PATCH request.""" + return _RequestContextManager( + self._request(hdrs.METH_PATCH, url, data=data, **kwargs) + ) - def delete(self, url: StrOrURL, **kwargs: Any) -> "_RequestContextManager": - """Perform HTTP DELETE request.""" - return _RequestContextManager(self._request(hdrs.METH_DELETE, url, **kwargs)) + def delete(self, url: StrOrURL, **kwargs: Any) -> "_RequestContextManager": + """Perform HTTP DELETE request.""" + return _RequestContextManager( + self._request(hdrs.METH_DELETE, url, **kwargs) + ) async def close(self) -> None: """Close underlying connector. @@ -1175,7 +1333,7 @@ class _BaseRequestContextManager(Coroutine[Any, Any, _RetType], Generic[_RetType __slots__ = ("_coro", "_resp") def __init__(self, coro: Coroutine["asyncio.Future[Any]", None, _RetType]) -> None: - self._coro = coro + self._coro: Coroutine["asyncio.Future[Any]", None, _RetType] = coro def send(self, arg: None) -> "asyncio.Future[Any]": return self._coro.send(arg) @@ -1194,12 +1352,8 @@ def __iter__(self) -> Generator[Any, None, _RetType]: return self.__await__() async def __aenter__(self) -> _RetType: - self._resp = await self._coro - return self._resp - - -class _RequestContextManager(_BaseRequestContextManager[ClientResponse]): - __slots__ = () + self._resp: _RetType = await self._coro + return await self._resp.__aenter__() async def __aexit__( self, @@ -1207,25 +1361,11 @@ async def __aexit__( exc: Optional[BaseException], tb: Optional[TracebackType], ) -> None: - # We're basing behavior on the exception as it can be caused by - # user code unrelated to the status of the connection. If you - # would like to close a connection you must do that - # explicitly. Otherwise connection error handling should kick in - # and close/recycle the connection as required. - self._resp.release() - await self._resp.wait_for_close() - + await self._resp.__aexit__(exc_type, exc, tb) -class _WSRequestContextManager(_BaseRequestContextManager[ClientWebSocketResponse]): - __slots__ = () - async def __aexit__( - self, - exc_type: Optional[Type[BaseException]], - exc: Optional[BaseException], - tb: Optional[TracebackType], - ) -> None: - await self._resp.close() +_RequestContextManager = _BaseRequestContextManager[ClientResponse] +_WSRequestContextManager = _BaseRequestContextManager[ClientWebSocketResponse] class _SessionRequestContextManager: @@ -1265,7 +1405,7 @@ def request( method: str, url: StrOrURL, *, - params: Optional[Mapping[str, str]] = None, + params: Query = None, data: Any = None, json: Any = None, headers: Optional[LooseHeaders] = None, diff --git a/contrib/python/aiohttp/aiohttp/client_exceptions.py b/contrib/python/aiohttp/aiohttp/client_exceptions.py index 9b6e44203c84..94991c42477d 100644 --- a/contrib/python/aiohttp/aiohttp/client_exceptions.py +++ b/contrib/python/aiohttp/aiohttp/client_exceptions.py @@ -2,10 +2,11 @@ import asyncio import warnings -from typing import TYPE_CHECKING, Any, Optional, Tuple, Union +from typing import TYPE_CHECKING, Optional, Tuple, Union -from .http_parser import RawResponseMessage -from .typedefs import LooseHeaders +from multidict import MultiMapping + +from .typedefs import StrOrURL try: import ssl @@ -17,18 +18,22 @@ if TYPE_CHECKING: from .client_reqrep import ClientResponse, ConnectionKey, Fingerprint, RequestInfo + from .http_parser import RawResponseMessage else: - RequestInfo = ClientResponse = ConnectionKey = None + RequestInfo = ClientResponse = ConnectionKey = RawResponseMessage = None __all__ = ( "ClientError", "ClientConnectionError", + "ClientConnectionResetError", "ClientOSError", "ClientConnectorError", "ClientProxyConnectionError", "ClientSSLError", "ClientConnectorSSLError", "ClientConnectorCertificateError", + "ConnectionTimeoutError", + "SocketTimeoutError", "ServerConnectionError", "ServerTimeoutError", "ServerDisconnectedError", @@ -39,6 +44,11 @@ "ContentTypeError", "ClientPayloadError", "InvalidURL", + "InvalidUrlClientError", + "RedirectClientError", + "NonHttpUrlClientError", + "InvalidUrlRedirectClientError", + "NonHttpUrlRedirectClientError", ) @@ -64,7 +74,7 @@ def __init__( code: Optional[int] = None, status: Optional[int] = None, message: str = "", - headers: Optional[LooseHeaders] = None, + headers: Optional[MultiMapping[str]] = None, ) -> None: self.request_info = request_info if code is not None: @@ -93,7 +103,7 @@ def __str__(self) -> str: return "{}, message={!r}, url={!r}".format( self.status, self.message, - self.request_info.real_url, + str(self.request_info.real_url), ) def __repr__(self) -> str: @@ -150,6 +160,10 @@ class ClientConnectionError(ClientError): """Base class for client socket errors.""" +class ClientConnectionResetError(ClientConnectionError, ConnectionResetError): + """ConnectionResetError""" + + class ClientOSError(ClientConnectionError, OSError): """OSError error.""" @@ -242,6 +256,14 @@ class ServerTimeoutError(ServerConnectionError, asyncio.TimeoutError): """Server timeout error.""" +class ConnectionTimeoutError(ServerTimeoutError): + """Connection timeout error.""" + + +class SocketTimeoutError(ServerTimeoutError): + """Socket timeout error.""" + + class ServerFingerprintMismatch(ServerConnectionError): """SSL certificate does not match expected fingerprint.""" @@ -271,17 +293,52 @@ class InvalidURL(ClientError, ValueError): # Derive from ValueError for backward compatibility - def __init__(self, url: Any) -> None: + def __init__(self, url: StrOrURL, description: Union[str, None] = None) -> None: # The type of url is not yarl.URL because the exception can be raised # on URL(url) call - super().__init__(url) + self._url = url + self._description = description + + if description: + super().__init__(url, description) + else: + super().__init__(url) @property - def url(self) -> Any: - return self.args[0] + def url(self) -> StrOrURL: + return self._url + + @property + def description(self) -> "str | None": + return self._description def __repr__(self) -> str: - return f"<{self.__class__.__name__} {self.url}>" + return f"<{self.__class__.__name__} {self}>" + + def __str__(self) -> str: + if self._description: + return f"{self._url} - {self._description}" + return str(self._url) + + +class InvalidUrlClientError(InvalidURL): + """Invalid URL client error.""" + + +class RedirectClientError(ClientError): + """Client redirect error.""" + + +class NonHttpUrlClientError(ClientError): + """Non http URL client error.""" + + +class InvalidUrlRedirectClientError(InvalidUrlClientError, RedirectClientError): + """Invalid URL redirect client error.""" + + +class NonHttpUrlRedirectClientError(NonHttpUrlClientError, RedirectClientError): + """Non http URL redirect client error.""" class ClientSSLError(ClientConnectorError): diff --git a/contrib/python/aiohttp/aiohttp/client_proto.py b/contrib/python/aiohttp/aiohttp/client_proto.py index 723f5aae5f44..8055811e40d9 100644 --- a/contrib/python/aiohttp/aiohttp/client_proto.py +++ b/contrib/python/aiohttp/aiohttp/client_proto.py @@ -7,7 +7,7 @@ ClientOSError, ClientPayloadError, ServerDisconnectedError, - ServerTimeoutError, + SocketTimeoutError, ) from .helpers import ( _EXC_SENTINEL, @@ -50,15 +50,13 @@ def upgraded(self) -> bool: @property def should_close(self) -> bool: - if self._payload is not None and not self._payload.is_eof() or self._upgraded: - return True - return ( self._should_close + or (self._payload is not None and not self._payload.is_eof()) or self._upgraded - or self.exception() is not None + or self._exception is not None or self._payload_parser is not None - or len(self) > 0 + or bool(self._buffer) or bool(self._tail) ) @@ -224,8 +222,16 @@ def _reschedule_timeout(self) -> None: def start_timeout(self) -> None: self._reschedule_timeout() + @property + def read_timeout(self) -> Optional[float]: + return self._read_timeout + + @read_timeout.setter + def read_timeout(self, read_timeout: Optional[float]) -> None: + self._read_timeout = read_timeout + def _on_read_timeout(self) -> None: - exc = ServerTimeoutError("Timeout on reading data from socket") + exc = SocketTimeoutError("Timeout on reading data from socket") self.set_exception(exc) if self._payload is not None: set_exception(self._payload, exc) @@ -261,7 +267,15 @@ def data_received(self, data: bytes) -> None: # closed in this case self.transport.close() # should_close is True after the call - self.set_exception(HttpProcessingError(), underlying_exc) + if isinstance(underlying_exc, HttpProcessingError): + exc = HttpProcessingError( + code=underlying_exc.code, + message=underlying_exc.message, + headers=underlying_exc.headers, + ) + else: + exc = HttpProcessingError() + self.set_exception(exc, underlying_exc) return self._upgraded = upgraded diff --git a/contrib/python/aiohttp/aiohttp/client_reqrep.py b/contrib/python/aiohttp/aiohttp/client_reqrep.py index afe719da16ea..aa8f54e67b81 100644 --- a/contrib/python/aiohttp/aiohttp/client_reqrep.py +++ b/contrib/python/aiohttp/aiohttp/client_reqrep.py @@ -27,7 +27,7 @@ import attr from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy -from yarl import URL +from yarl import URL, __version__ as yarl_version from . import hdrs, helpers, http, multipart, payload from .abc import AbstractStreamWriter @@ -67,6 +67,7 @@ JSONDecoder, LooseCookies, LooseHeaders, + Query, RawHeaders, ) @@ -88,6 +89,7 @@ _CONTAINS_CONTROL_CHAR_RE = re.compile(r"[^-!#$%&'*+.^_`|~0-9a-zA-Z]") +_YARL_SUPPORTS_EXTEND_QUERY = tuple(map(int, yarl_version.split(".")[:2])) >= (1, 11) json_re = re.compile(r"^application/(?:[\w.+-]+?\+)?json") @@ -209,7 +211,7 @@ def _merge_ssl_params( return ssl -@attr.s(auto_attribs=True, slots=True, frozen=True) +@attr.s(auto_attribs=True, slots=True, frozen=True, cache_hash=True) class ConnectionKey: # the key should contain an information about used proxy / TLS # to prevent reusing wrong connections from a pool @@ -245,7 +247,8 @@ class ClientRequest: hdrs.ACCEPT_ENCODING: _gen_default_accept_encoding(), } - body = b"" + # Type of body depends on PAYLOAD_REGISTRY, which is dynamic. + body: Any = b"" auth = None response = None @@ -262,14 +265,14 @@ def __init__( method: str, url: URL, *, - params: Optional[Mapping[str, str]] = None, + params: Query = None, headers: Optional[LooseHeaders] = None, - skip_auto_headers: Iterable[str] = frozenset(), + skip_auto_headers: Optional[Iterable[str]] = None, data: Any = None, cookies: Optional[LooseCookies] = None, auth: Optional[BasicAuth] = None, version: http.HttpVersion = http.HttpVersion11, - compress: Optional[str] = None, + compress: Union[str, bool, None] = None, chunked: Optional[bool] = None, expect100: bool = False, loop: Optional[asyncio.AbstractEventLoop] = None, @@ -300,10 +303,13 @@ def __init__( # assert session is not None self._session = cast("ClientSession", session) if params: - q = MultiDict(url.query) - url2 = url.with_query(params) - q.extend(url2.query) - url = url.with_query(q) + if _YARL_SUPPORTS_EXTEND_QUERY: + url = url.extend_query(params) + else: + q = MultiDict(url.query) + url2 = url.with_query(params) + q.extend(url2.query) + url = url.with_query(q) self.original_url = url self.url = url.with_fragment(None) self.method = method.upper() @@ -352,7 +358,12 @@ def _writer(self, writer: Optional["asyncio.Task[None]"]) -> None: if self.__writer is not None: self.__writer.remove_done_callback(self.__reset_writer) self.__writer = writer - if writer is not None: + if writer is None: + return + if writer.done(): + # The writer is already done, so we can reset it immediately. + self.__reset_writer() + else: writer.add_done_callback(self.__reset_writer) def is_ssl(self) -> bool: @@ -402,8 +413,8 @@ def update_host(self, url: URL) -> None: # basic auth info username, password = url.user, url.password - if username: - self.auth = helpers.BasicAuth(username, password or "") + if username or password: + self.auth = helpers.BasicAuth(username or "", password or "") def update_version(self, version: Union[http.HttpVersion, str]) -> None: """Convert request version to two elements tuple. @@ -436,7 +447,7 @@ def update_headers(self, headers: Optional[LooseHeaders]) -> None: if headers: if isinstance(headers, (dict, MultiDictProxy, MultiDict)): - headers = headers.items() # type: ignore[assignment] + headers = headers.items() for key, value in headers: # type: ignore[misc] # A special case for Host header @@ -445,12 +456,18 @@ def update_headers(self, headers: Optional[LooseHeaders]) -> None: else: self.headers.add(key, value) - def update_auto_headers(self, skip_auto_headers: Iterable[str]) -> None: - self.skip_auto_headers = CIMultiDict( - (hdr, None) for hdr in sorted(skip_auto_headers) - ) - used_headers = self.headers.copy() - used_headers.extend(self.skip_auto_headers) # type: ignore[arg-type] + def update_auto_headers(self, skip_auto_headers: Optional[Iterable[str]]) -> None: + if skip_auto_headers is not None: + self.skip_auto_headers = CIMultiDict( + (hdr, None) for hdr in sorted(skip_auto_headers) + ) + used_headers = self.headers.copy() + used_headers.extend(self.skip_auto_headers) # type: ignore[arg-type] + else: + # Fast path when there are no headers to skip + # which is the most common case. + self.skip_auto_headers = CIMultiDict() + used_headers = self.headers for hdr, val in self.DEFAULT_HEADERS.items(): if hdr not in used_headers: @@ -486,11 +503,12 @@ def update_cookies(self, cookies: Optional[LooseCookies]) -> None: def update_content_encoding(self, data: Any) -> None: """Set request content encoding.""" - if data is None: + if not data: + # Don't compress an empty body. + self.compress = None return - enc = self.headers.get(hdrs.CONTENT_ENCODING, "").lower() - if enc: + if self.headers.get(hdrs.CONTENT_ENCODING): if self.compress: raise ValueError( "compress can not be set " "if Content-Encoding header is set" @@ -566,10 +584,8 @@ def update_body_from_data(self, body: Any) -> None: # copy payload headers assert body.headers - for (key, value) in body.headers.items(): - if key in self.headers: - continue - if key in self.skip_auto_headers: + for key, value in body.headers.items(): + if key in self.headers or key in self.skip_auto_headers: continue self.headers[key] = value @@ -592,6 +608,10 @@ def update_proxy( raise ValueError("proxy_auth must be None or BasicAuth() tuple") self.proxy = proxy self.proxy_auth = proxy_auth + if proxy_headers is not None and not isinstance( + proxy_headers, (MultiDict, MultiDictProxy) + ): + proxy_headers = CIMultiDict(proxy_headers) self.proxy_headers = proxy_headers def keep_alive(self) -> bool: @@ -614,11 +634,8 @@ async def write_bytes( """Support coroutines that yields bytes objects.""" # 100 response if self._continue is not None: - try: - await writer.drain() - await self._continue - except asyncio.CancelledError: - return + await writer.drain() + await self._continue protocol = conn.protocol assert protocol is not None @@ -627,10 +644,10 @@ async def write_bytes( await self.body.write(writer) else: if isinstance(self.body, (bytes, bytearray)): - self.body = (self.body,) # type: ignore[assignment] + self.body = (self.body,) for chunk in self.body: - await writer.write(chunk) # type: ignore[arg-type] + await writer.write(chunk) except OSError as underlying_exc: reraised_exc = underlying_exc @@ -645,7 +662,9 @@ async def write_bytes( set_exception(protocol, reraised_exc, underlying_exc) except asyncio.CancelledError: - await writer.write_eof() + # Body hasn't been fully sent, so connection can't be reused. + conn.close() + raise except Exception as underlying_exc: set_exception( protocol, @@ -681,16 +700,20 @@ async def send(self, conn: "Connection") -> "ClientResponse": writer = StreamWriter( protocol, self.loop, - on_chunk_sent=functools.partial( - self._on_chunk_request_sent, self.method, self.url + on_chunk_sent=( + functools.partial(self._on_chunk_request_sent, self.method, self.url) + if self._traces + else None ), - on_headers_sent=functools.partial( - self._on_headers_request_sent, self.method, self.url + on_headers_sent=( + functools.partial(self._on_headers_request_sent, self.method, self.url) + if self._traces + else None ), ) if self.compress: - writer.enable_compression(self.compress) + writer.enable_compression(self.compress) # type: ignore[arg-type] if self.chunked is not None: writer.enable_chunking() @@ -717,13 +740,20 @@ async def send(self, conn: "Connection") -> "ClientResponse": self.headers[hdrs.CONNECTION] = connection # status + headers - status_line = "{0} {1} HTTP/{v.major}.{v.minor}".format( - self.method, path, v=self.version - ) + v = self.version + status_line = f"{self.method} {path} HTTP/{v.major}.{v.minor}" await writer.write_headers(status_line, self.headers) + coro = self.write_bytes(writer, conn) - self._writer = self.loop.create_task(self.write_bytes(writer, conn)) + if sys.version_info >= (3, 12): + # Optimization for Python 3.12, try to write + # bytes immediately to avoid having to schedule + # the task on the event loop. + task = asyncio.Task(coro, loop=self.loop, eager_start=True) + else: + task = self.loop.create_task(coro) + self._writer = task response_class = self.response_class assert response_class is not None self.response = response_class( @@ -741,8 +771,15 @@ async def send(self, conn: "Connection") -> "ClientResponse": async def close(self) -> None: if self._writer is not None: - with contextlib.suppress(asyncio.CancelledError): + try: await self._writer + except asyncio.CancelledError: + if ( + sys.version_info >= (3, 11) + and (task := asyncio.current_task()) + and task.cancelling() + ): + raise def terminate(self) -> None: if self._writer is not None: @@ -782,6 +819,7 @@ class ClientResponse(HeadersMixin): # post-init stage allows to not change ctor signature _closed = True # to allow __del__ for non-initialized properly response _released = False + _in_context = False __writer = None def __init__( @@ -820,9 +858,9 @@ def __init__( # work after the response has finished reading the body. if session is None: # TODO: Fix session=None in tests (see ClientRequest.__init__). - self._resolve_charset: Callable[ - ["ClientResponse", bytes], str - ] = lambda *_: "utf-8" + self._resolve_charset: Callable[["ClientResponse", bytes], str] = ( + lambda *_: "utf-8" + ) else: self._resolve_charset = session._resolve_charset if loop.get_debug(): @@ -840,7 +878,12 @@ def _writer(self, writer: Optional["asyncio.Task[None]"]) -> None: if self.__writer is not None: self.__writer.remove_done_callback(self.__reset_writer) self.__writer = writer - if writer is not None: + if writer is None: + return + if writer.done(): + # The writer is already done, so we can reset it immediately. + self.__reset_writer() + else: writer.add_done_callback(self.__reset_writer) @reify @@ -1066,7 +1109,12 @@ def raise_for_status(self) -> None: if not self.ok: # reason should always be not None for a started response assert self.reason is not None - self.release() + + # If we're in a context we can rely on __aexit__() to release as the + # exception propagates. + if not self._in_context: + self.release() + raise ClientResponseError( self.request_info, self.history, @@ -1085,7 +1133,15 @@ def _release_connection(self) -> None: async def _wait_released(self) -> None: if self._writer is not None: - await self._writer + try: + await self._writer + except asyncio.CancelledError: + if ( + sys.version_info >= (3, 11) + and (task := asyncio.current_task()) + and task.cancelling() + ): + raise self._release_connection() def _cleanup_writer(self) -> None: @@ -1101,7 +1157,15 @@ def _notify_content(self) -> None: async def wait_for_close(self) -> None: if self._writer is not None: - await self._writer + try: + await self._writer + except asyncio.CancelledError: + if ( + sys.version_info >= (3, 11) + and (task := asyncio.current_task()) + and task.cancelling() + ): + raise self.release() async def read(self) -> bytes: @@ -1130,7 +1194,7 @@ def get_encoding(self) -> str: encoding = mimetype.parameters.get("charset") if encoding: - with contextlib.suppress(LookupError): + with contextlib.suppress(LookupError, ValueError): return codecs.lookup(encoding).name if mimetype.type == "application" and ( @@ -1176,6 +1240,7 @@ async def json( raise ContentTypeError( self.request_info, self.history, + status=self.status, message=( "Attempt to decode JSON with " "unexpected mimetype: %s" % ctype ), @@ -1192,6 +1257,7 @@ async def json( return loads(stripped.decode(encoding)) async def __aenter__(self) -> "ClientResponse": + self._in_context = True return self async def __aexit__( @@ -1200,6 +1266,7 @@ async def __aexit__( exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: + self._in_context = False # similar to _RequestContextManager, we do not need to check # for exceptions, response object can close connection # if state is broken diff --git a/contrib/python/aiohttp/aiohttp/client_ws.py b/contrib/python/aiohttp/aiohttp/client_ws.py index d9c74a30f523..c6b5da5103bf 100644 --- a/contrib/python/aiohttp/aiohttp/client_ws.py +++ b/contrib/python/aiohttp/aiohttp/client_ws.py @@ -2,11 +2,12 @@ import asyncio import sys -from typing import Any, Optional, cast +from types import TracebackType +from typing import Any, Optional, Type, cast -from .client_exceptions import ClientError +from .client_exceptions import ClientError, ServerTimeoutError from .client_reqrep import ClientResponse -from .helpers import call_later, set_result +from .helpers import calculate_timeout_when, set_result from .http import ( WS_CLOSED_MESSAGE, WS_CLOSING_MESSAGE, @@ -62,63 +63,123 @@ def __init__( self._autoping = autoping self._heartbeat = heartbeat self._heartbeat_cb: Optional[asyncio.TimerHandle] = None + self._heartbeat_when: float = 0.0 if heartbeat is not None: self._pong_heartbeat = heartbeat / 2.0 self._pong_response_cb: Optional[asyncio.TimerHandle] = None self._loop = loop - self._waiting: Optional[asyncio.Future[bool]] = None + self._waiting: bool = False + self._close_wait: Optional[asyncio.Future[None]] = None self._exception: Optional[BaseException] = None self._compress = compress self._client_notakeover = client_notakeover + self._ping_task: Optional[asyncio.Task[None]] = None self._reset_heartbeat() def _cancel_heartbeat(self) -> None: - if self._pong_response_cb is not None: - self._pong_response_cb.cancel() - self._pong_response_cb = None - + self._cancel_pong_response_cb() if self._heartbeat_cb is not None: self._heartbeat_cb.cancel() self._heartbeat_cb = None + if self._ping_task is not None: + self._ping_task.cancel() + self._ping_task = None - def _reset_heartbeat(self) -> None: - self._cancel_heartbeat() + def _cancel_pong_response_cb(self) -> None: + if self._pong_response_cb is not None: + self._pong_response_cb.cancel() + self._pong_response_cb = None - if self._heartbeat is not None: - self._heartbeat_cb = call_later( - self._send_heartbeat, - self._heartbeat, - self._loop, - timeout_ceil_threshold=self._conn._connector._timeout_ceil_threshold - if self._conn is not None - else 5, - ) + def _reset_heartbeat(self) -> None: + if self._heartbeat is None: + return + self._cancel_pong_response_cb() + loop = self._loop + assert loop is not None + conn = self._conn + timeout_ceil_threshold = ( + conn._connector._timeout_ceil_threshold if conn is not None else 5 + ) + now = loop.time() + when = calculate_timeout_when(now, self._heartbeat, timeout_ceil_threshold) + self._heartbeat_when = when + if self._heartbeat_cb is None: + # We do not cancel the previous heartbeat_cb here because + # it generates a significant amount of TimerHandle churn + # which causes asyncio to rebuild the heap frequently. + # Instead _send_heartbeat() will reschedule the next + # heartbeat if it fires too early. + self._heartbeat_cb = loop.call_at(when, self._send_heartbeat) def _send_heartbeat(self) -> None: - if self._heartbeat is not None and not self._closed: - # fire-and-forget a task is not perfect but maybe ok for - # sending ping. Otherwise we need a long-living heartbeat - # task in the class. - self._loop.create_task(self._writer.ping()) - - if self._pong_response_cb is not None: - self._pong_response_cb.cancel() - self._pong_response_cb = call_later( - self._pong_not_received, - self._pong_heartbeat, - self._loop, - timeout_ceil_threshold=self._conn._connector._timeout_ceil_threshold - if self._conn is not None - else 5, + self._heartbeat_cb = None + loop = self._loop + now = loop.time() + if now < self._heartbeat_when: + # Heartbeat fired too early, reschedule + self._heartbeat_cb = loop.call_at( + self._heartbeat_when, self._send_heartbeat ) + return + + conn = self._conn + timeout_ceil_threshold = ( + conn._connector._timeout_ceil_threshold if conn is not None else 5 + ) + when = calculate_timeout_when(now, self._pong_heartbeat, timeout_ceil_threshold) + self._cancel_pong_response_cb() + self._pong_response_cb = loop.call_at(when, self._pong_not_received) + + if sys.version_info >= (3, 12): + # Optimization for Python 3.12, try to send the ping + # immediately to avoid having to schedule + # the task on the event loop. + ping_task = asyncio.Task(self._writer.ping(), loop=loop, eager_start=True) + else: + ping_task = loop.create_task(self._writer.ping()) + + if not ping_task.done(): + self._ping_task = ping_task + ping_task.add_done_callback(self._ping_task_done) + else: + self._ping_task_done(ping_task) + + def _ping_task_done(self, task: "asyncio.Task[None]") -> None: + """Callback for when the ping task completes.""" + if not task.cancelled() and (exc := task.exception()): + self._handle_ping_pong_exception(exc) + self._ping_task = None def _pong_not_received(self) -> None: - if not self._closed: - self._closed = True - self._close_code = WSCloseCode.ABNORMAL_CLOSURE - self._exception = asyncio.TimeoutError() - self._response.close() + self._handle_ping_pong_exception(ServerTimeoutError()) + + def _handle_ping_pong_exception(self, exc: BaseException) -> None: + """Handle exceptions raised during ping/pong processing.""" + if self._closed: + return + self._set_closed() + self._close_code = WSCloseCode.ABNORMAL_CLOSURE + self._exception = exc + self._response.close() + if self._waiting and not self._closing: + self._reader.feed_data(WSMessage(WSMsgType.ERROR, exc, None)) + + def _set_closed(self) -> None: + """Set the connection to closed. + + Cancel any heartbeat timers and set the closed flag. + """ + self._closed = True + self._cancel_heartbeat() + + def _set_closing(self) -> None: + """Set the connection to closing. + + Cancel any heartbeat timers and set the closing flag. + """ + self._closing = True + self._cancel_heartbeat() @property def closed(self) -> bool: @@ -181,14 +242,15 @@ async def send_json( async def close(self, *, code: int = WSCloseCode.OK, message: bytes = b"") -> bool: # we need to break `receive()` cycle first, # `close()` may be called from different task - if self._waiting is not None and not self._closing: - self._closing = True + if self._waiting and not self._closing: + assert self._loop is not None + self._close_wait = self._loop.create_future() + self._set_closing() self._reader.feed_data(WS_CLOSING_MESSAGE, 0) - await self._waiting + await self._close_wait if not self._closed: - self._cancel_heartbeat() - self._closed = True + self._set_closed() try: await self._writer.close(code, message) except asyncio.CancelledError: @@ -219,7 +281,7 @@ async def close(self, *, code: int = WSCloseCode.OK, message: bytes = b"") -> bo self._response.close() return True - if msg.type == WSMsgType.CLOSE: + if msg.type is WSMsgType.CLOSE: self._close_code = msg.data self._response.close() return True @@ -227,8 +289,10 @@ async def close(self, *, code: int = WSCloseCode.OK, message: bytes = b"") -> bo return False async def receive(self, timeout: Optional[float] = None) -> WSMessage: + receive_timeout = timeout or self._receive_timeout + while True: - if self._waiting is not None: + if self._waiting: raise RuntimeError("Concurrent call to receive() is not allowed") if self._closed: @@ -238,15 +302,22 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage: return WS_CLOSED_MESSAGE try: - self._waiting = self._loop.create_future() + self._waiting = True try: - async with async_timeout.timeout(timeout or self._receive_timeout): + if receive_timeout: + # Entering the context manager and creating + # Timeout() object can take almost 50% of the + # run time in this loop so we avoid it if + # there is no read timeout. + async with async_timeout.timeout(receive_timeout): + msg = await self._reader.read() + else: msg = await self._reader.read() self._reset_heartbeat() finally: - waiter = self._waiting - self._waiting = None - set_result(waiter, True) + self._waiting = False + if self._close_wait: + set_result(self._close_wait, None) except (asyncio.CancelledError, asyncio.TimeoutError): self._close_code = WSCloseCode.ABNORMAL_CLOSURE raise @@ -255,7 +326,8 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage: await self.close() return WSMessage(WSMsgType.CLOSED, None, None) except ClientError: - self._closed = True + # Likely ServerDisconnectedError when connection is lost + self._set_closed() self._close_code = WSCloseCode.ABNORMAL_CLOSURE return WS_CLOSED_MESSAGE except WebSocketError as exc: @@ -264,35 +336,35 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage: return WSMessage(WSMsgType.ERROR, exc, None) except Exception as exc: self._exception = exc - self._closing = True + self._set_closing() self._close_code = WSCloseCode.ABNORMAL_CLOSURE await self.close() return WSMessage(WSMsgType.ERROR, exc, None) - if msg.type == WSMsgType.CLOSE: - self._closing = True + if msg.type is WSMsgType.CLOSE: + self._set_closing() self._close_code = msg.data if not self._closed and self._autoclose: await self.close() - elif msg.type == WSMsgType.CLOSING: - self._closing = True - elif msg.type == WSMsgType.PING and self._autoping: + elif msg.type is WSMsgType.CLOSING: + self._set_closing() + elif msg.type is WSMsgType.PING and self._autoping: await self.pong(msg.data) continue - elif msg.type == WSMsgType.PONG and self._autoping: + elif msg.type is WSMsgType.PONG and self._autoping: continue return msg async def receive_str(self, *, timeout: Optional[float] = None) -> str: msg = await self.receive(timeout) - if msg.type != WSMsgType.TEXT: + if msg.type is not WSMsgType.TEXT: raise TypeError(f"Received message {msg.type}:{msg.data!r} is not str") return cast(str, msg.data) async def receive_bytes(self, *, timeout: Optional[float] = None) -> bytes: msg = await self.receive(timeout) - if msg.type != WSMsgType.BINARY: + if msg.type is not WSMsgType.BINARY: raise TypeError(f"Received message {msg.type}:{msg.data!r} is not bytes") return cast(bytes, msg.data) @@ -313,3 +385,14 @@ async def __anext__(self) -> WSMessage: if msg.type in (WSMsgType.CLOSE, WSMsgType.CLOSING, WSMsgType.CLOSED): raise StopAsyncIteration return msg + + async def __aenter__(self) -> "ClientWebSocketResponse": + return self + + async def __aexit__( + self, + exc_type: Optional[Type[BaseException]], + exc_val: Optional[BaseException], + exc_tb: Optional[TracebackType], + ) -> None: + await self.close() diff --git a/contrib/python/aiohttp/aiohttp/compression_utils.py b/contrib/python/aiohttp/aiohttp/compression_utils.py index 9631d377e9a5..ab4a2f1cc845 100644 --- a/contrib/python/aiohttp/aiohttp/compression_utils.py +++ b/contrib/python/aiohttp/aiohttp/compression_utils.py @@ -50,9 +50,11 @@ def __init__( max_sync_chunk_size: Optional[int] = MAX_SYNC_CHUNK_SIZE, ): super().__init__( - mode=encoding_to_mode(encoding, suppress_deflate_header) - if wbits is None - else wbits, + mode=( + encoding_to_mode(encoding, suppress_deflate_header) + if wbits is None + else wbits + ), executor=executor, max_sync_chunk_size=max_sync_chunk_size, ) diff --git a/contrib/python/aiohttp/aiohttp/connector.py b/contrib/python/aiohttp/aiohttp/connector.py index f95ebe84c66c..8288a0115b72 100644 --- a/contrib/python/aiohttp/aiohttp/connector.py +++ b/contrib/python/aiohttp/aiohttp/connector.py @@ -1,6 +1,7 @@ import asyncio import functools import random +import socket import sys import traceback import warnings @@ -22,6 +23,7 @@ List, Literal, Optional, + Sequence, Set, Tuple, Type, @@ -29,10 +31,11 @@ cast, ) +import aiohappyeyeballs import attr from . import hdrs, helpers -from .abc import AbstractResolver +from .abc import AbstractResolver, ResolveResult from .client_exceptions import ( ClientConnectionError, ClientConnectorCertificateError, @@ -47,7 +50,7 @@ ) from .client_proto import ResponseHandler from .client_reqrep import ClientRequest, Fingerprint, _merge_ssl_params -from .helpers import ceil_timeout, get_running_loop, is_ip_address, noop, sentinel +from .helpers import ceil_timeout, is_ip_address, noop, sentinel from .locks import EventResultOrError from .resolver import DefaultResolver @@ -60,6 +63,14 @@ SSLContext = object # type: ignore[misc,assignment] +EMPTY_SCHEMA_SET = frozenset({""}) +HTTP_SCHEMA_SET = frozenset({"http", "https"}) +WS_SCHEMA_SET = frozenset({"ws", "wss"}) + +HTTP_AND_EMPTY_SCHEMA_SET = HTTP_SCHEMA_SET | EMPTY_SCHEMA_SET +HIGH_LEVEL_SCHEMA_SET = HTTP_AND_EMPTY_SCHEMA_SET | WS_SCHEMA_SET + + __all__ = ("BaseConnector", "TCPConnector", "UnixConnector", "NamedPipeConnector") @@ -208,6 +219,8 @@ class BaseConnector: # abort transport after 2 seconds (cleanup broken connections) _cleanup_closed_period = 2.0 + allowed_protocol_schema_set = HIGH_LEVEL_SCHEMA_SET + def __init__( self, *, @@ -229,7 +242,7 @@ def __init__( if keepalive_timeout is sentinel: keepalive_timeout = 15.0 - loop = get_running_loop(loop) + loop = loop or asyncio.get_event_loop() self._timeout_ceil_threshold = timeout_ceil_threshold self._closed = False @@ -240,9 +253,9 @@ def __init__( self._limit = limit self._limit_per_host = limit_per_host self._acquired: Set[ResponseHandler] = set() - self._acquired_per_host: DefaultDict[ - ConnectionKey, Set[ResponseHandler] - ] = defaultdict(set) + self._acquired_per_host: DefaultDict[ConnectionKey, Set[ResponseHandler]] = ( + defaultdict(set) + ) self._keepalive_timeout = cast(float, keepalive_timeout) self._force_close = force_close @@ -691,14 +704,14 @@ async def _create_connection( class _DNSCacheTable: def __init__(self, ttl: Optional[float] = None) -> None: - self._addrs_rr: Dict[Tuple[str, int], Tuple[Iterator[Dict[str, Any]], int]] = {} + self._addrs_rr: Dict[Tuple[str, int], Tuple[Iterator[ResolveResult], int]] = {} self._timestamps: Dict[Tuple[str, int], float] = {} self._ttl = ttl def __contains__(self, host: object) -> bool: return host in self._addrs_rr - def add(self, key: Tuple[str, int], addrs: List[Dict[str, Any]]) -> None: + def add(self, key: Tuple[str, int], addrs: List[ResolveResult]) -> None: self._addrs_rr[key] = (cycle(addrs), len(addrs)) if self._ttl is not None: @@ -714,7 +727,7 @@ def clear(self) -> None: self._addrs_rr.clear() self._timestamps.clear() - def next_addrs(self, key: Tuple[str, int]) -> List[Dict[str, Any]]: + def next_addrs(self, key: Tuple[str, int]) -> List[ResolveResult]: loop, length = self._addrs_rr[key] addrs = list(islice(loop, length)) # Consume one more element to shift internal state of `cycle` @@ -728,6 +741,35 @@ def expired(self, key: Tuple[str, int]) -> bool: return self._timestamps[key] + self._ttl < monotonic() +def _make_ssl_context(verified: bool) -> SSLContext: + """Create SSL context. + + This method is not async-friendly and should be called from a thread + because it will load certificates from disk and do other blocking I/O. + """ + if ssl is None: + # No ssl support + return None + if verified: + return ssl.create_default_context() + sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + sslcontext.options |= ssl.OP_NO_SSLv2 + sslcontext.options |= ssl.OP_NO_SSLv3 + sslcontext.check_hostname = False + sslcontext.verify_mode = ssl.CERT_NONE + sslcontext.options |= ssl.OP_NO_COMPRESSION + sslcontext.set_default_verify_paths() + return sslcontext + + +# The default SSLContext objects are created at import time +# since they do blocking I/O to load certificates from disk, +# and imports should always be done before the event loop starts +# or in a thread. +_SSL_CONTEXT_VERIFIED = _make_ssl_context(True) +_SSL_CONTEXT_UNVERIFIED = _make_ssl_context(False) + + class TCPConnector(BaseConnector): """TCP connector. @@ -735,7 +777,7 @@ class TCPConnector(BaseConnector): fingerprint - Pass the binary sha256 digest of the expected certificate in DER format to verify that the certificate the server presents matches. See also - https://en.wikipedia.org/wiki/Transport_Layer_Security#Certificate_pinning + https://en.wikipedia.org/wiki/HTTP_Public_Key_Pinning resolver - Enable DNS lookups and use this resolver use_dns_cache - Use memory cache for DNS lookups. @@ -750,9 +792,15 @@ class TCPConnector(BaseConnector): limit_per_host - Number of simultaneous connections to one host. enable_cleanup_closed - Enables clean-up closed ssl transports. Disabled by default. + happy_eyeballs_delay - This is the “Connection Attempt Delay” + as defined in RFC 8305. To disable + the happy eyeballs algorithm, set to None. + interleave - “First Address Family Count” as defined in RFC 8305 loop - Optional event loop. """ + allowed_protocol_schema_set = HIGH_LEVEL_SCHEMA_SET | frozenset({"tcp"}) + def __init__( self, *, @@ -760,7 +808,7 @@ def __init__( fingerprint: Optional[bytes] = None, use_dns_cache: bool = True, ttl_dns_cache: Optional[int] = 10, - family: int = 0, + family: socket.AddressFamily = socket.AddressFamily.AF_UNSPEC, ssl_context: Optional[SSLContext] = None, ssl: Union[bool, Fingerprint, SSLContext] = True, local_addr: Optional[Tuple[str, int]] = None, @@ -772,6 +820,8 @@ def __init__( enable_cleanup_closed: bool = False, loop: Optional[asyncio.AbstractEventLoop] = None, timeout_ceil_threshold: float = 5, + happy_eyeballs_delay: Optional[float] = 0.25, + interleave: Optional[int] = None, ): super().__init__( keepalive_timeout=keepalive_timeout, @@ -792,13 +842,19 @@ def __init__( self._cached_hosts = _DNSCacheTable(ttl=ttl_dns_cache) self._throttle_dns_events: Dict[Tuple[str, int], EventResultOrError] = {} self._family = family - self._local_addr = local_addr + self._local_addr_infos = aiohappyeyeballs.addr_to_addr_infos(local_addr) + self._happy_eyeballs_delay = happy_eyeballs_delay + self._interleave = interleave + self._resolve_host_tasks: Set["asyncio.Task[List[ResolveResult]]"] = set() def close(self) -> Awaitable[None]: """Close all ongoing DNS calls.""" for ev in self._throttle_dns_events.values(): ev.cancel() + for t in self._resolve_host_tasks: + t.cancel() + return super().close() @property @@ -823,8 +879,8 @@ def clear_dns_cache( self._cached_hosts.clear() async def _resolve_host( - self, host: str, port: int, traces: Optional[List["Trace"]] = None - ) -> List[Dict[str, Any]]: + self, host: str, port: int, traces: Optional[Sequence["Trace"]] = None + ) -> List[ResolveResult]: """Resolve host and return list of addresses.""" if is_ip_address(host): return [ @@ -876,11 +932,13 @@ async def _resolve_host( resolved_host_task = asyncio.create_task( self._resolve_host_with_throttle(key, host, port, traces) ) + self._resolve_host_tasks.add(resolved_host_task) + resolved_host_task.add_done_callback(self._resolve_host_tasks.discard) try: return await asyncio.shield(resolved_host_task) except asyncio.CancelledError: - def drop_exception(fut: "asyncio.Future[List[Dict[str, Any]]]") -> None: + def drop_exception(fut: "asyncio.Future[List[ResolveResult]]") -> None: with suppress(Exception, asyncio.CancelledError): fut.result() @@ -892,8 +950,8 @@ async def _resolve_host_with_throttle( key: Tuple[str, int], host: str, port: int, - traces: Optional[List["Trace"]], - ) -> List[Dict[str, Any]]: + traces: Optional[Sequence["Trace"]], + ) -> List[ResolveResult]: """Resolve host with a dns events throttle.""" if key in self._throttle_dns_events: # get event early, before any await (#4014) @@ -945,29 +1003,6 @@ async def _create_connection( return proto - @staticmethod - @functools.lru_cache(None) - def _make_ssl_context(verified: bool) -> SSLContext: - if verified: - return ssl.create_default_context() - else: - sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) - sslcontext.options |= ssl.OP_NO_SSLv2 - sslcontext.options |= ssl.OP_NO_SSLv3 - sslcontext.check_hostname = False - sslcontext.verify_mode = ssl.CERT_NONE - try: - sslcontext.options |= ssl.OP_NO_COMPRESSION - except AttributeError as attr_err: - warnings.warn( - "{!s}: The Python interpreter is compiled " - "against OpenSSL < 1.0.0. Ref: " - "https://docs.python.org/3/library/ssl.html" - "#ssl.OP_NO_COMPRESSION".format(attr_err), - ) - sslcontext.set_default_verify_paths() - return sslcontext - def _get_ssl_context(self, req: ClientRequest) -> Optional[SSLContext]: """Logic to get the correct SSL context @@ -982,25 +1017,25 @@ def _get_ssl_context(self, req: ClientRequest) -> Optional[SSLContext]: 3. if verify_ssl is False in req, generate a SSL context that won't verify """ - if req.is_ssl(): - if ssl is None: # pragma: no cover - raise RuntimeError("SSL is not supported.") - sslcontext = req.ssl - if isinstance(sslcontext, ssl.SSLContext): - return sslcontext - if sslcontext is not True: - # not verified or fingerprinted - return self._make_ssl_context(False) - sslcontext = self._ssl - if isinstance(sslcontext, ssl.SSLContext): - return sslcontext - if sslcontext is not True: - # not verified or fingerprinted - return self._make_ssl_context(False) - return self._make_ssl_context(True) - else: + if not req.is_ssl(): return None + if ssl is None: # pragma: no cover + raise RuntimeError("SSL is not supported.") + sslcontext = req.ssl + if isinstance(sslcontext, ssl.SSLContext): + return sslcontext + if sslcontext is not True: + # not verified or fingerprinted + return _SSL_CONTEXT_UNVERIFIED + sslcontext = self._ssl + if isinstance(sslcontext, ssl.SSLContext): + return sslcontext + if sslcontext is not True: + # not verified or fingerprinted + return _SSL_CONTEXT_UNVERIFIED + return _SSL_CONTEXT_VERIFIED + def _get_fingerprint(self, req: ClientRequest) -> Optional["Fingerprint"]: ret = req.ssl if isinstance(ret, Fingerprint): @@ -1011,6 +1046,36 @@ def _get_fingerprint(self, req: ClientRequest) -> Optional["Fingerprint"]: return None async def _wrap_create_connection( + self, + *args: Any, + addr_infos: List[aiohappyeyeballs.AddrInfoType], + req: ClientRequest, + timeout: "ClientTimeout", + client_error: Type[Exception] = ClientConnectorError, + **kwargs: Any, + ) -> Tuple[asyncio.Transport, ResponseHandler]: + try: + async with ceil_timeout( + timeout.sock_connect, ceil_threshold=timeout.ceil_threshold + ): + sock = await aiohappyeyeballs.start_connection( + addr_infos=addr_infos, + local_addr_infos=self._local_addr_infos, + happy_eyeballs_delay=self._happy_eyeballs_delay, + interleave=self._interleave, + loop=self._loop, + ) + return await self._loop.create_connection(*args, **kwargs, sock=sock) + except cert_errors as exc: + raise ClientConnectorCertificateError(req.connection_key, exc) from exc + except ssl_errors as exc: + raise ClientConnectorSSLError(req.connection_key, exc) from exc + except OSError as exc: + if exc.errno is None and isinstance(exc, asyncio.TimeoutError): + raise + raise client_error(req.connection_key, exc) from exc + + async def _wrap_existing_connection( self, *args: Any, req: ClientRequest, @@ -1121,13 +1186,11 @@ async def _start_tls_connection( ) -> Tuple[asyncio.BaseTransport, ResponseHandler]: """Wrap the raw TCP transport with TLS.""" tls_proto = self._factory() # Create a brand new proto for TLS - - # Safety of the `cast()` call here is based on the fact that - # internally `_get_ssl_context()` only returns `None` when - # `req.is_ssl()` evaluates to `False` which is never gonna happen - # in this code path. Of course, it's rather fragile - # maintainability-wise but this is to be solved separately. - sslcontext = cast(ssl.SSLContext, self._get_ssl_context(req)) + sslcontext = self._get_ssl_context(req) + if TYPE_CHECKING: + # _start_tls_connection is unreachable in the current code path + # if sslcontext is None. + assert sslcontext is not None try: async with ceil_timeout( @@ -1176,6 +1239,27 @@ async def _start_tls_connection( return tls_transport, tls_proto + def _convert_hosts_to_addr_infos( + self, hosts: List[ResolveResult] + ) -> List[aiohappyeyeballs.AddrInfoType]: + """Converts the list of hosts to a list of addr_infos. + + The list of hosts is the result of a DNS lookup. The list of + addr_infos is the result of a call to `socket.getaddrinfo()`. + """ + addr_infos: List[aiohappyeyeballs.AddrInfoType] = [] + for hinfo in hosts: + host = hinfo["host"] + is_ipv6 = ":" in host + family = socket.AF_INET6 if is_ipv6 else socket.AF_INET + if self._family and self._family != family: + continue + addr = (host, hinfo["port"], 0, 0) if is_ipv6 else (host, hinfo["port"]) + addr_infos.append( + (family, socket.SOCK_STREAM, socket.IPPROTO_TCP, "", addr) + ) + return addr_infos + async def _create_direct_connection( self, req: ClientRequest, @@ -1209,36 +1293,27 @@ async def _create_direct_connection( raise ClientConnectorError(req.connection_key, exc) from exc last_exc: Optional[Exception] = None - - for hinfo in hosts: - host = hinfo["host"] - port = hinfo["port"] - + addr_infos = self._convert_hosts_to_addr_infos(hosts) + while addr_infos: # Strip trailing dots, certificates contain FQDN without dots. # See https://github.com/aio-libs/aiohttp/issues/3636 server_hostname = ( - (req.server_hostname or hinfo["hostname"]).rstrip(".") - if sslcontext - else None + (req.server_hostname or host).rstrip(".") if sslcontext else None ) try: transp, proto = await self._wrap_create_connection( self._factory, - host, - port, timeout=timeout, ssl=sslcontext, - family=hinfo["family"], - proto=hinfo["proto"], - flags=hinfo["flags"], + addr_infos=addr_infos, server_hostname=server_hostname, - local_addr=self._local_addr, req=req, client_error=client_error, ) except ClientConnectorError as exc: last_exc = exc + aiohappyeyeballs.pop_addr_infos_interleave(addr_infos, self._interleave) continue if req.is_ssl() and fingerprint: @@ -1249,6 +1324,10 @@ async def _create_direct_connection( if not self._cleanup_closed_disabled: self._cleanup_closed_transports.append(transp) last_exc = exc + # Remove the bad peer from the list of addr_infos + sock: socket.socket = transp.get_extra_info("socket") + bad_peer = sock.getpeername() + aiohappyeyeballs.remove_addr_infos(addr_infos, bad_peer) continue return transp, proto @@ -1367,7 +1446,7 @@ async def _create_proxy_connection( if not runtime_has_start_tls: # HTTP proxy with support for upgrade to HTTPS sslcontext = self._get_ssl_context(req) - return await self._wrap_create_connection( + return await self._wrap_existing_connection( self._factory, timeout=timeout, ssl=sslcontext, @@ -1401,6 +1480,8 @@ class UnixConnector(BaseConnector): loop - Optional event loop. """ + allowed_protocol_schema_set = HIGH_LEVEL_SCHEMA_SET | frozenset({"unix"}) + def __init__( self, path: str, @@ -1457,6 +1538,8 @@ class NamedPipeConnector(BaseConnector): loop - Optional event loop. """ + allowed_protocol_schema_set = HIGH_LEVEL_SCHEMA_SET | frozenset({"npipe"}) + def __init__( self, path: str, diff --git a/contrib/python/aiohttp/aiohttp/cookiejar.py b/contrib/python/aiohttp/aiohttp/cookiejar.py index a348f112cb55..c78d5fa7e724 100644 --- a/contrib/python/aiohttp/aiohttp/cookiejar.py +++ b/contrib/python/aiohttp/aiohttp/cookiejar.py @@ -2,6 +2,8 @@ import calendar import contextlib import datetime +import heapq +import itertools import os # noqa import pathlib import pickle @@ -9,8 +11,7 @@ import time from collections import defaultdict from http.cookies import BaseCookie, Morsel, SimpleCookie -from math import ceil -from typing import ( # noqa +from typing import ( DefaultDict, Dict, Iterable, @@ -35,6 +36,15 @@ CookieItem = Union[str, "Morsel[str]"] +# We cache these string methods here as their use is in performance critical code. +_FORMAT_PATH = "{}/{}".format +_FORMAT_DOMAIN_REVERSED = "{1}.{0}".format + +# The minimum number of scheduled cookie expirations before we start cleaning up +# the expiration heap. This is a performance optimization to avoid cleaning up the +# heap too often when there are only a few scheduled expirations. +_MIN_SCHEDULED_COOKIE_EXPIRATION = 100 + class CookieJar(AbstractCookieJar): """Implements cookie storage adhering to RFC 6265.""" @@ -85,6 +95,9 @@ def __init__( self._cookies: DefaultDict[Tuple[str, str], SimpleCookie] = defaultdict( SimpleCookie ) + self._morsel_cache: DefaultDict[Tuple[str, str], Dict[str, Morsel[str]]] = ( + defaultdict(dict) + ) self._host_only_cookies: Set[Tuple[str, str]] = set() self._unsafe = unsafe self._quote_cookie = quote_cookie @@ -100,7 +113,7 @@ def __init__( for url in treat_as_secure_origin ] self._treat_as_secure_origin = treat_as_secure_origin - self._next_expiration: float = ceil(time.time()) + self._expire_heap: List[Tuple[float, Tuple[str, str, str]]] = [] self._expirations: Dict[Tuple[str, str, str], float] = {} def save(self, file_path: PathLike) -> None: @@ -115,34 +128,26 @@ def load(self, file_path: PathLike) -> None: def clear(self, predicate: Optional[ClearCookiePredicate] = None) -> None: if predicate is None: - self._next_expiration = ceil(time.time()) + self._expire_heap.clear() self._cookies.clear() + self._morsel_cache.clear() self._host_only_cookies.clear() self._expirations.clear() return - to_del = [] now = time.time() - for (domain, path), cookie in self._cookies.items(): - for name, morsel in cookie.items(): - key = (domain, path, name) - if ( - key in self._expirations and self._expirations[key] <= now - ) or predicate(morsel): - to_del.append(key) - - for domain, path, name in to_del: - self._host_only_cookies.discard((domain, name)) - key = (domain, path, name) - if key in self._expirations: - del self._expirations[(domain, path, name)] - self._cookies[(domain, path)].pop(name, None) - - self._next_expiration = ( - min(*self._expirations.values(), self.SUB_MAX_TIME) + 1 - if self._expirations - else self.MAX_TIME - ) + to_del = [ + key + for (domain, path), cookie in self._cookies.items() + for name, morsel in cookie.items() + if ( + (key := (domain, path, name)) in self._expirations + and self._expirations[key] <= now + ) + or predicate(morsel) + ] + if to_del: + self._delete_cookies(to_del) def clear_domain(self, domain: str) -> None: self.clear(lambda x: self._is_domain_match(domain, x["domain"])) @@ -153,14 +158,70 @@ def __iter__(self) -> "Iterator[Morsel[str]]": yield from val.values() def __len__(self) -> int: - return sum(1 for i in self) + """Return number of cookies. + + This function does not iterate self to avoid unnecessary expiration + checks. + """ + return sum(len(cookie.values()) for cookie in self._cookies.values()) def _do_expiration(self) -> None: - self.clear(lambda x: False) + """Remove expired cookies.""" + if not (expire_heap_len := len(self._expire_heap)): + return + + # If the expiration heap grows larger than the number expirations + # times two, we clean it up to avoid keeping expired entries in + # the heap and consuming memory. We guard this with a minimum + # threshold to avoid cleaning up the heap too often when there are + # only a few scheduled expirations. + if ( + expire_heap_len > _MIN_SCHEDULED_COOKIE_EXPIRATION + and expire_heap_len > len(self._expirations) * 2 + ): + # Remove any expired entries from the expiration heap + # that do not match the expiration time in the expirations + # as it means the cookie has been re-added to the heap + # with a different expiration time. + self._expire_heap = [ + entry + for entry in self._expire_heap + if self._expirations.get(entry[1]) == entry[0] + ] + heapq.heapify(self._expire_heap) + + now = time.time() + to_del: List[Tuple[str, str, str]] = [] + # Find any expired cookies and add them to the to-delete list + while self._expire_heap: + when, cookie_key = self._expire_heap[0] + if when > now: + break + heapq.heappop(self._expire_heap) + # Check if the cookie hasn't been re-added to the heap + # with a different expiration time as it will be removed + # later when it reaches the top of the heap and its + # expiration time is met. + if self._expirations.get(cookie_key) == when: + to_del.append(cookie_key) + + if to_del: + self._delete_cookies(to_del) + + def _delete_cookies(self, to_del: List[Tuple[str, str, str]]) -> None: + for domain, path, name in to_del: + self._host_only_cookies.discard((domain, name)) + self._cookies[(domain, path)].pop(name, None) + self._morsel_cache[(domain, path)].pop(name, None) + self._expirations.pop((domain, path, name), None) def _expire_cookie(self, when: float, domain: str, path: str, name: str) -> None: - self._next_expiration = min(self._next_expiration, when) - self._expirations[(domain, path, name)] = when + cookie_key = (domain, path, name) + if self._expirations.get(cookie_key) == when: + # Avoid adding duplicates to the heap + return + heapq.heappush(self._expire_heap, (when, cookie_key)) + self._expirations[cookie_key] = when def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> None: """Update cookies.""" @@ -182,7 +243,7 @@ def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> No domain = cookie["domain"] # ignore domains with trailing dots - if domain.endswith("."): + if domain and domain[-1] == ".": domain = "" del cookie["domain"] @@ -192,7 +253,7 @@ def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> No self._host_only_cookies.add((hostname, name)) domain = cookie["domain"] = hostname - if domain.startswith("."): + if domain and domain[0] == ".": # Remove leading dot domain = domain[1:] cookie["domain"] = domain @@ -202,7 +263,7 @@ def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> No continue path = cookie["path"] - if not path or not path.startswith("/"): + if not path or path[0] != "/": # Set the cookie's path to the response path path = response_url.path if not path.startswith("/"): @@ -211,9 +272,9 @@ def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> No # Cut everything from the last slash to the end path = "/" + path[1 : path.rfind("/")] cookie["path"] = path + path = path.rstrip("/") - max_age = cookie["max-age"] - if max_age: + if max_age := cookie["max-age"]: try: delta_seconds = int(max_age) max_age_expiration = min(time.time() + delta_seconds, self.MAX_TIME) @@ -221,16 +282,18 @@ def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> No except ValueError: cookie["max-age"] = "" - else: - expires = cookie["expires"] - if expires: - expire_time = self._parse_date(expires) - if expire_time: - self._expire_cookie(expire_time, domain, path, name) - else: - cookie["expires"] = "" + elif expires := cookie["expires"]: + if expire_time := self._parse_date(expires): + self._expire_cookie(expire_time, domain, path, name) + else: + cookie["expires"] = "" - self._cookies[(domain, path)][name] = cookie + key = (domain, path) + if self._cookies[key].get(name) != cookie: + # Don't blow away the cache if the same + # cookie gets set again + self._cookies[key][name] = cookie + self._morsel_cache[key].pop(name, None) self._do_expiration() @@ -256,36 +319,52 @@ def filter_cookies(self, request_url: URL = URL()) -> "BaseCookie[str]": request_origin = request_url.origin() is_not_secure = request_origin not in self._treat_as_secure_origin - # Point 2: https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4 - for cookie in sorted(self, key=lambda c: len(c["path"])): - name = cookie.key - domain = cookie["domain"] + # Send shared cookie + for c in self._cookies[("", "")].values(): + filtered[c.key] = c.value - # Send shared cookies - if not domain: - filtered[name] = cookie.value - continue + if is_ip_address(hostname): + if not self._unsafe: + return filtered + domains: Iterable[str] = (hostname,) + else: + # Get all the subdomains that might match a cookie (e.g. "foo.bar.com", "bar.com", "com") + domains = itertools.accumulate( + reversed(hostname.split(".")), _FORMAT_DOMAIN_REVERSED + ) - if not self._unsafe and is_ip_address(hostname): - continue + # Get all the path prefixes that might match a cookie (e.g. "", "/foo", "/foo/bar") + paths = itertools.accumulate(request_url.path.split("/"), _FORMAT_PATH) + # Create every combination of (domain, path) pairs. + pairs = itertools.product(domains, paths) - if (domain, name) in self._host_only_cookies: - if domain != hostname: + path_len = len(request_url.path) + # Point 2: https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4 + for p in pairs: + for name, cookie in self._cookies[p].items(): + domain = cookie["domain"] + + if (domain, name) in self._host_only_cookies and domain != hostname: continue - elif not self._is_domain_match(domain, hostname): - continue - if not self._is_path_match(request_url.path, cookie["path"]): - continue + # Skip edge case when the cookie has a trailing slash but request doesn't. + if len(cookie["path"]) > path_len: + continue - if is_not_secure and cookie["secure"]: - continue + if is_not_secure and cookie["secure"]: + continue + + # We already built the Morsel so reuse it here + if name in self._morsel_cache[p]: + filtered[name] = self._morsel_cache[p][name] + continue - # It's critical we use the Morsel so the coded_value - # (based on cookie version) is preserved - mrsl_val = cast("Morsel[str]", cookie.get(cookie.key, Morsel())) - mrsl_val.set(cookie.key, cookie.value, cookie.coded_value) - filtered[name] = mrsl_val + # It's critical we use the Morsel so the coded_value + # (based on cookie version) is preserved + mrsl_val = cast("Morsel[str]", cookie.get(cookie.key, Morsel())) + mrsl_val.set(cookie.key, cookie.value, cookie.coded_value) + self._morsel_cache[p][name] = mrsl_val + filtered[name] = mrsl_val return filtered @@ -305,25 +384,6 @@ def _is_domain_match(domain: str, hostname: str) -> bool: return not is_ip_address(hostname) - @staticmethod - def _is_path_match(req_path: str, cookie_path: str) -> bool: - """Implements path matching adhering to RFC 6265.""" - if not req_path.startswith("/"): - req_path = "/" - - if req_path == cookie_path: - return True - - if not req_path.startswith(cookie_path): - return False - - if cookie_path.endswith("/"): - return True - - non_matching = req_path[len(cookie_path) :] - - return non_matching.startswith("/") - @classmethod def _parse_date(cls, date_str: str) -> Optional[int]: """Implements date string parsing adhering to RFC 6265.""" diff --git a/contrib/python/aiohttp/aiohttp/helpers.py b/contrib/python/aiohttp/aiohttp/helpers.py index 284033b7a044..40705b16d714 100644 --- a/contrib/python/aiohttp/aiohttp/helpers.py +++ b/contrib/python/aiohttp/aiohttp/helpers.py @@ -14,7 +14,6 @@ import re import sys import time -import warnings import weakref from collections import namedtuple from contextlib import suppress @@ -35,7 +34,6 @@ List, Mapping, Optional, - Pattern, Protocol, Tuple, Type, @@ -52,7 +50,7 @@ from yarl import URL from . import hdrs -from .log import client_logger, internal_logger +from .log import client_logger if sys.version_info >= (3, 11): import asyncio as async_timeout @@ -165,9 +163,9 @@ def from_url(cls, url: URL, *, encoding: str = "latin1") -> Optional["BasicAuth" """Create BasicAuth from url.""" if not isinstance(url, URL): raise TypeError("url should be yarl.URL instance") - if url.user is None: + if url.user is None and url.password is None: return None - return cls(url.user, url.password or "", encoding=encoding) + return cls(url.user or "", url.password or "", encoding=encoding) def encode(self) -> str: """Encode credentials.""" @@ -287,38 +285,6 @@ def proxies_from_env() -> Dict[str, ProxyInfo]: return ret -def current_task( - loop: Optional[asyncio.AbstractEventLoop] = None, -) -> "Optional[asyncio.Task[Any]]": - return asyncio.current_task(loop=loop) - - -def get_running_loop( - loop: Optional[asyncio.AbstractEventLoop] = None, -) -> asyncio.AbstractEventLoop: - if loop is None: - loop = asyncio.get_event_loop() - if not loop.is_running(): - warnings.warn( - "The object should be created within an async function", - DeprecationWarning, - stacklevel=3, - ) - if loop.get_debug(): - internal_logger.warning( - "The object should be created within an async function", stack_info=True - ) - return loop - - -def isasyncgenfunction(obj: Any) -> bool: - func = getattr(inspect, "isasyncgenfunction", None) - if func is not None: - return func(obj) # type: ignore[no-any-return] - else: - return False - - def get_env_proxy_for_url(url: URL) -> Tuple[URL, Optional[BasicAuth]]: """Get a permitted proxy for the given URL from the env.""" if url.host is not None and proxy_bypass(url.host): @@ -504,44 +470,51 @@ def __set__(self, inst: _TSelf[_T], value: _T) -> None: except ImportError: pass -_ipv4_pattern = ( - r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}" - r"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" -) -_ipv6_pattern = ( - r"^(?:(?:(?:[A-F0-9]{1,4}:){6}|(?=(?:[A-F0-9]{0,4}:){0,6}" - r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}$)(([0-9A-F]{1,4}:){0,5}|:)" - r"((:[0-9A-F]{1,4}){1,5}:|:)|::(?:[A-F0-9]{1,4}:){5})" - r"(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}" - r"(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])|(?:[A-F0-9]{1,4}:){7}" - r"[A-F0-9]{1,4}|(?=(?:[A-F0-9]{0,4}:){0,7}[A-F0-9]{0,4}$)" - r"(([0-9A-F]{1,4}:){1,7}|:)((:[0-9A-F]{1,4}){1,7}|:)|(?:[A-F0-9]{1,4}:){7}" - r":|:(:[A-F0-9]{1,4}){7})$" -) -_ipv4_regex = re.compile(_ipv4_pattern) -_ipv6_regex = re.compile(_ipv6_pattern, flags=re.IGNORECASE) -_ipv4_regexb = re.compile(_ipv4_pattern.encode("ascii")) -_ipv6_regexb = re.compile(_ipv6_pattern.encode("ascii"), flags=re.IGNORECASE) +def is_ipv4_address(host: Optional[Union[str, bytes]]) -> bool: + """Check if host looks like an IPv4 address. -def _is_ip_address( - regex: Pattern[str], regexb: Pattern[bytes], host: Optional[Union[str, bytes]] -) -> bool: - if host is None: + This function does not validate that the format is correct, only that + the host is a str or bytes, and its all numeric. + + This check is only meant as a heuristic to ensure that + a host is not a domain name. + """ + if not host: return False + # For a host to be an ipv4 address, it must be all numeric. if isinstance(host, str): - return bool(regex.match(host)) - elif isinstance(host, (bytes, bytearray, memoryview)): - return bool(regexb.match(host)) - else: - raise TypeError(f"{host} [{type(host)}] is not a str or bytes") + return host.replace(".", "").isdigit() + if isinstance(host, (bytes, bytearray, memoryview)): + return host.decode("ascii").replace(".", "").isdigit() + raise TypeError(f"{host} [{type(host)}] is not a str or bytes") + +def is_ipv6_address(host: Optional[Union[str, bytes]]) -> bool: + """Check if host looks like an IPv6 address. -is_ipv4_address = functools.partial(_is_ip_address, _ipv4_regex, _ipv4_regexb) -is_ipv6_address = functools.partial(_is_ip_address, _ipv6_regex, _ipv6_regexb) + This function does not validate that the format is correct, only that + the host contains a colon and that it is a str or bytes. + + This check is only meant as a heuristic to ensure that + a host is not a domain name. + """ + if not host: + return False + # The host must contain a colon to be an IPv6 address. + if isinstance(host, str): + return ":" in host + if isinstance(host, (bytes, bytearray, memoryview)): + return b":" in host + raise TypeError(f"{host} [{type(host)}] is not a str or bytes") def is_ip_address(host: Optional[Union[str, bytes, bytearray, memoryview]]) -> bool: + """Check if host looks like an IP Address. + + This check is only meant as a heuristic to ensure that + a host is not a domain name. + """ return is_ipv4_address(host) or is_ipv6_address(host) @@ -619,12 +592,23 @@ def call_later( loop: asyncio.AbstractEventLoop, timeout_ceil_threshold: float = 5, ) -> Optional[asyncio.TimerHandle]: - if timeout is not None and timeout > 0: - when = loop.time() + timeout - if timeout > timeout_ceil_threshold: - when = ceil(when) - return loop.call_at(when, cb) - return None + if timeout is None or timeout <= 0: + return None + now = loop.time() + when = calculate_timeout_when(now, timeout, timeout_ceil_threshold) + return loop.call_at(when, cb) + + +def calculate_timeout_when( + loop_time: float, + timeout: float, + timeout_ceiling_threshold: float, +) -> float: + """Calculate when to execute a timeout.""" + when = loop_time + timeout + if timeout > timeout_ceiling_threshold: + return ceil(when) + return when class TimeoutHandle: @@ -651,7 +635,7 @@ def register( def close(self) -> None: self._callbacks.clear() - def start(self) -> Optional[asyncio.Handle]: + def start(self) -> Optional[asyncio.TimerHandle]: timeout = self._timeout if timeout is not None and timeout > 0: when = self._loop.time() + timeout @@ -709,7 +693,7 @@ def assert_timeout(self) -> None: raise asyncio.TimeoutError from None def __enter__(self) -> BaseTimerContext: - task = current_task(loop=self._loop) + task = asyncio.current_task(loop=self._loop) if task is None: raise RuntimeError( @@ -749,7 +733,7 @@ def ceil_timeout( if delay is None or delay <= 0: return async_timeout.timeout(None) - loop = get_running_loop() + loop = asyncio.get_running_loop() now = loop.time() when = now + delay if delay > ceil_threshold: @@ -784,7 +768,8 @@ def content_type(self) -> str: raw = self._headers.get(hdrs.CONTENT_TYPE) if self._stored_content_type != raw: self._parse_content_type(raw) - return self._content_type # type: ignore[return-value] + assert self._content_type is not None + return self._content_type @property def charset(self) -> Optional[str]: @@ -792,7 +777,8 @@ def charset(self) -> Optional[str]: raw = self._headers.get(hdrs.CONTENT_TYPE) if self._stored_content_type != raw: self._parse_content_type(raw) - return self._content_dict.get("charset") # type: ignore[union-attr] + assert self._content_dict is not None + return self._content_dict.get("charset") @property def content_length(self) -> Optional[int]: @@ -818,8 +804,7 @@ def set_exception( self, exc: BaseException, exc_cause: BaseException = ..., - ) -> None: - ... # pragma: no cover + ) -> None: ... # pragma: no cover def set_exception( @@ -905,12 +890,10 @@ def __init_subclass__(cls) -> None: ) @overload # type: ignore[override] - def __getitem__(self, key: AppKey[_T]) -> _T: - ... + def __getitem__(self, key: AppKey[_T]) -> _T: ... @overload - def __getitem__(self, key: str) -> Any: - ... + def __getitem__(self, key: str) -> Any: ... def __getitem__(self, key: Union[str, AppKey[_T]]) -> Any: for mapping in self._maps: @@ -921,16 +904,13 @@ def __getitem__(self, key: Union[str, AppKey[_T]]) -> Any: raise KeyError(key) @overload # type: ignore[override] - def get(self, key: AppKey[_T], default: _S) -> Union[_T, _S]: - ... + def get(self, key: AppKey[_T], default: _S) -> Union[_T, _S]: ... @overload - def get(self, key: AppKey[_T], default: None = ...) -> Optional[_T]: - ... + def get(self, key: AppKey[_T], default: None = ...) -> Optional[_T]: ... @overload - def get(self, key: str, default: Any = ...) -> Any: - ... + def get(self, key: str, default: Any = ...) -> Any: ... def get(self, key: Union[str, AppKey[_T]], default: Any = None) -> Any: try: @@ -993,6 +973,7 @@ def parse_http_date(date_str: Optional[str]) -> Optional[datetime.datetime]: return None +@functools.lru_cache def must_be_empty_body(method: str, code: int) -> bool: """Check if a request must return an empty body.""" return ( diff --git a/contrib/python/aiohttp/aiohttp/http_exceptions.py b/contrib/python/aiohttp/aiohttp/http_exceptions.py index 72eac3a3cac4..c43ee0d96594 100644 --- a/contrib/python/aiohttp/aiohttp/http_exceptions.py +++ b/contrib/python/aiohttp/aiohttp/http_exceptions.py @@ -1,6 +1,5 @@ """Low-level http related exceptions.""" - from textwrap import indent from typing import Optional, Union diff --git a/contrib/python/aiohttp/aiohttp/http_parser.py b/contrib/python/aiohttp/aiohttp/http_parser.py index 013511917e8a..686a2d02e283 100644 --- a/contrib/python/aiohttp/aiohttp/http_parser.py +++ b/contrib/python/aiohttp/aiohttp/http_parser.py @@ -47,7 +47,6 @@ TransferEncodingError, ) from .http_writer import HttpVersion, HttpVersion10 -from .log import internal_logger from .streams import EMPTY_PAYLOAD, StreamReader from .typedefs import RawHeaders @@ -249,7 +248,6 @@ def __init__( timer: Optional[BaseTimerContext] = None, code: Optional[int] = None, method: Optional[str] = None, - readall: bool = False, payload_exception: Optional[Type[BaseException]] = None, response_with_body: bool = True, read_until_eof: bool = False, @@ -263,7 +261,6 @@ def __init__( self.timer = timer self.code = code self.method = method - self.readall = readall self.payload_exception = payload_exception self.response_with_body = response_with_body self.read_until_eof = read_until_eof @@ -280,8 +277,10 @@ def __init__( ) @abc.abstractmethod - def parse_message(self, lines: List[bytes]) -> _MsgT: - pass + def parse_message(self, lines: List[bytes]) -> _MsgT: ... + + @abc.abstractmethod + def _is_chunked_te(self, te: str) -> bool: ... def feed_eof(self) -> Optional[_MsgT]: if self._payload_parser is not None: @@ -318,6 +317,7 @@ def feed_data( start_pos = 0 loop = self.loop + should_close = False while start_pos < data_len: # read HTTP message (request/response line + headers), \r\n\r\n @@ -330,6 +330,9 @@ def feed_data( continue if pos >= start_pos: + if should_close: + raise BadHttpMessage("Data after `Connection: close`") + # line found line = data[start_pos:pos] if SEP == b"\n": # For lax response parsing @@ -393,7 +396,6 @@ def get_content_length() -> Optional[int]: method=method, compression=msg.compression, code=self.code, - readall=self.readall, response_with_body=self.response_with_body, auto_decompress=self._auto_decompress, lax=self.lax, @@ -413,7 +415,6 @@ def get_content_length() -> Optional[int]: payload, method=msg.method, compression=msg.compression, - readall=True, auto_decompress=self._auto_decompress, lax=self.lax, ) @@ -431,7 +432,6 @@ def get_content_length() -> Optional[int]: method=method, compression=msg.compression, code=self.code, - readall=True, response_with_body=self.response_with_body, auto_decompress=self._auto_decompress, lax=self.lax, @@ -442,6 +442,7 @@ def get_content_length() -> Optional[int]: payload = EMPTY_PAYLOAD messages.append((msg, payload)) + should_close = msg.should_close else: self._tail = data[start_pos:] data = EMPTY @@ -543,10 +544,8 @@ def parse_headers( # chunking te = headers.get(hdrs.TRANSFER_ENCODING) if te is not None: - if "chunked" == te.lower(): + if self._is_chunked_te(te): chunked = True - else: - raise BadHttpMessage("Request has invalid `Transfer-Encoding`") if hdrs.CONTENT_LENGTH in headers: raise BadHttpMessage( @@ -656,6 +655,12 @@ def parse_message(self, lines: List[bytes]) -> RawRequestMessage: url, ) + def _is_chunked_te(self, te: str) -> bool: + if te.rsplit(",", maxsplit=1)[-1].strip(" \t").lower() == "chunked": + return True + # https://www.rfc-editor.org/rfc/rfc9112#section-6.3-2.4.3 + raise BadHttpMessage("Request has invalid `Transfer-Encoding`") + class HttpResponseParser(HttpParser[RawResponseMessage]): """Read response status line and headers. @@ -741,6 +746,10 @@ def parse_message(self, lines: List[bytes]) -> RawResponseMessage: chunked, ) + def _is_chunked_te(self, te: str) -> bool: + # https://www.rfc-editor.org/rfc/rfc9112#section-6.3-2.4.2 + return te.rsplit(",", maxsplit=1)[-1].strip(" \t").lower() == "chunked" + class HttpPayloadParser: def __init__( @@ -751,13 +760,12 @@ def __init__( compression: Optional[str] = None, code: Optional[int] = None, method: Optional[str] = None, - readall: bool = False, response_with_body: bool = True, auto_decompress: bool = True, lax: bool = False, ) -> None: self._length = 0 - self._type = ParseState.PARSE_NONE + self._type = ParseState.PARSE_UNTIL_EOF self._chunk = ChunkState.PARSE_CHUNKED_SIZE self._chunk_size = 0 self._chunk_tail = b"" @@ -779,7 +787,6 @@ def __init__( self._type = ParseState.PARSE_NONE real_payload.feed_eof() self.done = True - elif chunked: self._type = ParseState.PARSE_CHUNKED elif length is not None: @@ -788,16 +795,6 @@ def __init__( if self._length == 0: real_payload.feed_eof() self.done = True - else: - if readall and code != 204: - self._type = ParseState.PARSE_UNTIL_EOF - elif method in ("PUT", "POST"): - internal_logger.warning( # pragma: no cover - "Content-Length or Transfer-Encoding header is required" - ) - self._type = ParseState.PARSE_NONE - real_payload.feed_eof() - self.done = True self.payload = real_payload @@ -888,13 +885,13 @@ def feed_data( self._chunk_size = 0 self.payload.feed_data(chunk[:required], required) chunk = chunk[required:] - if self._lax and chunk.startswith(b"\r"): - chunk = chunk[1:] self._chunk = ChunkState.PARSE_CHUNKED_CHUNK_EOF self.payload.end_http_chunk_receiving() # toss the CRLF at the end of the chunk if self._chunk == ChunkState.PARSE_CHUNKED_CHUNK_EOF: + if self._lax and chunk.startswith(b"\r"): + chunk = chunk[1:] if chunk[: len(SEP)] == SEP: chunk = chunk[len(SEP) :] self._chunk = ChunkState.PARSE_CHUNKED_SIZE diff --git a/contrib/python/aiohttp/aiohttp/http_websocket.py b/contrib/python/aiohttp/aiohttp/http_websocket.py index 39f2e4a5c15d..fb00ebc7d35d 100644 --- a/contrib/python/aiohttp/aiohttp/http_websocket.py +++ b/contrib/python/aiohttp/aiohttp/http_websocket.py @@ -8,6 +8,7 @@ import sys import zlib from enum import IntEnum +from functools import partial from struct import Struct from typing import ( Any, @@ -24,6 +25,7 @@ ) from .base_protocol import BaseProtocol +from .client_exceptions import ClientConnectionResetError from .compression_utils import ZLibCompressor, ZLibDecompressor from .helpers import NO_EXTENSIONS, set_exception from .streams import DataQueue @@ -93,6 +95,14 @@ class WSMsgType(IntEnum): error = ERROR +MESSAGE_TYPES_WITH_CONTENT: Final = frozenset( + { + WSMsgType.BINARY, + WSMsgType.TEXT, + WSMsgType.CONTINUATION, + } +) + WS_KEY: Final[bytes] = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11" @@ -103,8 +113,10 @@ class WSMsgType(IntEnum): PACK_LEN2 = Struct("!BBH").pack PACK_LEN3 = Struct("!BBQ").pack PACK_CLOSE_CODE = Struct("!H").pack +PACK_RANDBITS = Struct("!L").pack MSG_SIZE: Final[int] = 2**14 DEFAULT_LIMIT: Final[int] = 2**16 +MASK_LEN: Final[int] = 4 class WSMessage(NamedTuple): @@ -294,7 +306,7 @@ def __init__( self._frame_opcode: Optional[int] = None self._frame_payload = bytearray() - self._tail = b"" + self._tail: bytes = b"" self._has_mask = False self._frame_mask: Optional[bytes] = None self._payload_length = 0 @@ -311,17 +323,101 @@ def feed_data(self, data: bytes) -> Tuple[bool, bytes]: return True, data try: - return self._feed_data(data) + self._feed_data(data) except Exception as exc: self._exc = exc set_exception(self.queue, exc) return True, b"" - def _feed_data(self, data: bytes) -> Tuple[bool, bytes]: + return False, b"" + + def _feed_data(self, data: bytes) -> None: for fin, opcode, payload, compressed in self.parse_frame(data): - if compressed and not self._decompressobj: - self._decompressobj = ZLibDecompressor(suppress_deflate_header=True) - if opcode == WSMsgType.CLOSE: + if opcode in MESSAGE_TYPES_WITH_CONTENT: + # load text/binary + is_continuation = opcode == WSMsgType.CONTINUATION + if not fin: + # got partial frame payload + if not is_continuation: + self._opcode = opcode + self._partial += payload + if self._max_msg_size and len(self._partial) >= self._max_msg_size: + raise WebSocketError( + WSCloseCode.MESSAGE_TOO_BIG, + "Message size {} exceeds limit {}".format( + len(self._partial), self._max_msg_size + ), + ) + continue + + has_partial = bool(self._partial) + if is_continuation: + if self._opcode is None: + raise WebSocketError( + WSCloseCode.PROTOCOL_ERROR, + "Continuation frame for non started message", + ) + opcode = self._opcode + self._opcode = None + # previous frame was non finished + # we should get continuation opcode + elif has_partial: + raise WebSocketError( + WSCloseCode.PROTOCOL_ERROR, + "The opcode in non-fin frame is expected " + "to be zero, got {!r}".format(opcode), + ) + + if has_partial: + assembled_payload = self._partial + payload + self._partial.clear() + else: + assembled_payload = payload + + if self._max_msg_size and len(assembled_payload) >= self._max_msg_size: + raise WebSocketError( + WSCloseCode.MESSAGE_TOO_BIG, + "Message size {} exceeds limit {}".format( + len(assembled_payload), self._max_msg_size + ), + ) + + # Decompress process must to be done after all packets + # received. + if compressed: + if not self._decompressobj: + self._decompressobj = ZLibDecompressor( + suppress_deflate_header=True + ) + payload_merged = self._decompressobj.decompress_sync( + assembled_payload + _WS_DEFLATE_TRAILING, self._max_msg_size + ) + if self._decompressobj.unconsumed_tail: + left = len(self._decompressobj.unconsumed_tail) + raise WebSocketError( + WSCloseCode.MESSAGE_TOO_BIG, + "Decompressed message size {} exceeds limit {}".format( + self._max_msg_size + left, self._max_msg_size + ), + ) + else: + payload_merged = bytes(assembled_payload) + + if opcode == WSMsgType.TEXT: + try: + text = payload_merged.decode("utf-8") + except UnicodeDecodeError as exc: + raise WebSocketError( + WSCloseCode.INVALID_TEXT, "Invalid UTF-8 text message" + ) from exc + + self.queue.feed_data(WSMessage(WSMsgType.TEXT, text, ""), len(text)) + continue + + self.queue.feed_data( + WSMessage(WSMsgType.BINARY, payload_merged, ""), len(payload_merged) + ) + elif opcode == WSMsgType.CLOSE: if len(payload) >= 2: close_code = UNPACK_CLOSE_CODE(payload[:2])[0] if close_code < 3000 and close_code not in ALLOWED_CLOSE_CODES: @@ -356,241 +452,145 @@ def _feed_data(self, data: bytes) -> Tuple[bool, bytes]: WSMessage(WSMsgType.PONG, payload, ""), len(payload) ) - elif ( - opcode not in (WSMsgType.TEXT, WSMsgType.BINARY) - and self._opcode is None - ): + else: raise WebSocketError( WSCloseCode.PROTOCOL_ERROR, f"Unexpected opcode={opcode!r}" ) - else: - # load text/binary - if not fin: - # got partial frame payload - if opcode != WSMsgType.CONTINUATION: - self._opcode = opcode - self._partial.extend(payload) - if self._max_msg_size and len(self._partial) >= self._max_msg_size: - raise WebSocketError( - WSCloseCode.MESSAGE_TOO_BIG, - "Message size {} exceeds limit {}".format( - len(self._partial), self._max_msg_size - ), - ) - else: - # previous frame was non finished - # we should get continuation opcode - if self._partial: - if opcode != WSMsgType.CONTINUATION: - raise WebSocketError( - WSCloseCode.PROTOCOL_ERROR, - "The opcode in non-fin frame is expected " - "to be zero, got {!r}".format(opcode), - ) - - if opcode == WSMsgType.CONTINUATION: - assert self._opcode is not None - opcode = self._opcode - self._opcode = None - - self._partial.extend(payload) - if self._max_msg_size and len(self._partial) >= self._max_msg_size: - raise WebSocketError( - WSCloseCode.MESSAGE_TOO_BIG, - "Message size {} exceeds limit {}".format( - len(self._partial), self._max_msg_size - ), - ) - - # Decompress process must to be done after all packets - # received. - if compressed: - assert self._decompressobj is not None - self._partial.extend(_WS_DEFLATE_TRAILING) - payload_merged = self._decompressobj.decompress_sync( - self._partial, self._max_msg_size - ) - if self._decompressobj.unconsumed_tail: - left = len(self._decompressobj.unconsumed_tail) - raise WebSocketError( - WSCloseCode.MESSAGE_TOO_BIG, - "Decompressed message size {} exceeds limit {}".format( - self._max_msg_size + left, self._max_msg_size - ), - ) - else: - payload_merged = bytes(self._partial) - - self._partial.clear() - - if opcode == WSMsgType.TEXT: - try: - text = payload_merged.decode("utf-8") - self.queue.feed_data( - WSMessage(WSMsgType.TEXT, text, ""), len(text) - ) - except UnicodeDecodeError as exc: - raise WebSocketError( - WSCloseCode.INVALID_TEXT, "Invalid UTF-8 text message" - ) from exc - else: - self.queue.feed_data( - WSMessage(WSMsgType.BINARY, payload_merged, ""), - len(payload_merged), - ) - - return False, b"" def parse_frame( self, buf: bytes ) -> List[Tuple[bool, Optional[int], bytearray, Optional[bool]]]: """Return the next frame from the socket.""" - frames = [] + frames: List[Tuple[bool, Optional[int], bytearray, Optional[bool]]] = [] if self._tail: buf, self._tail = self._tail + buf, b"" - start_pos = 0 + start_pos: int = 0 buf_length = len(buf) while True: # read header - if self._state == WSParserState.READ_HEADER: - if buf_length - start_pos >= 2: - data = buf[start_pos : start_pos + 2] - start_pos += 2 - first_byte, second_byte = data - - fin = (first_byte >> 7) & 1 - rsv1 = (first_byte >> 6) & 1 - rsv2 = (first_byte >> 5) & 1 - rsv3 = (first_byte >> 4) & 1 - opcode = first_byte & 0xF - - # frame-fin = %x0 ; more frames of this message follow - # / %x1 ; final frame of this message - # frame-rsv1 = %x0 ; - # 1 bit, MUST be 0 unless negotiated otherwise - # frame-rsv2 = %x0 ; - # 1 bit, MUST be 0 unless negotiated otherwise - # frame-rsv3 = %x0 ; - # 1 bit, MUST be 0 unless negotiated otherwise - # - # Remove rsv1 from this test for deflate development - if rsv2 or rsv3 or (rsv1 and not self._compress): - raise WebSocketError( - WSCloseCode.PROTOCOL_ERROR, - "Received frame with non-zero reserved bits", - ) + if self._state is WSParserState.READ_HEADER: + if buf_length - start_pos < 2: + break + data = buf[start_pos : start_pos + 2] + start_pos += 2 + first_byte, second_byte = data + + fin = (first_byte >> 7) & 1 + rsv1 = (first_byte >> 6) & 1 + rsv2 = (first_byte >> 5) & 1 + rsv3 = (first_byte >> 4) & 1 + opcode = first_byte & 0xF + + # frame-fin = %x0 ; more frames of this message follow + # / %x1 ; final frame of this message + # frame-rsv1 = %x0 ; + # 1 bit, MUST be 0 unless negotiated otherwise + # frame-rsv2 = %x0 ; + # 1 bit, MUST be 0 unless negotiated otherwise + # frame-rsv3 = %x0 ; + # 1 bit, MUST be 0 unless negotiated otherwise + # + # Remove rsv1 from this test for deflate development + if rsv2 or rsv3 or (rsv1 and not self._compress): + raise WebSocketError( + WSCloseCode.PROTOCOL_ERROR, + "Received frame with non-zero reserved bits", + ) - if opcode > 0x7 and fin == 0: - raise WebSocketError( - WSCloseCode.PROTOCOL_ERROR, - "Received fragmented control frame", - ) + if opcode > 0x7 and fin == 0: + raise WebSocketError( + WSCloseCode.PROTOCOL_ERROR, + "Received fragmented control frame", + ) - has_mask = (second_byte >> 7) & 1 - length = second_byte & 0x7F + has_mask = (second_byte >> 7) & 1 + length = second_byte & 0x7F - # Control frames MUST have a payload - # length of 125 bytes or less - if opcode > 0x7 and length > 125: - raise WebSocketError( - WSCloseCode.PROTOCOL_ERROR, - "Control frame payload cannot be " "larger than 125 bytes", - ) + # Control frames MUST have a payload + # length of 125 bytes or less + if opcode > 0x7 and length > 125: + raise WebSocketError( + WSCloseCode.PROTOCOL_ERROR, + "Control frame payload cannot be " "larger than 125 bytes", + ) - # Set compress status if last package is FIN - # OR set compress status if this is first fragment - # Raise error if not first fragment with rsv1 = 0x1 - if self._frame_fin or self._compressed is None: - self._compressed = True if rsv1 else False - elif rsv1: - raise WebSocketError( - WSCloseCode.PROTOCOL_ERROR, - "Received frame with non-zero reserved bits", - ) + # Set compress status if last package is FIN + # OR set compress status if this is first fragment + # Raise error if not first fragment with rsv1 = 0x1 + if self._frame_fin or self._compressed is None: + self._compressed = True if rsv1 else False + elif rsv1: + raise WebSocketError( + WSCloseCode.PROTOCOL_ERROR, + "Received frame with non-zero reserved bits", + ) - self._frame_fin = bool(fin) - self._frame_opcode = opcode - self._has_mask = bool(has_mask) - self._payload_length_flag = length - self._state = WSParserState.READ_PAYLOAD_LENGTH - else: - break + self._frame_fin = bool(fin) + self._frame_opcode = opcode + self._has_mask = bool(has_mask) + self._payload_length_flag = length + self._state = WSParserState.READ_PAYLOAD_LENGTH # read payload length - if self._state == WSParserState.READ_PAYLOAD_LENGTH: - length = self._payload_length_flag - if length == 126: - if buf_length - start_pos >= 2: - data = buf[start_pos : start_pos + 2] - start_pos += 2 - length = UNPACK_LEN2(data)[0] - self._payload_length = length - self._state = ( - WSParserState.READ_PAYLOAD_MASK - if self._has_mask - else WSParserState.READ_PAYLOAD - ) - else: + if self._state is WSParserState.READ_PAYLOAD_LENGTH: + length_flag = self._payload_length_flag + if length_flag == 126: + if buf_length - start_pos < 2: break - elif length > 126: - if buf_length - start_pos >= 8: - data = buf[start_pos : start_pos + 8] - start_pos += 8 - length = UNPACK_LEN3(data)[0] - self._payload_length = length - self._state = ( - WSParserState.READ_PAYLOAD_MASK - if self._has_mask - else WSParserState.READ_PAYLOAD - ) - else: + data = buf[start_pos : start_pos + 2] + start_pos += 2 + self._payload_length = UNPACK_LEN2(data)[0] + elif length_flag > 126: + if buf_length - start_pos < 8: break + data = buf[start_pos : start_pos + 8] + start_pos += 8 + self._payload_length = UNPACK_LEN3(data)[0] else: - self._payload_length = length - self._state = ( - WSParserState.READ_PAYLOAD_MASK - if self._has_mask - else WSParserState.READ_PAYLOAD - ) + self._payload_length = length_flag + + self._state = ( + WSParserState.READ_PAYLOAD_MASK + if self._has_mask + else WSParserState.READ_PAYLOAD + ) # read payload mask - if self._state == WSParserState.READ_PAYLOAD_MASK: - if buf_length - start_pos >= 4: - self._frame_mask = buf[start_pos : start_pos + 4] - start_pos += 4 - self._state = WSParserState.READ_PAYLOAD - else: + if self._state is WSParserState.READ_PAYLOAD_MASK: + if buf_length - start_pos < 4: break + self._frame_mask = buf[start_pos : start_pos + 4] + start_pos += 4 + self._state = WSParserState.READ_PAYLOAD - if self._state == WSParserState.READ_PAYLOAD: + if self._state is WSParserState.READ_PAYLOAD: length = self._payload_length payload = self._frame_payload chunk_len = buf_length - start_pos if length >= chunk_len: self._payload_length = length - chunk_len - payload.extend(buf[start_pos:]) + payload += buf[start_pos:] start_pos = buf_length else: self._payload_length = 0 - payload.extend(buf[start_pos : start_pos + length]) + payload += buf[start_pos : start_pos + length] start_pos = start_pos + length - if self._payload_length == 0: - if self._has_mask: - assert self._frame_mask is not None - _websocket_mask(self._frame_mask, payload) + if self._payload_length != 0: + break - frames.append( - (self._frame_fin, self._frame_opcode, payload, self._compressed) - ) + if self._has_mask: + assert self._frame_mask is not None + _websocket_mask(self._frame_mask, payload) - self._frame_payload = bytearray() - self._state = WSParserState.READ_HEADER - else: - break + frames.append( + (self._frame_fin, self._frame_opcode, payload, self._compressed) + ) + self._frame_payload = bytearray() + self._state = WSParserState.READ_HEADER self._tail = buf[start_pos:] @@ -612,7 +612,7 @@ def __init__( self.protocol = protocol self.transport = transport self.use_mask = use_mask - self.randrange = random.randrange + self.get_random_bits = partial(random.getrandbits, 32) self.compress = compress self.notakeover = notakeover self._closing = False @@ -625,14 +625,20 @@ async def _send_frame( ) -> None: """Send a frame over the websocket with message as its payload.""" if self._closing and not (opcode & WSMsgType.CLOSE): - raise ConnectionResetError("Cannot write to closing transport") + raise ClientConnectionResetError("Cannot write to closing transport") + # RSV are the reserved bits in the frame header. They are used to + # indicate that the frame is using an extension. + # https://datatracker.ietf.org/doc/html/rfc6455#section-5.2 rsv = 0 - # Only compress larger packets (disabled) # Does small packet needs to be compressed? # if self.compress and opcode < 8 and len(message) > 124: if (compress or self.compress) and opcode < 8: + # RSV1 (rsv = 0x40) is set for compressed frames + # https://datatracker.ietf.org/doc/html/rfc7692#section-7.2.3.1 + rsv = 0x40 + if compress: # Do not set self._compress if compressing is for this frame compressobj = self._make_compress_obj(compress) @@ -651,29 +657,39 @@ async def _send_frame( ) if message.endswith(_WS_DEFLATE_TRAILING): message = message[:-4] - rsv = rsv | 0x40 msg_length = len(message) use_mask = self.use_mask - if use_mask: - mask_bit = 0x80 - else: - mask_bit = 0 + mask_bit = 0x80 if use_mask else 0 + # Depending on the message length, the header is assembled differently. + # The first byte is reserved for the opcode and the RSV bits. + first_byte = 0x80 | rsv | opcode if msg_length < 126: - header = PACK_LEN1(0x80 | rsv | opcode, msg_length | mask_bit) + header = PACK_LEN1(first_byte, msg_length | mask_bit) + header_len = 2 elif msg_length < (1 << 16): - header = PACK_LEN2(0x80 | rsv | opcode, 126 | mask_bit, msg_length) + header = PACK_LEN2(first_byte, 126 | mask_bit, msg_length) + header_len = 4 else: - header = PACK_LEN3(0x80 | rsv | opcode, 127 | mask_bit, msg_length) + header = PACK_LEN3(first_byte, 127 | mask_bit, msg_length) + header_len = 10 + + # https://datatracker.ietf.org/doc/html/rfc6455#section-5.3 + # If we are using a mask, we need to generate it randomly + # and apply it to the message before sending it. A mask is + # a 32-bit value that is applied to the message using a + # bitwise XOR operation. It is used to prevent certain types + # of attacks on the websocket protocol. The mask is only used + # when aiohttp is acting as a client. Servers do not use a mask. if use_mask: - mask_int = self.randrange(0, 0xFFFFFFFF) - mask = mask_int.to_bytes(4, "big") + mask = PACK_RANDBITS(self.get_random_bits()) message = bytearray(message) _websocket_mask(mask, message) self._write(header + mask + message) - self._output_size += len(header) + len(mask) + msg_length + self._output_size += header_len + MASK_LEN + msg_length + else: if msg_length > MSG_SIZE: self._write(header) @@ -681,11 +697,16 @@ async def _send_frame( else: self._write(header + message) - self._output_size += len(header) + msg_length + self._output_size += header_len + msg_length # It is safe to return control to the event loop when using compression # after this point as we have already sent or buffered all the data. + # Once we have written output_size up to the limit, we call the + # drain helper which waits for the transport to be ready to accept + # more data. This is a flow control mechanism to prevent the buffer + # from growing too large. The drain helper will return right away + # if the writer is not paused. if self._output_size > self._limit: self._output_size = 0 await self.protocol._drain_helper() @@ -699,7 +720,7 @@ def _make_compress_obj(self, compress: int) -> ZLibCompressor: def _write(self, data: bytes) -> None: if self.transport is None or self.transport.is_closing(): - raise ConnectionResetError("Cannot write to closing transport") + raise ClientConnectionResetError("Cannot write to closing transport") self.transport.write(data) async def pong(self, message: Union[bytes, str] = b"") -> None: diff --git a/contrib/python/aiohttp/aiohttp/http_writer.py b/contrib/python/aiohttp/aiohttp/http_writer.py index d6b02e6f566c..dc07a358c709 100644 --- a/contrib/python/aiohttp/aiohttp/http_writer.py +++ b/contrib/python/aiohttp/aiohttp/http_writer.py @@ -8,6 +8,7 @@ from .abc import AbstractStreamWriter from .base_protocol import BaseProtocol +from .client_exceptions import ClientConnectionResetError from .compression_utils import ZLibCompressor from .helpers import NO_EXTENSIONS @@ -70,9 +71,9 @@ def _write(self, chunk: bytes) -> None: size = len(chunk) self.buffer_size += size self.output_size += size - transport = self.transport - if not self._protocol.connected or transport is None or transport.is_closing(): - raise ConnectionResetError("Cannot write to closing transport") + transport = self._protocol.transport + if transport is None or transport.is_closing(): + raise ClientConnectionResetError("Cannot write to closing transport") transport.write(chunk) async def write( diff --git a/contrib/python/aiohttp/aiohttp/multipart.py b/contrib/python/aiohttp/aiohttp/multipart.py index 71fc2654a1c9..49c05c5af25c 100644 --- a/contrib/python/aiohttp/aiohttp/multipart.py +++ b/contrib/python/aiohttp/aiohttp/multipart.py @@ -2,6 +2,7 @@ import binascii import json import re +import sys import uuid import warnings import zlib @@ -10,7 +11,6 @@ from typing import ( TYPE_CHECKING, Any, - AsyncIterator, Deque, Dict, Iterator, @@ -48,6 +48,13 @@ ) from .streams import StreamReader +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing import TypeVar + + Self = TypeVar("Self", bound="BodyPartReader") + __all__ = ( "MultipartReader", "MultipartWriter", @@ -266,6 +273,7 @@ def __init__( ) -> None: self.headers = headers self._boundary = boundary + self._boundary_len = len(boundary) + 2 # Boundary + \r\n self._content = content self._default_charset = default_charset self._at_eof = False @@ -279,8 +287,8 @@ def __init__( self._content_eof = 0 self._cache: Dict[str, Any] = {} - def __aiter__(self) -> AsyncIterator["BodyPartReader"]: - return self # type: ignore[return-value] + def __aiter__(self: Self): + return self async def __anext__(self) -> bytes: part = await self.next() @@ -322,6 +330,31 @@ async def read_chunk(self, size: int = chunk_size) -> bytes: else: chunk = await self._read_chunk_from_stream(size) + # For the case of base64 data, we must read a fragment of size with a + # remainder of 0 by dividing by 4 for string without symbols \n or \r + encoding = self.headers.get(CONTENT_TRANSFER_ENCODING) + if encoding and encoding.lower() == "base64": + stripped_chunk = b"".join(chunk.split()) + remainder = len(stripped_chunk) % 4 + + while remainder != 0 and not self.at_eof(): + over_chunk_size = 4 - remainder + over_chunk = b"" + + if self._prev_chunk: + over_chunk = self._prev_chunk[:over_chunk_size] + self._prev_chunk = self._prev_chunk[len(over_chunk) :] + + if len(over_chunk) != over_chunk_size: + over_chunk += await self._content.read(4 - len(over_chunk)) + + if not over_chunk: + self._at_eof = True + + stripped_chunk += b"".join(over_chunk.split()) + chunk += over_chunk + remainder = len(stripped_chunk) % 4 + self._read_bytes += len(chunk) if self._read_bytes == self._length: self._at_eof = True @@ -346,15 +379,25 @@ async def _read_chunk_from_stream(self, size: int) -> bytes: # Reads content chunk of body part with unknown length. # The Content-Length header for body part is not necessary. assert ( - size >= len(self._boundary) + 2 + size >= self._boundary_len ), "Chunk size must be greater or equal than boundary length + 2" first_chunk = self._prev_chunk is None if first_chunk: self._prev_chunk = await self._content.read(size) - chunk = await self._content.read(size) - self._content_eof += int(self._content.at_eof()) - assert self._content_eof < 3, "Reading after EOF" + chunk = b"" + # content.read() may return less than size, so we need to loop to ensure + # we have enough data to detect the boundary. + while len(chunk) < self._boundary_len: + chunk += await self._content.read(size) + self._content_eof += int(self._content.at_eof()) + assert self._content_eof < 3, "Reading after EOF" + if self._content_eof: + break + if len(chunk) > size: + self._content.unread_data(chunk[size:]) + chunk = chunk[:size] + assert self._prev_chunk is not None window = self._prev_chunk + chunk sub = b"\r\n" + self._boundary @@ -518,6 +561,8 @@ def filename(self) -> Optional[str]: @payload_type(BodyPartReader, order=Order.try_first) class BodyPartReaderPayload(Payload): + _value: BodyPartReader + def __init__(self, value: BodyPartReader, *args: Any, **kwargs: Any) -> None: super().__init__(value, *args, **kwargs) @@ -530,6 +575,9 @@ def __init__(self, value: BodyPartReader, *args: Any, **kwargs: Any) -> None: if params: self.set_content_disposition("attachment", True, **params) + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + raise TypeError("Unable to decode.") + async def write(self, writer: Any) -> None: field = self._value chunk = await field.read_chunk(size=2**16) @@ -566,10 +614,8 @@ def __init__(self, headers: Mapping[str, str], content: StreamReader) -> None: self._at_bof = True self._unread: List[bytes] = [] - def __aiter__( - self, - ) -> AsyncIterator["BodyPartReader"]: - return self # type: ignore[return-value] + def __aiter__(self: Self): + return self async def __anext__( self, @@ -749,6 +795,8 @@ async def _maybe_release_last_part(self) -> None: class MultipartWriter(Payload): """Multipart body writer.""" + _value: None + def __init__(self, subtype: str = "mixed", boundary: Optional[str] = None) -> None: boundary = boundary if boundary is not None else uuid.uuid4().hex # The underlying Payload API demands a str (utf-8), not bytes, @@ -929,6 +977,16 @@ def size(self) -> Optional[int]: total += 2 + len(self._boundary) + 4 # b'--'+self._boundary+b'--\r\n' return total + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + return "".join( + "--" + + self.boundary + + "\n" + + part._binary_headers.decode(encoding, errors) + + part.decode() + for part, _e, _te in self._parts + ) + async def write(self, writer: Any, close_boundary: bool = True) -> None: """Write body.""" for part, encoding, te_encoding in self._parts: diff --git a/contrib/python/aiohttp/aiohttp/payload.py b/contrib/python/aiohttp/aiohttp/payload.py index 6593b05c6f7b..276369777741 100644 --- a/contrib/python/aiohttp/aiohttp/payload.py +++ b/contrib/python/aiohttp/aiohttp/payload.py @@ -11,7 +11,6 @@ IO, TYPE_CHECKING, Any, - ByteString, Dict, Final, Iterable, @@ -208,6 +207,13 @@ def set_content_disposition( disptype, quote_fields=quote_fields, _charset=_charset, **params ) + @abstractmethod + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + """Return string representation of the value. + + This is named decode() to allow compatibility with bytes objects. + """ + @abstractmethod async def write(self, writer: AbstractStreamWriter) -> None: """Write payload. @@ -217,7 +223,11 @@ async def write(self, writer: AbstractStreamWriter) -> None: class BytesPayload(Payload): - def __init__(self, value: ByteString, *args: Any, **kwargs: Any) -> None: + _value: bytes + + def __init__( + self, value: Union[bytes, bytearray, memoryview], *args: Any, **kwargs: Any + ) -> None: if not isinstance(value, (bytes, bytearray, memoryview)): raise TypeError(f"value argument must be byte-ish, not {type(value)!r}") @@ -241,6 +251,9 @@ def __init__(self, value: ByteString, *args: Any, **kwargs: Any) -> None: **kwargs, ) + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + return self._value.decode(encoding, errors) + async def write(self, writer: AbstractStreamWriter) -> None: await writer.write(self._value) @@ -282,7 +295,7 @@ def __init__(self, value: IO[str], *args: Any, **kwargs: Any) -> None: class IOBasePayload(Payload): - _value: IO[Any] + _value: io.IOBase def __init__( self, value: IO[Any], disposition: str = "attachment", *args: Any, **kwargs: Any @@ -306,9 +319,12 @@ async def write(self, writer: AbstractStreamWriter) -> None: finally: await loop.run_in_executor(None, self._value.close) + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + return "".join(r.decode(encoding, errors) for r in self._value.readlines()) + class TextIOPayload(IOBasePayload): - _value: TextIO + _value: io.TextIOBase def __init__( self, @@ -345,6 +361,9 @@ def size(self) -> Optional[int]: except OSError: return None + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + return self._value.read() + async def write(self, writer: AbstractStreamWriter) -> None: loop = asyncio.get_event_loop() try: @@ -362,6 +381,8 @@ async def write(self, writer: AbstractStreamWriter) -> None: class BytesIOPayload(IOBasePayload): + _value: io.BytesIO + @property def size(self) -> int: position = self._value.tell() @@ -369,17 +390,27 @@ def size(self) -> int: self._value.seek(position) return end - position + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + return self._value.read().decode(encoding, errors) + class BufferedReaderPayload(IOBasePayload): + _value: io.BufferedIOBase + @property def size(self) -> Optional[int]: try: return os.fstat(self._value.fileno()).st_size - self._value.tell() - except OSError: + except (OSError, AttributeError): # data.fileno() is not supported, e.g. # io.BufferedReader(io.BytesIO(b'data')) + # For some file-like objects (e.g. tarfile), the fileno() attribute may + # not exist at all, and will instead raise an AttributeError. return None + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + return self._value.read().decode(encoding, errors) + class JsonPayload(BytesPayload): def __init__( @@ -416,6 +447,7 @@ def __init__( class AsyncIterablePayload(Payload): _iter: Optional[_AsyncIterator] = None + _value: _AsyncIterable def __init__(self, value: _AsyncIterable, *args: Any, **kwargs: Any) -> None: if not isinstance(value, AsyncIterable): @@ -443,6 +475,9 @@ async def write(self, writer: AbstractStreamWriter) -> None: except StopAsyncIteration: self._iter = None + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + raise TypeError("Unable to decode.") + class StreamReaderPayload(AsyncIterablePayload): def __init__(self, value: StreamReader, *args: Any, **kwargs: Any) -> None: diff --git a/contrib/python/aiohttp/aiohttp/payload_streamer.py b/contrib/python/aiohttp/aiohttp/payload_streamer.py index 364f763ae741..831fdc0a77f3 100644 --- a/contrib/python/aiohttp/aiohttp/payload_streamer.py +++ b/contrib/python/aiohttp/aiohttp/payload_streamer.py @@ -65,6 +65,9 @@ class StreamWrapperPayload(Payload): async def write(self, writer: AbstractStreamWriter) -> None: await self._value(writer) + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: + raise TypeError("Unable to decode.") + @payload_type(streamer) class StreamPayload(StreamWrapperPayload): diff --git a/contrib/python/aiohttp/aiohttp/pytest_plugin.py b/contrib/python/aiohttp/aiohttp/pytest_plugin.py index 5754747bf485..55964ead041a 100644 --- a/contrib/python/aiohttp/aiohttp/pytest_plugin.py +++ b/contrib/python/aiohttp/aiohttp/pytest_plugin.py @@ -1,13 +1,21 @@ import asyncio import contextlib +import inspect import warnings -from typing import Any, Awaitable, Callable, Dict, Iterator, Optional, Type, Union +from typing import ( + Any, + Awaitable, + Callable, + Dict, + Iterator, + Optional, + Protocol, + Type, + Union, +) import pytest -from aiohttp.helpers import isasyncgenfunction -from aiohttp.web import Application - from .test_utils import ( BaseTestServer, RawTestServer, @@ -18,15 +26,35 @@ teardown_test_loop, unused_port as _unused_port, ) +from .web import Application +from .web_protocol import _RequestHandler try: import uvloop except ImportError: # pragma: no cover uvloop = None # type: ignore[assignment] -AiohttpClient = Callable[[Union[Application, BaseTestServer]], Awaitable[TestClient]] -AiohttpRawServer = Callable[[Application], Awaitable[RawTestServer]] -AiohttpServer = Callable[[Application], Awaitable[TestServer]] + +class AiohttpClient(Protocol): + def __call__( + self, + __param: Union[Application, BaseTestServer], + *, + server_kwargs: Optional[Dict[str, Any]] = None, + **kwargs: Any + ) -> Awaitable[TestClient]: ... + + +class AiohttpServer(Protocol): + def __call__( + self, app: Application, *, port: Optional[int] = None, **kwargs: Any + ) -> Awaitable[TestServer]: ... + + +class AiohttpRawServer(Protocol): + def __call__( + self, handler: _RequestHandler, *, port: Optional[int] = None, **kwargs: Any + ) -> Awaitable[RawTestServer]: ... def pytest_addoption(parser): # type: ignore[no-untyped-def] @@ -57,7 +85,7 @@ def pytest_fixture_setup(fixturedef): # type: ignore[no-untyped-def] """ func = fixturedef.func - if isasyncgenfunction(func): + if inspect.isasyncgenfunction(func): # async generator fixture is_async_gen = True elif asyncio.iscoroutinefunction(func): @@ -262,7 +290,9 @@ def aiohttp_server(loop: asyncio.AbstractEventLoop) -> Iterator[AiohttpServer]: """ servers = [] - async def go(app, *, port=None, **kwargs): # type: ignore[no-untyped-def] + async def go( + app: Application, *, port: Optional[int] = None, **kwargs: Any + ) -> TestServer: server = TestServer(app, port=port) await server.start_server(loop=loop, **kwargs) servers.append(server) @@ -295,7 +325,9 @@ def aiohttp_raw_server(loop: asyncio.AbstractEventLoop) -> Iterator[AiohttpRawSe """ servers = [] - async def go(handler, *, port=None, **kwargs): # type: ignore[no-untyped-def] + async def go( + handler: _RequestHandler, *, port: Optional[int] = None, **kwargs: Any + ) -> RawTestServer: server = RawTestServer(handler, port=port) await server.start_server(loop=loop, **kwargs) servers.append(server) diff --git a/contrib/python/aiohttp/aiohttp/resolver.py b/contrib/python/aiohttp/aiohttp/resolver.py index c03230c744e7..06855fa13fd0 100644 --- a/contrib/python/aiohttp/aiohttp/resolver.py +++ b/contrib/python/aiohttp/aiohttp/resolver.py @@ -1,20 +1,25 @@ import asyncio import socket -from typing import Any, Dict, List, Optional, Type, Union +import sys +from typing import Any, Dict, List, Optional, Tuple, Type, Union -from .abc import AbstractResolver -from .helpers import get_running_loop +from .abc import AbstractResolver, ResolveResult __all__ = ("ThreadedResolver", "AsyncResolver", "DefaultResolver") + try: import aiodns - # aiodns_default = hasattr(aiodns.DNSResolver, 'gethostbyname') + aiodns_default = hasattr(aiodns.DNSResolver, "getaddrinfo") except ImportError: # pragma: no cover - aiodns = None + aiodns = None # type: ignore[assignment] + aiodns_default = False + -aiodns_default = False +_NUMERIC_SOCKET_FLAGS = socket.AI_NUMERICHOST | socket.AI_NUMERICSERV +_NAME_SOCKET_FLAGS = socket.NI_NUMERICHOST | socket.NI_NUMERICSERV +_SUPPORTS_SCOPE_ID = sys.version_info >= (3, 9, 0) class ThreadedResolver(AbstractResolver): @@ -25,48 +30,48 @@ class ThreadedResolver(AbstractResolver): """ def __init__(self, loop: Optional[asyncio.AbstractEventLoop] = None) -> None: - self._loop = get_running_loop(loop) + self._loop = loop or asyncio.get_event_loop() async def resolve( - self, hostname: str, port: int = 0, family: int = socket.AF_INET - ) -> List[Dict[str, Any]]: + self, host: str, port: int = 0, family: socket.AddressFamily = socket.AF_INET + ) -> List[ResolveResult]: infos = await self._loop.getaddrinfo( - hostname, + host, port, type=socket.SOCK_STREAM, family=family, # flags=socket.AI_ADDRCONFIG, ) - hosts = [] + hosts: List[ResolveResult] = [] for family, _, proto, _, address in infos: if family == socket.AF_INET6: if len(address) < 3: # IPv6 is not supported by Python build, # or IPv6 is not enabled in the host continue - if address[3]: + if address[3] and _SUPPORTS_SCOPE_ID: # This is essential for link-local IPv6 addresses. # LL IPv6 is a VERY rare case. Strictly speaking, we should use # getnameinfo() unconditionally, but performance makes sense. - host, _port = socket.getnameinfo( - address, socket.NI_NUMERICHOST | socket.NI_NUMERICSERV + resolved_host, _port = await self._loop.getnameinfo( + address, _NAME_SOCKET_FLAGS ) port = int(_port) else: - host, port = address[:2] + resolved_host, port = address[:2] else: # IPv4 assert family == socket.AF_INET - host, port = address # type: ignore[misc] + resolved_host, port = address # type: ignore[misc] hosts.append( - { - "hostname": hostname, - "host": host, - "port": port, - "family": family, - "proto": proto, - "flags": socket.AI_NUMERICHOST | socket.AI_NUMERICSERV, - } + ResolveResult( + hostname=host, + host=resolved_host, + port=port, + family=family, + proto=proto, + flags=_NUMERIC_SOCKET_FLAGS, + ) ) return hosts @@ -87,32 +92,56 @@ def __init__( if aiodns is None: raise RuntimeError("Resolver requires aiodns library") - self._loop = get_running_loop(loop) - self._resolver = aiodns.DNSResolver(*args, loop=loop, **kwargs) + self._resolver = aiodns.DNSResolver(*args, **kwargs) if not hasattr(self._resolver, "gethostbyname"): # aiodns 1.1 is not available, fallback to DNSResolver.query self.resolve = self._resolve_with_query # type: ignore async def resolve( - self, host: str, port: int = 0, family: int = socket.AF_INET - ) -> List[Dict[str, Any]]: + self, host: str, port: int = 0, family: socket.AddressFamily = socket.AF_INET + ) -> List[ResolveResult]: try: - resp = await self._resolver.gethostbyname(host, family) + resp = await self._resolver.getaddrinfo( + host, + port=port, + type=socket.SOCK_STREAM, + family=family, + flags=socket.AI_ADDRCONFIG, + ) except aiodns.error.DNSError as exc: msg = exc.args[1] if len(exc.args) >= 1 else "DNS lookup failed" raise OSError(msg) from exc - hosts = [] - for address in resp.addresses: + hosts: List[ResolveResult] = [] + for node in resp.nodes: + address: Union[Tuple[bytes, int], Tuple[bytes, int, int, int]] = node.addr + family = node.family + if family == socket.AF_INET6: + if len(address) > 3 and address[3] and _SUPPORTS_SCOPE_ID: + # This is essential for link-local IPv6 addresses. + # LL IPv6 is a VERY rare case. Strictly speaking, we should use + # getnameinfo() unconditionally, but performance makes sense. + result = await self._resolver.getnameinfo( + (address[0].decode("ascii"), *address[1:]), + _NAME_SOCKET_FLAGS, + ) + resolved_host = result.node + else: + resolved_host = address[0].decode("ascii") + port = address[1] + else: # IPv4 + assert family == socket.AF_INET + resolved_host = address[0].decode("ascii") + port = address[1] hosts.append( - { - "hostname": host, - "host": address, - "port": port, - "family": family, - "proto": 0, - "flags": socket.AI_NUMERICHOST | socket.AI_NUMERICSERV, - } + ResolveResult( + hostname=host, + host=resolved_host, + port=port, + family=family, + proto=0, + flags=_NUMERIC_SOCKET_FLAGS, + ) ) if not hosts: diff --git a/contrib/python/aiohttp/aiohttp/streams.py b/contrib/python/aiohttp/aiohttp/streams.py index b9b9c3fd96fb..c927cfbb1b38 100644 --- a/contrib/python/aiohttp/aiohttp/streams.py +++ b/contrib/python/aiohttp/aiohttp/streams.py @@ -296,6 +296,9 @@ def end_http_chunk_receiving(self) -> None: set_result(waiter, None) async def _wait(self, func_name: str) -> None: + if not self._protocol.connected: + raise RuntimeError("Connection closed.") + # StreamReader uses a future to link the protocol feed_data() method # to a read coroutine. Running two read coroutines at the same time # would have an unexpected behaviour. It would not possible to know diff --git a/contrib/python/aiohttp/aiohttp/test_utils.py b/contrib/python/aiohttp/aiohttp/test_utils.py index a36e85996894..01496b6711ab 100644 --- a/contrib/python/aiohttp/aiohttp/test_utils.py +++ b/contrib/python/aiohttp/aiohttp/test_utils.py @@ -11,17 +11,7 @@ import warnings from abc import ABC, abstractmethod from types import TracebackType -from typing import ( - TYPE_CHECKING, - Any, - Callable, - Iterator, - List, - Optional, - Type, - Union, - cast, -) +from typing import TYPE_CHECKING, Any, Callable, Iterator, List, Optional, Type, cast from unittest import IsolatedAsyncioTestCase, mock from aiosignal import Signal @@ -29,7 +19,11 @@ from yarl import URL import aiohttp -from aiohttp.client import _RequestContextManager, _WSRequestContextManager +from aiohttp.client import ( + _RequestContextManager, + _RequestOptions, + _WSRequestContextManager, +) from . import ClientSession, hdrs from .abc import AbstractCookieJar @@ -37,6 +31,7 @@ from .client_ws import ClientWebSocketResponse from .helpers import sentinel from .http import HttpVersion, RawRequestMessage +from .streams import EMPTY_PAYLOAD, StreamReader from .typedefs import StrOrURL from .web import ( Application, @@ -55,6 +50,9 @@ else: SSLContext = None +if sys.version_info >= (3, 11) and TYPE_CHECKING: + from typing import Unpack + REUSE_ADDRESS = os.name == "posix" and sys.platform != "cygwin" @@ -90,7 +88,7 @@ class BaseTestServer(ABC): def __init__( self, *, - scheme: Union[str, object] = sentinel, + scheme: str = "", loop: Optional[asyncio.AbstractEventLoop] = None, host: str = "127.0.0.1", port: Optional[int] = None, @@ -121,10 +119,13 @@ async def start_server( await self.runner.setup() if not self.port: self.port = 0 + absolute_host = self.host try: version = ipaddress.ip_address(self.host).version except ValueError: version = 4 + if version == 6: + absolute_host = f"[{self.host}]" family = socket.AF_INET6 if version == 6 else socket.AF_INET _sock = self.socket_factory(self.host, self.port, family) self.host, self.port = _sock.getsockname()[:2] @@ -135,13 +136,9 @@ async def start_server( sockets = server.sockets # type: ignore[attr-defined] assert sockets is not None self.port = sockets[0].getsockname()[1] - if self.scheme is sentinel: - if self._ssl: - scheme = "https" - else: - scheme = "http" - self.scheme = scheme - self._root = URL(f"{self.scheme}://{self.host}:{self.port}") + if not self.scheme: + self.scheme = "https" if self._ssl else "http" + self._root = URL(f"{self.scheme}://{absolute_host}:{self.port}") @abstractmethod # pragma: no cover async def _make_runner(self, **kwargs: Any) -> BaseRunner: @@ -222,7 +219,7 @@ def __init__( self, app: Application, *, - scheme: Union[str, object] = sentinel, + scheme: str = "", host: str = "127.0.0.1", port: Optional[int] = None, **kwargs: Any, @@ -239,7 +236,7 @@ def __init__( self, handler: _RequestHandler, *, - scheme: Union[str, object] = sentinel, + scheme: str = "", host: str = "127.0.0.1", port: Optional[int] = None, **kwargs: Any, @@ -324,45 +321,101 @@ async def _request( self._responses.append(resp) return resp - def request( - self, method: str, path: StrOrURL, **kwargs: Any - ) -> _RequestContextManager: - """Routes a request to tested http server. + if sys.version_info >= (3, 11) and TYPE_CHECKING: + + def request( + self, method: str, path: StrOrURL, **kwargs: Unpack[_RequestOptions] + ) -> _RequestContextManager: ... + + def get( + self, + path: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> _RequestContextManager: ... + + def options( + self, + path: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> _RequestContextManager: ... + + def head( + self, + path: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> _RequestContextManager: ... + + def post( + self, + path: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> _RequestContextManager: ... + + def put( + self, + path: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> _RequestContextManager: ... + + def patch( + self, + path: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> _RequestContextManager: ... + + def delete( + self, + path: StrOrURL, + **kwargs: Unpack[_RequestOptions], + ) -> _RequestContextManager: ... - The interface is identical to aiohttp.ClientSession.request, - except the loop kwarg is overridden by the instance used by the - test server. + else: - """ - return _RequestContextManager(self._request(method, path, **kwargs)) + def request( + self, method: str, path: StrOrURL, **kwargs: Any + ) -> _RequestContextManager: + """Routes a request to tested http server. - def get(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: - """Perform an HTTP GET request.""" - return _RequestContextManager(self._request(hdrs.METH_GET, path, **kwargs)) + The interface is identical to aiohttp.ClientSession.request, + except the loop kwarg is overridden by the instance used by the + test server. - def post(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: - """Perform an HTTP POST request.""" - return _RequestContextManager(self._request(hdrs.METH_POST, path, **kwargs)) + """ + return _RequestContextManager(self._request(method, path, **kwargs)) - def options(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: - """Perform an HTTP OPTIONS request.""" - return _RequestContextManager(self._request(hdrs.METH_OPTIONS, path, **kwargs)) + def get(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: + """Perform an HTTP GET request.""" + return _RequestContextManager(self._request(hdrs.METH_GET, path, **kwargs)) - def head(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: - """Perform an HTTP HEAD request.""" - return _RequestContextManager(self._request(hdrs.METH_HEAD, path, **kwargs)) + def post(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: + """Perform an HTTP POST request.""" + return _RequestContextManager(self._request(hdrs.METH_POST, path, **kwargs)) - def put(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: - """Perform an HTTP PUT request.""" - return _RequestContextManager(self._request(hdrs.METH_PUT, path, **kwargs)) + def options(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: + """Perform an HTTP OPTIONS request.""" + return _RequestContextManager( + self._request(hdrs.METH_OPTIONS, path, **kwargs) + ) + + def head(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: + """Perform an HTTP HEAD request.""" + return _RequestContextManager(self._request(hdrs.METH_HEAD, path, **kwargs)) + + def put(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: + """Perform an HTTP PUT request.""" + return _RequestContextManager(self._request(hdrs.METH_PUT, path, **kwargs)) - def patch(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: - """Perform an HTTP PATCH request.""" - return _RequestContextManager(self._request(hdrs.METH_PATCH, path, **kwargs)) + def patch(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: + """Perform an HTTP PATCH request.""" + return _RequestContextManager( + self._request(hdrs.METH_PATCH, path, **kwargs) + ) - def delete(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: - """Perform an HTTP PATCH request.""" - return _RequestContextManager(self._request(hdrs.METH_DELETE, path, **kwargs)) + def delete(self, path: StrOrURL, **kwargs: Any) -> _RequestContextManager: + """Perform an HTTP PATCH request.""" + return _RequestContextManager( + self._request(hdrs.METH_DELETE, path, **kwargs) + ) def ws_connect(self, path: StrOrURL, **kwargs: Any) -> _WSRequestContextManager: """Initiate websocket connection. @@ -582,7 +635,7 @@ def make_mocked_request( writer: Any = sentinel, protocol: Any = sentinel, transport: Any = sentinel, - payload: Any = sentinel, + payload: StreamReader = EMPTY_PAYLOAD, sslcontext: Optional[SSLContext] = None, client_max_size: int = 1024**2, loop: Any = ..., @@ -651,9 +704,6 @@ def make_mocked_request( protocol.transport = transport protocol.writer = writer - if payload is sentinel: - payload = mock.Mock() - req = Request( message, payload, protocol, writer, task, loop, client_max_size=client_max_size ) diff --git a/contrib/python/aiohttp/aiohttp/tracing.py b/contrib/python/aiohttp/aiohttp/tracing.py index fe3eda9abb73..067a132464e2 100644 --- a/contrib/python/aiohttp/aiohttp/tracing.py +++ b/contrib/python/aiohttp/aiohttp/tracing.py @@ -1,5 +1,5 @@ from types import SimpleNamespace -from typing import TYPE_CHECKING, Awaitable, Optional, Protocol, Type, TypeVar +from typing import TYPE_CHECKING, Awaitable, Mapping, Optional, Protocol, Type, TypeVar import attr from aiosignal import Signal @@ -42,59 +42,29 @@ class TraceConfig: def __init__( self, trace_config_ctx_factory: Type[SimpleNamespace] = SimpleNamespace ) -> None: - self._on_request_start: _TracingSignal[ - TraceRequestStartParams - ] = Signal(self) - self._on_request_chunk_sent: _TracingSignal[ - TraceRequestChunkSentParams - ] = Signal(self) - self._on_response_chunk_received: _TracingSignal[ - TraceResponseChunkReceivedParams - ] = Signal(self) - self._on_request_end: _TracingSignal[TraceRequestEndParams] = Signal( - self + self._on_request_start: _TracingSignal[TraceRequestStartParams] = ( + Signal(self) ) - self._on_request_exception: _TracingSignal[ - TraceRequestExceptionParams - ] = Signal(self) - self._on_request_redirect: _TracingSignal[ - TraceRequestRedirectParams - ] = Signal(self) - self._on_connection_queued_start: _TracingSignal[ - TraceConnectionQueuedStartParams - ] = Signal(self) - self._on_connection_queued_end: _TracingSignal[ - TraceConnectionQueuedEndParams - ] = Signal(self) - self._on_connection_create_start: _TracingSignal[ - TraceConnectionCreateStartParams - ] = Signal(self) - self._on_connection_create_end: _TracingSignal[ - TraceConnectionCreateEndParams - ] = Signal(self) - self._on_connection_reuseconn: _TracingSignal[ - TraceConnectionReuseconnParams - ] = Signal(self) - self._on_dns_resolvehost_start: _TracingSignal[ - TraceDnsResolveHostStartParams - ] = Signal(self) - self._on_dns_resolvehost_end: _TracingSignal[ - TraceDnsResolveHostEndParams - ] = Signal(self) - self._on_dns_cache_hit: _TracingSignal[ - TraceDnsCacheHitParams - ] = Signal(self) - self._on_dns_cache_miss: _TracingSignal[ - TraceDnsCacheMissParams - ] = Signal(self) - self._on_request_headers_sent: _TracingSignal[ - TraceRequestHeadersSentParams - ] = Signal(self) + self._on_request_chunk_sent: _TracingSignal[TraceRequestChunkSentParams] = Signal(self) + self._on_response_chunk_received: _TracingSignal[TraceResponseChunkReceivedParams] = Signal(self) + self._on_request_end: _TracingSignal[TraceRequestEndParams] = Signal(self) + self._on_request_exception: _TracingSignal[TraceRequestExceptionParams] = Signal(self) + self._on_request_redirect: _TracingSignal[TraceRequestRedirectParams] = Signal(self) + self._on_connection_queued_start: _TracingSignal[TraceConnectionQueuedStartParams] = Signal(self) + self._on_connection_queued_end: _TracingSignal[TraceConnectionQueuedEndParams] = Signal(self) + self._on_connection_create_start: _TracingSignal[TraceConnectionCreateStartParams] = Signal(self) + self._on_connection_create_end: _TracingSignal[TraceConnectionCreateEndParams] = Signal(self) + self._on_connection_reuseconn: _TracingSignal[TraceConnectionReuseconnParams] = Signal(self) + self._on_dns_resolvehost_start: _TracingSignal[TraceDnsResolveHostStartParams] = Signal(self) + self._on_dns_resolvehost_end: _TracingSignal[TraceDnsResolveHostEndParams] = Signal(self) + self._on_dns_cache_hit: _TracingSignal[TraceDnsCacheHitParams] = (Signal(self)) + self._on_dns_cache_miss: _TracingSignal[TraceDnsCacheMissParams] = (Signal(self)) + self._on_request_headers_sent: _TracingSignal[TraceRequestHeadersSentParams] = Signal(self) self._trace_config_ctx_factory = trace_config_ctx_factory def trace_config_ctx( - self, trace_request_ctx: Optional[SimpleNamespace] = None + self, trace_request_ctx: Optional[Mapping[str, str]] = None ) -> SimpleNamespace: """Return a new trace_config_ctx instance""" return self._trace_config_ctx_factory(trace_request_ctx=trace_request_ctx) @@ -122,7 +92,9 @@ def on_request_start(self) -> "_TracingSignal[TraceRequestStartParams]": return self._on_request_start @property - def on_request_chunk_sent(self) -> "_TracingSignal[TraceRequestChunkSentParams]": + def on_request_chunk_sent( + self, + ) -> "_TracingSignal[TraceRequestChunkSentParams]": return self._on_request_chunk_sent @property diff --git a/contrib/python/aiohttp/aiohttp/typedefs.py b/contrib/python/aiohttp/aiohttp/typedefs.py index 5e963e1a10ef..668d4fc344f9 100644 --- a/contrib/python/aiohttp/aiohttp/typedefs.py +++ b/contrib/python/aiohttp/aiohttp/typedefs.py @@ -7,6 +7,8 @@ Callable, Iterable, Mapping, + Protocol, + Sequence, Tuple, Union, ) @@ -14,6 +16,18 @@ from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy, istr from yarl import URL +try: + # Available in yarl>=1.10.0 + from yarl import Query as _Query +except ImportError: # pragma: no cover + SimpleQuery = Union[str, int, float] # pragma: no cover + QueryVariable = Union[SimpleQuery, "Sequence[SimpleQuery]"] # pragma: no cover + _Query = Union[ # type: ignore[misc] # pragma: no cover + None, str, "Mapping[str, QueryVariable]", "Sequence[Tuple[str, QueryVariable]]" + ] + +Query = _Query + DEFAULT_JSON_ENCODER = json.dumps DEFAULT_JSON_DECODER = json.loads @@ -34,7 +48,13 @@ Byteish = Union[bytes, bytearray, memoryview] JSONEncoder = Callable[[Any], str] JSONDecoder = Callable[[str], Any] -LooseHeaders = Union[Mapping[Union[str, istr], str], _CIMultiDict, _CIMultiDictProxy] +LooseHeaders = Union[ + Mapping[str, str], + Mapping[istr, str], + _CIMultiDict, + _CIMultiDictProxy, + Iterable[Tuple[Union[str, istr], str]], +] RawHeaders = Tuple[Tuple[bytes, bytes], ...] StrOrURL = Union[str, URL] @@ -51,4 +71,5 @@ Handler = Callable[["Request"], Awaitable["StreamResponse"]] Middleware = Callable[["Request", Handler], Awaitable["StreamResponse"]] + PathLike = Union[str, "os.PathLike[str]"] diff --git a/contrib/python/aiohttp/aiohttp/web.py b/contrib/python/aiohttp/aiohttp/web.py index e9116507f4e6..88bf14bf8283 100644 --- a/contrib/python/aiohttp/aiohttp/web.py +++ b/contrib/python/aiohttp/aiohttp/web.py @@ -7,7 +7,6 @@ from argparse import ArgumentParser from collections.abc import Iterable from contextlib import suppress -from functools import partial from importlib import import_module from typing import ( Any, @@ -21,7 +20,6 @@ Union, cast, ) -from weakref import WeakSet from .abc import AbstractAccessLogger from .helpers import AppKey as AppKey @@ -320,23 +318,6 @@ async def _run_app( reuse_port: Optional[bool] = None, handler_cancellation: bool = False, ) -> None: - async def wait( - starting_tasks: "WeakSet[asyncio.Task[object]]", shutdown_timeout: float - ) -> None: - # Wait for pending tasks for a given time limit. - t = asyncio.current_task() - assert t is not None - starting_tasks.add(t) - with suppress(asyncio.TimeoutError): - await asyncio.wait_for(_wait(starting_tasks), timeout=shutdown_timeout) - - async def _wait(exclude: "WeakSet[asyncio.Task[object]]") -> None: - t = asyncio.current_task() - assert t is not None - exclude.add(t) - while tasks := asyncio.all_tasks().difference(exclude): - await asyncio.wait(tasks) - # An internal function to actually do all dirty job for application running if asyncio.iscoroutine(app): app = await app @@ -355,12 +336,6 @@ async def _wait(exclude: "WeakSet[asyncio.Task[object]]") -> None: ) await runner.setup() - # On shutdown we want to avoid waiting on tasks which run forever. - # It's very likely that all tasks which run forever will have been created by - # the time we have completed the application startup (in runner.setup()), - # so we just record all running tasks here and exclude them later. - starting_tasks: "WeakSet[asyncio.Task[object]]" = WeakSet(asyncio.all_tasks()) - runner.shutdown_callback = partial(wait, starting_tasks, shutdown_timeout) sites: List[BaseSite] = [] @@ -545,10 +520,14 @@ def run_app( except (GracefulExit, KeyboardInterrupt): # pragma: no cover pass finally: - _cancel_tasks({main_task}, loop) - _cancel_tasks(asyncio.all_tasks(loop), loop) - loop.run_until_complete(loop.shutdown_asyncgens()) - loop.close() + try: + main_task.cancel() + with suppress(asyncio.CancelledError): + loop.run_until_complete(main_task) + finally: + _cancel_tasks(asyncio.all_tasks(loop), loop) + loop.run_until_complete(loop.shutdown_asyncgens()) + loop.close() def main(argv: List[str]) -> None: diff --git a/contrib/python/aiohttp/aiohttp/web_app.py b/contrib/python/aiohttp/aiohttp/web_app.py index 8e0e91bcfe38..ab11981a8a52 100644 --- a/contrib/python/aiohttp/aiohttp/web_app.py +++ b/contrib/python/aiohttp/aiohttp/web_app.py @@ -1,7 +1,7 @@ import asyncio import logging import warnings -from functools import partial, update_wrapper +from functools import lru_cache, partial, update_wrapper from typing import ( TYPE_CHECKING, Any, @@ -38,7 +38,7 @@ from .http_parser import RawRequestMessage from .log import web_logger from .streams import StreamReader -from .typedefs import Middleware +from .typedefs import Handler, Middleware from .web_exceptions import NotAppKeyWarning from .web_log import AccessLogger from .web_middlewares import _fix_request_current_app @@ -76,6 +76,18 @@ _T = TypeVar("_T") _U = TypeVar("_U") +_Resource = TypeVar("_Resource", bound=AbstractResource) + + +@lru_cache(None) +def _build_middlewares( + handler: Handler, apps: Tuple["Application", ...] +) -> Callable[[Request], Awaitable[StreamResponse]]: + """Apply middlewares to handler.""" + for app in apps[::-1]: + for m, _ in app._middlewares_handlers: # type: ignore[union-attr] + handler = update_wrapper(partial(m, handler=handler), handler) # type: ignore[misc] + return handler class Application(MutableMapping[Union[str, AppKey[Any]], Any]): @@ -88,6 +100,7 @@ class Application(MutableMapping[Union[str, AppKey[Any]], Any]): "_handler_args", "_middlewares", "_middlewares_handlers", + "_has_legacy_middlewares", "_run_middlewares", "_state", "_frozen", @@ -142,6 +155,7 @@ def __init__( self._middlewares_handlers: _MiddlewaresHandlers = None # initialized on freezing self._run_middlewares: Optional[bool] = None + self._has_legacy_middlewares: bool = True self._state: Dict[Union[AppKey[Any], str], object] = {} self._frozen = False @@ -183,12 +197,10 @@ def __eq__(self, other: object) -> bool: return self is other @overload # type: ignore[override] - def __getitem__(self, key: AppKey[_T]) -> _T: - ... + def __getitem__(self, key: AppKey[_T]) -> _T: ... @overload - def __getitem__(self, key: str) -> Any: - ... + def __getitem__(self, key: str) -> Any: ... def __getitem__(self, key: Union[str, AppKey[_T]]) -> Any: return self._state[key] @@ -202,12 +214,10 @@ def _check_frozen(self) -> None: ) @overload # type: ignore[override] - def __setitem__(self, key: AppKey[_T], value: _T) -> None: - ... + def __setitem__(self, key: AppKey[_T], value: _T) -> None: ... @overload - def __setitem__(self, key: str, value: Any) -> None: - ... + def __setitem__(self, key: str, value: Any) -> None: ... def __setitem__(self, key: Union[str, AppKey[_T]], value: Any) -> None: self._check_frozen() @@ -231,17 +241,17 @@ def __len__(self) -> int: def __iter__(self) -> Iterator[Union[str, AppKey[Any]]]: return iter(self._state) + def __hash__(self) -> int: + return id(self) + @overload # type: ignore[override] - def get(self, key: AppKey[_T], default: None = ...) -> Optional[_T]: - ... + def get(self, key: AppKey[_T], default: None = ...) -> Optional[_T]: ... @overload - def get(self, key: AppKey[_T], default: _U) -> Union[_T, _U]: - ... + def get(self, key: AppKey[_T], default: _U) -> Union[_T, _U]: ... @overload - def get(self, key: str, default: Any = ...) -> Any: - ... + def get(self, key: str, default: Any = ...) -> Any: ... def get(self, key: Union[str, AppKey[_T]], default: Any = None) -> Any: return self._state.get(key, default) @@ -290,6 +300,9 @@ def pre_freeze(self) -> None: self._on_shutdown.freeze() self._on_cleanup.freeze() self._middlewares_handlers = tuple(self._prepare_middleware()) + self._has_legacy_middlewares = any( + not new_style for _, new_style in self._middlewares_handlers + ) # If current app and any subapp do not have middlewares avoid run all # of the code footprint that it implies, which have a middleware @@ -334,7 +347,7 @@ async def handler(app: "Application") -> None: reg_handler("on_shutdown") reg_handler("on_cleanup") - def add_subapp(self, prefix: str, subapp: "Application") -> AbstractResource: + def add_subapp(self, prefix: str, subapp: "Application") -> PrefixedSubAppResource: if not isinstance(prefix, str): raise TypeError("Prefix must be str") prefix = prefix.rstrip("/") @@ -344,8 +357,8 @@ def add_subapp(self, prefix: str, subapp: "Application") -> AbstractResource: return self._add_subapp(factory, subapp) def _add_subapp( - self, resource_factory: Callable[[], AbstractResource], subapp: "Application" - ) -> AbstractResource: + self, resource_factory: Callable[[], _Resource], subapp: "Application" + ) -> _Resource: if self.frozen: raise RuntimeError("Cannot add sub application to frozen application") if subapp.frozen: @@ -359,7 +372,7 @@ def _add_subapp( subapp._set_loop(self._loop) return resource - def add_domain(self, domain: str, subapp: "Application") -> AbstractResource: + def add_domain(self, domain: str, subapp: "Application") -> MatchedSubAppResource: if not isinstance(domain, str): raise TypeError("Domain must be str") elif "*" in domain: @@ -520,29 +533,30 @@ async def _handle(self, request: Request) -> StreamResponse: match_info.freeze() - resp = None request._match_info = match_info - expect = request.headers.get(hdrs.EXPECT) - if expect: + + if request.headers.get(hdrs.EXPECT): resp = await match_info.expect_handler(request) await request.writer.drain() + if resp is not None: + return resp - if resp is None: - handler = match_info.handler + handler = match_info.handler - if self._run_middlewares: + if self._run_middlewares: + if not self._has_legacy_middlewares: + handler = _build_middlewares(handler, match_info.apps) + else: for app in match_info.apps[::-1]: for m, new_style in app._middlewares_handlers: # type: ignore[union-attr] if new_style: handler = update_wrapper( - partial(m, handler=handler), handler + partial(m, handler=handler), handler # type: ignore[misc] ) else: handler = await m(app, handler) # type: ignore[arg-type,assignment] - resp = await handler(request) - - return resp + return await handler(request) def __call__(self) -> "Application": """gunicorn compatibility""" @@ -585,7 +599,7 @@ async def _on_cleanup(self, app: Application) -> None: await it.__anext__() except StopAsyncIteration: pass - except Exception as exc: + except (Exception, asyncio.CancelledError) as exc: errors.append(exc) else: errors.append(RuntimeError(f"{it!r} has more than one 'yield'")) diff --git a/contrib/python/aiohttp/aiohttp/web_fileresponse.py b/contrib/python/aiohttp/aiohttp/web_fileresponse.py index 7dbe50f0a5a4..f0de75e9f1b3 100644 --- a/contrib/python/aiohttp/aiohttp/web_fileresponse.py +++ b/contrib/python/aiohttp/aiohttp/web_fileresponse.py @@ -1,7 +1,11 @@ import asyncio -import mimetypes import os import pathlib +import sys +from contextlib import suppress +from mimetypes import MimeTypes +from stat import S_ISREG +from types import MappingProxyType from typing import ( # noqa IO, TYPE_CHECKING, @@ -22,6 +26,8 @@ from .helpers import ETAG_ANY, ETag, must_be_empty_body from .typedefs import LooseHeaders, PathLike from .web_exceptions import ( + HTTPForbidden, + HTTPNotFound, HTTPNotModified, HTTPPartialContent, HTTPPreconditionFailed, @@ -40,6 +46,35 @@ NOSENDFILE: Final[bool] = bool(os.environ.get("AIOHTTP_NOSENDFILE")) +CONTENT_TYPES: Final[MimeTypes] = MimeTypes() + +if sys.version_info < (3, 9): + CONTENT_TYPES.encodings_map[".br"] = "br" + +# File extension to IANA encodings map that will be checked in the order defined. +ENCODING_EXTENSIONS = MappingProxyType( + {ext: CONTENT_TYPES.encodings_map[ext] for ext in (".br", ".gz")} +) + +FALLBACK_CONTENT_TYPE = "application/octet-stream" + +# Provide additional MIME type/extension pairs to be recognized. +# https://en.wikipedia.org/wiki/List_of_archive_formats#Compression_only +ADDITIONAL_CONTENT_TYPES = MappingProxyType( + { + "application/gzip": ".gz", + "application/x-brotli": ".br", + "application/x-bzip2": ".bz2", + "application/x-compress": ".Z", + "application/x-xz": ".xz", + } +) + +# Add custom pairs and clear the encodings map so guess_type ignores them. +CONTENT_TYPES.encodings_map.clear() +for content_type, extension in ADDITIONAL_CONTENT_TYPES.items(): + CONTENT_TYPES.add_type(content_type, extension) # type: ignore[attr-defined] + class FileResponse(StreamResponse): """A response object can be used to send files.""" @@ -101,10 +136,12 @@ async def _sendfile( return writer @staticmethod - def _strong_etag_match(etag_value: str, etags: Tuple[ETag, ...]) -> bool: + def _etag_match(etag_value: str, etags: Tuple[ETag, ...], *, weak: bool) -> bool: if len(etags) == 1 and etags[0].value == ETAG_ANY: return True - return any(etag.value == etag_value for etag in etags if not etag.is_weak) + return any( + etag.value == etag_value for etag in etags if weak or not etag.is_weak + ) async def _not_modified( self, request: "BaseRequest", etag_value: str, last_modified: float @@ -124,42 +161,60 @@ async def _precondition_failed( self.content_length = 0 return await super().prepare(request) - def _get_file_path_stat_and_gzip( - self, check_for_gzipped_file: bool - ) -> Tuple[pathlib.Path, os.stat_result, bool]: - """Return the file path, stat result, and gzip status. + def _get_file_path_stat_encoding( + self, accept_encoding: str + ) -> Tuple[pathlib.Path, os.stat_result, Optional[str]]: + """Return the file path, stat result, and encoding. + + If an uncompressed file is returned, the encoding is set to + :py:data:`None`. This method should be called from a thread executor since it calls os.stat which may block. """ - filepath = self._path - if check_for_gzipped_file: - gzip_path = filepath.with_name(filepath.name + ".gz") - try: - return gzip_path, gzip_path.stat(), True - except OSError: - # Fall through and try the non-gzipped file - pass + file_path = self._path + for file_extension, file_encoding in ENCODING_EXTENSIONS.items(): + if file_encoding not in accept_encoding: + continue - return filepath, filepath.stat(), False + compressed_path = file_path.with_suffix(file_path.suffix + file_extension) + with suppress(OSError): + # Do not follow symlinks and ignore any non-regular files. + st = compressed_path.lstat() + if S_ISREG(st.st_mode): + return compressed_path, st, file_encoding + + # Fallback to the uncompressed file + return file_path, file_path.stat(), None async def prepare(self, request: "BaseRequest") -> Optional[AbstractStreamWriter]: - loop = asyncio.get_event_loop() + loop = asyncio.get_running_loop() # Encoding comparisons should be case-insensitive # https://www.rfc-editor.org/rfc/rfc9110#section-8.4.1 - check_for_gzipped_file = ( - "gzip" in request.headers.get(hdrs.ACCEPT_ENCODING, "").lower() - ) - filepath, st, gzip = await loop.run_in_executor( - None, self._get_file_path_stat_and_gzip, check_for_gzipped_file - ) + accept_encoding = request.headers.get(hdrs.ACCEPT_ENCODING, "").lower() + try: + file_path, st, file_encoding = await loop.run_in_executor( + None, self._get_file_path_stat_encoding, accept_encoding + ) + except OSError: + # Most likely to be FileNotFoundError or OSError for circular + # symlinks in python >= 3.13, so respond with 404. + self.set_status(HTTPNotFound.status_code) + return await super().prepare(request) + + # Forbid special files like sockets, pipes, devices, etc. + if not S_ISREG(st.st_mode): + self.set_status(HTTPForbidden.status_code) + return await super().prepare(request) etag_value = f"{st.st_mtime_ns:x}-{st.st_size:x}" last_modified = st.st_mtime - # https://tools.ietf.org/html/rfc7232#section-6 + # https://www.rfc-editor.org/rfc/rfc9110#section-13.1.1-2 ifmatch = request.if_match - if ifmatch is not None and not self._strong_etag_match(etag_value, ifmatch): + if ifmatch is not None and not self._etag_match( + etag_value, ifmatch, weak=False + ): return await self._precondition_failed(request) unmodsince = request.if_unmodified_since @@ -170,8 +225,11 @@ async def prepare(self, request: "BaseRequest") -> Optional[AbstractStreamWriter ): return await self._precondition_failed(request) + # https://www.rfc-editor.org/rfc/rfc9110#section-13.1.2-2 ifnonematch = request.if_none_match - if ifnonematch is not None and self._strong_etag_match(etag_value, ifnonematch): + if ifnonematch is not None and self._etag_match( + etag_value, ifnonematch, weak=True + ): return await self._not_modified(request, etag_value, last_modified) modsince = request.if_modified_since @@ -182,15 +240,6 @@ async def prepare(self, request: "BaseRequest") -> Optional[AbstractStreamWriter ): return await self._not_modified(request, etag_value, last_modified) - if hdrs.CONTENT_TYPE not in self.headers: - ct, encoding = mimetypes.guess_type(str(filepath)) - if not ct: - ct = "application/octet-stream" - should_set_ct = True - else: - encoding = "gzip" if gzip else None - should_set_ct = False - status = self._status file_size = st.st_size count = file_size @@ -265,11 +314,16 @@ async def prepare(self, request: "BaseRequest") -> Optional[AbstractStreamWriter # return a HTTP 206 for a Range request. self.set_status(status) - if should_set_ct: - self.content_type = ct # type: ignore[assignment] - if encoding: - self.headers[hdrs.CONTENT_ENCODING] = encoding - if gzip: + # If the Content-Type header is not already set, guess it based on the + # extension of the request path. The encoding returned by guess_type + # can be ignored since the map was cleared above. + if hdrs.CONTENT_TYPE not in self.headers: + self.content_type = ( + CONTENT_TYPES.guess_type(self._path)[0] or FALLBACK_CONTENT_TYPE + ) + + if file_encoding: + self.headers[hdrs.CONTENT_ENCODING] = file_encoding self.headers[hdrs.VARY] = hdrs.ACCEPT_ENCODING # Disable compression if we are already sending # a compressed file since we don't want to double @@ -293,7 +347,12 @@ async def prepare(self, request: "BaseRequest") -> Optional[AbstractStreamWriter if count == 0 or must_be_empty_body(request.method, self.status): return await super().prepare(request) - fobj = await loop.run_in_executor(None, filepath.open, "rb") + try: + fobj = await loop.run_in_executor(None, file_path.open, "rb") + except PermissionError: + self.set_status(HTTPForbidden.status_code) + return await super().prepare(request) + if start: # be aware that start could be None or int=0 here. offset = start else: diff --git a/contrib/python/aiohttp/aiohttp/web_middlewares.py b/contrib/python/aiohttp/aiohttp/web_middlewares.py index 5da1533c0df7..2f1f5f58e6e3 100644 --- a/contrib/python/aiohttp/aiohttp/web_middlewares.py +++ b/contrib/python/aiohttp/aiohttp/web_middlewares.py @@ -110,7 +110,12 @@ async def impl(request: Request, handler: Handler) -> StreamResponse: def _fix_request_current_app(app: "Application") -> Middleware: @middleware async def impl(request: Request, handler: Handler) -> StreamResponse: - with request.match_info.set_current_app(app): + match_info = request.match_info + prev = match_info.current_app + match_info.current_app = app + try: return await handler(request) + finally: + match_info.current_app = prev return impl diff --git a/contrib/python/aiohttp/aiohttp/web_protocol.py b/contrib/python/aiohttp/aiohttp/web_protocol.py index f083b13eb0f1..85eb70d5a0b7 100644 --- a/contrib/python/aiohttp/aiohttp/web_protocol.py +++ b/contrib/python/aiohttp/aiohttp/web_protocol.py @@ -1,5 +1,6 @@ import asyncio import asyncio.streams +import sys import traceback import warnings from collections import deque @@ -26,7 +27,7 @@ from .abc import AbstractAccessLogger, AbstractStreamWriter from .base_protocol import BaseProtocol -from .helpers import ceil_timeout, set_exception +from .helpers import ceil_timeout from .http import ( HttpProcessingError, HttpRequestParser, @@ -37,7 +38,7 @@ from .log import access_logger, server_logger from .streams import EMPTY_PAYLOAD, StreamReader from .tcp_helpers import tcp_keepalive -from .web_exceptions import HTTPException +from .web_exceptions import HTTPException, HTTPInternalServerError from .web_log import AccessLogger from .web_request import BaseRequest from .web_response import Response, StreamResponse @@ -83,6 +84,9 @@ class PayloadAccessError(Exception): """Payload was accessed after response was sent.""" +_PAYLOAD_ACCESS_ERROR = PayloadAccessError() + + @attr.s(auto_attribs=True, frozen=True, slots=True) class _ErrInfo: status: int @@ -133,8 +137,6 @@ class RequestHandler(BaseProtocol): """ - KEEPALIVE_RESCHEDULE_DELAY = 1 - __slots__ = ( "_request_count", "_keepalive", @@ -142,12 +144,13 @@ class RequestHandler(BaseProtocol): "_request_handler", "_request_factory", "_tcp_keepalive", - "_keepalive_time", + "_next_keepalive_close_time", "_keepalive_handle", "_keepalive_timeout", "_lingering_time", "_messages", "_message_tail", + "_handler_waiter", "_waiter", "_task_handler", "_upgrade", @@ -162,6 +165,7 @@ class RequestHandler(BaseProtocol): "_force_close", "_current_request", "_timeout_ceil_threshold", + "_request_in_progress", ) def __init__( @@ -195,7 +199,7 @@ def __init__( self._tcp_keepalive = tcp_keepalive # placeholder to be replaced on keepalive timeout setup - self._keepalive_time = 0.0 + self._next_keepalive_close_time = 0.0 self._keepalive_handle: Optional[asyncio.Handle] = None self._keepalive_timeout = keepalive_timeout self._lingering_time = float(lingering_time) @@ -204,6 +208,7 @@ def __init__( self._message_tail = b"" self._waiter: Optional[asyncio.Future[None]] = None + self._handler_waiter: Optional[asyncio.Future[None]] = None self._task_handler: Optional[asyncio.Task[None]] = None self._upgrade = False @@ -237,6 +242,7 @@ def __init__( self._close = False self._force_close = False + self._request_in_progress = False def __repr__(self) -> str: return "<{} {}>".format( @@ -259,25 +265,44 @@ async def shutdown(self, timeout: Optional[float] = 15.0) -> None: if self._keepalive_handle is not None: self._keepalive_handle.cancel() - if self._waiter: - self._waiter.cancel() - - # wait for handlers - with suppress(asyncio.CancelledError, asyncio.TimeoutError): + # Wait for graceful handler completion + if self._request_in_progress: + # The future is only created when we are shutting + # down while the handler is still processing a request + # to avoid creating a future for every request. + self._handler_waiter = self._loop.create_future() + try: + async with ceil_timeout(timeout): + await self._handler_waiter + except (asyncio.CancelledError, asyncio.TimeoutError): + self._handler_waiter = None + if ( + sys.version_info >= (3, 11) + and (task := asyncio.current_task()) + and task.cancelling() + ): + raise + # Then cancel handler and wait + try: async with ceil_timeout(timeout): if self._current_request is not None: self._current_request._cancel(asyncio.CancelledError()) if self._task_handler is not None and not self._task_handler.done(): - await self._task_handler + await asyncio.shield(self._task_handler) + except (asyncio.CancelledError, asyncio.TimeoutError): + if ( + sys.version_info >= (3, 11) + and (task := asyncio.current_task()) + and task.cancelling() + ): + raise # force-close non-idle handler if self._task_handler is not None: self._task_handler.cancel() - if self.transport is not None: - self.transport.close() - self.transport = None + self.force_close() def connection_made(self, transport: asyncio.BaseTransport) -> None: super().connection_made(transport) @@ -286,22 +311,27 @@ def connection_made(self, transport: asyncio.BaseTransport) -> None: if self._tcp_keepalive: tcp_keepalive(real_transport) - self._task_handler = self._loop.create_task(self.start()) assert self._manager is not None self._manager.connection_made(self, real_transport) + loop = self._loop + if sys.version_info >= (3, 12): + task = asyncio.Task(self.start(), loop=loop, eager_start=True) + else: + task = loop.create_task(self.start()) + self._task_handler = task + def connection_lost(self, exc: Optional[BaseException]) -> None: if self._manager is None: return self._manager.connection_lost(self, exc) - super().connection_lost(exc) - # Grab value before setting _manager to None. handler_cancellation = self._manager.handler_cancellation + self.force_close() + super().connection_lost(exc) self._manager = None - self._force_close = True self._request_factory = None self._request_handler = None self._request_parser = None @@ -314,9 +344,6 @@ def connection_lost(self, exc: Optional[BaseException]) -> None: exc = ConnectionResetError("Connection lost") self._current_request._cancel(exc) - if self._waiter is not None: - self._waiter.cancel() - if handler_cancellation and self._task_handler is not None: self._task_handler.cancel() @@ -421,23 +448,21 @@ def log_exception(self, *args: Any, **kw: Any) -> None: self.logger.exception(*args, **kw) def _process_keepalive(self) -> None: + self._keepalive_handle = None if self._force_close or not self._keepalive: return - next = self._keepalive_time + self._keepalive_timeout + loop = self._loop + now = loop.time() + close_time = self._next_keepalive_close_time + if now <= close_time: + # Keep alive close check fired too early, reschedule + self._keepalive_handle = loop.call_at(close_time, self._process_keepalive) + return # handler in idle state - if self._waiter: - if self._loop.time() > next: - self.force_close() - return - - # not all request handlers are done, - # reschedule itself to next second - self._keepalive_handle = self._loop.call_later( - self.KEEPALIVE_RESCHEDULE_DELAY, - self._process_keepalive, - ) + if self._waiter and not self._waiter.done(): + self.force_close() async def _handle_request( self, @@ -445,7 +470,7 @@ async def _handle_request( start_time: float, request_handler: Callable[[BaseRequest], Awaitable[StreamResponse]], ) -> Tuple[StreamResponse, bool]: - assert self._request_handler is not None + self._request_in_progress = True try: try: self._current_request = request @@ -454,16 +479,16 @@ async def _handle_request( self._current_request = None except HTTPException as exc: resp = exc - reset = await self.finish_response(request, resp, start_time) + resp, reset = await self.finish_response(request, resp, start_time) except asyncio.CancelledError: raise except asyncio.TimeoutError as exc: self.log_debug("Request handler timed out.", exc_info=exc) resp = self.handle_error(request, 504) - reset = await self.finish_response(request, resp, start_time) + resp, reset = await self.finish_response(request, resp, start_time) except Exception as exc: resp = self.handle_error(request, 500, exc) - reset = await self.finish_response(request, resp, start_time) + resp, reset = await self.finish_response(request, resp, start_time) else: # Deprecation warning (See #2415) if getattr(resp, "__http_exception__", False): @@ -474,7 +499,11 @@ async def _handle_request( DeprecationWarning, ) - reset = await self.finish_response(request, resp, start_time) + resp, reset = await self.finish_response(request, resp, start_time) + finally: + self._request_in_progress = False + if self._handler_waiter is not None: + self._handler_waiter.set_result(None) return resp, reset @@ -488,7 +517,7 @@ async def start(self) -> None: keep_alive(True) specified. """ loop = self._loop - handler = self._task_handler + handler = asyncio.current_task(loop) assert handler is not None manager = self._manager assert manager is not None @@ -503,8 +532,6 @@ async def start(self) -> None: # wait for next request self._waiter = loop.create_future() await self._waiter - except asyncio.CancelledError: - break finally: self._waiter = None @@ -524,12 +551,14 @@ async def start(self) -> None: request = self._request_factory(message, payload, self, writer, handler) try: # a new task is used for copy context vars (#3406) - task = self._loop.create_task( - self._handle_request(request, start, request_handler) - ) + coro = self._handle_request(request, start, request_handler) + if sys.version_info >= (3, 12): + task = asyncio.Task(coro, loop=loop, eager_start=True) + else: + task = loop.create_task(coro) try: resp, reset = await task - except (asyncio.CancelledError, ConnectionError): + except ConnectionError: self.log_debug("Ignored premature client disconnection") break @@ -553,27 +582,30 @@ async def start(self) -> None: now = loop.time() end_t = now + lingering_time - with suppress(asyncio.TimeoutError, asyncio.CancelledError): + try: while not payload.is_eof() and now < end_t: async with ceil_timeout(end_t - now): # read and ignore await payload.readany() now = loop.time() + except (asyncio.CancelledError, asyncio.TimeoutError): + if ( + sys.version_info >= (3, 11) + and (t := asyncio.current_task()) + and t.cancelling() + ): + raise # if payload still uncompleted if not payload.is_eof() and not self._force_close: self.log_debug("Uncompleted request.") self.close() - set_exception(payload, PayloadAccessError()) + payload.set_exception(_PAYLOAD_ACCESS_ERROR) except asyncio.CancelledError: - self.log_debug("Ignored premature client disconnection ") - break - except RuntimeError as exc: - if self.debug: - self.log_exception("Unhandled runtime exception", exc_info=exc) - self.force_close() + self.log_debug("Ignored premature client disconnection") + raise except Exception as exc: self.log_exception("Unhandled exception", exc_info=exc) self.force_close() @@ -584,11 +616,12 @@ async def start(self) -> None: if self._keepalive and not self._close: # start keep-alive timer if keepalive_timeout is not None: - now = self._loop.time() - self._keepalive_time = now + now = loop.time() + close_time = now + keepalive_timeout + self._next_keepalive_close_time = close_time if self._keepalive_handle is None: self._keepalive_handle = loop.call_at( - now + keepalive_timeout, self._process_keepalive + close_time, self._process_keepalive ) else: break @@ -601,7 +634,7 @@ async def start(self) -> None: async def finish_response( self, request: BaseRequest, resp: StreamResponse, start_time: float - ) -> bool: + ) -> Tuple[StreamResponse, bool]: """Prepare the response and write_eof, then log access. This has to @@ -609,6 +642,7 @@ async def finish_response( can get exception information. Returns True if the client disconnects prematurely. """ + request._finish() if self._request_parser is not None: self._request_parser.set_upgraded(False) self._upgrade = False @@ -619,22 +653,26 @@ async def finish_response( prepare_meth = resp.prepare except AttributeError: if resp is None: - raise RuntimeError("Missing return " "statement on request handler") + self.log_exception("Missing return statement on request handler") else: - raise RuntimeError( - "Web-handler should return " - "a response instance, " + self.log_exception( + "Web-handler should return a response instance, " "got {!r}".format(resp) ) + exc = HTTPInternalServerError() + resp = Response( + status=exc.status, reason=exc.reason, text=exc.text, headers=exc.headers + ) + prepare_meth = resp.prepare try: await prepare_meth(request) await resp.write_eof() except ConnectionError: self.log_access(request, resp, start_time) - return True - else: - self.log_access(request, resp, start_time) - return False + return resp, True + + self.log_access(request, resp, start_time) + return resp, False def handle_error( self, diff --git a/contrib/python/aiohttp/aiohttp/web_request.py b/contrib/python/aiohttp/aiohttp/web_request.py index 4bc670a798c5..eca71e4413a4 100644 --- a/contrib/python/aiohttp/aiohttp/web_request.py +++ b/contrib/python/aiohttp/aiohttp/web_request.py @@ -79,7 +79,7 @@ class FileField: filename: str file: io.BufferedReader content_type: str - headers: "CIMultiDictProxy[str]" + headers: CIMultiDictProxy[str] _TCHAR: Final[str] = string.digits + string.ascii_letters + r"!#$%&'*+.^_`|~-" @@ -99,10 +99,10 @@ class FileField: qdtext=_QDTEXT, quoted_pair=_QUOTED_PAIR ) -_FORWARDED_PAIR: Final[ - str -] = r"({token})=({token}|{quoted_string})(:\d{{1,4}})?".format( - token=_TOKEN, quoted_string=_QUOTED_STRING +_FORWARDED_PAIR: Final[str] = ( + r"({token})=({token}|{quoted_string})(:\d{{1,4}})?".format( + token=_TOKEN, quoted_string=_QUOTED_STRING + ) ) _QUOTED_PAIR_REPLACE_RE: Final[Pattern[str]] = re.compile(r"\\([\t !-~])") @@ -169,12 +169,16 @@ def __init__( self._payload_writer = payload_writer self._payload = payload - self._headers = message.headers + self._headers: CIMultiDictProxy[str] = message.headers self._method = message.method self._version = message.version self._cache: Dict[str, Any] = {} url = message.url if url.is_absolute(): + if scheme is not None: + url = url.with_scheme(scheme) + if host is not None: + url = url.with_host(host) # absolute URL is given, # override auto-calculating url, host, and scheme # all other properties should be good @@ -184,6 +188,10 @@ def __init__( self._rel_url = url.relative() else: self._rel_url = message.url + if scheme is not None: + self._cache["scheme"] = scheme + if host is not None: + self._cache["host"] = host self._post: Optional[MultiDictProxy[Union[str, bytes, FileField]]] = None self._read_bytes: Optional[bytes] = None @@ -197,10 +205,6 @@ def __init__( self._transport_sslcontext = transport.get_extra_info("sslcontext") self._transport_peername = transport.get_extra_info("peername") - if scheme is not None: - self._cache["scheme"] = scheme - if host is not None: - self._cache["host"] = host if remote is not None: self._cache["remote"] = remote @@ -235,7 +239,8 @@ def clone( # a copy semantic dct["headers"] = CIMultiDictProxy(CIMultiDict(headers)) dct["raw_headers"] = tuple( - (k.encode("utf-8"), v.encode("utf-8")) for k, v in headers.items() + (k.encode("utf-8"), v.encode("utf-8")) + for k, v in dct["headers"].items() ) message = self._message._replace(**dct) @@ -481,7 +486,7 @@ def raw_path(self) -> str: @reify def query(self) -> "MultiMapping[str]": """A multidict with all the variables in the query string.""" - return MultiDictProxy(self._rel_url.query) + return self._rel_url.query @reify def query_string(self) -> str: @@ -492,7 +497,7 @@ def query_string(self) -> str: return self._rel_url.query_string @reify - def headers(self) -> "MultiMapping[str]": + def headers(self) -> CIMultiDictProxy[str]: """A case-insensitive multidict proxy with all headers.""" return self._headers @@ -819,6 +824,18 @@ async def _prepare_hook(self, response: StreamResponse) -> None: def _cancel(self, exc: BaseException) -> None: set_exception(self._payload, exc) + def _finish(self) -> None: + if self._post is None or self.content_type != "multipart/form-data": + return + + # NOTE: Release file descriptors for the + # NOTE: `tempfile.Temporaryfile`-created `_io.BufferedRandom` + # NOTE: instances of files sent within multipart request body + # NOTE: via HTTP POST request. + for file_name, file_field_object in self._post.items(): + if isinstance(file_field_object, FileField): + file_field_object.file.close() + class Request(BaseRequest): @@ -898,4 +915,5 @@ async def _prepare_hook(self, response: StreamResponse) -> None: if match_info is None: return for app in match_info._apps: - await app.on_response_prepare.send(self, response) + if on_response_prepare := app.on_response_prepare: + await on_response_prepare.send(self, response) diff --git a/contrib/python/aiohttp/aiohttp/web_response.py b/contrib/python/aiohttp/aiohttp/web_response.py index 40d6f01ecaa4..4307b2a98c80 100644 --- a/contrib/python/aiohttp/aiohttp/web_response.py +++ b/contrib/python/aiohttp/aiohttp/web_response.py @@ -41,6 +41,8 @@ from .payload import Payload from .typedefs import JSONEncoder, LooseHeaders +REASON_PHRASES = {http_status.value: http_status.phrase for http_status in HTTPStatus} + __all__ = ("ContentCoding", "StreamResponse", "Response", "json_response") @@ -52,6 +54,7 @@ BaseClass = collections.abc.MutableMapping +# TODO(py311): Convert to StrEnum for wider use class ContentCoding(enum.Enum): # The content codings that we have support for. # @@ -62,6 +65,8 @@ class ContentCoding(enum.Enum): identity = "identity" +CONTENT_CODINGS = {coding.value: coding for coding in ContentCoding} + ############################################################ # HTTP Response classes ############################################################ @@ -71,6 +76,8 @@ class StreamResponse(BaseClass, HeadersMixin): _length_check = True + _body: Union[None, bytes, bytearray, Payload] + def __init__( self, *, @@ -97,11 +104,11 @@ def __init__( else: self._headers = CIMultiDict() - self.set_status(status, reason) + self._set_status(status, reason) @property def prepared(self) -> bool: - return self._payload_writer is not None + return self._eof_sent or self._payload_writer is not None @property def task(self) -> "Optional[asyncio.Task[None]]": @@ -131,15 +138,15 @@ def set_status( status: int, reason: Optional[str] = None, ) -> None: - assert not self.prepared, ( - "Cannot change the response status code after " "the headers have been sent" - ) + assert ( + not self.prepared + ), "Cannot change the response status code after the headers have been sent" + self._set_status(status, reason) + + def _set_status(self, status: int, reason: Optional[str]) -> None: self._status = int(status) if reason is None: - try: - reason = HTTPStatus(self._status).phrase - except ValueError: - reason = "" + reason = REASON_PHRASES.get(self._status, "") self._reason = reason @property @@ -175,7 +182,7 @@ def enable_compression( ) -> None: """Enables response compression encoding.""" # Backwards compatibility for when force was a bool <0.17. - if type(force) == bool: + if isinstance(force, bool): force = ContentCoding.deflate if force else ContentCoding.identity warnings.warn( "Using boolean for force is deprecated #3318", DeprecationWarning @@ -403,8 +410,8 @@ async def _start_compression(self, request: "BaseRequest") -> None: # Encoding comparisons should be case-insensitive # https://www.rfc-editor.org/rfc/rfc9110#section-8.4.1 accept_encoding = request.headers.get(hdrs.ACCEPT_ENCODING, "").lower() - for coding in ContentCoding: - if coding.value in accept_encoding: + for value, coding in CONTENT_CODINGS.items(): + if value in accept_encoding: await self._do_start_compression(coding) return @@ -499,9 +506,7 @@ async def _write_headers(self) -> None: assert writer is not None # status line version = request.version - status_line = "HTTP/{}.{} {} {}".format( - version[0], version[1], self._status, self._reason - ) + status_line = f"HTTP/{version[0]}.{version[1]} {self._status} {self._reason}" await writer.write_headers(status_line, self._headers) async def write(self, data: bytes) -> None: @@ -650,21 +655,17 @@ def body(self) -> Optional[Union[bytes, Payload]]: return self._body @body.setter - def body(self, body: bytes) -> None: + def body(self, body: Any) -> None: if body is None: - self._body: Optional[bytes] = None - self._body_payload: bool = False + self._body = None elif isinstance(body, (bytes, bytearray)): self._body = body - self._body_payload = False else: try: self._body = body = payload.PAYLOAD_REGISTRY.get(body) except payload.LookupError: raise ValueError("Unsupported body type %r" % type(body)) - self._body_payload = True - headers = self._headers # set content-type @@ -673,7 +674,7 @@ def body(self, body: bytes) -> None: # copy payload headers if body.headers: - for (key, value) in body.headers.items(): + for key, value in body.headers.items(): if key not in headers: headers[key] = value @@ -697,7 +698,6 @@ def text(self, text: str) -> None: self.charset = "utf-8" self._body = text.encode(self.charset) - self._body_payload = False self._compressed_body = None @property @@ -711,7 +711,7 @@ def content_length(self) -> Optional[int]: if self._compressed_body is not None: # Return length of the compressed body return len(self._compressed_body) - elif self._body_payload: + elif isinstance(self._body, Payload): # A payload without content length, or a compressed payload return None elif self._body is not None: @@ -736,9 +736,8 @@ async def write_eof(self, data: bytes = b"") -> None: if body is not None: if self._must_be_empty_body: await super().write_eof() - elif self._body_payload: - payload = cast(Payload, body) - await payload.write(self._payload_writer) + elif isinstance(self._body, Payload): + await self._body.write(self._payload_writer) await super().write_eof() else: await super().write_eof(cast(bytes, body)) @@ -746,14 +745,13 @@ async def write_eof(self, data: bytes = b"") -> None: await super().write_eof() async def _start(self, request: "BaseRequest") -> AbstractStreamWriter: - if should_remove_content_length(request.method, self.status): - if hdrs.CONTENT_LENGTH in self._headers: + if hdrs.CONTENT_LENGTH in self._headers: + if should_remove_content_length(request.method, self.status): del self._headers[hdrs.CONTENT_LENGTH] - elif not self._chunked and hdrs.CONTENT_LENGTH not in self._headers: - if self._body_payload: - size = cast(Payload, self._body).size - if size is not None: - self._headers[hdrs.CONTENT_LENGTH] = str(size) + elif not self._chunked: + if isinstance(self._body, Payload): + if self._body.size is not None: + self._headers[hdrs.CONTENT_LENGTH] = str(self._body.size) else: body_len = len(self._body) if self._body else "0" # https://www.rfc-editor.org/rfc/rfc9110.html#section-8.6-7 @@ -765,7 +763,7 @@ async def _start(self, request: "BaseRequest") -> AbstractStreamWriter: return await super()._start(request) async def _do_start_compression(self, coding: ContentCoding) -> None: - if self._body_payload or self._chunked: + if self._chunked or isinstance(self._body, Payload): return await super()._do_start_compression(coding) if coding != ContentCoding.identity: diff --git a/contrib/python/aiohttp/aiohttp/web_routedef.py b/contrib/python/aiohttp/aiohttp/web_routedef.py index d79cd32a14a1..93802141c567 100644 --- a/contrib/python/aiohttp/aiohttp/web_routedef.py +++ b/contrib/python/aiohttp/aiohttp/web_routedef.py @@ -162,12 +162,10 @@ def __repr__(self) -> str: return f"" @overload - def __getitem__(self, index: int) -> AbstractRouteDef: - ... + def __getitem__(self, index: int) -> AbstractRouteDef: ... @overload - def __getitem__(self, index: slice) -> List[AbstractRouteDef]: - ... + def __getitem__(self, index: slice) -> List[AbstractRouteDef]: ... def __getitem__(self, index): # type: ignore[no-untyped-def] return self._items[index] diff --git a/contrib/python/aiohttp/aiohttp/web_runner.py b/contrib/python/aiohttp/aiohttp/web_runner.py index 19a4441658fd..0a237ede2c50 100644 --- a/contrib/python/aiohttp/aiohttp/web_runner.py +++ b/contrib/python/aiohttp/aiohttp/web_runner.py @@ -3,7 +3,7 @@ import socket import warnings from abc import ABC, abstractmethod -from typing import Any, Awaitable, Callable, List, Optional, Set +from typing import Any, List, Optional, Set from yarl import URL @@ -108,7 +108,7 @@ def __init__( @property def name(self) -> str: scheme = "https" if self._ssl_context else "http" - host = "0.0.0.0" if self._host is None else self._host + host = "0.0.0.0" if not self._host else self._host return str(URL.build(scheme=scheme, host=host, port=self._port)) async def start(self) -> None: @@ -238,14 +238,7 @@ async def start(self) -> None: class BaseRunner(ABC): - __slots__ = ( - "shutdown_callback", - "_handle_signals", - "_kwargs", - "_server", - "_sites", - "_shutdown_timeout", - ) + __slots__ = ("_handle_signals", "_kwargs", "_server", "_sites", "_shutdown_timeout") def __init__( self, @@ -254,7 +247,6 @@ def __init__( shutdown_timeout: float = 60.0, **kwargs: Any, ) -> None: - self.shutdown_callback: Optional[Callable[[], Awaitable[None]]] = None self._handle_signals = handle_signals self._kwargs = kwargs self._server: Optional[Server] = None @@ -312,10 +304,6 @@ async def cleanup(self) -> None: await asyncio.sleep(0) self._server.pre_shutdown() await self.shutdown() - - if self.shutdown_callback: - await self.shutdown_callback() - await self._server.shutdown(self._shutdown_timeout) await self._cleanup_server() diff --git a/contrib/python/aiohttp/aiohttp/web_server.py b/contrib/python/aiohttp/aiohttp/web_server.py index 52faacb164a0..973e7c154404 100644 --- a/contrib/python/aiohttp/aiohttp/web_server.py +++ b/contrib/python/aiohttp/aiohttp/web_server.py @@ -1,9 +1,9 @@ """Low level HTTP server.""" + import asyncio from typing import Any, Awaitable, Callable, Dict, List, Optional # noqa from .abc import AbstractStreamWriter -from .helpers import get_running_loop from .http_parser import RawRequestMessage from .streams import StreamReader from .web_protocol import RequestHandler, _RequestFactory, _RequestHandler @@ -22,7 +22,7 @@ def __init__( loop: Optional[asyncio.AbstractEventLoop] = None, **kwargs: Any ) -> None: - self._loop = get_running_loop(loop) + self._loop = loop or asyncio.get_event_loop() self._connections: Dict[RequestHandler, asyncio.Transport] = {} self._kwargs = kwargs self.requests_count = 0 @@ -43,7 +43,12 @@ def connection_lost( self, handler: RequestHandler, exc: Optional[BaseException] = None ) -> None: if handler in self._connections: - del self._connections[handler] + if handler._task_handler: + handler._task_handler.add_done_callback( + lambda f: self._connections.pop(handler, None) + ) + else: + del self._connections[handler] def _make_request( self, diff --git a/contrib/python/aiohttp/aiohttp/web_urldispatcher.py b/contrib/python/aiohttp/aiohttp/web_urldispatcher.py index 954291f64494..89abdc43fa65 100644 --- a/contrib/python/aiohttp/aiohttp/web_urldispatcher.py +++ b/contrib/python/aiohttp/aiohttp/web_urldispatcher.py @@ -8,8 +8,8 @@ import keyword import os import re +import sys import warnings -from contextlib import contextmanager from functools import wraps from pathlib import Path from types import MappingProxyType @@ -38,7 +38,7 @@ cast, ) -from yarl import URL, __version__ as yarl_version # type: ignore[attr-defined] +from yarl import URL, __version__ as yarl_version from . import hdrs from .abc import AbstractMatchInfo, AbstractRouter, AbstractView @@ -78,6 +78,12 @@ else: BaseDict = dict +CIRCULAR_SYMLINK_ERROR = ( + (OSError,) + if sys.version_info < (3, 10) and sys.platform.startswith("win32") + else (RuntimeError,) if sys.version_info < (3, 13) else () +) + YARL_VERSION: Final[Tuple[int, ...]] = tuple(map(int, yarl_version.split(".")[:2])) HTTP_METHOD_RE: Final[Pattern[str]] = re.compile( @@ -199,7 +205,7 @@ def __init__( @wraps(handler) async def handler_wrapper(request: Request) -> StreamResponse: - result = old_handler(request) + result = old_handler(request) # type: ignore[call-arg] if asyncio.iscoroutine(result): result = await result assert isinstance(result, StreamResponse) @@ -286,8 +292,8 @@ def current_app(self) -> "Application": assert app is not None return app - @contextmanager - def set_current_app(self, app: "Application") -> Generator[None, None, None]: + @current_app.setter + def current_app(self, app: "Application") -> None: if DEBUG: # pragma: no cover if app not in self._apps: raise RuntimeError( @@ -295,12 +301,7 @@ def set_current_app(self, app: "Application") -> Generator[None, None, None]: self._apps, app ) ) - prev = self._current_app self._current_app = app - try: - yield - finally: - self._current_app = prev def freeze(self) -> None: self._frozen = True @@ -334,6 +335,8 @@ async def _default_expect_handler(request: Request) -> None: if request.version == HttpVersion11: if expect.lower() == "100-continue": await request.writer.write(b"HTTP/1.1 100 Continue\r\n\r\n") + # Reset output_size as we haven't started the main body yet. + request.writer.output_size = 0 else: raise HTTPExpectationFailed(text="Unknown Expect: %s" % expect) @@ -372,7 +375,7 @@ def register_route(self, route: "ResourceRoute") -> None: async def resolve(self, request: Request) -> _Resolve: allowed_methods: Set[str] = set() - match_dict = self._match(request.rel_url.raw_path) + match_dict = self._match(request.rel_url.path_safe) if match_dict is None: return None, allowed_methods @@ -422,8 +425,7 @@ def _match(self, path: str) -> Optional[Dict[str, str]]: # string comparison is about 10 times faster than regexp matching if self._path == path: return {} - else: - return None + return None def raw_match(self, path: str) -> bool: return self._path == path @@ -447,6 +449,7 @@ class DynamicResource(Resource): def __init__(self, path: str, *, name: Optional[str] = None) -> None: super().__init__(name=name) + self._orig_path = path pattern = "" formatter = "" for part in ROUTE_RE.split(path): @@ -493,13 +496,12 @@ def _match(self, path: str) -> Optional[Dict[str, str]]: match = self._pattern.fullmatch(path) if match is None: return None - else: - return { - key: _unquote_path(value) for key, value in match.groupdict().items() - } + return { + key: _unquote_path_safe(value) for key, value in match.groupdict().items() + } def raw_match(self, path: str) -> bool: - return self._formatter == path + return self._orig_path == path def get_info(self) -> _InfoDict: return {"formatter": self._formatter, "pattern": self._pattern} @@ -557,14 +559,11 @@ def __init__( ) -> None: super().__init__(prefix, name=name) try: - directory = Path(directory) - if str(directory).startswith("~"): - directory = Path(os.path.expanduser(str(directory))) - directory = directory.resolve() - if not directory.is_dir(): - raise ValueError("Not a directory") - except (FileNotFoundError, ValueError) as error: - raise ValueError(f"No directory exists at '{directory}'") from error + directory = Path(directory).expanduser().resolve(strict=True) + except FileNotFoundError as error: + raise ValueError(f"'{directory}' does not exist") from error + if not directory.is_dir(): + raise ValueError(f"'{directory}' is not a directory") self._directory = directory self._show_index = show_index self._chunk_size = chunk_size @@ -644,7 +643,7 @@ def set_options_route(self, handler: Handler) -> None: ) async def resolve(self, request: Request) -> _Resolve: - path = request.rel_url.raw_path + path = request.rel_url.path_safe method = request.method allowed_methods = set(self._routes) if not path.startswith(self._prefix2) and path != self._prefix: @@ -653,7 +652,7 @@ async def resolve(self, request: Request) -> _Resolve: if method not in allowed_methods: return None, allowed_methods - match_dict = {"filename": _unquote_path(path[len(self._prefix) + 1 :])} + match_dict = {"filename": _unquote_path_safe(path[len(self._prefix) + 1 :])} return (UrlMappingMatchInfo(match_dict, self._routes[method]), allowed_methods) def __len__(self) -> int: @@ -664,59 +663,64 @@ def __iter__(self) -> Iterator[AbstractRoute]: async def _handle(self, request: Request) -> StreamResponse: rel_url = request.match_info["filename"] + filename = Path(rel_url) + if filename.anchor: + # rel_url is an absolute name like + # /static/\\machine_name\c$ or /static/D:\path + # where the static dir is totally different + raise HTTPForbidden() + + unresolved_path = self._directory.joinpath(filename) + loop = asyncio.get_running_loop() + return await loop.run_in_executor( + None, self._resolve_path_to_response, unresolved_path + ) + + def _resolve_path_to_response(self, unresolved_path: Path) -> StreamResponse: + """Take the unresolved path and query the file system to form a response.""" + # Check for access outside the root directory. For follow symlinks, URI + # cannot traverse out, but symlinks can. Otherwise, no access outside + # root is permitted. try: - filename = Path(rel_url) - if filename.anchor: - # rel_url is an absolute name like - # /static/\\machine_name\c$ or /static/D:\path - # where the static dir is totally different - raise HTTPForbidden() - unresolved_path = self._directory.joinpath(filename) if self._follow_symlinks: normalized_path = Path(os.path.normpath(unresolved_path)) normalized_path.relative_to(self._directory) - filepath = normalized_path.resolve() + file_path = normalized_path.resolve() else: - filepath = unresolved_path.resolve() - filepath.relative_to(self._directory) - except (ValueError, FileNotFoundError) as error: - # relatively safe - raise HTTPNotFound() from error - except HTTPForbidden: - raise - except Exception as error: - # perm error or other kind! - request.app.logger.exception(error) + file_path = unresolved_path.resolve() + file_path.relative_to(self._directory) + except (ValueError, *CIRCULAR_SYMLINK_ERROR) as error: + # ValueError is raised for the relative check. Circular symlinks + # raise here on resolving for python < 3.13. raise HTTPNotFound() from error - # on opening a dir, load its contents if allowed - if filepath.is_dir(): - if self._show_index: - try: + # if path is a directory, return the contents if permitted. Note the + # directory check will raise if a segment is not readable. + try: + if file_path.is_dir(): + if self._show_index: return Response( - text=self._directory_as_html(filepath), content_type="text/html" + text=self._directory_as_html(file_path), + content_type="text/html", ) - except PermissionError: + else: raise HTTPForbidden() - else: - raise HTTPForbidden() - elif filepath.is_file(): - return FileResponse(filepath, chunk_size=self._chunk_size) - else: - raise HTTPNotFound + except PermissionError as error: + raise HTTPForbidden() from error - def _directory_as_html(self, filepath: Path) -> str: - # returns directory's index as html + # Return the file response, which handles all other checks. + return FileResponse(file_path, chunk_size=self._chunk_size) - # sanity check - assert filepath.is_dir() + def _directory_as_html(self, dir_path: Path) -> str: + """returns directory's index as html.""" + assert dir_path.is_dir() - relative_path_to_dir = filepath.relative_to(self._directory).as_posix() + relative_path_to_dir = dir_path.relative_to(self._directory).as_posix() index_of = f"Index of /{html_escape(relative_path_to_dir)}" h1 = f"

{index_of}

" index_list = [] - dir_index = filepath.iterdir() + dir_index = dir_path.iterdir() for _file in sorted(dir_index): # show file url as relative to static path rel_path = _file.relative_to(self._directory).as_posix() @@ -750,13 +754,20 @@ class PrefixedSubAppResource(PrefixResource): def __init__(self, prefix: str, app: "Application") -> None: super().__init__(prefix) self._app = app - for resource in app.router.resources(): - resource.add_prefix(prefix) + self._add_prefix_to_resources(prefix) def add_prefix(self, prefix: str) -> None: super().add_prefix(prefix) - for resource in self._app.router.resources(): + self._add_prefix_to_resources(prefix) + + def _add_prefix_to_resources(self, prefix: str) -> None: + router = self._app.router + for resource in router.resources(): + # Since the canonical path of a resource is about + # to change, we need to unindex it and then reindex + router.unindex_resource(resource) resource.add_prefix(prefix) + router.index_resource(resource) def url_for(self, *args: str, **kwargs: str) -> URL: raise RuntimeError(".url_for() is not supported " "by sub-application root") @@ -765,11 +776,6 @@ def get_info(self) -> _InfoDict: return {"app": self._app, "prefix": self._prefix} async def resolve(self, request: Request) -> _Resolve: - if ( - not request.url.raw_path.startswith(self._prefix2) - and request.url.raw_path != self._prefix - ): - return None, set() match_info = await self._app.router.resolve(request) match_info.add_app(self._app) if isinstance(match_info.http_exception, HTTPMethodNotAllowed): @@ -1015,12 +1021,39 @@ def __init__(self) -> None: super().__init__() self._resources: List[AbstractResource] = [] self._named_resources: Dict[str, AbstractResource] = {} + self._resource_index: dict[str, list[AbstractResource]] = {} + self._matched_sub_app_resources: List[MatchedSubAppResource] = [] async def resolve(self, request: Request) -> UrlMappingMatchInfo: - method = request.method + resource_index = self._resource_index allowed_methods: Set[str] = set() - for resource in self._resources: + # Walk the url parts looking for candidates. We walk the url backwards + # to ensure the most explicit match is found first. If there are multiple + # candidates for a given url part because there are multiple resources + # registered for the same canonical path, we resolve them in a linear + # fashion to ensure registration order is respected. + url_part = request.rel_url.path_safe + while url_part: + for candidate in resource_index.get(url_part, ()): + match_dict, allowed = await candidate.resolve(request) + if match_dict is not None: + return match_dict + else: + allowed_methods |= allowed + if url_part == "/": + break + url_part = url_part.rpartition("/")[0] or "/" + + # + # We didn't find any candidates, so we'll try the matched sub-app + # resources which we have to walk in a linear fashion because they + # have regex/wildcard match rules and we cannot index them. + # + # For most cases we do not expect there to be many of these since + # currently they are only added by `add_domain` + # + for resource in self._matched_sub_app_resources: match_dict, allowed = await resource.resolve(request) if match_dict is not None: return match_dict @@ -1028,9 +1061,9 @@ async def resolve(self, request: Request) -> UrlMappingMatchInfo: allowed_methods |= allowed if allowed_methods: - return MatchInfoError(HTTPMethodNotAllowed(method, allowed_methods)) - else: - return MatchInfoError(HTTPNotFound()) + return MatchInfoError(HTTPMethodNotAllowed(request.method, allowed_methods)) + + return MatchInfoError(HTTPNotFound()) def __iter__(self) -> Iterator[str]: return iter(self._named_resources) @@ -1086,6 +1119,36 @@ def register_resource(self, resource: AbstractResource) -> None: self._named_resources[name] = resource self._resources.append(resource) + if isinstance(resource, MatchedSubAppResource): + # We cannot index match sub-app resources because they have match rules + self._matched_sub_app_resources.append(resource) + else: + self.index_resource(resource) + + def _get_resource_index_key(self, resource: AbstractResource) -> str: + """Return a key to index the resource in the resource index.""" + if "{" in (index_key := resource.canonical): + # strip at the first { to allow for variables, and than + # rpartition at / to allow for variable parts in the path + # For example if the canonical path is `/core/locations{tail:.*}` + # the index key will be `/core` since index is based on the + # url parts split by `/` + index_key = index_key.partition("{")[0].rpartition("/")[0] + return index_key.rstrip("/") or "/" + + def index_resource(self, resource: AbstractResource) -> None: + """Add a resource to the resource index.""" + resource_key = self._get_resource_index_key(resource) + # There may be multiple resources for a canonical path + # so we keep them in a list to ensure that registration + # order is respected. + self._resource_index.setdefault(resource_key, []).append(resource) + + def unindex_resource(self, resource: AbstractResource) -> None: + """Remove a resource from the resource index.""" + resource_key = self._get_resource_index_key(resource) + self._resource_index[resource_key].remove(resource) + def add_resource(self, path: str, *, name: Optional[str] = None) -> Resource: if path and not path.startswith("/"): raise ValueError("path should be started with / or be empty") @@ -1095,7 +1158,7 @@ def add_resource(self, path: str, *, name: Optional[str] = None) -> Resource: if resource.name == name and resource.raw_match(path): return cast(Resource, resource) if not ("{" in path or "}" in path or ROUTE_RE.search(path)): - resource = PlainResource(_requote_path(path), name=name) + resource = PlainResource(path, name=name) self.register_resource(resource) return resource resource = DynamicResource(path, name=name) @@ -1221,8 +1284,10 @@ def _quote_path(value: str) -> str: return URL.build(path=value, encoded=False).raw_path -def _unquote_path(value: str) -> str: - return URL.build(path=value, encoded=True).path +def _unquote_path_safe(value: str) -> str: + if "%" not in value: + return value + return value.replace("%2F", "/").replace("%25", "%") def _requote_path(value: str) -> str: diff --git a/contrib/python/aiohttp/aiohttp/web_ws.py b/contrib/python/aiohttp/aiohttp/web_ws.py index 9fe665275395..382223097ea6 100644 --- a/contrib/python/aiohttp/aiohttp/web_ws.py +++ b/contrib/python/aiohttp/aiohttp/web_ws.py @@ -11,7 +11,7 @@ from . import hdrs from .abc import AbstractStreamWriter -from .helpers import call_later, set_exception, set_result +from .helpers import calculate_timeout_when, set_exception, set_result from .http import ( WS_CLOSED_MESSAGE, WS_CLOSING_MESSAGE, @@ -81,67 +81,119 @@ def __init__( self._conn_lost = 0 self._close_code: Optional[int] = None self._loop: Optional[asyncio.AbstractEventLoop] = None - self._waiting: Optional[asyncio.Future[bool]] = None + self._waiting: bool = False + self._close_wait: Optional[asyncio.Future[None]] = None self._exception: Optional[BaseException] = None self._timeout = timeout self._receive_timeout = receive_timeout self._autoclose = autoclose self._autoping = autoping self._heartbeat = heartbeat + self._heartbeat_when = 0.0 self._heartbeat_cb: Optional[asyncio.TimerHandle] = None if heartbeat is not None: self._pong_heartbeat = heartbeat / 2.0 self._pong_response_cb: Optional[asyncio.TimerHandle] = None self._compress = compress self._max_msg_size = max_msg_size + self._ping_task: Optional[asyncio.Task[None]] = None def _cancel_heartbeat(self) -> None: - if self._pong_response_cb is not None: - self._pong_response_cb.cancel() - self._pong_response_cb = None - + self._cancel_pong_response_cb() if self._heartbeat_cb is not None: self._heartbeat_cb.cancel() self._heartbeat_cb = None + if self._ping_task is not None: + self._ping_task.cancel() + self._ping_task = None - def _reset_heartbeat(self) -> None: - self._cancel_heartbeat() + def _cancel_pong_response_cb(self) -> None: + if self._pong_response_cb is not None: + self._pong_response_cb.cancel() + self._pong_response_cb = None - if self._heartbeat is not None: - assert self._loop is not None - self._heartbeat_cb = call_later( - self._send_heartbeat, - self._heartbeat, - self._loop, - timeout_ceil_threshold=self._req._protocol._timeout_ceil_threshold - if self._req is not None - else 5, - ) + def _reset_heartbeat(self) -> None: + if self._heartbeat is None: + return + self._cancel_pong_response_cb() + req = self._req + timeout_ceil_threshold = ( + req._protocol._timeout_ceil_threshold if req is not None else 5 + ) + loop = self._loop + assert loop is not None + now = loop.time() + when = calculate_timeout_when(now, self._heartbeat, timeout_ceil_threshold) + self._heartbeat_when = when + if self._heartbeat_cb is None: + # We do not cancel the previous heartbeat_cb here because + # it generates a significant amount of TimerHandle churn + # which causes asyncio to rebuild the heap frequently. + # Instead _send_heartbeat() will reschedule the next + # heartbeat if it fires too early. + self._heartbeat_cb = loop.call_at(when, self._send_heartbeat) def _send_heartbeat(self) -> None: - if self._heartbeat is not None and not self._closed: - assert self._loop is not None - # fire-and-forget a task is not perfect but maybe ok for - # sending ping. Otherwise we need a long-living heartbeat - # task in the class. - self._loop.create_task(self._writer.ping()) # type: ignore[union-attr] - - if self._pong_response_cb is not None: - self._pong_response_cb.cancel() - self._pong_response_cb = call_later( - self._pong_not_received, - self._pong_heartbeat, - self._loop, - timeout_ceil_threshold=self._req._protocol._timeout_ceil_threshold - if self._req is not None - else 5, + self._heartbeat_cb = None + loop = self._loop + assert loop is not None and self._writer is not None + now = loop.time() + if now < self._heartbeat_when: + # Heartbeat fired too early, reschedule + self._heartbeat_cb = loop.call_at( + self._heartbeat_when, self._send_heartbeat ) + return + + req = self._req + timeout_ceil_threshold = ( + req._protocol._timeout_ceil_threshold if req is not None else 5 + ) + when = calculate_timeout_when(now, self._pong_heartbeat, timeout_ceil_threshold) + self._cancel_pong_response_cb() + self._pong_response_cb = loop.call_at(when, self._pong_not_received) + + if sys.version_info >= (3, 12): + # Optimization for Python 3.12, try to send the ping + # immediately to avoid having to schedule + # the task on the event loop. + ping_task = asyncio.Task(self._writer.ping(), loop=loop, eager_start=True) + else: + ping_task = loop.create_task(self._writer.ping()) + + if not ping_task.done(): + self._ping_task = ping_task + ping_task.add_done_callback(self._ping_task_done) + else: + self._ping_task_done(ping_task) + + def _ping_task_done(self, task: "asyncio.Task[None]") -> None: + """Callback for when the ping task completes.""" + if not task.cancelled() and (exc := task.exception()): + self._handle_ping_pong_exception(exc) + self._ping_task = None def _pong_not_received(self) -> None: if self._req is not None and self._req.transport is not None: - self._closed = True - self._set_code_close_transport(WSCloseCode.ABNORMAL_CLOSURE) - self._exception = asyncio.TimeoutError() + self._handle_ping_pong_exception(asyncio.TimeoutError()) + + def _handle_ping_pong_exception(self, exc: BaseException) -> None: + """Handle exceptions raised during ping/pong processing.""" + if self._closed: + return + self._set_closed() + self._set_code_close_transport(WSCloseCode.ABNORMAL_CLOSURE) + self._exception = exc + if self._waiting and not self._closing and self._reader is not None: + self._reader.feed_data(WSMessage(WSMsgType.ERROR, exc, None)) + + def _set_closed(self) -> None: + """Set the connection to closed. + + Cancel any heartbeat timers and set the closed flag. + """ + self._closed = True + self._cancel_heartbeat() async def prepare(self, request: BaseRequest) -> AbstractStreamWriter: # make pre-check to don't hide it by do_handshake() exceptions @@ -366,20 +418,10 @@ async def close( if self._writer is None: raise RuntimeError("Call .prepare() first") - self._cancel_heartbeat() - reader = self._reader - assert reader is not None - - # we need to break `receive()` cycle first, - # `close()` may be called from different task - if self._waiting is not None and not self._closed: - reader.feed_data(WS_CLOSING_MESSAGE, 0) - await self._waiting - if self._closed: return False + self._set_closed() - self._closed = True try: await self._writer.close(code, message) writer = self._payload_writer @@ -394,12 +436,21 @@ async def close( self._set_code_close_transport(WSCloseCode.ABNORMAL_CLOSURE) return True + reader = self._reader + assert reader is not None + # we need to break `receive()` cycle before we can call + # `reader.read()` as `close()` may be called from different task + if self._waiting: + assert self._loop is not None + assert self._close_wait is None + self._close_wait = self._loop.create_future() + reader.feed_data(WS_CLOSING_MESSAGE) + await self._close_wait + if self._closing: self._close_transport() return True - reader = self._reader - assert reader is not None try: async with async_timeout.timeout(self._timeout): msg = await reader.read() @@ -411,7 +462,7 @@ async def close( self._set_code_close_transport(WSCloseCode.ABNORMAL_CLOSURE) return True - if msg.type == WSMsgType.CLOSE: + if msg.type is WSMsgType.CLOSE: self._set_code_close_transport(msg.data) return True @@ -423,6 +474,7 @@ def _set_closing(self, code: WSCloseCode) -> None: """Set the close code and mark the connection as closing.""" self._closing = True self._close_code = code + self._cancel_heartbeat() def _set_code_close_transport(self, code: WSCloseCode) -> None: """Set the close code and close the transport.""" @@ -440,8 +492,9 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage: loop = self._loop assert loop is not None + receive_timeout = timeout or self._receive_timeout while True: - if self._waiting is not None: + if self._waiting: raise RuntimeError("Concurrent call to receive() is not allowed") if self._closed: @@ -453,15 +506,22 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage: return WS_CLOSING_MESSAGE try: - self._waiting = loop.create_future() + self._waiting = True try: - async with async_timeout.timeout(timeout or self._receive_timeout): + if receive_timeout: + # Entering the context manager and creating + # Timeout() object can take almost 50% of the + # run time in this loop so we avoid it if + # there is no read timeout. + async with async_timeout.timeout(receive_timeout): + msg = await self._reader.read() + else: msg = await self._reader.read() self._reset_heartbeat() finally: - waiter = self._waiting - set_result(waiter, True) - self._waiting = None + self._waiting = False + if self._close_wait: + set_result(self._close_wait, None) except asyncio.TimeoutError: raise except EofStream: @@ -478,7 +538,7 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage: await self.close() return WSMessage(WSMsgType.ERROR, exc, None) - if msg.type == WSMsgType.CLOSE: + if msg.type is WSMsgType.CLOSE: self._set_closing(msg.data) # Could be closed while awaiting reader. if not self._closed and self._autoclose: @@ -487,19 +547,19 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage: # want to drain any pending writes as it will # likely result writing to a broken pipe. await self.close(drain=False) - elif msg.type == WSMsgType.CLOSING: + elif msg.type is WSMsgType.CLOSING: self._set_closing(WSCloseCode.OK) - elif msg.type == WSMsgType.PING and self._autoping: + elif msg.type is WSMsgType.PING and self._autoping: await self.pong(msg.data) continue - elif msg.type == WSMsgType.PONG and self._autoping: + elif msg.type is WSMsgType.PONG and self._autoping: continue return msg async def receive_str(self, *, timeout: Optional[float] = None) -> str: msg = await self.receive(timeout) - if msg.type != WSMsgType.TEXT: + if msg.type is not WSMsgType.TEXT: raise TypeError( "Received message {}:{!r} is not WSMsgType.TEXT".format( msg.type, msg.data @@ -509,7 +569,7 @@ async def receive_str(self, *, timeout: Optional[float] = None) -> str: async def receive_bytes(self, *, timeout: Optional[float] = None) -> bytes: msg = await self.receive(timeout) - if msg.type != WSMsgType.BINARY: + if msg.type is not WSMsgType.BINARY: raise TypeError(f"Received message {msg.type}:{msg.data!r} is not bytes") return cast(bytes, msg.data) @@ -535,5 +595,6 @@ def _cancel(self, exc: BaseException) -> None: # web_protocol calls this from connection_lost # or when the server is shutting down. self._closing = True + self._cancel_heartbeat() if self._reader is not None: set_exception(self._reader, exc) diff --git a/contrib/python/aiohttp/patches/04-force-content-type.patch b/contrib/python/aiohttp/patches/04-force-content-type.patch new file mode 100644 index 000000000000..445694133073 --- /dev/null +++ b/contrib/python/aiohttp/patches/04-force-content-type.patch @@ -0,0 +1,12 @@ +--- contrib/python/aiohttp/aiohttp/web_response.py (ddcb92de87597ba3c0a8961e7fdf04a184c227ce) ++++ contrib/python/aiohttp/aiohttp/web_response.py (0978c4fe84e8994e041f045b1447dd8058efa52c) +@@ -487,8 +487,7 @@ class StreamResponse(BaseClass, HeadersMixin): + # https://datatracker.ietf.org/doc/html/rfc9112#section-6.1-13 + if hdrs.TRANSFER_ENCODING in headers: + del headers[hdrs.TRANSFER_ENCODING] +- elif self.content_length != 0: +- # https://www.rfc-editor.org/rfc/rfc9110#section-8.3-5 ++ else: + headers.setdefault(hdrs.CONTENT_TYPE, "application/octet-stream") + headers.setdefault(hdrs.DATE, rfc822_formatted_time()) + headers.setdefault(hdrs.SERVER, SERVER_SOFTWARE) diff --git a/contrib/python/aiohttp/patches/04-pr11265-support-aiosignal-1.4.patch b/contrib/python/aiohttp/patches/04-pr11265-support-aiosignal-1.4.patch index 0bfc1cc3a870..3b478e3aca5a 100644 --- a/contrib/python/aiohttp/patches/04-pr11265-support-aiosignal-1.4.patch +++ b/contrib/python/aiohttp/patches/04-pr11265-support-aiosignal-1.4.patch @@ -1,6 +1,6 @@ --- contrib/python/aiohttp/aiohttp/tracing.py (index) +++ contrib/python/aiohttp/aiohttp/tracing.py (working tree) -@@ -12,15 +12,7 @@ if TYPE_CHECKING: +@@ -12,14 +12,7 @@ if TYPE_CHECKING: from .client import ClientSession _ParamT_contra = TypeVar("_ParamT_contra", contravariant=True) @@ -11,98 +11,83 @@ - __client_session: ClientSession, - __trace_config_ctx: SimpleNamespace, - __params: _ParamT_contra, -- ) -> Awaitable[None]: -- ... +- ) -> Awaitable[None]: ... + _TracingSignal = Signal[ClientSession, SimpleNamespace, _ParamT_contra] __all__ = ( -@@ -50,53 +42,53 @@ class TraceConfig: +@@ -49,54 +42,24 @@ class TraceConfig: def __init__( self, trace_config_ctx_factory: Type[SimpleNamespace] = SimpleNamespace ) -> None: -- self._on_request_start: Signal[ -- _SignalCallback[TraceRequestStartParams] -+ self._on_request_start: _TracingSignal[ -+ TraceRequestStartParams - ] = Signal(self) +- self._on_request_start: Signal[_SignalCallback[TraceRequestStartParams]] = ( ++ self._on_request_start: _TracingSignal[TraceRequestStartParams] = ( + Signal(self) + ) - self._on_request_chunk_sent: Signal[ - _SignalCallback[TraceRequestChunkSentParams] -+ self._on_request_chunk_sent: _TracingSignal[ -+ TraceRequestChunkSentParams - ] = Signal(self) +- ] = Signal(self) - self._on_response_chunk_received: Signal[ - _SignalCallback[TraceResponseChunkReceivedParams] -+ self._on_response_chunk_received: _TracingSignal[ -+ TraceResponseChunkReceivedParams - ] = Signal(self) +- ] = Signal(self) - self._on_request_end: Signal[_SignalCallback[TraceRequestEndParams]] = Signal( -+ self._on_request_end: _TracingSignal[TraceRequestEndParams] = Signal( - self - ) +- self +- ) - self._on_request_exception: Signal[ - _SignalCallback[TraceRequestExceptionParams] -+ self._on_request_exception: _TracingSignal[ -+ TraceRequestExceptionParams - ] = Signal(self) +- ] = Signal(self) - self._on_request_redirect: Signal[ - _SignalCallback[TraceRequestRedirectParams] -+ self._on_request_redirect: _TracingSignal[ -+ TraceRequestRedirectParams - ] = Signal(self) +- ] = Signal(self) - self._on_connection_queued_start: Signal[ - _SignalCallback[TraceConnectionQueuedStartParams] -+ self._on_connection_queued_start: _TracingSignal[ -+ TraceConnectionQueuedStartParams - ] = Signal(self) +- ] = Signal(self) - self._on_connection_queued_end: Signal[ - _SignalCallback[TraceConnectionQueuedEndParams] -+ self._on_connection_queued_end: _TracingSignal[ -+ TraceConnectionQueuedEndParams - ] = Signal(self) +- ] = Signal(self) - self._on_connection_create_start: Signal[ - _SignalCallback[TraceConnectionCreateStartParams] -+ self._on_connection_create_start: _TracingSignal[ -+ TraceConnectionCreateStartParams - ] = Signal(self) +- ] = Signal(self) - self._on_connection_create_end: Signal[ - _SignalCallback[TraceConnectionCreateEndParams] -+ self._on_connection_create_end: _TracingSignal[ -+ TraceConnectionCreateEndParams - ] = Signal(self) +- ] = Signal(self) - self._on_connection_reuseconn: Signal[ - _SignalCallback[TraceConnectionReuseconnParams] -+ self._on_connection_reuseconn: _TracingSignal[ -+ TraceConnectionReuseconnParams - ] = Signal(self) +- ] = Signal(self) - self._on_dns_resolvehost_start: Signal[ - _SignalCallback[TraceDnsResolveHostStartParams] -+ self._on_dns_resolvehost_start: _TracingSignal[ -+ TraceDnsResolveHostStartParams - ] = Signal(self) +- ] = Signal(self) - self._on_dns_resolvehost_end: Signal[ - _SignalCallback[TraceDnsResolveHostEndParams] -+ self._on_dns_resolvehost_end: _TracingSignal[ -+ TraceDnsResolveHostEndParams - ] = Signal(self) -- self._on_dns_cache_hit: Signal[ -- _SignalCallback[TraceDnsCacheHitParams] -+ self._on_dns_cache_hit: _TracingSignal[ -+ TraceDnsCacheHitParams - ] = Signal(self) -- self._on_dns_cache_miss: Signal[ -- _SignalCallback[TraceDnsCacheMissParams] -+ self._on_dns_cache_miss: _TracingSignal[ -+ TraceDnsCacheMissParams - ] = Signal(self) +- ] = Signal(self) +- self._on_dns_cache_hit: Signal[_SignalCallback[TraceDnsCacheHitParams]] = ( +- Signal(self) +- ) +- self._on_dns_cache_miss: Signal[_SignalCallback[TraceDnsCacheMissParams]] = ( +- Signal(self) +- ) - self._on_request_headers_sent: Signal[ - _SignalCallback[TraceRequestHeadersSentParams] -+ self._on_request_headers_sent: _TracingSignal[ -+ TraceRequestHeadersSentParams - ] = Signal(self) +- ] = Signal(self) ++ self._on_request_chunk_sent: _TracingSignal[TraceRequestChunkSentParams] = Signal(self) ++ self._on_response_chunk_received: _TracingSignal[TraceResponseChunkReceivedParams] = Signal(self) ++ self._on_request_end: _TracingSignal[TraceRequestEndParams] = Signal(self) ++ self._on_request_exception: _TracingSignal[TraceRequestExceptionParams] = Signal(self) ++ self._on_request_redirect: _TracingSignal[TraceRequestRedirectParams] = Signal(self) ++ self._on_connection_queued_start: _TracingSignal[TraceConnectionQueuedStartParams] = Signal(self) ++ self._on_connection_queued_end: _TracingSignal[TraceConnectionQueuedEndParams] = Signal(self) ++ self._on_connection_create_start: _TracingSignal[TraceConnectionCreateStartParams] = Signal(self) ++ self._on_connection_create_end: _TracingSignal[TraceConnectionCreateEndParams] = Signal(self) ++ self._on_connection_reuseconn: _TracingSignal[TraceConnectionReuseconnParams] = Signal(self) ++ self._on_dns_resolvehost_start: _TracingSignal[TraceDnsResolveHostStartParams] = Signal(self) ++ self._on_dns_resolvehost_end: _TracingSignal[TraceDnsResolveHostEndParams] = Signal(self) ++ self._on_dns_cache_hit: _TracingSignal[TraceDnsCacheHitParams] = (Signal(self)) ++ self._on_dns_cache_miss: _TracingSignal[TraceDnsCacheMissParams] = (Signal(self)) ++ self._on_request_headers_sent: _TracingSignal[TraceRequestHeadersSentParams] = Signal(self) self._trace_config_ctx_factory = trace_config_ctx_factory -@@ -126,91 +118,89 @@ class TraceConfig: + +@@ -125,91 +88,91 @@ class TraceConfig: self._on_request_headers_sent.freeze() @property @@ -111,10 +96,10 @@ return self._on_request_start @property -- def on_request_chunk_sent( -- self, + def on_request_chunk_sent( + self, - ) -> "Signal[_SignalCallback[TraceRequestChunkSentParams]]": -+ def on_request_chunk_sent(self) -> "_TracingSignal[TraceRequestChunkSentParams]": ++ ) -> "_TracingSignal[TraceRequestChunkSentParams]": return self._on_request_chunk_sent @property diff --git a/contrib/python/aiohttp/patches/05-disable-retries-on-oidemponent-methods.patch b/contrib/python/aiohttp/patches/05-disable-retries-on-oidemponent-methods.patch new file mode 100644 index 000000000000..8bd072eeabea --- /dev/null +++ b/contrib/python/aiohttp/patches/05-disable-retries-on-oidemponent-methods.patch @@ -0,0 +1,11 @@ +--- contrib/python/aiohttp/aiohttp/client.py (index) ++++ contrib/python/aiohttp/aiohttp/client.py (working tree) +@@ -574,7 +574,7 @@ class ClientSession: + try: + with timer: + # https://www.rfc-editor.org/rfc/rfc9112.html#name-retrying-requests +- retry_persistent_connection = method in IDEMPOTENT_METHODS ++ retry_persistent_connection = False #method in IDEMPOTENT_METHODS + while True: + url, auth_from_url = strip_auth_from_url(url) + if not url.raw_host: diff --git a/contrib/python/aiohttp/patches/06-mypy-silence.patch b/contrib/python/aiohttp/patches/06-mypy-silence.patch new file mode 100644 index 000000000000..d18dca98aa46 --- /dev/null +++ b/contrib/python/aiohttp/patches/06-mypy-silence.patch @@ -0,0 +1,61 @@ +--- contrib/python/aiohttp/aiohttp/client.py ++++ contrib/python/aiohttp/aiohttp/client.py +@@ -174,11 +174,11 @@ class _RequestOptions(TypedDict, total=False): + read_until_eof: bool + proxy: Union[StrOrURL, None] + proxy_auth: Union[BasicAuth, None] +- timeout: "Union[ClientTimeout, _SENTINEL, None]" ++ timeout: "Union[ClientTimeout, _SENTINEL, int, float, None]" + ssl: Union[SSLContext, bool, Fingerprint] + server_hostname: Union[str, None] + proxy_headers: Union[LooseHeaders, None] +- trace_request_ctx: Union[Mapping[str, str], None] ++ trace_request_ctx: Any #Union[Mapping[str, str], None] + read_bufsize: Union[int, None] + auto_decompress: Union[bool, None] + max_line_size: Union[int, None] +--- contrib/python/aiohttp/aiohttp/typedefs.py ++++ contrib/python/aiohttp/aiohttp/typedefs.py +@@ -69,12 +69,7 @@ LooseCookies = Union[ + ] + + Handler = Callable[["Request"], Awaitable["StreamResponse"]] +- +- +-class Middleware(Protocol): +- def __call__( +- self, request: "Request", handler: Handler +- ) -> Awaitable["StreamResponse"]: ... ++Middleware = Callable[["Request", Handler], Awaitable["StreamResponse"]] + + + PathLike = Union[str, "os.PathLike[str]"] +--- contrib/python/aiohttp/aiohttp/multipart.py ++++ contrib/python/aiohttp/aiohttp/multipart.py +@@ -287,7 +287,7 @@ class BodyPartReader: + self._content_eof = 0 + self._cache: Dict[str, Any] = {} + +- def __aiter__(self: Self) -> Self: ++ def __aiter__(self: Self): + return self + + async def __anext__(self) -> bytes: +@@ -593,7 +593,7 @@ class MultipartReader: + response_wrapper_cls = MultipartResponseWrapper + #: Multipart reader class, used to handle multipart/* body parts. + #: None points to type(self) +- multipart_reader_cls: Optional[Type["MultipartReader"]] = None ++ multipart_reader_cls = None + #: Body part reader class for non multipart/* content types. + part_reader_cls = BodyPartReader + +@@ -614,7 +614,7 @@ class MultipartReader: + self._at_bof = True + self._unread: List[bytes] = [] + +- def __aiter__(self: Self) -> Self: ++ def __aiter__(self: Self): + return self + + async def __anext__( diff --git a/contrib/python/aiohttp/patches/07-dont-throw-at-newline.patch b/contrib/python/aiohttp/patches/07-dont-throw-at-newline.patch new file mode 100644 index 000000000000..815dd062c17d --- /dev/null +++ b/contrib/python/aiohttp/patches/07-dont-throw-at-newline.patch @@ -0,0 +1,12 @@ +# This patch is revert commit dd5bb073107caa1c764158b87fb8482124aad6c1 +--- contrib/python/aiohttp/aiohttp/web_response.py (index) ++++ contrib/python/aiohttp/aiohttp/web_response.py (working tree) +@@ -147,8 +147,6 @@ class StreamResponse(BaseClass, HeadersMixin): + self._status = int(status) + if reason is None: + reason = REASON_PHRASES.get(self._status, "") +- elif "\n" in reason: +- raise ValueError("Reason cannot contain \\n") + self._reason = reason + + @property diff --git a/contrib/python/aiohttp/patches/99-rep-get-running-loop.sh b/contrib/python/aiohttp/patches/99-rep-get-running-loop.sh new file mode 100644 index 000000000000..b97011e3c676 --- /dev/null +++ b/contrib/python/aiohttp/patches/99-rep-get-running-loop.sh @@ -0,0 +1,4 @@ +# This patch may be dropped after python 3.13 upver + +find aiohttp -type f -exec sed --in-place 's|loop or asyncio.get_running_loop|loop or asyncio.get_event_loop|g' '{}' ';' + diff --git a/contrib/python/aiohttp/ya.make b/contrib/python/aiohttp/ya.make index 40b3b6faabe0..e714d0fd4233 100644 --- a/contrib/python/aiohttp/ya.make +++ b/contrib/python/aiohttp/ya.make @@ -2,11 +2,12 @@ PY3_LIBRARY() -VERSION(3.9.5) +VERSION(3.10.6) LICENSE(Apache-2.0) PEERDIR( + contrib/python/aiohappyeyeballs contrib/python/aiosignal contrib/python/attrs contrib/python/frozenlist From 65b8155bcc5ec62f732e1adb11af8f6a34c5bb50 Mon Sep 17 00:00:00 2001 From: ermolovd Date: Tue, 21 Oct 2025 15:26:11 +0300 Subject: [PATCH 09/55] fix proto column filter for proto with EMBEDDED messages * Changelog entry Type: fix Component: cpp-sdk fix inferring column filter when running operations in protobuf format commit_hash:9263474e2121155b4678af32e0d20b5a685fac0c --- .../mapreduce/interface/protobuf_format.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/yt/cpp/mapreduce/interface/protobuf_format.cpp b/yt/cpp/mapreduce/interface/protobuf_format.cpp index 4962e85fc812..65090aa4d5b8 100644 --- a/yt/cpp/mapreduce/interface/protobuf_format.cpp +++ b/yt/cpp/mapreduce/interface/protobuf_format.cpp @@ -1102,18 +1102,29 @@ NTi::TTypePtr CreateStruct(TStringBuf fieldName, TVector members) TMaybe> InferColumnFilter(const ::google::protobuf::Descriptor& descriptor) { - auto isOtherColumns = [] (const ::google::protobuf::FieldDescriptor& field) { - return GetFieldOptions(&field).Type == EProtobufType::OtherColumns; + auto isOtherColumns = [] (const ::google::protobuf::FieldDescriptor* field) { + return GetFieldOptions(field).Type == EProtobufType::OtherColumns; + }; + auto isEmbeddedColumn = [] (const ::google::protobuf::FieldDescriptor* field) { + return GetFieldOptions(field).SerializationMode == EProtobufSerializationMode::Embedded; }; TVector result; result.reserve(descriptor.field_count()); for (int i = 0; i < descriptor.field_count(); ++i) { - const auto& field = *descriptor.field(i); + auto field = descriptor.field(i); if (isOtherColumns(field)) { return {}; } - result.push_back(GetColumnName(field)); + if (isEmbeddedColumn(field) && field->message_type() != nullptr) { + auto embeddedFilter = InferColumnFilter(*field->message_type()); + if (!embeddedFilter) { + return {}; + } + result.insert(result.end(), embeddedFilter->begin(), embeddedFilter->end()); + } else { + result.push_back(GetColumnName(*field)); + } } return result; } From f656a3c4932158f2911b7d9bcca18bc0d5b7b19f Mon Sep 17 00:00:00 2001 From: galtsev Date: Tue, 21 Oct 2025 15:27:28 +0300 Subject: [PATCH 10/55] YT-24506: Store original data weight in samples by default commit_hash:bb2298647d2c3dd6675622359583c9e4a9e3dc61 --- yt/yt/client/table_client/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt/yt/client/table_client/config.cpp b/yt/yt/client/table_client/config.cpp index c7e0948aa05e..baaf876379be 100644 --- a/yt/yt/client/table_client/config.cpp +++ b/yt/yt/client/table_client/config.cpp @@ -154,7 +154,7 @@ void TChunkWriterConfig::Register(TRegistrar registrar) .Default(0.0001); registrar.Parameter("use_original_data_weight_in_samples", &TThis::UseOriginalDataWeightInSamples) - .Default(false); + .Default(true); registrar.Parameter("chunk_indexes", &TThis::ChunkIndexes) .DefaultNew(); From a78abfefc09af44fa49d9b60a8680b18c266f556 Mon Sep 17 00:00:00 2001 From: ziganshinmr Date: Tue, 21 Oct 2025 15:35:09 +0300 Subject: [PATCH 11/55] YQL query dumper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Реализация full capture/replay (см тикет для информации) commit_hash:fbde9af7b610c053ee5e0e8c4936ac426aa9c827 --- yql/essentials/core/facade/yql_facade.cpp | 30 +- yql/essentials/core/facade/yql_facade.h | 2 + .../core/qplayer/storage/interface/ya.make | 2 + .../qplayer/storage/interface/yql_qstorage.h | 22 +- .../udf_resolver/yql_qplayer_udf_resolver.cpp | 11 +- .../core/services/yql_eval_expr.cpp | 4 +- yql/essentials/core/yql_data_provider.h | 3 + yql/essentials/core/yql_udf_resolver.h | 1 + .../providers/common/config/yql_dispatch.cpp | 5 + .../providers/common/config/yql_dispatch.h | 19 +- .../common/proto/gateways_config.proto | 1 + .../provider/yql_data_provider_impl.cpp | 4 + .../common/provider/yql_data_provider_impl.h | 1 + .../common/provider/yql_provider.cpp | 13 +- .../tools/yql_facade_run/yql_facade_run.cpp | 37 ++- .../tools/yql_facade_run/yql_facade_run.h | 1 + .../providers/yt/common/yql_configuration.h | 4 + .../providers/yt/common/yql_yt_settings.cpp | 55 ++-- yt/yql/providers/yt/common/yql_yt_settings.h | 9 +- .../providers/yt/gateway/file/yql_yt_file.cpp | 8 +- .../yt/gateway/lib/transaction_cache.cpp | 30 +- .../yt/gateway/lib/transaction_cache.h | 7 +- .../native/ut/yql_yt_native_folders_ut.cpp | 24 +- yt/yql/providers/yt/gateway/native/ya.make | 1 + .../yt/gateway/native/yql_yt_exec_ctx.cpp | 38 ++- .../yt/gateway/native/yql_yt_exec_ctx.h | 19 +- .../yt/gateway/native/yql_yt_native.cpp | 104 ++++++- .../yt/gateway/native/yql_yt_session.cpp | 2 + .../yt/gateway/native/yql_yt_session.h | 3 + .../yt/gateway/native/yql_yt_transform.cpp | 51 +++- .../yt/gateway/native/yql_yt_transform.h | 11 +- yt/yql/providers/yt/gateway/qplayer/ya.make | 16 +- .../qplayer/yql_yt_qplayer_gateway.cpp | 263 ++++++++++++++++-- .../gateway/qplayer/yql_yt_qplayer_gateway.h | 13 +- yt/yql/providers/yt/lib/dump_helpers/ya.make | 15 + .../lib/dump_helpers/yql_yt_dump_helpers.cpp | 43 +++ .../yt/lib/dump_helpers/yql_yt_dump_helpers.h | 16 ++ yt/yql/providers/yt/lib/full_capture/ya.make | 16 ++ .../lib/full_capture/yql_yt_full_capture.cpp | 73 +++++ .../yt/lib/full_capture/yql_yt_full_capture.h | 22 ++ yt/yql/providers/yt/provider/ya.make | 1 + .../providers/yt/provider/yql_yt_datasink.cpp | 4 + .../yt/provider/yql_yt_datasink_finalize.cpp | 8 +- .../yt/provider/yql_yt_forwarding_gateway.cpp | 5 +- .../yt/provider/yql_yt_forwarding_gateway.h | 4 +- yt/yql/providers/yt/provider/yql_yt_gateway.h | 29 +- .../providers/yt/provider/yql_yt_provider.cpp | 24 +- .../providers/yt/provider/yql_yt_provider.h | 10 +- 48 files changed, 966 insertions(+), 118 deletions(-) create mode 100644 yt/yql/providers/yt/lib/dump_helpers/ya.make create mode 100644 yt/yql/providers/yt/lib/dump_helpers/yql_yt_dump_helpers.cpp create mode 100644 yt/yql/providers/yt/lib/dump_helpers/yql_yt_dump_helpers.h create mode 100644 yt/yql/providers/yt/lib/full_capture/ya.make create mode 100644 yt/yql/providers/yt/lib/full_capture/yql_yt_full_capture.cpp create mode 100644 yt/yql/providers/yt/lib/full_capture/yql_yt_full_capture.h diff --git a/yql/essentials/core/facade/yql_facade.cpp b/yql/essentials/core/facade/yql_facade.cpp index 0b6f9eca6b60..bdfd809957e4 100644 --- a/yql/essentials/core/facade/yql_facade.cpp +++ b/yql/essentials/core/facade/yql_facade.cpp @@ -67,6 +67,7 @@ const TString StaticUserFilesLabel = "UserFiles"; const TString DynamicUserFilesLabel = "DynamicUserFiles"; const TString StaticCredentialsLabel = "Credentials"; const TString DynamicCredentialsLabel = "DynamicCredentials"; +const TString FullCaptureLabel = "FullCapture"; class TUrlLoader: public IUrlLoader { public: @@ -359,7 +360,7 @@ TProgram::TProgram( auto credList = NYT::NodeToYsonString(credListNode, NYT::NYson::EYsonFormat::Binary); QContext_.GetWriter()->Put({FacadeComponent, StaticCredentialsLabel}, credList).GetValueSync(); - } else if (QContext_.CanRead()) { + } else if (QContext_.CaptureMode() == EQPlayerCaptureMode::MetaOnly) { Credentials_ = MakeIntrusive(); Credentials_->SetUserCredentials({.OauthToken = "REPLAY_OAUTH", .BlackboxSessionIdCookie = "REPLAY_SESSIONID"}); @@ -535,6 +536,24 @@ TString TProgram::GetSourceCode() const { return SourceCode_; } +bool TProgram::IsFullCaptureReady() const { + if (!TypeCtx_ || !QContext_.CanWrite() || QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { + return false; + } + + for (auto& source : TypeCtx_->DataSources) { + if (!source->IsFullCaptureReady()) { + return false; + } + } + for (auto& sink : TypeCtx_->DataSinks) { + if (!sink->IsFullCaptureReady()) { + return false; + } + } + return true; +} + void TProgram::SetParametersYson(const TString& parameters) { Y_ENSURE(!TypeCtx_, "TypeCtx_ already created"); NYT::TNode node; @@ -736,6 +755,11 @@ void UpdateSqlFlagsFromQContext(const TQContext& qContext, THashSet& fl } } +bool HasFullCapture(const IQReaderPtr& reader) { + auto fullCaptureItem = reader->Get({FacadeComponent, FullCaptureLabel}).GetValueSync(); + return fullCaptureItem.Defined(); +} + void TProgram::HandleTranslationSettings(NSQLTranslation::TTranslationSettings& loadedSettings, NSQLTranslation::TTranslationSettings*& currentSettings) { @@ -1982,6 +2006,10 @@ NThreading::TFuture TProgram::CloseLastSession() { CloseLastSessionFuture_ = promise.GetFuture(); } + if (IsFullCaptureReady()) { + QContext_.GetWriter()->Put({FacadeComponent, FullCaptureLabel}, "").GetValueSync(); + } + TVector> closeFutures; closeFutures.reserve(dataProviders.size()); for (const auto& dp : dataProviders) { diff --git a/yql/essentials/core/facade/yql_facade.h b/yql/essentials/core/facade/yql_facade.h index 0f6767562adb..d0fb9ae05827 100644 --- a/yql/essentials/core/facade/yql_facade.h +++ b/yql/essentials/core/facade/yql_facade.h @@ -352,6 +352,7 @@ class TProgram: public TThrRefBase, private TNonCopyable { } TString GetSourceCode() const; + bool IsFullCaptureReady() const; void SetEnableLineage() { EnableLineage_ = true; @@ -491,5 +492,6 @@ class TProgram: public TThrRefBase, private TNonCopyable { }; void UpdateSqlFlagsFromQContext(const TQContext& qContext, THashSet& flags, TMaybe gatewaysPatch = {}); +bool HasFullCapture(const IQReaderPtr& reader); } // namespace NYql diff --git a/yql/essentials/core/qplayer/storage/interface/ya.make b/yql/essentials/core/qplayer/storage/interface/ya.make index 4b35b17c9545..41aebecff42e 100644 --- a/yql/essentials/core/qplayer/storage/interface/ya.make +++ b/yql/essentials/core/qplayer/storage/interface/ya.make @@ -8,4 +8,6 @@ PEERDIR( library/cpp/threading/future ) +GENERATE_ENUM_SERIALIZATION(yql_qstorage.h) + END() diff --git a/yql/essentials/core/qplayer/storage/interface/yql_qstorage.h b/yql/essentials/core/qplayer/storage/interface/yql_qstorage.h index 55230b33cfaa..dbcafc86bae3 100644 --- a/yql/essentials/core/qplayer/storage/interface/yql_qstorage.h +++ b/yql/essentials/core/qplayer/storage/interface/yql_qstorage.h @@ -92,19 +92,27 @@ class IQStorage { using IQStoragePtr = std::shared_ptr; +enum class EQPlayerCaptureMode { + None /* "none" */, + MetaOnly /* "meta" */, + Full /* "full" */, +}; + class TQContext { public: TQContext() { } - TQContext(IQReaderPtr reader) - : Reader_(reader) + TQContext(IQReaderPtr reader, EQPlayerCaptureMode captureMode = EQPlayerCaptureMode::MetaOnly) + : CaptureMode_(captureMode) + , Reader_(reader) { } - TQContext(IQWriterPtr writer) - : Writer_(writer) + TQContext(IQWriterPtr writer, EQPlayerCaptureMode captureMode = EQPlayerCaptureMode::MetaOnly) + : CaptureMode_(captureMode) + , Writer_(writer) { } @@ -115,6 +123,10 @@ class TQContext { return CanRead() || CanWrite(); } + EQPlayerCaptureMode CaptureMode() const { + return CaptureMode_; + } + bool CanRead() const { return Reader_ != nullptr; } @@ -132,6 +144,8 @@ class TQContext { } private: + EQPlayerCaptureMode CaptureMode_ = EQPlayerCaptureMode::None; + IQReaderPtr Reader_; IQWriterPtr Writer_; }; diff --git a/yql/essentials/core/qplayer/udf_resolver/yql_qplayer_udf_resolver.cpp b/yql/essentials/core/qplayer/udf_resolver/yql_qplayer_udf_resolver.cpp index 6339e50d90a6..95e4c17d3cf1 100644 --- a/yql/essentials/core/qplayer/udf_resolver/yql_qplayer_udf_resolver.cpp +++ b/yql/essentials/core/qplayer/udf_resolver/yql_qplayer_udf_resolver.cpp @@ -10,6 +10,7 @@ namespace NYql::NCommon { namespace { +const TString UdfResolver_GetSystemModulePath = "UdfResolver_GetSystemModulePath"; const TString UdfResolver_LoadMetadata = "UdfResolver_LoadMetadata"; const TString UdfResolver_ContainsModule = "UdfResolver_ContainsModule"; @@ -32,10 +33,16 @@ class TResolver: public IUdfResolver { TMaybe GetSystemModulePath(const TStringBuf& moduleName) const final { if (QContext_.CanRead()) { - return MakeMaybe("", ""); + auto res = QContext_.GetReader()->Get({UdfResolver_GetSystemModulePath, TString(moduleName)}).GetValueSync(); + return MakeMaybe(res ? res->Value : "", ""); } - return Inner_->GetSystemModulePath(moduleName); + auto res = Inner_->GetSystemModulePath(moduleName); + if (res && QContext_.CanWrite()) { + QContext_.GetWriter()->Put({UdfResolver_GetSystemModulePath, TString(moduleName)}, res->Path).GetValueSync(); + } + + return res; } bool LoadMetadata(const TVector& imports, diff --git a/yql/essentials/core/services/yql_eval_expr.cpp b/yql/essentials/core/services/yql_eval_expr.cpp index a15b64b7753f..17becb121b1c 100644 --- a/yql/essentials/core/services/yql_eval_expr.cpp +++ b/yql/essentials/core/services/yql_eval_expr.cpp @@ -1021,7 +1021,7 @@ IGraphTransformer::TStatus EvaluateExpression(const TExprNode::TPtr& input, TExp NYT::TNode ysonNode; if (types.QContext) { key = MakeCacheKey(*clonedArg); - if (types.QContext.CanRead()) { + if (types.QContext.CanRead() && types.QContext.CaptureMode() != EQPlayerCaptureMode::Full) { auto item = types.QContext.GetReader()->Get({EvaluationComponent, key}).GetValueSync(); if (!item) { throw yexception() << "Missing replay data"; @@ -1058,7 +1058,7 @@ IGraphTransformer::TStatus EvaluateExpression(const TExprNode::TPtr& input, TExp return nullptr; } - if (types.QContext.CanRead()) { + if (types.QContext.CanRead() && types.QContext.CaptureMode() != EQPlayerCaptureMode::Full) { break; } diff --git a/yql/essentials/core/yql_data_provider.h b/yql/essentials/core/yql_data_provider.h index c54378b2ff09..a60337bac7e4 100644 --- a/yql/essentials/core/yql_data_provider.h +++ b/yql/essentials/core/yql_data_provider.h @@ -195,6 +195,9 @@ class IDataProvider : public TThrRefBase { // layers virtual NLayers::ILayersIntegrationPtr GetLayersIntegration() const = 0; + + // query capture + virtual bool IsFullCaptureReady() = 0; }; struct IPipelineConfigurator; diff --git a/yql/essentials/core/yql_udf_resolver.h b/yql/essentials/core/yql_udf_resolver.h index 915a7a40407f..05330fade572 100644 --- a/yql/essentials/core/yql_udf_resolver.h +++ b/yql/essentials/core/yql_udf_resolver.h @@ -27,6 +27,7 @@ struct TFilePathWithMd5 { { } + TFilePathWithMd5(const TFilePathWithMd5& other) = default; TFilePathWithMd5& operator=(const TFilePathWithMd5& other) = default; }; diff --git a/yql/essentials/providers/common/config/yql_dispatch.cpp b/yql/essentials/providers/common/config/yql_dispatch.cpp index a42c1c3c899e..8b3a94219f68 100644 --- a/yql/essentials/providers/common/config/yql_dispatch.cpp +++ b/yql/essentials/providers/common/config/yql_dispatch.cpp @@ -117,6 +117,11 @@ bool TSettingDispatcher::Dispatch(const TString& cluster, const TString& name, c return errorCallback(TStringBuilder() << "Static setting " << name.Quote() << " cannot be reset to default", true); } + if (QContext_.CanRead() && QContext_.CaptureMode() == EQPlayerCaptureMode::Full && stage != EStage::CONFIG && handler->IgnoreInFullReplay()) { + YQL_CLOG(INFO, ProviderCommon) << "Ignoring setting " << name.Quote() << " in full replay mode"; + return true; + } + bool validateOnly = true; switch (stage) { case EStage::RUNTIME: diff --git a/yql/essentials/providers/common/config/yql_dispatch.h b/yql/essentials/providers/common/config/yql_dispatch.h index df9e92d4f2b5..a99d72f83415 100644 --- a/yql/essentials/providers/common/config/yql_dispatch.h +++ b/yql/essentials/providers/common/config/yql_dispatch.h @@ -125,6 +125,7 @@ class TSettingDispatcher: public TThrRefBase { virtual bool IsRuntime() const = 0; virtual bool IsPerCluster() const = 0; virtual bool IsDeprecated() const = 0; + virtual bool IgnoreInFullReplay() const = 0; protected: TString Name_; @@ -207,6 +208,10 @@ class TSettingDispatcher: public TThrRefBase { return Deprecated_; } + bool IgnoreInFullReplay() const override { + return IgnoreInFullReplay_; + } + TSettingHandlerImpl& Lower(TType lower) { Validators_.push_back([lower](const TString&, TType value) { if (value < lower) { @@ -325,6 +330,11 @@ class TSettingDispatcher: public TThrRefBase { return *this; } + TSettingHandlerImpl& IgnoreInFullReplay() { + IgnoreInFullReplay_ = true; + return *this; + } + private: TConfSetting& Setting_; TMaybe> Default_; @@ -333,9 +343,14 @@ class TSettingDispatcher: public TThrRefBase { TVector Validators_; TString Warning_; bool Deprecated_ = false; + bool IgnoreInFullReplay_ = false; }; - TSettingDispatcher() = default; + TSettingDispatcher(const TQContext& qContext = {}) + : QContext_(qContext) + { + } + TSettingDispatcher(const TSettingDispatcher&) = delete; template @@ -413,6 +428,8 @@ class TSettingDispatcher: public TThrRefBase { THashSet ValidClusters; // NOLINT(readability-identifier-naming) THashMap Handlers_; TSet Names_; + + const TQContext QContext_; }; } // namespace NCommon diff --git a/yql/essentials/providers/common/proto/gateways_config.proto b/yql/essentials/providers/common/proto/gateways_config.proto index 65a7cd957812..87e3b61ab165 100644 --- a/yql/essentials/providers/common/proto/gateways_config.proto +++ b/yql/essentials/providers/common/proto/gateways_config.proto @@ -524,6 +524,7 @@ message TYqlCoreConfig { repeated TCoreAttr Flags = 1; optional TActivationPercentage QPlayerActivation = 2; optional uint32 QPlayerRobotPercentage = 3 [default = 0]; + optional TActivationPercentage QPlayerFullCaptureActivation = 4; } /////////////////////////////// Sql Core /////////////////////////////// diff --git a/yql/essentials/providers/common/provider/yql_data_provider_impl.cpp b/yql/essentials/providers/common/provider/yql_data_provider_impl.cpp index 5392927591fc..21cd47329b71 100644 --- a/yql/essentials/providers/common/provider/yql_data_provider_impl.cpp +++ b/yql/essentials/providers/common/provider/yql_data_provider_impl.cpp @@ -361,6 +361,10 @@ NLayers::ILayersIntegrationPtr TDataProviderBase::GetLayersIntegration() const { return nullptr; } +bool TDataProviderBase::IsFullCaptureReady() { + return true; +} + TExprNode::TPtr DefaultCleanupWorld(const TExprNode::TPtr& node, TExprContext& ctx) { auto root = node; auto status = OptimizeExpr(root, root, [&](const TExprNode::TPtr& node, TExprContext& ctx) -> TExprNode::TPtr { diff --git a/yql/essentials/providers/common/provider/yql_data_provider_impl.h b/yql/essentials/providers/common/provider/yql_data_provider_impl.h index 1866b91e041b..99ae95bdfa00 100644 --- a/yql/essentials/providers/common/provider/yql_data_provider_impl.h +++ b/yql/essentials/providers/common/provider/yql_data_provider_impl.h @@ -96,6 +96,7 @@ class TDataProviderBase: public IDataProvider, public TPlanFormatterBase { IYtflowIntegration* GetYtflowIntegration() override; IYtflowOptimization* GetYtflowOptimization() override; NLayers::ILayersIntegrationPtr GetLayersIntegration() const override; + bool IsFullCaptureReady() override; protected: THolder DefConstraintTransformer_; diff --git a/yql/essentials/providers/common/provider/yql_provider.cpp b/yql/essentials/providers/common/provider/yql_provider.cpp index 15c59112d899..a4e5ffa697f9 100644 --- a/yql/essentials/providers/common/provider/yql_provider.cpp +++ b/yql/essentials/providers/common/provider/yql_provider.cpp @@ -1034,12 +1034,17 @@ bool FillUsedFilesImpl( if (addSysModule) { auto pathWithMd5 = types.UdfResolver->GetSystemModulePath(moduleName); YQL_ENSURE(pathWithMd5); + TUserDataBlock sysBlock; - sysBlock.Type = EUserDataType::PATH; - sysBlock.Data = pathWithMd5->Path; + if (!types.QContext.CanRead()) { + sysBlock.Type = EUserDataType::PATH; + sysBlock.Data = pathWithMd5->Path; + } else { + sysBlock.Type = EUserDataType::RAW_INLINE_DATA; + } sysBlock.Usage.Set(EUserDataBlockUsage::Udf); - auto alias = TFsPath(sysBlock.Data).GetName(); + auto alias = TFsPath(pathWithMd5->Path).GetName(); auto key = TUserDataKey::Udf(alias); if (const auto block = types.UserDataStorage->FindUserDataBlock(key)) { files[key] = *block; @@ -1230,7 +1235,7 @@ std::pair FreezeUsedF return SyncError(); } - if (types.QContext.CanRead()) { + if (types.QContext.CanRead() && types.QContext.CaptureMode() != EQPlayerCaptureMode::Full) { return SyncOk(); } diff --git a/yql/essentials/tools/yql_facade_run/yql_facade_run.cpp b/yql/essentials/tools/yql_facade_run/yql_facade_run.cpp index 5062d712f23c..7833b65106f0 100644 --- a/yql/essentials/tools/yql_facade_run/yql_facade_run.cpp +++ b/yql/essentials/tools/yql_facade_run/yql_facade_run.cpp @@ -399,16 +399,25 @@ void TFacadeRunOptions::Parse(int argc, const char* argv[]) { }); opts.AddLongOption("op-id", "QStorage operation id").StoreResult(&OperationId).DefaultValue("dummy_op"); opts.AddLongOption("capture", "Write query metadata to QStorage").NoArgument().Handler0([this]() { - if (EQPlayerMode::Replay == QPlayerMode) { - throw yexception() << "replay and capture options can't be used simultaneously"; + if (EQPlayerMode::None != QPlayerMode) { + throw yexception() << "QPlayer mode options (capture/capture-full/replay) can't be used simultaneously"; } QPlayerMode = EQPlayerMode::Capture; + QPlayerCaptureMode = EQPlayerCaptureMode::MetaOnly; + }); + opts.AddLongOption("capture-full", "Keep actual data needed for query run (input tables & attached files)").NoArgument().Handler0([this]() { + if (EQPlayerMode::None != QPlayerMode) { + throw yexception() << "QPlayer mode options (capture/capture-full/replay) can't be used simultaneously"; + } + QPlayerMode = EQPlayerMode::Capture; + QPlayerCaptureMode = EQPlayerCaptureMode::Full; }); opts.AddLongOption("replay", "Read query metadata from QStorage").NoArgument().Handler0([this]() { - if (EQPlayerMode::Capture == QPlayerMode) { - throw yexception() << "replay and capture options can't be used simultaneously"; + if (EQPlayerMode::None != QPlayerMode) { + throw yexception() << "QPlayer mode options (capture/capture-full/replay) can't be used simultaneously"; } QPlayerMode = EQPlayerMode::Replay; + QPlayerCaptureMode = EQPlayerCaptureMode::MetaOnly; }); opts.AddLongOption("gateways-patch", "QPlayer patch for gateways conf").Optional().RequiredArgument("FILE").Handler1T([this](const TString& file) { GatewaysPatch = TFileInput(file).ReadAll(); @@ -452,14 +461,22 @@ void TFacadeRunOptions::Parse(int argc, const char* argv[]) { } if (EQPlayerMode::Replay == QPlayerMode) { try { - QPlayerContext = TQContext(QPlayerStorage_->MakeReader(OperationId, {})); + auto reader = QPlayerStorage_->MakeReader(OperationId, {}); + if (Mode == ERunMode::Run) { + // Check replay data to contain full capture + if (HasFullCapture(reader)) { + QPlayerCaptureMode = EQPlayerCaptureMode::Full; + } + } + + QPlayerContext = TQContext(std::move(reader), QPlayerCaptureMode); } catch (...) { throw yexception() << "QPlayer replay is probably broken. Exception: " << CurrentExceptionMessage(); } ProgramFile = "-replay-"; ProgramText = ""; - } else if (EQPlayerMode::Capture == QPlayerMode) { - QPlayerContext = TQContext(QPlayerStorage_->MakeWriter(OperationId, {})); + } else { + QPlayerContext = TQContext(QPlayerStorage_->MakeWriter(OperationId, {}), QPlayerCaptureMode); } } if (EQPlayerMode::Replay != QPlayerMode && !ProgramText) { @@ -473,6 +490,10 @@ void TFacadeRunOptions::Parse(int argc, const char* argv[]) { throw yexception() << "At least one gateway from the list " << JoinSeq(",", SupportedGateways_).Quote() << " must be specified"; } + if (Mode == ERunMode::Run && QPlayerMode == EQPlayerMode::Replay && QPlayerCaptureMode != EQPlayerCaptureMode::Full) { + throw yexception() << "Simultaneous usage of run and replay options requires replay data to contain full capture"; + } + if (!GatewaysConfig) { GatewaysConfig = ParseProtoFromResource("gateways.conf"); } @@ -781,6 +802,8 @@ int TFacadeRunner::DoRun(TProgramFactory& factory) { program->SetEnableLineage(); } + program->SetOperationId(RunOptions_.OperationId); + bool fail = false; if (RunOptions_.ProgramType != EProgramType::SExpr) { RunOptions_.PrintInfo("Parse SQL..."); diff --git a/yql/essentials/tools/yql_facade_run/yql_facade_run.h b/yql/essentials/tools/yql_facade_run/yql_facade_run.h index b0a08d370aa2..c27b59346071 100644 --- a/yql/essentials/tools/yql_facade_run/yql_facade_run.h +++ b/yql/essentials/tools/yql_facade_run/yql_facade_run.h @@ -81,6 +81,7 @@ class TFacadeRunOptions { TString Token; ui64 MemLimit = 0; EQPlayerMode QPlayerMode = EQPlayerMode::None; + EQPlayerCaptureMode QPlayerCaptureMode = EQPlayerCaptureMode::None; TString OperationId; TQContext QPlayerContext; diff --git a/yt/yql/providers/yt/common/yql_configuration.h b/yt/yql/providers/yt/common/yql_configuration.h index 2885e09e9659..1fc633097f34 100644 --- a/yt/yql/providers/yt/common/yql_configuration.h +++ b/yt/yql/providers/yt/common/yql_configuration.h @@ -147,4 +147,8 @@ constexpr bool DEFAULT_EARLY_PARTITION_PRUNING = false; constexpr bool DEFAULT_VALIDATE_CLUSTERS = false; +constexpr ui64 DEFAULT_QUERY_DUMP_TABLE_SIZE_LIMIT = 100_GB; +constexpr ui64 DEFAULT_QUERY_DUMP_TABLE_COUNT_PER_CLUSTER_LIMIT = 5; +constexpr ui64 DEFAULT_QUERY_DUMP_FILE_COUNT_PER_OPERATION_LIMIT = 5; + } // NYql diff --git a/yt/yql/providers/yt/common/yql_yt_settings.cpp b/yt/yql/providers/yt/common/yql_yt_settings.cpp index 876ecd10ee71..f65249dfbd06 100644 --- a/yt/yql/providers/yt/common/yql_yt_settings.cpp +++ b/yt/yql/providers/yt/common/yql_yt_settings.cpp @@ -55,7 +55,8 @@ void MediaValidator(const NYT::TNode& value) { } } -TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) +TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx, const TQContext& qContext) + : NCommon::TSettingDispatcher(qContext) { const auto codecValidator = [] (const TString&, TString str) { if (!ValidateCompressionCodecValue(str)) { @@ -73,11 +74,12 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) for (auto& x: Tokens) { x.second = value; } - }); - REGISTER_SETTING(*this, ExternalTx); - REGISTER_SETTING(*this, TmpFolder); - REGISTER_SETTING(*this, TablesTmpFolder); - REGISTER_SETTING(*this, TempTablesTtl); + }) + .IgnoreInFullReplay(); + REGISTER_SETTING(*this, ExternalTx).IgnoreInFullReplay(); + REGISTER_SETTING(*this, TmpFolder).IgnoreInFullReplay(); + REGISTER_SETTING(*this, TablesTmpFolder).IgnoreInFullReplay(); + REGISTER_SETTING(*this, TempTablesTtl).IgnoreInFullReplay(); REGISTER_SETTING(*this, KeepTempTables) .ValueSetter([this](const TString& cluster, bool value) { Y_UNUSED(cluster); @@ -111,7 +113,9 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) REGISTER_SETTING(*this, InferSchemaTableCountThreshold); - REGISTER_SETTING(*this, QueryCacheMode).Parser([](const TString& v) { return FromString(v); }); + REGISTER_SETTING(*this, QueryCacheMode) + .Parser([](const TString& v) { return FromString(v); }) + .IgnoreInFullReplay(); REGISTER_SETTING(*this, QueryCacheIgnoreTableRevision); REGISTER_SETTING(*this, QueryCacheSalt); REGISTER_SETTING(*this, QueryCacheTtl); @@ -136,7 +140,7 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) REGISTER_SETTING(*this, MinLocalityInputDataWeight); REGISTER_SETTING(*this, MaxJobCount).Lower(1); REGISTER_SETTING(*this, UserSlots).Lower(1); - REGISTER_SETTING(*this, Pool).NonEmpty(); + REGISTER_SETTING(*this, Pool).NonEmpty().IgnoreInFullReplay(); REGISTER_SETTING(*this, DefaultOperationWeight).Lower(0.0); REGISTER_SETTING(*this, DefaultMapSelectivityFactor).Lower(0.0); REGISTER_SETTING(*this, NightlyCompress); @@ -146,7 +150,7 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) REGISTER_SETTING(*this, PublishedErasureCodec).Parser([](const TString& v) { return FromString(v); }); REGISTER_SETTING(*this, TemporaryErasureCodec).Parser([](const TString& v) { return FromString(v); }); REGISTER_SETTING(*this, ClientMapTimeout).Deprecated(); - REGISTER_SETTING(*this, CoreDumpPath).NonEmpty(); + REGISTER_SETTING(*this, CoreDumpPath).NonEmpty().IgnoreInFullReplay(); REGISTER_SETTING(*this, UseTmpfs); REGISTER_SETTING(*this, SuspendIfAccountLimitExceeded); REGISTER_SETTING(*this, ExtraTmpfsSize); @@ -171,7 +175,7 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) REGISTER_SETTING(*this, UseNativeDescSort); REGISTER_SETTING(*this, UseIntermediateSchema).Deprecated(); REGISTER_SETTING(*this, UseIntermediateStreams); - REGISTER_SETTING(*this, StaticPool); + REGISTER_SETTING(*this, StaticPool).IgnoreInFullReplay(); REGISTER_SETTING(*this, UseFlow) .ValueSetter([this](const TString&, bool value) { UseFlow = value; @@ -213,22 +217,23 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) } else { Owners[cluster].insert(owners.begin(), owners.end()); } - }); - REGISTER_SETTING(*this, OperationReaders).NonEmpty(); - REGISTER_SETTING(*this, SchedulingTag); - REGISTER_SETTING(*this, SchedulingTagFilter); - REGISTER_SETTING(*this, PoolTrees) + }) + .IgnoreInFullReplay(); + REGISTER_SETTING(*this, OperationReaders).NonEmpty().IgnoreInFullReplay(); + REGISTER_SETTING(*this, SchedulingTag).IgnoreInFullReplay(); + REGISTER_SETTING(*this, SchedulingTagFilter).IgnoreInFullReplay(); + REGISTER_SETTING(*this, PoolTrees).IgnoreInFullReplay() .NonEmpty() .ValueSetter([this] (const TString& cluster, TSet trees) { HybridDqExecution = false; PoolTrees[cluster] = trees; }); - REGISTER_SETTING(*this, TentativePoolTrees).NonEmpty(); + REGISTER_SETTING(*this, TentativePoolTrees).NonEmpty().IgnoreInFullReplay(); REGISTER_SETTING(*this, TentativeTreeEligibilitySampleJobCount); REGISTER_SETTING(*this, TentativeTreeEligibilityMaxJobDurationRatio); REGISTER_SETTING(*this, TentativeTreeEligibilityMinJobDuration); REGISTER_SETTING(*this, UseDefaultTentativePoolTrees); - REGISTER_SETTING(*this, IntermediateAccount).NonEmpty(); + REGISTER_SETTING(*this, IntermediateAccount).NonEmpty().IgnoreInFullReplay(); REGISTER_SETTING(*this, IntermediateReplicationFactor).Lower(1).Upper(10); REGISTER_SETTING(*this, PublishedReplicationFactor).Lower(1).Upper(10); REGISTER_SETTING(*this, TemporaryReplicationFactor).Lower(1).Upper(10); @@ -403,7 +408,8 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) .ValueSetter([this](const TString& cluster, const NYT::TNode& spec) { OperationSpec[cluster] = spec; HybridDqExecution = false; - }); + }) + .IgnoreInFullReplay(); REGISTER_SETTING(*this, FmrOperationSpec) .Parser([](const TString& v) { return NYT::NodeFromYsonString(v, ::NYson::EYsonType::Node); }) .Validator([] (const TString&, const NYT::TNode& value) { @@ -437,9 +443,9 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) REGISTER_SETTING(*this, LLVMPerNodeMemSize); REGISTER_SETTING(*this, LLVMNodeCountLimit); REGISTER_SETTING(*this, SamplingIoBlockSize); - REGISTER_SETTING(*this, BinaryTmpFolder); + REGISTER_SETTING(*this, BinaryTmpFolder).IgnoreInFullReplay(); REGISTER_SETTING(*this, _BinaryCacheFolder); - REGISTER_SETTING(*this, BinaryExpirationInterval); + REGISTER_SETTING(*this, BinaryExpirationInterval).IgnoreInFullReplay(); REGISTER_SETTING(*this, FolderInlineDataLimit); REGISTER_SETTING(*this, FolderInlineItemsLimit); REGISTER_SETTING(*this, TableContentMinAvgChunkSize); @@ -496,9 +502,9 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) REGISTER_SETTING(*this, KeyFilterForStartsWith); REGISTER_SETTING(*this, MaxKeyRangeCount).Upper(10000); REGISTER_SETTING(*this, MaxChunksForDqRead).Lower(1); - REGISTER_SETTING(*this, NetworkProject); - REGISTER_SETTING(*this, StaticNetworkProject); - REGISTER_SETTING(*this, FileCacheTtl); + REGISTER_SETTING(*this, NetworkProject).IgnoreInFullReplay(); + REGISTER_SETTING(*this, StaticNetworkProject).IgnoreInFullReplay(); + REGISTER_SETTING(*this, FileCacheTtl).IgnoreInFullReplay(); REGISTER_SETTING(*this, _ImpersonationUser); REGISTER_SETTING(*this, InferSchemaMode).Parser([](const TString& v) { return FromString(v); }); REGISTER_SETTING(*this, BatchListFolderConcurrency).Lower(1); // Upper bound on concurrent batch folder list requests https://yt.yandex-team.ru/docs/api/commands#execute_batch @@ -605,6 +611,9 @@ TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx) REGISTER_SETTING(*this, _LocalTableContentLimit); REGISTER_SETTING(*this, ValidatePool); REGISTER_SETTING(*this, ValidateClusters); + REGISTER_SETTING(*this, _QueryDumpFolder); + REGISTER_SETTING(*this, _QueryDumpTableSizeLimit); + REGISTER_SETTING(*this, _QueryDumpTableCountPerClusterLimit); } EReleaseTempDataMode GetReleaseTempDataMode(const TYtSettings& settings) { diff --git a/yt/yql/providers/yt/common/yql_yt_settings.h b/yt/yql/providers/yt/common/yql_yt_settings.h index 2556b489f9f8..966eb891dc7b 100644 --- a/yt/yql/providers/yt/common/yql_yt_settings.h +++ b/yt/yql/providers/yt/common/yql_yt_settings.h @@ -115,6 +115,7 @@ struct TYtSettings { NCommon::TConfSetting, StaticPerCluster> JobBlockOutputSupportedTypes; NCommon::TConfSetting, StaticPerCluster> JobBlockOutputSupportedDataTypes; NCommon::TConfSetting ValidatePool; + NCommon::TConfSetting _QueryDumpFolder; // static global NCommon::TConfSetting Auth; @@ -155,6 +156,8 @@ struct TYtSettings { NCommon::TConfSetting UseNativeYtDefaultColumnOrder; NCommon::TConfSetting EarlyPartitionPruning; NCommon::TConfSetting ValidateClusters; + NCommon::TConfSetting _QueryDumpTableSizeLimit; + NCommon::TConfSetting _QueryDumpTableCountPerClusterLimit; // Job runtime NCommon::TConfSetting Pool; @@ -358,7 +361,7 @@ inline TString GetTablesTmpFolder(const TYtSettings& settings, const TString& cl struct TYtConfiguration : public TYtSettings, public NCommon::TSettingDispatcher { using TPtr = TIntrusivePtr; - TYtConfiguration(TTypeAnnotationContext& typeCtx); + TYtConfiguration(TTypeAnnotationContext& typeCtx, const TQContext& qContext = {}); TYtConfiguration(const TYtConfiguration&) = delete; template @@ -399,8 +402,8 @@ class TYtVersionedConfiguration: public TYtConfiguration { TYtSettings::TConstPtr Snapshot; }; - TYtVersionedConfiguration(TTypeAnnotationContext& types) - : TYtConfiguration(types) + TYtVersionedConfiguration(TTypeAnnotationContext& types, const TQContext& qContext = {}) + : TYtConfiguration(types, qContext) { } diff --git a/yt/yql/providers/yt/gateway/file/yql_yt_file.cpp b/yt/yql/providers/yt/gateway/file/yql_yt_file.cpp index 352ccaa3a9b3..d4e91ec2a8d1 100644 --- a/yt/yql/providers/yt/gateway/file/yql_yt_file.cpp +++ b/yt/yql/providers/yt/gateway/file/yql_yt_file.cpp @@ -681,7 +681,7 @@ class TYtFileGateway : public IYtGateway { } - TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) const final { + TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) final { TRunResult res; auto nodePos = ctx.GetPosition(node->Pos()); @@ -1147,6 +1147,12 @@ class TYtFileGateway : public IYtGateway { void AddCluster(const TYtClusterConfig&) override { } + TFuture Dump(TDumpOptions&& /*options*/) override { + TDumpResult res; + res.SetSuccess(); + return MakeFuture(res); + } + private: static NYT::TNode LoadTableAttrs(const TString& path) { NYT::TNode attrs = NYT::TNode::CreateMap(); diff --git a/yt/yql/providers/yt/gateway/lib/transaction_cache.cpp b/yt/yql/providers/yt/gateway/lib/transaction_cache.cpp index 002dc7188d5b..0609861d4bfb 100644 --- a/yt/yql/providers/yt/gateway/lib/transaction_cache.cpp +++ b/yt/yql/providers/yt/gateway/lib/transaction_cache.cpp @@ -68,13 +68,14 @@ void TTransactionCache::TEntry::DoRemove(const TString& table) { } } -void TTransactionCache::TEntry::Finalize(const TString& clusterName) { +void TTransactionCache::TEntry::Finalize(const TString& clusterName, bool commitDumpTx) { NYT::ITransactionPtr binarySnapshotTx; decltype(SnapshotTxs) snapshotTxs; THashMap toDelete; decltype(CheckpointTxs) checkpointTxs; decltype(WriteTxs) writeTxs; NYT::ITransactionPtr layersTx; + NYT::ITransactionPtr dumpTx; with_lock(Lock_) { binarySnapshotTx.Swap(BinarySnapshotTx); snapshotTxs.swap(SnapshotTxs); @@ -84,6 +85,7 @@ void TTransactionCache::TEntry::Finalize(const TString& clusterName) { checkpointTxs.swap(CheckpointTxs); writeTxs.swap(WriteTxs); layersTx.Swap(LayersSnapshotTx); + dumpTx.Swap(DumpTx); } if (layersTx) { @@ -112,6 +114,15 @@ void TTransactionCache::TEntry::Finalize(const TString& clusterName) { YQL_CLOG(INFO, ProviderYt) << "Committing tx " << GetGuidAsString(Tx->GetId()) << " on " << clusterName; Tx->Commit(); + + if (dumpTx) { + YQL_CLOG(INFO, ProviderYt) << (commitDumpTx ? "Commiting" : "Aborting") << " dump tx " << GetGuidAsString(dumpTx->GetId()) << " on " << clusterName; + if (commitDumpTx) { + dumpTx->Commit(); + } else { + dumpTx->Abort(); + } + } } TMaybe TTransactionCache::TEntry::GetColumnarStat(NYT::TRichYPath ytPath) const { @@ -479,7 +490,8 @@ TTransactionCache::TEntry::TPtr TTransactionCache::TryGetEntry(const TString& se } TTransactionCache::TEntry::TPtr TTransactionCache::GetOrCreateEntry(const TString& cluster, const TString& server, const TString& token, - const TMaybe& impersonationUser, const TSpecProvider& specProvider, const TYtSettings::TConstPtr& config, IMetricsRegistryPtr metrics) + const TMaybe& impersonationUser, const TSpecProvider& specProvider, const TYtSettings::TConstPtr& config, IMetricsRegistryPtr metrics, + bool createDumpTx) { TEntry::TPtr createdEntry = nullptr; NYT::TTransactionId externalTx = config->ExternalTx.Get(cluster).GetOrElse(TGUID()); @@ -511,6 +523,9 @@ TTransactionCache::TEntry::TPtr TTransactionCache::GetOrCreateEntry(const TStrin } createdEntry->CacheTx = createdEntry->Client; createdEntry->CacheTtl = config->QueryCacheTtl.Get().GetOrElse(TDuration::Days(7)); + if (createDumpTx) { + createdEntry->DumpTx = createdEntry->Client->StartTransaction(TStartTransactionOptions().Attributes(createdEntry->TransactionSpec)); + } const TString tmpFolder = GetTablesTmpFolder(*config, cluster); if (!tmpFolder.empty()) { auto fullTmpFolder = AddPathPrefix(tmpFolder, NYT::TConfig::Get()->Prefix); @@ -533,6 +548,9 @@ TTransactionCache::TEntry::TPtr TTransactionCache::GetOrCreateEntry(const TStrin YQL_CLOG(INFO, ProviderYt) << "Attached to external tx " << GetGuidAsString(externalTx) << " on cluster " << cluster; } YQL_CLOG(INFO, ProviderYt) << "Created tx " << GetGuidAsString(createdEntry->Tx->GetId()) << " on " << server << " cluster " << cluster; + if (createdEntry->DumpTx) { + YQL_CLOG(INFO, ProviderYt) << "Created dump tx " << GetGuidAsString(createdEntry->DumpTx->GetId()) << " on " << server << " cluster " << cluster; + } return createdEntry; } @@ -557,13 +575,13 @@ void TTransactionCache::Commit(const TString& server) { } } -void TTransactionCache::Finalize() { +void TTransactionCache::Finalize(bool commitDumpTxs) { THashMap txMap; with_lock(Lock_) { txMap.swap(TxMap_); } for (auto& item: txMap) { - item.second->Finalize(item.first); + item.second->Finalize(item.first, commitDumpTxs); } } @@ -606,6 +624,10 @@ void TTransactionCache::AbortAll() { YQL_CLOG(INFO, ProviderYt) << "AbortAll(): Aborting BinarySnapshot tx " << GetGuidAsString(entry->BinarySnapshotTx->GetId()); abortTx(entry->BinarySnapshotTx); } + if (entry->DumpTx) { + YQL_CLOG(INFO, ProviderYt) << "AbortAll(): Aborting dump tx " << GetGuidAsString(entry->DumpTx->GetId()) << " on " << item.first; + abortTx(entry->DumpTx); + } if (entry->Tx) { YQL_CLOG(INFO, ProviderYt) << "Aborting tx " << GetGuidAsString(entry->Tx->GetId()) << " on " << item.first; abortTx(entry->Tx); diff --git a/yt/yql/providers/yt/gateway/lib/transaction_cache.h b/yt/yql/providers/yt/gateway/lib/transaction_cache.h index 0d20257f12a5..2dda42af8984 100644 --- a/yt/yql/providers/yt/gateway/lib/transaction_cache.h +++ b/yt/yql/providers/yt/gateway/lib/transaction_cache.h @@ -39,6 +39,7 @@ class TTransactionCache { NYT::ITransactionPtr ExternalTx; NYT::IClientBasePtr CacheTx; NYT::TTransactionId CacheTxId; + NYT::ITransactionPtr DumpTx; TDuration CacheTtl; THashMap SnapshotTxs; THashMap WriteTxs; @@ -84,7 +85,7 @@ class TTransactionCache { } void RemoveInternal(const TString& table); - void Finalize(const TString& clusterName); + void Finalize(const TString& clusterName, bool commitDumpTx = false); template T AssumeAsDeletedAtFinalize(const T& range) { @@ -170,11 +171,11 @@ class TTransactionCache { TTransactionCache(const TString& userName); TEntry::TPtr GetEntry(const TString& server); - TEntry::TPtr GetOrCreateEntry(const TString& cluster, const TString& server, const TString& token, const TMaybe& impersonationUser, const TSpecProvider& specProvider, const TYtSettings::TConstPtr& config, IMetricsRegistryPtr metrics); + TEntry::TPtr GetOrCreateEntry(const TString& cluster, const TString& server, const TString& token, const TMaybe& impersonationUser, const TSpecProvider& specProvider, const TYtSettings::TConstPtr& config, IMetricsRegistryPtr metrics, bool createDumpTx = false); TEntry::TPtr TryGetEntry(const TString& server); void Commit(const TString& server); - void Finalize(); + void Finalize(bool commitDumpTxs = false); void AbortAll(); void DetachSnapshotTxs(); diff --git a/yt/yql/providers/yt/gateway/native/ut/yql_yt_native_folders_ut.cpp b/yt/yql/providers/yt/gateway/native/ut/yql_yt_native_folders_ut.cpp index 574422d70338..2e68ae0be8a1 100644 --- a/yt/yql/providers/yt/gateway/native/ut/yql_yt_native_folders_ut.cpp +++ b/yt/yql/providers/yt/gateway/native/ut/yql_yt_native_folders_ut.cpp @@ -13,7 +13,11 @@ namespace NYql { namespace { -constexpr auto CYPRES_TX_ID = "\"9518f6d4-f0480586-41103e8-ca595920\""; +const std::vector CYPRESS_TX_IDS = { + "\"9518f6d4-f0480586-41103e8-ca595920\"", + "\"9b86fed7-4be58942-3f403e8-834d2964\"", +}; + constexpr auto CYPRES_NODE_A_CONTENT = R"( [ { @@ -126,8 +130,12 @@ class TYtReplier : public TRequestReplier { HttpCodes code = HTTP_NOT_FOUND; TString content; if (parsed.Path == "/api/v3/start_tx") { - content = CYPRES_TX_ID; - code = HTTP_OK; + if (CurrTx_ < CYPRESS_TX_IDS.size()) { + content = CYPRESS_TX_IDS[CurrTx_++]; + code = HTTP_OK; + } else { + code = HTTP_INTERNAL_SERVER_ERROR; + } } else if (parsed.Path == "/api/v3/ping_tx") { code = HTTP_OK; @@ -143,8 +151,8 @@ class TYtReplier : public TRequestReplier { return true; } - explicit TYtReplier(THandler handleListCommand, THandler handleGetCommand, TMaybe> assertion): - HandleListCommand_(handleListCommand), HandleGetCommand_(handleGetCommand) { + explicit TYtReplier(size_t& currTx, THandler handleListCommand, THandler handleGetCommand, TMaybe> assertion): + CurrTx_(currTx), HandleListCommand_(handleListCommand), HandleGetCommand_(handleGetCommand) { if (assertion) { Assertion_ = assertion.GetRef(); } @@ -178,10 +186,11 @@ class TYtReplier : public TRequestReplier { return THttpResponse{HTTP_NOT_FOUND}; } + size_t& CurrTx_; + std::function Assertion_ = [] ([[maybe_unused]] auto _) {}; THandler HandleListCommand_; THandler HandleGetCommand_; - }; Y_UNIT_TEST_SUITE(YtNativeGateway) { @@ -204,8 +213,9 @@ std::pair, IYtGateway::TPtr> InitTest(const NTesting:: IYtGateway::TFolderResult GetFolderResult(TYtReplier::THandler handleList, TYtReplier::THandler handleGet, TMaybe> gatewayRequestAssertion, std::function makeFolderOptions) { const auto port = NTesting::GetFreePort(); + size_t currTx = 0; NMock::TMockServer mockServer{port, - [gatewayRequestAssertion, handleList, handleGet] () {return new TYtReplier(handleList, handleGet, gatewayRequestAssertion);} + [&currTx, gatewayRequestAssertion, handleList, handleGet] () {return new TYtReplier(currTx, handleList, handleGet, gatewayRequestAssertion);} }; TTypeAnnotationContext types; diff --git a/yt/yql/providers/yt/gateway/native/ya.make b/yt/yql/providers/yt/gateway/native/ya.make index 07bfd575cbd3..048cc1d519e6 100644 --- a/yt/yql/providers/yt/gateway/native/ya.make +++ b/yt/yql/providers/yt/gateway/native/ya.make @@ -44,6 +44,7 @@ PEERDIR( yt/yql/providers/yt/expr_nodes yt/yql/providers/yt/gateway/lib yt/yql/providers/yt/job + yt/yql/providers/yt/lib/dump_helpers yt/yql/providers/yt/lib/expr_traits yt/yql/providers/yt/lib/infer_schema yt/yql/providers/yt/lib/lambda_builder diff --git a/yt/yql/providers/yt/gateway/native/yql_yt_exec_ctx.cpp b/yt/yql/providers/yt/gateway/native/yql_yt_exec_ctx.cpp index f00ec623d0af..0c5b979a8daa 100644 --- a/yt/yql/providers/yt/gateway/native/yql_yt_exec_ctx.cpp +++ b/yt/yql/providers/yt/gateway/native/yql_yt_exec_ctx.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ namespace NNative { using namespace NNodes; TExecContextBase::TExecContextBase( + const IYtGateway::TPtr& gateway, const TYtNativeServices::TPtr& services, const TConfigClusters::TPtr& clusters, const TIntrusivePtr& mkqlCompiler, @@ -44,6 +46,7 @@ TExecContextBase::TExecContextBase( const TYtUrlMapper& urlMapper, IMetricsRegistryPtr metrics) : TExecContextBaseSimple(services, clusters, mkqlCompiler, cluster, session) + , Gateway(gateway) , FileStorage_(services->FileStorage) , SecretMasker(services->SecretMasker) , Session_(session) @@ -140,7 +143,7 @@ TTransactionCache::TEntry::TPtr TExecContextBase::GetOrCreateEntry(const TYtSett "Accessing YT cluster " << Cluster_.Quote() << " without OAuth token is not allowed"; } - return Session_->TxCache_.GetOrCreateEntry(Cluster_, YtServer_, token, impersonationUser, [s = Session_]() { return s->CreateSpecWithDesc(); }, settings, Metrics); + return Session_->TxCache_.GetOrCreateEntry(Cluster_, YtServer_, token, impersonationUser, [s = Session_]() { return s->CreateSpecWithDesc(); }, settings, Metrics, bool(Session_->FullCapture_)); } TExpressionResorceUsage TExecContextBase::ScanExtraResourceUsageImpl(const TExprNode& node, const TYtSettings::TConstPtr& config, bool withInput) { @@ -154,6 +157,39 @@ TExpressionResorceUsage TExecContextBase::ScanExtraResourceUsageImpl(const TExpr return extraUsage; } +void TExecContextBase::DumpFilesFromJob(const NYT::TNode& opSpec) const { + YQL_ENSURE(Session_->FullCapture_); + + THashMap snapshots; // yt job basename -> snapshot node id + auto handlePaths = [&](const NYT::TNode& filePaths) { + for (auto& path : filePaths.AsList()) { + auto& attrs = path.GetAttributes().AsMap(); + snapshots.emplace(attrs.at("file_name").AsString(), path.AsString()); + } + }; + if (opSpec.HasKey("mapper")) { + handlePaths(opSpec.At("mapper").At("file_paths")); + } + if (opSpec.HasKey("reducer")) { + handlePaths(opSpec.At("reducer").At("file_paths")); + } + + IYtGateway::TDumpOptions dumpOptions(Session_->SessionId_); + for (auto& [basename, dumpPath] : JobFilesDumpPaths) { + YQL_ENSURE(snapshots.contains(basename), "file is not present in operation spec"); + auto& snapshotNodeId = snapshots.at(basename); + dumpOptions.Entries()[Cluster_].push_back(IYtGateway::TDumpOptions::TEntry { + .SrcPath = snapshotNodeId, + .DstPath = dumpPath + }); + YQL_CLOG(INFO, ProviderYt) << "Dump job file " << basename << " (snapshot " << snapshotNodeId << ") to " << dumpPath << " on cluster " << Cluster_; + } + + Session_->FullCapture_->AddOperationFuture(Gateway->Dump(std::move(dumpOptions)).Apply([] (const NThreading::TFuture& f) { + return NCommon::TOperationResult(f.GetValue()); + })); +} + TString TExecContextBase::GetAuth(const TYtSettings::TConstPtr& config) const { auto auth = config->Auth.Get(); if (!auth || auth->empty()) { diff --git a/yt/yql/providers/yt/gateway/native/yql_yt_exec_ctx.h b/yt/yql/providers/yt/gateway/native/yql_yt_exec_ctx.h index 7590b87de1ff..88481ad46e81 100644 --- a/yt/yql/providers/yt/gateway/native/yql_yt_exec_ctx.h +++ b/yt/yql/providers/yt/gateway/native/yql_yt_exec_ctx.h @@ -36,6 +36,7 @@ namespace NNative { class TExecContextBase: public TExecContextBaseSimple { protected: TExecContextBase( + const IYtGateway::TPtr& gateway, const TYtNativeServices::TPtr& services, const TConfigClusters::TPtr& clusters, const TIntrusivePtr& mkqlCompiler, @@ -84,11 +85,14 @@ class TExecContextBase: public TExecContextBaseSimple { TExpressionResorceUsage ScanExtraResourceUsageImpl(const TExprNode& node, const TYtSettings::TConstPtr& config, bool withInput); + void DumpFilesFromJob(const NYT::TNode& opSpec) const; + NThreading::TFuture AcquireOperationLock() { return Session_->OperationSemaphore->AcquireAsync(); } public: + IYtGateway::TPtr Gateway; TFileStoragePtr FileStorage_; ISecretMasker::TPtr SecretMasker; TSession::TPtr Session_; @@ -102,6 +106,7 @@ class TExecContextBase: public TExecContextBaseSimple { bool Hidden = false; IMetricsRegistryPtr Metrics; TOperationProgress::EOpBlockStatus BlockStatus = TOperationProgress::EOpBlockStatus::None; + THashMap JobFilesDumpPaths; // yt job basename -> dump path }; @@ -112,6 +117,7 @@ class TExecContext: public TExecContextBase { using TOptions = T; TExecContext( + const IYtGateway::TPtr& gateway, const TYtNativeServices::TPtr services, const TConfigClusters::TPtr& clusters, const TIntrusivePtr& mkqlCompiler, @@ -120,7 +126,7 @@ class TExecContext: public TExecContextBase { const TString& cluster, const TYtUrlMapper& urlMapper, IMetricsRegistryPtr metrics) - : TExecContextBase(services, clusters, mkqlCompiler, session, cluster, urlMapper, std::move(metrics)) + : TExecContextBase(gateway, services, clusters, mkqlCompiler, session, cluster, urlMapper, std::move(metrics)) , Options_(std::move(options)) { } @@ -222,6 +228,17 @@ class TExecContext: public TExecContextBase { } catch (...) { // Promise will be initialized with exception inside of TOperation::Start() } + if (self->Session_->FullCapture_) { + try { + auto attrs = op->GetAttributes(NYT::TGetOperationOptions().AttributeFilter( + NYT::TOperationAttributeFilter().Add(NYT::EOperationAttribute::Spec) + )); + YQL_ENSURE(attrs.Spec.Defined()); + self->DumpFilesFromJob(*attrs.Spec); + } catch (const std::exception& e) { + self->Session_->FullCapture_->ReportError(e); + } + } } }); // opFactory factory may contain locked resources. Explicitly wait preparation before destroying it diff --git a/yt/yql/providers/yt/gateway/native/yql_yt_native.cpp b/yt/yql/providers/yt/gateway/native/yql_yt_native.cpp index 78c320623496..faa8e89fa20f 100644 --- a/yt/yql/providers/yt/gateway/native/yql_yt_native.cpp +++ b/yt/yql/providers/yt/gateway/native/yql_yt_native.cpp @@ -623,9 +623,14 @@ class TYtNativeGateway : public IYtGateway { try { TSession::TPtr session = GetSession(options.SessionId()); auto logCtx = NYql::NLog::CurrentLogContextPath(); - return session->Queue_->Async([session, logCtx, abort=options.Abort(), detachSnapshotTxs=options.DetachSnapshotTxs()] () { + return session->Queue_->Async([ + session, logCtx, + abort=options.Abort(), + detachSnapshotTxs=options.DetachSnapshotTxs(), + commitDumpTxs=options.CommitDumpTxs() + ] () { YQL_LOG_CTX_ROOT_SESSION_SCOPE(logCtx); - return ExecFinalize(session, abort, detachSnapshotTxs); + return ExecFinalize(session, abort, detachSnapshotTxs, commitDumpTxs); }); } catch (...) { return MakeFuture(ResultFromCurrentException()); @@ -1568,7 +1573,7 @@ class TYtNativeGateway : public IYtGateway { } } - TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) const final { + TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) final { YQL_LOG_CTX_SCOPE(TStringBuf("Gateway"), __FUNCTION__); auto nodePos = ctx.GetPosition(node->Pos()); try { @@ -1751,6 +1756,36 @@ class TYtNativeGateway : public IYtGateway { Clusters_->AddCluster(cluster, false); } + TFuture Dump(TDumpOptions&& options) override { + YQL_LOG_CTX_SCOPE(TStringBuf("Gateway"), __FUNCTION__); + try { + TSession::TPtr session = GetSession(options.SessionId()); + + TVector> futures; + for (auto& [cluster, entries] : options.Entries()) { + auto execCtx = MakeExecCtx(std::move(entries), session, cluster, nullptr, nullptr); + futures.push_back(execCtx->Session_->Queue_->Async([execCtx]() { + YQL_LOG_CTX_ROOT_SESSION_SCOPE(execCtx->LogCtx_); + return ExecDump(execCtx); + })); + } + + return WaitExceptionOrAll(futures).Apply([futures](const TFuture& f) { + try { + f.GetValue(); + + TDumpResult res; + res.SetSuccess(); + return res; + } catch (...) { + return ResultFromCurrentException(); + } + }); + } catch (...) { + return MakeFuture(ResultFromCurrentException()); + } + } + private: class TNodeResultBuilder { public: @@ -1886,7 +1921,7 @@ class TYtNativeGateway : public IYtGateway { const TVector Columns_; }; - static TFinalizeResult ExecFinalize(const TSession::TPtr& session, bool abort, bool detachSnapshotTxs) { + static TFinalizeResult ExecFinalize(const TSession::TPtr& session, bool abort, bool detachSnapshotTxs, bool commitDumpTxs) { try { TFinalizeResult res; if (detachSnapshotTxs) { @@ -1897,7 +1932,7 @@ class TYtNativeGateway : public IYtGateway { YQL_CLOG(INFO, ProviderYt) << "Aborting all transactions for hidden query"; session->TxCache_.AbortAll(); } else { - session->TxCache_.Finalize(); + session->TxCache_.Finalize(commitDumpTxs); } res.SetSuccess(); return res; @@ -4956,6 +4991,14 @@ class TYtNativeGateway : public IYtGateway { execCtx->Session_->InitLocalCalcSemaphore(execCtx->Options_.Config()); TGuard guard(*execCtx->Session_->LocalCalcSemaphore_); execCtx->SetNodeExecProgress("Local run"); + + if (transform.HasFilesToDump()) { + YQL_ENSURE(execCtx->Session_->FullCapture_); + execCtx->Session_->FullCapture_->ReportError( + yexception() << "user files in local run" + ); + } + ExecSafeFill(outYPaths, root, execCtx->GetOutSpec(!useSkiff, nativeTypeCompat), execCtx, entry, builder, alloc, tmpFiles->TmpDir.GetPath() + '/'); return MakeFuture(); } @@ -5567,6 +5610,14 @@ class TYtNativeGateway : public IYtGateway { execCtx->Session_->InitLocalCalcSemaphore(execCtx->Options_.Config()); TGuard guard(*execCtx->Session_->LocalCalcSemaphore_); execCtx->SetNodeExecProgress("Local run"); + + if (transform.HasFilesToDump()) { + YQL_ENSURE(execCtx->Session_->FullCapture_); + execCtx->Session_->FullCapture_->ReportError( + yexception() << "user files in local run" + ); + } + TExploringNodeVisitor explorer; auto localGraph = builder.BuildLocalGraph(GetGatewayNodeFactory(codecCtx.Get(), nullptr, execCtx->UserFiles_, pathPrefix), execCtx->Options_.UdfValidateMode(), NUdf::EValidatePolicy::Exception, @@ -5713,6 +5764,45 @@ class TYtNativeGateway : public IYtGateway { }); } + static void ExecDump(const TExecContext::TPtr& execCtx) { + auto entry = execCtx->GetEntry(); + YQL_ENSURE(entry->DumpTx); + for (auto& [srcPath, dstPath] : execCtx->Options_) { + NYT::TRichYPath srcRichYPath; + NYT::IClientBasePtr srcTx; + auto snapshot = entry->Snapshots.FindPtr(std::make_pair(srcPath, 0)); + if (snapshot) { + // use table snapshot if present + auto& [tableId, txId, _] = *snapshot; + srcRichYPath.Path(tableId).TransactionId(txId); + srcTx = entry->GetSnapshotTx(txId); + } else { + srcRichYPath.Path(srcPath); + srcTx = entry->Tx; + } + + NYT::TNode attrs = srcTx->Get(srcRichYPath.Path_ + "&/@", NYT::TGetOptions().AttributeFilter( + NYT::TAttributeFilter() + .AddAttribute("type") + .AddAttribute("compression_codec") + .AddAttribute("erasure_codec") + .AddAttribute("optimize_for") + .AddAttribute("schema") + .AddAttribute("media") + .AddAttribute("primary_medium") + )); + auto srcType = FromString(attrs.At("type").AsString()); + attrs.AsMap().erase("type"); + + entry->DumpTx->Create(dstPath, srcType, TCreateOptions().Recursive(true).Attributes(attrs)); + entry->DumpTx->Concatenate( + { srcRichYPath }, + NYT::TRichYPath(dstPath), + TConcatenateOptions() + ); + } + } + template static TVector PrepareDestinations( const TVector& outTables, @@ -5821,9 +5911,9 @@ class TYtNativeGateway : public IYtGateway { const TSession::TPtr& session, const TString& cluster, const TExprNode* root, - TExprContext* exprCtx) const + TExprContext* exprCtx) { - auto ctx = MakeIntrusive>(MakeIntrusive(Services_), Clusters_, MkqlCompiler_, std::move(options), session, cluster, UrlMapper_, Services_.Metrics); + auto ctx = MakeIntrusive>(TIntrusivePtr(this), MakeIntrusive(Services_), Clusters_, MkqlCompiler_, std::move(options), session, cluster, UrlMapper_, Services_.Metrics); if (root) { YQL_ENSURE(exprCtx); if (TYtTransientOpBase::Match(root)) { diff --git a/yt/yql/providers/yt/gateway/native/yql_yt_session.cpp b/yt/yql/providers/yt/gateway/native/yql_yt_session.cpp index 131af1b663c9..6ae8007cba54 100644 --- a/yt/yql/providers/yt/gateway/native/yql_yt_session.cpp +++ b/yt/yql/providers/yt/gateway/native/yql_yt_session.cpp @@ -21,6 +21,8 @@ TSession::TSession(IYtGateway::TOpenSessionOptions&& options, size_t numThreads) , OperationSemaphore(nullptr) , LocalCalcSemaphore_(nullptr) , TxCache_(UserName_) + , QContext_(options.QContext()) + , FullCapture_(options.FullCapture()) { InitYtApiOnce(OperationOptions_.AttrsYson); diff --git a/yt/yql/providers/yt/gateway/native/yql_yt_session.h b/yt/yql/providers/yt/gateway/native/yql_yt_session.h index 5b8799d607e5..6d432b148ec7 100644 --- a/yt/yql/providers/yt/gateway/native/yql_yt_session.h +++ b/yt/yql/providers/yt/gateway/native/yql_yt_session.h @@ -54,6 +54,9 @@ struct TSession: public TSessionBase { TTransactionCache TxCache_; + const TQContext QContext_; + const IYtFullCapture::TPtr FullCapture_; + private: void StopQueueAndTracker(); }; diff --git a/yt/yql/providers/yt/gateway/native/yql_yt_transform.cpp b/yt/yql/providers/yt/gateway/native/yql_yt_transform.cpp index f8682e84d0c2..1ff595b63465 100644 --- a/yt/yql/providers/yt/gateway/native/yql_yt_transform.cpp +++ b/yt/yql/providers/yt/gateway/native/yql_yt_transform.cpp @@ -1,5 +1,6 @@ #include "yql_yt_transform.h" +#include #include #include #include @@ -36,7 +37,7 @@ using namespace NKikimr::NMiniKQL; using namespace NYT; using namespace NNodes; -TGatewayTransformer::TGatewayTransformer(const TExecContextBase& execCtx, TYtSettings::TConstPtr settings, const TString& optLLVM, +TGatewayTransformer::TGatewayTransformer(TExecContextBase& execCtx, TYtSettings::TConstPtr settings, const TString& optLLVM, TUdfModulesTable udfModules, IUdfResolver::TPtr udfResolver, TTransactionCache::TEntry::TPtr entry, TProgramBuilder& builder, TTempFiles& tmpFiles, TMaybe publicId) : ExecCtx_(execCtx) @@ -58,7 +59,7 @@ TGatewayTransformer::TGatewayTransformer(const TExecContextBase& execCtx, TYtSet , RemoteFiles_(std::make_shared>()) , LocalFiles_(std::make_shared>>()) , DeferredUdfFiles_(std::make_shared>>()) - + , HasFilesToDump_(std::make_shared(false)) { if (optLLVM != "OFF") { *UsedMem_ = 128_MB; @@ -537,7 +538,7 @@ TTransactionCache::TEntry::TPtr TGatewayTransformer::GetEntry() { } void TGatewayTransformer::AddFile(TString alias, - const TUserFiles::TFileInfo& fileInfo, const TString& udfPrefix) { + TUserFiles::TFileInfo fileInfo, const TString& udfPrefix) { if (alias.StartsWith('/')) { alias = alias.substr(1); } @@ -545,8 +546,37 @@ void TGatewayTransformer::AddFile(TString alias, alias = alias.substr(TStringBuf("home/").length()); } + auto& qContext = ExecCtx_.Session_->QContext_; + auto& fullCapture = ExecCtx_.Session_->FullCapture_; + + if (qContext.CanRead() && qContext.CaptureMode() == EQPlayerCaptureMode::Full) { + auto dumpPath = GetDumpPath(alias, ExecCtx_.Cluster_, YtGateway_FileDumpPath, qContext); + YQL_ENSURE(dumpPath.Defined(), "Missing replay data"); + + YQL_CLOG(INFO, ProviderYt) << "Substituting file " << alias << " with dump " << *dumpPath << " on cluster " << ExecCtx_.Cluster_; + fileInfo.RemotePath = *dumpPath; + fileInfo.Path = nullptr; + } + TString basename; if (fileInfo.Path) { + auto processLocalFileForDump = [&qContext, &fullCapture, this](const TString& alias, const TString& localPath) { + if (!fullCapture) { + return; + } + try { + auto basename = TFsPath(localPath).GetName(); + auto dumpPath = MakeDumpPath(basename, ExecCtx_.Cluster_, ExecCtx_.Session_->OperationOptions_, Settings_); + auto dumpKey = MakeDumpKey(alias, ExecCtx_.Cluster_); + ExecCtx_.JobFilesDumpPaths.emplace(basename, dumpPath); + qContext.GetWriter()->Put({ YtGateway_FileDumpPath, dumpKey }, dumpPath).GetValueSync(); + YQL_CLOG(INFO, ProviderYt) << "Local file " << alias << " (" << basename << ") dump is " << dumpPath << " on cluster " << ExecCtx_.Cluster_; + *HasFilesToDump_ = true; + } catch (const std::exception& e) { + fullCapture->ReportError(e); + } + }; + // Pass only unique files to YT auto insertRes = UniqFiles_->insert({fileInfo.Path->GetMd5(), fileInfo.Path->GetPath()}); TString filePath; @@ -565,6 +595,9 @@ void TGatewayTransformer::AddFile(TString alias, basename = TFsPath(filePath).GetName(); if (alias && alias != basename) { JobFileAliases_->insert({alias, basename}); + processLocalFileForDump(alias, filePath); + } else { + processLocalFileForDump(basename, filePath); } } else { @@ -579,6 +612,18 @@ void TGatewayTransformer::AddFile(TString alias, } auto insertRes = UniqFiles_->insert({alias, remoteFile.Path_}); if (insertRes.second) { + if (fullCapture) { + try { + auto dumpPath = MakeDumpPath(alias, ExecCtx_.Cluster_, ExecCtx_.Session_->OperationOptions_, Settings_); + auto dumpKey = MakeDumpKey(alias, ExecCtx_.Cluster_); + ExecCtx_.JobFilesDumpPaths.emplace(alias, dumpPath); + qContext.GetWriter()->Put({ YtGateway_FileDumpPath, dumpKey }, dumpPath).GetValueSync(); + YQL_CLOG(INFO, ProviderYt) << "Remote file " << alias << " (" << remoteFile.Path_ << ") dump is " << dumpPath << " on cluster " << ExecCtx_.Cluster_; + *HasFilesToDump_ = true; + } catch (const std::exception& e) { + fullCapture->ReportError(e); + } + } RemoteFiles_->push_back(remoteFile.Executable(true).BypassArtifactCache(fileInfo.BypassArtifactCache)); if (fileInfo.RemoteMemoryFactor > 0.) { *UsedMem_ += fileInfo.RemoteMemoryFactor * GetUncompressedFileSize(GetTx(), remoteFile.Path_).GetOrElse(ui64(1) << 10); diff --git a/yt/yql/providers/yt/gateway/native/yql_yt_transform.h b/yt/yql/providers/yt/gateway/native/yql_yt_transform.h index b6dd25f2e994..87850366a5e5 100644 --- a/yt/yql/providers/yt/gateway/native/yql_yt_transform.h +++ b/yt/yql/providers/yt/gateway/native/yql_yt_transform.h @@ -29,7 +29,7 @@ namespace NNative { class TGatewayTransformer { public: - TGatewayTransformer(const TExecContextBase& execCtx, TYtSettings::TConstPtr settings, const TString& optLLVM, + TGatewayTransformer(TExecContextBase& execCtx, TYtSettings::TConstPtr settings, const TString& optLLVM, TUdfModulesTable udfModules, IUdfResolver::TPtr udfResolver, TTransactionCache::TEntry::TPtr entry, NKikimr::NMiniKQL::TProgramBuilder& builder, TTempFiles& tmpFiles, TMaybe publicId); @@ -73,18 +73,22 @@ class TGatewayTransformer { return *UsedMem_; } + bool HasFilesToDump() const { + return *HasFilesToDump_; + } + void ApplyJobProps(TYqlJobBase& job); void ApplyUserJobSpec(NYT::TUserJobSpec& spec, bool localRun); private: NYT::ITransactionPtr GetTx(); TTransactionCache::TEntry::TPtr GetEntry(); - void AddFile(TString alias, const TUserFiles::TFileInfo& fileInfo, const TString& udfPrefix = {}); + void AddFile(TString alias, TUserFiles::TFileInfo fileInfo, const TString& udfPrefix = {}); TString FindUdfPath(const TStringBuf moduleName) const; TString FindUdfPrefix(const TStringBuf moduleName) const; private: - const TExecContextBase& ExecCtx_; + TExecContextBase& ExecCtx_; TYtSettings::TConstPtr Settings_; TUdfModulesTable UdfModules_; IUdfResolver::TPtr UdfResolver_; @@ -107,6 +111,7 @@ class TGatewayTransformer { std::shared_ptr> RemoteFiles_; std::shared_ptr>> LocalFiles_; std::shared_ptr>> DeferredUdfFiles_; + std::shared_ptr HasFilesToDump_; }; } // NNative diff --git a/yt/yql/providers/yt/gateway/qplayer/ya.make b/yt/yql/providers/yt/gateway/qplayer/ya.make index 3494947329b0..d150d2f087f4 100644 --- a/yt/yql/providers/yt/gateway/qplayer/ya.make +++ b/yt/yql/providers/yt/gateway/qplayer/ya.make @@ -5,18 +5,20 @@ SRCS( ) PEERDIR( - yql/essentials/core/qplayer/storage/interface - yql/essentials/providers/common/schema/expr - yql/essentials/core - yql/essentials/core/file_storage + contrib/libs/openssl library/cpp/yson/node library/cpp/random_provider yt/cpp/mapreduce/interface - contrib/libs/openssl + yql/essentials/providers/common/schema/expr + yql/essentials/core + yql/essentials/core/file_storage + yql/essentials/core/services + yql/essentials/utils/log + yt/yql/providers/yt/expr_nodes + yt/yql/providers/yt/lib/dump_helpers + yt/yql/providers/yt/lib/full_capture ) YQL_LAST_ABI_VERSION() END() - - diff --git a/yt/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp b/yt/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp index d787bf0c259f..80d58dea9814 100644 --- a/yt/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp +++ b/yt/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp @@ -1,9 +1,17 @@ #include "yql_yt_qplayer_gateway.h" +#include +#include + #include +#include +#include +#include + +#include + #include #include -#include #include @@ -26,6 +34,7 @@ const TString YtGateway_GetFolders = "YtGateway_GetFolders"; const TString YtGateway_ResolveLinks = "YtGateway_ResolveLinks"; const TString YtGateway_PathStat = "YtGateway_PathStat"; const TString YtGateway_PathStatMissing = "YtGateway_PathStatMissing"; +const TString YtGateway_TableDumpPath = "YtGateway_TableDumpPath"; TString MakeHash(const TString& str) { SHA256_CTX sha; @@ -40,11 +49,20 @@ class TGateway : public IYtGateway { public: TGateway(IYtGateway::TPtr inner, const TQContext& qContext, const TIntrusivePtr& randomProvider, - const TFileStoragePtr& fileStorage) + const TFileStoragePtr& fileStorage, + const TYqlOperationOptions& operationOptions, + const IYtFullCapture::TPtr& fullCapture, + const TYtTablesData::TPtr& tablesData, + TTypeAnnotationContext& types + ) : Inner_(inner) , QContext_(qContext) , RandomProvider_(randomProvider) , FileStorage_(fileStorage) + , OperationOptions_(operationOptions) + , FullCapture_(fullCapture) + , TablesData_(tablesData) + , Types_(types) {} void OpenSession(TOpenSessionOptions&& options) final { @@ -251,13 +269,32 @@ class TGateway : public IYtGateway { res.Data.push_back(data); } - return NThreading::MakeFuture(res); + if (QContext_.CaptureMode() == EQPlayerCaptureMode::Full) { + // Make actual request to create sessions and lock tables + for (auto& table : options.Tables()) { + auto dumpPath = GetTableDumpPath(table.Table(), table.Cluster()); + if (dumpPath.Defined()) { + table.Table() = *dumpPath; + } + } + + return Inner_->GetTableInfo(std::move(options)).Apply([res = std::move(res)] (const NThreading::TFuture& f) { + if (!f.GetValue().Success()) { + return f.GetValue(); + } + return res; + }); + } else { + return NThreading::MakeFuture(std::move(res)); + } } auto optionsDup = options; return Inner_->GetTableInfo(std::move(options)) - .Subscribe([optionsDup, qContext = QContext_, generation](const NThreading::TFuture& future) { - if (!qContext.CanWrite() || future.HasException()) { + .Subscribe([this, optionsDup, generation](const NThreading::TFuture& future) { + YQL_LOG_CTX_ROOT_SESSION_SCOPE(optionsDup.SessionId()); + + if (!QContext_.CanWrite() || future.HasException()) { return; } @@ -317,8 +354,10 @@ class TGateway : public IYtGateway { valueNode("WriteLock", data.WriteLock); auto value = NYT::NodeToYsonString(valueNode, NYT::NYson::EYsonFormat::Binary); - qContext.GetWriter()->Put({YtGateway_GetTableInfo, key},value).GetValueSync(); + QContext_.GetWriter()->Put({YtGateway_GetTableInfo, key},value).GetValueSync(); } + + DumpTables(res.Data, optionsDup); }); } @@ -664,7 +703,11 @@ class TGateway : public IYtGateway { NThreading::TFuture ResOrPull(const TExprNode::TPtr& node, TExprContext& ctx, TResOrPullOptions&& options) final { if (QContext_.CanRead()) { - throw yexception() << "Can't replay ResOrPull"; + if (QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { + throw yexception() << "Can't replay ResOrPull"; + } + + return Inner_->ResOrPull(ReplaceTablesWithDump(node, ctx), ctx, std::move(options)); } return Inner_->ResOrPull(node, ctx, std::move(options)); @@ -672,15 +715,23 @@ class TGateway : public IYtGateway { NThreading::TFuture Run(const TExprNode::TPtr& node, TExprContext& ctx, TRunOptions&& options) final { if (QContext_.CanRead()) { - throw yexception() << "Can't replay Run"; + if (QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { + throw yexception() << "Can't replay Run"; + } + + return Inner_->Run(ReplaceTablesWithDump(node, ctx), ctx, std::move(options)); } return Inner_->Run(node, ctx, std::move(options)); } - NThreading::TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) const final { + NThreading::TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) final { if (QContext_.CanRead()) { - throw yexception() << "Can't replay Prepare"; + if (QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { + throw yexception() << "Can't replay Prepare"; + } + + return Inner_->Prepare(ReplaceTablesWithDump(node, ctx), ctx, std::move(options)); } return Inner_->Prepare(node, ctx, std::move(options)); @@ -688,7 +739,11 @@ class TGateway : public IYtGateway { NThreading::TFuture GetTableStat(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) final { if (QContext_.CanRead()) { - throw yexception() << "Can't replay GetTableStat"; + if (QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { + throw yexception() << "Can't replay GetTableStat"; + } + + return Inner_->GetTableStat(ReplaceTablesWithDump(node, ctx), ctx, std::move(options)); } return Inner_->GetTableStat(node, ctx, std::move(options)); @@ -696,7 +751,11 @@ class TGateway : public IYtGateway { NThreading::TFuture Calc(const TExprNode::TListType& nodes, TExprContext& ctx, TCalcOptions&& options) final { if (QContext_.CanRead()) { - throw yexception() << "Can't replay Calc"; + if (QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { + throw yexception() << "Can't replay Calc"; + } + + return Inner_->Calc(ReplaceTablesWithDump(nodes, ctx), ctx, std::move(options)); } return Inner_->Calc(nodes, ctx, std::move(options)); @@ -704,14 +763,18 @@ class TGateway : public IYtGateway { NThreading::TFuture Publish(const TExprNode::TPtr& node, TExprContext& ctx, TPublishOptions&& options) final { if (QContext_.CanRead()) { - throw yexception() << "Can't replay Publish"; + if (QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { + throw yexception() << "Can't replay Publish"; + } + + return Inner_->Publish(ReplaceTablesWithDump(node, ctx), ctx, std::move(options)); } return Inner_->Publish(node, ctx, std::move(options)); } NThreading::TFuture Commit(TCommitOptions&& options) final { - if (QContext_.CanRead()) { + if (QContext_.CanRead() && QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { throw yexception() << "Can't replay Commit"; } @@ -720,7 +783,18 @@ class TGateway : public IYtGateway { NThreading::TFuture DropTrackables(TDropTrackablesOptions&& options) final { if (QContext_.CanRead()) { - throw yexception() << "Can't replay DropTrackables"; + if (QContext_.CaptureMode() != EQPlayerCaptureMode::Full) { + throw yexception() << "Can't replay DropTrackables"; + } + + for (auto& path : options.Pathes()) { + auto dumpPath = GetTableDumpPath(path.Path, path.Cluster); + if (dumpPath.Defined()) { + path.Path = *dumpPath; + } + } + + return Inner_->DropTrackables(std::move(options)); } return Inner_->DropTrackables(std::move(options)); @@ -796,6 +870,18 @@ class TGateway : public IYtGateway { NThreading::TFuture PathStat(TPathStatOptions&& options) final { ui64 generation = SessionGenerations_[options.SessionId()]; if (QContext_.CanRead()) { + if (QContext_.CaptureMode() == EQPlayerCaptureMode::Full) { + // Make real request to avoid problems with temporary tables + for (auto& path : options.Paths()) { + auto dumpPath = GetTableDumpPath(path.Path().Path_, options.Cluster()); + if (dumpPath.Defined()) { + path.Path().Path_ = *dumpPath; + } + } + + return Inner_->PathStat(std::move(options)); + } + TPathStatResult res; res.DataSize.resize(options.Paths().size(), 0); res.Extended.resize(options.Paths().size()); @@ -839,6 +925,18 @@ class TGateway : public IYtGateway { TPathStatResult TryPathStat(TPathStatOptions&& options) final { ui64 generation = SessionGenerations_[options.SessionId()]; if (QContext_.CanRead()) { + if (QContext_.CaptureMode() == EQPlayerCaptureMode::Full) { + // Make real request to avoid problems with temporary tables + for (auto& path : options.Paths()) { + auto dumpPath = GetTableDumpPath(path.Path().Path_, options.Cluster()); + if (dumpPath.Defined()) { + path.Path().Path_ = *dumpPath; + } + } + + return Inner_->TryPathStat(std::move(options)); + } + TPathStatResult res; res.DataSize.resize(options.Paths().size(), 0); res.Extended.resize(options.Paths().size()); @@ -976,20 +1074,149 @@ class TGateway : public IYtGateway { return Inner_->SnapshotLayers(std::move(options)); } + + NThreading::TFuture Dump(TDumpOptions&& options) override { + if (QContext_.CanRead()) { + return NThreading::MakeFuture(TDumpResult()); + } + + return Inner_->Dump(std::move(options)); + } + +private: + TMaybe GetTableDumpPath(const TStringBuf& name, const TStringBuf& cluster) const { + return GetDumpPath(name, cluster, YtGateway_TableDumpPath, QContext_); + } + + TExprNode::TPtr ReplaceTablesWithDump(TExprNode::TPtr start, TExprContext& ctx) const { + TNodeOnNodeOwnedMap replaces; + VisitExpr(start, [&](const TExprNode::TPtr& node) { + if (NNodes::TYtTable::Match(node.Get())) { + auto table = TString(node->Child(NNodes::TYtTable::idx_Name)->Content()); + auto cluster = TString(node->Child(NNodes::TYtTable::idx_Cluster)->Content()); + auto dumpPath = GetTableDumpPath(table, cluster); + if (dumpPath.Defined()) { + YQL_CLOG(INFO, ProviderYt) << "Substituting table " << table << " with dump " << *dumpPath << " on cluster " << cluster; + replaces[node.Get()] = ctx.ChangeChild(*node, NNodes::TYtTable::idx_Name, ctx.NewAtom(node->Pos(), *dumpPath, TNodeFlags::Default)); + + auto& origTableData = TablesData_->GetTable(cluster, table, {}); + if (!TablesData_->FindTable(cluster, *dumpPath, {})) { + // Add fake table data to allow YT type annotation + TablesData_->GetOrAddTable(cluster, *dumpPath, {}) = origTableData; + } + } + + return false; + } + + return true; + }); + start = ctx.ReplaceNodes(std::move(start), replaces); + + // Run type ann & caclulate constraints + TTransformationPipeline pipeline(&Types_); + pipeline.AddServiceTransformers(); + pipeline.AddTypeAnnotationTransformerWithMode(TIssuesIds::CORE_TYPE_ANN, ETypeCheckMode::Repeat); + pipeline.AddPostTypeAnnotation(true); + + YQL_ENSURE(InstantTransform(*pipeline.Build(), start, ctx) == IGraphTransformer::TStatus::Ok); + return start; + } + + TExprNode::TListType ReplaceTablesWithDump(const TExprNode::TListType& starts, TExprContext& ctx) const { + TExprNode::TListType result; + for (const auto& node : starts) { + result.push_back(ReplaceTablesWithDump(node, ctx)); + } + return result; + } + + void DumpTables(const TVector& tables, const TGetTableInfoOptions& options) { + if (!QContext_.CanWrite() || QContext_.CaptureMode() != EQPlayerCaptureMode::Full || options.Epoch() != 0) { + return; + } + YQL_ENSURE(FullCapture_); + + try { + TDumpOptions dumpOptions(options.SessionId()); + size_t tableDataSize = 0; + + ui64 generation = SessionGenerations_[options.SessionId()]; + YQL_ENSURE(tables.size() == options.Tables().size()); + for (size_t i = 0; i < tables.size(); i++) { + const auto& req = options.Tables()[i]; + const auto& tableInfo = tables[i]; + + auto key = MakeGetTableInfoKey(req, options.Epoch(), generation); + auto dumpKey = MakeDumpKey(req.Table(), req.Cluster()); + + TString dumpPath; + if (tableInfo.Meta && tableInfo.Meta->DoesExist) { + if (tableInfo.Meta->IsDynamic) { + throw yexception() << "dynamic table " << req.Table() << " on cluster " << req.Cluster(); + } + + YQL_ENSURE(tableInfo.Stat); + tableDataSize += tableInfo.Stat->DataSize; + + dumpPath = MakeDumpPath(req.Table(), req.Cluster(), OperationOptions_, options.Config()); + YQL_CLOG(INFO, ProviderYt) << "Dump table " << req.Table() << " to " << dumpPath << " on cluster " << req.Cluster(); + dumpOptions.Entries()[req.Cluster()].push_back(TDumpOptions::TEntry { + .SrcPath = req.Table(), + .DstPath = dumpPath, + }); + } else { + dumpPath = MakeDumpPath(req.Table(), req.Cluster(), OperationOptions_, options.Config(), true); + YQL_CLOG(INFO, ProviderYt) << "Subst table " << req.Table() << " to " << dumpPath << " on cluster " << req.Cluster(); + } + + QContext_.GetWriter()->Put({ YtGateway_TableDumpPath, dumpKey }, dumpPath).GetValueSync(); + } + + if (!dumpOptions.Entries().empty()) { + auto tableDataSizeLimit = options.Config()->_QueryDumpTableSizeLimit.Get().GetOrElse(DEFAULT_QUERY_DUMP_TABLE_SIZE_LIMIT); + if (tableDataSize > tableDataSizeLimit) { + throw yexception() << "data size limit exceeded (" << tableDataSize << " > " << tableDataSizeLimit << ")"; + } + + auto tableCountLimit = options.Config()->_QueryDumpTableCountPerClusterLimit.Get().GetOrElse(DEFAULT_QUERY_DUMP_TABLE_COUNT_PER_CLUSTER_LIMIT); + for (auto& [cluster, tables] : dumpOptions.Entries()) { + if (tables.size() > tableCountLimit) { + throw yexception() << "table count limit exceeded (" << tables.size() << " > " << tableCountLimit << ")"; + } + } + + FullCapture_->AddOperationFuture(Inner_->Dump(std::move(dumpOptions)).Apply([] (const NThreading::TFuture& f) { + return NCommon::TOperationResult(f.GetValue()); + })); + } + } catch (const std::exception& e) { + FullCapture_->ReportError(e); + } + } + private: const IYtGateway::TPtr Inner_; const TQContext QContext_; const TIntrusivePtr RandomProvider_; const TFileStoragePtr FileStorage_; + const TYqlOperationOptions OperationOptions_; + const IYtFullCapture::TPtr FullCapture_; + const TYtTablesData::TPtr TablesData_; + TTypeAnnotationContext& Types_; + THashSet PathStatKeys_; THashMap SessionGenerations_; }; } -IYtGateway::TPtr WrapYtGatewayWithQContext(IYtGateway::TPtr gateway, const TQContext& qContext, - const TIntrusivePtr& randomProvider, const TFileStoragePtr& fileStorage) { - return MakeIntrusive(gateway, qContext, randomProvider, fileStorage); +IYtGateway::TPtr WrapYtGatewayWithQContext( + IYtGateway::TPtr gateway, const TQContext& qContext, const TIntrusivePtr& randomProvider, + const TFileStoragePtr& fileStorage, const TYqlOperationOptions& operationOptions, const IYtFullCapture::TPtr& fullCapture, + const TYtTablesData::TPtr& tablesData, TTypeAnnotationContext& types +) { + return MakeIntrusive(gateway, qContext, randomProvider, fileStorage, operationOptions, fullCapture, tablesData, types); } } diff --git a/yt/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.h b/yt/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.h index 4c327fcb0d92..e0e67a10518f 100644 --- a/yt/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.h +++ b/yt/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.h @@ -1,5 +1,7 @@ #pragma once -#include + +#include +#include #include #include @@ -7,7 +9,10 @@ namespace NYql { -IYtGateway::TPtr WrapYtGatewayWithQContext(IYtGateway::TPtr gateway, const TQContext& qContext, - const TIntrusivePtr& randomProvider, const TFileStoragePtr& fileStorage); +IYtGateway::TPtr WrapYtGatewayWithQContext( + IYtGateway::TPtr gateway, const TQContext& qContext, const TIntrusivePtr& randomProvider, + const TFileStoragePtr& fileStorage, const TYqlOperationOptions& operationOptions, const IYtFullCapture::TPtr& fullCapture, + const TYtTablesData::TPtr& tablesData, TTypeAnnotationContext& types +); -} \ No newline at end of file +} diff --git a/yt/yql/providers/yt/lib/dump_helpers/ya.make b/yt/yql/providers/yt/lib/dump_helpers/ya.make new file mode 100644 index 000000000000..343e00349f3c --- /dev/null +++ b/yt/yql/providers/yt/lib/dump_helpers/ya.make @@ -0,0 +1,15 @@ +LIBRARY() + +SRCS( + yql_yt_dump_helpers.cpp +) + +PEERDIR( + library/cpp/yson/node + yt/yql/providers/yt/common + yt/yql/providers/yt/lib/hash +) + +YQL_LAST_ABI_VERSION() + +END() diff --git a/yt/yql/providers/yt/lib/dump_helpers/yql_yt_dump_helpers.cpp b/yt/yql/providers/yt/lib/dump_helpers/yql_yt_dump_helpers.cpp new file mode 100644 index 000000000000..92aaa3bdac31 --- /dev/null +++ b/yt/yql/providers/yt/lib/dump_helpers/yql_yt_dump_helpers.cpp @@ -0,0 +1,43 @@ +#include "yql_yt_dump_helpers.h" + +#include + +#include + +#include + +namespace NYql { + +TString MakeDumpKey(const TStringBuf& name, const TStringBuf& cluster) { + return (THashBuilder() << NYT::NodeToCanonicalYsonString(NYT::TNode::CreateList({ name, cluster }))).Finish(); +} + +TString MakeDumpPath(const TString& srcPath, const TString& cluster, const TYqlOperationOptions& opOptions, const TYtSettings::TConstPtr& configuration, bool out) { + YQL_ENSURE(opOptions.Id.Defined(), "Operation id is not set"); + + auto opIdHash = HexEncode((THashBuilder() << *opOptions.Id).Finish()); + auto tableHash = HexEncode((THashBuilder() << srcPath << cluster).Finish()); + + TString root; + if (!out) { + auto dumpFolder = configuration->_QueryDumpFolder.Get(cluster); + YQL_ENSURE(dumpFolder.Defined(), "yt._QueryDumpFolder is not set for cluster " << cluster); + root = *dumpFolder; + } else { + root = "//tmp/yql/_qdump_out"; + } + + return TStringBuilder() << root << "/" << opIdHash << "/" << tableHash; +} + +TMaybe GetDumpPath(const TStringBuf& name, const TStringBuf& cluster, const TString& component, const TQContext& qContext) { + YQL_ENSURE(qContext.CaptureMode() == EQPlayerCaptureMode::Full); + + auto dumpKey = MakeDumpKey(name, cluster); + auto item = qContext.GetReader()->Get({ component, dumpKey }).GetValueSync(); + return item.AndThen([] (const TQItem& item) { + return MakeMaybe(item.Value); + }); +} + +} // namespace NYql diff --git a/yt/yql/providers/yt/lib/dump_helpers/yql_yt_dump_helpers.h b/yt/yql/providers/yt/lib/dump_helpers/yql_yt_dump_helpers.h new file mode 100644 index 000000000000..d522d9c97a01 --- /dev/null +++ b/yt/yql/providers/yt/lib/dump_helpers/yql_yt_dump_helpers.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +#include + +namespace NYql { + +inline const TString YtGateway_FileDumpPath = "YtGateway_FileDumpPath"; + +TString MakeDumpKey(const TStringBuf& name, const TStringBuf& cluster); +TString MakeDumpPath(const TString& srcPath, const TString& cluster, const TYqlOperationOptions& opOptions, const TYtSettings::TConstPtr& configuration, bool out = false); + +TMaybe GetDumpPath(const TStringBuf& name, const TStringBuf& cluster, const TString& component, const TQContext& qContext); + +} // namespace NYql diff --git a/yt/yql/providers/yt/lib/full_capture/ya.make b/yt/yql/providers/yt/lib/full_capture/ya.make new file mode 100644 index 000000000000..d965e9f7310b --- /dev/null +++ b/yt/yql/providers/yt/lib/full_capture/ya.make @@ -0,0 +1,16 @@ +LIBRARY() + +SRCS( + yql_yt_full_capture.cpp +) + +PEERDIR( + yql/essentials/core/qplayer/storage/interface + yql/essentials/providers/common/gateway + yql/essentials/utils/log + yql/essentials/utils + + library/cpp/threading/future +) + +END() diff --git a/yt/yql/providers/yt/lib/full_capture/yql_yt_full_capture.cpp b/yt/yql/providers/yt/lib/full_capture/yql_yt_full_capture.cpp new file mode 100644 index 000000000000..cebec11d729b --- /dev/null +++ b/yt/yql/providers/yt/lib/full_capture/yql_yt_full_capture.cpp @@ -0,0 +1,73 @@ +#include "yql_yt_full_capture.h" + +#include +#include + +#include + +namespace NYql { + +namespace { + +class TYtFullCapture : public IYtFullCapture { +public: + void ReportError(const std::exception& e) override { + auto guard = Guard(Lock_); + YQL_CLOG(WARN, Core) << "YT full capture has not been taken: " << e.what(); + State_ = EState::Error; + } + + void AddOperationFuture(const NThreading::TFuture& future) override { + auto guard = Guard(Lock_); + OperationFutures_.push_back(future); + } + + bool Seal() override { + if (State_ == EState::Error) { + return false; + } + YQL_ENSURE(State_ == EState::None, "bad state"); + + auto captureFuture = NThreading::WaitAll(OperationFutures_); + if (!captureFuture.IsReady()) { + YQL_CLOG(WARN, Core) << "YT full capture has not been taken - deadline exceeded"; + return false; + } + YQL_ENSURE(captureFuture.HasValue()); + + for (auto& future : OperationFutures_) { + auto& result = future.GetValue(); + if (!result.Success()) { + YQL_CLOG(WARN, Core) << "YT full capture has not been taken"; + return false; + } + } + + State_ = EState::Ready; + return true; + } + + bool IsReady() const override { + return State_ == EState::Ready; + } + +private: + enum class EState { + None, + Ready, + Error, + }; + + EState State_ = EState::None; + + TMutex Lock_; + TVector> OperationFutures_; +}; + +} // namespace + +IYtFullCapture::TPtr CreateYtFullCapture() { + return MakeIntrusive(); +} + +} // namespace NYql diff --git a/yt/yql/providers/yt/lib/full_capture/yql_yt_full_capture.h b/yt/yql/providers/yt/lib/full_capture/yql_yt_full_capture.h new file mode 100644 index 000000000000..872fba1d4cc8 --- /dev/null +++ b/yt/yql/providers/yt/lib/full_capture/yql_yt_full_capture.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +#include + +namespace NYql { + +class IYtFullCapture : public TThrRefBase { +public: + using TPtr = TIntrusivePtr; + + virtual void ReportError(const std::exception& e) = 0; + virtual void AddOperationFuture(const NThreading::TFuture& future) = 0; + virtual bool Seal() = 0; + virtual bool IsReady() const = 0; +}; + +IYtFullCapture::TPtr CreateYtFullCapture(); + +} // namespace NYql diff --git a/yt/yql/providers/yt/provider/ya.make b/yt/yql/providers/yt/provider/ya.make index cc1c66e3139a..3612b0b86df6 100644 --- a/yt/yql/providers/yt/provider/ya.make +++ b/yt/yql/providers/yt/provider/ya.make @@ -122,6 +122,7 @@ PEERDIR( yt/yql/providers/yt/common yt/yql/providers/yt/expr_nodes yt/yql/providers/yt/lib/expr_traits + yt/yql/providers/yt/lib/full_capture yt/yql/providers/yt/lib/graph_reorder yt/yql/providers/yt/lib/hash yt/yql/providers/yt/lib/key_filter diff --git a/yt/yql/providers/yt/provider/yql_yt_datasink.cpp b/yt/yql/providers/yt/provider/yql_yt_datasink.cpp index 87eaff37b13a..2dd56bb43aeb 100644 --- a/yt/yql/providers/yt/provider/yql_yt_datasink.cpp +++ b/yt/yql/providers/yt/provider/yql_yt_datasink.cpp @@ -629,6 +629,10 @@ class TYtDataSink : public TDataProviderBase { return State_->YtflowOptimization_.Get(); } + bool IsFullCaptureReady() override { + return State_->FullCapture_ ? State_->FullCapture_->IsReady() : false; + } + private: static void WriteColumns(NYson::TYsonWriter& writer, TExprBase columns) { if (auto maybeList = columns.Maybe()) { diff --git a/yt/yql/providers/yt/provider/yql_yt_datasink_finalize.cpp b/yt/yql/providers/yt/provider/yql_yt_datasink_finalize.cpp index 6a0a4aa5d4bd..9fc108cbd479 100644 --- a/yt/yql/providers/yt/provider/yql_yt_datasink_finalize.cpp +++ b/yt/yql/providers/yt/provider/yql_yt_datasink_finalize.cpp @@ -16,11 +16,17 @@ class TYtDataSinkFinalizingTransformer: public TAsyncCallbackTransformer CallbackTransform(const TExprNode::TPtr& input, TExprNode::TPtr& output, TExprContext& ctx) { Y_UNUSED(ctx); output = input; + + bool fullCaptureReady = false; + if (State_->FullCapture_) { + fullCaptureReady = State_->FullCapture_->Seal(); + } auto future = State_->Gateway->Finalize( IYtGateway::TFinalizeOptions(State_->SessionId) .Config(State_->Configuration->Snapshot()) - .Abort(State_->Types->HiddenMode == EHiddenMode::Force) + .Abort(State_->Types->HiddenMode == EHiddenMode::Force || State_->Types->QContext.CanRead()) .DetachSnapshotTxs(State_->PassiveExecution) + .CommitDumpTxs(fullCaptureReady) ); return WrapFuture(future, [](const IYtGateway::TFinalizeResult& res, const TExprNode::TPtr& input, TExprContext& ctx) { Y_UNUSED(res); diff --git a/yt/yql/providers/yt/provider/yql_yt_forwarding_gateway.cpp b/yt/yql/providers/yt/provider/yql_yt_forwarding_gateway.cpp index afee8004b4ba..e6279212dec4 100644 --- a/yt/yql/providers/yt/provider/yql_yt_forwarding_gateway.cpp +++ b/yt/yql/providers/yt/provider/yql_yt_forwarding_gateway.cpp @@ -57,7 +57,7 @@ TFuture TYtForwardingGatewayBase::Run(const TExprNode::T return Slave_->Run(node, ctx, std::move(options)); } -TFuture TYtForwardingGatewayBase::Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) const { +TFuture TYtForwardingGatewayBase::Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) { return Slave_->Prepare(node, ctx, std::move(options)); } @@ -149,5 +149,8 @@ NThreading::TFuture TYtForwardingGatewayBase: return Slave_->SnapshotLayers(std::move(options)); } +NThreading::TFuture TYtForwardingGatewayBase::Dump(TDumpOptions&& options) { + return Slave_->Dump(std::move(options)); +} } // namspace NYql diff --git a/yt/yql/providers/yt/provider/yql_yt_forwarding_gateway.h b/yt/yql/providers/yt/provider/yql_yt_forwarding_gateway.h index 6bae71121876..27a140e48626 100644 --- a/yt/yql/providers/yt/provider/yql_yt_forwarding_gateway.h +++ b/yt/yql/providers/yt/provider/yql_yt_forwarding_gateway.h @@ -31,7 +31,7 @@ class TYtForwardingGatewayBase: public IYtGateway { TFuture Run(const TExprNode::TPtr& node, TExprContext& ctx, TRunOptions&& options) override; - TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) const override; + TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) override; TFuture Calc(const TExprNode::TListType& nodes, TExprContext& ctx, TCalcOptions&& options) override; @@ -77,6 +77,8 @@ class TYtForwardingGatewayBase: public IYtGateway { NThreading::TFuture SnapshotLayers(TSnapshotLayersOptions&& options) override; + NThreading::TFuture Dump(TDumpOptions&& options) override; + protected: IYtGateway::TPtr Slave_; }; diff --git a/yt/yql/providers/yt/provider/yql_yt_gateway.h b/yt/yql/providers/yt/provider/yql_yt_gateway.h index 76b8bee54486..228d82775853 100644 --- a/yt/yql/providers/yt/provider/yql_yt_gateway.h +++ b/yt/yql/providers/yt/provider/yql_yt_gateway.h @@ -4,6 +4,7 @@ #include "yql_yt_table_desc.h" #include +#include #include #include @@ -108,6 +109,8 @@ class IYtGateway : public TThrRefBase { OPTION_FIELD(TIntrusivePtr, TimeProvider) OPTION_FIELD(TStatWriter, StatWriter) OPTION_FIELD_DEFAULT(bool, CreateOperationTracker, true) + OPTION_FIELD_DEFAULT(TQContext, QContext, {}) + OPTION_FIELD_DEFAULT(IYtFullCapture::TPtr, FullCapture, nullptr) }; ////////////////////////////////////////////////////////////// @@ -145,6 +148,7 @@ class IYtGateway : public TThrRefBase { OPTION_FIELD(TYtSettings::TConstPtr, Config) OPTION_FIELD_DEFAULT(bool, Abort, false) OPTION_FIELD_DEFAULT(bool, DetachSnapshotTxs, false) + OPTION_FIELD_DEFAULT(bool, CommitDumpTxs, false) }; struct TFinalizeResult : public NCommon::TOperationResult { @@ -672,6 +676,28 @@ class IYtGateway : public TThrRefBase { TVector> Data; }; + struct TDumpOptions : public TCommonOptions { + using TSelf = TDumpOptions; + + struct TEntry { + TString SrcPath; + TString DstPath; + }; + + using TEntries = TVector; + using TEntriesPerCluster = THashMap; + + TDumpOptions(const TString& sessionId) + : TCommonOptions(sessionId) + { + } + + OPTION_FIELD(TEntriesPerCluster, Entries); + }; + + struct TDumpResult : public NCommon::TOperationResult { + }; + public: virtual ~IYtGateway() = default; @@ -699,7 +725,7 @@ class IYtGateway : public TThrRefBase { virtual NThreading::TFuture Run(const TExprNode::TPtr& node, TExprContext& ctx, TRunOptions&& options) = 0; - virtual NThreading::TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) const = 0; + virtual NThreading::TFuture Prepare(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) = 0; virtual NThreading::TFuture GetTableStat(const TExprNode::TPtr& node, TExprContext& ctx, TPrepareOptions&& options) = 0 ; virtual NThreading::TFuture Calc(const TExprNode::TListType& nodes, TExprContext& ctx, TCalcOptions&& options) = 0; @@ -739,6 +765,7 @@ class IYtGateway : public TThrRefBase { virtual TMaybe GetTableFilePath(const TGetTableFilePathOptions&& options) = 0; + virtual NThreading::TFuture Dump(TDumpOptions&& options) = 0; }; } diff --git a/yt/yql/providers/yt/provider/yql_yt_provider.cpp b/yt/yql/providers/yt/provider/yql_yt_provider.cpp index cc4fc8f5f55d..a6f2d5a2b3a4 100644 --- a/yt/yql/providers/yt/provider/yql_yt_provider.cpp +++ b/yt/yql/providers/yt/provider/yql_yt_provider.cpp @@ -341,17 +341,22 @@ void TYtState::LeaveEvaluation(ui64 id) { std::pair, TStatWriter> CreateYtNativeState(IYtGateway::TPtr gateway, const TString& userName, const TString& sessionId, const TYtGatewayConfig* ytGatewayConfig, TIntrusivePtr typeCtx, - const IOptimizerFactory::TPtr& optFactory, const IDqHelper::TPtr& helper) + const IOptimizerFactory::TPtr& optFactory, const IDqHelper::TPtr& helper, const TYtTablesData::TPtr& tablesData, const IYtFullCapture::TPtr& fullCapture, + const TQContext& qContext) { - auto ytState = std::make_shared(typeCtx.Get()); + auto ytState = std::make_shared(typeCtx.Get(), qContext); ytState->SessionId = sessionId; ytState->Gateway = gateway; + if (tablesData) { + ytState->TablesData = tablesData; + } ytState->DqIntegration_ = CreateYtDqIntegration(ytState); ytState->OptimizerFactory_ = optFactory; ytState->DqHelper = helper; ytState->YtflowIntegration_ = CreateYtYtflowIntegration(ytState); ytState->YtflowOptimization_ = CreateYtYtflowOptimization(ytState); ytState->LayersIntegration_ = CreateYtLayersIntegration(); + ytState->FullCapture_ = fullCapture; if (ytGatewayConfig) { std::unordered_set groups; @@ -410,10 +415,17 @@ TDataProviderInitializer GetYtNativeDataProviderInitializer(IYtGateway::TPtr gat Y_UNUSED(progressWriter); Y_UNUSED(operationOptions); Y_UNUSED(hiddenAborter); + + IYtFullCapture::TPtr fullCapture; + if (qContext.CanWrite() && qContext.CaptureMode() == EQPlayerCaptureMode::Full) { + fullCapture = CreateYtFullCapture(); + } + auto tablesData = MakeIntrusive(); + auto gateway = originalGateway; if (qContext) { gateway = WrapYtGatewayWithQContext(originalGateway, qContext, - typeCtx->RandomProvider, typeCtx->FileStorage); + typeCtx->RandomProvider, typeCtx->FileStorage, operationOptions, fullCapture, tablesData, *typeCtx); } TDataProviderInfo info; @@ -422,14 +434,14 @@ TDataProviderInitializer GetYtNativeDataProviderInitializer(IYtGateway::TPtr gat const TYtGatewayConfig* ytGatewayConfig = gatewaysConfig ? &gatewaysConfig->GetYt() : nullptr; TYtState::TPtr ytState; TStatWriter statWriter; - std::tie(ytState, statWriter) = CreateYtNativeState(gateway, userName, sessionId, ytGatewayConfig, typeCtx, optFactory, helper); + std::tie(ytState, statWriter) = CreateYtNativeState(gateway, userName, sessionId, ytGatewayConfig, typeCtx, optFactory, helper, tablesData, fullCapture, qContext); ytState->PlanLimits = planLimits; info.Names.insert({TString{YtProviderName}}); info.Source = CreateYtDataSource(ytState); info.Sink = CreateYtDataSink(ytState); info.SupportFullResultDataSink = true; - info.OpenSession = [gateway, statWriter](const TString& sessionId, const TString& username, + info.OpenSession = [gateway, statWriter, qContext, fullCapture](const TString& sessionId, const TString& username, const TOperationProgressWriter& progressWriter, const TYqlOperationOptions& operationOptions, TIntrusivePtr randomProvider, TIntrusivePtr timeProvider) { gateway->OpenSession( @@ -440,6 +452,8 @@ TDataProviderInitializer GetYtNativeDataProviderInitializer(IYtGateway::TPtr gat .RandomProvider(randomProvider) .TimeProvider(timeProvider) .StatWriter(statWriter) + .QContext(qContext) + .FullCapture(fullCapture) ); return NThreading::MakeFuture(); }; diff --git a/yt/yql/providers/yt/provider/yql_yt_provider.h b/yt/yql/providers/yt/provider/yql_yt_provider.h index 698e5beb1a40..ad97fddf9918 100644 --- a/yt/yql/providers/yt/provider/yql_yt_provider.h +++ b/yt/yql/providers/yt/provider/yql_yt_provider.h @@ -6,6 +6,7 @@ #include "yql_yt_io_discovery_walk_folders.h" #include +#include #include #include #include @@ -98,9 +99,9 @@ struct TYtState { bool IsHybridEnabledForCluster(const std::string_view& cluster) const; bool HybridTakesTooLong() const; - TYtState(TTypeAnnotationContext* types) { + TYtState(TTypeAnnotationContext* types, const TQContext& qContext = {}) { Types = types; - Configuration = MakeIntrusive(*types); + Configuration = MakeIntrusive(*types, qContext); } TString SessionId; @@ -134,6 +135,7 @@ struct TYtState { bool IsDqTimeout = false; NLayers::ILayersIntegrationPtr LayersIntegration_; THashMap>> LayersSnapshots; + IYtFullCapture::TPtr FullCapture_; private: std::unordered_map ConfigurationEvalStates_; std::unordered_map EpochEvalStates_; @@ -143,7 +145,9 @@ struct TYtState { class TYtGatewayConfig; std::pair, TStatWriter> CreateYtNativeState(IYtGateway::TPtr gateway, const TString& userName, const TString& sessionId, const TYtGatewayConfig* ytGatewayConfig, TIntrusivePtr typeCtx, - const IOptimizerFactory::TPtr& optFactory, const IDqHelper::TPtr& helper); + const IOptimizerFactory::TPtr& optFactory, const IDqHelper::TPtr& helper, + const TYtTablesData::TPtr& tablesData = {}, const IYtFullCapture::TPtr& fullCapture = {}, + const TQContext& qContext = {}); TIntrusivePtr CreateYtDataSource(TYtState::TPtr state); TIntrusivePtr CreateYtDataSink(TYtState::TPtr state); From 6444701d3e0efa06cbc50bbf3a3cf959cf3ce216 Mon Sep 17 00:00:00 2001 From: achains Date: Tue, 21 Oct 2025 16:00:39 +0300 Subject: [PATCH 12/55] YT-26108: Distributed file write * Changelog entry Type: feature Component: proxy Introduce distributed write protocol for files commit_hash:6e90fa9dc228b4b1b9fecc19473152f851c39ce1 --- yt/yt/client/api/client.h | 3 + yt/yt/client/api/delegating_client.h | 21 +++ yt/yt/client/api/delegating_transaction.cpp | 15 ++ yt/yt/client/api/delegating_transaction.h | 14 +- yt/yt/client/api/distributed_file_client.cpp | 19 ++ yt/yt/client/api/distributed_file_client.h | 102 +++++++++++ yt/yt/client/api/distributed_file_session.cpp | 91 +++++++++ yt/yt/client/api/distributed_file_session.h | 88 +++++++++ yt/yt/client/api/file_writer.h | 12 +- yt/yt/client/api/public.h | 11 ++ .../client/api/rpc_proxy/api_service_proxy.h | 7 + yt/yt/client/api/rpc_proxy/client_base.cpp | 55 +++++- yt/yt/client/api/rpc_proxy/client_base.h | 13 ++ yt/yt/client/api/rpc_proxy/client_impl.cpp | 17 ++ yt/yt/client/api/rpc_proxy/client_impl.h | 5 + yt/yt/client/api/rpc_proxy/file_reader.cpp | 1 - yt/yt/client/api/rpc_proxy/file_writer.cpp | 109 ++++++++++- yt/yt/client/api/rpc_proxy/file_writer.h | 12 +- yt/yt/client/api/rpc_proxy/helpers.cpp | 110 ++++++++++- yt/yt/client/api/rpc_proxy/helpers.h | 54 +++++- .../client/api/rpc_proxy/transaction_impl.cpp | 30 +++ yt/yt/client/api/rpc_proxy/transaction_impl.h | 12 ++ .../driver/distributed_file_commands.cpp | 173 ++++++++++++++++++ .../client/driver/distributed_file_commands.h | 78 ++++++++ yt/yt/client/driver/driver.cpp | 6 + yt/yt/client/driver/ya.make | 1 + yt/yt/client/federated/client.cpp | 7 + yt/yt/client/file_client/public.h | 8 + yt/yt/client/hedging/hedging.cpp | 4 + yt/yt/client/unittests/mock/client.h | 21 +++ yt/yt/client/unittests/mock/transaction.h | 16 ++ yt/yt/client/ya.make | 2 + yt/yt/core/rpc/stream-inl.h | 14 +- yt/yt/core/rpc/stream.h | 9 +- .../api/rpc_proxy/proto/api_service.proto | 48 +++++ 35 files changed, 1162 insertions(+), 26 deletions(-) create mode 100644 yt/yt/client/api/distributed_file_client.cpp create mode 100644 yt/yt/client/api/distributed_file_client.h create mode 100644 yt/yt/client/api/distributed_file_session.cpp create mode 100644 yt/yt/client/api/distributed_file_session.h create mode 100644 yt/yt/client/driver/distributed_file_commands.cpp create mode 100644 yt/yt/client/driver/distributed_file_commands.h diff --git a/yt/yt/client/api/client.h b/yt/yt/client/api/client.h index 37823fdab375..8821f0563729 100644 --- a/yt/yt/client/api/client.h +++ b/yt/yt/client/api/client.h @@ -6,6 +6,7 @@ #include "chaos_client.h" #include "cypress_client.h" #include "distributed_table_client.h" +#include "distributed_file_client.h" #include "etc_client.h" #include "file_client.h" #include "flow_client.h" @@ -42,6 +43,7 @@ struct IClientBase , public IQueueClientBase , public IEtcClientBase , public IDistributedTableClientBase + , public IDistributedFileClientBase { virtual IConnectionPtr GetConnection() = 0; }; @@ -78,6 +80,7 @@ struct IClient , public NBundleControllerClient::IBundleControllerClient , public IFlowClient , public IDistributedTableClient + , public IDistributedFileClient , public IShuffleClient { //! Terminates all channels. diff --git a/yt/yt/client/api/delegating_client.h b/yt/yt/client/api/delegating_client.h index 7073d6ede7b7..3a792a2071f9 100644 --- a/yt/yt/client/api/delegating_client.h +++ b/yt/yt/client/api/delegating_client.h @@ -923,6 +923,27 @@ class TDelegatingClient const TTableFragmentWriterOptions& options), (cookie, options)) + // Distributed file client + DELEGATE_METHOD(TFuture, StartDistributedWriteFileSession, ( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options), + (path, options)) + + DELEGATE_METHOD(TFuture, PingDistributedWriteFileSession, ( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options), + (session, options)) + + DELEGATE_METHOD(TFuture, FinishDistributedWriteFileSession, ( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options), + (sessionWithResults, options)) + + DELEGATE_METHOD(IFileFragmentWriterPtr, CreateFileFragmentWriter, ( + const TSignedWriteFileFragmentCookiePtr& cookie, + const TFileFragmentWriterOptions& options), + (cookie, options)) + // Shuffle Service DELEGATE_METHOD(TFuture, StartShuffle, ( const std::string& account, diff --git a/yt/yt/client/api/delegating_transaction.cpp b/yt/yt/client/api/delegating_transaction.cpp index 88f62c9853d1..06f5e3d68e92 100644 --- a/yt/yt/client/api/delegating_transaction.cpp +++ b/yt/yt/client/api/delegating_transaction.cpp @@ -327,6 +327,21 @@ DELEGATE_METHOD(TFuture, FinishDistributedWriteSession, ( const TDistributedWriteSessionFinishOptions& options), (sessionWithResults, options)) +DELEGATE_METHOD(TFuture, StartDistributedWriteFileSession, ( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options), + (path, options)) + +DELEGATE_METHOD(TFuture, PingDistributedWriteFileSession, ( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options), + (session, options)) + +DELEGATE_METHOD(TFuture, FinishDistributedWriteFileSession, ( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options), + (sessionWithResults, options)) + #undef DELEGATE_METHOD //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/api/delegating_transaction.h b/yt/yt/client/api/delegating_transaction.h index cbebb1af48b3..0c66fa034c09 100644 --- a/yt/yt/client/api/delegating_transaction.h +++ b/yt/yt/client/api/delegating_transaction.h @@ -269,6 +269,19 @@ class TDelegatingTransaction const TDistributedWriteSessionWithResults& sessionWithResults, const TDistributedWriteSessionFinishOptions& options = {}) override; + // Distributed file client + TFuture StartDistributedWriteFileSession( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options = {}) override; + + TFuture PingDistributedWriteFileSession( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options = {}) override; + + TFuture FinishDistributedWriteFileSession( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options = {}) override; + protected: const ITransactionPtr Underlying_; }; @@ -276,4 +289,3 @@ class TDelegatingTransaction //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NApi - diff --git a/yt/yt/client/api/distributed_file_client.cpp b/yt/yt/client/api/distributed_file_client.cpp new file mode 100644 index 000000000000..0aac16c70dca --- /dev/null +++ b/yt/yt/client/api/distributed_file_client.cpp @@ -0,0 +1,19 @@ +#include "distributed_file_client.h" + +#include + +#include + +namespace NYT::NApi { + +/////////////////////////////////////////////////////////////////////////////// + +void TDistributedWriteFileSessionWithCookies::Register(TRegistrar registrar) +{ + registrar.Parameter("session", &TThis::Session); + registrar.Parameter("cookies", &TThis::Cookies); +} + +/////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi diff --git a/yt/yt/client/api/distributed_file_client.h b/yt/yt/client/api/distributed_file_client.h new file mode 100644 index 000000000000..e76cec802684 --- /dev/null +++ b/yt/yt/client/api/distributed_file_client.h @@ -0,0 +1,102 @@ +#include "file_client.h" + +#include + +#include + +namespace NYT::NApi { + +//////////////////////////////////////////////////////////////////////////////// + +// Contains the session host data and a set of signed cookies for individual file fragment writes. +// +// #Session: signed session host data. +// #Cookies: signed session cookies per requested participants. +// Note: not all cookies need to be used. +struct TDistributedWriteFileSessionWithCookies + : public NYTree::TYsonStructLite +{ + TSignedDistributedWriteFileSessionPtr Session; + std::vector Cookies; + + REGISTER_YSON_STRUCT_LITE(TDistributedWriteFileSessionWithCookies) + + static void Register(TRegistrar registrar); +}; + +// TODO(achains): Break this class into two separate parameters +struct TDistributedWriteFileSessionWithResults +{ + TSignedDistributedWriteFileSessionPtr Session; + std::vector Results; +}; + +//////////////////////////////////////////////////////////////////////////////// + +struct TDistributedWriteFileSessionStartOptions + : public TTransactionalOptions + , public TTimeoutOptions +{ + // Number of participants for individual file fragment writes. + int CookieCount = 0; + // Timeout for session. Similar to transaction timeout. + std::optional Timeout; +}; + +struct TDistributedWriteFileSessionPingOptions + : public TTimeoutOptions +{ }; + +struct TDistributedWriteFileSessionFinishOptions + : public TTimeoutOptions +{ }; + +// Options for file fragment writer in distributed write file session. +// Note: MD5 and prerequisite transactions are not yet supported. +struct TFileFragmentWriterOptions + : public TFileWriterOptions +{ }; + +//////////////////////////////////////////////////////////////////////////////// + +struct IDistributedFileClientBase +{ + virtual ~IDistributedFileClientBase() = default; + + virtual TFuture StartDistributedWriteFileSession( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options = {}) = 0; + + virtual TFuture PingDistributedWriteFileSession( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options = {}) = 0; + + // Finish distributed session with merging all write fragment results. + // + // The write happens by merging fragments in the order they appear in #Results. + // + // #Session: signed session host data. + // #Results: signed results of fragment writes. + virtual TFuture FinishDistributedWriteFileSession( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options = {}) = 0; +}; + +//////////////////////////////////////////////////////////////////////////////// + +struct IDistributedFileClient +{ + virtual ~IDistributedFileClient() = default; + + // Creates distributed file fragment writer for given cookie. + // + // Same cookie may be reused for creating multiple fragment writers. + // Every new writer instance writes data to its independant root chunk list. + virtual IFileFragmentWriterPtr CreateFileFragmentWriter( + const TSignedWriteFileFragmentCookiePtr& cookie, + const TFileFragmentWriterOptions& options = {}) = 0; +}; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi diff --git a/yt/yt/client/api/distributed_file_session.cpp b/yt/yt/client/api/distributed_file_session.cpp new file mode 100644 index 000000000000..7fca349e3f7a --- /dev/null +++ b/yt/yt/client/api/distributed_file_session.cpp @@ -0,0 +1,91 @@ +#include "distributed_file_session.h" + +#include + +namespace NYT::NApi { + +using namespace NChunkClient; +using namespace NCypressClient; +using namespace NFileClient; +using namespace NObjectClient; +using namespace NTransactionClient; +using namespace NYPath; +using namespace NYson; +using namespace NYTree; + +//////////////////////////////////////////////////////////////////////////////// + +void TWriteFileFragmentResult::Register(TRegistrar registrar) +{ + registrar.Parameter("session_id", &TThis::SessionId); + registrar.Parameter("cookie_id", &TThis::CookieId); + registrar.Parameter("chunk_list_id", &TThis::ChunkListId); +} + +//////////////////////////////////////////////////////////////////////////////// + +void TWriteFileFragmentCookieData::Register(TRegistrar registrar) +{ + registrar.Parameter("rich_path", &TThis::RichPath); + registrar.Parameter("file_attributes", &TThis::FileAttributes); + + registrar.Parameter("main_transaction_id", &TThis::MainTransactionId); + registrar.Parameter("file_id", &TThis::FileId); + registrar.Parameter("external_cell_tag", &TThis::ExternalCellTag); +} + +void TWriteFileFragmentCookie::Register(TRegistrar registrar) +{ + registrar.Parameter("session_id", &TThis::SessionId); + registrar.Parameter("cookie_id", &TThis::CookieId); + + registrar.Parameter("cookie_data", &TThis::CookieData); +} + +//////////////////////////////////////////////////////////////////////////////// + +TDistributedWriteFileSession::TDistributedWriteFileSession( + TTransactionId mainTransactionId, + TTransactionId uploadTransactionId, + TChunkListId rootChunkListId, + TRichYPath richPath, + TObjectId fileId, + TCellTag externalCellTag, + TTimestamp timestamp, + INodePtr fileAttributes) + : TDistributedWriteFileSession() +{ + RootChunkListId = rootChunkListId; + UploadTransactionId = uploadTransactionId; + Timestamp = timestamp; + + HostData.RichPath = std::move(richPath); + HostData.FileAttributes = std::move(fileAttributes); + HostData.MainTransactionId = mainTransactionId; + HostData.FileId = fileId; + HostData.ExternalCellTag = externalCellTag; +} + +TWriteFileFragmentCookie TDistributedWriteFileSession::CookieFromThis() const +{ + auto cookie = TWriteFileFragmentCookie(); + cookie.SessionId = RootChunkListId; + cookie.CookieId = TGuid::Create(); + + cookie.CookieData = HostData; + + return cookie; +} + +void TDistributedWriteFileSession::Register(TRegistrar registrar) +{ + registrar.Parameter("root_chunk_list_id", &TThis::RootChunkListId); + registrar.Parameter("upload_transaction_id", &TThis::UploadTransactionId); + registrar.Parameter("timestamp", &TThis::Timestamp); + + registrar.Parameter("host_data", &TThis::HostData); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi diff --git a/yt/yt/client/api/distributed_file_session.h b/yt/yt/client/api/distributed_file_session.h new file mode 100644 index 000000000000..ab7d29ba8926 --- /dev/null +++ b/yt/yt/client/api/distributed_file_session.h @@ -0,0 +1,88 @@ +#pragma once + +#include "public.h" + +#include + +#include + +#include + +namespace NYT::NApi { + +//////////////////////////////////////////////////////////////////////////////// + +struct TWriteFileFragmentResult + : public NYTree::TYsonStructLite +{ + TGuid SessionId; + TGuid CookieId; + + NChunkClient::TChunkListId ChunkListId; + + REGISTER_YSON_STRUCT_LITE(TWriteFileFragmentResult) + + static void Register(TRegistrar registrar); +}; + +//////////////////////////////////////////////////////////////////////////////// + +struct TWriteFileFragmentCookieData + : public NYTree::TYsonStructLite +{ + NYPath::TRichYPath RichPath; + NYTree::INodePtr FileAttributes; + + NCypressClient::TTransactionId MainTransactionId; + NObjectClient::TObjectId FileId; + NObjectClient::TCellTag ExternalCellTag; + + REGISTER_YSON_STRUCT_LITE(TWriteFileFragmentCookieData); + + static void Register(TRegistrar registrar); +}; + +struct TWriteFileFragmentCookie + : public NYTree::TYsonStructLite +{ + TGuid SessionId; + TGuid CookieId; + + TWriteFileFragmentCookieData CookieData; + + REGISTER_YSON_STRUCT_LITE(TWriteFileFragmentCookie); + + static void Register(TRegistrar registrar); +}; + +//////////////////////////////////////////////////////////////////////////////// + +struct TDistributedWriteFileSession + : public NYTree::TYsonStructLite +{ + NChunkClient::TChunkListId RootChunkListId; + NCypressClient::TTransactionId UploadTransactionId; + NTransactionClient::TTimestamp Timestamp; + + TWriteFileFragmentCookieData HostData; + + TDistributedWriteFileSession( + NCypressClient::TTransactionId mainTransactionId, + NCypressClient::TTransactionId uploadTransactionId, + NChunkClient::TChunkListId rootChunkListId, + NYPath::TRichYPath richPath, + NObjectClient::TObjectId objectId, + NObjectClient::TCellTag externalCellTag, + NTransactionClient::TTimestamp timestamp, + NYTree::INodePtr fileAttributes); + + TWriteFileFragmentCookie CookieFromThis() const; + + REGISTER_YSON_STRUCT_LITE(TDistributedWriteFileSession); + + static void Register(TRegistrar registrar); +}; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi diff --git a/yt/yt/client/api/file_writer.h b/yt/yt/client/api/file_writer.h index 1e8742fcfec6..7d3ee5be37d5 100644 --- a/yt/yt/client/api/file_writer.h +++ b/yt/yt/client/api/file_writer.h @@ -34,5 +34,15 @@ DEFINE_REFCOUNTED_TYPE(IFileWriter) //////////////////////////////////////////////////////////////////////////////// -} // namespace NYT::NApi +struct IFileFragmentWriter + : public virtual IFileWriter +{ + //! Returns signed write result. Only safe to use after |Close|. + virtual NFileClient::TSignedWriteFileFragmentResultPtr GetWriteFragmentResult() const = 0; +}; + +DEFINE_REFCOUNTED_TYPE(IFileFragmentWriter) +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi diff --git a/yt/yt/client/api/public.h b/yt/yt/client/api/public.h index d347005a68e0..b3caa42f7d76 100644 --- a/yt/yt/client/api/public.h +++ b/yt/yt/client/api/public.h @@ -6,6 +6,8 @@ #include +#include + #include #include @@ -169,6 +171,8 @@ DECLARE_REFCOUNTED_STRUCT(ITableFragmentWriter); DECLARE_REFCOUNTED_STRUCT(IFileReader) DECLARE_REFCOUNTED_STRUCT(IFileWriter) +DECLARE_REFCOUNTED_STRUCT(IFileFragmentWriter) + DECLARE_REFCOUNTED_STRUCT(IJournalReader) DECLARE_REFCOUNTED_STRUCT(IJournalWriter) @@ -269,4 +273,11 @@ struct TWriteFragmentCookie; //////////////////////////////////////////////////////////////////////////////// +using NFileClient::TSignedDistributedWriteFileSessionPtr; +using NFileClient::TSignedWriteFileFragmentCookiePtr; +using NFileClient::TSignedWriteFileFragmentResultPtr; +struct TWriteFileFragmentCookie; + +//////////////////////////////////////////////////////////////////////////////// + } // namespace NYT::NApi diff --git a/yt/yt/client/api/rpc_proxy/api_service_proxy.h b/yt/yt/client/api/rpc_proxy/api_service_proxy.h index aad91be10523..545b5be29c03 100644 --- a/yt/yt/client/api/rpc_proxy/api_service_proxy.h +++ b/yt/yt/client/api/rpc_proxy/api_service_proxy.h @@ -221,6 +221,13 @@ class TApiServiceProxy DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, WriteTableFragment, .SetStreamingEnabled(true)); + // Distributed file client + DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, StartDistributedWriteFileSession); + DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, PingDistributedWriteFileSession); + DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, FinishDistributedWriteFileSession); + DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, WriteFileFragment, + .SetStreamingEnabled(true)); + // Shuffle service DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, StartShuffle); DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, WriteShuffleData, diff --git a/yt/yt/client/api/rpc_proxy/client_base.cpp b/yt/yt/client/api/rpc_proxy/client_base.cpp index 667aeaa8f50c..57652366d605 100644 --- a/yt/yt/client/api/rpc_proxy/client_base.cpp +++ b/yt/yt/client/api/rpc_proxy/client_base.cpp @@ -826,10 +826,10 @@ TFuture TClientBase::StartDistributedWriteS std::vector cookies; cookies.reserve(result->signed_cookies().size()); for (const auto& cookie : result->signed_cookies()) { - cookies.push_back(ConvertTo(TYsonString(cookie))); + cookies.push_back(ConvertTo(TYsonStringBuf(cookie))); } TDistributedWriteSessionWithCookies sessionWithCookies; - sessionWithCookies.Session = ConvertTo(TYsonString(result->signed_session())), + sessionWithCookies.Session = ConvertTo(TYsonStringBuf(result->signed_session())), sessionWithCookies.Cookies = std::move(cookies); return sessionWithCookies; })); @@ -861,6 +861,57 @@ TFuture TClientBase::FinishDistributedWriteSession( //////////////////////////////////////////////////////////////////////////////// +TFuture TClientBase::StartDistributedWriteFileSession( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options) +{ + using TRsp = TIntrusivePtr>; + + auto proxy = CreateApiServiceProxy(); + + auto req = proxy.StartDistributedWriteFileSession(); + FillRequest(req.Get(), path, options); + + return req->Invoke() + .ApplyUnique(BIND([] (TRsp&& result) { + std::vector cookies; + cookies.reserve(result->signed_cookies().size()); + for (const auto& cookie : result->signed_cookies()) { + cookies.push_back(ConvertTo(TYsonStringBuf(cookie))); + } + TDistributedWriteFileSessionWithCookies sessionWithCookies; + sessionWithCookies.Session = ConvertTo(TYsonStringBuf(result->signed_session())), + sessionWithCookies.Cookies = std::move(cookies); + return sessionWithCookies; + })); +} + +TFuture TClientBase::PingDistributedWriteFileSession( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options) +{ + auto proxy = CreateApiServiceProxy(); + + auto req = proxy.PingDistributedWriteFileSession(); + + FillRequest(req.Get(), session, options); + return req->Invoke().AsVoid(); +} + +TFuture TClientBase::FinishDistributedWriteFileSession( + const TDistributedWriteFileSessionWithResults& session, + const TDistributedWriteFileSessionFinishOptions& options) +{ + auto proxy = CreateApiServiceProxy(); + + auto req = proxy.FinishDistributedWriteFileSession(); + + FillRequest(req.Get(), session, options); + return req->Invoke().AsVoid(); +} + +//////////////////////////////////////////////////////////////////////////////// + TFuture TClientBase::LookupRows( const TYPath& path, TNameTablePtr nameTable, diff --git a/yt/yt/client/api/rpc_proxy/client_base.h b/yt/yt/client/api/rpc_proxy/client_base.h index 31f753837498..9b455079e5c8 100644 --- a/yt/yt/client/api/rpc_proxy/client_base.h +++ b/yt/yt/client/api/rpc_proxy/client_base.h @@ -196,6 +196,19 @@ class TClientBase TFuture FinishDistributedWriteSession( const TDistributedWriteSessionWithResults& sessionWithResults, const TDistributedWriteSessionFinishOptions& options) override; + + // Distributed file client + TFuture StartDistributedWriteFileSession( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options) override; + + TFuture PingDistributedWriteFileSession( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options) override; + + TFuture FinishDistributedWriteFileSession( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options) override; }; DEFINE_REFCOUNTED_TYPE(TClientBase) diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp index 914fb112fb37..87b503f1678e 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp @@ -2,6 +2,7 @@ #include "config.h" #include "chaos_lease.h" +#include "file_writer.h" #include "helpers.h" #include "private.h" #include "row_batch_reader.h" @@ -31,6 +32,7 @@ #include #include +#include #include @@ -861,6 +863,21 @@ TFuture TClient::CreateTableFragmentWriter( })); } +IFileFragmentWriterPtr TClient::CreateFileFragmentWriter( + const TSignedWriteFileFragmentCookiePtr& cookie, + const TFileFragmentWriterOptions& options) +{ + YT_VERIFY(cookie); + + auto proxy = CreateApiServiceProxy(); + auto req = proxy.WriteFileFragment(); + InitStreamingRequest(*req); + + FillRequest(req.Get(), cookie, options); + + return NRpcProxy::CreateFileFragmentWriter(std::move(req)); +} + TFuture TClient::PullQueue( const TRichYPath& queuePath, i64 offset, diff --git a/yt/yt/client/api/rpc_proxy/client_impl.h b/yt/yt/client/api/rpc_proxy/client_impl.h index fd79f9c2d09b..e66e1f6a292c 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.h +++ b/yt/yt/client/api/rpc_proxy/client_impl.h @@ -151,6 +151,11 @@ class TClient const TSignedWriteFragmentCookiePtr& cookie, const TTableFragmentWriterOptions& options) override; + // Distributed file client + IFileFragmentWriterPtr CreateFileFragmentWriter( + const TSignedWriteFileFragmentCookiePtr& cookie, + const TFileFragmentWriterOptions& options) override; + // Queues. TFuture PullQueue( const NYPath::TRichYPath& queuePath, diff --git a/yt/yt/client/api/rpc_proxy/file_reader.cpp b/yt/yt/client/api/rpc_proxy/file_reader.cpp index c3e928f4fd26..7bc4e1c45fc4 100644 --- a/yt/yt/client/api/rpc_proxy/file_reader.cpp +++ b/yt/yt/client/api/rpc_proxy/file_reader.cpp @@ -71,4 +71,3 @@ TFuture CreateFileReader( //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NApi::NRpcProxy - diff --git a/yt/yt/client/api/rpc_proxy/file_writer.cpp b/yt/yt/client/api/rpc_proxy/file_writer.cpp index 33318dff3a11..59f610bd19e5 100644 --- a/yt/yt/client/api/rpc_proxy/file_writer.cpp +++ b/yt/yt/client/api/rpc_proxy/file_writer.cpp @@ -2,6 +2,8 @@ #include +#include + #include namespace NYT::NApi::NRpcProxy { @@ -14,8 +16,7 @@ class TFileWriter : public IFileWriter { public: - TFileWriter( - TApiServiceProxy::TReqWriteFilePtr request) + explicit TFileWriter(TApiServiceProxy::TReqWriteFilePtr request) : Request_(std::move(request)) { YT_VERIFY(Request_); @@ -44,10 +45,7 @@ class TFileWriter return VoidFuture; } - // Returned future might be set instantly, and the user can modify #data right after that. - struct TTag { }; - auto dataCopy = TSharedMutableRef::MakeCopy(data); - return Underlying_->Write(dataCopy); + return Underlying_->Write(data); } TFuture Close() override @@ -90,5 +88,102 @@ IFileWriterPtr CreateFileWriter( //////////////////////////////////////////////////////////////////////////////// -} // namespace NYT::NApi::NRpcProxy +class TFileFragmentWriter + : public IFileFragmentWriter +{ +public: + explicit TFileFragmentWriter(TApiServiceProxy::TReqWriteFileFragmentPtr request) + : Request_(std::move(request)) + { + YT_VERIFY(Request_); + } + + TFuture Open() override + { + using TRspPtr = TIntrusivePtr>; + + ValidateNotClosed(); + + if (!OpenResult_) { + WriteResultPromise_ = NewPromise(); + WriteResultFuture_ = WriteResultPromise_.ToFuture(); + + OpenResult_ = NRpc::CreateRpcClientOutputStream( + /*request*/ Request_, + /*rspHandler*/ BIND([this, this_ = MakeStrong(this)] (TRspPtr&& rsp){ + YT_VERIFY(rsp->has_signed_write_result()); + WriteResultPromise_.Set(ConvertTo(NYson::TYsonString(rsp->signed_write_result()))); + })) + .Apply(BIND([this, this_ = MakeStrong(this)] (const IAsyncZeroCopyOutputStreamPtr& outputStream) { + Underlying_ = outputStream; + })).As(); + } + + return OpenResult_; + } + + TFuture Write(const TSharedRef& data) override + { + ValidateOpened(); + ValidateNotClosed(); + + if (!data) { + return VoidFuture; + } + + return Underlying_->Write(data); + } + + TFuture Close() override + { + ValidateOpened(); + ValidateNotClosed(); + + Closed_ = true; + return AllSucceeded({Underlying_->Close(), WriteResultFuture_.AsVoid()}); + } + + TSignedWriteFileFragmentResultPtr GetWriteFragmentResult() const override + { + if (!WriteResultFuture_.IsSet()) { + THROW_ERROR_EXCEPTION("Can't get unset write fragment result"); + } + return WriteResultFuture_.Get() + .ValueOrThrow(); + } + +private: + const TApiServiceProxy::TReqWriteFileFragmentPtr Request_; + + IAsyncZeroCopyOutputStreamPtr Underlying_; + TFuture OpenResult_; + + TPromise WriteResultPromise_; + TFuture WriteResultFuture_; + + bool Closed_ = false; + + void ValidateOpened() + { + if (!OpenResult_ || !OpenResult_.IsSet()) { + THROW_ERROR_EXCEPTION("Cannot write into an unopened file writer"); + } + OpenResult_.Get().ThrowOnError(); + } + + void ValidateNotClosed() + { + if (Closed_) { + THROW_ERROR_EXCEPTION("File writer is closed"); + } + } +}; +IFileFragmentWriterPtr CreateFileFragmentWriter(TApiServiceProxy::TReqWriteFileFragmentPtr request) +{ + return New(std::move(request)); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi::NRpcProxy diff --git a/yt/yt/client/api/rpc_proxy/file_writer.h b/yt/yt/client/api/rpc_proxy/file_writer.h index 19d9b677393b..6c9b49e59abb 100644 --- a/yt/yt/client/api/rpc_proxy/file_writer.h +++ b/yt/yt/client/api/rpc_proxy/file_writer.h @@ -2,14 +2,20 @@ #include "api_service_proxy.h" +#include + +#include + namespace NYT::NApi::NRpcProxy { //////////////////////////////////////////////////////////////////////////////// -IFileWriterPtr CreateFileWriter( - TApiServiceProxy::TReqWriteFilePtr request); +IFileWriterPtr CreateFileWriter(TApiServiceProxy::TReqWriteFilePtr request); //////////////////////////////////////////////////////////////////////////////// -} // namespace NYT::NApi::NRpcProxy +IFileFragmentWriterPtr CreateFileFragmentWriter(TApiServiceProxy::TReqWriteFileFragmentPtr request); +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi::NRpcProxy diff --git a/yt/yt/client/api/rpc_proxy/helpers.cpp b/yt/yt/client/api/rpc_proxy/helpers.cpp index 688ecab0468d..d8d63f53d6b2 100644 --- a/yt/yt/client/api/rpc_proxy/helpers.cpp +++ b/yt/yt/client/api/rpc_proxy/helpers.cpp @@ -1979,7 +1979,7 @@ void ParseRequest( void FillRequest( TReqPingDistributedWriteSession* req, - const TSignedDistributedWriteSessionPtr session, + const TSignedDistributedWriteSessionPtr& session, const TDistributedWriteSessionPingOptions& /*options*/) { req->set_signed_session(ToProto(ConvertToYsonString(session))); @@ -1991,7 +1991,7 @@ void ParseRequest( const TReqPingDistributedWriteSession& req) { Y_UNUSED(mutableOptions); - *mutableSession = ConvertTo(TYsonString(req.signed_session())); + *mutableSession = ConvertTo(TYsonStringBuf(req.signed_session())); } //////////////////////////////////////////////////////////////////////////////// @@ -2020,10 +2020,10 @@ void ParseRequest( { mutableSessionWithResults->Results.reserve(req.signed_write_results().size()); for (const auto& writeResult : req.signed_write_results()) { - mutableSessionWithResults->Results.push_back(ConvertTo(TYsonString(writeResult))); + mutableSessionWithResults->Results.push_back(ConvertTo(TYsonStringBuf(writeResult))); } - mutableSessionWithResults->Session = ConvertTo(TYsonString(req.signed_session())); + mutableSessionWithResults->Session = ConvertTo(TYsonStringBuf(req.signed_session())); } //////////////////////////////////////////////////////////////////////////////// @@ -2045,9 +2045,9 @@ void ParseRequest( TTableFragmentWriterOptions* mutableOptions, const TReqWriteTableFragment& req) { - *mutableCookie = ConvertTo(TYsonString(req.signed_cookie())); + *mutableCookie = ConvertTo(TYsonStringBuf(req.signed_cookie())); if (req.has_config()) { - mutableOptions->Config = ConvertTo(TYsonString(req.config())); + mutableOptions->Config = ConvertTo(TYsonStringBuf(req.config())); } else { mutableOptions->Config = ConvertTo(TYsonString(TStringBuf("{}"))); } @@ -2055,6 +2055,104 @@ void ParseRequest( //////////////////////////////////////////////////////////////////////////////// +void FillRequest( + TReqStartDistributedWriteFileSession* req, + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options) +{ + ToProto(req->mutable_path(), path); + req->set_cookie_count(options.CookieCount); + if (options.Timeout) { + req->set_timeout(options.Timeout->GetValue()); + } + + if (options.TransactionId) { + ToProto(req->mutable_transactional_options(), options); + } +} + +void ParseRequest( + NYPath::TRichYPath* mutablePath, + TDistributedWriteFileSessionStartOptions* mutableOptions, + const TReqStartDistributedWriteFileSession& req) +{ + *mutablePath = FromProto(req.path()); + mutableOptions->CookieCount = req.cookie_count(); + if (req.has_timeout()) { + mutableOptions->Timeout = TDuration::FromValue(req.timeout()); + } + if (req.has_transactional_options()) { + FromProto(mutableOptions, req.transactional_options()); + } +} + +//////////////////////////////////////////////////////////////////////////////// + +void FillRequest( + TReqPingDistributedWriteFileSession* req, + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& /*options*/) +{ + req->set_signed_session(ToProto(ConvertToYsonString(session))); +} + +void ParseRequest( + TSignedDistributedWriteFileSessionPtr* mutableSession, + TDistributedWriteFileSessionPingOptions* /*mutableOptions*/, + const TReqPingDistributedWriteFileSession& req) +{ + *mutableSession = ConvertTo(TYsonStringBuf(req.signed_session())); +} + +//////////////////////////////////////////////////////////////////////////////// + +void FillRequest( + TReqFinishDistributedWriteFileSession* req, + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& /*options*/) +{ + YT_VERIFY(sessionWithResults.Session); + + req->set_signed_session(ToProto(ConvertToYsonString(sessionWithResults.Session))); + for (const auto& writeResult : sessionWithResults.Results) { + YT_VERIFY(writeResult); + req->add_signed_write_results(ConvertToYsonString(writeResult).ToString()); + } +} + +void ParseRequest( + TDistributedWriteFileSessionWithResults* mutableSessionWithResults, + TDistributedWriteFileSessionFinishOptions* /*mutableOptions*/, + const TReqFinishDistributedWriteFileSession& req) +{ + mutableSessionWithResults->Results.reserve(req.signed_write_results().size()); + for (const auto& writeResult : req.signed_write_results()) { + mutableSessionWithResults->Results.push_back(ConvertTo(TYsonStringBuf(writeResult))); + } + + mutableSessionWithResults->Session = ConvertTo(TYsonStringBuf(req.signed_session())); +} + +//////////////////////////////////////////////////////////////////////////////// + +void FillRequest( + TReqWriteFileFragment* req, + const TSignedWriteFileFragmentCookiePtr& cookie, + const TFileFragmentWriterOptions& /*options*/) +{ + req->set_signed_cookie(ToProto(ConvertToYsonString(cookie))); +} + +void ParseRequest( + TSignedWriteFileFragmentCookiePtr* mutableCookie, + TFileFragmentWriterOptions* /*mutableOptions*/, + const TReqWriteFileFragment& req) +{ + *mutableCookie = ConvertTo(TYsonStringBuf(req.signed_cookie())); +} + +//////////////////////////////////////////////////////////////////////////////// + } // namespace NProto //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/api/rpc_proxy/helpers.h b/yt/yt/client/api/rpc_proxy/helpers.h index ec434a762e35..a40c54f2d7c6 100644 --- a/yt/yt/client/api/rpc_proxy/helpers.h +++ b/yt/yt/client/api/rpc_proxy/helpers.h @@ -22,6 +22,8 @@ namespace NYT::NApi::NRpcProxy { namespace NProto { +//////////////////////////////////////////////////////////////////////////////// + void ToProto( NProto::TTransactionalOptions* proto, const NApi::TTransactionalOptions& options); @@ -330,7 +332,7 @@ void ParseRequest( void FillRequest( TReqPingDistributedWriteSession* req, - const TSignedDistributedWriteSessionPtr session, + const TSignedDistributedWriteSessionPtr& session, const TDistributedWriteSessionPingOptions& options); void ParseRequest( @@ -362,6 +364,56 @@ void ParseRequest( TTableFragmentWriterOptions* mutableOptions, const TReqWriteTableFragment& req); +//////////////////////////////////////////////////////////////////////////////// + +void FillRequest( + TReqStartDistributedWriteFileSession* req, + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options); + +void ParseRequest( + NYPath::TRichYPath* mutablePath, + TDistributedWriteFileSessionStartOptions* mutableOptions, + const TReqStartDistributedWriteFileSession& req); + +//////////////////////////////////////////////////////////////////////////////// + +void FillRequest( + TReqPingDistributedWriteFileSession* req, + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options); + +void ParseRequest( + TSignedDistributedWriteFileSessionPtr* mutableSession, + TDistributedWriteFileSessionPingOptions* mutableOptions, + const TReqPingDistributedWriteFileSession& req); + +//////////////////////////////////////////////////////////////////////////////// + +void FillRequest( + TReqFinishDistributedWriteFileSession* req, + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options); + +void ParseRequest( + TDistributedWriteFileSessionWithResults* mutableSessionWithResults, + TDistributedWriteFileSessionFinishOptions* mutableOptions, + const TReqFinishDistributedWriteFileSession& req); + +//////////////////////////////////////////////////////////////////////////////// + +void FillRequest( + TReqWriteFileFragment* req, + const TSignedWriteFileFragmentCookiePtr& cookie, + const TFileFragmentWriterOptions& options); + +void ParseRequest( + TSignedWriteFileFragmentCookiePtr* mutableCookie, + TFileFragmentWriterOptions* mutableOptions, + const TReqWriteFileFragment& req); + +//////////////////////////////////////////////////////////////////////////////// + } // namespace NProto //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/api/rpc_proxy/transaction_impl.cpp b/yt/yt/client/api/rpc_proxy/transaction_impl.cpp index eb1c7870fa41..48c6dd7a745e 100644 --- a/yt/yt/client/api/rpc_proxy/transaction_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/transaction_impl.cpp @@ -968,6 +968,36 @@ TFuture TTransaction::FinishDistributedWriteSession( options); } +TFuture TTransaction::StartDistributedWriteFileSession( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options) +{ + ValidateActive(); + return Client_->StartDistributedWriteFileSession( + path, + PatchTransactionId(options)); +} + +TFuture TTransaction::PingDistributedWriteFileSession( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options) +{ + ValidateActive(); + return Client_->PingDistributedWriteFileSession( + session, + options); +} + +TFuture TTransaction::FinishDistributedWriteFileSession( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options) +{ + ValidateActive(); + return Client_->FinishDistributedWriteFileSession( + sessionWithResults, + options); +} + TFuture TTransaction::DoAbort( TGuard* guard, const TTransactionAbortOptions& /*options*/) diff --git a/yt/yt/client/api/rpc_proxy/transaction_impl.h b/yt/yt/client/api/rpc_proxy/transaction_impl.h index 0086c27af4df..fe0de53b2c7d 100644 --- a/yt/yt/client/api/rpc_proxy/transaction_impl.h +++ b/yt/yt/client/api/rpc_proxy/transaction_impl.h @@ -250,6 +250,18 @@ class TTransaction const TDistributedWriteSessionWithResults& sessionWithResults, const TDistributedWriteSessionFinishOptions& options = {}) override; + TFuture StartDistributedWriteFileSession( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options = {}) override; + + TFuture PingDistributedWriteFileSession( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options = {}) override; + + TFuture FinishDistributedWriteFileSession( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options = {}) override; + // Custom methods. //! Returns proxy address this transaction is sticking to. diff --git a/yt/yt/client/driver/distributed_file_commands.cpp b/yt/yt/client/driver/distributed_file_commands.cpp new file mode 100644 index 000000000000..b5623b93aa52 --- /dev/null +++ b/yt/yt/client/driver/distributed_file_commands.cpp @@ -0,0 +1,173 @@ +#include "distributed_file_commands.h" +#include "helpers.h" + +#include +#include + +#include +#include + +#include + +#include + +namespace NYT::NDriver { + +using namespace NApi; +using namespace NConcurrency; +using namespace NFileClient; +using namespace NTracing; +using namespace NYTree; +using namespace NYson; +using namespace NYPath; + +//////////////////////////////////////////////////////////////////////////////// + +void TStartDistributedWriteFileSessionCommand::Register(TRegistrar registrar) +{ + registrar.Parameter("path", &TThis::Path); + registrar.ParameterWithUniversalAccessor( + "cookie_count", + [] (TThis* command) -> auto& { + return command->Options.CookieCount; + }) + .Default(); +} + +void TStartDistributedWriteFileSessionCommand::DoExecute(ICommandContextPtr context) +{ + auto transaction = AttachTransaction(context, /*required*/ false); + + auto sessionAndCookies = WaitFor(context->GetClient()->StartDistributedWriteFileSession(Path, Options)) + .ValueOrThrow(); + + ProduceOutput(context, [sessionAndCookies = std::move(sessionAndCookies)] (IYsonConsumer* consumer) { + Serialize(sessionAndCookies, consumer); + }); +} + +//////////////////////////////////////////////////////////////////////////////// + +void TPingDistributedWriteFileSessionCommand::Register(TRegistrar registrar) +{ + registrar.Parameter("session", &TThis::Session); +} + +void TPingDistributedWriteFileSessionCommand::DoExecute(ICommandContextPtr context) +{ + auto session = ConvertTo(Session); + WaitFor(context->GetClient()->PingDistributedWriteFileSession(session, Options)) + .ThrowOnError(); +} + +//////////////////////////////////////////////////////////////////////////////// + +void TFinishDistributedWriteFileSessionCommand::Register(TRegistrar registrar) +{ + registrar.Parameter("session", &TThis::Session); + registrar.Parameter("results", &TThis::Results); +} + +void TFinishDistributedWriteFileSessionCommand::DoExecute(ICommandContextPtr context) +{ + auto session = ConvertTo(Session); + auto results = ConvertTo>(Results); + + auto validator = context->GetDriver()->GetSignatureValidator(); + std::vector> validationFutures; + validationFutures.reserve(1 + results.size()); + validationFutures.emplace_back(validator->Validate(session.Underlying())); + for (const auto& result : results) { + validationFutures.emplace_back(validator->Validate(result.Underlying())); + } + + auto validationResults = WaitFor(AllSucceeded(std::move(validationFutures))) + .ValueOrThrow(); + bool allValid = std::all_of(validationResults.begin(), validationResults.end(), [] (bool value) { + return value; + }); + THROW_ERROR_EXCEPTION_UNLESS( + allValid, + "Signature validation failed for distributed write session finish"); + + TDistributedWriteFileSessionWithResults sessionWithResults(std::move(session), std::move(results)); + + WaitFor(context->GetClient()->FinishDistributedWriteFileSession(sessionWithResults, Options)) + .ThrowOnError(); +} + +//////////////////////////////////////////////////////////////////////////////// + +void TWriteFileFragmentCommand::Register(TRegistrar registrar) +{ + registrar.Parameter("cookie", &TThis::Cookie); +} + +IFileFragmentWriterPtr TWriteFileFragmentCommand::CreateFileWriter( + const ICommandContextPtr& context) +{ + PutMethodInfoInTraceContext("write_file_fragment"); + + auto signedCookie = ConvertTo(Cookie); + auto validationSuccessful = WaitFor(context->GetDriver()->GetSignatureValidator()->Validate(signedCookie.Underlying())) + .ValueOrThrow(); + + if (!validationSuccessful) { + auto concreteCookie = ConvertTo(TYsonStringBuf(signedCookie.Underlying()->Payload())); + + THROW_ERROR_EXCEPTION( + "Signature validation failed for write file fragment") + << TErrorAttribute("session_id", concreteCookie.SessionId) + << TErrorAttribute("cookie_id", concreteCookie.CookieId); + } + + return context + ->GetClient() + ->CreateFileFragmentWriter( + signedCookie, + TTypedCommand::Options); +} + +void TWriteFileFragmentCommand::DoExecute(ICommandContextPtr context) +{ + auto cookie = ConvertTo(Cookie); + + PutMethodInfoInTraceContext("write_distributed_file"); + + auto fileWriter = CreateFileWriter(context); + + WaitFor(fileWriter->Open()) + .ThrowOnError(); + + // NB(pavook): we shouldn't ping transaction here, as this method is executed in parallel + // and pinging the transaction could cause substantial master load. + + auto input = context->Request().InputStream; + + while (true) { + auto data = WaitFor(input->Read()) + .ValueOrThrow(); + + if (!data) { + break; + } + + WaitFor(fileWriter->Write(std::move(data))) + .ThrowOnError(); + } + + WaitFor(fileWriter->Close()) + .ThrowOnError(); + + auto signedWriteResult = fileWriter->GetWriteFragmentResult(); + + ProduceOutput(context, [result = std::move(signedWriteResult)] (IYsonConsumer* consumer) { + Serialize( + *result.Underlying(), + consumer); + }); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NDriver diff --git a/yt/yt/client/driver/distributed_file_commands.h b/yt/yt/client/driver/distributed_file_commands.h new file mode 100644 index 000000000000..79f95b4d4fa7 --- /dev/null +++ b/yt/yt/client/driver/distributed_file_commands.h @@ -0,0 +1,78 @@ +#pragma once + +#include "file_commands.h" + +#include + +namespace NYT::NDriver { + +//////////////////////////////////////////////////////////////////////////////// + +class TStartDistributedWriteFileSessionCommand + : public TTypedCommand +{ +public: + REGISTER_YSON_STRUCT_LITE(TStartDistributedWriteFileSessionCommand); + + static void Register(TRegistrar registrar); + +private: + NYPath::TRichYPath Path; + + void DoExecute(ICommandContextPtr context) override; +}; + +//////////////////////////////////////////////////////////////////////////////// + +class TPingDistributedWriteFileSessionCommand + : public TTypedCommand +{ +public: + REGISTER_YSON_STRUCT_LITE(TPingDistributedWriteFileSessionCommand); + + static void Register(TRegistrar registrar); + +private: + NYTree::INodePtr Session; + + void DoExecute(ICommandContextPtr context) override; +}; + +//////////////////////////////////////////////////////////////////////////////// + +class TFinishDistributedWriteFileSessionCommand + : public TTypedCommand +{ +public: + REGISTER_YSON_STRUCT_LITE(TFinishDistributedWriteFileSessionCommand); + + static void Register(TRegistrar registrar); + +private: + NYTree::INodePtr Session; + std::vector Results; + + void DoExecute(ICommandContextPtr context) override; +}; + +//////////////////////////////////////////////////////////////////////////////// + +class TWriteFileFragmentCommand + : public TTypedCommand +{ +public: + REGISTER_YSON_STRUCT_LITE(TWriteFileFragmentCommand); + + static void Register(TRegistrar registrar); + +private: + NYTree::INodePtr Cookie; + + NApi::IFileFragmentWriterPtr CreateFileWriter(const ICommandContextPtr& context); + + void DoExecute(ICommandContextPtr context) override; +}; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NDriver diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp index 233a26f440de..784ca6413d4d 100644 --- a/yt/yt/client/driver/driver.cpp +++ b/yt/yt/client/driver/driver.cpp @@ -8,6 +8,7 @@ #include "config.h" #include "cypress_commands.h" #include "distributed_table_commands.h" +#include "distributed_file_commands.h" #include "etc_commands.h" #include "file_commands.h" #include "flow_commands.h" @@ -413,6 +414,11 @@ class TDriver REGISTER (TFinishDistributedWriteSessionCommand, "finish_distributed_write_session", Null, Null, true, false, ApiVersion4); REGISTER (TWriteTableFragmentCommand, "write_table_fragment", Tabular, Structured, true, true, ApiVersion4); + REGISTER (TStartDistributedWriteFileSessionCommand, "start_distributed_write_file_session",Null,Structured,true, false, ApiVersion4); + REGISTER (TPingDistributedWriteFileSessionCommand, "ping_distributed_write_file_session",Null, Null, true, false, ApiVersion4); + REGISTER (TFinishDistributedWriteFileSessionCommand, "finish_distributed_write_file_session",Null,Null, true, false, ApiVersion4); + REGISTER (TWriteFileFragmentCommand, "write_file_fragment", Binary, Structured, true, true, ApiVersion4); + if (Config_->EnableInternalCommands) { REGISTER_ALL(TReadHunksCommand, "read_hunks", Null, Structured, false, true ); REGISTER_ALL(TWriteHunksCommand, "write_hunks", Null, Structured, true, true ); diff --git a/yt/yt/client/driver/ya.make b/yt/yt/client/driver/ya.make index 0e6ee7b1fa30..10ba05059bc0 100644 --- a/yt/yt/client/driver/ya.make +++ b/yt/yt/client/driver/ya.make @@ -11,6 +11,7 @@ SRCS( config.cpp cypress_commands.cpp distributed_table_commands.cpp + distributed_file_commands.cpp driver.cpp etc_commands.cpp file_commands.cpp diff --git a/yt/yt/client/federated/client.cpp b/yt/yt/client/federated/client.cpp index dd72ee0d270a..6f9fcb216d50 100644 --- a/yt/yt/client/federated/client.cpp +++ b/yt/yt/client/federated/client.cpp @@ -239,6 +239,9 @@ class TTransaction UNIMPLEMENTED_METHOD(TFuture, StartDistributedWriteSession, (const NYPath::TRichYPath&, const TDistributedWriteSessionStartOptions&)); UNIMPLEMENTED_METHOD(TFuture, PingDistributedWriteSession, (const TSignedDistributedWriteSessionPtr, const TDistributedWriteSessionPingOptions&)); UNIMPLEMENTED_METHOD(TFuture, FinishDistributedWriteSession, (const TDistributedWriteSessionWithResults&, const TDistributedWriteSessionFinishOptions&)); + UNIMPLEMENTED_METHOD(TFuture, StartDistributedWriteFileSession, (const NYPath::TRichYPath&, const TDistributedWriteFileSessionStartOptions&)); + UNIMPLEMENTED_METHOD(TFuture, PingDistributedWriteFileSession, (const NFileClient::TSignedDistributedWriteFileSessionPtr&, const TDistributedWriteFileSessionPingOptions&)); + UNIMPLEMENTED_METHOD(TFuture, FinishDistributedWriteFileSession, (const TDistributedWriteFileSessionWithResults&, const TDistributedWriteFileSessionFinishOptions&)); UNIMPLEMENTED_METHOD(TFuture, Abort, (const TPrerequisiteAbortOptions&)); private: @@ -509,6 +512,10 @@ class TClient UNIMPLEMENTED_METHOD(TFuture, PingDistributedWriteSession, (const TSignedDistributedWriteSessionPtr, const TDistributedWriteSessionPingOptions&)); UNIMPLEMENTED_METHOD(TFuture, FinishDistributedWriteSession, (const TDistributedWriteSessionWithResults&, const TDistributedWriteSessionFinishOptions&)); UNIMPLEMENTED_METHOD(TFuture, CreateTableFragmentWriter, (const TSignedWriteFragmentCookiePtr&, const TTableFragmentWriterOptions&)); + UNIMPLEMENTED_METHOD(TFuture, StartDistributedWriteFileSession, (const NYPath::TRichYPath&, const TDistributedWriteFileSessionStartOptions&)); + UNIMPLEMENTED_METHOD(TFuture, PingDistributedWriteFileSession, (const NFileClient::TSignedDistributedWriteFileSessionPtr&, const TDistributedWriteFileSessionPingOptions&)); + UNIMPLEMENTED_METHOD(TFuture, FinishDistributedWriteFileSession, (const TDistributedWriteFileSessionWithResults&, const TDistributedWriteFileSessionFinishOptions&)); + UNIMPLEMENTED_METHOD(IFileFragmentWriterPtr, CreateFileFragmentWriter, (const NFileClient::TSignedWriteFileFragmentCookiePtr&, const TFileFragmentWriterOptions&)); UNIMPLEMENTED_METHOD(TFuture, StartShuffle, (const std::string& , int, NObjectClient::TTransactionId, const TStartShuffleOptions&)); UNIMPLEMENTED_METHOD(TFuture, CreateShuffleReader, (const TSignedShuffleHandlePtr&, int, std::optional, const TShuffleReaderOptions&)); UNIMPLEMENTED_METHOD(TFuture, CreateShuffleWriter, (const TSignedShuffleHandlePtr&, const std::string&, std::optional, const TShuffleWriterOptions&)); diff --git a/yt/yt/client/file_client/public.h b/yt/yt/client/file_client/public.h index f3b0c5d37123..cb2a17cccb07 100644 --- a/yt/yt/client/file_client/public.h +++ b/yt/yt/client/file_client/public.h @@ -1,5 +1,7 @@ #pragma once +#include + #include namespace NYT::NFileClient { @@ -10,4 +12,10 @@ DECLARE_REFCOUNTED_STRUCT(TFileChunkWriterConfig) //////////////////////////////////////////////////////////////////////////////// +YT_DEFINE_STRONG_TYPEDEF(TSignedDistributedWriteFileSessionPtr, NSignature::TSignaturePtr); +YT_DEFINE_STRONG_TYPEDEF(TSignedWriteFileFragmentCookiePtr, NSignature::TSignaturePtr); +YT_DEFINE_STRONG_TYPEDEF(TSignedWriteFileFragmentResultPtr, NSignature::TSignaturePtr); + +//////////////////////////////////////////////////////////////////////////////// + } // namespace NYT::NFileClient diff --git a/yt/yt/client/hedging/hedging.cpp b/yt/yt/client/hedging/hedging.cpp index b9be050c83ff..c744947ecc6e 100644 --- a/yt/yt/client/hedging/hedging.cpp +++ b/yt/yt/client/hedging/hedging.cpp @@ -118,6 +118,10 @@ class THedgingClient UNSUPPORTED_METHOD(TFuture, PingDistributedWriteSession, (const TSignedDistributedWriteSessionPtr, const TDistributedWriteSessionPingOptions&)); UNSUPPORTED_METHOD(TFuture, FinishDistributedWriteSession, (const TDistributedWriteSessionWithResults&, const TDistributedWriteSessionFinishOptions&)); UNSUPPORTED_METHOD(TFuture, CreateTableFragmentWriter, (const TSignedWriteFragmentCookiePtr&, const TTableFragmentWriterOptions&)); + UNSUPPORTED_METHOD(TFuture, StartDistributedWriteFileSession, (const NYPath::TRichYPath&, const TDistributedWriteFileSessionStartOptions&)); + UNSUPPORTED_METHOD(TFuture, PingDistributedWriteFileSession, (const NFileClient::TSignedDistributedWriteFileSessionPtr&, const TDistributedWriteFileSessionPingOptions&)); + UNSUPPORTED_METHOD(TFuture, FinishDistributedWriteFileSession, (const TDistributedWriteFileSessionWithResults&, const TDistributedWriteFileSessionFinishOptions&)); + UNSUPPORTED_METHOD(IFileFragmentWriterPtr, CreateFileFragmentWriter, (const NFileClient::TSignedWriteFileFragmentCookiePtr&, const TFileFragmentWriterOptions&)); // IClient methods. // Unsupported methods. diff --git a/yt/yt/client/unittests/mock/client.h b/yt/yt/client/unittests/mock/client.h index 40884dfc1012..b8ce8c1843fb 100644 --- a/yt/yt/client/unittests/mock/client.h +++ b/yt/yt/client/unittests/mock/client.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -899,11 +900,31 @@ class TMockClient const TDistributedWriteSessionFinishOptions& options), (override)); + MOCK_METHOD(TFuture, StartDistributedWriteFileSession, ( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options), + (override)); + + MOCK_METHOD(TFuture, PingDistributedWriteFileSession, ( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options), + (override)); + + MOCK_METHOD(TFuture, FinishDistributedWriteFileSession, ( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options), + (override)); + MOCK_METHOD(TFuture, CreateTableFragmentWriter, ( const TSignedWriteFragmentCookiePtr& cookie, const TTableFragmentWriterOptions& options), (override)); + MOCK_METHOD(IFileFragmentWriterPtr, CreateFileFragmentWriter, ( + const TSignedWriteFileFragmentCookiePtr& cookie, + const TFileFragmentWriterOptions& options), + (override)); + MOCK_METHOD(TFuture, StartShuffle, ( const std::string& account, int partitionCount, diff --git a/yt/yt/client/unittests/mock/transaction.h b/yt/yt/client/unittests/mock/transaction.h index c3ec389306da..f2d9861a5d94 100644 --- a/yt/yt/client/unittests/mock/transaction.h +++ b/yt/yt/client/unittests/mock/transaction.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include #include @@ -166,6 +167,21 @@ class TMockTransaction const TDistributedWriteSessionFinishOptions& options), (override)); + MOCK_METHOD(TFuture, StartDistributedWriteFileSession, ( + const NYPath::TRichYPath& path, + const TDistributedWriteFileSessionStartOptions& options), + (override)); + + MOCK_METHOD(TFuture, PingDistributedWriteFileSession, ( + const TSignedDistributedWriteFileSessionPtr& session, + const TDistributedWriteFileSessionPingOptions& options), + (override)); + + MOCK_METHOD(TFuture, FinishDistributedWriteFileSession, ( + const TDistributedWriteFileSessionWithResults& sessionWithResults, + const TDistributedWriteFileSessionFinishOptions& options), + (override)); + // ITransaction IClientPtr Client; NTransactionClient::ETransactionType Type; diff --git a/yt/yt/client/ya.make b/yt/yt/client/ya.make index 3cbd5dc813d9..6b9a11d0a55a 100644 --- a/yt/yt/client/ya.make +++ b/yt/yt/client/ya.make @@ -16,6 +16,8 @@ SRCS( api/delegating_transaction.cpp api/distributed_table_session.cpp api/distributed_table_client.cpp + api/distributed_file_session.cpp + api/distributed_file_client.cpp api/etc_client.cpp api/journal_client.cpp api/operation_client.cpp diff --git a/yt/yt/core/rpc/stream-inl.h b/yt/yt/core/rpc/stream-inl.h index 8f7ddd274be8..247508fb2aa8 100644 --- a/yt/yt/core/rpc/stream-inl.h +++ b/yt/yt/core/rpc/stream-inl.h @@ -68,7 +68,19 @@ TFuture CreateRpcClientOutputStream })); } +template +TFuture CreateRpcClientOutputStream( + TIntrusivePtr> request, + TCallback&&)> rspHandler) +{ + auto invokeResult = request->Invoke() + .ApplyUnique(std::move(rspHandler)); + + return NDetail::CreateRpcClientOutputStreamFromInvokedRequest( + std::move(request), + std::move(invokeResult)); +} + //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NRpc - diff --git a/yt/yt/core/rpc/stream.h b/yt/yt/core/rpc/stream.h index b989479f9585..243791239a34 100644 --- a/yt/yt/core/rpc/stream.h +++ b/yt/yt/core/rpc/stream.h @@ -272,15 +272,18 @@ TFuture CreateRpcClientOutputStream TCallback metaHandler); //! This variant additionally allows non-trivial response of streaming request to be handled. -//! TODO(arkady-e1ppa): Introduce IAsyncZeroCopyOutputStream which |Close| returns -//! TFuture instead of TFuture as a way to transfer data via rsp -//! use it here. template TFuture CreateRpcClientOutputStream( TIntrusivePtr> request, TCallback metaHandler, TCallback&&)> rspHandler); +//! This variant additionally allows non-trivial response of streaming request to be handled. +template +TFuture CreateRpcClientOutputStream( + TIntrusivePtr> request, + TCallback&&)> rspHandler); + //////////////////////////////////////////////////////////////////////////////// //! Handles an incoming streaming request that uses the #CreateRpcClientInputStream diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto index 726c703ee479..1fe8ffb765c3 100644 --- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto +++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto @@ -3726,6 +3726,54 @@ message TRspWriteTableFragment required bytes signed_write_result = 1; // YSON-serialized TSignedWriteFragmentResultPtr } +//////////////////////////////////////////////////////////////////////////////// +// Distributed file client +//////////////////////////////////////////////////////////////////////////////// + +message TReqStartDistributedWriteFileSession +{ + required bytes path = 1; // RichYPath + required int32 cookie_count = 2; + optional int64 timeout = 3; + + optional TTransactionalOptions transactional_options = 100; +} + +message TRspStartDistributedWriteFileSession +{ + required bytes signed_session = 1; // YSON-serialized TSignedDistributedWriteFileSessionPtr + repeated bytes signed_cookies = 2; // vector of YSON-serialized TSignedDistributedWriteFileCookiePtr +} + +message TReqPingDistributedWriteFileSession +{ + required bytes signed_session = 1; // YSON-serialized TSignedDistributedWriteFileSessionPtr +} + +message TRspPingDistributedWriteFileSession +{ +} + +message TReqFinishDistributedWriteFileSession +{ + required bytes signed_session = 1; // YSON-serialized TSignedDistributedWriteFileSessionPtr + repeated bytes signed_write_results = 2; // vector of YSON-serialized TSignedWriteFileFragmentResultPtr +} + +message TRspFinishDistributedWriteFileSession +{ +} + +message TReqWriteFileFragment +{ + required bytes signed_cookie = 1; // YSON-serialized TSignedWriteFileFragmentCookiePtr +} + +message TRspWriteFileFragment +{ + required bytes signed_write_result = 1; // YSON-serialized TSignedWriteFileFragmentResultPtr +} + /////////////////////////////////////////////////////////////////////////////// // Shuffle Service //////////////////////////////////////////////////////////////////////////////// From 2e383b764b832fe83a9994c55677504ad934aeb6 Mon Sep 17 00:00:00 2001 From: say Date: Tue, 21 Oct 2025 16:33:35 +0300 Subject: [PATCH 13/55] Revert commit rXXXXXX, Automatic release build for ya_bin, os_test_tool, test_tool, os_ya commit_hash:f3d007d48d11226248228c2bf01bb2e69dc3f556 --- build/mapping.conf.json | 2 -- build/platform/test_tool/host.ya.make.inc | 10 +++++----- build/platform/test_tool/host_os.ya.make.inc | 10 +++++----- ya | 20 ++++++++++---------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/build/mapping.conf.json b/build/mapping.conf.json index b35740f50521..4d9a9158ad6f 100644 --- a/build/mapping.conf.json +++ b/build/mapping.conf.json @@ -461,7 +461,6 @@ "3968796477": "{registry_endpoint}/3968796477", "3968796981": "{registry_endpoint}/3968796981", "3968797636": "{registry_endpoint}/3968797636", - "10050129395": "{registry_endpoint}/10050129395", "5486713852": "{registry_endpoint}/5486713852", "5514352253": "{registry_endpoint}/5514352253", "5523579199": "{registry_endpoint}/5523579199", @@ -2242,7 +2241,6 @@ "3968796477": "devtools/ya/test/programs/flake8/py3/flake8 for linux-aarch64", "3968796981": "devtools/ya/test/programs/flake8/py3/flake8 for linux-ppc64le", "3968797636": "devtools/ya/test/programs/flake8/py3/flake8 for win32", - "10050129395": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5486713852": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5514352253": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5523579199": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", diff --git a/build/platform/test_tool/host.ya.make.inc b/build/platform/test_tool/host.ya.make.inc index 7e100581ff1f..b1ee16c56337 100644 --- a/build/platform/test_tool/host.ya.make.inc +++ b/build/platform/test_tool/host.ya.make.inc @@ -1,12 +1,12 @@ IF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050211675) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985369410) ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_ARM64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050207070) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985365495) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050219731) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985375160) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_AARCH64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050203832) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985362301) ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050216120) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985372335) ENDIF() diff --git a/build/platform/test_tool/host_os.ya.make.inc b/build/platform/test_tool/host_os.ya.make.inc index 6e28a9519b36..6ede13a99b01 100644 --- a/build/platform/test_tool/host_os.ya.make.inc +++ b/build/platform/test_tool/host_os.ya.make.inc @@ -1,12 +1,12 @@ IF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050119334) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985347260) ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_ARM64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050114246) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985344210) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050129395) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985353571) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_AARCH64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050109489) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985341289) ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10050124173) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:9985350661) ENDIF() diff --git a/ya b/ya index 02588e49a1e6..e18b361759d2 100755 --- a/ya +++ b/ya @@ -39,33 +39,33 @@ REGISTRY_ENDPOINT = os.environ.get("YA_REGISTRY_ENDPOINT", "https://devtools-reg PLATFORM_MAP = { "data": { "win32": { - "md5": "722083ed92162b7a8739d96818a73c11", + "md5": "a712addc784890ce75a167142a082fa8", "urls": [ - f"{REGISTRY_ENDPOINT}/10050213201" + f"{REGISTRY_ENDPOINT}/9985394570" ] }, "darwin": { - "md5": "f48c19b8940a7d46a3907fa722584eab", + "md5": "fc35ba4887e39f26d947c326984ebc3e", "urls": [ - f"{REGISTRY_ENDPOINT}/10050208723" + f"{REGISTRY_ENDPOINT}/9985390713" ] }, "darwin-arm64": { - "md5": "8fd3324c7e6e6b7025982294e0f4466d", + "md5": "0d46439fee9ed381dbdad09e2e5cc6a1", "urls": [ - f"{REGISTRY_ENDPOINT}/10050205181" + f"{REGISTRY_ENDPOINT}/9985386916" ] }, "linux-aarch64": { - "md5": "447c23c1035d6942988867178daf29c3", + "md5": "fa8f1231599daa34a0cf75c909a8089e", "urls": [ - f"{REGISTRY_ENDPOINT}/10050201300" + f"{REGISTRY_ENDPOINT}/9985383917" ] }, "linux": { - "md5": "c448c3d3c0e5a06f69c9c97d8af08067", + "md5": "0ce0099a335ef1ee19d6a4c3bac5f045", "urls": [ - f"{REGISTRY_ENDPOINT}/10050217041" + f"{REGISTRY_ENDPOINT}/9985398958" ] } } From b5bad9b2b77fb892ab8d8ceaec0221ab7b401dc2 Mon Sep 17 00:00:00 2001 From: koloshmet Date: Tue, 21 Oct 2025 17:15:40 +0300 Subject: [PATCH 14/55] YT-18571: Fixed range construction from span Fixed range construction from span commit_hash:a7b4b66073a1d5ea79abc304966494b1e9543919 --- library/cpp/yt/memory/range.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/cpp/yt/memory/range.h b/library/cpp/yt/memory/range.h index 84ea2e77586d..deabd6b15bd2 100644 --- a/library/cpp/yt/memory/range.h +++ b/library/cpp/yt/memory/range.h @@ -100,7 +100,7 @@ class TRange { } //! Constructs a TRange from an std::span. - TRange(const std::span& elements) + TRange(std::span elements) : Data_(elements.data()) , Length_(elements.size()) { } From 6d432111902ac604d11ae945c3f9aec37d6dfe1d Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Tue, 21 Oct 2025 19:47:46 +0300 Subject: [PATCH 15/55] Intermediate changes commit_hash:88032d840827567ec2003c784b8d5ea34e27f445 --- .../.yandex_meta/devtools.copyrights.report | 98 - .../.yandex_meta/devtools.licenses.report | 2626 ---- contrib/libs/clang14-rt/CODE_OWNERS.TXT | 53 - contrib/libs/clang14-rt/CREDITS.TXT | 36 - contrib/libs/clang14-rt/LICENSE.TXT | 311 - contrib/libs/clang14-rt/README.txt | 11 - .../include/profile/InstrProfData.inc | 905 -- .../include/profile/MemProfData.inc | 152 - .../include/sanitizer/allocator_interface.h | 88 - .../include/sanitizer/asan_interface.h | 326 - .../include/sanitizer/common_interface_defs.h | 366 - .../include/sanitizer/coverage_interface.h | 35 - .../include/sanitizer/dfsan_interface.h | 187 - .../include/sanitizer/hwasan_interface.h | 99 - .../include/sanitizer/linux_syscall_hooks.h | 3100 ----- .../include/sanitizer/lsan_interface.h | 89 - .../include/sanitizer/memprof_interface.h | 65 - .../include/sanitizer/msan_interface.h | 124 - .../include/sanitizer/netbsd_syscall_hooks.h | 5005 -------- .../include/sanitizer/scudo_interface.h | 38 - .../include/sanitizer/tsan_interface.h | 179 - .../include/sanitizer/tsan_interface_atomic.h | 221 - .../include/sanitizer/ubsan_interface.h | 32 - .../.yandex_meta/licenses.list.txt | 366 - .../libs/clang14-rt/lib/asan-preinit/ya.make | 48 - .../lib/asan/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/asan/README.txt | 26 - .../clang14-rt/lib/asan/asan_activation.cpp | 143 - .../clang14-rt/lib/asan/asan_activation.h | 22 - .../lib/asan/asan_activation_flags.inc | 36 - .../clang14-rt/lib/asan/asan_allocator.cpp | 1232 -- .../libs/clang14-rt/lib/asan/asan_allocator.h | 233 - .../clang14-rt/lib/asan/asan_debugging.cpp | 147 - .../clang14-rt/lib/asan/asan_descriptions.cpp | 507 - .../clang14-rt/lib/asan/asan_descriptions.h | 269 - .../libs/clang14-rt/lib/asan/asan_errors.cpp | 601 - .../libs/clang14-rt/lib/asan/asan_errors.h | 456 - .../clang14-rt/lib/asan/asan_fake_stack.cpp | 312 - .../clang14-rt/lib/asan/asan_fake_stack.h | 175 - .../libs/clang14-rt/lib/asan/asan_flags.cpp | 206 - contrib/libs/clang14-rt/lib/asan/asan_flags.h | 48 - .../libs/clang14-rt/lib/asan/asan_flags.inc | 162 - .../libs/clang14-rt/lib/asan/asan_fuchsia.cpp | 263 - .../libs/clang14-rt/lib/asan/asan_globals.cpp | 463 - .../clang14-rt/lib/asan/asan_globals_win.cpp | 61 - .../clang14-rt/lib/asan/asan_init_version.h | 44 - .../clang14-rt/lib/asan/asan_interceptors.cpp | 711 -- .../clang14-rt/lib/asan/asan_interceptors.h | 163 - .../asan/asan_interceptors_memintrinsics.cpp | 43 - .../asan/asan_interceptors_memintrinsics.h | 154 - .../lib/asan/asan_interceptors_vfork.S | 13 - .../lib/asan/asan_interface_internal.h | 259 - .../libs/clang14-rt/lib/asan/asan_internal.h | 168 - .../libs/clang14-rt/lib/asan/asan_linux.cpp | 237 - contrib/libs/clang14-rt/lib/asan/asan_lock.h | 0 contrib/libs/clang14-rt/lib/asan/asan_mac.cpp | 299 - .../clang14-rt/lib/asan/asan_malloc_linux.cpp | 226 - .../clang14-rt/lib/asan/asan_malloc_mac.cpp | 102 - .../clang14-rt/lib/asan/asan_malloc_win.cpp | 551 - .../libs/clang14-rt/lib/asan/asan_mapping.h | 393 - .../lib/asan/asan_mapping_sparc64.h | 102 - .../lib/asan/asan_memory_profile.cpp | 129 - .../clang14-rt/lib/asan/asan_new_delete.cpp | 196 - .../clang14-rt/lib/asan/asan_poisoning.cpp | 449 - .../libs/clang14-rt/lib/asan/asan_poisoning.h | 98 - .../libs/clang14-rt/lib/asan/asan_posix.cpp | 145 - .../libs/clang14-rt/lib/asan/asan_preinit.cpp | 24 - .../lib/asan/asan_premap_shadow.cpp | 64 - .../clang14-rt/lib/asan/asan_premap_shadow.h | 29 - .../libs/clang14-rt/lib/asan/asan_report.cpp | 571 - .../libs/clang14-rt/lib/asan/asan_report.h | 99 - contrib/libs/clang14-rt/lib/asan/asan_rtl.cpp | 619 - .../clang14-rt/lib/asan/asan_rtl_static.cpp | 15 - .../clang14-rt/lib/asan/asan_rtl_x86_64.S | 146 - .../lib/asan/asan_scariness_score.h | 73 - .../clang14-rt/lib/asan/asan_shadow_setup.cpp | 125 - .../libs/clang14-rt/lib/asan/asan_stack.cpp | 89 - contrib/libs/clang14-rt/lib/asan/asan_stack.h | 71 - .../libs/clang14-rt/lib/asan/asan_stats.cpp | 173 - contrib/libs/clang14-rt/lib/asan/asan_stats.h | 71 - .../clang14-rt/lib/asan/asan_suppressions.cpp | 104 - .../clang14-rt/lib/asan/asan_suppressions.h | 29 - .../libs/clang14-rt/lib/asan/asan_thread.cpp | 558 - .../libs/clang14-rt/lib/asan/asan_thread.h | 188 - contrib/libs/clang14-rt/lib/asan/asan_win.cpp | 402 - contrib/libs/clang14-rt/lib/asan/ya.make | 162 - .../asan_cxx/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/asan_cxx/ya.make | 54 - .../.yandex_meta/licenses.list.txt | 366 - .../libs/clang14-rt/lib/asan_static/ya.make | 49 - .../libs/clang14-rt/lib/builtins/README.txt | 353 - .../libs/clang14-rt/lib/builtins/assembly.h | 292 - .../lib/cfi/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/cfi/cfi.cpp | 476 - contrib/libs/clang14-rt/lib/cfi/ya.make | 99 - .../cfi_diag/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/cfi_diag/ya.make | 129 - .../lib/dd/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/dd/ya.make | 100 - .../lib/dfsan/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/dfsan/dfsan.cpp | 1127 -- contrib/libs/clang14-rt/lib/dfsan/dfsan.h | 106 - .../clang14-rt/lib/dfsan/dfsan_allocator.cpp | 293 - .../clang14-rt/lib/dfsan/dfsan_allocator.h | 30 - .../lib/dfsan/dfsan_chained_origin_depot.cpp | 22 - .../lib/dfsan/dfsan_chained_origin_depot.h | 26 - .../clang14-rt/lib/dfsan/dfsan_custom.cpp | 2529 ---- .../libs/clang14-rt/lib/dfsan/dfsan_flags.h | 32 - .../libs/clang14-rt/lib/dfsan/dfsan_flags.inc | 43 - .../lib/dfsan/dfsan_interceptors.cpp | 220 - .../clang14-rt/lib/dfsan/dfsan_new_delete.cpp | 124 - .../libs/clang14-rt/lib/dfsan/dfsan_origin.h | 127 - .../clang14-rt/lib/dfsan/dfsan_platform.h | 88 - .../clang14-rt/lib/dfsan/dfsan_thread.cpp | 144 - .../libs/clang14-rt/lib/dfsan/dfsan_thread.h | 84 - contrib/libs/clang14-rt/lib/dfsan/ya.make | 125 - .../gwp_asan/.yandex_meta/licenses.list.txt | 366 - .../libs/clang14-rt/lib/gwp_asan/common.cpp | 108 - contrib/libs/clang14-rt/lib/gwp_asan/common.h | 182 - .../clang14-rt/lib/gwp_asan/crash_handler.cpp | 154 - .../clang14-rt/lib/gwp_asan/crash_handler.h | 125 - .../clang14-rt/lib/gwp_asan/definitions.h | 20 - .../lib/gwp_asan/guarded_pool_allocator.cpp | 361 - .../lib/gwp_asan/guarded_pool_allocator.h | 249 - contrib/libs/clang14-rt/lib/gwp_asan/mutex.h | 42 - .../lib/gwp_asan/optional/backtrace.h | 53 - .../optional/backtrace_linux_libc.cpp | 67 - .../lib/gwp_asan/optional/options_parser.cpp | 258 - .../lib/gwp_asan/optional/options_parser.h | 31 - .../clang14-rt/lib/gwp_asan/optional/printf.h | 33 - .../lib/gwp_asan/optional/segv_handler.h | 33 - .../gwp_asan/optional/segv_handler_posix.cpp | 225 - .../libs/clang14-rt/lib/gwp_asan/options.h | 57 - .../libs/clang14-rt/lib/gwp_asan/options.inc | 69 - .../platform_specific/common_posix.cpp | 26 - .../guarded_pool_allocator_fuchsia.h | 22 - .../guarded_pool_allocator_posix.cpp | 111 - .../guarded_pool_allocator_posix.h | 18 - .../guarded_pool_allocator_tls.h | 55 - .../platform_specific/mutex_fuchsia.h | 23 - .../platform_specific/mutex_posix.cpp | 30 - .../gwp_asan/platform_specific/mutex_posix.h | 23 - .../platform_specific/utilities_posix.cpp | 30 - .../lib/gwp_asan/stack_trace_compressor.cpp | 111 - .../lib/gwp_asan/stack_trace_compressor.h | 38 - .../libs/clang14-rt/lib/gwp_asan/utilities.h | 28 - contrib/libs/clang14-rt/lib/gwp_asan/ya.make | 54 - .../lib/hwasan/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/hwasan/hwasan.cpp | 599 - contrib/libs/clang14-rt/lib/hwasan/hwasan.h | 227 - .../hwasan/hwasan_allocation_functions.cpp | 175 - .../lib/hwasan/hwasan_allocator.cpp | 484 - .../clang14-rt/lib/hwasan/hwasan_allocator.h | 125 - .../clang14-rt/lib/hwasan/hwasan_checks.h | 127 - .../lib/hwasan/hwasan_dynamic_shadow.cpp | 143 - .../lib/hwasan/hwasan_dynamic_shadow.h | 27 - .../lib/hwasan/hwasan_exceptions.cpp | 67 - .../libs/clang14-rt/lib/hwasan/hwasan_flags.h | 31 - .../clang14-rt/lib/hwasan/hwasan_flags.inc | 83 - .../clang14-rt/lib/hwasan/hwasan_fuchsia.cpp | 215 - .../clang14-rt/lib/hwasan/hwasan_globals.cpp | 91 - .../clang14-rt/lib/hwasan/hwasan_globals.h | 49 - .../lib/hwasan/hwasan_interceptors.cpp | 205 - .../lib/hwasan/hwasan_interceptors_vfork.S | 14 - .../lib/hwasan/hwasan_interface_internal.h | 182 - .../clang14-rt/lib/hwasan/hwasan_linux.cpp | 447 - .../lib/hwasan/hwasan_malloc_bisect.h | 50 - .../clang14-rt/lib/hwasan/hwasan_mapping.h | 75 - .../lib/hwasan/hwasan_memintrinsics.cpp | 44 - .../lib/hwasan/hwasan_new_delete.cpp | 135 - .../lib/hwasan/hwasan_poisoning.cpp | 28 - .../clang14-rt/lib/hwasan/hwasan_poisoning.h | 24 - .../clang14-rt/lib/hwasan/hwasan_report.cpp | 781 -- .../clang14-rt/lib/hwasan/hwasan_report.h | 35 - .../lib/hwasan/hwasan_setjmp_aarch64.S | 101 - .../lib/hwasan/hwasan_setjmp_x86_64.S | 82 - .../lib/hwasan/hwasan_tag_mismatch_aarch64.S | 158 - .../clang14-rt/lib/hwasan/hwasan_thread.cpp | 150 - .../clang14-rt/lib/hwasan/hwasan_thread.h | 113 - .../lib/hwasan/hwasan_thread_list.cpp | 15 - .../lib/hwasan/hwasan_thread_list.h | 205 - .../lib/hwasan/hwasan_type_test.cpp | 25 - contrib/libs/clang14-rt/lib/hwasan/ya.make | 148 - .../.yandex_meta/licenses.list.txt | 366 - .../clang14-rt/lib/hwasan_aliases/ya.make | 149 - .../.yandex_meta/licenses.list.txt | 366 - .../clang14-rt/lib/hwasan_aliases_cxx/ya.make | 56 - .../hwasan_cxx/.yandex_meta/licenses.list.txt | 366 - .../libs/clang14-rt/lib/hwasan_cxx/ya.make | 56 - .../lib/interception/interception.h | 295 - .../lib/interception/interception_linux.cpp | 83 - .../lib/interception/interception_linux.h | 53 - .../lib/interception/interception_mac.cpp | 18 - .../lib/interception/interception_mac.h | 27 - .../interception/interception_type_test.cpp | 39 - .../lib/interception/interception_win.cpp | 1071 -- .../lib/interception/interception_win.h | 83 - .../lib/lsan/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/lsan/lsan.cpp | 116 - contrib/libs/clang14-rt/lib/lsan/lsan.h | 55 - .../clang14-rt/lib/lsan/lsan_allocator.cpp | 379 - .../libs/clang14-rt/lib/lsan/lsan_allocator.h | 121 - .../libs/clang14-rt/lib/lsan/lsan_common.cpp | 1044 -- .../libs/clang14-rt/lib/lsan/lsan_common.h | 316 - .../lib/lsan/lsan_common_fuchsia.cpp | 161 - .../clang14-rt/lib/lsan/lsan_common_linux.cpp | 147 - .../clang14-rt/lib/lsan/lsan_common_mac.cpp | 204 - .../libs/clang14-rt/lib/lsan/lsan_flags.inc | 46 - .../libs/clang14-rt/lib/lsan/lsan_fuchsia.cpp | 122 - .../libs/clang14-rt/lib/lsan/lsan_fuchsia.h | 35 - .../clang14-rt/lib/lsan/lsan_interceptors.cpp | 542 - .../libs/clang14-rt/lib/lsan/lsan_linux.cpp | 32 - contrib/libs/clang14-rt/lib/lsan/lsan_mac.cpp | 191 - .../clang14-rt/lib/lsan/lsan_malloc_mac.cpp | 59 - .../libs/clang14-rt/lib/lsan/lsan_posix.cpp | 96 - contrib/libs/clang14-rt/lib/lsan/lsan_posix.h | 49 - .../libs/clang14-rt/lib/lsan/lsan_preinit.cpp | 21 - .../libs/clang14-rt/lib/lsan/lsan_thread.cpp | 90 - .../libs/clang14-rt/lib/lsan/lsan_thread.h | 58 - contrib/libs/clang14-rt/lib/lsan/ya.make | 134 - .../.yandex_meta/licenses.list.txt | 366 - .../clang14-rt/lib/memprof-preinit/ya.make | 48 - .../memprof/.yandex_meta/licenses.list.txt | 366 - .../libs/clang14-rt/lib/memprof/README.txt | 17 - .../lib/memprof/memprof_allocator.cpp | 725 -- .../lib/memprof/memprof_allocator.h | 103 - .../lib/memprof/memprof_descriptions.cpp | 70 - .../lib/memprof/memprof_descriptions.h | 45 - .../clang14-rt/lib/memprof/memprof_flags.cpp | 93 - .../clang14-rt/lib/memprof/memprof_flags.h | 45 - .../clang14-rt/lib/memprof/memprof_flags.inc | 41 - .../lib/memprof/memprof_init_version.h | 26 - .../lib/memprof/memprof_interceptors.cpp | 364 - .../lib/memprof/memprof_interceptors.h | 60 - .../memprof_interceptors_memintrinsics.cpp | 29 - .../memprof_interceptors_memintrinsics.h | 79 - .../lib/memprof/memprof_interface_internal.h | 64 - .../clang14-rt/lib/memprof/memprof_internal.h | 104 - .../clang14-rt/lib/memprof/memprof_linux.cpp | 80 - .../lib/memprof/memprof_malloc_linux.cpp | 151 - .../clang14-rt/lib/memprof/memprof_mapping.h | 113 - .../clang14-rt/lib/memprof/memprof_mibmap.cpp | 37 - .../clang14-rt/lib/memprof/memprof_mibmap.h | 27 - .../lib/memprof/memprof_new_delete.cpp | 145 - .../clang14-rt/lib/memprof/memprof_posix.cpp | 55 - .../lib/memprof/memprof_preinit.cpp | 23 - .../lib/memprof/memprof_rawprofile.cpp | 246 - .../lib/memprof/memprof_rawprofile.h | 14 - .../clang14-rt/lib/memprof/memprof_rtl.cpp | 299 - .../lib/memprof/memprof_shadow_setup.cpp | 62 - .../clang14-rt/lib/memprof/memprof_stack.cpp | 59 - .../clang14-rt/lib/memprof/memprof_stack.h | 66 - .../clang14-rt/lib/memprof/memprof_stats.cpp | 157 - .../clang14-rt/lib/memprof/memprof_stats.h | 61 - .../clang14-rt/lib/memprof/memprof_thread.cpp | 219 - .../clang14-rt/lib/memprof/memprof_thread.h | 135 - contrib/libs/clang14-rt/lib/memprof/ya.make | 137 - .../.yandex_meta/licenses.list.txt | 366 - .../libs/clang14-rt/lib/memprof_cxx/ya.make | 48 - .../lib/msan/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/msan/msan.cpp | 736 -- contrib/libs/clang14-rt/lib/msan/msan.h | 402 - .../clang14-rt/lib/msan/msan_allocator.cpp | 375 - .../libs/clang14-rt/lib/msan/msan_allocator.h | 31 - .../lib/msan/msan_chained_origin_depot.cpp | 42 - .../lib/msan/msan_chained_origin_depot.h | 38 - contrib/libs/clang14-rt/lib/msan/msan_flags.h | 29 - .../libs/clang14-rt/lib/msan/msan_flags.inc | 34 - .../clang14-rt/lib/msan/msan_interceptors.cpp | 1745 --- .../lib/msan/msan_interface_internal.h | 198 - .../libs/clang14-rt/lib/msan/msan_linux.cpp | 261 - .../clang14-rt/lib/msan/msan_new_delete.cpp | 108 - .../libs/clang14-rt/lib/msan/msan_origin.h | 168 - .../clang14-rt/lib/msan/msan_poisoning.cpp | 253 - .../libs/clang14-rt/lib/msan/msan_poisoning.h | 58 - .../libs/clang14-rt/lib/msan/msan_report.cpp | 277 - .../libs/clang14-rt/lib/msan/msan_report.h | 33 - .../libs/clang14-rt/lib/msan/msan_thread.cpp | 122 - .../libs/clang14-rt/lib/msan/msan_thread.h | 81 - contrib/libs/clang14-rt/lib/msan/ya.make | 137 - .../msan_cxx/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/msan_cxx/ya.make | 56 - .../profile/.yandex_meta/licenses.list.txt | 366 - .../clang14-rt/lib/profile/GCDAProfiling.c | 642 - .../clang14-rt/lib/profile/InstrProfiling.c | 76 - .../clang14-rt/lib/profile/InstrProfiling.h | 329 - .../lib/profile/InstrProfilingBuffer.c | 167 - .../lib/profile/InstrProfilingFile.c | 1194 -- .../lib/profile/InstrProfilingInternal.c | 26 - .../lib/profile/InstrProfilingInternal.h | 201 - .../lib/profile/InstrProfilingMerge.c | 185 - .../lib/profile/InstrProfilingMergeFile.c | 45 - .../lib/profile/InstrProfilingNameVar.c | 17 - .../profile/InstrProfilingPlatformDarwin.c | 75 - .../profile/InstrProfilingPlatformFuchsia.c | 190 - .../lib/profile/InstrProfilingPlatformLinux.c | 230 - .../lib/profile/InstrProfilingPlatformOther.c | 109 - .../profile/InstrProfilingPlatformWindows.c | 73 - .../lib/profile/InstrProfilingPort.h | 152 - .../lib/profile/InstrProfilingRuntime.cpp | 28 - .../lib/profile/InstrProfilingUtil.c | 375 - .../lib/profile/InstrProfilingUtil.h | 87 - .../lib/profile/InstrProfilingValue.c | 358 - .../lib/profile/InstrProfilingVersionVar.c | 26 - .../lib/profile/InstrProfilingWriter.c | 339 - .../libs/clang14-rt/lib/profile/WindowsMMap.h | 76 - contrib/libs/clang14-rt/lib/profile/ya.make | 61 - .../safestack/.yandex_meta/licenses.list.txt | 366 - .../clang14-rt/lib/safestack/safestack.cpp | 310 - .../lib/safestack/safestack_platform.h | 124 - .../clang14-rt/lib/safestack/safestack_util.h | 49 - contrib/libs/clang14-rt/lib/safestack/ya.make | 52 - .../lib/sanitizer_common/sancov_flags.cpp | 58 - .../lib/sanitizer_common/sancov_flags.h | 39 - .../lib/sanitizer_common/sancov_flags.inc | 20 - .../sanitizer_common/sanitizer_addrhashmap.h | 393 - .../sanitizer_common/sanitizer_allocator.cpp | 209 - .../sanitizer_common/sanitizer_allocator.h | 78 - .../sanitizer_allocator_checks.cpp | 22 - .../sanitizer_allocator_checks.h | 76 - .../sanitizer_allocator_combined.h | 199 - .../sanitizer_allocator_dlsym.h | 79 - .../sanitizer_allocator_interface.h | 47 - .../sanitizer_allocator_internal.h | 57 - .../sanitizer_allocator_local_cache.h | 271 - .../sanitizer_allocator_primary32.h | 381 - .../sanitizer_allocator_primary64.h | 898 -- .../sanitizer_allocator_report.cpp | 145 - .../sanitizer_allocator_report.h | 40 - .../sanitizer_allocator_secondary.h | 322 - .../sanitizer_allocator_size_class_map.h | 241 - .../sanitizer_allocator_stats.h | 106 - .../lib/sanitizer_common/sanitizer_asm.h | 75 - .../lib/sanitizer_common/sanitizer_atomic.h | 86 - .../sanitizer_common/sanitizer_atomic_clang.h | 104 - .../sanitizer_atomic_clang_mips.h | 117 - .../sanitizer_atomic_clang_other.h | 85 - .../sanitizer_atomic_clang_x86.h | 113 - .../sanitizer_common/sanitizer_atomic_msvc.h | 256 - .../sanitizer_common/sanitizer_bitvector.h | 350 - .../lib/sanitizer_common/sanitizer_bvgraph.h | 164 - .../sanitizer_chained_origin_depot.cpp | 146 - .../sanitizer_chained_origin_depot.h | 45 - .../lib/sanitizer_common/sanitizer_common.cpp | 371 - .../lib/sanitizer_common/sanitizer_common.h | 1078 -- .../sanitizer_common_interceptors.inc | 10534 ---------------- .../sanitizer_common_interceptors_format.inc | 568 - .../sanitizer_common_interceptors_ioctl.inc | 604 - ...izer_common_interceptors_netbsd_compat.inc | 128 - ...er_common_interceptors_vfork_aarch64.inc.S | 48 - ...itizer_common_interceptors_vfork_arm.inc.S | 49 - ...tizer_common_interceptors_vfork_i386.inc.S | 64 - ...er_common_interceptors_vfork_riscv64.inc.S | 56 - ...zer_common_interceptors_vfork_x86_64.inc.S | 42 - .../sanitizer_common_interface.inc | 42 - .../sanitizer_common_interface_posix.inc | 15 - .../sanitizer_common_libcdep.cpp | 221 - .../sanitizer_common_syscalls.inc | 3175 ----- .../sanitizer_coverage_fuchsia.cpp | 253 - .../sanitizer_coverage_interface.inc | 33 - .../sanitizer_coverage_libcdep_new.cpp | 276 - .../sanitizer_coverage_win_sections.cpp | 67 - .../lib/sanitizer_common/sanitizer_dbghelp.h | 41 - .../sanitizer_deadlock_detector.h | 410 - .../sanitizer_deadlock_detector1.cpp | 194 - .../sanitizer_deadlock_detector2.cpp | 421 - .../sanitizer_deadlock_detector_interface.h | 98 - .../sanitizer_common/sanitizer_dense_map.h | 705 -- .../sanitizer_dense_map_info.h | 282 - .../lib/sanitizer_common/sanitizer_errno.cpp | 34 - .../lib/sanitizer_common/sanitizer_errno.h | 38 - .../sanitizer_common/sanitizer_errno_codes.h | 34 - .../lib/sanitizer_common/sanitizer_file.cpp | 246 - .../lib/sanitizer_common/sanitizer_file.h | 109 - .../sanitizer_flag_parser.cpp | 191 - .../sanitizer_common/sanitizer_flag_parser.h | 204 - .../lib/sanitizer_common/sanitizer_flags.cpp | 139 - .../lib/sanitizer_common/sanitizer_flags.h | 71 - .../lib/sanitizer_common/sanitizer_flags.inc | 268 - .../lib/sanitizer_common/sanitizer_flat_map.h | 173 - .../lib/sanitizer_common/sanitizer_freebsd.h | 137 - .../sanitizer_common/sanitizer_fuchsia.cpp | 520 - .../lib/sanitizer_common/sanitizer_fuchsia.h | 38 - .../sanitizer_common/sanitizer_getauxval.h | 60 - .../sanitizer_glibc_version.h | 26 - .../lib/sanitizer_common/sanitizer_hash.h | 67 - .../sanitizer_interceptors_ioctl_netbsd.inc | 1535 --- .../sanitizer_interface_internal.h | 123 - .../sanitizer_internal_defs.h | 480 - .../lib/sanitizer_common/sanitizer_leb128.h | 87 - .../lib/sanitizer_common/sanitizer_lfstack.h | 72 - .../lib/sanitizer_common/sanitizer_libc.cpp | 292 - .../lib/sanitizer_common/sanitizer_libc.h | 89 - .../sanitizer_common/sanitizer_libignore.cpp | 129 - .../sanitizer_common/sanitizer_libignore.h | 115 - .../lib/sanitizer_common/sanitizer_linux.cpp | 2291 ---- .../lib/sanitizer_common/sanitizer_linux.h | 175 - .../sanitizer_linux_libcdep.cpp | 1037 -- .../sanitizer_common/sanitizer_linux_s390.cpp | 228 - .../lib/sanitizer_common/sanitizer_list.h | 166 - .../sanitizer_local_address_space_view.h | 76 - .../lib/sanitizer_common/sanitizer_lzw.h | 159 - .../lib/sanitizer_common/sanitizer_mac.cpp | 1425 --- .../lib/sanitizer_common/sanitizer_mac.h | 68 - .../sanitizer_mac_libcdep.cpp | 29 - .../sanitizer_common/sanitizer_malloc_mac.inc | 414 - .../lib/sanitizer_common/sanitizer_mutex.cpp | 225 - .../lib/sanitizer_common/sanitizer_mutex.h | 432 - .../lib/sanitizer_common/sanitizer_netbsd.cpp | 351 - .../sanitizer_placement_new.h | 24 - .../lib/sanitizer_common/sanitizer_platform.h | 419 - .../sanitizer_platform_interceptors.h | 614 - .../sanitizer_platform_limits_freebsd.cpp | 557 - .../sanitizer_platform_limits_freebsd.h | 698 - .../sanitizer_platform_limits_linux.cpp | 108 - .../sanitizer_platform_limits_netbsd.cpp | 2740 ---- .../sanitizer_platform_limits_netbsd.h | 2421 ---- .../sanitizer_platform_limits_openbsd.h | 0 .../sanitizer_platform_limits_posix.cpp | 1308 -- .../sanitizer_platform_limits_posix.h | 1459 --- .../sanitizer_platform_limits_solaris.cpp | 368 - .../sanitizer_platform_limits_solaris.h | 496 - .../lib/sanitizer_common/sanitizer_posix.cpp | 400 - .../lib/sanitizer_common/sanitizer_posix.h | 128 - .../sanitizer_posix_libcdep.cpp | 503 - .../lib/sanitizer_common/sanitizer_printf.cpp | 361 - .../lib/sanitizer_common/sanitizer_procmaps.h | 110 - .../sanitizer_procmaps_bsd.cpp | 112 - .../sanitizer_procmaps_common.cpp | 190 - .../sanitizer_procmaps_fuchsia.cpp | 80 - .../sanitizer_procmaps_linux.cpp | 81 - .../sanitizer_procmaps_mac.cpp | 379 - .../sanitizer_procmaps_solaris.cpp | 76 - .../lib/sanitizer_common/sanitizer_ptrauth.h | 41 - .../sanitizer_common/sanitizer_quarantine.h | 318 - .../sanitizer_report_decorator.h | 48 - .../sanitizer_common/sanitizer_ring_buffer.h | 161 - .../sanitizer_signal_interceptors.inc | 97 - .../sanitizer_common/sanitizer_solaris.cpp | 230 - .../sanitizer_stack_store.cpp | 379 - .../sanitizer_common/sanitizer_stack_store.h | 121 - .../sanitizer_common/sanitizer_stackdepot.cpp | 245 - .../sanitizer_common/sanitizer_stackdepot.h | 51 - .../sanitizer_stackdepotbase.h | 194 - .../sanitizer_common/sanitizer_stacktrace.cpp | 168 - .../sanitizer_common/sanitizer_stacktrace.h | 221 - .../sanitizer_stacktrace_libcdep.cpp | 225 - .../sanitizer_stacktrace_printer.cpp | 310 - .../sanitizer_stacktrace_printer.h | 73 - .../sanitizer_stacktrace_sparc.cpp | 85 - .../sanitizer_common/sanitizer_stoptheworld.h | 65 - .../sanitizer_stoptheworld_fuchsia.cpp | 43 - .../sanitizer_stoptheworld_fuchsia.h | 20 - .../sanitizer_stoptheworld_linux_libcdep.cpp | 623 - .../sanitizer_stoptheworld_mac.cpp | 180 - .../sanitizer_stoptheworld_netbsd_libcdep.cpp | 362 - .../sanitizer_stoptheworld_win.cpp | 175 - .../sanitizer_suppressions.cpp | 181 - .../sanitizer_common/sanitizer_suppressions.h | 56 - .../sanitizer_common/sanitizer_symbolizer.cpp | 141 - .../sanitizer_common/sanitizer_symbolizer.h | 224 - .../sanitizer_symbolizer_fuchsia.h | 42 - .../sanitizer_symbolizer_internal.h | 165 - .../sanitizer_symbolizer_libbacktrace.cpp | 209 - .../sanitizer_symbolizer_libbacktrace.h | 49 - .../sanitizer_symbolizer_libcdep.cpp | 557 - .../sanitizer_symbolizer_mac.cpp | 205 - .../sanitizer_symbolizer_mac.h | 47 - .../sanitizer_symbolizer_markup.cpp | 150 - .../sanitizer_symbolizer_posix_libcdep.cpp | 511 - .../sanitizer_symbolizer_report.cpp | 298 - .../sanitizer_symbolizer_win.cpp | 326 - .../sanitizer_syscall_generic.inc | 38 - .../sanitizer_syscall_linux_aarch64.inc | 137 - .../sanitizer_syscall_linux_arm.inc | 137 - .../sanitizer_syscall_linux_hexagon.inc | 131 - .../sanitizer_syscall_linux_riscv64.inc | 174 - .../sanitizer_syscall_linux_x86_64.inc | 90 - .../sanitizer_syscalls_netbsd.inc | 3944 ------ .../sanitizer_termination.cpp | 99 - .../sanitizer_thread_registry.cpp | 384 - .../sanitizer_thread_registry.h | 168 - .../sanitizer_thread_safety.h | 49 - .../sanitizer_tls_get_addr.cpp | 178 - .../sanitizer_common/sanitizer_tls_get_addr.h | 79 - .../sanitizer_type_traits.cpp | 20 - .../sanitizer_common/sanitizer_type_traits.h | 141 - .../sanitizer_unwind_linux_libcdep.cpp | 180 - .../sanitizer_common/sanitizer_unwind_win.cpp | 93 - .../lib/sanitizer_common/sanitizer_vector.h | 124 - .../lib/sanitizer_common/sanitizer_win.cpp | 1174 -- .../lib/sanitizer_common/sanitizer_win.h | 25 - .../lib/sanitizer_common/sanitizer_win_defs.h | 174 - .../sanitizer_win_dll_thunk.h | 181 - .../sanitizer_win_weak_interception.h | 32 - .../lib/scudo/.yandex_meta/licenses.list.txt | 377 - .../clang14-rt/lib/scudo/scudo_allocator.cpp | 831 -- .../clang14-rt/lib/scudo/scudo_allocator.h | 125 - .../lib/scudo/scudo_allocator_combined.h | 75 - .../lib/scudo/scudo_allocator_secondary.h | 192 - .../libs/clang14-rt/lib/scudo/scudo_crc32.cpp | 24 - .../libs/clang14-rt/lib/scudo/scudo_crc32.h | 104 - .../clang14-rt/lib/scudo/scudo_errors.cpp | 77 - .../libs/clang14-rt/lib/scudo/scudo_errors.h | 34 - .../libs/clang14-rt/lib/scudo/scudo_flags.cpp | 136 - .../libs/clang14-rt/lib/scudo/scudo_flags.h | 32 - .../libs/clang14-rt/lib/scudo/scudo_flags.inc | 48 - .../lib/scudo/scudo_interface_internal.h | 32 - .../clang14-rt/lib/scudo/scudo_malloc.cpp | 84 - .../clang14-rt/lib/scudo/scudo_new_delete.cpp | 107 - .../clang14-rt/lib/scudo/scudo_platform.h | 93 - .../lib/scudo/scudo_termination.cpp | 41 - contrib/libs/clang14-rt/lib/scudo/scudo_tsd.h | 65 - .../lib/scudo/scudo_tsd_exclusive.cpp | 67 - .../lib/scudo/scudo_tsd_exclusive.inc | 47 - .../clang14-rt/lib/scudo/scudo_tsd_shared.cpp | 107 - .../clang14-rt/lib/scudo/scudo_tsd_shared.inc | 56 - .../libs/clang14-rt/lib/scudo/scudo_utils.cpp | 145 - .../libs/clang14-rt/lib/scudo/scudo_utils.h | 36 - .../lib/scudo/standalone/allocator_config.h | 204 - .../lib/scudo/standalone/atomic_helpers.h | 145 - .../clang14-rt/lib/scudo/standalone/bytemap.h | 43 - .../lib/scudo/standalone/checksum.cpp | 82 - .../lib/scudo/standalone/checksum.h | 58 - .../clang14-rt/lib/scudo/standalone/chunk.h | 155 - .../lib/scudo/standalone/combined.h | 1440 --- .../lib/scudo/standalone/common.cpp | 38 - .../clang14-rt/lib/scudo/standalone/common.h | 211 - .../lib/scudo/standalone/crc32_hw.cpp | 19 - .../clang14-rt/lib/scudo/standalone/flags.cpp | 73 - .../clang14-rt/lib/scudo/standalone/flags.h | 38 - .../clang14-rt/lib/scudo/standalone/flags.inc | 47 - .../lib/scudo/standalone/flags_parser.cpp | 164 - .../lib/scudo/standalone/flags_parser.h | 55 - .../lib/scudo/standalone/fuchsia.cpp | 202 - .../clang14-rt/lib/scudo/standalone/fuchsia.h | 31 - .../standalone/include/scudo/interface.h | 160 - .../lib/scudo/standalone/internal_defs.h | 166 - .../clang14-rt/lib/scudo/standalone/linux.cpp | 218 - .../clang14-rt/lib/scudo/standalone/linux.h | 25 - .../clang14-rt/lib/scudo/standalone/list.h | 228 - .../lib/scudo/standalone/local_cache.h | 198 - .../clang14-rt/lib/scudo/standalone/memtag.h | 331 - .../clang14-rt/lib/scudo/standalone/mutex.h | 72 - .../clang14-rt/lib/scudo/standalone/options.h | 74 - .../lib/scudo/standalone/platform.h | 80 - .../lib/scudo/standalone/primary32.h | 507 - .../lib/scudo/standalone/primary64.h | 489 - .../lib/scudo/standalone/quarantine.h | 297 - .../lib/scudo/standalone/release.cpp | 16 - .../clang14-rt/lib/scudo/standalone/release.h | 333 - .../lib/scudo/standalone/report.cpp | 192 - .../clang14-rt/lib/scudo/standalone/report.h | 57 - .../lib/scudo/standalone/secondary.h | 614 - .../lib/scudo/standalone/size_class_map.h | 374 - .../lib/scudo/standalone/stack_depot.h | 144 - .../clang14-rt/lib/scudo/standalone/stats.h | 101 - .../lib/scudo/standalone/string_utils.cpp | 255 - .../lib/scudo/standalone/string_utils.h | 42 - .../clang14-rt/lib/scudo/standalone/trusty.h | 24 - .../clang14-rt/lib/scudo/standalone/tsd.h | 66 - .../lib/scudo/standalone/tsd_exclusive.h | 152 - .../lib/scudo/standalone/tsd_shared.h | 216 - .../clang14-rt/lib/scudo/standalone/vector.h | 117 - .../lib/scudo/standalone/wrappers_c.cpp | 39 - .../lib/scudo/standalone/wrappers_c.h | 57 - .../lib/scudo/standalone/wrappers_c.inc | 288 - .../lib/scudo/standalone/wrappers_c_checks.h | 69 - .../lib/scudo/standalone/wrappers_cpp.cpp | 108 - contrib/libs/clang14-rt/lib/scudo/ya.make | 149 - .../scudo_cxx/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/scudo_cxx/ya.make | 57 - .../.yandex_meta/licenses.list.txt | 366 - .../clang14-rt/lib/scudo_cxx_minimal/ya.make | 51 - .../.yandex_meta/licenses.list.txt | 366 - .../libs/clang14-rt/lib/scudo_minimal/ya.make | 120 - .../.yandex_meta/licenses.list.txt | 366 - .../clang14-rt/lib/scudo_standalone/ya.make | 72 - .../.yandex_meta/licenses.list.txt | 366 - .../lib/scudo_standalone_cxx/ya.make | 46 - .../lib/stats/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/stats/stats.cpp | 136 - contrib/libs/clang14-rt/lib/stats/stats.h | 42 - .../clang14-rt/lib/stats/stats_client.cpp | 83 - contrib/libs/clang14-rt/lib/stats/ya.make | 113 - .../.yandex_meta/licenses.list.txt | 366 - .../libs/clang14-rt/lib/stats_client/ya.make | 47 - .../lib/tsan/.yandex_meta/licenses.list.txt | 366 - .../lib/tsan/dd/dd_interceptors.cpp | 330 - .../libs/clang14-rt/lib/tsan/dd/dd_rtl.cpp | 158 - contrib/libs/clang14-rt/lib/tsan/dd/dd_rtl.h | 66 - .../lib/tsan/rtl/tsan_debugging.cpp | 262 - .../libs/clang14-rt/lib/tsan/rtl/tsan_defs.h | 216 - .../lib/tsan/rtl/tsan_dense_alloc.h | 165 - .../clang14-rt/lib/tsan/rtl/tsan_external.cpp | 126 - .../libs/clang14-rt/lib/tsan/rtl/tsan_fd.cpp | 321 - .../libs/clang14-rt/lib/tsan/rtl/tsan_fd.h | 64 - .../clang14-rt/lib/tsan/rtl/tsan_flags.cpp | 120 - .../libs/clang14-rt/lib/tsan/rtl/tsan_flags.h | 34 - .../clang14-rt/lib/tsan/rtl/tsan_flags.inc | 83 - .../lib/tsan/rtl/tsan_ignoreset.cpp | 38 - .../clang14-rt/lib/tsan/rtl/tsan_ignoreset.h | 36 - .../libs/clang14-rt/lib/tsan/rtl/tsan_ilist.h | 189 - .../lib/tsan/rtl/tsan_interceptors.h | 105 - .../rtl/tsan_interceptors_libdispatch.cpp | 814 -- .../lib/tsan/rtl/tsan_interceptors_mac.cpp | 521 - .../tsan/rtl/tsan_interceptors_mach_vm.cpp | 53 - .../lib/tsan/rtl/tsan_interceptors_posix.cpp | 3057 ----- .../lib/tsan/rtl/tsan_interface.cpp | 92 - .../clang14-rt/lib/tsan/rtl/tsan_interface.h | 424 - .../lib/tsan/rtl/tsan_interface.inc | 190 - .../lib/tsan/rtl/tsan_interface_ann.cpp | 438 - .../lib/tsan/rtl/tsan_interface_ann.h | 32 - .../lib/tsan/rtl/tsan_interface_atomic.cpp | 925 -- .../lib/tsan/rtl/tsan_interface_java.cpp | 258 - .../lib/tsan/rtl/tsan_interface_java.h | 99 - .../lib/tsan/rtl/tsan_malloc_mac.cpp | 71 - .../libs/clang14-rt/lib/tsan/rtl/tsan_md5.cpp | 250 - .../clang14-rt/lib/tsan/rtl/tsan_mman.cpp | 456 - .../libs/clang14-rt/lib/tsan/rtl/tsan_mman.h | 80 - .../clang14-rt/lib/tsan/rtl/tsan_mutexset.cpp | 80 - .../clang14-rt/lib/tsan/rtl/tsan_mutexset.h | 91 - .../lib/tsan/rtl/tsan_new_delete.cpp | 199 - .../clang14-rt/lib/tsan/rtl/tsan_platform.h | 881 -- .../lib/tsan/rtl/tsan_platform_linux.cpp | 533 - .../lib/tsan/rtl/tsan_platform_mac.cpp | 319 - .../lib/tsan/rtl/tsan_platform_posix.cpp | 143 - .../lib/tsan/rtl/tsan_platform_windows.cpp | 33 - .../clang14-rt/lib/tsan/rtl/tsan_preinit.cpp | 26 - .../clang14-rt/lib/tsan/rtl/tsan_report.cpp | 473 - .../clang14-rt/lib/tsan/rtl/tsan_report.h | 126 - .../libs/clang14-rt/lib/tsan/rtl/tsan_rtl.cpp | 1066 -- .../libs/clang14-rt/lib/tsan/rtl/tsan_rtl.h | 763 -- .../lib/tsan/rtl/tsan_rtl_aarch64.S | 245 - .../lib/tsan/rtl/tsan_rtl_access.cpp | 753 -- .../clang14-rt/lib/tsan/rtl/tsan_rtl_amd64.S | 210 - .../clang14-rt/lib/tsan/rtl/tsan_rtl_mips64.S | 214 - .../lib/tsan/rtl/tsan_rtl_mutex.cpp | 577 - .../clang14-rt/lib/tsan/rtl/tsan_rtl_ppc64.S | 288 - .../clang14-rt/lib/tsan/rtl/tsan_rtl_proc.cpp | 59 - .../lib/tsan/rtl/tsan_rtl_report.cpp | 869 -- .../clang14-rt/lib/tsan/rtl/tsan_rtl_s390x.S | 49 - .../lib/tsan/rtl/tsan_rtl_thread.cpp | 368 - .../clang14-rt/lib/tsan/rtl/tsan_shadow.h | 180 - .../lib/tsan/rtl/tsan_stack_trace.cpp | 57 - .../lib/tsan/rtl/tsan_stack_trace.h | 42 - .../lib/tsan/rtl/tsan_suppressions.cpp | 161 - .../lib/tsan/rtl/tsan_suppressions.h | 37 - .../lib/tsan/rtl/tsan_symbolize.cpp | 123 - .../clang14-rt/lib/tsan/rtl/tsan_symbolize.h | 30 - .../clang14-rt/lib/tsan/rtl/tsan_sync.cpp | 289 - .../libs/clang14-rt/lib/tsan/rtl/tsan_sync.h | 148 - .../libs/clang14-rt/lib/tsan/rtl/tsan_trace.h | 215 - .../lib/tsan/rtl/tsan_vector_clock.cpp | 126 - .../lib/tsan/rtl/tsan_vector_clock.h | 51 - contrib/libs/clang14-rt/lib/tsan/ya.make | 176 - .../tsan_cxx/.yandex_meta/licenses.list.txt | 366 - contrib/libs/clang14-rt/lib/tsan_cxx/ya.make | 55 - .../clang14-rt/lib/ubsan/ubsan_checks.inc | 71 - .../libs/clang14-rt/lib/ubsan/ubsan_diag.cpp | 447 - .../libs/clang14-rt/lib/ubsan/ubsan_diag.h | 266 - .../lib/ubsan/ubsan_diag_standalone.cpp | 38 - .../libs/clang14-rt/lib/ubsan/ubsan_flags.cpp | 80 - .../libs/clang14-rt/lib/ubsan/ubsan_flags.h | 46 - .../libs/clang14-rt/lib/ubsan/ubsan_flags.inc | 28 - .../clang14-rt/lib/ubsan/ubsan_handlers.cpp | 918 -- .../clang14-rt/lib/ubsan/ubsan_handlers.h | 236 - .../lib/ubsan/ubsan_handlers_cxx.cpp | 205 - .../clang14-rt/lib/ubsan/ubsan_handlers_cxx.h | 54 - .../libs/clang14-rt/lib/ubsan/ubsan_init.cpp | 75 - .../libs/clang14-rt/lib/ubsan/ubsan_init.h | 33 - .../lib/ubsan/ubsan_init_standalone.cpp | 33 - .../ubsan/ubsan_init_standalone_preinit.cpp | 35 - .../clang14-rt/lib/ubsan/ubsan_monitor.cpp | 75 - .../libs/clang14-rt/lib/ubsan/ubsan_monitor.h | 48 - .../clang14-rt/lib/ubsan/ubsan_platform.h | 25 - .../lib/ubsan/ubsan_signals_standalone.cpp | 71 - .../lib/ubsan/ubsan_signals_standalone.h | 24 - .../clang14-rt/lib/ubsan/ubsan_type_hash.cpp | 33 - .../clang14-rt/lib/ubsan/ubsan_type_hash.h | 73 - .../lib/ubsan/ubsan_type_hash_itanium.cpp | 270 - .../lib/ubsan/ubsan_type_hash_win.cpp | 84 - .../libs/clang14-rt/lib/ubsan/ubsan_value.cpp | 160 - .../libs/clang14-rt/lib/ubsan/ubsan_value.h | 199 - .../.yandex_meta/licenses.list.txt | 366 - .../ubsan_minimal/ubsan_minimal_handlers.cpp | 120 - .../libs/clang14-rt/lib/ubsan_minimal/ya.make | 46 - .../.yandex_meta/licenses.list.txt | 366 - .../clang14-rt/lib/ubsan_standalone/ya.make | 131 - .../.yandex_meta/licenses.list.txt | 366 - .../lib/ubsan_standalone_cxx/ya.make | 52 - contrib/libs/clang14-rt/ya.make | 44 - 692 files changed, 178714 deletions(-) delete mode 100644 contrib/libs/clang14-rt/.yandex_meta/devtools.copyrights.report delete mode 100644 contrib/libs/clang14-rt/.yandex_meta/devtools.licenses.report delete mode 100644 contrib/libs/clang14-rt/CODE_OWNERS.TXT delete mode 100644 contrib/libs/clang14-rt/CREDITS.TXT delete mode 100644 contrib/libs/clang14-rt/LICENSE.TXT delete mode 100644 contrib/libs/clang14-rt/README.txt delete mode 100644 contrib/libs/clang14-rt/include/profile/InstrProfData.inc delete mode 100644 contrib/libs/clang14-rt/include/profile/MemProfData.inc delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/allocator_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/asan_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/common_interface_defs.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/coverage_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/dfsan_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/hwasan_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/linux_syscall_hooks.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/lsan_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/memprof_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/msan_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/netbsd_syscall_hooks.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/scudo_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/tsan_interface.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/tsan_interface_atomic.h delete mode 100644 contrib/libs/clang14-rt/include/sanitizer/ubsan_interface.h delete mode 100644 contrib/libs/clang14-rt/lib/asan-preinit/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/asan-preinit/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/asan/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/asan/README.txt delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_activation.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_activation.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_activation_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_debugging.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_descriptions.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_descriptions.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_errors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_errors.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_fake_stack.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_fake_stack.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_flags.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_globals.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_globals_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_init_version.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_interceptors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_interceptors.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_interceptors_memintrinsics.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_interceptors_memintrinsics.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_interceptors_vfork.S delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_interface_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_lock.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_malloc_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_malloc_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_mapping.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_mapping_sparc64.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_memory_profile.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_new_delete.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_poisoning.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_poisoning.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_preinit.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_premap_shadow.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_premap_shadow.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_report.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_report.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_rtl.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_rtl_static.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_rtl_x86_64.S delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_scariness_score.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_shadow_setup.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_stack.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_stack.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_stats.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_stats.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_suppressions.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_suppressions.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_thread.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_thread.h delete mode 100644 contrib/libs/clang14-rt/lib/asan/asan_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/asan/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/asan_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/asan_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/asan_static/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/asan_static/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/builtins/README.txt delete mode 100644 contrib/libs/clang14-rt/lib/builtins/assembly.h delete mode 100644 contrib/libs/clang14-rt/lib/cfi/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/cfi/cfi.cpp delete mode 100644 contrib/libs/clang14-rt/lib/cfi/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/cfi_diag/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/cfi_diag/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/dd/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/dd/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan.cpp delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan.h delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_chained_origin_depot.cpp delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_chained_origin_depot.h delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_custom.cpp delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_interceptors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_new_delete.cpp delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_origin.h delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_platform.h delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_thread.cpp delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/dfsan_thread.h delete mode 100644 contrib/libs/clang14-rt/lib/dfsan/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/common.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/common.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/crash_handler.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/crash_handler.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/definitions.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/guarded_pool_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/guarded_pool_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/mutex.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/optional/backtrace.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/optional/options_parser.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/optional/options_parser.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/optional/printf.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/optional/segv_handler.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/optional/segv_handler_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/options.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/options.inc delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/common_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/mutex_posix.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/stack_trace_compressor.cpp delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/stack_trace_compressor.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/utilities.h delete mode 100644 contrib/libs/clang14-rt/lib/gwp_asan/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_allocation_functions.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_checks.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_dynamic_shadow.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_dynamic_shadow.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_exceptions.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_globals.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_globals.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_interceptors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_interceptors_vfork.S delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_interface_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_malloc_bisect.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_mapping.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_memintrinsics.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_new_delete.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_poisoning.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_poisoning.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_report.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_report.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_setjmp_aarch64.S delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_setjmp_x86_64.S delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_tag_mismatch_aarch64.S delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_thread.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_thread.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_thread_list.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_thread_list.h delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/hwasan_type_test.cpp delete mode 100644 contrib/libs/clang14-rt/lib/hwasan/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/hwasan_aliases/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/hwasan_aliases/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/hwasan_aliases_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/hwasan_aliases_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/hwasan_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/hwasan_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/interception/interception.h delete mode 100644 contrib/libs/clang14-rt/lib/interception/interception_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/interception/interception_linux.h delete mode 100644 contrib/libs/clang14-rt/lib/interception/interception_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/interception/interception_mac.h delete mode 100644 contrib/libs/clang14-rt/lib/interception/interception_type_test.cpp delete mode 100644 contrib/libs/clang14-rt/lib/interception/interception_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/interception/interception_win.h delete mode 100644 contrib/libs/clang14-rt/lib/lsan/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan.h delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_common.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_common.h delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_common_fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_common_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_common_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_fuchsia.h delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_interceptors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_malloc_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_posix.h delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_preinit.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_thread.cpp delete mode 100644 contrib/libs/clang14-rt/lib/lsan/lsan_thread.h delete mode 100644 contrib/libs/clang14-rt/lib/lsan/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/memprof-preinit/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/memprof-preinit/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/memprof/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/memprof/README.txt delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_descriptions.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_descriptions.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_flags.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_init_version.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_interceptors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_interceptors.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_interceptors_memintrinsics.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_interceptors_memintrinsics.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_interface_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_malloc_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_mapping.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_mibmap.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_mibmap.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_new_delete.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_preinit.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_rawprofile.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_rawprofile.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_rtl.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_shadow_setup.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_stack.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_stack.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_stats.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_stats.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_thread.cpp delete mode 100644 contrib/libs/clang14-rt/lib/memprof/memprof_thread.h delete mode 100644 contrib/libs/clang14-rt/lib/memprof/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/memprof_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/memprof_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/msan/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_chained_origin_depot.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_chained_origin_depot.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_interceptors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_interface_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_new_delete.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_origin.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_poisoning.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_poisoning.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_report.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_report.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_thread.cpp delete mode 100644 contrib/libs/clang14-rt/lib/msan/msan_thread.h delete mode 100644 contrib/libs/clang14-rt/lib/msan/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/msan_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/msan_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/profile/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/profile/GCDAProfiling.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfiling.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfiling.h delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingBuffer.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingFile.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingInternal.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingInternal.h delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingMerge.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingMergeFile.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingNameVar.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingPlatformDarwin.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingPlatformFuchsia.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingPlatformLinux.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingPlatformOther.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingPlatformWindows.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingPort.h delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingRuntime.cpp delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingUtil.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingUtil.h delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingValue.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingVersionVar.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/InstrProfilingWriter.c delete mode 100644 contrib/libs/clang14-rt/lib/profile/WindowsMMap.h delete mode 100644 contrib/libs/clang14-rt/lib/profile/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/safestack/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/safestack/safestack.cpp delete mode 100644 contrib/libs/clang14-rt/lib/safestack/safestack_platform.h delete mode 100644 contrib/libs/clang14-rt/lib/safestack/safestack_util.h delete mode 100644 contrib/libs/clang14-rt/lib/safestack/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sancov_flags.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sancov_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sancov_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_addrhashmap.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_checks.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_checks.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_combined.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_dlsym.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_interface.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_report.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_report.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_secondary.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_size_class_map.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_allocator_stats.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_asm.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_atomic.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_atomic_clang.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_atomic_clang_mips.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_atomic_clang_x86.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_bitvector.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_bvgraph.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors_format.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_arm.inc.S delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_riscv64.inc.S delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interface.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_interface_posix.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_coverage_interface.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_coverage_win_sections.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_dbghelp.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_deadlock_detector2.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_dense_map.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_dense_map_info.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_errno.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_errno.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_errno_codes.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_file.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_file.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_flag_parser.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_flag_parser.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_flags.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_flat_map.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_freebsd.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_fuchsia.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_getauxval.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_glibc_version.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_hash.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_interface_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_internal_defs.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_leb128.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_lfstack.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_libc.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_libc.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_libignore.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_libignore.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_linux.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_linux_s390.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_list.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_local_address_space_view.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_lzw.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_mac.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_mac_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_mutex.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_mutex.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_netbsd.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_placement_new.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_openbsd.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_posix.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_printf.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_procmaps.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_procmaps_common.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_procmaps_fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_procmaps_solaris.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_ptrauth.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_quarantine.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_report_decorator.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_ring_buffer.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_signal_interceptors.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_solaris.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stack_store.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stack_store.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stackdepot.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stacktrace.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stoptheworld.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_stoptheworld_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_suppressions.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_suppressions.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_syscall_linux_arm.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_syscall_linux_hexagon.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_syscall_linux_riscv64.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_syscall_linux_x86_64.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_syscalls_netbsd.inc delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_termination.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_thread_registry.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_thread_registry.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_thread_safety.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_tls_get_addr.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_type_traits.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_type_traits.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_vector.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_win.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_win_defs.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_win_dll_thunk.h delete mode 100644 contrib/libs/clang14-rt/lib/sanitizer_common/sanitizer_win_weak_interception.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_allocator.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_allocator.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_allocator_combined.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_allocator_secondary.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_crc32.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_crc32.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_errors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_errors.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_flags.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_interface_internal.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_malloc.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_new_delete.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_platform.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_termination.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_tsd.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_tsd_exclusive.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_tsd_exclusive.inc delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_tsd_shared.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_tsd_shared.inc delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_utils.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/scudo_utils.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/allocator_config.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/atomic_helpers.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/bytemap.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/checksum.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/checksum.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/chunk.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/combined.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/common.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/common.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/crc32_hw.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/flags.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/flags.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/flags_parser.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/flags_parser.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/fuchsia.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/fuchsia.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/include/scudo/interface.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/internal_defs.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/linux.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/list.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/local_cache.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/memtag.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/mutex.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/options.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/platform.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/primary32.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/primary64.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/quarantine.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/release.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/release.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/report.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/report.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/secondary.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/size_class_map.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/stack_depot.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/stats.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/string_utils.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/string_utils.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/trusty.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/tsd.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/tsd_exclusive.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/tsd_shared.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/vector.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/wrappers_c.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/wrappers_c.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/wrappers_c.inc delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/wrappers_c_checks.h delete mode 100644 contrib/libs/clang14-rt/lib/scudo/standalone/wrappers_cpp.cpp delete mode 100644 contrib/libs/clang14-rt/lib/scudo/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/scudo_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/scudo_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/scudo_cxx_minimal/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/scudo_cxx_minimal/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/scudo_minimal/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/scudo_minimal/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/scudo_standalone/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/scudo_standalone/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/scudo_standalone_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/scudo_standalone_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/stats/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/stats/stats.cpp delete mode 100644 contrib/libs/clang14-rt/lib/stats/stats.h delete mode 100644 contrib/libs/clang14-rt/lib/stats/stats_client.cpp delete mode 100644 contrib/libs/clang14-rt/lib/stats/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/stats_client/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/stats_client/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/tsan/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/tsan/dd/dd_interceptors.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/dd/dd_rtl.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/dd/dd_rtl.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_debugging.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_defs.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_dense_alloc.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_external.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_fd.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_fd.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_flags.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_ignoreset.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_ignoreset.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_ilist.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interceptors.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interceptors_libdispatch.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interceptors_mach_vm.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interface.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interface.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interface.inc delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interface_ann.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interface_ann.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interface_atomic.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interface_java.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_interface_java.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_malloc_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_md5.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_mman.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_mman.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_mutexset.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_mutexset.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_new_delete.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_platform.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_platform_linux.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_platform_mac.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_platform_posix.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_platform_windows.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_preinit.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_report.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_report.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_aarch64.S delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_access.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_amd64.S delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_mips64.S delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_ppc64.S delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_proc.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_report.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_s390x.S delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_rtl_thread.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_shadow.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_stack_trace.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_stack_trace.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_suppressions.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_suppressions.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_symbolize.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_symbolize.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_sync.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_sync.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_trace.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_vector_clock.cpp delete mode 100644 contrib/libs/clang14-rt/lib/tsan/rtl/tsan_vector_clock.h delete mode 100644 contrib/libs/clang14-rt/lib/tsan/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/tsan_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/tsan_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_checks.inc delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_diag.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_diag.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_diag_standalone.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_flags.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_flags.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_flags.inc delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_handlers.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_handlers.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_handlers_cxx.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_handlers_cxx.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_init.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_init.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_init_standalone.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_init_standalone_preinit.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_monitor.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_monitor.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_platform.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_signals_standalone.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_signals_standalone.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_type_hash.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_type_hash.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_type_hash_itanium.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_type_hash_win.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_value.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan/ubsan_value.h delete mode 100644 contrib/libs/clang14-rt/lib/ubsan_minimal/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp delete mode 100644 contrib/libs/clang14-rt/lib/ubsan_minimal/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/ubsan_standalone/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/ubsan_standalone/ya.make delete mode 100644 contrib/libs/clang14-rt/lib/ubsan_standalone_cxx/.yandex_meta/licenses.list.txt delete mode 100644 contrib/libs/clang14-rt/lib/ubsan_standalone_cxx/ya.make delete mode 100644 contrib/libs/clang14-rt/ya.make 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_lock.h b/contrib/libs/clang14-rt/lib/asan/asan_lock.h deleted file mode 100644 index e69de29bb2d1..000000000000 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