-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace vfork() with fork() #925
Comments
Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes google/sanitizers#925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 llvm-svn=327752
Fixed by https://reviews.llvm.org/D44587, r327752. |
I've reverted the fix for performance concerns. Apparently, fork() is not nearly as fast as vfork(). Now, the next plan is to intercept vfork() and unpoison the unallocated part of the stack in the parent process after the child is done. But there is a catch - vfork() can not be intercepted. Not in C, in any case. That is because the spec says the child is not allowed to return from a function that called vfork(), and interceptor itself would be such a function. Returning from the caller of vfork messes up parent's stack - effectively, the caller returns twice from its point of view. We might be able to implement an interceptor in assembly, either by |
Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes google/sanitizers#925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 Change-Id: I163aa74830053caef97c9e7c6946bc44bb56bdba git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327752 91177308-0d34-0410-b5e6-96231b3b80d8 Signed-off-by: mydongistiny <jaysonedson@gmail.com>
Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes google/sanitizers#925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 Change-Id: I163aa74830053caef97c9e7c6946bc44bb56bdba git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327752 91177308-0d34-0410-b5e6-96231b3b80d8 Signed-off-by: mydongistiny <jaysonedson@gmail.com>
commit 0b2455d60eae3577ad2d410467a570571d037d85 Author: Pirama Arumuga Nainar <pirama@google.com> Date: Tue Apr 10 10:36:14 2018 -0700 Add option to disable linking of libcxx into fuzzer Summary: The ability to partially link libcxx into fuzzer does not work for cross compilations. CMAKE_EXE_LINKER_FLAGS, etc are not passed to the custom CMake invocation and cross-compiling libcxx without a libcxxabi, as is done here, has further issues as well. Add an option to disable linking of libcxx into fuzzer. The default for this option is to link libcxx. Reviewers: srhines, chh, phosek, EricWF Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44532 commit 68186437fef3fc9da71782da211c8fc459a3e604 Author: Yi Kong <yikong@google.com> Date: Mon Dec 18 11:55:00 2017 -0800 Expand ALL_FUZZER_SUPPORTED_ARCH to include all Android supported archs Upstream it declares X86 as the only supported libfuzzer arch, to prevent issues with cross compilation. This change adds all the Android supported archs to ALL_FUZZER_SUPPORTED_ARCH. We need to figure out a way to upstream a proper fix for this. Bug: 70819574 Change-Id: Idb14a04e9ab706ae089710335b90a738d8749460 commit 83844e0b98d6a0b8dc1a4e831ea620fe227029b5 Merge: 22214af2d 13c69d3bc Author: Pirama Arumuga Nainar <pirama@google.com> Date: Mon Apr 9 23:49:33 2018 -0700 Merge commit 13c69d3bcd85 - upstream svn@328849 Test: git diff 13c69d3bcd85 == git diff 2d6790829bc8 6a52b697d56 Change-Id: I79ba9963edfa29b1349c1fc131294eb0edaedcff commit 22214af2dcd25e9150e5b7399bdebf5cd150cbd8 Author: Pirama Arumuga Nainar <pirama@google.com> Date: Mon Apr 9 23:48:36 2018 -0700 Revert to previoius base 2d6790829bc8 Test: git diff 2d6790829bc8 Change-Id: I721b907e03c4d6791dfbd69e66a46cae07a39257 commit 13c69d3bcd85a38da14fd28322b0b2f8b675d943 Author: Alex Shlyapnikov <alekseys@google.com> Date: Fri Mar 30 00:03:36 2018 +0000 [ASan] Disable new ASan error reporting tests on various ARMs. As many other ASan tests already, has to disable these failing tests on arm, armhf and aarch64 configs. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328849 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9d7af14084ce6fb61c13938c8f56d491d5013e2f Author: Dan Liew <dan@su-root.co.uk> Date: Thu Mar 29 13:53:50 2018 +0000 [asan] Split the `throw_invoke_test.cc` into a Linux specific variant and the general version to avoid use of libstdc++ on non-Linux platforms. This is motivated by the fact that using `libstdc++` is deprecated on Darwin and maybe removed some day. Differential Revision: https://reviews.llvm.org/D44733 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328775 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2042980a5df0017a2c1b228ab1241743d2e21ccf Author: Alex Shlyapnikov <alekseys@google.com> Date: Thu Mar 29 02:18:57 2018 +0000 [ASan] Disable aligned_alloc-alignment.cc on PPC64. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328753 91177308-0d34-0410-b5e6-96231b3b80d8 commit ac9149c80600e4c6952c3df849358d67d8e11a54 Author: Alex Shlyapnikov <alekseys@google.com> Date: Thu Mar 29 00:09:12 2018 +0000 [ASan] Disable aligned_alloc-alignment.cc on ppc64be Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328742 91177308-0d34-0410-b5e6-96231b3b80d8 commit ff9c056a0fd6585de070a0c088eac14222ccc967 Author: Alex Shlyapnikov <alekseys@google.com> Date: Wed Mar 28 23:01:04 2018 +0000 [ASan] Disable aligned_alloc-alignment.cc test on gcc. This check "CHECK: {{#0 0x.* in .*aligned_alloc}}" fails on ppc64be, gcc build. Disabling the test for gcc for now. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328741 91177308-0d34-0410-b5e6-96231b3b80d8 commit e3435fdbc7cebcee5087739f657dce99641e80aa Author: Alex Shlyapnikov <alekseys@google.com> Date: Wed Mar 28 22:00:08 2018 +0000 [ASan] Disable aligned_alloc-alignment.cc on Android. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328734 91177308-0d34-0410-b5e6-96231b3b80d8 commit 85f074e7256b2a434f7663d56e9a11f21c466d5e Author: Alex Shlyapnikov <alekseys@google.com> Date: Wed Mar 28 19:53:55 2018 +0000 [ASan] Add aligned_alloc declaration to aligned_alloc-alignment.cc test. aligned_alloc is not always defined in headers. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328726 91177308-0d34-0410-b5e6-96231b3b80d8 commit 85f6bace7a20b03d7a754d83a1b655b504eee0e3 Author: Alex Shlyapnikov <alekseys@google.com> Date: Wed Mar 28 18:22:40 2018 +0000 [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ing Summary: Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, not stack, no details, not too helpful nor informative. To improve the situation, ASan detailed errors were defined and reported under the appropriate conditions. Issue: https://github.com/google/sanitizers/issues/887 Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328722 91177308-0d34-0410-b5e6-96231b3b80d8 commit d2575a962bced93ad1d1bc9c6551b9f54ccd71ef Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Wed Mar 28 00:45:20 2018 +0000 [asan] Add vfork to the list of reasons for stack errors. Until we figure out what to do with it, vfork can cause stack-based false positives. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328681 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0c41e4c8cf77ed9fb28114cfaf430ac34e6c6e9c Author: Alex Shlyapnikov <alekseys@google.com> Date: Tue Mar 27 17:45:53 2018 +0000 [HWASan] Make use-after-free c, not c++ test. To minimize testing surface (remove libstdc++ from the picture, for one), make use-after-free c, not c++ test. Differential Revision: https://reviews.llvm.org/D44705 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328646 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7741c0b35bb33e852c9e4bdfa1b71233a2e294eb Author: Matt Morehouse <mascasa@google.com> Date: Tue Mar 27 16:40:34 2018 +0000 [libFuzzer] Disable optimization for exit_on_src_pos.test. Test fails on Darwin with -O2. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328634 91177308-0d34-0410-b5e6-96231b3b80d8 commit dd22916b45f7624acd28fe614544a8206bed7ddd Author: Matt Morehouse <mascasa@google.com> Date: Tue Mar 27 16:40:20 2018 +0000 [libFuzzer] Place volatile after pointer types. For a few tests, volatile was placed before the '*' in pointer declarations, resulting in it applying to the underlying data rather than the pointer itself. Placing volatile after the '*' allows us to switch those tests to -O2. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328633 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9d924ab8a5ce9dfebbdb1d04c715a2a5bb80c8b6 Author: Alex Shlyapnikov <alekseys@google.com> Date: Tue Mar 27 16:04:40 2018 +0000 [HWASan] Relax use-after-free.cc test matching rules. Relax use-after-free.cc test matching rules to cover more malloc/free interceptor names variations. Differential Revision: https://reviews.llvm.org/D44705 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328630 91177308-0d34-0410-b5e6-96231b3b80d8 commit d3a94d4f000fcb48d36db18ac6e8b652db371e96 Author: Kostya Kortchinsky <kostyak@google.com> Date: Tue Mar 27 14:40:39 2018 +0000 [scudo] Fuchsia minimal shared runtime Summary: Fuchsia requires its Scudo shared runtime to not be C++ dependant. Since they don't use UBSan in conjunction with Scudo, we can just remove the runtime, and add the extra `nostdinc++` and `nostdlib++` flags. No need for Coverage either. This allows to keep things going while working on additional splits of sanitizer_commong and a more minimal runtime. Reviewers: phosek, flowerhack, alekseyshl Reviewed By: phosek, alekseyshl Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44791 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328625 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4637a721ec1e9399c884a941d71d966bd0c1af74 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Tue Mar 27 00:31:16 2018 +0000 Revert "[asan] Replace vfork with fork." Replacing vfork with fork results in significant slowdown of certain apps (in particular, memcached). This reverts r327752. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328600 91177308-0d34-0410-b5e6-96231b3b80d8 commit d7962b9d3455e69f0fd558d6226d9c70d711740e Author: Matt Morehouse <mascasa@google.com> Date: Mon Mar 26 19:36:20 2018 +0000 [libFuzzer] Do not optimize minimize_two_crashes.test. Speculative fix for build bot breakage on Mac. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328576 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1e64638ed164f0981d2c8987c104590339fbff3d Author: Vitaly Buka <vitalybuka@google.com> Date: Mon Mar 26 01:29:48 2018 +0000 [sanitizer] Make test compatible with Darwin git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328467 91177308-0d34-0410-b5e6-96231b3b80d8 commit c98416104dcbc5b7a6251ab9a0ccbc929d9c7868 Author: Vitaly Buka <vitalybuka@google.com> Date: Sat Mar 24 08:13:18 2018 +0000 [sanitizer] Fix Darwin build git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328417 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6a3cda135ae93355184917e134e0026348925a0f Author: Vitaly Buka <vitalybuka@google.com> Date: Sat Mar 24 07:45:24 2018 +0000 Mmap interceptor providing mprotect support Summary: - Intercepting mprotect calls. - Fixing forgotten flag check. Patch by David CARLIER Reviewers: vitalybuka, vsk Subscribers: delcypher, srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44777 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328415 91177308-0d34-0410-b5e6-96231b3b80d8 commit 69eddd514afd59184bb25f87dff8880144395fb7 Author: Vitaly Buka <vitalybuka@google.com> Date: Sat Mar 24 07:31:59 2018 +0000 [sanitizer] Fix strlcpy and strlcat interceptors on Darwin git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328414 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4151745865d9ea591f2287d050c61d2314e0fe09 Author: Alex Shlyapnikov <alekseys@google.com> Date: Sat Mar 24 02:10:49 2018 +0000 [HWASan] Fix use-after-free.cc test on x86-64 Differential Revision: https://reviews.llvm.org/D44705 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328407 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4c143ffe63116f76af629d9daa471daebdfcd17c Author: Alex Shlyapnikov <alekseys@google.com> Date: Sat Mar 24 00:40:51 2018 +0000 Remove duplicated const qualifier. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328403 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2f90bfba89ad7ac272dcb1cae064681fce98f1b9 Author: Alex Shlyapnikov <alekseys@google.com> Date: Fri Mar 23 23:38:04 2018 +0000 [HWASan] Port HWASan to Linux x86-64 (compiler-rt) Summary: Porting HWASan to Linux x86-64, first of the three patches, compiler-rt part. The approach is similar to ARM case, trap signal is used to communicate memory tag check failure. int3 instruction is used to generate a signal, access parameters are stored in nop [eax + offset] instruction immediately following the int3 one Had to add HWASan init on malloc because, due to much less interceptors defined (most other sanitizers intercept much more and get initalized via one of those interceptors or don't care about malloc), HWASan was not initialized yet when libstdc++ was trying to allocate memory for its own fixed-size heap, which led to CHECK-fail in AllocateFromLocalPool. Also added the CHECK() failure handler with more detailed message and stack reporting. Reviewers: eugenis Subscribers: kubamracek, dberris, mgorny, kristof.beyls, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44705 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328385 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0691287972d44894b7fa3ca57af9c03133e45d26 Author: Matt Morehouse <mascasa@google.com> Date: Fri Mar 23 23:35:28 2018 +0000 [libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer. Summary: Disables certain CMP optimizations to improve fuzzing signal under -O1 and -O2. Switches all fuzzer tests to -O2 except for a few leak tests where the leak is optimized out under -O2. Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D44798 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328384 91177308-0d34-0410-b5e6-96231b3b80d8 commit f40efdb90fed2c5d01b17677c9603bf5f1d19b60 Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 23 21:44:59 2018 +0000 FreeBSD sanitizer common, intercept couple of more functions Summary: Intercepts lstat, acct, access, faccessat and strlcpy/strlcat Patch by David CARLIER Reviewers: visa, vitalybuka Subscribers: krytarowski, fedor.sergeev, srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44432 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328376 91177308-0d34-0410-b5e6-96231b3b80d8 commit 132d1ff971cc7e7b8930107388f9806bb2feb00e Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 23 21:44:59 2018 +0000 Revert "Mmap interceptor providing mprotect support" Breaks Darwin. This reverts commit r328369. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328375 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5b515098cbfff3f1102b63e3a63bfdc4b22cbf64 Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 23 20:59:51 2018 +0000 Mmap interceptor providing mprotect support Summary: - Intercepting mprotect calls. - Fixing forgotten flag check. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44777 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328369 91177308-0d34-0410-b5e6-96231b3b80d8 commit abcc3f0e5b31873a8479a3b81a17439987b357f7 Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 23 00:15:10 2018 +0000 [sanitizer] Fix PPC bot git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328279 91177308-0d34-0410-b5e6-96231b3b80d8 commit 51461d68f54a4003586b3e387ce9e92542b0f70f Author: Petr Hosek <phosek@chromium.org> Date: Thu Mar 22 23:58:37 2018 +0000 [sanitizer] zx_vmo_write on Fuchsia takes only 4 arguments now The system call now fails when it cannot write the requested size. Update the sanitizer runtime Fuchsia implementation accordingly. Differential Revision: https://reviews.llvm.org/D44770 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328273 91177308-0d34-0410-b5e6-96231b3b80d8 commit d794921df40c9c8df2f43270789fb966012c4cee Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 22 20:42:28 2018 +0000 More OpenBSD fixes Summary: - Use internal_syscall_ptr in internal_readlink - use sigcontext on OpenBSD Patch by David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44713 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328239 91177308-0d34-0410-b5e6-96231b3b80d8 commit f8d3fb24f9a40efa40128a74ce919b9a2e88f13f Author: Kostya Kortchinsky <kostyak@google.com> Date: Thu Mar 22 15:04:31 2018 +0000 [sanitizer] Split coverage into separate RT in sanitizer_common Summary: `sanitizer_common`'s coverage support is fairly well separated, and libcdep by default. Several sanitizers don't make use of coverage, and as far as I can tell do no benefit from the extra dependencies pulled in by the coverage public interface functions. The following sanitizers call `InitializeCoverage` explicitely: MSan, ASan, LSan, HWAsan, UBSan. On top of this, any sanitizer bundling RTUBSan should add the coverage RT as well: ASan, Scudo, UBSan, CFI (diag), TSan, MSan, HWAsan. So in the end the following have no need: DFSan, ESan, CFI, SafeStack (nolibc anyway), XRay, and the upcoming Scudo minimal runtime. I tested this with all the sanitizers check-* with gcc & clang, and in standalone on Linux & Android, and there was no issue. I couldn't test this on Mac, Fuchsia, BSDs, & Windows for lack of an environment, so adding a bunch of people for additional scrunity. I couldn't test HWAsan either. Reviewers: eugenis, vitalybuka, alekseyshl, flowerhack, kubamracek, dberris, rnk, krytarowski Reviewed By: vitalybuka, alekseyshl, flowerhack, dberris Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44701 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328204 91177308-0d34-0410-b5e6-96231b3b80d8 commit 351f235ea4d0bfa17b65dd3a0ac14bbd8a98b90b Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 21 21:25:07 2018 +0000 Mmap interceptor new option, Write Exec runtime detector Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328151 91177308-0d34-0410-b5e6-96231b3b80d8 commit 52411af60152548a1f25237339abaf2b9db0fbba Author: George Karpenkov <ekarpenkov@apple.com> Date: Wed Mar 21 17:55:36 2018 +0000 [libFuzzer] Disable equivalence-signals test on Darwin due to persistent failures git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328125 91177308-0d34-0410-b5e6-96231b3b80d8 commit 402d59575d5ffd2eb8ea0ca7d78661bbabffb8b5 Author: Nemanja Ivanovic <nemanja.i.ibm@gmail.com> Date: Wed Mar 21 11:58:37 2018 +0000 [PowerPC] Disable failing dynamic tls test cases Due to recent kernel upgrades, these test case fail on PowerPC buildbots. This is a known problem on affected kernels. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328091 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9596e209a0ad212d0fdedcd41852f3039c6cd54c Author: Dmitry Vyukov <dvyukov@google.com> Date: Wed Mar 21 09:26:29 2018 +0000 tsan: fix darwin build after 328079 328079 introduced a weak hook without default implementation. This broke darwin build: http://green.lab.llvm.org/green//job/clang-stage1-configure-RA/43731/consoleFull#-119213188149ba4694-19c4-4d7e-bec5-911270d8a58c Provide default impl for the hook. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328082 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6f6e03a3c09e31ff6fda4ad9f215ca0c6d495d34 Author: Dmitry Vyukov <dvyukov@google.com> Date: Wed Mar 21 08:44:14 2018 +0000 tsan: support inlined frames in external symbolization New API passes a callback function to the external symbolizer, allowing it to add multiple frames to the traceback. Note that the old interface API will be still supported until the clients migrate to the new one. Author: asmundak (Alexander Smundak) Reviewed in: https://reviews.llvm.org/D44714 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328079 91177308-0d34-0410-b5e6-96231b3b80d8 commit def0ac6300d4511350d7abbb883f42faf708a132 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 21 07:50:02 2018 +0000 Fix declaration of environ after r327923 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328077 91177308-0d34-0410-b5e6-96231b3b80d8 commit db8db463f2c29aa2468f3e4b4a7866ff35f1a445 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Fri Mar 16 22:15:05 2018 +0000 [asan] Replace vfork with fork. Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes https://github.com/google/sanitizers/issues/925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 Change-Id: I163aa74830053caef97c9e7c6946bc44bb56bdba git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327752 91177308-0d34-0410-b5e6-96231b3b80d8 commit a70e78d7e227e7dd22a08dd73d3345854273cadf Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Fri Mar 16 21:31:49 2018 +0000 [asan] Remove empty fork interceptor. After a partial revert, ASan somehow ended up with an empty interceptor for fork(). Change-Id: I1774d54fa3a2b391267e756dbd2271383f4e3174 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327748 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9725eed959002e12a6d96f9ea0c758456caf7150 Author: Mandeep Singh Grang <mgrang@codeaurora.org> Date: Tue Mar 20 01:17:18 2018 +0000 Revert "[compiler-rt] Change std::sort to llvm::sort in response to r327219" This reverts commit 2ee210e1963e03aacc0f71c50e4994bb5c66586e. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327936 91177308-0d34-0410-b5e6-96231b3b80d8 commit 789e1d7e04752d0c2df371b5acf13e9190ec1666 Author: Mandeep Singh Grang <mgrang@codeaurora.org> Date: Tue Mar 20 00:44:59 2018 +0000 [compiler-rt] Change std::sort to llvm::sort in response to r327219 Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Reviewers: kcc, rsmith, RKSimon, eugenis Reviewed By: RKSimon Subscribers: efriedma, kubamracek, dberris, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44360 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327929 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7dce3214a401e4e8b1a3ad04e79ae6c3dd0a8d1e Author: Vitaly Buka <vitalybuka@google.com> Date: Mon Mar 19 23:12:14 2018 +0000 OpenBSD UBsan support missing bits Summary: Lost bits since the WIP ticket Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: srhines, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44599 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327923 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5c4cd77db3a08587c6ac82a8e2c92cd4be0bc200 Author: Vitaly Buka <vitalybuka@google.com> Date: Mon Mar 19 20:44:06 2018 +0000 Cleanup of "extern char **environ" declaration git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327904 91177308-0d34-0410-b5e6-96231b3b80d8 commit 522a892efc2ff22a2fd421b1ef4d9d9739d78b2e Author: Vitaly Buka <vitalybuka@google.com> Date: Mon Mar 19 18:22:35 2018 +0000 Fix CMake/MSVC when compiler-rt and llvm are built separately Summary: For some reason CMake can't find the `append` macro if LLVM is built separately and imported via `LLVM_CONFIG_PATH`. Patch by Loo Rong Jie Reviewers: rnk, vitalybuka Reviewed By: rnk, vitalybuka Subscribers: dberris, mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43458 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327876 91177308-0d34-0410-b5e6-96231b3b80d8 commit ced3f2bc118b52e25c2da715cbf43315d599ceca Author: Vitaly Buka <vitalybuka@google.com> Date: Sat Mar 17 00:31:41 2018 +0000 Revert "Mmap interceptor new option, Write Exec runtime detector" Breaks Android bot. This reverts commit r327747. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327762 91177308-0d34-0410-b5e6-96231b3b80d8 commit d7241395e6a8ddb73618dca61db1495c227354b8 Author: Petr Hosek <phosek@chromium.org> Date: Fri Mar 16 22:40:55 2018 +0000 [Fuzzer] Build the shared memory hooks for Fuchsia This is needed otherwise we'll get undefined references when trying to use the libFuzzer built for Fuchsia. Differential Revision: https://reviews.llvm.org/D44590 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327759 91177308-0d34-0410-b5e6-96231b3b80d8 commit 37e599c1fe0403f3c89e1755daa8e58401ddba0a Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 16 22:29:29 2018 +0000 OpenBSD UBsan support final missing bits Summary: One forgotten file change + reordering one header due to clang-format Patch by David CARLIER Reviewers: vitalybuka, vsk Subscribers: kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44556 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327758 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5fe72ccbb2c5733e929b146e23ba7c5aa16faab5 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Fri Mar 16 22:15:05 2018 +0000 [asan] Replace vfork with fork. Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes https://github.com/google/sanitizers/issues/925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327752 91177308-0d34-0410-b5e6-96231b3b80d8 commit da8ddca6ddbd7f12d73eb42c268f37a0c0a345c5 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Fri Mar 16 21:31:49 2018 +0000 [asan] Remove empty fork interceptor. After a partial revert, ASan somehow ended up with an empty interceptor for fork(). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327748 91177308-0d34-0410-b5e6-96231b3b80d8 commit f4140e284d9c82989841f94d9f916a2fc186da3e Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 16 21:25:09 2018 +0000 Mmap interceptor new option, Write Exec runtime detector Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327747 91177308-0d34-0410-b5e6-96231b3b80d8 commit 957b9624d6f70e4df40237dc6d41f9b2f8391c95 Author: Jonas Devlieghere <jonas@devlieghere.com> Date: Fri Mar 16 15:34:09 2018 +0000 Revert "Mmap interceptor new option, Write Exec runtime detector" This reverts r327696 because it is failing on GreenDragon. http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/43605/ http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10957/ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327719 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8ef4f556928c7090cc7d6b6bdf8a3ce948d8b658 Author: Dmitry Vyukov <dvyukov@google.com> Date: Fri Mar 16 10:20:58 2018 +0000 tsan: revert: Update buildgo.sh to pass -isysroot on Darwin. This commit breaks actual Go runtime build on gomote builders (10.12) with: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance Without this part build works fine. The original commit does not include any explanation as to why it is needed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327700 91177308-0d34-0410-b5e6-96231b3b80d8 commit 302ac21ae0e46fa549dc90cfa3d1c66519d77ea1 Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 16 08:23:33 2018 +0000 FreeBSD TSan support update Summary: - Disable thread_finalize callback on FreeBSD, fixing couple of unit tests. Patch by David CARLIER Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: emaste, kubamracek, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44156 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327697 91177308-0d34-0410-b5e6-96231b3b80d8 commit 84b43a132165c8a776aa570bf91809a496166bbe Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 16 08:22:18 2018 +0000 Mmap interceptor new option, Write Exec runtime detector Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327696 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8b6780e6f14939eeeeb343395b349310c5eb9cc7 Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 15 22:41:28 2018 +0000 MSan, FreeBSD few tests fixes Summary: pthread_getattr_np_deadlock support pthread_getname_np unsupported Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: eugenis, srhines, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44085 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327678 91177308-0d34-0410-b5e6-96231b3b80d8 commit 53dde8665ba7cca453b412ba4905f1b3fa6ad0c4 Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 15 22:40:47 2018 +0000 OpenBSD UBsan support procmaps Summary: procmaps OpenBSD specifics Patch by David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: mgorny, emaste, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44050 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327677 91177308-0d34-0410-b5e6-96231b3b80d8 commit c63595181aa235959cc67ce317d7c7b64e89223f Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 15 22:19:39 2018 +0000 OpenBSD UBsan support common functions Summary: Ripped off OpenBSD specific from the common Linux implementation Patch by David Carlier Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: emaste, srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44036 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327674 91177308-0d34-0410-b5e6-96231b3b80d8 commit bc44f95c352f593a12e211f129f2952fa876ded6 Author: Martin Pelikan <martin.pelikan@gmail.com> Date: Thu Mar 15 12:10:43 2018 +0000 [TSan] fix Go runtime test on amd64 with PIE Summary: Without this diff, the test segfaults. Examining the generated executable (which gets auto-deleted likely by cmake/ninja) yields this error message: ThreadSanitizer failed to allocate 0x4000 (16384) bytes at address 1755558480000 (errno: 12) Note that the address has more than 47 bits, which on amd64 means special treatment and therefore points out an overflow. The allocation came from __tsan_map_shadow on a .data pointer, which (on my work Debian-based box) means the 0x550000000000 range. This doesn't correspond to the constants mentioned in tsan_platform.h for Go binaries on Linux/amd64. The diff therefore allocates memory in the sort of area Go programs would, and prevents the test from crashing. It would be nice if reviewers kindly considered other setups and architectures :-) Reviewers: kcc, dvyukov Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44071 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327621 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5e073b42727f893199a07e7bd0e76c662314e29f Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 15 01:13:29 2018 +0000 [sanitizer] Fix off type in mmap64 interceptor git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327596 91177308-0d34-0410-b5e6-96231b3b80d8 commit 11f8e7a5890a156f9c8747b2559a7a40f919c277 Author: Kostya Kortchinsky <kostyak@google.com> Date: Wed Mar 14 15:50:32 2018 +0000 [scudo] Add Chunk::getSize, rework Chunk::getUsableSize Summary: Using `getActuallyAllocatedSize` from the Combined resulting in mediocre compiled code, as the `ClassId != 0` predicament was not propagated there, resulting in additional branches and dead code. Move the logic in the frontend, which results in better compiled code. Also I think it makes it slightly easier to distinguish between the size the user requested, and the size that was actually allocated by the allocator. `const` a couple of things as well. This has no functional impact. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44444 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327525 91177308-0d34-0410-b5e6-96231b3b80d8 commit e24370110c39773a6d068a34676c7123f66ee1bc Author: Sylvestre Ledru <sylvestre@debian.org> Date: Tue Mar 13 14:35:10 2018 +0000 fix some user facing typos / in the comments git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327402 91177308-0d34-0410-b5e6-96231b3b80d8 commit dc85e2be5787b1b60a1a33be1d275a565ee3902c Author: Chih-Hung Hsieh <chh@google.com> Date: Mon Mar 12 15:29:23 2018 -0700 Revert "Reland "[libFuzzer] Support using libc++"" This reverts commit 03a88ba9f340248303a07ddab4dd41fdece50466. That commit breaks Android build.py. Test: build AOSP Change-Id: I7c9133e7fa32eaba4f74cb6239c5718e5fb1c5a9 commit 76cf66f4d6d8409a3369cf8ea94983ba9ede175e Author: Yi Kong <yikong@google.com> Date: Mon Dec 18 11:55:00 2017 -0800 Expand ALL_FUZZER_SUPPORTED_ARCH to include all Android supported archs Upstream it declares X86 as the only supported libfuzzer arch, to prevent issues with cross compilation. This change adds all the Android supported archs to ALL_FUZZER_SUPPORTED_ARCH. We need to figure out a way to upstream a proper fix for this. Bug: 70819574 Change-Id: I0f617768fb838f16f6b110f2735209c25639d543 commit 2d6790829bc896679b78b90331c3c0435a6bcd43 Merge: 9e1f331f3 6a52b697d Author: Chih-Hung Hsieh <chh@google.com> Date: Mon Mar 12 15:07:54 2018 -0700 Merge commit 6a52b697d56 * upstream svn@326768 Test: git diff 6a52b697d56 == git diff 98adaa209 e53507209 Change-Id: I1ed714360026b5ff2860d55befd97fc9edf81147 commit 9e1f331f3aaa5767c0bbe56dbd11fa1d93c0a126 Author: Chih-Hung Hsieh <chh@google.com> Date: Mon Mar 12 15:06:59 2018 -0700 Revert to previous base e53507209. Test: git diff e53507209 Change-Id: Ib9a2e7081ab6e42cba0f3def781c575194ca1279 commit 4c895bfe35adea9996ffe603d7ca215fb7e6d1ef Author: Alex Shlyapnikov <alekseys@google.com> Date: Mon Mar 12 21:59:06 2018 +0000 [Sanitizers] Add more standard compliant posix_memalign implementation for LSan. Summary: Add more standard compliant posix_memalign implementation for LSan and use corresponding sanitizer's posix_memalign implenetations in allocation wrappers on Mac. Reviewers: eugenis, fjricci Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44335 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327338 91177308-0d34-0410-b5e6-96231b3b80d8 commit 39ded27815df4a8cb76ad0b55461111ab35378e6 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Mon Mar 12 21:46:55 2018 +0000 [asan] poison_heap=0 should not disable __asan_handle_no_return. Reviewers: kcc, alekseyshl, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44339 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327337 91177308-0d34-0410-b5e6-96231b3b80d8 commit cc4629e776d0d196dd410cca62b9af110f1225c2 Author: Kostya Kortchinsky <kostyak@google.com> Date: Mon Mar 12 19:29:38 2018 +0000 [scudo] Secondary allocator overhaul to support Windows Summary: The need for this change stems from the fact that Windows doesn't support partial unmapping (`MEM_RELEASE` implies the entire allocated region). So we now have to keep track of the reserved region and the committed region, so that we can function without the trimming we did when dealing with larger alignments. Instead of just having a `ReservedAddressRange` per chunk, we introduce a `LargeChunkHeader` (and `LargeChunk` namespace) that additionally holds the committed size and the usable size. The former is needed for stats purposes, the latter is used by the frontend. Requiring both is debatable, we could only work with the usable size but then be off by up to a page per chunk when dealing with stats. Additionally, we introduce more stats since they turned out to be useful for experiments, and a `PrintStats` function that will be used by the combined allocator in later patch. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D43949 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327321 91177308-0d34-0410-b5e6-96231b3b80d8 commit ea50a1c66e94da932152145fbdd8b588560036c4 Author: Kostya Kortchinsky <kostyak@google.com> Date: Mon Mar 12 17:18:26 2018 +0000 [sanitizer] Align & pad the allocator structures to the cacheline size v2 Summary: This is a new version of D44261, which broke some builds with older gcc, as they can't align on a constexpr, but rather require an integer (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56859) among others. We introduce `SANITIZER_CACHE_LINE_SIZE` in `sanitizer_platform.h` to be used in `ALIGNED` attributes instead of using directly `kCacheLineSize`. Reviewers: alekseyshl, thakis Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44326 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327297 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8f248a533d150affba3ff5f62ee796b9523bdde6 Author: Petr Hosek <phosek@chromium.org> Date: Sat Mar 10 02:00:18 2018 +0000 [Fuzzer] When building for Fuchsia, add an explicit libc++ dependency libFuzzer dependes on C++ library, when building for Fuchsia, we need to ensure that libFuzzer is only being built after libc++ has been built, so we add an explicity dependency on it. Differential Revision: https://reviews.llvm.org/D44340 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327196 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1164bd823b1935a3f50c2bcce4c9ead8291933ab Author: Dan Liew <dan@su-root.co.uk> Date: Fri Mar 9 23:12:32 2018 +0000 [asan] Clean up the REQUIRES of `asan/TestCases/strcat-overlap.cc` by explicitly listing where we expect this test to work. Because this test invokes undefined behaviour all sorts of things can happen (e.g. crash, or on some bots asan manages to catch something). The test seems to pass okay on Darwin (x86_64/x86_64/i386) and on Linux (x86_64/i386) so explicitly require one of these platforms to run the test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327185 91177308-0d34-0410-b5e6-96231b3b80d8 commit f505320f53517f24d70259f78f84ef1e0dba4e72 Author: Peter Collingbourne <peter@pcc.me.uk> Date: Fri Mar 9 20:41:56 2018 +0000 cfi: Disable simple-pass.cpp on Darwin. -mretpoline does not work yet on Darwin. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327168 91177308-0d34-0410-b5e6-96231b3b80d8 commit c6ad367baca517ce86ec09f05e25f2187b655aec Author: Kostya Kortchinsky <kostyak@google.com> Date: Fri Mar 9 20:17:12 2018 +0000 [sanitizer] Revert rCRT327145 Summary: It breaks the Chromium toolchain due to: ``` lib/sanitizer_common/sanitizer_allocator_primary32.h:269:34: error: requested alignment is not an integer constant struct ALIGNED(kCacheLineSize) SizeClassInfo { ``` Reviewers: alekseyshl, thakis Reviewed By: thakis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44320 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327167 91177308-0d34-0410-b5e6-96231b3b80d8 commit ff2d057904474f978563112276df87143032421b Author: Peter Collingbourne <peter@pcc.me.uk> Date: Fri Mar 9 19:11:44 2018 +0000 Use branch funnels for virtual calls when retpoline mitigation is enabled. The retpoline mitigation for variant 2 of CVE-2017-5715 inhibits the branch predictor, and as a result it can lead to a measurable loss of performance. We can reduce the performance impact of retpolined virtual calls by replacing them with a special construct known as a branch funnel, which is an instruction sequence that implements virtual calls to a set of known targets using a binary tree of direct branches. This allows the processor to speculately execute valid implementations of the virtual function without allowing for speculative execution of of calls to arbitrary addresses. This patch extends the whole-program devirtualization pass to replace certain virtual calls with calls to branch funnels, which are represented using a new llvm.icall.jumptable intrinsic. It also extends the LowerTypeTests pass to recognize the new intrinsic, generate code for the branch funnels (x86_64 only for now) and lay out virtual tables as required for each branch funnel. The implementation supports full LTO as well as ThinLTO, and extends the ThinLTO summary format used for whole-program devirtualization to support branch funnels. For more details see RFC: http://lists.llvm.org/pipermail/llvm-dev/2018-January/120672.html Differential Revision: https://reviews.llvm.org/D42453 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327163 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0d7956335942ee1e32255e12d3b302c80ae5d021 Author: Kostya Kortchinsky <kostyak@google.com> Date: Fri Mar 9 16:18:38 2018 +0000 [sanitizer] Align & pad the allocator structures to the cacheline size Summary: Both `SizeClassInfo` structures for the 32-bit primary & `RegionInfo` structures for the 64-bit primary can be used by different threads, and as such they should be aligned & padded to the cacheline size to avoid false sharing. The former was padded but the array was not aligned, the latter was not padded but we lucked up as the size of the structure was 192 bytes, and aligned by the properties of `mmap`. I plan on adding a couple of fields to the `RegionInfo`, and some highly threaded tests pointed out that without proper padding & alignment, performance was getting a hit - and it is going away with proper padding. This patch makes sure that we are properly padded & aligned for both. I used a template to avoid padding if the size is already a multiple of the cacheline size. There might be a better way to do this, I am open to suggestions. Reviewers: alekseyshl, dvyukov Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44261 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327145 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1f433c4909dd21b31269d42ca116187d1bdc55fc Author: Dan Liew <dan@su-root.co.uk> Date: Fri Mar 9 12:26:29 2018 +0000 [asan] Try to unbreak arm build bots by only running the test on x86_64 and x86_64H (and not in the iOS simulator) where it seems to work. We need to properly fix the test when time permits. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327122 91177308-0d34-0410-b5e6-96231b3b80d8 commit f7e699a4e81cf30591a0226d737b1335da44148b Author: Kuba Mracek <mracek@apple.com> Date: Fri Mar 9 00:41:29 2018 +0000 Mark the -overlap tests are "UNSUPPORTED: android". Android test harness doesn't know how to handle suppression files. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327091 91177308-0d34-0410-b5e6-96231b3b80d8 commit c6d3dcdd6b737e2ef4720d5b59a9eb59258dbe59 Author: Kuba Mracek <mracek@apple.com> Date: Fri Mar 9 00:03:09 2018 +0000 Mark strcat-overlap.cc as "UNSUPPORTED: win32" git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327081 91177308-0d34-0410-b5e6-96231b3b80d8 commit eea34fb22d9d45ce80edf9879aa2e063bd0ddd85 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 23:53:29 2018 +0000 Move lto-constmerge-odr.cc to Posix (it's failing on Windows). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327080 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7332f89acb92bba401a4fd40d6f2f928896beb03 Author: Dan Liew <dan@su-root.co.uk> Date: Thu Mar 8 21:50:22 2018 +0000 [asan] Fix bug where suppression of overlapping accesses was ignored on `strcpy()`, `strncpy()`, `strcat()`, and `strncat()`. rdar://problem/35576899 Differential Revision: https://reviews.llvm.org/D43702 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327068 91177308-0d34-0410-b5e6-96231b3b80d8 commit 70aabe0941d94ac5e936fa2e5f6b745a653e6f45 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 21:02:52 2018 +0000 [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part, take 3] This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. See the included testcase for an example. Differential Revision: https://reviews.llvm.org/D43959 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327062 91177308-0d34-0410-b5e6-96231b3b80d8 commit 369b1057026155cf2a46aef40f6f047239b86860 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 18:20:03 2018 +0000 More revert of r327031 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327038 91177308-0d34-0410-b5e6-96231b3b80d8 commit bc85606fd81617dd6dc21200c73d00ccb58b6566 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 17:31:31 2018 +0000 Revert r327031 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327032 91177308-0d34-0410-b5e6-96231b3b80d8 commit e9572d640f9be27f781c4e2ceb4d8773fc470e70 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 17:24:47 2018 +0000 [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part] This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. Differential Revision: https://reviews.llvm.org/D43959 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327031 91177308-0d34-0410-b5e6-96231b3b80d8 commit f8d672aa199e4dd12eb641ee168a8604e19aaec2 Author: Eugene Zemtsov <ezemtsov@google.com> Date: Thu Mar 8 04:34:22 2018 +0000 Build LLVMDemangle from build_symbolizer.sh Symbolizer now depends on internal implementation of itaniumDemangle. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326987 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5e71c6bf635d11864a52642d77754ceedb19efb2 Author: Eugene Zemtsov <ezemtsov@google.com> Date: Thu Mar 8 02:57:54 2018 +0000 Add Demangle lib into internalization list Symbolizer now depends on internal implementation of itaniumDemangle. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326983 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4b4c1dade5a766794775983263c8c2c60e9693b2 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 19:43:50 2018 +0000 [sanitizer] Fix SANITIZER_INTERCEPT_MMAP and SANITIZER_INTERCEPT_MMAP64 values git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326938 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7bcd41f70ccc1b88195ea8804e88ac89d30b6e46 Author: Petr Hosek <phosek@chromium.org> Date: Wed Mar 7 18:14:09 2018 +0000 [Fuzzer] Avoid the unnecessary rebuild of the custom libc++ This changes the add_custom_libcxx macro to resemble the llvm_ExternalProject_Add. The primary motivation is to avoid unnecessary libFuzzer rebuilds that are being done on every Ninja/Make invocation. The libc++ should be only rebuilt whenever the libc++ source itself changes. Differential Revision: https://reviews.llvm.org/D43213 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326921 91177308-0d34-0410-b5e6-96231b3b80d8 commit df0d7bf4bc073d15b096b88a26ec7e7871c942d4 Author: Kostya Kortchinsky <kostyak@google.com> Date: Wed Mar 7 16:22:16 2018 +0000 [scudo] Make logging more consistent Summary: A few changes related to logging: - prepend `Scudo` to the error messages so that users can identify that we reported an error; - replace a couple of `Report` calls in the RSS check code with `dieWithMessage`/`Print`, mark a condition as `UNLIKELY` in the process; - change some messages so that they all look more or less the same. This includes the `CHECK` message; - adapt a couple of tests with the new strings. A couple of side notes: this results in a few 1-line-blocks, for which I left brackets. There doesn't seem to be any style guide for that, I can remove them if need be. I didn't use `SanitizerToolName` in the strings, but directly `Scudo` because we are the only users, I could change that too. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44171 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326901 91177308-0d34-0410-b5e6-96231b3b80d8 commit 41f54f83a6b2114e4bc2237537f2feaed18fc6b8 Author: Kamil Rytarowski <n54@gmx.com> Date: Wed Mar 7 09:16:10 2018 +0000 Don't intercept mmap64() on NetBSD Disable SANITIZER_INTERCEPT_MMAP64 for SI_NETBSD. NetBSD switched to 64-bit offsets almost 30 years ago on 32-bit platforms and never needed mmap64() concept. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326883 91177308-0d34-0410-b5e6-96231b3b80d8 commit dd41ac244184bda1751f065ac467fc8ac260d1fd Author: George Burgess IV <george.burgess.iv@gmail.com> Date: Wed Mar 7 07:36:23 2018 +0000 Attempt to appease buildbots I can't reproduce this build error locally, but it appears straightforward enough to fix. r326851 renamed two of the params of this interceptor, but apparently to update their use here. Failure: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/4569 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326876 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0639500fd242d68428b9e2959c7bf5227b9aeca8 Author: Adam Nemet <anemet@apple.com> Date: Wed Mar 7 05:33:37 2018 +0000 Disable tests from r326852 on Darwin Darwin needs xlocale.h but I see no precedence in the code how non-Posix headers like this are handled and I am not experienced with this code. Just disable the tests for now to recover the bots. rdar://38208146 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326874 91177308-0d34-0410-b5e6-96231b3b80d8 commit 74e7bc0d6590da2181fae37627e2658a4af6e487 Author: Dean Michael Berris <dberris@google.com> Date: Wed Mar 7 02:45:14 2018 +0000 [XRay][compiler-rt] Add APIs for processing logs in memory Summary: This change adds APIs to allow logging implementations to provide a function for iterating through in-memory buffers (if they hold in-memory buffers) and a way for users to generically deal with these buffers in-process. These APIs are: - __xray_log_set_buffer_iterator(...) and __xray_log_remove_buffer_iterator(): installs and removes an iterator function that takes an XRayBuffer and yields the next one. - __xray_log_process_buffers(...): takes a function pointer that can take a mode identifier (string) and an XRayBuffer to process this data as they see fit. The intent is to have the FDR mode implementation's buffers be available through this `__xray_log_process_buffers(...)` API, so that they can be streamed from memory instead of flushed to disk (useful for getting the data to a network, or doing in-process analysis). Basic mode logging will not support this mechanism as it's designed to write the data mostly to disk. Future implementations will may depend on this API as well, to allow for programmatically working through the XRay buffers exposed to the users in some fashion. Reviewers: eizan, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43495 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326866 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2e65830de05d20662908cce16498e139fe29887c Author: Kuba Mracek <mracek@apple.com> Date: Wed Mar 7 02:30:55 2018 +0000 Fixup r326851: mmap64 interceptor should not be used on Darwin. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326864 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2ccfc5617bd2308b9063c5a21035ec8f2d27ba89 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:15:10 2018 +0000 [sanitizer] Update symbolizer test git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326855 91177308-0d34-0410-b5e6-96231b3b80d8 commit 77712da5be6ad0e4483747826547756c15d1f4c3 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:14:52 2018 +0000 [sanitizer] Extract common code into STRXFRM_INTERCEPTOR_IMPL git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326854 91177308-0d34-0410-b5e6-96231b3b80d8 commit e6fe6d618bcd23f8baa1d3b2bb38f236c019ba2d Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:14:30 2018 +0000 [sanitizer] Move strxfrm interceptors into sanitizer_common git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326853 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4f09499dc766ec4ce5170f4553a6951a5e063c29 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:14:12 2018 +0000 [sanitizer] Add interceptors for wcsxfrm, wcsxfrm_l Patch by Oliver Chang Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44133 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326852 91177308-0d34-0410-b5e6-96231b3b80d8 commit 03e114b188efa25ce9371cd4c1e212477e0981d3 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:13:54 2018 +0000 [sanitizer] Move mmap interceptors into sanitizer_common Reviewers: devnexen, krytarowski, eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44125 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326851 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6702fa4a371471894dbf0e7e63cdcffb744f1620 Author: Dean Michael Berris <dberris@google.com> Date: Tue Mar 6 23:06:09 2018 +0000 [XRay][compiler-rt] Make unit tests depend on implementation files Summary: This change makes changes to XRay implementation files trigger re-builds of the unit tests. Prior to this change, the unit tests were not built and run properly if the implementation files were changed during the development process. This change forces the dependency on all files in the XRay include and lib hosted files in compiler-rt. Caveat is, that new files added to the director(ies) will need a re-run of CMake to re-generate the fileset. We think this is an OK compromise, since adding new files may necessitate editing (or adding) new unit tests. It's also less likely that we're adding new files without updating the CMake configuration to include the functionality in the XRay runtime implementation anyway. Reviewers: pelikan, kpw, nglevin Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D44080 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326842 91177308-0d34-0410-b5e6-96231b3b80d8 commit fda7be249930e29d47db4e21535c618afebfc8f5 Author: Kostya Kortchinsky <kostyak@google.com> Date: Tue Mar 6 20:13:37 2018 +0000 [scudo] Use gc-sections by default Summary: If not using `-Wl,--gc-sections`, a whole lot of unused `sanitizer_common` code and related static variables are pulled into the shared library. Keep the binary size smaller, and its memory footprint smaller as well, by using the compiler flags `-ffunction-section` & `-fdata-sections` by default, as well as the linker flags `-Wl,--gc-sections`. Current experiments show a large discrepency between binary sizes generated by gcc (big) and clang (small). I am not sure yet how I can make a test that would encompass both, so it's an outstanding work item. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44121 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326833 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6a52b697d564699d511de92bce88e15bf6fc56b8 Author: Kamil Rytarowski <n54@gmx.com> Date: Tue Mar 6 08:24:16 2018 +0000 OpenBSD sanitizer common, define RLIMIT_AS constant Summary: define RLIMIT_AS constant until it s defined in the future Patch by: David Carlier Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44068 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326768 91177308-0d34-0410-b5e6-96231b3b80d8 commit 115b7e9a67cae5e81daf12b58e035d1eaff21140 Author: Petr Hosek <phosek@chromium.org> Date: Tue Mar 6 02:01:32 2018 +0000 [sanitizer] Fix the return type for GetTid in Fuchsia implementation This is triggering "functions that differ only in their return type cannot be overloaded" error. Differential Revision: https://reviews.llvm.org/D44126 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326759 91177308-0d34-0410-b5e6-96231b3b80d8 commit ac596966cd96f9a0b781b96e7eaf1566d970b88c Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Wed Nov 8 00:15:12 2017 +0000 [sanitizer] Asm implementation of syscall() for arm32. Summary: These will be used in an ifunc resolver, when the binary may not be completely relocated, and syscall() function from libc could not be used. Reviewers: dvyukov, vitalybuka Subscribers: aemerson, kubamracek, javed.absar, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D39701 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317640 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6063ee2eec3187838cb580e26137986dc90789c5 Author: Yi Kong <yikong@google.com> Date: Fri Jan 19 19:29:22 2018 -0800 [ubsan] Disable signal handling on Android. Taken from https://reviews.llvm.org/D42329 to fix Android build. Change-Id: I4e602452129304c4f281010efa015d000bea754e commit d5ab806ae9e9b6170e8909cbcef19d3de305c799 Author: Yi Kong <yikong@google.com> Date: Thu Dec 28 23:06:24 2017 +0000 Ignore the DISPATCH_NOESCAPE if not defined This macro is only defined after XCode 8, causing build breakage for build systems with prior versions. Ignore DISPATCH_NOESCAPE if not defined. Differential Revision: https://reviews.llvm.org/D41601 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321543 91177308-0d34-0410-b5e6-96231b3b80d8 commit d2dd86bc1ebb9cd9339023ec9d657c22b52c0200 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Tue Nov 7 23:51:22 2017 +0000 (NFC) Rename GetMax{,User}VirtualAddress. Future change will introduce GetMaxVirtualAddress that will not take the kernel area into account. Change-Id: I5b3ef1bed1d823a0dad79a434a8a4c93c8888e2d git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317638 91177308-0d34-0410-b5e6-96231b3b80d8 commit b89b3640aeff016d49768fef0d9250cfc158b70a Author: Yi Kong <yikong@google.com> Date: Mon Dec 18 11:55:00 2017 -0800 Expand ALL_FUZZER_SUPPORTED_ARCH to include all Android supported archs Upstream it declares X86 as the only supported libfuzzer arch, to prevent issues with cross compilation. This change adds all the Android supported archs to ALL_FUZZER_SUPPORTED_ARCH. We need to figure out a way to upstream a proper fix for this. Bug: 70819574 Change-Id: I1164439d6eb2f3daad6eee0679182a32928c0ef6 commit 5818606a1ba6c81d8de1bd145aa7e6d45dc85901 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Mon Nov 20 17:41:57 2017 +0000 [asan] Use dynamic shadow on 32-bit Android, try 2. Summary: This change reverts r318575 and changes FindDynamicShadowStart() to keep the memory range it found mapped PROT_NONE to make sure it is not reused. We also skip MemoryRangeIsAvailable() check, because it is (a) unnecessary, and (b) would fail anyway. Reviewers: pcc, vitalybuka, kcc Subscribers: srhines, kubamracek, mgorny, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D40203 Change-Id: I779e4c394f6d90234150dcbd18cc9d06499ed962 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318666 91177308-0d34-0410-b5e6-96231b3b80d8 commit 81bfe08c5b3ea267c40632dc4cee5f85752f1698 Author: Peter Collingbourne <peter@pcc.me.uk> Date: Fri Nov 10 22:09:37 2017 +0000 sanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does not work. 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…
Disable linking of libcxx unto fuzzer by default. It's causing build errors for dtc commit 0b2455d60eae3577ad2d410467a570571d037d85 Author: Pirama Arumuga Nainar <pirama@google.com> Date: Tue Apr 10 10:36:14 2018 -0700 Add option to disable linking of libcxx into fuzzer Summary: The ability to partially link libcxx into fuzzer does not work for cross compilations. CMAKE_EXE_LINKER_FLAGS, etc are not passed to the custom CMake invocation and cross-compiling libcxx without a libcxxabi, as is done here, has further issues as well. Add an option to disable linking of libcxx into fuzzer. The default for this option is to link libcxx. Reviewers: srhines, chh, phosek, EricWF Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44532 commit 68186437fef3fc9da71782da211c8fc459a3e604 Author: Yi Kong <yikong@google.com> Date: Mon Dec 18 11:55:00 2017 -0800 Expand ALL_FUZZER_SUPPORTED_ARCH to include all Android supported archs Upstream it declares X86 as the only supported libfuzzer arch, to prevent issues with cross compilation. This change adds all the Android supported archs to ALL_FUZZER_SUPPORTED_ARCH. We need to figure out a way to upstream a proper fix for this. Bug: 70819574 Change-Id: Idb14a04e9ab706ae089710335b90a738d8749460 commit 83844e0b98d6a0b8dc1a4e831ea620fe227029b5 Merge: 22214af2d 13c69d3bc Author: Pirama Arumuga Nainar <pirama@google.com> Date: Mon Apr 9 23:49:33 2018 -0700 Merge commit 13c69d3bcd85 - upstream svn@328849 Test: git diff 13c69d3bcd85 == git diff 2d6790829bc8 6a52b697d56 Change-Id: I79ba9963edfa29b1349c1fc131294eb0edaedcff commit 22214af2dcd25e9150e5b7399bdebf5cd150cbd8 Author: Pirama Arumuga Nainar <pirama@google.com> Date: Mon Apr 9 23:48:36 2018 -0700 Revert to previoius base 2d6790829bc8 Test: git diff 2d6790829bc8 Change-Id: I721b907e03c4d6791dfbd69e66a46cae07a39257 commit 13c69d3bcd85a38da14fd28322b0b2f8b675d943 Author: Alex Shlyapnikov <alekseys@google.com> Date: Fri Mar 30 00:03:36 2018 +0000 [ASan] Disable new ASan error reporting tests on various ARMs. As many other ASan tests already, has to disable these failing tests on arm, armhf and aarch64 configs. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328849 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9d7af14084ce6fb61c13938c8f56d491d5013e2f Author: Dan Liew <dan@su-root.co.uk> Date: Thu Mar 29 13:53:50 2018 +0000 [asan] Split the `throw_invoke_test.cc` into a Linux specific variant and the general version to avoid use of libstdc++ on non-Linux platforms. This is motivated by the fact that using `libstdc++` is deprecated on Darwin and maybe removed some day. Differential Revision: https://reviews.llvm.org/D44733 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328775 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2042980a5df0017a2c1b228ab1241743d2e21ccf Author: Alex Shlyapnikov <alekseys@google.com> Date: Thu Mar 29 02:18:57 2018 +0000 [ASan] Disable aligned_alloc-alignment.cc on PPC64. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328753 91177308-0d34-0410-b5e6-96231b3b80d8 commit ac9149c80600e4c6952c3df849358d67d8e11a54 Author: Alex Shlyapnikov <alekseys@google.com> Date: Thu Mar 29 00:09:12 2018 +0000 [ASan] Disable aligned_alloc-alignment.cc on ppc64be Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328742 91177308-0d34-0410-b5e6-96231b3b80d8 commit ff9c056a0fd6585de070a0c088eac14222ccc967 Author: Alex Shlyapnikov <alekseys@google.com> Date: Wed Mar 28 23:01:04 2018 +0000 [ASan] Disable aligned_alloc-alignment.cc test on gcc. This check "CHECK: {{#0 0x.* in .*aligned_alloc}}" fails on ppc64be, gcc build. Disabling the test for gcc for now. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328741 91177308-0d34-0410-b5e6-96231b3b80d8 commit e3435fdbc7cebcee5087739f657dce99641e80aa Author: Alex Shlyapnikov <alekseys@google.com> Date: Wed Mar 28 22:00:08 2018 +0000 [ASan] Disable aligned_alloc-alignment.cc on Android. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328734 91177308-0d34-0410-b5e6-96231b3b80d8 commit 85f074e7256b2a434f7663d56e9a11f21c466d5e Author: Alex Shlyapnikov <alekseys@google.com> Date: Wed Mar 28 19:53:55 2018 +0000 [ASan] Add aligned_alloc declaration to aligned_alloc-alignment.cc test. aligned_alloc is not always defined in headers. Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328726 91177308-0d34-0410-b5e6-96231b3b80d8 commit 85f6bace7a20b03d7a754d83a1b655b504eee0e3 Author: Alex Shlyapnikov <alekseys@google.com> Date: Wed Mar 28 18:22:40 2018 +0000 [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ing Summary: Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, not stack, no details, not too helpful nor informative. To improve the situation, ASan detailed errors were defined and reported under the appropriate conditions. Issue: https://github.com/google/sanitizers/issues/887 Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328722 91177308-0d34-0410-b5e6-96231b3b80d8 commit d2575a962bced93ad1d1bc9c6551b9f54ccd71ef Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Wed Mar 28 00:45:20 2018 +0000 [asan] Add vfork to the list of reasons for stack errors. Until we figure out what to do with it, vfork can cause stack-based false positives. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328681 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0c41e4c8cf77ed9fb28114cfaf430ac34e6c6e9c Author: Alex Shlyapnikov <alekseys@google.com> Date: Tue Mar 27 17:45:53 2018 +0000 [HWASan] Make use-after-free c, not c++ test. To minimize testing surface (remove libstdc++ from the picture, for one), make use-after-free c, not c++ test. Differential Revision: https://reviews.llvm.org/D44705 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328646 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7741c0b35bb33e852c9e4bdfa1b71233a2e294eb Author: Matt Morehouse <mascasa@google.com> Date: Tue Mar 27 16:40:34 2018 +0000 [libFuzzer] Disable optimization for exit_on_src_pos.test. Test fails on Darwin with -O2. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328634 91177308-0d34-0410-b5e6-96231b3b80d8 commit dd22916b45f7624acd28fe614544a8206bed7ddd Author: Matt Morehouse <mascasa@google.com> Date: Tue Mar 27 16:40:20 2018 +0000 [libFuzzer] Place volatile after pointer types. For a few tests, volatile was placed before the '*' in pointer declarations, resulting in it applying to the underlying data rather than the pointer itself. Placing volatile after the '*' allows us to switch those tests to -O2. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328633 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9d924ab8a5ce9dfebbdb1d04c715a2a5bb80c8b6 Author: Alex Shlyapnikov <alekseys@google.com> Date: Tue Mar 27 16:04:40 2018 +0000 [HWASan] Relax use-after-free.cc test matching rules. Relax use-after-free.cc test matching rules to cover more malloc/free interceptor names variations. Differential Revision: https://reviews.llvm.org/D44705 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328630 91177308-0d34-0410-b5e6-96231b3b80d8 commit d3a94d4f000fcb48d36db18ac6e8b652db371e96 Author: Kostya Kortchinsky <kostyak@google.com> Date: Tue Mar 27 14:40:39 2018 +0000 [scudo] Fuchsia minimal shared runtime Summary: Fuchsia requires its Scudo shared runtime to not be C++ dependant. Since they don't use UBSan in conjunction with Scudo, we can just remove the runtime, and add the extra `nostdinc++` and `nostdlib++` flags. No need for Coverage either. This allows to keep things going while working on additional splits of sanitizer_commong and a more minimal runtime. Reviewers: phosek, flowerhack, alekseyshl Reviewed By: phosek, alekseyshl Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44791 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328625 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4637a721ec1e9399c884a941d71d966bd0c1af74 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Tue Mar 27 00:31:16 2018 +0000 Revert "[asan] Replace vfork with fork." Replacing vfork with fork results in significant slowdown of certain apps (in particular, memcached). This reverts r327752. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328600 91177308-0d34-0410-b5e6-96231b3b80d8 commit d7962b9d3455e69f0fd558d6226d9c70d711740e Author: Matt Morehouse <mascasa@google.com> Date: Mon Mar 26 19:36:20 2018 +0000 [libFuzzer] Do not optimize minimize_two_crashes.test. Speculative fix for build bot breakage on Mac. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328576 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1e64638ed164f0981d2c8987c104590339fbff3d Author: Vitaly Buka <vitalybuka@google.com> Date: Mon Mar 26 01:29:48 2018 +0000 [sanitizer] Make test compatible with Darwin git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328467 91177308-0d34-0410-b5e6-96231b3b80d8 commit c98416104dcbc5b7a6251ab9a0ccbc929d9c7868 Author: Vitaly Buka <vitalybuka@google.com> Date: Sat Mar 24 08:13:18 2018 +0000 [sanitizer] Fix Darwin build git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328417 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6a3cda135ae93355184917e134e0026348925a0f Author: Vitaly Buka <vitalybuka@google.com> Date: Sat Mar 24 07:45:24 2018 +0000 Mmap interceptor providing mprotect support Summary: - Intercepting mprotect calls. - Fixing forgotten flag check. Patch by David CARLIER Reviewers: vitalybuka, vsk Subscribers: delcypher, srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44777 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328415 91177308-0d34-0410-b5e6-96231b3b80d8 commit 69eddd514afd59184bb25f87dff8880144395fb7 Author: Vitaly Buka <vitalybuka@google.com> Date: Sat Mar 24 07:31:59 2018 +0000 [sanitizer] Fix strlcpy and strlcat interceptors on Darwin git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328414 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4151745865d9ea591f2287d050c61d2314e0fe09 Author: Alex Shlyapnikov <alekseys@google.com> Date: Sat Mar 24 02:10:49 2018 +0000 [HWASan] Fix use-after-free.cc test on x86-64 Differential Revision: https://reviews.llvm.org/D44705 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328407 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4c143ffe63116f76af629d9daa471daebdfcd17c Author: Alex Shlyapnikov <alekseys@google.com> Date: Sat Mar 24 00:40:51 2018 +0000 Remove duplicated const qualifier. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328403 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2f90bfba89ad7ac272dcb1cae064681fce98f1b9 Author: Alex Shlyapnikov <alekseys@google.com> Date: Fri Mar 23 23:38:04 2018 +0000 [HWASan] Port HWASan to Linux x86-64 (compiler-rt) Summary: Porting HWASan to Linux x86-64, first of the three patches, compiler-rt part. The approach is similar to ARM case, trap signal is used to communicate memory tag check failure. int3 instruction is used to generate a signal, access parameters are stored in nop [eax + offset] instruction immediately following the int3 one Had to add HWASan init on malloc because, due to much less interceptors defined (most other sanitizers intercept much more and get initalized via one of those interceptors or don't care about malloc), HWASan was not initialized yet when libstdc++ was trying to allocate memory for its own fixed-size heap, which led to CHECK-fail in AllocateFromLocalPool. Also added the CHECK() failure handler with more detailed message and stack reporting. Reviewers: eugenis Subscribers: kubamracek, dberris, mgorny, kristof.beyls, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44705 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328385 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0691287972d44894b7fa3ca57af9c03133e45d26 Author: Matt Morehouse <mascasa@google.com> Date: Fri Mar 23 23:35:28 2018 +0000 [libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer. Summary: Disables certain CMP optimizations to improve fuzzing signal under -O1 and -O2. Switches all fuzzer tests to -O2 except for a few leak tests where the leak is optimized out under -O2. Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D44798 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328384 91177308-0d34-0410-b5e6-96231b3b80d8 commit f40efdb90fed2c5d01b17677c9603bf5f1d19b60 Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 23 21:44:59 2018 +0000 FreeBSD sanitizer common, intercept couple of more functions Summary: Intercepts lstat, acct, access, faccessat and strlcpy/strlcat Patch by David CARLIER Reviewers: visa, vitalybuka Subscribers: krytarowski, fedor.sergeev, srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44432 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328376 91177308-0d34-0410-b5e6-96231b3b80d8 commit 132d1ff971cc7e7b8930107388f9806bb2feb00e Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 23 21:44:59 2018 +0000 Revert "Mmap interceptor providing mprotect support" Breaks Darwin. This reverts commit r328369. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328375 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5b515098cbfff3f1102b63e3a63bfdc4b22cbf64 Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 23 20:59:51 2018 +0000 Mmap interceptor providing mprotect support Summary: - Intercepting mprotect calls. - Fixing forgotten flag check. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44777 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328369 91177308-0d34-0410-b5e6-96231b3b80d8 commit abcc3f0e5b31873a8479a3b81a17439987b357f7 Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 23 00:15:10 2018 +0000 [sanitizer] Fix PPC bot git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328279 91177308-0d34-0410-b5e6-96231b3b80d8 commit 51461d68f54a4003586b3e387ce9e92542b0f70f Author: Petr Hosek <phosek@chromium.org> Date: Thu Mar 22 23:58:37 2018 +0000 [sanitizer] zx_vmo_write on Fuchsia takes only 4 arguments now The system call now fails when it cannot write the requested size. Update the sanitizer runtime Fuchsia implementation accordingly. Differential Revision: https://reviews.llvm.org/D44770 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328273 91177308-0d34-0410-b5e6-96231b3b80d8 commit d794921df40c9c8df2f43270789fb966012c4cee Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 22 20:42:28 2018 +0000 More OpenBSD fixes Summary: - Use internal_syscall_ptr in internal_readlink - use sigcontext on OpenBSD Patch by David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44713 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328239 91177308-0d34-0410-b5e6-96231b3b80d8 commit f8d3fb24f9a40efa40128a74ce919b9a2e88f13f Author: Kostya Kortchinsky <kostyak@google.com> Date: Thu Mar 22 15:04:31 2018 +0000 [sanitizer] Split coverage into separate RT in sanitizer_common Summary: `sanitizer_common`'s coverage support is fairly well separated, and libcdep by default. Several sanitizers don't make use of coverage, and as far as I can tell do no benefit from the extra dependencies pulled in by the coverage public interface functions. The following sanitizers call `InitializeCoverage` explicitely: MSan, ASan, LSan, HWAsan, UBSan. On top of this, any sanitizer bundling RTUBSan should add the coverage RT as well: ASan, Scudo, UBSan, CFI (diag), TSan, MSan, HWAsan. So in the end the following have no need: DFSan, ESan, CFI, SafeStack (nolibc anyway), XRay, and the upcoming Scudo minimal runtime. I tested this with all the sanitizers check-* with gcc & clang, and in standalone on Linux & Android, and there was no issue. I couldn't test this on Mac, Fuchsia, BSDs, & Windows for lack of an environment, so adding a bunch of people for additional scrunity. I couldn't test HWAsan either. Reviewers: eugenis, vitalybuka, alekseyshl, flowerhack, kubamracek, dberris, rnk, krytarowski Reviewed By: vitalybuka, alekseyshl, flowerhack, dberris Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44701 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328204 91177308-0d34-0410-b5e6-96231b3b80d8 commit 351f235ea4d0bfa17b65dd3a0ac14bbd8a98b90b Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 21 21:25:07 2018 +0000 Mmap interceptor new option, Write Exec runtime detector Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328151 91177308-0d34-0410-b5e6-96231b3b80d8 commit 52411af60152548a1f25237339abaf2b9db0fbba Author: George Karpenkov <ekarpenkov@apple.com> Date: Wed Mar 21 17:55:36 2018 +0000 [libFuzzer] Disable equivalence-signals test on Darwin due to persistent failures git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328125 91177308-0d34-0410-b5e6-96231b3b80d8 commit 402d59575d5ffd2eb8ea0ca7d78661bbabffb8b5 Author: Nemanja Ivanovic <nemanja.i.ibm@gmail.com> Date: Wed Mar 21 11:58:37 2018 +0000 [PowerPC] Disable failing dynamic tls test cases Due to recent kernel upgrades, these test case fail on PowerPC buildbots. This is a known problem on affected kernels. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328091 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9596e209a0ad212d0fdedcd41852f3039c6cd54c Author: Dmitry Vyukov <dvyukov@google.com> Date: Wed Mar 21 09:26:29 2018 +0000 tsan: fix darwin build after 328079 328079 introduced a weak hook without default implementation. This broke darwin build: http://green.lab.llvm.org/green//job/clang-stage1-configure-RA/43731/consoleFull#-119213188149ba4694-19c4-4d7e-bec5-911270d8a58c Provide default impl for the hook. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328082 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6f6e03a3c09e31ff6fda4ad9f215ca0c6d495d34 Author: Dmitry Vyukov <dvyukov@google.com> Date: Wed Mar 21 08:44:14 2018 +0000 tsan: support inlined frames in external symbolization New API passes a callback function to the external symbolizer, allowing it to add multiple frames to the traceback. Note that the old interface API will be still supported until the clients migrate to the new one. Author: asmundak (Alexander Smundak) Reviewed in: https://reviews.llvm.org/D44714 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328079 91177308-0d34-0410-b5e6-96231b3b80d8 commit def0ac6300d4511350d7abbb883f42faf708a132 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 21 07:50:02 2018 +0000 Fix declaration of environ after r327923 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328077 91177308-0d34-0410-b5e6-96231b3b80d8 commit db8db463f2c29aa2468f3e4b4a7866ff35f1a445 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Fri Mar 16 22:15:05 2018 +0000 [asan] Replace vfork with fork. Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes https://github.com/google/sanitizers/issues/925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 Change-Id: I163aa74830053caef97c9e7c6946bc44bb56bdba git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327752 91177308-0d34-0410-b5e6-96231b3b80d8 commit a70e78d7e227e7dd22a08dd73d3345854273cadf Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Fri Mar 16 21:31:49 2018 +0000 [asan] Remove empty fork interceptor. After a partial revert, ASan somehow ended up with an empty interceptor for fork(). Change-Id: I1774d54fa3a2b391267e756dbd2271383f4e3174 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327748 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9725eed959002e12a6d96f9ea0c758456caf7150 Author: Mandeep Singh Grang <mgrang@codeaurora.org> Date: Tue Mar 20 01:17:18 2018 +0000 Revert "[compiler-rt] Change std::sort to llvm::sort in response to r327219" This reverts commit 2ee210e1963e03aacc0f71c50e4994bb5c66586e. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327936 91177308-0d34-0410-b5e6-96231b3b80d8 commit 789e1d7e04752d0c2df371b5acf13e9190ec1666 Author: Mandeep Singh Grang <mgrang@codeaurora.org> Date: Tue Mar 20 00:44:59 2018 +0000 [compiler-rt] Change std::sort to llvm::sort in response to r327219 Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Reviewers: kcc, rsmith, RKSimon, eugenis Reviewed By: RKSimon Subscribers: efriedma, kubamracek, dberris, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44360 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327929 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7dce3214a401e4e8b1a3ad04e79ae6c3dd0a8d1e Author: Vitaly Buka <vitalybuka@google.com> Date: Mon Mar 19 23:12:14 2018 +0000 OpenBSD UBsan support missing bits Summary: Lost bits since the WIP ticket Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: srhines, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44599 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327923 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5c4cd77db3a08587c6ac82a8e2c92cd4be0bc200 Author: Vitaly Buka <vitalybuka@google.com> Date: Mon Mar 19 20:44:06 2018 +0000 Cleanup of "extern char **environ" declaration git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327904 91177308-0d34-0410-b5e6-96231b3b80d8 commit 522a892efc2ff22a2fd421b1ef4d9d9739d78b2e Author: Vitaly Buka <vitalybuka@google.com> Date: Mon Mar 19 18:22:35 2018 +0000 Fix CMake/MSVC when compiler-rt and llvm are built separately Summary: For some reason CMake can't find the `append` macro if LLVM is built separately and imported via `LLVM_CONFIG_PATH`. Patch by Loo Rong Jie Reviewers: rnk, vitalybuka Reviewed By: rnk, vitalybuka Subscribers: dberris, mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43458 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327876 91177308-0d34-0410-b5e6-96231b3b80d8 commit ced3f2bc118b52e25c2da715cbf43315d599ceca Author: Vitaly Buka <vitalybuka@google.com> Date: Sat Mar 17 00:31:41 2018 +0000 Revert "Mmap interceptor new option, Write Exec runtime detector" Breaks Android bot. This reverts commit r327747. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327762 91177308-0d34-0410-b5e6-96231b3b80d8 commit d7241395e6a8ddb73618dca61db1495c227354b8 Author: Petr Hosek <phosek@chromium.org> Date: Fri Mar 16 22:40:55 2018 +0000 [Fuzzer] Build the shared memory hooks for Fuchsia This is needed otherwise we'll get undefined references when trying to use the libFuzzer built for Fuchsia. Differential Revision: https://reviews.llvm.org/D44590 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327759 91177308-0d34-0410-b5e6-96231b3b80d8 commit 37e599c1fe0403f3c89e1755daa8e58401ddba0a Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 16 22:29:29 2018 +0000 OpenBSD UBsan support final missing bits Summary: One forgotten file change + reordering one header due to clang-format Patch by David CARLIER Reviewers: vitalybuka, vsk Subscribers: kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44556 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327758 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5fe72ccbb2c5733e929b146e23ba7c5aa16faab5 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Fri Mar 16 22:15:05 2018 +0000 [asan] Replace vfork with fork. Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes https://github.com/google/sanitizers/issues/925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327752 91177308-0d34-0410-b5e6-96231b3b80d8 commit da8ddca6ddbd7f12d73eb42c268f37a0c0a345c5 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Fri Mar 16 21:31:49 2018 +0000 [asan] Remove empty fork interceptor. After a partial revert, ASan somehow ended up with an empty interceptor for fork(). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327748 91177308-0d34-0410-b5e6-96231b3b80d8 commit f4140e284d9c82989841f94d9f916a2fc186da3e Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 16 21:25:09 2018 +0000 Mmap interceptor new option, Write Exec runtime detector Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327747 91177308-0d34-0410-b5e6-96231b3b80d8 commit 957b9624d6f70e4df40237dc6d41f9b2f8391c95 Author: Jonas Devlieghere <jonas@devlieghere.com> Date: Fri Mar 16 15:34:09 2018 +0000 Revert "Mmap interceptor new option, Write Exec runtime detector" This reverts r327696 because it is failing on GreenDragon. http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/43605/ http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10957/ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327719 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8ef4f556928c7090cc7d6b6bdf8a3ce948d8b658 Author: Dmitry Vyukov <dvyukov@google.com> Date: Fri Mar 16 10:20:58 2018 +0000 tsan: revert: Update buildgo.sh to pass -isysroot on Darwin. This commit breaks actual Go runtime build on gomote builders (10.12) with: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance Without this part build works fine. The original commit does not include any explanation as to why it is needed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327700 91177308-0d34-0410-b5e6-96231b3b80d8 commit 302ac21ae0e46fa549dc90cfa3d1c66519d77ea1 Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 16 08:23:33 2018 +0000 FreeBSD TSan support update Summary: - Disable thread_finalize callback on FreeBSD, fixing couple of unit tests. Patch by David CARLIER Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: emaste, kubamracek, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44156 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327697 91177308-0d34-0410-b5e6-96231b3b80d8 commit 84b43a132165c8a776aa570bf91809a496166bbe Author: Vitaly Buka <vitalybuka@google.com> Date: Fri Mar 16 08:22:18 2018 +0000 Mmap interceptor new option, Write Exec runtime detector Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327696 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8b6780e6f14939eeeeb343395b349310c5eb9cc7 Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 15 22:41:28 2018 +0000 MSan, FreeBSD few tests fixes Summary: pthread_getattr_np_deadlock support pthread_getname_np unsupported Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: eugenis, srhines, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44085 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327678 91177308-0d34-0410-b5e6-96231b3b80d8 commit 53dde8665ba7cca453b412ba4905f1b3fa6ad0c4 Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 15 22:40:47 2018 +0000 OpenBSD UBsan support procmaps Summary: procmaps OpenBSD specifics Patch by David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: mgorny, emaste, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44050 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327677 91177308-0d34-0410-b5e6-96231b3b80d8 commit c63595181aa235959cc67ce317d7c7b64e89223f Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 15 22:19:39 2018 +0000 OpenBSD UBsan support common functions Summary: Ripped off OpenBSD specific from the common Linux implementation Patch by David Carlier Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: emaste, srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44036 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327674 91177308-0d34-0410-b5e6-96231b3b80d8 commit bc44f95c352f593a12e211f129f2952fa876ded6 Author: Martin Pelikan <martin.pelikan@gmail.com> Date: Thu Mar 15 12:10:43 2018 +0000 [TSan] fix Go runtime test on amd64 with PIE Summary: Without this diff, the test segfaults. Examining the generated executable (which gets auto-deleted likely by cmake/ninja) yields this error message: ThreadSanitizer failed to allocate 0x4000 (16384) bytes at address 1755558480000 (errno: 12) Note that the address has more than 47 bits, which on amd64 means special treatment and therefore points out an overflow. The allocation came from __tsan_map_shadow on a .data pointer, which (on my work Debian-based box) means the 0x550000000000 range. This doesn't correspond to the constants mentioned in tsan_platform.h for Go binaries on Linux/amd64. The diff therefore allocates memory in the sort of area Go programs would, and prevents the test from crashing. It would be nice if reviewers kindly considered other setups and architectures :-) Reviewers: kcc, dvyukov Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44071 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327621 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5e073b42727f893199a07e7bd0e76c662314e29f Author: Vitaly Buka <vitalybuka@google.com> Date: Thu Mar 15 01:13:29 2018 +0000 [sanitizer] Fix off type in mmap64 interceptor git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327596 91177308-0d34-0410-b5e6-96231b3b80d8 commit 11f8e7a5890a156f9c8747b2559a7a40f919c277 Author: Kostya Kortchinsky <kostyak@google.com> Date: Wed Mar 14 15:50:32 2018 +0000 [scudo] Add Chunk::getSize, rework Chunk::getUsableSize Summary: Using `getActuallyAllocatedSize` from the Combined resulting in mediocre compiled code, as the `ClassId != 0` predicament was not propagated there, resulting in additional branches and dead code. Move the logic in the frontend, which results in better compiled code. Also I think it makes it slightly easier to distinguish between the size the user requested, and the size that was actually allocated by the allocator. `const` a couple of things as well. This has no functional impact. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44444 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327525 91177308-0d34-0410-b5e6-96231b3b80d8 commit e24370110c39773a6d068a34676c7123f66ee1bc Author: Sylvestre Ledru <sylvestre@debian.org> Date: Tue Mar 13 14:35:10 2018 +0000 fix some user facing typos / in the comments git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327402 91177308-0d34-0410-b5e6-96231b3b80d8 commit dc85e2be5787b1b60a1a33be1d275a565ee3902c Author: Chih-Hung Hsieh <chh@google.com> Date: Mon Mar 12 15:29:23 2018 -0700 Revert "Reland "[libFuzzer] Support using libc++"" This reverts commit 03a88ba9f340248303a07ddab4dd41fdece50466. That commit breaks Android build.py. Test: build AOSP Change-Id: I7c9133e7fa32eaba4f74cb6239c5718e5fb1c5a9 commit 76cf66f4d6d8409a3369cf8ea94983ba9ede175e Author: Yi Kong <yikong@google.com> Date: Mon Dec 18 11:55:00 2017 -0800 Expand ALL_FUZZER_SUPPORTED_ARCH to include all Android supported archs Upstream it declares X86 as the only supported libfuzzer arch, to prevent issues with cross compilation. This change adds all the Android supported archs to ALL_FUZZER_SUPPORTED_ARCH. We need to figure out a way to upstream a proper fix for this. Bug: 70819574 Change-Id: I0f617768fb838f16f6b110f2735209c25639d543 commit 2d6790829bc896679b78b90331c3c0435a6bcd43 Merge: 9e1f331f3 6a52b697d Author: Chih-Hung Hsieh <chh@google.com> Date: Mon Mar 12 15:07:54 2018 -0700 Merge commit 6a52b697d56 * upstream svn@326768 Test: git diff 6a52b697d56 == git diff 98adaa209 e53507209 Change-Id: I1ed714360026b5ff2860d55befd97fc9edf81147 commit 9e1f331f3aaa5767c0bbe56dbd11fa1d93c0a126 Author: Chih-Hung Hsieh <chh@google.com> Date: Mon Mar 12 15:06:59 2018 -0700 Revert to previous base e53507209. Test: git diff e53507209 Change-Id: Ib9a2e7081ab6e42cba0f3def781c575194ca1279 commit 4c895bfe35adea9996ffe603d7ca215fb7e6d1ef Author: Alex Shlyapnikov <alekseys@google.com> Date: Mon Mar 12 21:59:06 2018 +0000 [Sanitizers] Add more standard compliant posix_memalign implementation for LSan. Summary: Add more standard compliant posix_memalign implementation for LSan and use corresponding sanitizer's posix_memalign implenetations in allocation wrappers on Mac. Reviewers: eugenis, fjricci Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44335 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327338 91177308-0d34-0410-b5e6-96231b3b80d8 commit 39ded27815df4a8cb76ad0b55461111ab35378e6 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Mon Mar 12 21:46:55 2018 +0000 [asan] poison_heap=0 should not disable __asan_handle_no_return. Reviewers: kcc, alekseyshl, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44339 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327337 91177308-0d34-0410-b5e6-96231b3b80d8 commit cc4629e776d0d196dd410cca62b9af110f1225c2 Author: Kostya Kortchinsky <kostyak@google.com> Date: Mon Mar 12 19:29:38 2018 +0000 [scudo] Secondary allocator overhaul to support Windows Summary: The need for this change stems from the fact that Windows doesn't support partial unmapping (`MEM_RELEASE` implies the entire allocated region). So we now have to keep track of the reserved region and the committed region, so that we can function without the trimming we did when dealing with larger alignments. Instead of just having a `ReservedAddressRange` per chunk, we introduce a `LargeChunkHeader` (and `LargeChunk` namespace) that additionally holds the committed size and the usable size. The former is needed for stats purposes, the latter is used by the frontend. Requiring both is debatable, we could only work with the usable size but then be off by up to a page per chunk when dealing with stats. Additionally, we introduce more stats since they turned out to be useful for experiments, and a `PrintStats` function that will be used by the combined allocator in later patch. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D43949 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327321 91177308-0d34-0410-b5e6-96231b3b80d8 commit ea50a1c66e94da932152145fbdd8b588560036c4 Author: Kostya Kortchinsky <kostyak@google.com> Date: Mon Mar 12 17:18:26 2018 +0000 [sanitizer] Align & pad the allocator structures to the cacheline size v2 Summary: This is a new version of D44261, which broke some builds with older gcc, as they can't align on a constexpr, but rather require an integer (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56859) among others. We introduce `SANITIZER_CACHE_LINE_SIZE` in `sanitizer_platform.h` to be used in `ALIGNED` attributes instead of using directly `kCacheLineSize`. Reviewers: alekseyshl, thakis Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44326 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327297 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8f248a533d150affba3ff5f62ee796b9523bdde6 Author: Petr Hosek <phosek@chromium.org> Date: Sat Mar 10 02:00:18 2018 +0000 [Fuzzer] When building for Fuchsia, add an explicit libc++ dependency libFuzzer dependes on C++ library, when building for Fuchsia, we need to ensure that libFuzzer is only being built after libc++ has been built, so we add an explicity dependency on it. Differential Revision: https://reviews.llvm.org/D44340 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327196 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1164bd823b1935a3f50c2bcce4c9ead8291933ab Author: Dan Liew <dan@su-root.co.uk> Date: Fri Mar 9 23:12:32 2018 +0000 [asan] Clean up the REQUIRES of `asan/TestCases/strcat-overlap.cc` by explicitly listing where we expect this test to work. Because this test invokes undefined behaviour all sorts of things can happen (e.g. crash, or on some bots asan manages to catch something). The test seems to pass okay on Darwin (x86_64/x86_64/i386) and on Linux (x86_64/i386) so explicitly require one of these platforms to run the test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327185 91177308-0d34-0410-b5e6-96231b3b80d8 commit f505320f53517f24d70259f78f84ef1e0dba4e72 Author: Peter Collingbourne <peter@pcc.me.uk> Date: Fri Mar 9 20:41:56 2018 +0000 cfi: Disable simple-pass.cpp on Darwin. -mretpoline does not work yet on Darwin. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327168 91177308-0d34-0410-b5e6-96231b3b80d8 commit c6ad367baca517ce86ec09f05e25f2187b655aec Author: Kostya Kortchinsky <kostyak@google.com> Date: Fri Mar 9 20:17:12 2018 +0000 [sanitizer] Revert rCRT327145 Summary: It breaks the Chromium toolchain due to: ``` lib/sanitizer_common/sanitizer_allocator_primary32.h:269:34: error: requested alignment is not an integer constant struct ALIGNED(kCacheLineSize) SizeClassInfo { ``` Reviewers: alekseyshl, thakis Reviewed By: thakis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44320 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327167 91177308-0d34-0410-b5e6-96231b3b80d8 commit ff2d057904474f978563112276df87143032421b Author: Peter Collingbourne <peter@pcc.me.uk> Date: Fri Mar 9 19:11:44 2018 +0000 Use branch funnels for virtual calls when retpoline mitigation is enabled. The retpoline mitigation for variant 2 of CVE-2017-5715 inhibits the branch predictor, and as a result it can lead to a measurable loss of performance. We can reduce the performance impact of retpolined virtual calls by replacing them with a special construct known as a branch funnel, which is an instruction sequence that implements virtual calls to a set of known targets using a binary tree of direct branches. This allows the processor to speculately execute valid implementations of the virtual function without allowing for speculative execution of of calls to arbitrary addresses. This patch extends the whole-program devirtualization pass to replace certain virtual calls with calls to branch funnels, which are represented using a new llvm.icall.jumptable intrinsic. It also extends the LowerTypeTests pass to recognize the new intrinsic, generate code for the branch funnels (x86_64 only for now) and lay out virtual tables as required for each branch funnel. The implementation supports full LTO as well as ThinLTO, and extends the ThinLTO summary format used for whole-program devirtualization to support branch funnels. For more details see RFC: http://lists.llvm.org/pipermail/llvm-dev/2018-January/120672.html Differential Revision: https://reviews.llvm.org/D42453 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327163 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0d7956335942ee1e32255e12d3b302c80ae5d021 Author: Kostya Kortchinsky <kostyak@google.com> Date: Fri Mar 9 16:18:38 2018 +0000 [sanitizer] Align & pad the allocator structures to the cacheline size Summary: Both `SizeClassInfo` structures for the 32-bit primary & `RegionInfo` structures for the 64-bit primary can be used by different threads, and as such they should be aligned & padded to the cacheline size to avoid false sharing. The former was padded but the array was not aligned, the latter was not padded but we lucked up as the size of the structure was 192 bytes, and aligned by the properties of `mmap`. I plan on adding a couple of fields to the `RegionInfo`, and some highly threaded tests pointed out that without proper padding & alignment, performance was getting a hit - and it is going away with proper padding. This patch makes sure that we are properly padded & aligned for both. I used a template to avoid padding if the size is already a multiple of the cacheline size. There might be a better way to do this, I am open to suggestions. Reviewers: alekseyshl, dvyukov Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44261 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327145 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1f433c4909dd21b31269d42ca116187d1bdc55fc Author: Dan Liew <dan@su-root.co.uk> Date: Fri Mar 9 12:26:29 2018 +0000 [asan] Try to unbreak arm build bots by only running the test on x86_64 and x86_64H (and not in the iOS simulator) where it seems to work. We need to properly fix the test when time permits. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327122 91177308-0d34-0410-b5e6-96231b3b80d8 commit f7e699a4e81cf30591a0226d737b1335da44148b Author: Kuba Mracek <mracek@apple.com> Date: Fri Mar 9 00:41:29 2018 +0000 Mark the -overlap tests are "UNSUPPORTED: android". Android test harness doesn't know how to handle suppression files. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327091 91177308-0d34-0410-b5e6-96231b3b80d8 commit c6d3dcdd6b737e2ef4720d5b59a9eb59258dbe59 Author: Kuba Mracek <mracek@apple.com> Date: Fri Mar 9 00:03:09 2018 +0000 Mark strcat-overlap.cc as "UNSUPPORTED: win32" git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327081 91177308-0d34-0410-b5e6-96231b3b80d8 commit eea34fb22d9d45ce80edf9879aa2e063bd0ddd85 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 23:53:29 2018 +0000 Move lto-constmerge-odr.cc to Posix (it's failing on Windows). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327080 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7332f89acb92bba401a4fd40d6f2f928896beb03 Author: Dan Liew <dan@su-root.co.uk> Date: Thu Mar 8 21:50:22 2018 +0000 [asan] Fix bug where suppression of overlapping accesses was ignored on `strcpy()`, `strncpy()`, `strcat()`, and `strncat()`. rdar://problem/35576899 Differential Revision: https://reviews.llvm.org/D43702 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327068 91177308-0d34-0410-b5e6-96231b3b80d8 commit 70aabe0941d94ac5e936fa2e5f6b745a653e6f45 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 21:02:52 2018 +0000 [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part, take 3] This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. See the included testcase for an example. Differential Revision: https://reviews.llvm.org/D43959 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327062 91177308-0d34-0410-b5e6-96231b3b80d8 commit 369b1057026155cf2a46aef40f6f047239b86860 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 18:20:03 2018 +0000 More revert of r327031 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327038 91177308-0d34-0410-b5e6-96231b3b80d8 commit bc85606fd81617dd6dc21200c73d00ccb58b6566 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 17:31:31 2018 +0000 Revert r327031 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327032 91177308-0d34-0410-b5e6-96231b3b80d8 commit e9572d640f9be27f781c4e2ceb4d8773fc470e70 Author: Kuba Mracek <mracek@apple.com> Date: Thu Mar 8 17:24:47 2018 +0000 [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part] This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. Differential Revision: https://reviews.llvm.org/D43959 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327031 91177308-0d34-0410-b5e6-96231b3b80d8 commit f8d672aa199e4dd12eb641ee168a8604e19aaec2 Author: Eugene Zemtsov <ezemtsov@google.com> Date: Thu Mar 8 04:34:22 2018 +0000 Build LLVMDemangle from build_symbolizer.sh Symbolizer now depends on internal implementation of itaniumDemangle. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326987 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5e71c6bf635d11864a52642d77754ceedb19efb2 Author: Eugene Zemtsov <ezemtsov@google.com> Date: Thu Mar 8 02:57:54 2018 +0000 Add Demangle lib into internalization list Symbolizer now depends on internal implementation of itaniumDemangle. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326983 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4b4c1dade5a766794775983263c8c2c60e9693b2 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 19:43:50 2018 +0000 [sanitizer] Fix SANITIZER_INTERCEPT_MMAP and SANITIZER_INTERCEPT_MMAP64 values git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326938 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7bcd41f70ccc1b88195ea8804e88ac89d30b6e46 Author: Petr Hosek <phosek@chromium.org> Date: Wed Mar 7 18:14:09 2018 +0000 [Fuzzer] Avoid the unnecessary rebuild of the custom libc++ This changes the add_custom_libcxx macro to resemble the llvm_ExternalProject_Add. The primary motivation is to avoid unnecessary libFuzzer rebuilds that are being done on every Ninja/Make invocation. The libc++ should be only rebuilt whenever the libc++ source itself changes. Differential Revision: https://reviews.llvm.org/D43213 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326921 91177308-0d34-0410-b5e6-96231b3b80d8 commit df0d7bf4bc073d15b096b88a26ec7e7871c942d4 Author: Kostya Kortchinsky <kostyak@google.com> Date: Wed Mar 7 16:22:16 2018 +0000 [scudo] Make logging more consistent Summary: A few changes related to logging: - prepend `Scudo` to the error messages so that users can identify that we reported an error; - replace a couple of `Report` calls in the RSS check code with `dieWithMessage`/`Print`, mark a condition as `UNLIKELY` in the process; - change some messages so that they all look more or less the same. This includes the `CHECK` message; - adapt a couple of tests with the new strings. A couple of side notes: this results in a few 1-line-blocks, for which I left brackets. There doesn't seem to be any style guide for that, I can remove them if need be. I didn't use `SanitizerToolName` in the strings, but directly `Scudo` because we are the only users, I could change that too. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44171 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326901 91177308-0d34-0410-b5e6-96231b3b80d8 commit 41f54f83a6b2114e4bc2237537f2feaed18fc6b8 Author: Kamil Rytarowski <n54@gmx.com> Date: Wed Mar 7 09:16:10 2018 +0000 Don't intercept mmap64() on NetBSD Disable SANITIZER_INTERCEPT_MMAP64 for SI_NETBSD. NetBSD switched to 64-bit offsets almost 30 years ago on 32-bit platforms and never needed mmap64() concept. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326883 91177308-0d34-0410-b5e6-96231b3b80d8 commit dd41ac244184bda1751f065ac467fc8ac260d1fd Author: George Burgess IV <george.burgess.iv@gmail.com> Date: Wed Mar 7 07:36:23 2018 +0000 Attempt to appease buildbots I can't reproduce this build error locally, but it appears straightforward enough to fix. r326851 renamed two of the params of this interceptor, but apparently to update their use here. Failure: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/4569 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326876 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0639500fd242d68428b9e2959c7bf5227b9aeca8 Author: Adam Nemet <anemet@apple.com> Date: Wed Mar 7 05:33:37 2018 +0000 Disable tests from r326852 on Darwin Darwin needs xlocale.h but I see no precedence in the code how non-Posix headers like this are handled and I am not experienced with this code. Just disable the tests for now to recover the bots. rdar://38208146 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326874 91177308-0d34-0410-b5e6-96231b3b80d8 commit 74e7bc0d6590da2181fae37627e2658a4af6e487 Author: Dean Michael Berris <dberris@google.com> Date: Wed Mar 7 02:45:14 2018 +0000 [XRay][compiler-rt] Add APIs for processing logs in memory Summary: This change adds APIs to allow logging implementations to provide a function for iterating through in-memory buffers (if they hold in-memory buffers) and a way for users to generically deal with these buffers in-process. These APIs are: - __xray_log_set_buffer_iterator(...) and __xray_log_remove_buffer_iterator(): installs and removes an iterator function that takes an XRayBuffer and yields the next one. - __xray_log_process_buffers(...): takes a function pointer that can take a mode identifier (string) and an XRayBuffer to process this data as they see fit. The intent is to have the FDR mode implementation's buffers be available through this `__xray_log_process_buffers(...)` API, so that they can be streamed from memory instead of flushed to disk (useful for getting the data to a network, or doing in-process analysis). Basic mode logging will not support this mechanism as it's designed to write the data mostly to disk. Future implementations will may depend on this API as well, to allow for programmatically working through the XRay buffers exposed to the users in some fashion. Reviewers: eizan, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43495 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326866 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2e65830de05d20662908cce16498e139fe29887c Author: Kuba Mracek <mracek@apple.com> Date: Wed Mar 7 02:30:55 2018 +0000 Fixup r326851: mmap64 interceptor should not be used on Darwin. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326864 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2ccfc5617bd2308b9063c5a21035ec8f2d27ba89 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:15:10 2018 +0000 [sanitizer] Update symbolizer test git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326855 91177308-0d34-0410-b5e6-96231b3b80d8 commit 77712da5be6ad0e4483747826547756c15d1f4c3 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:14:52 2018 +0000 [sanitizer] Extract common code into STRXFRM_INTERCEPTOR_IMPL git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326854 91177308-0d34-0410-b5e6-96231b3b80d8 commit e6fe6d618bcd23f8baa1d3b2bb38f236c019ba2d Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:14:30 2018 +0000 [sanitizer] Move strxfrm interceptors into sanitizer_common git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326853 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4f09499dc766ec4ce5170f4553a6951a5e063c29 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:14:12 2018 +0000 [sanitizer] Add interceptors for wcsxfrm, wcsxfrm_l Patch by Oliver Chang Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44133 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326852 91177308-0d34-0410-b5e6-96231b3b80d8 commit 03e114b188efa25ce9371cd4c1e212477e0981d3 Author: Vitaly Buka <vitalybuka@google.com> Date: Wed Mar 7 00:13:54 2018 +0000 [sanitizer] Move mmap interceptors into sanitizer_common Reviewers: devnexen, krytarowski, eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44125 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326851 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6702fa4a371471894dbf0e7e63cdcffb744f1620 Author: Dean Michael Berris <dberris@google.com> Date: Tue Mar 6 23:06:09 2018 +0000 [XRay][compiler-rt] Make unit tests depend on implementation files Summary: This change makes changes to XRay implementation files trigger re-builds of the unit tests. Prior to this change, the unit tests were not built and run properly if the implementation files were changed during the development process. This change forces the dependency on all files in the XRay include and lib hosted files in compiler-rt. Caveat is, that new files added to the director(ies) will need a re-run of CMake to re-generate the fileset. We think this is an OK compromise, since adding new files may necessitate editing (or adding) new unit tests. It's also less likely that we're adding new files without updating the CMake configuration to include the functionality in the XRay runtime implementation anyway. Reviewers: pelikan, kpw, nglevin Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D44080 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326842 91177308-0d34-0410-b5e6-96231b3b80d8 commit fda7be249930e29d47db4e21535c618afebfc8f5 Author: Kostya Kortchinsky <kostyak@google.com> Date: Tue Mar 6 20:13:37 2018 +0000 [scudo] Use gc-sections by default Summary: If not using `-Wl,--gc-sections`, a whole lot of unused `sanitizer_common` code and related static variables are pulled into the shared library. Keep the binary size smaller, and its memory footprint smaller as well, by using the compiler flags `-ffunction-section` & `-fdata-sections` by default, as well as the linker flags `-Wl,--gc-sections`. Current experiments show a large discrepency between binary sizes generated by gcc (big) and clang (small). I am not sure yet how I can make a test that would encompass both, so it's an outstanding work item. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44121 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326833 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6a52b697d564699d511de92bce88e15bf6fc56b8 Author: Kamil Rytarowski <n54@gmx.com> Date: Tue Mar 6 08:24:16 2018 +0000 OpenBSD sanitizer common, define RLIMIT_AS constant Summary: define RLIMIT_AS constant until it s defined in the future Patch by: David Carlier Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44068 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326768 91177308-0d34-0410-b5e6-96231b3b80d8 commit 115b7e9a67cae5e81daf12b58e035d1eaff21140 Author: Petr Hosek <phosek@chromium.org> Date: Tue Mar 6 02:01:32 2018 +0000 [sanitizer] Fix the return type for GetTid in Fuchsia implementation This is triggering "functions that differ only in their return type cannot be overloaded" error. Differential Revision: https://reviews.llvm.org/D44126 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326759 91177308-0d34-0410-b5e6-96231b3b80d8 commit ac596966cd96f9a0b781b96e7eaf1566d970b88c Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Wed Nov 8 00:15:12 2017 +0000 [sanitizer] Asm implementation of syscall() for arm32. Summary: These will be used in an ifunc resolver, when the binary may not be completely relocated, and syscall() function from libc could not be used. Reviewers: dvyukov, vitalybuka Subscribers: aemerson, kubamracek, javed.absar, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D39701 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317640 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6063ee2eec3187838cb580e26137986dc90789c5 Author: Yi Kong <yikong@google.com> Date: Fri Jan 19 19:29:22 2018 -0800 [ubsan] Disable signal handling on Android. Taken from https://reviews.llvm.org/D42329 to fix Android build. Change-Id: I4e602452129304c4f281010efa015d000bea754e commit d5ab806ae9e9b6170e8909cbcef19d3de305c799 Author: Yi Kong <yikong@google.com> Date: Thu Dec 28 23:06:24 2017 +0000 Ignore the DISPATCH_NOESCAPE if not defined This macro is only defined after XCode 8, causing build breakage for build systems with prior versions. Ignore DISPATCH_NOESCAPE if not defined. Differential Revision: https://reviews.llvm.org/D41601 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321543 91177308-0d34-0410-b5e6-96231b3b80d8 commit d2dd86bc1ebb9cd9339023ec9d657c22b52c0200 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Tue Nov 7 23:51:22 2017 +0000 (NFC) Rename GetMax{,User}VirtualAddress. Future change will introduce GetMaxVirtualAddress that will not take the kernel area into account. Change-Id: I5b3ef1bed1d823a0dad79a434a8a4c93c8888e2d git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317638 91177308-0d34-0410-b5e6-96231b3b80d8 commit b89b3640aeff016d49768fef0d9250cfc158b70a Author: Yi Kong <yikong@google.com> Date: Mon Dec 18 11:55:00 2017 -0800 Expand ALL_FUZZER_SUPPORTED_ARCH to include all Android supported archs Upstream it declares X86 as the only supported libfuzzer arch, to prevent issues with cross compilation. This change adds all the Android supported archs to ALL_FUZZER_SUPPORTED_ARCH. We need to figure out a way to upstream a proper fix for this. Bug: 70819574 Change-Id: I1164439d6eb2f3daad6eee0679182a32928c0ef6 commit 5818606a1ba6c81d8de1bd145aa7e6d45dc85901 Author: Evgeniy Stepanov <eugeni.stepanov@gmail.com> Date: Mon Nov 20 17:41:57 2017 +0000 [asan] Use dynamic shadow on 32-bit Android, try 2. Summary: This change reverts r318575 and changes FindDynamicShadowStart() to keep the memory range it found mapped PROT_NONE to make sure it is not reused. We also skip MemoryRangeIsAvailable() check, because it is (a) unnecessary, and (b) would fail anyway. Reviewers: pcc, vitalybuka, kcc Subscribers: srhines, kubamracek, mgorny, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D40203 Change-Id: I779e4c394f6d90234150dcbd18cc9d06499ed962 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318666 91177308-0d34-0410-b5e6-96231b3b80d8 commit 81bfe08c5b3ea267c40632dc4cee5f85752f1698 Author: Peter Collingbourne <peter@pcc.me.uk> Date: Fri Nov 10 22:09:37 2017 +0000 sanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does not work. If the lookup using RTLD_NEXT failed, the sanitizer runtime library is later in t…
@eugenis: Status? |
Would it work to intercept |
_exit discards address space and execve completely replaces address space, so doing anything there looks pointless (can't have any effect on anything). |
But after |
Also why cannot we unpoison now-unallocated part of the parent process stack from |
Ah, I see what you mean. My bad. @eugenis what do you think. |
If we intercept execve, we'll need to intercept _exit, and some other
functions as well. The full list is not clear to me.
Intercepting vfork will work, but is extremely platform-dependent and must
be done in assembly. Note that a function that calls vfork can not return
in the child process, or it would corrupt the stack frame in the parent.
…On Wed, Oct 10, 2018 at 8:11 AM Dmitry Vyukov ***@***.***> wrote:
But after vfork and until execve child process is operating in address
space of the parent, intercepting execve would allow us to inject desired
epilogue to do necessary cleanup of leftover poisoning before replacing the
address space?
Ah, I see what you mean. My bad. @eugenis <https://github.com/eugenis>
what do you think.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#925 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZuSvt3QUuXuZ7u-tzSTj0MA9rd2RyCks5ujg4VgaJpZM4SuYXN>
.
|
Yeah, agree that intercepting |
Yes, it should work in practice. We'd need to intercept a ton of exec* functions, but it still feels better than a platform specific vfork interceptor. |
Intercepting execve doesn't seem like it's the right way to go, since it can fail. This code doesn't seem completely insane to me, for example: pid_t pid = vfork();
if (pid == 0) {
execl("/bin/foo", "foo", nullptr);
execl("/usr/bin/foo", "foo", nullptr);
execl("/usr/local/bin/foo", "foo", nullptr);
_exit(1);
} |
Good point. Sounds like we will have to bite the bullet and wrap vfork in
assembly.
We can not do the system call directly, because libc function may need to
maintain internal state - ex. in bionic it clears the cached pid.
To wrap the libc function, we'd need a place to store the return address,
and we can not use stack for that. Libc has it easy - the kernel preserves
more registers than userspace ABI function does. Bionic stores the return
address in RDI (x86_64) and LR (arm64). Our interceptor has the same ABI as
the libc function, so there are no free registers.
We could use a thread local slot, or just grab a lock and use a global
variable. Does anyone have a better idea?
Note that in a multithreaded program two threads can call vfork
simultaneously. That would be completely crazy, of course, but the man page
states that only the calling thread is frozen while vfork child runs.
Nested vforks are not allowed. A lock can be used to serialize all vfork
calls. Child threads will not touch the lock (i.e. will run with lock held).
…On Mon, Dec 3, 2018 at 1:40 PM Josh Gao ***@***.***> wrote:
Intercepting execve doesn't seem like it's the right way to go, since it
can fail. This code doesn't seem completely insane to me, for example:
pid_t pid = vfork();if (pid == 0) {
execl("/bin/foo", "foo", nullptr);
execl("/usr/bin/foo", "foo", nullptr);
execl("/usr/local/bin/foo", "foo", nullptr);
_exit(1);
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#925 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZuSpGuak1LHsJUs-Q5iYR8oRaL-5rEks5u1Zo2gaJpZM4SuYXN>
.
|
Do you actually need to stash the return address? Can't you just tail call to your unpoisoning function? e.g. something like:
pid_t __vfork_unpoison_stack(pid_t rc) {
// ...
return rc;
} |
On Mon, Dec 3, 2018 at 3:00 PM Josh Gao ***@***.***> wrote:
Do you actually need to stash the return address? Can't you just tail call to your unpoisoning function? e.g. something like:
vfork:
bl __real_vfork
Did not you just destroy the return address in LR?
… cmp r0, #0
bxgt __vfork_unpoison_stack
bx lr
pid_t __vfork_unpoison_stack(pid_t rc) {
// ...
return rc;
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Oops, right, I'm dumb. Sticking it in TLS seems like the best option to me.
bionic uses vfork in posix_spawn if you either explicitly ask for vfork, or if you're doing something trivial that boils down to |
I've uploaded a first revision of asm interceptor for vfork using thread-local storage for return address here: |
r355030 intercepts vfork in hwasan & asan on x86, x86_64, arm, aarch64. |
Call a hwasan hook in the parent return path for vfork() to let hwasan update its shadow. See google/sanitizers#925 for more details. Bug: 112438058 Test: bionic-unit-tests Change-Id: I9a06800962913e822bd66e072012d0a2c5be453d
Call a hwasan hook in the parent return path for vfork() to let hwasan update its shadow. See google/sanitizers#925 for more details. Bug: 112438058 Test: bionic-unit-tests Change-Id: I9a06800962913e822bd66e072012d0a2c5be453d
Call a hwasan hook in the parent return path for vfork() to let hwasan update its shadow. See google/sanitizers#925 for more details. Bug: 112438058 Test: bionic-unit-tests Change-Id: I9a06800962913e822bd66e072012d0a2c5be453d
ASan has stack false positives with vfork(). After vfork(), child process runs in the context and on the stack of parent process and poisons it. After that, execve() returns control to the parent (kind of like longjmp()) with leftover poisoning in newly-unallocated stack space.
See https://android-review.googlesource.com/#/c/platform/libcore/+/641439/ for an example.
AFAIK, it is always safe to replace vfork() with fork(). Do that in an interceptor.
The text was updated successfully, but these errors were encountered: