f7ed23f744 
								
							 
						 
						
							
							
								
								[compiler-rt] Fix build (again) by wrapping lines to 80 chars (NFC)  
							
							... 
							
							
							
							llvm-svn: 248979 
							
						 
						
							2015-10-01 02:15:40 +00:00  
				
					
						
							
							
								 
						
							
								59ba7b8cd1 
								
							 
						 
						
							
							
								
								[compiler-rt] Apply modernize-use-nullptr fixes in sanitizers  
							
							... 
							
							
							
							- Trim spaces.
- Use nullptr in place of 0 for pointer variables.
- Use '!p' in place of 'p == 0' for null pointer checks.
- Add blank lines to separate function definitions.
- Add 'extern "C"' or 'namespace foo' comments after the appropriate
  closing brackets
This is a continuation of work from 409b7b82. The focus here is on the
various sanitizers (not sanitizer_common, as before).
Patch by Eugene Zelenko!
Differential Revision: http://reviews.llvm.org/D13225 
llvm-svn: 248966 
							
						 
						
							2015-10-01 00:22:21 +00:00  
				
					
						
							
							
								 
						
							
								cc45ee9a63 
								
							 
						 
						
							
							
								
								Try to fix the MSVC build now that we use /Zc:inline.  
							
							... 
							
							
							
							Thanks to Majnemer for the help.
llvm-svn: 244786 
							
						 
						
							2015-08-12 18:09:44 +00:00  
				
					
						
							
							
								 
						
							
								63d9764585 
								
							 
						 
						
							
							
								
								[ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!  
							
							... 
							
							
							
							Differential Revision: http://reviews.llvm.org/D7098 
llvm-svn: 238401 
							
						 
						
							2015-05-28 07:49:05 +00:00  
				
					
						
							
							
								 
						
							
								f074b3c2de 
								
							 
						 
						
							
							
								
								[asan] Allow changing verbosity in activation flags.  
							
							... 
							
							
							
							This change removes some debug output in asan_flags.cc that
was reading the verbosity level before all the flags were parsed.
llvm-svn: 226566 
							
						 
						
							2015-01-20 13:21:20 +00:00  
				
					
						
							
							
								 
						
							
								0545f4b0f3 
								
							 
						 
						
							
							
								
								[ASan] Change fake stack and local variables handling.  
							
							... 
							
							
							
							This commit changes the way we get fake stack from ASan runtime
(to find use-after-return errors) and the way we represent local
variables:
  - __asan_stack_malloc function now returns pointer to newly allocated
    fake stack frame, or NULL if frame cannot be allocated. It doesn't
    take pointer to real stack as an input argument, it is calculated
    inside the runtime.
  - __asan_stack_free function doesn't take pointer to real stack as
    an input argument. Now this function is never called if fake stack
    frame wasn't allocated.
  - __asan_init version is bumped to reflect changes in the ABI.
  - new flag "-asan-stack-dynamic-alloca" allows to store all the
    function local variables in a dynamic alloca, instead of the static
    one. It reduces the stack space usage in use-after-return mode
    (dynamic alloca will not be called if the local variables are stored
    in a fake stack), and improves the debug info quality for local
    variables (they will not be described relatively to %rbp/%rsp, which
    are assumed to be clobbered by function calls). This flag is turned
    off by default for now, but I plan to turn it on after more
    testing.
llvm-svn: 224063 
							
						 
						
							2014-12-11 21:53:19 +00:00  
				
					
						
							
							
								 
						
							
								e47130e407 
								
							 
						 
						
							
							
								
								[ASan] Get fake stack code working with GCC 4.8.2.  
							
							... 
							
							
							
							Summary:
TestCases/Linux/heavy_uar_test.cc was failing on my
PowerPC64 box with GCC 4.8.2, because the compiler recognised
a memset-like loop and turned it into a call to memset, which
got intercepted by __asan_memset, which got upset because it was
being called on an address in high shadow memory.
Use break_optimization to stop the compiler from doing this.
Reviewers: kcc, samsonov
Reviewed By: kcc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D6266 
llvm-svn: 222572 
							
						 
						
							2014-11-21 21:25:09 +00:00  
				
					
						
							
							
								 
						
							
								1ee681305f 
								
							 
						 
						
							
							
								
								[asan] introduce two functions that will allow implementations of C++ garbage colection to work with asan's fake stack  
							
							... 
							
							
							
							llvm-svn: 200908 
							
						 
						
							2014-02-06 06:56:22 +00:00  
				
					
						
							
							
								 
						
							
								1aedf6c9e6 
								
							 
						 
						
							
							
								
								[asan] replace the flag uar_stack_size_log with two flags min_uar_stack_size_log/max_uar_stack_size_log  
							
							... 
							
							
							
							llvm-svn: 197370 
							
						 
						
							2013-12-16 08:42:08 +00:00  
				
					
						
							
							
								 
						
							
								57bfdb080b 
								
							 
						 
						
							
							
								
								[asan] add flag uar_noreserve to use noreserve mmap for fake stack. uar_noreserve=1 will save some memory but also negatively affect performance  
							
							... 
							
							
							
							llvm-svn: 197233 
							
						 
						
							2013-12-13 15:03:49 +00:00  
				
					
						
							
							
								 
						
							
								e55d388e71 
								
							 
						 
						
							
							
								
								[asan] when a fake stack is being unmapped also flush the corresponding shadow  
							
							... 
							
							
							
							llvm-svn: 197040 
							
						 
						
							2013-12-11 14:26:41 +00:00  
				
					
						
							
							
								 
						
							
								7a3a93f112 
								
							 
						 
						
							
							
								
								[asan] if verbosity>=2, print the fake stack usage stats at thread exit; No functionality change in non-verboze mode  
							
							... 
							
							
							
							llvm-svn: 197037 
							
						 
						
							2013-12-11 13:54:01 +00:00  
				
					
						
							
							
								 
						
							
								9be70fbda9 
								
							 
						 
						
							
							
								
								[sanitizer] Introduce VReport and VPrintf macros and use them in sanitizer code.  
							
							... 
							
							
							
							Instead of "if (common_flags()->verbosity) Report(...)" we now have macros.
llvm-svn: 196497 
							
						 
						
							2013-12-05 12:04:51 +00:00  
				
					
						
							
							
								 
						
							
								52ca74ec61 
								
							 
						 
						
							
							
								
								tsan: move verbosity flag to CommonFlags  
							
							... 
							
							
							
							llvm-svn: 192701 
							
						 
						
							2013-10-15 13:28:51 +00:00  
				
					
						
							
							
								 
						
							
								43d90cbd86 
								
							 
						 
						
							
							
								
								[lsan] Support ASan's stack-use-after-return mode in LSan.  
							
							... 
							
							
							
							Treat the fake stack as live memory.
llvm-svn: 192593 
							
						 
						
							2013-10-14 14:04:50 +00:00  
				
					
						
							
							
								 
						
							
								3c42ce1516 
								
							 
						 
						
							
							
								
								[asan] introduce run-time flag uar_stack_size_log to control the size of FakeStack; don't crash when the fake stack is exhausted, move some code to .cc file  
							
							... 
							
							
							
							llvm-svn: 191510 
							
						 
						
							2013-09-27 11:37:23 +00:00  
				
					
						
							
							
								 
						
							
								c3d43ca3ec 
								
							 
						 
						
							
							
								
								[asan] add a run-time option detect_stack_use_after_return, add verbosity output for fake stack  
							
							... 
							
							
							
							llvm-svn: 190932 
							
						 
						
							2013-09-18 10:35:12 +00:00  
				
					
						
							
							
								 
						
							
								2f5c2be6bd 
								
							 
						 
						
							
							
								
								[asan] further speedup use-after-return: simplify deallocation of fake frames. ~ 20% speedup.  
							
							... 
							
							
							
							llvm-svn: 190852 
							
						 
						
							2013-09-17 07:42:54 +00:00  
				
					
						
							
							
								 
						
							
								3bee8efc95 
								
							 
						 
						
							
							
								
								[asan] Android does not have TLS  
							
							... 
							
							
							
							llvm-svn: 190669 
							
						 
						
							2013-09-13 08:58:22 +00:00  
				
					
						
							
							
								 
						
							
								9583b87077 
								
							 
						 
						
							
							
								
								[asan] don't record the class_id in FakeFrame (scratching the last bits of performance)  
							
							... 
							
							
							
							llvm-svn: 190666 
							
						 
						
							2013-09-13 07:50:44 +00:00  
				
					
						
							
							
								 
						
							
								4117bdbbbc 
								
							 
						 
						
							
							
								
								[asan] more performance to FakeStack: a) don't used atomic exchange, instead rely on regular load and store and other signal-safe logic; b) remove allocated_from_size_class_mask_ which is not helping much anyway; Another 10% speedup  
							
							... 
							
							
							
							llvm-svn: 190664 
							
						 
						
							2013-09-13 07:20:35 +00:00  
				
					
						
							
							
								 
						
							
								43c4493b44 
								
							 
						 
						
							
							
								
								[asan] second attempt to use TLS with fake stack. This time it looks (more) async-signal safe.  
							
							... 
							
							
							
							llvm-svn: 190663 
							
						 
						
							2013-09-13 06:32:26 +00:00  
				
					
						
							
							
								 
						
							
								c19851ab6c 
								
							 
						 
						
							
							
								
								[asan] undo the previous commit since TLS hack breaks with signals... :(  
							
							... 
							
							
							
							llvm-svn: 190662 
							
						 
						
							2013-09-13 06:15:02 +00:00  
				
					
						
							
							
								 
						
							
								096413ba3b 
								
							 
						 
						
							
							
								
								[asan] use TLS on Linux to get the FakeStack. Saves 15% performance  
							
							... 
							
							
							
							llvm-svn: 190661 
							
						 
						
							2013-09-13 06:04:18 +00:00  
				
					
						
							
							
								 
						
							
								77caab4d7b 
								
							 
						 
						
							
							
								
								[asan] inline PoisonShadow in FakeStack to get ~10% speedup  
							
							... 
							
							
							
							llvm-svn: 190660 
							
						 
						
							2013-09-13 05:57:58 +00:00  
				
					
						
							
							
								 
						
							
								7638aa135e 
								
							 
						 
						
							
							
								
								[asan] a bit of performance improvement in fake stack, generalized one test, fixed android build of another test  
							
							... 
							
							
							
							llvm-svn: 190606 
							
						 
						
							2013-09-12 14:41:10 +00:00  
				
					
						
							
							
								 
						
							
								627ea6391e 
								
							 
						 
						
							
							
								
								[asan] add a test for use-after-return and exceptions and fix it. Not 100% sure this is a complete fix, will keep looking for harder cases.  
							
							... 
							
							
							
							llvm-svn: 190603 
							
						 
						
							2013-09-12 13:25:29 +00:00  
				
					
						
							
							
								 
						
							
								628cda7367 
								
							 
						 
						
							
							
								
								[asan] hopefully make the FakeStack async-signal safe, enable the related test  
							
							... 
							
							
							
							llvm-svn: 190592 
							
						 
						
							2013-09-12 08:34:50 +00:00  
				
					
						
							
							
								 
						
							
								e8f961e847 
								
							 
						 
						
							
							
								
								[asan] use xchg instead of CAS in FakeStack::Allocate (5% faster for this case)  
							
							... 
							
							
							
							llvm-svn: 190589 
							
						 
						
							2013-09-12 07:28:42 +00:00  
				
					
						
							
							
								 
						
							
								729c8dc65b 
								
							 
						 
						
							
							
								
								[asan] fully re-implement the FakeStack (use-after-return) to make it faster and async-signal-safe. The implementation is not yet complete (see FIXMEs) but the existing tests pass.  
							
							... 
							
							
							
							llvm-svn: 190588 
							
						 
						
							2013-09-12 07:11:58 +00:00  
				
					
						
							
							
								 
						
							
								8fc35ca008 
								
							 
						 
						
							
							
								
								[asan] refactor the use-after-return API so that the size class is computed at compile time instead of at run-time. compiler-rt part  
							
							... 
							
							
							
							llvm-svn: 190406 
							
						 
						
							2013-09-10 13:16:26 +00:00  
				
					
						
							
							
								 
						
							
								1f13414d45 
								
							 
						 
						
							
							
								
								[asan] make use-after-return handle very deep recursion; fixes 483.xalancbmk in UAR mode  
							
							... 
							
							
							
							llvm-svn: 189929 
							
						 
						
							2013-09-04 10:59:32 +00:00  
				
					
						
							
							
								 
						
							
								fab9336413 
								
							 
						 
						
							
							
								
								[asan]: fix a CHECK failure in use-after-return mode; enable and fix stack-use-after-return.cc; add a test for UAR mode in asan_noinst_test  
							
							... 
							
							
							
							llvm-svn: 189457 
							
						 
						
							2013-08-28 08:59:23 +00:00  
				
					
						
							
							
								 
						
							
								d8a1798b47 
								
							 
						 
						
							
							
								
								[asan] Limit fake stack size to a reasonable value when running with unlimited stack.  
							
							... 
							
							
							
							llvm-svn: 187411 
							
						 
						
							2013-07-30 11:50:26 +00:00  
				
					
						
							
							
								 
						
							
								6a068a715d 
								
							 
						 
						
							
							
								
								[asan] initialize fake_stack lazily and increase its maximal size. This makes -fsanitize=address,use-after-return more robust: all SPEC tests pass now. In the default mode thread stacks become a bit smaller.  
							
							... 
							
							
							
							llvm-svn: 184934 
							
						 
						
							2013-06-26 12:16:05 +00:00  
				
					
						
							
							
								 
						
							
								cc61eefd4b 
								
							 
						 
						
							
							
								
								Fix MSVC W3 compiler warnings  
							
							... 
							
							
							
							llvm-svn: 182857 
							
						 
						
							2013-05-29 14:11:44 +00:00  
				
					
						
							
							
								 
						
							
								1c77de3aeb 
								
							 
						 
						
							
							
								
								[asan] improve the UAR reporting (try harder to find the correct frame), try to make the test more stable  
							
							... 
							
							
							
							llvm-svn: 179292 
							
						 
						
							2013-04-11 15:35:40 +00:00  
				
					
						
							
							
								 
						
							
								5b4267f7e7 
								
							 
						 
						
							
							
								
								[sanitizer] found a bug by code inspection: CHECK(a=b) instead of CHECK(a==b). Was puzzled why lint did not catch it. Turns out this check was disabled for asan source. fix all cases and enable the check  
							
							... 
							
							
							
							llvm-svn: 178872 
							
						 
						
							2013-04-05 14:40:25 +00:00  
				
					
						
							
							
								 
						
							
								a88c60b085 
								
							 
						 
						
							
							
								
								[ASan] Speed-up initialization-order checking: create and use fast versions of PoisonShadow functions, store copies of __asan_global descriptors in a vector instead of list of pointers. This gives 3x speedup on both benchmarks and real binaries with lots of globals.  
							
							... 
							
							
							
							llvm-svn: 178239 
							
						 
						
							2013-03-28 15:42:43 +00:00  
				
					
						
							
							
								 
						
							
								54afba8b62 
								
							 
						 
						
							
							
								
								[ASan] Switch ASan to generic ThreadRegistry from sanitizer_common. Delete ASan-specific AsanThreadRegistry.  
							
							... 
							
							
							
							llvm-svn: 177634 
							
						 
						
							2013-03-21 11:23:41 +00:00  
				
					
						
							
							
								 
						
							
								cf025cb2e6 
								
							 
						 
						
							
							
								
								[ASan] Move GetCurrentThread/SetCurrentThread from AsanThreadRegistry class into plain functions: they don't actually use registry  
							
							... 
							
							
							
							llvm-svn: 177501 
							
						 
						
							2013-03-20 09:23:28 +00:00  
				
					
						
							
							
								 
						
							
								a0c0da8f51 
								
							 
						 
						
							
							
								
								[ASan] Split ASan interface header into private and public parts. Add a test that makes sure users can include interface header  
							
							... 
							
							
							
							llvm-svn: 174058 
							
						 
						
							2013-01-31 13:46:14 +00:00  
				
					
						
							
							
								 
						
							
								13bdbe698e 
								
							 
						 
						
							
							
								
								[asan] move FakeStack into a separate file  
							
							... 
							
							
							
							llvm-svn: 169734 
							
						 
						
							2012-12-10 14:19:15 +00:00