-
Notifications
You must be signed in to change notification settings - Fork 605
Open
Description
Head version of dynamorio generates a SEGFAULT when running a simple drrun command both on rpi2 with armv7 and also with qemu userspace emulation.
glibc 2.41, gcc 14.2.1, Archlinux arm head
uname -an
Linux alarmpi 6.12.21-1-rpi #1 SMP Mon Mar 31 13:47:52 MDT 2025 armv7l GNU/Linux
git clone https://github.com/DynamoRIO/dynamorio.git
cd dynamorio
git submodule update --init
mkdir build && cd build
cmake ..
bin32/drrun -dumpcore_mask 0x8bff -- ls
<Application /usr/bin/ls (7118). DynamoRIO internal crash at PC 0xb6e4dd2c. Please report this at http://dynamorio.org/issues/. Program aborted.
Received SIGSEGV at pc 0xb6e4dd2c in thread 7118
Base: 0xb6db6000
Registers: r0 =0x00000000 r1 =0x00000000 r2 =0x00000002 r3 =0xe58a0000
r4 =0x00000000 r5 =0x41f12a3c r6 =0x41f0ed24 r7 =0x00000000
r8 =0x41f0ed28 r9 =0x00000000 r10=0x41f0ed20 r11=0x00000001
r12=0x00000005 r13=0x41f0ed18 r14=0xb6e4dd1d r15=0xb6e4dd2c
eflags=0x80081830
version 11.90.20183, custom build
-no_dynamic_options -code_api -dumpcore_mask 0x8bff -stack_size 56K -signal_stack_size 32K -max_elide_jmp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct >
Reading symbols from /usr/bin/ls...
(No debugging symbols found in /usr/bin/ls)
"/home/alarm/dynamorio/build/core" is not a core dump: file format not recognized
(gdb) No stack.
(gdb) Working directory /home/alarm/dynamorio/build.
(gdb) Segmentation fault (core dumped)
with debug build, coredump files (2 generated
) of this run are attached
mkdir builddebug && cd builddebug
cmake -DCMAKE_BUILD_TYPE=Debug ..
[alarm@alarmpi builddebug]$ bin32/drrun -debug -dumpcore_mask 0x8bff -- ls
<Starting application /usr/bin/ls (12576)>
<Initial options = -no_dynamic_options -code_api -dumpcore_mask 0x8bff -stack_size 56K -signal_stack_size 32K -max_elide_jmp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct >
<Paste into GDB to debug DynamoRIO clients:
set confirm off
add-symbol-file '/home/alarm/dynamorio/builddebug/lib32/debug/libdynamorio.so' 0xb6bc57a0
>
<Destination operand #0 has wrong type/size>
<Application /usr/bin/ls (12576). Internal Error: DynamoRIO debug check failure: /home/alarm/dynamorio/core/emit.c:363 pc != NULL
(Error occurred @1416 frags in tid 12576)
version 11.90.20183, custom build
-no_dynamic_options -code_api -dumpcore_mask 0x8bff -stack_size 56K -signal_stack_size 32K -max_elide_jmp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct
0xb6c348df 0xf8af04b0
/home/alarm/dynamorio/builddebug/lib32/debug/libdynamorio.so=0xb6ba0000>
<------------------------------------------->
<stackdump: --- now running the debugger --->
<gdb -q /usr/bin/ls core>
<------------------------------------------->
Reading symbols from /usr/bin/ls...
(No debugging symbols found in /usr/bin/ls)
"/home/alarm/dynamorio/builddebug/core" is not a core dump: file format not recognized
(gdb) No stack.
(gdb) Working directory /home/alarm/dynamorio/builddebug.
(gdb) <------------------------------------------->
<Crashing the process deliberately for a core dump for: |DynamoRIO debug check failure: /home/alarm/dynamorio/core/emit.c:363 pc != NULL
(Error occurred @1416 frags in tid 12576)
version 11.90.20183, custom build
-no_dynamic_options -code_api -dumpcore_mask 0x8bff -stack_size 56K -signal_stack_size 32K -max_elide_jmp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct
0xb6c348df 0xf8af04b0
/home/alarm/dynamorio/builddebug/lib32/debug/libdynamorio.so=0xb6ba0000|>
Segmentation fault (core dumped)
How to reproduce on X86:
cd ~/Downloads
git clone https://github.com/crosstool-ng/crosstool-ng
cd crosstool-ng
./bootstrap
./configure --enable-local
./ct-ng menuconfig
enable arm as target, select gcc newest version and glibc newest version. Enable C++ support for gcc so that libstdc++.so.6 will be built.
./ct-nt build
compile dynamorio, but first edit
make/toolchain_arm32.cmake
addd
set(TARGET_ABI "unknown-linux-gnueabi")
before the line
if (NOT DEFINED TARGET_ABI)
now compile dynamorio
-cd /home/<username>/Downloads/dynamorio && rm -rf ./buildarm
cd /home/<username>/Downloads/dynamorio && mkdir buildarm && cd buildarm && \
PATH=/home/<username>/x-tools/arm-unknown-linux-gnueabi2.30/bin/:$$PATH && \
cmake -DDEBUG=ON -DCMAKE_TOOLCHAIN_FILE=../make/toolchain-arm32.cmake -DCMAKE_C_LIBRARY_ARCHITECTURE=gnueabi -DBUILD_DOCS=NO -DTARGET_ABI='unknown-linux-gnueabi' -DCMAKE_SYSROOT=/home/<username>/x-tools/arm-unknown-linux-gnueabi2.30/arm-unknown-linux-gnueabi/sysroot/ -DZLIB_LIBRARY=/home/<username>/Downloads/zlib-arm-install/lib/libz.a -DZLIB_INCLUDE_DIR=/home/<username>/Downloads/zlib-arm-install/include/ .. && \
grep -r -l "arm-unknown-linux-gnueabi-as --sysroot" | xargs sed -i 's/arm-unknown-linux-gnueabi-as --sysroot=\/home\/<username>\/x-tools\/arm-unknown-linux-gnueabi2\.30\/arm-unknown-linux-gnueabi\/sysroot\//arm-unknown-linux-gnueabi-as/' && \
make
Have qemu user mode emulation installed, and a basic arm executable ready.
export QEMU_LD_PREFIX=/home/<username>/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/
qemu-arm-static bin32/drrun -debug -dumpcore_mask 0x8bff -- /home/<username>/Downloads/busybox-1.37.0/_install/bin/ls
When using a client, there is a floating point exception
qemu-arm-static bin32/drrun -debug -dumpcore_mask 0x8bff -c api/bin/libmemval_simple.so -- /home/<username>/Downloads/busybox-1.37.0/_install/bin/ls
<Starting application /home/<username>/Downloads/busybox-1.37.0/_install/bin/busybox (2992663)>
<Initial options = -no_dynamic_options -client_lib '/home/<username>/Downloads/dynamorio/buildarm/api/bin/libmemval_simple.so;0;' -client_lib32 '/home/<username>/Downloads/dynamorio/buildarm/api/bin/libmemval_simple.so;0;' -code_api -dumpcore_mask 0x8bff -stack_size 56K -signal_stack_size 32K -max_elide_jmp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct >
<WARNING! symbol lookup error: libdrx.so undefined symbol drx_scatter_gather_thread_exit>
<WARNING! symbol lookup error: libdrx.so undefined symbol drx_scatter_gather_thread_init>
<WARNING! symbol lookup error: libdrx.so undefined symbol drx_scatter_gather_restore_state>
qemu: uncaught target signal 8 (Floating point exception) - core dumped
Floating point exception (core dumped)
Reactions are currently unavailable