Commit Graph

82 Commits

Author SHA1 Message Date
Alexey Samsonov 9f6218bf44 PR17977: don't assume EOWNERDEAD is always defined
Summary: See details in http://llvm.org/bugs/show_bug.cgi?id=17977

Reviewers: dvyukov

Reviewed By: dvyukov

CC: glider, llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2340

llvm-svn: 196779
2013-12-09 13:21:43 +00:00
Evgeniy Stepanov b56c5cd95e [sanitizer] Intercept times.
llvm-svn: 195918
2013-11-28 14:41:22 +00:00
Evgeniy Stepanov 39cc337e20 [sanitizer] Change the way we use certain linux kernel headers.
Some linux headers are broken on older kernels.
Instead of depending on the constants and types from such headers directly,
we provide our own definitions and then verify them with compile-time
assertions. This makes the dependency on the headers test-only and would allow
switching to some other way of testing on older kernels, or even disable the
tests as the last resort (after all, kernel interfaces are supposed to be
stable).

llvm-svn: 195427
2013-11-22 09:01:50 +00:00
Bob Wilson 99d8fa92c3 Remove #include of net/ip_mroute.h for SANITIZER_MAC.
This header has not been supported at all for the last 2 major OS X releases.
Removed its include and the capture of related symbols.

<rdar://problem/15303348>

llvm-svn: 194841
2013-11-15 19:13:08 +00:00
Dmitry Vyukov 4bbe6dc8a9 tsan: add support for robust mutexes
llvm-svn: 194823
2013-11-15 16:58:12 +00:00
Kostya Serebryany 82d0679e92 [asan] attempting to fix x32 build (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59018)
llvm-svn: 194155
2013-11-06 17:47:39 +00:00
Evgeniy Stepanov 2335879ff1 [sanitizer] Enhance io_submti syscall handler.
llvm-svn: 193848
2013-11-01 01:20:39 +00:00
Alexander Potapenko ac501f0250 [libsanitizer] Define SANITIZER_IOS when building for iOS or iOS simulator.
Do not use struct stat64 and struct statfs64 when building for iOS, where __DARWIN_ONLY_64_BIT_INO_T is set to 1.

llvm-svn: 193775
2013-10-31 17:38:18 +00:00
Evgeniy Stepanov 60db142d86 [asan] Fix syscall hooks build on Android.
llvm-svn: 193670
2013-10-30 00:58:17 +00:00
Evgeniy Stepanov 477f8b73a5 [sanitizer] Ptrace syscall handler.
llvm-svn: 193633
2013-10-29 17:59:45 +00:00
Evgeniy Stepanov 451c8de2d8 [msan] Intercept shmat.
llvm-svn: 193581
2013-10-29 02:48:49 +00:00
Evgeniy Stepanov f312b480e2 [sanitizer] Intercept shmctl.
llvm-svn: 193348
2013-10-24 14:47:34 +00:00
Evgeniy Stepanov 3e6064f9d2 [sanitizer] Intercept ether_* functions.
llvm-svn: 193241
2013-10-23 13:57:47 +00:00
Alexander Potapenko e45ca59fd9 [ASan] fix compilation of sanitizer_platform_limits_posix.cc on OSX.
llvm-svn: 192975
2013-10-18 14:16:54 +00:00
Evgeniy Stepanov 78c5730bec [sanitizer] Fix OSX build some more.
llvm-svn: 192967
2013-10-18 12:19:23 +00:00
Evgeniy Stepanov b4e501c6ec [sanitizer] Fix OSX build.
llvm-svn: 192966
2013-10-18 11:26:02 +00:00
Evgeniy Stepanov 3cb9df042e [sanitizer] Move statfs/fstatfs to common interceptors and add statvfs/fstatvfs.
llvm-svn: 192965
2013-10-18 11:14:16 +00:00
Evgeniy Stepanov 70d5abfba2 [sanitizer] Intercept getmntent, getmntent_r.
llvm-svn: 192959
2013-10-18 09:41:43 +00:00
Alexey Samsonov edecc38395 Make some pthread_mutex_* and pthread_cond_* interceptors common.
Reviewers: eugenis, dvyukov

Reviewed By: dvyukov

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1937

llvm-svn: 192774
2013-10-16 08:20:31 +00:00
Evgeniy Stepanov c907a60ffb [sanitizer] Fix localtime and gmtime interceptors to clean tm->tm_zone.
llvm-svn: 191827
2013-10-02 14:30:03 +00:00
Alexey Samsonov 4fc53e4c06 [Sanitizer] Don't include wordexp.h on Android
llvm-svn: 191358
2013-09-25 07:41:46 +00:00
Evgeniy Stepanov 2761ee0409 [sanitizer] Intercept wordexp.
llvm-svn: 191305
2013-09-24 14:38:22 +00:00
Evgeniy Stepanov 73166796a3 [sanitizer] Avoid including any system headers in the system-header-free part of the runtime library.
llvm-svn: 190161
2013-09-06 15:34:17 +00:00
Evgeniy Stepanov 5c1035e7fa [sanitizer] A bunch of linux system call handlers.
llvm-svn: 190157
2013-09-06 14:20:01 +00:00
Evgeniy Stepanov a40a058ff1 [sanitizer] Simplify sigaction and sigset_t handling.
llvm-svn: 189338
2013-08-27 11:10:04 +00:00
Chandler Carruth 022a3d4e88 Revert r188369 (and r188455) which breaks the build on at least some
Linux systems. I've replied on the original commit thread with details
of the problem.

llvm-svn: 188628
2013-08-18 08:47:06 +00:00
Evgeniy Stepanov 0bb7577d89 [sanitizer] Split platform_limits_posix into system- and kernel-dependent parts.
This change moves everything depending on kernel headers (mostly ioctl types
and ids) into a separate source file. This will reduce the possibility of
header conflict on various platforms (most importantly, older glibc versions).

This change also removes 2 deprecated ioctls, and symbolic ids for other bunch
of ambiguous ioctls (i.e. same id is shared by ioctls with different memory
behavior).

llvm-svn: 188369
2013-08-14 13:34:14 +00:00
Evgeniy Stepanov 64cace0687 [sanitizer] Intercept poll/ppoll.
llvm-svn: 188177
2013-08-12 13:19:53 +00:00
Alexey Samsonov eb7973246f [ASan] Bump min supported Mac OS X version to 10.6
llvm-svn: 186404
2013-07-16 11:54:40 +00:00
Timur Iskhodzhanov d7eb67774e Fix check_lint warnings in sanitizers' runtime libraries
llvm-svn: 186328
2013-07-15 16:11:39 +00:00
Chandler Carruth 1a48dc5ed6 Fix a veritable conucopia of bugs in the readdir_r interceptors.
First, the reason I came here: I forgot to look at readdir64_r which had
the exact same bug as readdir_r. However, upon applying the same
quick-fix and testing it I discovered that it still didn't work at all.
As a consequence, I spent some time studying the code and thinking about
it and fixed several other problems.

Second, the code was checking for a null entry and result pointer, but
there is no indication that null pointers are viable here. Certainly,
the spec makes it extremely clear that there is no non-error case where
the implementation of readdir_r fails to dereference the 'result'
pointer and store NULL to it. Thus, our checking for a non-null 'result'
pointer before reflecting that write in the instrumentation was
trivially dead. Remove it.

Third, the interceptor was marking the write to the actual dirent struct
by looking at the entry pointer, but nothing in the spec requires that
the dirent struct written is actually written into the entry structure
provided. A threadlocal buffer would be just as conforming, and the spec
goes out of its way to say the pointer to the *actual* result dirent
struct is stored into *result, so *that* is where the interceptor should
reflect a write occuring. This also obviates the need to even consider
whether the 'entry' parameter is null.

Fourth, I got to the bottom of why nothing at all worked in readdir64_r
-- the interceptor structure for dirent64 was completely wrong in that
it was the same as dirent. I fixed this struct to be correct (64-bit
inode and 64-bit offset! just a 64-bit offset isn't enough!) and added
several missing tests for the size and layout of this struct.

llvm-svn: 186109
2013-07-11 18:51:40 +00:00
Evgeniy Stepanov 9240838655 [sanitizer] More checks in mbstowcs-like interceptors.
llvm-svn: 186004
2013-07-10 14:17:46 +00:00
Evgeniy Stepanov faba61a7bc [sanitizer] Support GLOB_ALTDIRFUNC in glob interceptor.
llvm-svn: 185932
2013-07-09 12:07:59 +00:00
Evgeniy Stepanov 77ef78a0a5 [sanitizer] Intercept realpath and canonicalize_file_name.
Handle realpath(path, NULL) form.

llvm-svn: 185921
2013-07-09 09:53:37 +00:00
Evgeniy Stepanov 628d727749 [msan] Intercept pthread_key_create.
llvm-svn: 185693
2013-07-05 12:31:07 +00:00
Evgeniy Stepanov 0d1d35aeba [sanitizer] Disable ptrace interception on non-x86(_64).
Patch by Hal Finkel.

llvm-svn: 185686
2013-07-05 08:57:47 +00:00
Evgeniy Stepanov 1bd0fe447f [sanitizer] Fix Android build.
llvm-svn: 185432
2013-07-02 14:51:31 +00:00
Evgeniy Stepanov 69a387e6ae [sanitizer] Fix GLOB_NOMATCH behaviour and refactor the interceptor a bit.
llvm-svn: 185428
2013-07-02 14:08:52 +00:00
Evgeniy Stepanov d6e856f722 [sanitizer] Fix build with older kernels.
PTRACE_SETREGSET & PTRACE_GETREGSET may be missing from linux headers.

llvm-svn: 185317
2013-07-01 09:10:34 +00:00
Evgeniy Stepanov a127039258 [sanitizer] Disable all ptrace-related definitions on Android.
llvm-svn: 185150
2013-06-28 14:18:10 +00:00
Evgeniy Stepanov 4aef0ee57d [sanitizer] Fix an unfortunate typo and disable ptrace interception on Android.
llvm-svn: 185145
2013-06-28 12:16:03 +00:00
Evgeniy Stepanov dec0f76c14 [sanitizer] Intercept ptrace.
llvm-svn: 185142
2013-06-28 11:02:43 +00:00
Evgeniy Stepanov 815d3232a7 [sanitizer] Fix dirent interceptors.
The new version reads d_reclen for (struct dirent) size.

llvm-svn: 185067
2013-06-27 09:37:27 +00:00
Evgeniy Stepanov 06d6c25141 [sanitizer] readdir and readdir_r interceptors.
llvm-svn: 184950
2013-06-26 15:00:53 +00:00
Evgeniy Stepanov 2c7d4d379e [sanitizer] Fix build with OSS4 kernel headers.
This fixes PR16453.

llvm-svn: 184925
2013-06-26 08:16:38 +00:00
Evgeniy Stepanov 60d964d4f2 [sanitizer] Intercept sysinfo.
llvm-svn: 184739
2013-06-24 14:25:33 +00:00
Evgeniy Stepanov 02a7460d12 [sanitizer] Intercept inet_aton.
llvm-svn: 184735
2013-06-24 13:56:14 +00:00
Evgeniy Stepanov 57a40e5a94 [santizer] Disable several EVIOxxx ioctls on older kernels.
llvm-svn: 184539
2013-06-21 10:54:57 +00:00
Evgeniy Stepanov fbea5b95c6 [sanitizer] Handle EVIOxxxx ioctls.
llvm-svn: 184405
2013-06-20 09:19:28 +00:00
Evgeniy Stepanov 49b4314cfd [sanitizer] Fix struct ifconf definition on Mac and restore the size checks.
llvm-svn: 184296
2013-06-19 13:21:38 +00:00