Skip to content

Commit d068e6c

Browse files
committed
rrpage: use Linux vDSO soname
AddressSanitizer complains if it isn't the first shared object in the link map besides the vDSO. It checks for the vDSO by testing whether the DT_SONAME of the object starts with 'linux-'. With the introduction of librrpage, this check no longer passes and causes ASan-instrumented programs to abort when being recorded by rr. This patch alters the linker arguments used for producing the librrpage dummy vDSO such that its SONAME is 'linux-vdso.so.1'.
1 parent 6b546dc commit d068e6c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ foreach(file ${RR_PAGE_FILES})
342342
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/preload/${file}"
343343
PROPERTIES COMPILE_FLAGS ${PRELOAD_COMPILE_FLAGS})
344344
endforeach(file)
345-
set_target_properties(rrpage PROPERTIES LINK_FLAGS "-Wl,-T -Wl,${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 ${LINKER_FLAGS}")
345+
set_target_properties(rrpage PROPERTIES NO_SONAME ON)
346+
set_target_properties(rrpage PROPERTIES LINK_FLAGS "-Wl,-T -Wl,${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,-soname,linux-vdso.so.1 ${LINKER_FLAGS}")
346347
set_target_properties(rrpage PROPERTIES LINK_DEPENDS ${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld)
347348
# CMake seems to have trouble generating the link line without this
348349
set_target_properties(rrpage PROPERTIES LINKER_LANGUAGE C)
@@ -664,7 +665,8 @@ if(rr_32BIT AND rr_64BIT)
664665
PROPERTIES COMPILE_FLAGS "-m32 ${PRELOAD_COMPILE_FLAGS}")
665666
endforeach(file)
666667

667-
set_target_properties(rrpage_32 PROPERTIES LINK_FLAGS "-m32 -Wl,-T -Wl,${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld -nostartfiles -nostdlib ${LINKER_FLAGS}")
668+
set_target_properties(rrpage_32 PROPERTIES NO_SONAME ON)
669+
set_target_properties(rrpage_32 PROPERTIES LINK_FLAGS "-m32 -Wl,-T -Wl,${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld -nostartfiles -nostdlib -Wl,-soname,linux-vdso.so.1 ${LINKER_FLAGS}")
668670
set_target_properties(rrpage_32 PROPERTIES LINK_DEPENDS ${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld)
669671
set_target_properties(rrpage_32 PROPERTIES LINKER_LANGUAGE C)
670672

0 commit comments

Comments
 (0)