summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
Commit message (Collapse)AuthorAgeFilesLines
* compiler-rt: Rename .cc file in lib/sanitizer_common to .cppNico Weber2019-07-311-1271/+0
| | | | | | | | | | | See https://reviews.llvm.org/D58620 for discussion, and for the commands I ran. In addition I also ran for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $f . ; done and manually updated (many) references to renamed files found by that. llvm-svn: 367463
* 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_common] Remove support for tirpc/rpc/xdr.hMichal Gorny2019-01-101-3/+1
| | | | | | | | | | | | | Remove the partial support for rpc/xdr.h from libtirpc. Since it is an entirely external library, we ought to build it sanitized separately and not attempt to intercept like the libc implementation. Besides, the existing code for tirpc support was neither complete nor working. Noted by @krytarowski. Differential Revision: https://reviews.llvm.org/D47817 llvm-svn: 350881
* [sanitizer] Android does not provide <fstab.h>Evgeniy Stepanov2019-01-021-3/+2
| | | | llvm-svn: 350246
* [Sanitizer] Enable getfsent api for DarwinDavid Carlier2018-12-291-0/+2
| | | | | | | | | | Reviewers: vitalybuka, kubamracek Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D56138 llvm-svn: 350138
* Enable posix regex interceptors on linux.Evgeniy Stepanov2018-12-271-0/+3
| | | | | | | | | | | | Summary: They happen to work out of the box. Reviewers: rtrieu, vitalybuka Subscribers: kubamracek, fedor.sergeev, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D56088 llvm-svn: 350103
* [Sanitizer] Separate FreeBSD interception data structuresDavid Carlier2018-12-071-54/+18
| | | | | | | | | | Reviewers: vitalybuka, krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55386 llvm-svn: 348634
* Unbreak FreeBSD build.David Carlier2018-11-221-0/+1
| | | | | | M lib/sanitizer_common/sanitizer_platform_limits_posix.cc llvm-svn: 347451
* [Sanitizer] Adding setvbuf in supported platforms and other stream buffer ↵David Carlier2018-11-211-0/+2
| | | | | | | | | | | | | | | functions - Enabling setvbuf interceptions for non NetBSD platforms. - setbuf, setbuffer, setlinebuf as well. Reviewers: vitalybuka, krytarowski Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D54779 llvm-svn: 347426
* Add glibc_prereq to platform limits mmsghdrBrian Cain2018-09-051-4/+5
| | | | | | | | | sendmmsg requires glibc >= 2.14. Fixes PR38589. Review: https://reviews.llvm.org/D51538 llvm-svn: 341442
* [hwasan] Provide __sanitizer_* aliases to allocator functions.Evgeniy Stepanov2018-08-131-1/+1
| | | | | | | | | | | | | | | | Summary: Export __sanitizer_malloc, etc as aliases to malloc, etc. This way users can wrap sanitizer malloc, even in fully static binaries. Both jemalloc and tcmalloc provide similar aliases (je_* and tc_*). Reviewers: vitalybuka, kcc Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D50570 llvm-svn: 339614
* Define SIZEOF_STRUCT_USTAT for 32bit sparc.Sylvestre Ledru2018-05-311-1/+1
| | | | | | | | Patch landed on gcc upstream: https://github.com/gcc-mirror/gcc/commit/27453e962b3fe2f918c5105b2a48ec3e92d4c873 Patch by Matthias Klose llvm-svn: 333644
* Revert the last test commitH.J. Lu2018-05-251-1/+0
| | | | llvm-svn: 333310
* This is a test commit to verify repository accessH.J. Lu2018-05-251-0/+1
| | | | llvm-svn: 333309
* sanitizer: Use pre-computed size of struct ustat for LinuxCraig Topper2018-05-241-2/+13
| | | | | | | | | | | | | | | | | | | <sys/ustat.h> has been removed from glibc 2.28 by: commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7 Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Sun Mar 18 11:28:59 2018 +0800 Deprecate ustat syscall interface This patch uses pre-computed size of struct ustat for Linux to fix https://bugs.llvm.org/show_bug.cgi?id=37418 Patch by H.J. Lu. Differential Revision: https://reviews.llvm.org/D47281 llvm-svn: 333213
* [asan] Fix build with Android NDK < 14.Evgeniy Stepanov2018-01-041-1/+1
| | | | | | | | | | | | NDK < 13 & API_LEVEL < 21 do not define struct mmsghdr. Newer NDK use unified headers and provide this definition for all api levels. Since we can not check for the NDK version, check the api level. This is more strict than absolutely necessary, but it does not really matter: it is only a sanity check. llvm-svn: 321817
* [msan] Intercept sendmmsg, recvmmsg.Evgeniy Stepanov2018-01-031-0/+6
| | | | | | | | | | | | Summary: Extend the sendmsg test to cover all recv*. Reviewers: vitalybuka Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D41620 llvm-svn: 321774
* Correct NetBSD support in pthread_once(3)/TSanKamil Rytarowski2017-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The pthread_once(3)/NetBSD type is built with the following structure: struct __pthread_once_st { pthread_mutex_t pto_mutex; int pto_done; }; Set the pto_done position as shifted by __sanitizer::pthread_mutex_t_sz from the beginning of the pthread_once struct. This corrects deadlocks when the pthread_once(3) function is used. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, vitalybuka Reviewed By: dvyukov Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40262 llvm-svn: 318742
* [tsan] Move out more types to sanitizer_commonVitaly Buka2017-11-101-3/+4
| | | | | | https://github.com/google/sanitizers/issues/637 llvm-svn: 317946
* [Sanitizers] Consolidate internal errno definitions.Alex Shlyapnikov2017-07-061-9/+0
| | | | | | | Move internal errno definitions to common to be shared by all sanitizers and to be used by allocators. llvm-svn: 307233
* Remove struct_rtentry_sz on FreeBSDDimitry Andric2017-02-101-6/+1
| | | | | | | | | | | | | | | | | | Summary: Since struct rtentry is an internal kernel-only structure on FreeBSD, and SIOCADDRT and SIOCDELRT are not supported anyway, stop including socketvar.h and attempting to get at the definition of struct rtentry, and move the line with struct_rtentry_sz to the SANIZER_LINUX block. Reviewers: kcc, kutuzov.viktor.84, emaste Reviewed By: kcc, emaste Subscribers: emaste, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D29832 llvm-svn: 294806
* Fix build breakage on FreeBSD after rL289878/rL289881Dimitry Andric2016-12-201-2/+2
| | | | | | | | | | | | | | | | | | Summary: After rL289878/rL289881, the build on FreeBSD is broken, because sanitizer_platform_limits_posix.cc attempts to include <utmp.h> and use `struct utmp`, neither of which are supported anymore on FreeBSD. Fix this by adding `&& !SANITIZER_FREEBSD` in a few places, and stop intercepting utmp functions altogether for FreeBSD. Reviewers: kubabrecka, emaste, eugenis, ed Subscribers: ed, llvm-commits Differential Revision: https://reviews.llvm.org/D27902 llvm-svn: 290167
* Ifdef out utmp.h on Darwin to un-break the build after r289878 ([msan] ↵Kuba Mracek2016-12-151-0/+4
| | | | | | Intercept getutent and friends). llvm-svn: 289881
* [msan] Intercept getutent and friends.Evgeniy Stepanov2016-12-151-0/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D27791 llvm-svn: 289878
* [compiler-rt] Do not introduce __sanitizer namespace globallyAnna Zaks2016-09-151-0/+2
| | | | | | | | | | | | The definitions in sanitizer_common may conflict with definitions from system headers because: The runtime includes the system headers after the project headers (as per LLVM coding guidelines). lib/sanitizer_common/sanitizer_internal_defs.h pollutes the namespace of everything defined after it, which is all/most of the sanitizer .h and .cc files and the included system headers with: using namespace __sanitizer; // NOLINT This patch solves the problem by introducing the namespace only within the sanitizer namespaces as proposed by Dmitry. Differential Revision: https://reviews.llvm.org/D21947 llvm-svn: 281657
* [sanitizer] [SystemZ] Add ptrace support bits.Marcin Koscielnicki2016-04-261-2/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D19134 llvm-svn: 267548
* [sanitizer] [SystemZ] Add/fix kernel and libc type definitions.Marcin Koscielnicki2016-04-141-3/+7
| | | | | | | | | | | This is the first part of upcoming asan support for s390 and s390x. Note that there are bits for 31-bit support in this and subsequent patches - while LLVM itself doesn't support it, gcc should be able to make use of it just fine. Differential Revision: http://reviews.llvm.org/D18888 llvm-svn: 266370
* [ASAN] Add support for mips/mips64 androidMohit K. Bhakkad2016-03-161-1/+1
| | | | | | | | | | | | Patch by Duane Sand Reviewers: samsonov Subscribers: duanesand, jaydeep, sagar, llvm-commits, filcab. Differential Revision: http://reviews.llvm.org/D17883 llvm-svn: 263621
* [asan] Old Linux kernels (< 3.0) don't define ARM_VFPREGS_SIZE that leads toYury Gribov2015-11-301-0/+8
| | | | | | | | | | build errors on ARM. Define it internally to avoid such errors. Patch by Max Ostapenko. Differential Revision: http://reviews.llvm.org/D14921 llvm-svn: 254292
* Fix #if tests for PTRACE_GETREGS and others.Jay Foad2015-11-111-3/+6
| | | | | | | | | | | | | | | | | | Summary: On PowerPC64 Linux PTRACE_GETREGS is a #define and PT_GETREGS is not. On other systems it's the other way round. Extend the #ifs to check for both PTRACE_* and PT_*. This fixes test/sanitizer_common/TestCases/Linux/ptrace.cc when msan is enabled for PowerPC64. Reviewers: zatrazz, kcc, eugenis, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14564 llvm-svn: 252730
* [compiler-rt] Enable ptrace sanitizer for armAdhemerval Zanella2015-10-261-5/+20
| | | | | | | | | | This patch enables the ptrace syscall interceptors for arm and adds support for both PTRACE_GETVFPREGS and PTRACE_SETVFPREGS used to get the VFP register from ARM. The ptrace tests is also updated with arm and PTRACE_GETVFPREGS tests. llvm-svn: 251321
* [asan] Zero initialize sem_t in sem_init.Evgeniy Stepanov2015-10-121-0/+5
| | | | | | | | | | Old version of sem_init (GLIBC_2.0) fails to initialize parts of sem_t that are used in sem_timedwait. This is fixed in GLIBC_2.1, but since ASan interceptors downgrade sem_* to the oldest available version, this can introduce bugs that are only present in sanitized build. Workaround by zero-initializing sem_t in sem_init. llvm-svn: 250113
* [sanitizer_common] Apply modernize-use-nullptr, other minor fixesVedant Kumar2015-09-301-25/+25
| | | | | | | | | | | | - Trim spaces. - Use nullptr in place of 0 for pointer variables. - Use '!p' in place of 'p == 0' for null pointer checks. Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13310 llvm-svn: 248964
* [MSan] Enable MSAN for aarch64Adhemerval Zanella2015-09-161-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enabled msan for aarch64 with 39-bit VMA and 42-bit VMA. As defined by lib/msan/msan.h the memory layout used is for 39-bit is: 00 0000 0000 - 40 0000 0000: invalid 40 0000 0000 - 43 0000 0000: shadow 43 0000 0000 - 46 0000 0000: origin 46 0000 0000 - 55 0000 0000: invalid 55 0000 0000 - 56 0000 0000: app (low) 56 0000 0000 - 70 0000 0000: invalid 70 0000 0000 - 80 0000 0000: app (high) And for 42-bit VMA: 000 0000 0000 - 100 0000 0000: invalid 100 0000 0000 - 11b 0000 0000: shadow 11b 0000 0000 - 120 0000 0000: invalid 120 0000 0000 - 13b 0000 0000: origin 13b 0000 0000 - 2aa 0000 0000: invalid 2aa 0000 0000 - 2ab 0000 0000: app (low) 2ab 0000 0000 - 3f0 0000 0000: invalid 3f0 0000 0000 - 400 0000 0000: app (high) Most of tests are passing with exception of: * Linux/mallinfo.cc * chained_origin_limits.cc * dlerror.cc * param_tls_limit.cc * signal_stress_test.cc * nonnull-arg.cpp The 'Linux/mallinfo.cc' is due the fact AArch64 returns the sret in 'x8' instead of default first argument 'x1'. So a function prototype that aims to mimic (by using first argument as the return of function) won't work. For GCC one can make a register alias (register var asm ("r8")), but for clang it detects is an unused variable and generate wrong code. The 'chained_origin_limits' is probably due a wrong code generation, since it fails only when origin memory is used (-fsanitize-memory-track-origins=2) and only in the returned code (return buf[50]). The 'signal_streess_test' and 'nonnull-arg' are due currently missing variadic argument handling in memory sanitizer code instrumentation on LLVM side. Both 'dlerror' and 'param_tls_test' are unknown failures that require further investigation. All the failures are XFAIL for aarch64 for now. llvm-svn: 247809
* Unbreak building on FreeBSD.Roman Divacky2015-09-101-1/+3
| | | | llvm-svn: 247347
* [msan] Unpoison dlpi_phdr in dl_iterate_phdr.Evgeniy Stepanov2015-09-081-0/+4
| | | | | | | | | | | In some cases, PHDR table is allocated with malloc() by the linker instead of being mapped from file. It needs to be unpoisoned in the dl_iterate_phdr callback then. This happens when program headers are not part of any loadable ELF segment. llvm-svn: 247100
* [msan] Teach sanitizers about the PPC64 ptrace syscallJay Foad2015-06-251-5/+11
| | | | | | | | | | | | | | | | | Summary: This fixes test/msan/Linux/syscalls.cc, and should also fix the ppc64 sanitizer buildbots which are currently failing in "make check-sanitizer". Reviewers: samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10734 llvm-svn: 240692
* Working on reconciling out-of-tree patches to compiler-rt for building for iOS.Chris Bieneman2015-06-231-3/+6
| | | | | | | | | | | | | | | | | | | Summary: This is one of many changes needed for compiler-rt to get it building on iOS. This change ifdefs out headers and functionality that aren't available on iOS. Note: this change does not enable building for iOS, as there are more changes to come. Reviewers: glider, kubabrecka, bogner, samsonov Reviewed By: samsonov Subscribers: samsonov, llvm-commits Differential Revision: http://reviews.llvm.org/D10514 llvm-svn: 240468
* [msan] Intercept fopencookie.Evgeniy Stepanov2015-06-191-0/+6
| | | | | | https://code.google.com/p/memory-sanitizer/issues/detail?id=86 llvm-svn: 240107
* [ASan] Only include rpc headers if they are available.Yury Gribov2015-04-091-2/+6
| | | | | | Reviewed at http://reviews.llvm.org/D8698 llvm-svn: 234470
* Allow sanitizer to work with "old" kernel headersRenato Golin2015-02-241-1/+1
| | | | | | | | | | | | | | Sanitizers work on ancient kernels and were depending on types existing. When those types were removed, the sanitizer build broke. See bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59009 for more information. This patch fixes it by isolating the need for those types only when the feature is actually needed, thus allowing one to compile the kernel with or without that change, irrespective of its version. Patch by Christophe Lyon. llvm-svn: 230324
* [MSan][MIPS] Fix for some failing tests on MIPS64Mohit K. Bhakkad2015-02-181-3/+14
| | | | | | | | | | | | | | Enabling internal ptrace for mips, which fixes some ptrace related tests. Along with this fixing some other failures. Reviewers: Reviewers: eugenis, kcc, samsonov Subscribers: dsanders, sagar, lldb-commits Differential Revision: http://reviews.llvm.org/D7332 llvm-svn: 229656
* Remove inclusion of netinet/ip_compat.h for FreeBSD. This header is notDimitry Andric2015-02-171-1/+0
| | | | | | | | | | | | | always available, and nothing in sanitizer_platform_limits_posix.cc uses any of its definitions. See also: https://svnweb.freebsd.org/changeset/base/277201 Reviewers: kcc, kutuzov.viktor.84, samsonov Reviewed By: samsonov Differential Revision: http://reviews.llvm.org/D7486 llvm-svn: 229518
* [sanitizer] Fix aarch64 sanitizer build with recent glibcKostya Serebryany2015-01-211-0/+6
| | | | | | | | | | | | | | | | | | glibc recently changed ABI on aarch64-linux: https://sourceware.org/git/?p=glibc.git;a=commit;h=5c40c3bab2fddaca8cfe12d75944d1fef8adf1a4 Instead of having unsigned short mode; unsigned short __pad1; it now has unsigned int mode; field in ipc_perm structure. This patch allows to build against the recent glibc and disables the ipc_perm.mode verification for older versions of glibc. I think it shouldn't be a big deal even for older glibcs, I couldn't find any place which would actually care about the exact mode field, rather than the whole structure, appart from the CHECK_SIZE_AND_OFFSET macro. Patch by Jakub Jelinek llvm-svn: 226637
* [sanitizer] Disable compile-time checks for __kernel_old_uid_t size on aarch64.Evgeniy Stepanov2014-12-101-0/+4
| | | | | | Should fix PR21476. llvm-svn: 223925
* [sanitizer] Fix build with _FILE_OFFSET_BITS=64.Evgeniy Stepanov2014-10-211-0/+8
| | | | | | | Sanitizer source is not affected by _FILE_OFFSET_BITS in general, but this one file must be built with 32-bit off_t. More details in the code. llvm-svn: 220328
* Fix compiler-rt build on FreeBSD 10.1Ed Maste2014-10-141-3/+7
| | | | | | | | | | | | | | | We have to #define _WANT_RTENTRY to get struct rtentry, and add headers that it depends on. SIOCADDRT and SIOCDELRT also do not exist in FreeBSD 10.1 and were removed in FreeBSD rev. 263203: Garbage collect long time obsoleted (or never used) stuff from routing API. Differential Revision: http://reviews.llvm.org/D5703 llvm-svn: 219722
* [sanitizer] Fix global constructor warning in sanitizer; patch by Samuel F ↵Kostya Serebryany2014-09-161-1/+1
| | | | | | Antao llvm-svn: 217904
* [asan] i686-linux-android support.Evgeniy Stepanov2014-07-031-1/+2
| | | | | | | | | | | | Large part of this change is required due to https://code.google.com/p/android/issues/detail?id=61799 dlsym() crashes when symbol resolution fails, which means we have to limit the interceptor list instead of relying on runtime detection. There are minor differencies in system headers, too. llvm-svn: 212273
* [sanitizer] Intercept pthread_*attr_get*.Evgeniy Stepanov2014-06-191-0/+4
| | | | | | This is a resubmit of r211166 reverted due to osx breakage. llvm-svn: 211264
OpenPOWER on IntegriCloud