| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[asan][AIX] Move import/export lists to an AIX-specific subdirectory (#145936) This makes it more clear that these lists are AIX-specific. | 1 年前 | |
| 8 个月前 | ||
[compiler-rt][asan] Fix a test on Windows (#167591) Windows doesn't support pthread_attr, which was introduced to asan_test.cpp in #165198, so this change #ifdefs out the changes made in that PR. Originally reported by Chrome as https://crbug.com/459880605. | 8 个月前 | |
Revert "sanitizers: increase .clang-format columns to 100" This reverts commit 5d1df6d220f1d6f726d9643848679d781750db64. There is a strong objection to this change: https://reviews.llvm.org/D106436#2905618 Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D106847 | 4 年前 | |
| 8 个月前 | ||
[ASan] Fix the links to bugs and wikipages. llvm-svn: 254735 | 10 年前 | |
[asan] Export __sancov_* symbols symbols. Add __sancov_* symbols to the export list. Differential Revision: https://reviews.llvm.org/D29317 llvm-svn: 293680 | 9 年前 | |
Fix some small typos in compiler-rt. NFC (#133388) | 1 年前 | |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636 | 7 年前 | |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636 | 7 年前 | |
| 8 个月前 | ||
| 10 个月前 | ||
asan: refactor interceptor allocation/deallocation functions (#145087) Do some refactoring to allocation/deallocation interceptors. Expose explicit per-alloc_type functions and stop accepting explicit AllocType. This ensures we do not accidentally mix. NOTE: This change rejects attempts to call operator new(<some_size>, static_cast<std::align_val_t>(0)). For https://github.com/llvm/llvm-project/issues/144435 Signed-off-by: Justin King <jcking@google.com> | 1 年前 | |
[ASan] Renamed SHADOW_XYZ to ASAN_SHADOW_XYZ. Follow up from D115271. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D115293 | 4 年前 | |
[asan] Revert global check for non-AIX (#149245) 287b24e1899eb6ce62eb9daef5a24faae5e66c1e moved the GetGlobalAddressInformation call earlier, but this broke a chromium test, so make this workaround for AIX only. | 1 年前 | |
[NFC][asan] Cleanup AsanThreadIdAndName ctor/init (#111923) Co-authored-by: YunQiang Su <yunqiang@isrc.iscas.ac.cn> | 1 年前 | |
[ASan] Document define to disable container overflow checks at compile time. (#163468) Document a define to allow library developers to support disabling AddressSanitizer's container overflow detection in template code at compile time. The primary motivation is to reduce false positives in environments where libraries and frameworks that cannot be recompiled with sanitizers enabled are called from application code. This supports disabling checks when the runtime environment cannot be reliably controlled to use ASAN_OPTIONS. Key changes: - Use the define __SANITIZER_DISABLE_CONTAINER_OVERFLOW__ to disable instrumentation at compile time - Implemented redefining the container overflow APIs in common_interface_defs.h to use define to provide null implementation when define is present - Update documentation in AddressSanitizer.rst to suggest and illustrate use of the define - Add details of the define in PrintContainerOverflowHint() - Add test disable_container_overflow_checks to verify new hints on the error and fill the testing gap that ASAN_OPTIONS=detect_container_overflow=0 works - Add tests demonstrating the issue around closed source libraries and instrumented apps that both modify containers This requires no compiler changes and should be supportable cross compiler toolchains. An RFC has been opened to discuss: https://discourse.llvm.org/t/rfc-add-fsanitize-address-disable-container-overflow-flag-to-addresssanitizer/88349 | 8 个月前 | |
Provide ErrorBadParamsToCopyContiguousContainerAnnotations a more cor… (#139870) …rect 'reason' when constructing ErrorBase Co-authored-by: Tacet <advenam.tacet@gmail.com> | 10 个月前 | |
[asan] Hide SetTLSFakeStack and replaces uses with ResetTLSFakeStack (#163674) To simplify implementation of https://github.com/llvm/llvm-project/pull/160135 To keep the logic of figuring out what should be in TLS to one place. The rest of the code should just reset it and rely on GetFakeStackFast()/GetFakeStackFastAlways(). | 9 个月前 | |
[asan] Hide SetTLSFakeStack and replaces uses with ResetTLSFakeStack (#163674) To simplify implementation of https://github.com/llvm/llvm-project/pull/160135 To keep the logic of figuring out what should be in TLS to one place. The rest of the code should just reset it and rely on GetFakeStackFast()/GetFakeStackFastAlways(). | 9 个月前 | |
Revert "[ASan] Ensure Symbolize Flag setting on Windows through __asan_default_options() is maintained throughout runtime (#132811)" This reverts commit 7bf43fec3aa1c7bb64749efefe0f5fd1e377c1fd. Multiple buildbot failures have been reported: https://github.com/llvm/llvm-project/pull/132811 | 11 个月前 | |
Fix some small typos in compiler-rt. NFC (#133388) | 1 年前 | |
[asan] Add experimental 'poison_history_size' flag (#133175) This adds an experimental flag that will keep track of where the manual memory poisoning ( __asan_poison_memory_region) is called from, and print the stack trace if the poisoned region is accessed. (Absent this flag, ASan will tell you what code accessed a poisoned region, but not which code set the poison.) This implementation performs best-effort record keeping using ring buffers, as suggested by Vitaly. The size of each ring buffer is set by the poison_history_size flag. | 1 年前 | |
[compiler-rt][Fuchsia] Change GetMaxUserVirtualAddress to invoke syscall (#153309) LSan was recently refactored to call GetMaxUserVirtualAddress for diagnostic purposes. This leads to failures for some of our downstream tests which only run with lsan. This occurs because GetMaxUserVirtualAddress depends on setting up shadow via a call to __sanitizer_shadow_bounds, but shadow bounds aren't set for standalone lsan because it doesn't use shadow. This updates the function to invoke the same syscall used by __sanitizer_shadow_bounds calls for getting the memory limit. Ideally this function would only be called once since we only need to get the bounds once. More context in https://fxbug.dev/437346226. | 11 个月前 | |
Revert ""Reland "[asan] Remove debug tracing from report_globals (#104404)"" (#105926) Reverts llvm/llvm-project#105895 Still breaks the test https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/1864/ | 1 年前 | |
Reland [asan][windows] Eliminate the static asan runtime on windows (#107899) This reapplies 8fa66c6ca7272268747835a0e86805307b62399c ([asan][windows] Eliminate the static asan runtime on windows) for a second time. That PR bounced off the tests because it caused failures in the other sanitizer runtimes, these have been fixed by only building interception, sanitizer_common, and asan with /MD, and continuing to build the rest of the runtimes with /MT. This does mean that any usage of the static ubsan/fuzzer/etc runtimes will mean you're mixing different runtime library linkages in the same app, the interception, sanitizer_common, and asan runtimes are designed for this, however it does result in some linker warnings. Additionally, it turns out when building in release-mode with LLVM_ENABLE_PDBs the build system forced /OPT:ICF. This totally breaks asan's "new" method of doing "weak" functions on windows, and so /OPT:NOICF was explicitly added to asan's link flags. --------- Co-authored-by: Amy Wishnousky <amyw@microsoft.com> | 1 年前 | |
[ASan] Fix goo.gl link in comment for MSVC bug goo.gl is going away: https://developers.googleblog.com/en/google-url-shortener-links-will-no-longer-be-available/ Fix goo.gl link from: - http://goo.gl/L4qqUG + https://connect.microsoft.com/VisualStudio/feedback/details/829931/vs2012-and-vs2013-istream-code-reads-off-the-end-of-its-non-null-terminated-stack-copied-string via archive.org Endilll points out on the bug that the goo.gl link first goes to a dead redirect to connect.microsoft.com, then to bing, so grab the article from archive.org. Committed as obvious. Bug: https://github.com/llvm/llvm-project/issues/99586 | 1 年前 | |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636 | 7 年前 | |
[asan] Avoid -Wtautological-pointer-compare (#164918) https://github.com/llvm/llvm-project/pull/164906 converted a -Wpointer-bool-conversion warning into a -Wtautological-pointer-compare warning. Avoid both by using the bool cast. | 9 个月前 | |
[compiler-rt][asan] Reland: wcscpy/wcsncpy interceptors and stabilize wchar tests on Darwin/Android (#162028) ### Summary Reland: wcscpy/wcsncpy interceptors and stabilize wchar tests on Darwin/Android. Functional reland (runtime + tests). ### Context Reland of #160493 and #161624; previously reverted by #162021 and #162001 to restore green. ### Motivation - Restore wchar interceptors (wcscpy/wcsncpy), broaden ASan coverage, and improve Windows parity with narrow-string checks. - Make tests robust across Darwin/Android to keep bots green. ### Runtime (wcscpy/wcsncpy) - Add overlap checks; mark read/write ranges in bytes. - Use MaybeRealWcsnlen when available to bound reads. - Register Windows static runtime thunk where applicable. ### Tests (wcscpy/wcsncpy/wcscat/wcsncat) - Android: keep %env_asan_opts=log_to_stderr=1 so the ASan header is on stderr. - Darwin: tolerate reordering by putting all four key lines in one DAG group: cpp // CHECK-DAG: Good so far. // CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:...]] at pc {{...}} bp {{...}} sp {{...}} // CHECK-DAG: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0 // CHECK-DAG: #0 {{0x[0-9a-f]+}} in <func> ### Risk - Functional reland (runtime + tests), intended to restore functionality and maintain stability across platforms. --------- Signed-off-by: Yixuan Cao <caoyixuan2019@email.szu.edu.cn> | 9 个月前 | |
[ASan] Update meminstrinsics to use library memmove rather than internal (#160740) Currently memcpy and memset intrinsics map through to the library implementations if ASan has been inited, whereas memmove always calls internal_memmove. This patch changes memmove to use the library implementation if ASan has been inited. | 10 个月前 | |
[ASan] Update meminstrinsics to use library memmove rather than internal (#160740) Currently memcpy and memset intrinsics map through to the library implementations if ASan has been inited, whereas memmove always calls internal_memmove. This patch changes memmove to use the library implementation if ASan has been inited. | 10 个月前 | |
Port address sanitizer to LoongArch Depends on D129371. It survived all GCC ASan tests. Changes are trivial and mostly "borrowed" RISC-V logics, except that a different SHADOW_OFFSET is used. Reviewed By: SixWeining, MaskRay, XiaodongLoong Differential Revision: https://reviews.llvm.org/D129418 | 3 年前 | |
Revert "[asan][win][msvc] override new and delete and seperate TUs (#68754)" This reverts commit 481e9b3e0b9c0a6843261f060822c7a41387e28c. Breaks sanitizer bots: https://lab.llvm.org/buildbot/#/builders/127/builds/59071 | 2 年前 | |
ASAN: keep support for Global::location We as GCC still emit __asan_global_source_location for global variables and we would like to use it in the future. On other hand, we don't support llvm-symbolizer and the default libbacktraace symbolizer does not support location info. Differential Revision: https://reviews.llvm.org/D144424 | 3 年前 | |
[ASan][Windows] Honor asan config flags on windows when set through the user function (#122990) **Related to:** https://github.com/llvm/llvm-project/issues/117925 **Follow up to:** https://github.com/llvm/llvm-project/pull/117929 **Context:** As noted in the linked issue, some ASan configuration flags are not honored on Windows when set through the __asan_default_options user function. The reason for this is that __asan_default_options is not available by the time AsanInitInternal executes, which is responsible for applying the ASan flags. To fix this properly, we'll probably need a deep re-design of ASan initialization so that it is consistent across OS'es. In the meantime, this PR offers a practical workaround. **This PR:** refactors part of AsanInitInternal so that **idempotent** flag-applying steps are extracted into a new function ApplyOptions. This function is **also** invoked in the "weak function callback" on Windows (which gets called when __asan_default_options is available) so that, if any flags were set through the user-function, they are safely applied _then_. Today, ApplyOptions contains only a subset of flags. My hope is that ApplyOptions will over time, through incremental refactorings AsanInitInternal so that **all** flags are eventually honored. Other minor changes: * The introduction of a ApplyAllocatorOptions helper method, needed to implement ApplyOptions for allocator options without re-initializing the entire allocator. Reinitializing the entire allocator is expensive, as it may do a whole pass over all the marked memory. To my knowledge, this isn't needed for the options captured in ApplyAllocatorOptions. * Rename ProcessFlags to ValidateFlags, which seems like a more accurate name to what that function does, and prevents confusion when compared to the new ApplyOptions function. | 1 年前 | |
[compiler-rt][sanitizer][NFC] update endif markers for Haiku (#135475) | 1 年前 | |
[TSan] Fix asan_mac.cpp function pointer cast warnings (#151517) Fixes these compiler warnings: .../llvm-project/compiler-rt/lib/asan/asan_mac.cpp:252:4: warning: cast from 'dispatch_function_t' (aka 'void (*)(void *)') to 'void (*)(void *, size_t)' (aka 'void (*)(void *, unsigned long)') converts to incompatible function type [-Wcast-function-type-mismatch] 252 | ((void (*)(void *, size_t))asan_ctxt->func)(asan_ctxt->block, iteration); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../llvm-project/compiler-rt/lib/asan/asan_mac.cpp:259:32: warning: cast from 'void (*)(void *, size_t)' (aka 'void (*)(void *, unsigned long)') to 'dispatch_function_t' (aka 'void (*)(void *)') converts to incompatible function type [-Wcast-function-type-mismatch] 259 | alloc_asan_context(ctxt, (dispatch_function_t)work, &stack); | ^~~~~~~~~~~~~~~~~~~~~~~~~ | 11 个月前 | |
asan: refactor interceptor allocation/deallocation functions (#145087) Do some refactoring to allocation/deallocation interceptors. Expose explicit per-alloc_type functions and stop accepting explicit AllocType. This ensures we do not accidentally mix. NOTE: This change rejects attempts to call operator new(<some_size>, static_cast<std::align_val_t>(0)). For https://github.com/llvm/llvm-project/issues/144435 Signed-off-by: Justin King <jcking@google.com> | 1 年前 | |
asan: refactor interceptor allocation/deallocation functions (#145087) Do some refactoring to allocation/deallocation interceptors. Expose explicit per-alloc_type functions and stop accepting explicit AllocType. This ensures we do not accidentally mix. NOTE: This change rejects attempts to call operator new(<some_size>, static_cast<std::align_val_t>(0)). For https://github.com/llvm/llvm-project/issues/144435 Signed-off-by: Justin King <jcking@google.com> | 1 年前 | |
[win/asan] Improve SharedReAlloc with HEAP_REALLOC_IN_PLACE_ONLY. (#132558) Currently with HEAP_REALLOC_IN_PLACE_ONLY a new allocation gets returned with the content copied from the original pointer, which gets freed. But applications may rely on HEAP_REALLOC_IN_PLACE_ONLY returning the same pointer as they give as input to e.g. RtlReAllocateHeap. If e.g. growing is not possible it fails without modifying the input pointer. Downside of this patch is, it won't detect accesses to the area getting "free" by a shrinking reallocation. | 10 个月前 | |
[sanitizers] convert some errant CRLF line endings to LF (#108454) (nfc) https://github.com/llvm/llvm-project/pull/107899 Added some files with CRLF line endings. Mixed line endings are somewhat gross, so I've converted them all to unix. | 1 年前 | |
[compiler-rt] [Darwin] Strip MTE tags from ASAN and TSAN (#166453) ASAN and TSAN need to strip tags in order to compute the correct shadow addresses. rdar://163518624 | 8 个月前 | |
[ASan] Show memory rather than tag addresses in tag dump Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D133391 | 3 年前 | |
asan_memory_profile: Fix for deadlock in memory profiler code. Calling symbolization directly from stopTheWorld was causing deadlock. For libc dep systems, symbolization uses dl_iterate_phdr, which acquire a dl write lock. It could deadlock if the lock is already acquired by one of suspended. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D146990 | 3 年前 | |
asan: refactor interceptor allocation/deallocation functions (#145087) Do some refactoring to allocation/deallocation interceptors. Expose explicit per-alloc_type functions and stop accepting explicit AllocType. This ensures we do not accidentally mix. NOTE: This change rejects attempts to call operator new(<some_size>, static_cast<std::align_val_t>(0)). For https://github.com/llvm/llvm-project/issues/144435 Signed-off-by: Justin King <jcking@google.com> | 1 年前 | |
[asan] Fix-forward #133175 by avoiding designated initializers My patch broke the Windows build: C:\PROGRA~2\MIB055~1\2019\PROFES~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /nologo /TP -DASAN_DYNAMIC=1 -DINTERCEPTION_DYNAMIC_CRT -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GLIBCXX_ASSERTIONS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\b\slave\sanitizer-windows\build\stage1\projects\compiler-rt\lib\asan -IC:\b\slave\sanitizer-windows\llvm-project\compiler-rt\lib\asan -IC:\b\slave\sanitizer-windows\build\stage1\include -IC:\b\slave\sanitizer-windows\llvm-project\llvm\include -IC:\b\slave\sanitizer-windows\llvm-project\compiler-rt\lib\asan\.. /DWIN32 /D_WINDOWS /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Z7 /Oi /bigobj /permissive- -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /W4 /O2 /Ob2 -std:c++17 -MD /Oy- /GS- /Zc:threadSafeInit- /Z7 /wd4146 /wd4291 /wd4391 /wd4722 /wd4800 /Zl /GR- /experimental:external /external:W0 /external:anglebrackets /showIncludes /Foprojects\compiler-rt\lib\asan\CMakeFiles\RTAsan_dynamic.x86_64.dir\asan_poisoning.cpp.obj /Fdprojects\compiler-rt\lib\asan\CMakeFiles\RTAsan_dynamic.x86_64.dir\ /FS -c C:\b\slave\sanitizer-windows\llvm-project\compiler-rt\lib\asan\asan_poisoning.cpp C:\b\slave\sanitizer-windows\llvm-project\compiler-rt\lib\asan\asan_poisoning.cpp(164): error C7555: use of designated initializers requires at least '/std:c++20' [2/3] Building CXX object projects\compiler-rt\lib\asan\CMakeFiles\RTAsan_dynamic_version_script_dummy.x86_64.dir\dummy.cpp.obj https://lab.llvm.org/buildbot/#/builders/107/builds/9712/steps/4/logs/stdio | 1 年前 | |
[asan] Add experimental 'poison_history_size' flag (#133175) This adds an experimental flag that will keep track of where the manual memory poisoning ( __asan_poison_memory_region) is called from, and print the stack trace if the poisoned region is accessed. (Absent this flag, ASan will tell you what code accessed a poisoned region, but not which code set the poison.) This implementation performs best-effort record keeping using ring buffers, as suggested by Vitaly. The size of each ring buffer is set by the poison_history_size flag. | 1 年前 | |
| 8 个月前 | ||
[asan] Fix a comment | 2 年前 | |
Reapply "[HWASan] [compiler-rt] support non-4k pages on Android" (#95853) Updated MapDynamicShadow callsite in asan_win. | 2 年前 | |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636 | 7 年前 | |
[ASan] Limits the conditions of the deadlock patch (#137127) PR #131756 introduced a patch to fix a deadlock between LSan and ASan. The relevant deadlock only occurs when LSan is enabled and dl_iterate_phdr is used for Stop-the-World, i.e., under the condition CAN_SANITIZE_LEAKS && (SANITIZER_LINUX || SANITIZER_NETBSD). Therefore, this commit also sets the effective condition of this patch to the above condition, avoiding unnecessary problems in other environments, e.g., stack overflow on MSVC/Windows. | 1 年前 | |
[compiler-rt][ASan] Add function copying annotations (#91702) This PR adds a __sanitizer_copy_contiguous_container_annotations function, which copies annotations from one memory area to another. New area is annotated in the same way as the old region at the beginning (within limitations of ASan). Overlapping case: The function supports overlapping containers, however no assumptions should be made outside of no false positives in new buffer area. (It doesn't modify old container annotations where it's not necessary, false negatives may happen in edge granules of the new container area.) I don't expect this function to be used with overlapping buffers, but it's designed to work with them and not result in incorrect ASan errors (false positives). If buffers have granularity-aligned distance between them (old_beg % granularity == new_beg % granularity), copying algorithm works faster. If the distance is not granularity-aligned, annotations are copied byte after byte. cpp void __sanitizer_copy_contiguous_container_annotations( const void *old_storage_beg_p, const void *old_storage_end_p, const void *new_storage_beg_p, const void *new_storage_end_p) { This function aims to help with short string annotations and similar container annotations. Right now we change trait types of std::basic_string when compiling with ASan and this function purpose is reverting that change as soon as possible. https://github.com/llvm/llvm-project/blob/87f3407856e61a73798af4e41b28bc33b5bf4ce6/libcxx/include/string#L738-L751 The goal is to not change __trivially_relocatable when compiling with ASan. If this function is accepted and upstreamed, the next step is creating a function like __memcpy_with_asan moving memory with ASan. And then using this function instead of __builtin__memcpy while moving trivially relocatable objects. https://github.com/llvm/llvm-project/blob/11a6799740f824282650aa9ec249b55dcf1a8aae/libcxx/include/__memory/uninitialized_algorithms.h#L644-L646 --- I'm thinking if there is a good way to address fact that in a container the new buffer is usually bigger than the previous one. We may add two more arguments to the functions to address it (the beginning and the end of the whole buffer. Another potential change is removing new_storage_end_p as it's redundant, because we require the same size. Potential future work is creating a function __asan_unsafe_memmove, which will be basically memmove, but with turned off instrumentation (therefore it will allow copy data from poisoned area). --------- Co-authored-by: Vitaly Buka <vitalybuka@google.com> | 1 年前 | |
[sanitizer_common] Drop remaining support for Android 5 or older (#146187) Dependent on https://github.com/llvm/llvm-project/pull/145227 | 1 年前 | |
[ASan] Added intermediate functions between assembly and __asan_report.* to avoid link errors. Instead of calling asan_report.* directly from assembly code they have been replaced with corresponding asan_report.*_asm function, which call asan_report.*. All asan_report.* are now undefined weak symbols, which allows DSOs to link when z defs is used. Reviewed By: MaskRay, morehouse Differential Revision: https://reviews.llvm.org/D118813 | 4 年前 | |
[NFCI][asm][i386/x86-64] Enable AT&T syntax explicitly (#164453) Implementation files using the Intel syntax explicitly specify it. Do the same for the few files using AT&T syntax. This also enables building LLVM with -mllvm -x86-asm-syntax=intel in one's Clang config files (i.e. a global preference for Intel syntax). No functional change intended. | 9 个月前 | |
[compiler-rt] Remove some cpplint filters llvm-svn: 371704 | 6 年前 | |
[asan] Re-exec without ASLR if needed on 64-bit Linux (#132682) This generalizes https://github.com/llvm/llvm-project/pull/131975 to non-32-bit Linux (i.e., 64-bit Linux). This works around an edge case in 64-bit Linux, whereby the memory layout is incompatible if the stack size is unlimited AND ASLR entropy is 31+ bits (see https://github.com/google/sanitizers/issues/856#issuecomment-2747076811). More generally, this "re-exec without ASLR if layout is incompatible" is a hammer that can work around most shadow mapping issues, without incurring the overhead of using a dynamic shadow. | 1 年前 | |
[NFC][asan] Change asan_init and asan_init_is_running; add setters/getters For #71833 | 2 年前 | |
[compiler-rt] Mark some performance critical buffers uninitialized With -ftrivial-auto-var-init, do not emit memset() calls for performance critical stack variables. Reviewed By: vitalybuka, dvyukov, MaskRay Differential Revision: https://reviews.llvm.org/D151551 | 3 年前 | |
[ASan] return 0 for current allocated bytes if malloc/free are never happend (#67394) This is found during address sanitizer enablement on AIX. On platforms that has no malloc/free calls before user's malloc/free calls, __sanitizer_get_current_allocated_bytes() should return 0. Otherwise the case like compiler-rt/test/sanitizer_common/TestCases/allocator_interface.cpp will fail at below scenario: void Test(int size) { auto allocated_bytes_before = __sanitizer_get_current_allocated_bytes(); int *p = (int *)malloc(size); assert(__sanitizer_get_current_allocated_bytes() >= size + allocated_bytes_before); // if allocated_bytes_before is 1, this assert will fail. allocated_bytes_before should be 0 } | 2 年前 | |
Revert r369472 and r369441 check-sanitizer does not work on Linux llvm-svn: 369495 | 6 年前 | |
[sanitizer] Support "alloc_dealloc_mismatch" suppressions (#124197) This adds a stack-based suppression for alloc-dealloc-mismatch violations, using the function name to match. | 1 年前 | |
[sanitizer] Support "alloc_dealloc_mismatch" suppressions (#124197) This adds a stack-based suppression for alloc-dealloc-mismatch violations, using the function name to match. | 1 年前 | |
[asan] Hide SetTLSFakeStack and replaces uses with ResetTLSFakeStack (#163674) To simplify implementation of https://github.com/llvm/llvm-project/pull/160135 To keep the logic of figuring out what should be in TLS to one place. The rest of the code should just reset it and rely on GetFakeStackFast()/GetFakeStackFastAlways(). | 9 个月前 | |
[asan] Hide SetTLSFakeStack and replaces uses with ResetTLSFakeStack (#163674) To simplify implementation of https://github.com/llvm/llvm-project/pull/160135 To keep the logic of figuring out what should be in TLS to one place. The rest of the code should just reset it and rely on GetFakeStackFast()/GetFakeStackFastAlways(). | 9 个月前 | |
[asan] Re-exec without ASLR if needed on 32-bit Linux (#131975) High-entropy ASLR allows up to 16-bits of entropy (2**16 4KB pages == 256MB; a bit more in practice because of implementation details), which is a significant chunk of the user address space on 32-bit systems (4GB or less). This, combined with ASan's shadow (512MB) and ASan's fixed shadow offset (512MB), makes it possible for large binaries to fail to map the shadow. This patch changes ASan to do a one-time re-exec without ASLR if it cannot map the shadow, thus reclaiming the ~256MB of address space. Alternatives considered: 1) We don't lower ASan's fixed shadow offset, because that would limit non-PIE binaries. 2) We don't switch to a dynamic shadow offset, because ASan for 32-bit Linux relies on the compile-time constant offset to optimize its instrumentation and compiler-rt. This is loosely inspired by https://github.com/llvm/llvm-project/pull/78351, https://github.com/llvm/llvm-project/pull/85142, and https://github.com/llvm/llvm-project/pull/85674, though those were required because there were no static shadow mappings that could fully shadow the range of user mappings; this is not the case for ASan. | 1 年前 | |
[compiler-rt] [asan] Remove superfluous trailing semicolons (#110641) If built as part of the main llvm build, via ENABLE_LLVM_PROJECTS=compiler-rt, the code gets built with more warning options than if built standalone. Some of these trigger warnings like: warning: extra ';' outside of a function is incompatible with C++98 [-Wc++98-compat-extra-semi] | 1 年前 | |
[sanitizers] convert some errant CRLF line endings to LF (#108454) (nfc) https://github.com/llvm/llvm-project/pull/107899 Added some files with CRLF line endings. Mixed line endings are somewhat gross, so I've converted them all to unix. | 1 年前 | |
Reland [asan][windows] Eliminate the static asan runtime on windows (#107899) This reapplies 8fa66c6ca7272268747835a0e86805307b62399c ([asan][windows] Eliminate the static asan runtime on windows) for a second time. That PR bounced off the tests because it caused failures in the other sanitizer runtimes, these have been fixed by only building interception, sanitizer_common, and asan with /MD, and continuing to build the rest of the runtimes with /MT. This does mean that any usage of the static ubsan/fuzzer/etc runtimes will mean you're mixing different runtime library linkages in the same app, the interception, sanitizer_common, and asan runtimes are designed for this, however it does result in some linker warnings. Additionally, it turns out when building in release-mode with LLVM_ENABLE_PDBs the build system forced /OPT:ICF. This totally breaks asan's "new" method of doing "weak" functions on windows, and so /OPT:NOICF was explicitly added to asan's link flags. --------- Co-authored-by: Amy Wishnousky <amyw@microsoft.com> | 1 年前 | |
[compiler-rt][asan] Reland: wcscpy/wcsncpy interceptors and stabilize wchar tests on Darwin/Android (#162028) ### Summary Reland: wcscpy/wcsncpy interceptors and stabilize wchar tests on Darwin/Android. Functional reland (runtime + tests). ### Context Reland of #160493 and #161624; previously reverted by #162021 and #162001 to restore green. ### Motivation - Restore wchar interceptors (wcscpy/wcsncpy), broaden ASan coverage, and improve Windows parity with narrow-string checks. - Make tests robust across Darwin/Android to keep bots green. ### Runtime (wcscpy/wcsncpy) - Add overlap checks; mark read/write ranges in bytes. - Use MaybeRealWcsnlen when available to bound reads. - Register Windows static runtime thunk where applicable. ### Tests (wcscpy/wcsncpy/wcscat/wcsncat) - Android: keep %env_asan_opts=log_to_stderr=1 so the ASan header is on stderr. - Darwin: tolerate reordering by putting all four key lines in one DAG group: cpp // CHECK-DAG: Good so far. // CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:...]] at pc {{...}} bp {{...}} sp {{...}} // CHECK-DAG: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0 // CHECK-DAG: #0 {{0x[0-9a-f]+}} in <func> ### Risk - Functional reland (runtime + tests), intended to restore functionality and maintain stability across platforms. --------- Signed-off-by: Yixuan Cao <caoyixuan2019@email.szu.edu.cn> | 9 个月前 | |
[asan] Add missing __asan_set_shadow_0x() calls. Add new calls introduced in https://reviews.llvm.org/D136197 to weak_symbols.txt. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D137178 | 3 年前 |
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