DynamoRIO / DynamoRIO/dynamorio

APP CRASH: Program received internal crash when use dr_wrap under android 10

Open
#5,301 3 comments 0 reactions 0 assignees View on GitHub
Bug-ToolCrash OpSys-Android Status-NeedInfo
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

**Describe the bug**
We received a internal crash when use sample client libwrap.so to wrap some APIs. We cannot get the backtraces, so checked the maps, found that the crashed PC is not in the any modules(but always with a fixed offset behind libwrap.sp). Any suggestion to debug the crash?

**To Reproduce**
Steps to reproduce the behavior:

```shell
bin64/drrun -c /data/DynamoRIO-Linux-7.91.18822-0/samples/bin64/libwrap.so ./ -- ./test
```

**changed client libwrap.so src:**

```c
#define MALLOC_ROUTINE_NAME IF_WINDOWS_ELSE("xxx", "xxx")

static void
module_load_event(void *drcontext, const module_data_t *mod, bool loaded)
{
app_pc towrap = NULL;
dr_fprintf(STDERR, "module load:%s %p---%p\n", mod->full_path, mod->start, mod->end);
if(strcmp(mod->full_path, "xxx.so") == 0) {
towrap = (app_pc)dr_get_proc_address(mod->handle, MALLOC_ROUTINE_NAME);
if(towrap != NULL) {
dr_fprintf(STDERR, "-----------------------> dr_get_proc_address sucess:%s\n", MALLOC_ROUTINE_NAME);
} else {
dr_fprintf(STDERR, "-----------------------> dr_get_proc_address failed:%s\n", MALLOC_ROUTINE_NAME);
towrap = mod->start + 0x1cf3c ;//test APIs's offset
}

}
if (towrap != NULL) {
dr_fprintf(STDERR, "call drwrap_wrap:%s\n", mod->full_path);
bool ok = drwrap_wrap(towrap, wrap_pre, wrap_post);
}
}

static void
wrap_pre(void *wrapcxt, OUT void **user_data)
{
dr_fprintf(STDERR, "------------------ we are in wrap_pre\n");
}

static void
wrap_post(void *wrapcxt, void *user_data)
{
dr_fprintf(STDERR, "------------------ we are in wrap_post\n");
}
```

**Screenshots or Pasted Text**

```shell

```

```shell
Client wrap is running
module load:/data/secdive/DynamoRIO-Linux-7.91.18822-0/samples/bin64/libwrap.so 0x00000078a5b91000---0x00000078a5ba4000
module load:/system/bin/idea_mediacontrol_proc_server 0x00000078e5b91000---0x00000078e5ba7000
module load:/data/secdive/DynamoRIO-Linux-7.91.18822-0/lib64/release/libdynamorio.so 0x00000078e9ba8000---0x00000078e9d6a000
module load:/apex/com.android.runtime/bin/linker64 0x00000078e9d9d000---0x00000078e9ec2000
module load:[vdso] 0x00000078e9ec4000---0x00000078e9ec5000
module load:/apex/com.android.runtime/lib64/bionic/libdl.so 0x0000007825985000---0x0000007825989000
module load:/apex/com.android.runtime/lib64/bionic/libc.so 0x00000078e8143000---0x00000078e822a000
module load:/system/lib64/libc++.so 0x00000078e70ad000---0x00000078e717c000

```

Versions**

- DynamoRIO version:DynamoRIO-Linux-7.91.18822
- Env: Android10 arm64
- my application is 64-bit.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.