parent
							
								
									702097dafc
								
							
						
					
					
						commit
						b17fd11e09
					
				| 
						 | 
				
			
			@ -3,30 +3,28 @@
 | 
			
		|||
 | 
			
		||||
// UNSUPPORTED: ios
 | 
			
		||||
 | 
			
		||||
// RUN: mkdir -p %T/dyld_insert_libraries_reexec
 | 
			
		||||
// RUN: cp `%clang_asan %s -fsanitize=address -### 2>&1 \
 | 
			
		||||
// RUN:   | grep "libclang_rt.asan_osx_dynamic.dylib" \
 | 
			
		||||
// RUN:   | sed -e 's/.*"\(.*libclang_rt.asan_osx_dynamic.dylib\)".*/\1/'` \
 | 
			
		||||
// RUN:   %T/dyld_insert_libraries_reexec/libclang_rt.asan_osx_dynamic.dylib
 | 
			
		||||
// RUN: %clangxx_asan %s -o %T/dyld_insert_libraries_reexec/a.out
 | 
			
		||||
// RUN: rm -rf %t && mkdir -p %t
 | 
			
		||||
// RUN: cp `%clang_asan -print-file-name=lib`/darwin/libclang_rt.asan_osx_dynamic.dylib \
 | 
			
		||||
// RUN:   %t/libclang_rt.asan_osx_dynamic.dylib
 | 
			
		||||
// RUN: %clangxx_asan %s -o %t/a.out
 | 
			
		||||
 | 
			
		||||
// RUN:   %env_asan_opts=verbosity=1 \
 | 
			
		||||
// RUN:       DYLD_INSERT_LIBRARIES=@executable_path/libclang_rt.asan_osx_dynamic.dylib \
 | 
			
		||||
// RUN:       %run %T/dyld_insert_libraries_reexec/a.out 2>&1 \
 | 
			
		||||
// RUN:       %run %t/a.out 2>&1 \
 | 
			
		||||
// RUN:   | FileCheck %s
 | 
			
		||||
 | 
			
		||||
// RUN: IS_OSX_10_11_OR_HIGHER=$([ `sw_vers -productVersion | cut -d'.' -f2` -lt 11 ]; echo $?)
 | 
			
		||||
 | 
			
		||||
// On OS X 10.10 and lower, if the dylib is not DYLD-inserted, ASan will re-exec.
 | 
			
		||||
// RUN: if [ $IS_OSX_10_11_OR_HIGHER == 0 ]; then \
 | 
			
		||||
// RUN:   %env_asan_opts=verbosity=1 %run %T/dyld_insert_libraries_reexec/a.out 2>&1 \
 | 
			
		||||
// RUN:   %env_asan_opts=verbosity=1 %run %t/a.out 2>&1 \
 | 
			
		||||
// RUN:   | FileCheck --check-prefix=CHECK-NOINSERT %s; \
 | 
			
		||||
// RUN:   fi
 | 
			
		||||
 | 
			
		||||
// On OS X 10.11 and higher, we don't need to DYLD-insert anymore, and the interceptors
 | 
			
		||||
// still installed correctly. Let's just check that things work and we don't try to re-exec.
 | 
			
		||||
// RUN: if [ $IS_OSX_10_11_OR_HIGHER == 1 ]; then \
 | 
			
		||||
// RUN:   %env_asan_opts=verbosity=1 %run %T/dyld_insert_libraries_reexec/a.out 2>&1 \
 | 
			
		||||
// RUN:   %env_asan_opts=verbosity=1 %run %t/a.out 2>&1 \
 | 
			
		||||
// RUN:   | FileCheck %s; \
 | 
			
		||||
// RUN:   fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,26 +4,24 @@
 | 
			
		|||
 | 
			
		||||
// UNSUPPORTED: ios
 | 
			
		||||
 | 
			
		||||
// RUN: mkdir -p %T/dyld_insert_libraries_remove
 | 
			
		||||
// RUN: cp `%clang_asan %s -fsanitize=address -### 2>&1 \
 | 
			
		||||
// RUN:   | grep "libclang_rt.asan_osx_dynamic.dylib" \
 | 
			
		||||
// RUN:   | sed -e 's/.*"\(.*libclang_rt.asan_osx_dynamic.dylib\)".*/\1/'` \
 | 
			
		||||
// RUN:   %T/dyld_insert_libraries_remove/libclang_rt.asan_osx_dynamic.dylib
 | 
			
		||||
// RUN: rm -rf %t && mkdir -p %t
 | 
			
		||||
// RUN: cp `%clang_asan -print-file-name=lib`/darwin/libclang_rt.asan_osx_dynamic.dylib \
 | 
			
		||||
// RUN:   %t/libclang_rt.asan_osx_dynamic.dylib
 | 
			
		||||
 | 
			
		||||
// RUN: %clangxx_asan %s -o %T/dyld_insert_libraries_remove/a.out
 | 
			
		||||
// RUN: %clangxx_asan %s -o %t/a.out
 | 
			
		||||
// RUN: %clangxx -DSHARED_LIB %s \
 | 
			
		||||
// RUN:     -dynamiclib -o %T/dyld_insert_libraries_remove/dummy-so.dylib
 | 
			
		||||
// RUN:     -dynamiclib -o %t/dummy-so.dylib
 | 
			
		||||
 | 
			
		||||
// RUN: ( cd %T/dyld_insert_libraries_remove && \
 | 
			
		||||
// RUN: ( cd %t && \
 | 
			
		||||
// RUN:   DYLD_INSERT_LIBRARIES=@executable_path/libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \
 | 
			
		||||
// RUN:   %run ./a.out 2>&1 ) | FileCheck %s || exit 1
 | 
			
		||||
 | 
			
		||||
// RUN: ( cd %T/dyld_insert_libraries_remove && \
 | 
			
		||||
// RUN: ( cd %t && \
 | 
			
		||||
// RUN:   DYLD_INSERT_LIBRARIES=libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \
 | 
			
		||||
// RUN:   %run ./a.out 2>&1 ) | FileCheck %s || exit 1
 | 
			
		||||
 | 
			
		||||
// RUN: ( cd %T/dyld_insert_libraries_remove && \
 | 
			
		||||
// RUN:   DYLD_INSERT_LIBRARIES=%T/dyld_insert_libraries_remove/libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \
 | 
			
		||||
// RUN: ( cd %t && \
 | 
			
		||||
// RUN:   DYLD_INSERT_LIBRARIES=%t/libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \
 | 
			
		||||
// RUN:   %run ./a.out 2>&1 ) | FileCheck %s || exit 1
 | 
			
		||||
 | 
			
		||||
#if !defined(SHARED_LIB)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,16 +2,16 @@
 | 
			
		|||
// executing other programs.
 | 
			
		||||
 | 
			
		||||
// RUN: %clangxx_asan %s -o %t
 | 
			
		||||
// RUN: %clangxx %p/../Helpers/echo-env.cc -o %T/echo-env
 | 
			
		||||
// RUN: %clangxx %p/../Helpers/echo-env.cc -o %t-echo-env
 | 
			
		||||
// RUN: %clangxx -DSHARED_LIB %s \
 | 
			
		||||
// RUN:     -dynamiclib -o %t-darwin-dummy-shared-lib-so.dylib
 | 
			
		||||
 | 
			
		||||
// Make sure DYLD_INSERT_LIBRARIES doesn't contain the runtime library before
 | 
			
		||||
// execl().
 | 
			
		||||
 | 
			
		||||
// RUN: %run %t %T/echo-env >/dev/null 2>&1
 | 
			
		||||
// RUN: %run %t %t-echo-env >/dev/null 2>&1
 | 
			
		||||
// RUN: %env DYLD_INSERT_LIBRARIES=%t-darwin-dummy-shared-lib-so.dylib \
 | 
			
		||||
// RUN:     %run %t %T/echo-env 2>&1 | FileCheck %s || exit 1
 | 
			
		||||
// RUN:     %run %t %t-echo-env 2>&1 | FileCheck %s || exit 1
 | 
			
		||||
 | 
			
		||||
#if !defined(SHARED_LIB)
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue