summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_win.cc
AgeCommit message (Collapse)Author
2017-08-14[sanitizers] Add a blocking boolean to GetRandom prototypeKostya Kortchinsky
Summary: On platforms with `getrandom`, the system call defaults to blocking. This becomes an issue in the very early stage of the boot for Scudo, when the RNG source is not set-up yet: the syscall will block and we'll stall. Introduce a parameter to specify that the function should not block, defaulting to blocking as the underlying syscall does. Update Scudo to use the non-blocking version. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D36399 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-22[sanitizer_common] Move filesystem-related code out of sanitizer_common.ccVitaly Buka
Summary: This is a pure refactoring change. It just moves code that is related to filesystem operations from sanitizer_common.{cc,h} to sanitizer_file.{cc,h}. This makes it cleaner to disable the filesystem-related code for a new port that doesn't want it. Submitted on behalf of Roland McGrath. Reviewers: kcc, eugenis, alekseyshl Reviewed By: alekseyshl Subscribers: vitalybuka, llvm-commits, kubamracek, mgorny, phosek Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D35591 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308819 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12[asan] For iOS/AArch64, if the dynamic shadow doesn't fit, restrict the VM spaceKuba Mracek
On iOS/AArch64, the address space is very limited and has a dynamic maximum address based on the configuration of the device. We're already using a dynamic shadow, and we find a large-enough "gap" in the VM where we place the shadow memory. In some cases and some device configuration, we might not be able to find a large-enough gap: E.g. if the main executable is linked against a large number of libraries that are not part of the system, these libraries can fragment the address space, and this happens before ASan starts initializing. This patch has a solution, where we have a "backup plan" when we cannot find a large-enough gap: We will restrict the address space (via MmapFixedNoAccess) to a limit, for which the shadow limit will fit. Differential Revision: https://reviews.llvm.org/D35098 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26[Sanitizers] 64 bit allocator respects allocator_may_return_null flagAlex Shlyapnikov
Summary: Make SizeClassAllocator64 return nullptr when it encounters OOM, which allows the entire sanitizer's allocator to follow allocator_may_return_null=1 policy (LargeMmapAllocator: D34243, SizeClassAllocator64: D34433). Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34540 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306342 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22[Sanitizers] 32 bit allocator respects allocator_may_return_null flagAlex Shlyapnikov
Summary: Make SizeClassAllocator32 return nullptr when it encounters OOM, which allows the entire sanitizer's allocator to follow allocator_may_return_null=1 policy, even for small allocations (LargeMmapAllocator is already fixed by D34243). Will add a test for OOM in primary allocator later, when SizeClassAllocator64 can gracefully handle OOM too. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34433 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305972 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-21[sanitizer] Add a function to gather random bytesKostya Kortchinsky
Summary: AFAICT compiler-rt doesn't have a function that would return 'good' random bytes to seed a PRNG. Currently, the `SizeClassAllocator64` uses addresses returned by `mmap` to seed its PRNG, which is not ideal, and `SizeClassAllocator32` doesn't benefit from the entropy offered by its 64-bit counterpart address space, so right now it has nothing. This function aims at solving this, allowing to implement good 32-bit chunk randomization. Scudo also has a function that does this for Cookie purposes, which would go away in a later CL once this lands. This function will try the `getrandom` syscall if available, and fallback to `/dev/urandom` if not. Unfortunately, I do not have a way to implement and test a Mac and Windows version, so those are unimplemented as of now. Note that `kRandomShuffleChunks` is only used on Linux for now. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: zturner, rnk, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D34412 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16[Sanitizers] Secondary allocator respects allocator_may_return_null=1.Alex Shlyapnikov
Summary: Context: https://github.com/google/sanitizers/issues/740. Making secondary allocator to respect allocator_may_return_null=1 flag and return nullptr when "out of memory" happens. More changes in primary allocator and operator new will follow. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34243 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305569 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14[sanitizer] Reverting D34152Kostya Kortchinsky
Summary: This broke thread_local_quarantine_pthread_join.cc on some architectures, due to the overhead of the stashed regions. Reverting while figuring out the best way to deal with it. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D34213 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305404 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14[sanitizer] MmapAlignedOrDie changes to reduce fragmentationKostya Kortchinsky
Summary: The reasoning behind this change is explained in D33454, which unfortunately broke the Windows version (due to the platform not supporting partial unmapping of a memory region). This new approach changes `MmapAlignedOrDie` to allow for the specification of a `padding_chunk`. If non-null, and the initial allocation is aligned, this padding chunk will hold the address of the extra memory (of `alignment` bytes). This allows `AllocateRegion` to get 2 regions if the memory is aligned properly, and thus help reduce fragmentation (and saves on unmapping operations). As with the initial D33454, we use a stash in the 32-bit Primary to hold those extra regions and return them on the fast-path. The Windows version of `MmapAlignedOrDie` will always return a 0 `padding_chunk` if one was requested. Reviewers: alekseyshl, dvyukov, kcc Reviewed By: alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D34152 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-02[sanitizer-coverage] nuke more stale codeKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304504 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25[compiler-rt] Replace allow_user_segv_handler=0 with kHandleSignalExclusiveVitaly Buka
Summary: allow_user_segv_handler had confusing name did not allow to control behavior for signals separately. Reviewers: eugenis, alekseyshl, kcc Subscribers: llvm-commits, dberris, kubamracek Differential Revision: https://reviews.llvm.org/D33371 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19Use write instead of read permissions to check for global sections on macFrancis Ricci
Summary: The LINKEDIT section is very large and is read-only. Scanning this section caused LSan on darwin to be very slow. When only writable sections are scanned for global pointers, performance improved by a factor of about 25x. Reviewers: alekseyshl, kubamracek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33322 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303422 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17[sanitizer] Introduce tid_t as a typedef for OS-provided thread IDsKuba Mracek
We seem to assume that OS-provided thread IDs are either uptr or int, neither of which is true on Darwin. This introduces a tid_t type, which holds a OS-provided thread ID (gettid on Linux, pthread_threadid_np on Darwin, pthread_self on FreeBSD). Differential Revision: https://reviews.llvm.org/D31774 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300473 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17Don't read non-readable address ranges during lsan pointer scanningFrancis Ricci
Summary: This specifically addresses the Mach-O zero page, which we cannot read from. Reviewers: kubamracek, samsonov, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32044 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300456 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09[sanitizer] Bail out with warning if user dlopens shared library with ↵Maxim Ostapenko
RTLD_DEEPBIND flag People keep hitting on spurious failures in malloc/free routines when using sanitizers with shared libraries dlopened with RTLD_DEEPBIND (see https://github.com/google/sanitizers/issues/611 for details). Let's check for this flag and bail out with warning message instead of failing in random places. Differential Revision: https://reviews.llvm.org/D30504 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297370 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02[sanitizer] Move DescribeSignalOrException to sanitizer_common.Marcos Pividori
Differential Revision: https://reviews.llvm.org/D29459 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293956 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02[sanitizer] Move exception code to sanitizer_common.Marcos Pividori
Differential Revision: https://reviews.llvm.org/D29458 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293955 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29General definition for weak functionsMarcos Pividori
In this diff, I define a general macro for defining weak functions with a default implementation: "SANITIZER_INTERFACE_WEAK_DEF()". This way, we simplify the implementation for different platforms. For example, we cannot define weak functions on Windows, but we can use linker pragmas to create an alias to a default implementation. All of these implementation details are hidden in the new macro. Also, as I modify the name for exported weak symbols on Windows, I needed to temporarily disable "dll_host" test for asan, which checks the list of functions included in asan_win_dll_thunk. Differential Revision: https://reviews.llvm.org/D28596 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293419 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-20[sanitizer] [asan] Use macros to simplify weak aliases on Windows.Marcos Pividori
This patch adds some useful macros for dealing with pragma directives on Windows. Also, I add appropriate documentation for future users. Differential Revision: https://reviews.llvm.org/D28525 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06[sanitizer] Add a 'print_module_map' flag which prints modules with UUIDs on ↵Kuba Mracek
Darwin This patch add a new sanitizer flag, print_module_map, which enables printing a module map when the process exits, or after each report (for TSan). The output format is very similar to what Crash Reporter produces on Darwin (e.g. the format of module UUIDs). This enables users to use the existing symbol servers to offline symbolicate and aggregate reports. Differential Revision: https://reviews.llvm.org/D27400 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291277 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05break overly long line in sanitizer_win.ccBob Haarman
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291062 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05fix warning about noreturn in sanitizer_win's internal__exit()Bob Haarman
Summary: A previous fix used __assume(0), but not all compilers know that control will not pass that. This patch uses a macro which works in more compilers. Reviewers: rnk Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D28268 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291042 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13Fix warning for noreturn functionReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289568 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-30Release memory to OS only when the requested range covers the entire pageEvgeniy Stepanov
Summary: The current code was sometimes attempting to release huge chunks of memory due to undesired RoundUp/RoundDown interaction when the requested range is fully contained within one memory page. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D27228 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288271 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26[asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGVKuba Mracek
This patch prints out all CPU registers after a SIGSEGV. These are available in the signal handler context. Only implemented for Darwin. Can be turned off with the dump_registers flag. Differential Revision: https://reviews.llvm.org/D11365 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@287957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14[asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initializationReid Kleckner
Summary: ASan needs to initialize before ucrtbase.dll so that it can intercept all of its heap allocations. New versions of dbghelp.dll depend on ucrtbase.dll, which means both of those DLLs will initialize before the dynamic ASan runtime. By lazily loading dbghelp.dll with LoadLibrary, we avoid the issue. Eventually, I would like to remove our dbghelp.dll dependency in favor of always using llvm-symbolizer.exe, but this seems like an acceptable interim solution. Fixes PR30903 Reviewers: etienneb Subscribers: kubabrecka, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D26473 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286848 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11[asan/win] Fix wrong TerminateProcess exit codeReid Kleckner
Add a test for it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286608 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-10[asan/win] Move breakpoint from Abort to internal__exitReid Kleckner
Now that we use TerminateProcess, the debugger doesn't stop on program exit. Add this breakpoint so that the debugger stops after asan reports an error and is prepared to exit the program. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-09[asan/win] Use TerminateProcess when we want to exit abnormallyReid Kleckner
ExitProcess still runs some code which can lead to ASan interceptors running after CHECK failure. This can lead to deadlock if it CHECK fails again. Avoid that mess by really exiting immediately. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286395 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28tsan: always define SANITIZER_GODmitry Vyukov
Currently we either define SANITIZER_GO for Go or don't define it at all for C++. This works fine with preprocessor (ifdef/ifndef/defined), but does not work for C++ if statements (e.g. if (SANITIZER_GO) {...}). Also this is different from majority of SANITIZER_FOO macros which are always defined to either 0 or 1. Always define SANITIZER_GO to either 0 or 1. This allows to use SANITIZER_GO in expressions and in flag default values. Also remove kGoMode and kCppMode, which were meant to be used in expressions, but they are not defined in sanitizer_common code, so SANITIZER_GO become prevalent. Also convert some preprocessor checks to C++ if's or ternary expressions. Majority of this change is done mechanically with: sed "s#ifdef SANITIZER_GO#if SANITIZER_GO#g" sed "s#ifndef SANITIZER_GO#if \!SANITIZER_GO#g" sed "s#defined(SANITIZER_GO)#SANITIZER_GO#g" git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285443 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28tsan: fix windows buildDmitry Vyukov
Currently fails with: C:\workdir\compiler-rt\lib\tsan\go>gcc -c -o race_windows_amd64.syso gotsan.cc -I..\rtl -I..\.. -I..\..\sanitizer_common -I..\..\..\include -m64 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO -Wno-error=at tributes -Wno-attributes -Wno-format -Wno-maybe-uninitialized -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer -std=c++11 gotsan.cc:9229:0: warning: ignoring #pragma comment [-Wunknown-pragmas] #pragma comment(linker, "/alternatename:__sanitizer_print_memory_profile=__sanitizer_default_print_memory_profile") // NOLINT ^ gotsan.cc: In function 'void __sanitizer_print_memory_profile(int)': gotsan.cc:9226:17: error: redefinition of 'void __sanitizer_print_memory_profile(int)' extern "C" void __sanitizer_print_memory_profile(int top_percent) {} ^ gotsan.cc:6898:6: note: 'void __sanitizer_print_memory_profile(int)' previously defined here void __sanitizer_print_memory_profile(int top_percent) { Remove __sanitizer_print_memory_profile from Go build, it is not needed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285400 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30[compiler-rt] Add support for the dynamic shadow allocationEtienne Bergeron
Summary: This patch is adding support for dynamic shadow allocation. This is a merge and re-commit of the following patches. ``` [compiler-rt] Fix Asan build on Android https://reviews.llvm.org/D24768 [compiler-rt] Add support for the dynamic shadow allocation https://reviews.llvm.org/D23363 ``` This patch needed to re-land at the same time: ``` [asan] Support dynamic shadow address instrumentation https://reviews.llvm.org/D23354 ``` Reviewers: rnk, zaks.anna Subscribers: tberghammer, danalbert, kubabrecka, dberris, chrisha, llvm-commits Differential Revision: https://reviews.llvm.org/D25104 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282882 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21revert 282085, 281909, they broke 32-bit dynamic ASan and the ↵Nico Weber
sanitizer-windows bot git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282096 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-19[compiler-rt] Add support for the dynamic shadow allocationEtienne Bergeron
Summary: This patch is adding the needed code to compiler-rt to support dynamic shadow. This is to support this patch: https://reviews.llvm.org/D23354 It's adding support for using a shadow placed at a dynamic address determined at runtime. The dynamic shadow is required to work on windows 64-bits. Reviewers: rnk, kcc, vitalybuka Subscribers: kubabrecka, dberris, llvm-commits, chrisha Differential Revision: https://reviews.llvm.org/D23363 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15Really fix the Windows sanitizer buildReid Kleckner
Don't list __sanitizer_print_memory profile as an INTERFACE_FUNCTION. It is not exported by ASan; it is exported by user code. Move the weak definition from asan_win.cc to sanitizer_win.cc to fix the ubsan tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281619 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[asan] first attempt at releasing free-d memory back to the system using ↵Kostya Serebryany
madvise. Requires quite some tuning. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279887 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05Fix dumping of process module list and test itReid Kleckner
I probably broke this a year ago in r243895. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277842 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-04[compiler-rt] Fix memory allocator for dynamic address spaceEtienne Bergeron
Summary: The sanitizer allocators can works with a dynamic address space (i.e. specified with ~0ULL). Unfortunately, the code was broken on GetMetadata and GetChunkIdx. The current patch is moving the Win64 memory test to a dynamic address space. There is a migration to move every concept to a dynamic address space on windows. To have a better coverage, the unittest are now testing dynamic address space on other platforms too. Reviewers: rnk, kcc Subscribers: kubabrecka, dberris, llvm-commits, chrisha Differential Revision: https://reviews.llvm.org/D23170 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277745 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21[sanitizer] better allocator stats (with rss)Kostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276343 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21[compiler-rt] Fix broken SymInitialize unittestEtienne Bergeron
Summary: By adding the initialisation of the symbolisation library (DbgHelp) we are swapping the order in which both warnings are produced. We can't use CHECK-NEXT as the dbghelp warning is multiline. Reviewers: rnk Subscribers: kubabrecka, llvm-commits, wang0109, chrisha Differential Revision: https://reviews.llvm.org/D22586 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276228 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20tsan: fix windows buildDmitry Vyukov
It's only asan that installs vectored SEH handler to map memory lazily. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276112 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18revert https://reviews.llvm.org/D22393Etienne Bergeron
It is breaking build 32-bit build bots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275816 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15TestCase null_deref was failing in Win64:Etienne Bergeron
c:\lipo\work\asan\b_llvm>c:\lipo\work\asan\b_llvm\projects\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Output\null_deref.cc.tmp ================================================================= ==5488==ERROR: AddressSanitizer: access-violation on unknown address 0x000000000028 (pc 0x7ff701f91067 bp 0x000c8cf8fbf0 sp 0x000c8cf8fbb0 T0) ==5488==The signal is caused by a READ memory access. ==5488==Hint: address points to the zero page. #0 0x7ff701f91066 in NullDeref(int *) C:\lipo\work\asan\llvm\projects\compiler-rt\test\asan\TestCases\null_deref.cc:15:10 #1 0x8a0388830a67 (<unknown module>) The reason was symbols was not initilized. In fact, it was first inited with a call to stack.Print(), which calls WinSymbolizerTool::SymbolizePC, then InitializeDbgHelpIfNeeded(). Since the StackWalk was performed before the stack.Print(), stack frames where not gathered correctly. There should be a better place to initialize symbols. For now, this patch makes the test happy. Patch by Wei Wang Differential Revision: https://reviews.llvm.org/D22410 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275580 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14[compiler-rt] Fix missing frame with stackwalking on windows 64-bitsEtienne Bergeron
Summary: Fix missing frame with stackwalking on windows 64-bits Reviewers: rnk Subscribers: llvm-commits, wang0109, kubabrecka, chrisha Differential Revision: https://reviews.llvm.org/D22358 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275486 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[asan] Add exception handler to map memory on demand on Win64.Etienne Bergeron
Memory will be committed on demand when exception happens while accessing shadow memeory region. Patch by: Wei Wang Differential Revision: http://reviews.llvm.org/D21942 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275107 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-07[compiler-rt] Fix sanitizer memory allocator on win64.Etienne Bergeron
Summary: This patch is fixing unittests for sanitizer memory allocator. There was two issues: 1) The VirtualAlloc can't reserve twice a memory range. The memory space used by the SizeClass allocator is reserved with NoAccess and pages are commited on demand (using MmapFixedOrDie). 2) The address space is allocated using two VirtualAlloc calls. The first one for the memory space, the second one for the AdditionnalSpace (after). On windows, they need to be freed separately. Reviewers: rnk Subscribers: llvm-commits, wang0109, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21900 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274772 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23Use CreateFileA and add a FIXME to switch to the wide variantReid Kleckner
No functional change. Required to build with -DUNICODE, as is done in http://reviews.llvm.org/D21643 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273571 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix windows supportDmitry Vyukov
UnmapOrDie used to do MEM_DECOMMIT and so worked on partial regions. But r263160 changed it to use MEM_RELEASE and MEM_RELEASE can only work with whole regions mapped by VirtualAlloc. This broke windows as: FATAL: ThreadSanitizer CHECK failed: gotsan.cc:8296 "((mbi.AllocationBase == addr && "Windows cannot unmap part of a previous mapping")) != (0)" (0x0, 0x0) Restore the previous behavior. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267730 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix windows buildDmitry Vyukov
warning: '__sanitizer::uptr __sanitizer::GetPreferredBase(const char*)' defined but not used git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267682 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23[sanitizer] add a function MmapNoAccess that mmaps a protected region ↵Kostya Serebryany
*somewhere*; use MmapNoAccess in the Allocator when SpaceBeg is not a constant. In this mode the allocator will be a bit more hardened git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267256 91177308-0d34-0410-b5e6-96231b3b80d8