DynamoRIO / DynamoRIO/dynamorio

CRASH(drmemtrace): mcontext register holding incorrect value during signal handler

Open
#8,072 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

**Describe the bug**

When running `drmemtrace`, the value of registers in the `mcontext` during signal handler is incorrect.

**To Reproduce**

The repository https://github.com/WilliamQiufeng/dynamorio-drmemtrace-reg-mre shows the (hopefully minimal) assembly needed to produce this difference.

* Install a signal handler for SIGSEGV
* write some magic value to `x0`
* Load an invalid address to trigger SIGSEGV
* Compare mcontext register[0]

Please also answer these questions:
- Without any client, it runs fine and the value checks out
- `-debug` option doesn't change the result. When using `drmemtrace` the values do not match.

**Expected behavior**

the `x0` saved in `mcontext` should equal the correct value.

**Versions**
- DynamoRIO 11.90.20672
- Ubuntu, Aarch64, Neoverse N1

Contributor guide

Open the contributing guide

Research direction

Start with the linked minimal reproduction and compare its SIGSEGV mcontext behavior with and without drmemtrace on Ubuntu AArch64. Trace drmemtrace's signal-handler and mcontext handling to determine why register[0] differs. Done means the saved x0 value matches the value written before the fault when drmemtrace is enabled.

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
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.