[asan] Move __asan_handle_no_return to public header
Heretofore asan_handle_no_return was used only by interceptors, i.e. code private to the ASan runtime. However, on systems without interceptors, code like libc++abi is built with -fsanitize=address itself and should call asan_handle_no_return directly from __cxa_throw so that no interceptor is required. Patch by Roland McGrath Differential Revision: https://reviews.llvm.org/D36811 llvm-svn: 311869
This commit is contained in:
		
							parent
							
								
									8b633447da
								
							
						
					
					
						commit
						00b760ed48
					
				| 
						 | 
					@ -144,6 +144,10 @@ extern "C" {
 | 
				
			||||||
  void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
 | 
					  void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
 | 
				
			||||||
                                     void **end);
 | 
					                                     void **end);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Performs cleanup before a [[noreturn]] function.  Must be called
 | 
				
			||||||
 | 
					  // before things like _exit and execl to avoid false positives on stack.
 | 
				
			||||||
 | 
					  void __asan_handle_no_return(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}  // extern "C"
 | 
					}  // extern "C"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -423,3 +423,11 @@ TEST(AddressSanitizerInterface, GetOwnershipStressTest) {
 | 
				
			||||||
    free(pointers[i]);
 | 
					    free(pointers[i]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST(AddressSanitizerInterface, HandleNoReturnTest) {
 | 
				
			||||||
 | 
					  char array[40];
 | 
				
			||||||
 | 
					  __asan_poison_memory_region(array, sizeof(array));
 | 
				
			||||||
 | 
					  BAD_ACCESS(array, 20);
 | 
				
			||||||
 | 
					  __asan_handle_no_return();
 | 
				
			||||||
 | 
					  // It unpoisons the whole thread stack.
 | 
				
			||||||
 | 
					  GOOD_ACCESS(array, 20);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue