summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_libc.h
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* [sanitizer] Use const char* in internal_simple_strtollVitaly Buka2018-06-171-1/+1
| | | | llvm-svn: 334900
* [sanitizer] Remove low-hanging-fruit dead codeKostya Kortchinsky2018-04-171-5/+0
| | | | | | | | | | | | | | | | | Summary: Going through the dead code findings, the code removed in this CL appears to be pretty straightforward to remove, and seems to be some leftover from previous refactors. Reviewers: alekseyshl, eugenis Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45704 llvm-svn: 330190
* Fix clang-cl warning and crash in sanitizersReid Kleckner2016-07-211-4/+6
| | | | | | | | | | Make kStderrFd a macro to avoid dynamic initialization of the report_file global. This actually causes a crash at runtime, because ASan initializes before static initializers run. Remove an unused variable in asan_win.cc. llvm-svn: 276314
* [compiler-rt] Add internal wcslen to avoid crashing on windows 64-bitsEtienne Bergeron2016-07-141-0/+1
| | | | | | | | | | | | | | | | | | Summary: The function wcslen is incorrectly hooked on windows 64-bits. The interception library is not able to hook without breaking the code. The function is too small and the interception must be done with trampoline-hooking which turned out to be incorrect on a small loop (first few instructions have a backedge). Reviewers: rnk Subscribers: wang0109, chrisha, llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D22363 llvm-svn: 275488
* Fixup for r269288. SleepForSeconds is not available in nolibc builds, let's ↵Kuba Brecka2016-05-121-0/+1
| | | | | | add an internal_sleep. llvm-svn: 269296
* [compiler-rt] Add internal implementations for strlcat and strlcpyAnna Zaks2015-11-201-0/+2
| | | | | | | | | | The compiler-rt should make use of strlcpy() rather than strncpy(). Using internal_strncpy() may be fine with appropriate bounds checking or enforcement of nul-termination elsewhere, but it's just good practice these days to avoid using strncpy() in new code. A patch by Jeremy Sequoia! Differential Revision: http://reviews.llvm.org/D14714 llvm-svn: 253690
* [sanitizer] Fix Clang-tidy modernize-use-nullptr warnings in ↵Kostya Serebryany2015-09-291-3/+4
| | | | | | lib/sanitizer_common headers, unify closing inclusion guards. Patch by Eugene Zelenko llvm-svn: 248816
* [ASan/Win] Add more support for file operationsTimur Iskhodzhanov2015-04-091-3/+3
| | | | llvm-svn: 234494
* Use RenameFile instead of internal_rename in non-POSIX codeTimur Iskhodzhanov2015-04-091-1/+0
| | | | llvm-svn: 234490
* Use WriteToFile instead of internal_write in non-POSIX codeTimur Iskhodzhanov2015-04-091-1/+0
| | | | llvm-svn: 234487
* Use ReadFromFile instead of internal_read in non-POSIX codeTimur Iskhodzhanov2015-04-091-1/+0
| | | | llvm-svn: 234485
* Move more POSIX-specific functions to sanitizer_posix.hTimur Iskhodzhanov2015-04-091-8/+0
| | | | llvm-svn: 234482
* Introduce CloseFile to be used instead of internal_close on non-POSIXTimur Iskhodzhanov2015-04-091-1/+0
| | | | llvm-svn: 234481
* [Sanitizer RT] Get rid of internal_isattyTimur Iskhodzhanov2015-04-081-1/+0
| | | | llvm-svn: 234423
* Move some POSIX-specific functions from sanitizer_libc.h to a new ↵Timur Iskhodzhanov2015-04-081-35/+0
| | | | | | sanitizer_posix.h llvm-svn: 234418
* [Sanitizers] Make OpenFile more portableTimur Iskhodzhanov2015-04-081-0/+1
| | | | llvm-svn: 234410
* [compiler-rt] Make MaybeReexec properly process DYLD_INSERT_LIBRARIES when ↵Kuba Brecka2015-02-061-0/+1
| | | | | | | | | | | | using non-absolute paths MaybeReexec() in asan_mac.cc checks for presence of the ASan dylib in DYLD_INSERT_LIBRARIES, and if it is there, it will process this env. var. and remove the dylib from its value, so that spawned children don't have this variable set. However, the current implementation only works when using a canonical absolute path to the dylib, it fails to remove the dylib for example when using @executable_path. This patch changes the processing of DYLD_INSERT_LIBRARIES to comparing values only based on filenames (ignoring directories). Reviewed at http://reviews.llvm.org/D7160 llvm-svn: 228392
* [sanitizer] Flag parser rewrite.Evgeniy Stepanov2015-01-151-0/+1
| | | | | | | The new parser is a lot stricter about syntax, reports unrecognized flags, and will make it easier to implemented some of the planned features. llvm-svn: 226169
* [asan] new flag: hard_rss_limit_mbKostya Serebryany2014-12-161-0/+19
| | | | llvm-svn: 224353
* [asancov] Write coverage directly to a memory-mapped file.Evgeniy Stepanov2014-05-271-0/+2
| | | | | | | | | | | This way does not require a __sanitizer_cov_dump() call. That's important on Android, where apps can be killed at arbitrary time. We write raw PCs to disk instead of module offsets; we also write memory layout to a separate file. This increases dump size by the factor of 2 on 64-bit systems. llvm-svn: 209653
* [libsanitizer] Fix the return type of internal_forkAlexander Potapenko2014-05-131-1/+1
| | | | llvm-svn: 208714
* [libsanitizer] Use internal_fork() to spawn the symbolizer process.Alexander Potapenko2014-05-131-0/+2
| | | | | | This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=61 llvm-svn: 208707
* [ASan] Move the SIGSEGV/SIGBUS handling to sanitizer_commonAlexander Potapenko2014-01-311-0/+2
| | | | | | | This change is a part of refactoring intended to have common signal handling behavior in all tools. This particular CL moves InstallSignalHandlers() into sanitizer_common (making it InstallDeadlySignalHandlers()), but doesn't enable default signal handlers for any tool other than ASan. llvm-svn: 200542
* [sanitizer] use 16-byte aligned bzero in performance critical place (mostly ↵Kostya Serebryany2013-11-231-0/+2
| | | | | | for lsan) llvm-svn: 195549
* Add internal_strchrnul functionAlexey Samsonov2013-09-031-0/+1
| | | | llvm-svn: 189797
* [nolibc] Move all platforms to internal_getpid.Peter Collingbourne2013-05-171-0/+1
| | | | | | | | | | Before, we had an unused internal_getpid function for Linux, and a platform-independent GetPid function. To make the naming conventions consistent for syscall-like functions, the GetPid syscall wrapper in sanitizer_posix.cc is moved to sanitizer_mac.cc, and GetPid is renamed to internal_getpid, bringing the Linux variant into use. llvm-svn: 182132
* [nolibc] Change internal syscall API to remove reliance on libc's errno.Peter Collingbourne2013-05-081-16/+19
| | | | | | | | | | | | | This change moves to a model where the error value of a system call is potentially contained in the return value itself rather than being implicit in errno. The helper function internal_iserror can be used to extract the error value from a return value. On platforms other than Linux/x86_64 this still uses errno, but other platforms are free to port their error handling to this new model. Differential Revision: http://llvm-reviews.chandlerc.com/D756 llvm-svn: 181436
* tsan: add internal_unlink() functionDmitry Vyukov2013-03-201-0/+1
| | | | llvm-svn: 177510
* add Linux syscall wrappers and ThreadLister to sanitizer_commonKostya Serebryany2013-02-271-0/+5
| | | | | | | | ThreadLister is a Linux-specific class for obtaining the thread IDs of a process from procfs (/proc/<pid>/task/). It will be used by leak checking code. Also add several syscall wrappers which will be required by the same code that uses ThreadLister, but are not used in ThreadLister itself. Patch by Sergey Matveev llvm-svn: 176179
* [Sanitizer] use raw syscall instead of _exit() function on LinuxAlexey Samsonov2013-02-201-2/+4
| | | | llvm-svn: 175622
* [Sanitizer] extend internal libc with stat/fstat/lstat functionsAlexey Samsonov2013-02-041-0/+4
| | | | llvm-svn: 174316
* [Sanitizer] use u32 instead of mode_t, which is defined in Darwin headersAlexey Samsonov2013-02-011-1/+1
| | | | llvm-svn: 174189
* [Sanitizer] make internal_open have the same interface as libc versionAlexey Samsonov2013-02-011-2/+5
| | | | llvm-svn: 174187
* [sanitizer] Further split private and public sanitizer headers.Evgeniy Stepanov2013-01-301-2/+1
| | | | | | And make msan_interface.h C-compatible. llvm-svn: 173928
* [asan] implement more strict checking for memset/etc parameters. Instead of ↵Kostya Serebryany2012-12-281-0/+5
| | | | | | checking the first and the last byte, we check the entire shadow region. This costs ~10 slowdown for the instrumented functions. Motivated by a nasty memset-buffer-overflow-by-140-bytes in chrome which was reported as a use-after-free or not at all llvm-svn: 171198
* [Sanitizer] Add internal_isatty to sanitizer_libc and PrintsToTty to ↵Alexey Samsonov2012-11-021-0/+1
| | | | | | determine whether error reports are printed to terminal llvm-svn: 167298
* [Sanitizer] Use kStderrFd constant instead of hardcoded 2Alexey Samsonov2012-11-021-0/+3
| | | | llvm-svn: 167291
* Implement internal_memmove.Alexander Potapenko2012-10-151-0/+1
| | | | | | | | Use internal_memmove() and internal_memcpy() in the memcpy() and memmove() wrappers when building the dynamic runtime (OS X only), to work around a bug in resolver functions wrapping. See also http://code.google.com/p/address-sanitizer/issues/detail?id=116 llvm-svn: 165939
* [Sanitizer] implement readlink as syscall on LinuxAlexey Samsonov2012-09-051-0/+1
| | | | llvm-svn: 163213
* Relocate the external headers provided by ASan and the common sanitizerChandler Carruth2012-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | library. These headers are intended to be available to user code when built with AddressSanitizer (or one of the other sanitizer's in the future) to interface with the runtime library. As such, they form stable external C interfaces, and the headers shouldn't be located within the implementation. I've pulled them out into what seem like fairly obvious locations and names, but I'm wide open to further bikeshedding of these names and locations. I've updated the code and the build system to cope with the new locations, both CMake and Makefile. Please let me know if this breaks anyone's build. The eventual goal is to install these headers along side the Clang builtin headers when we build the ASan runtime and install it. My current thinking is to locate them at: <prefix>/lib/clang/X.Y/include/sanitizer/common_interface_defs.h <prefix>/lib/clang/X.Y/include/sanitizer/asan_interface.h <prefix>/lib/clang/X.Y/include/sanitizer/... But maybe others have different suggestions? Fixing the style of the #include between these headers at least unblocks experimentation with installing them as they now should work when installed in these locations. llvm-svn: 162822
* [Sanitizer] implement internal_strcspnAlexey Samsonov2012-08-211-0/+1
| | | | llvm-svn: 162272
* [asan] get rid of libc's sscanf as it causes infinite recursion on Fedora. Kostya Serebryany2012-06-291-1/+0
| | | | llvm-svn: 159424
* [Sanitizer] Renaming: SNPrintf -> internal_snprintf (and move it to ↵Alexey Samsonov2012-06-191-0/+1
| | | | | | sanitizer libc) llvm-svn: 158710
* [Sanitizer] State that sanitizer_libc.h header can be included in the user ↵Alexey Samsonov2012-06-191-1/+4
| | | | | | code (and therefore it shouldn't include other sanitizer runtime headers). llvm-svn: 158707
* [Sanitizer] add internal_strncmp to sanitizer libcAlexey Samsonov2012-06-181-0/+1
| | | | llvm-svn: 158658
* [Sanitizer] move different wrappers from TSan to common sanitizer runtimeAlexey Samsonov2012-06-181-0/+3
| | | | llvm-svn: 158655
* [Sanitizer] move all the rest re-implementations of libc functions from ASan ↵Alexey Samsonov2012-06-151-2/+7
| | | | | | runtime to common sanitizer runtime llvm-svn: 158519
* [Sanitizer] Use DEFINE_REAL macro in TSan runtime to call libc ↵Alexey Samsonov2012-06-151-0/+1
| | | | | | implementations of functions. Move strchr to sanitizer_libc. llvm-svn: 158517
* [Sanitizer] Move internal_memcmp to common sanitizer libcAlexey Samsonov2012-06-141-0/+1
| | | | llvm-svn: 158450
OpenPOWER on IntegriCloud