DynamoRIO / DynamoRIO/dynamorio
Drrun (x86) crash in hook_vsyscall
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 30
Description
Hello.
I know there's a similar issue (#3248), but am reporting this one in case anyone can pinpoint the issue.
I am able to reproduce this issue with both using an Ubuntu 18.06 (64-bit and 32-bit) running ```DynamoRIO-Linux-7.0.0-RC1``` as well as the latest ```DynamoRIO-i386-Linux-7.0.17914-0```
Here's the stack trace from a DEBUG version using the ```32bit drrun``` on a 64-bit system:
```
Program received signal SIGSEGV, Segmentation fault.
0xf7ed1279 in hook_vsyscall (dcontext=dcontext@entry=0x4b94cc40, method_changing=true) at /dynamorio_package/core/arch/arch.c:2890
2890 /dynamorio_package/core/arch/arch.c: No such file or directory.
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
───────────────────────────────────────────────────────────────[ REGISTERS ]────────────────────────────────────────────────────────────────
EAX 0xc3595a5d
EBX 0xf7fa9348 (_GLOBAL_OFFSET_TABLE_) ◂— 0x71191000
ECX 0xf7e1705e ◂— nop
EDX 0xc
EDI 0x4b94cc40 ◂— 0x21000
ESI 0x4b9a6d04 ◂— 0xf0000
EBP 0xf7e1705d ◂— nop
ESP 0x4b9a6cec —▸ 0xf7e1705e ◂— nop
EIP 0xf7ed1279 (hook_vsyscall.part+553) ◂— mov dword ptr [ebp + 1], eax
─────────────────────────────────────────────────────────────────[ DISASM ]─────────────────────────────────────────────────────────────────
► 0xf7ed1279 mov dword ptr [ebp + 1], eax
0xf7ed127c mov eax, dword ptr [ebx - 0x208]
0xf7ed1282 mov dword ptr [eax], ecx
0xf7ed1284 jmp hook_vsyscall.part+411 <0xf7ed11eb>
↓
0xf7ed11eb mov edx, dword ptr [ebx + 0x4abb0]
0xf7ed11f1 push 0
0xf7ed11f3 mov ebp, 1
0xf7ed11f8 mov eax, dword ptr [edx + 0x87c]
0xf7ed11fe add eax, dword ptr [edx + 0x878]
0xf7ed1204 push eax
0xf7ed1205 mov eax, dword ptr [esp + 0xc]
─────────────────────────────────────────────────────────────────[ STACK ]──────────────────────────────────────────────────────────────────
00:0000│ esp 0x4b9a6cec —▸ 0xf7e1705e ◂— nop
01:0004│ 0x4b9a6cf0 —▸ 0xf7ff4048 (vsyscall_sysenter_return_pc) —▸ 0xf7e17059 ◂— pop ebp
02:0008│ 0x4b9a6cf4 —▸ 0xf7e17000 ◂— 0xb48dffff
03:000c│ 0x4b9a6cf8 —▸ 0xf7ff4050 (vsyscall_page_start) —▸ 0xf7e16000 ◂— jg 0xf7e16047 /* 0x464c457f */
04:0010│ 0x4b9a6cfc ◂— 0x5
... ↓
06:0018│ esi 0x4b9a6d04 ◂— 0xf0000
07:001c│ 0x4b9a6d08 ◂— 0x1
───────────────────────────────────────────────────────────────[ BACKTRACE ]────────────────────────────────────────────────────────────────
► f 0 f7ed1279 hook_vsyscall.part+553
f 1 f7ed6169 check_syscall_method+345
f 2 f7ed6169 check_syscall_method+345
f 3 f7f0599e build_bb_ilist+8094
f 4 f7f0599e build_bb_ilist+8094
f 5 f7f06987 build_basic_block_fragment+887
f 6 f7e789b6 dispatch+2438
f 7 4b961a07
Program received signal SIGSEGV
pwndbg> bt
#0 0xf7ed1279 in hook_vsyscall (dcontext=dcontext@entry=0x4b94cc40, method_changing=true) at /dynamorio_package/core/arch/arch.c:2890
#1 0xf7ed6169 in hook_vsyscall (method_changing=true, dcontext=0x4b94cc40) at /dynamorio_package/core/arch/arch.c:2963
#2 check_syscall_method (dcontext=0x4b94cc40, instr=0x4b9a997c) at /dynamorio_package/core/arch/arch.c:3084
#3 0xf7f0599e in bb_process_syscall (bb=0x4b9a6ed4, dcontext=0x4b94cc40) at /dynamorio_package/core/arch/interp.c:1947
#4 build_bb_ilist (dcontext=dcontext@entry=0x4b94cc40, bb=bb@entry=0x4b9a6ed4) at /dynamorio_package/core/arch/interp.c:3847
#5 0xf7f06987 in build_basic_block_fragment (dcontext=0x4b94cc40, start=0xf7e17050 "QRU\211\345\017\064̀]ZYÐ\220"..., initial_flags=0, link=true, visible=true, for_trace=false, unmangled_ilist=0x0) at /dynamorio_package/core/arch/interp.c:5096
#6 0xf7e789b6 in dispatch (dcontext=0x4b94cc40) at /dynamorio_package/core/dispatch.c:216
#7 0x4b961a07 in ?? ()
#8 0x00000000 in ?? ()
```
On top of that, running it on the x86 system (although I did use the -DDEBUG flag it doesn't seem to have debug symbols) am getting the following crash:
```
symeon@ubuntu:~/Desktop/testing$ ~/build_debug/bin32/drrun -- binary ./seeds/test.txt
0xb7a69e81
>
vmheap.num_free_blocks == heapmgt->vmheap.num_blocks - unfreed_blocks || ((ever_beyond_vmm IF_WINDOWS(|| get_os_version() >= WINDOWS_VERSION_8_1)) && heapmgt
version 7.0.17918, custom build
-no_dynamic_options -code_api -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
0x49e9d338 0xb7d10194
0x49e9d568 0xb7d85665
0x49e9d58c 0xb7c98385
0x49e9d5a4 0xb7c986d6
0x49e9d5bc 0xb7c9884f
0x49e9d5cc 0xb7e6e9c8
0x49e9d5dc 0x49e297c0
0xb7ea4c07 0x00100083>
```
Let me know if you need more details, thanks!
Edit: I've just realised there's literally same issue (#3355) as mine, could it be Ubuntu is failing somehow?
Contributor guide
Research direction
Start with hook_vsyscall in core/arch/arch.c and follow the calls through check_syscall_method and bb_process_syscall in core/arch/interp.c. Reproduce with the 32-bit drrun commands on Ubuntu, then compare the behavior and traces with issues #3248 and #3355. Done means identifying and fixing the x86 crash, with a regression check for the reported configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100