DynamoRIO / DynamoRIO/drmemory

failure to create shadow mapping on WSL: stack is in assumed-empty slot

Open
#2,124 0 comments 0 reactions 1 assignee Claimed by @derekbruening View on GitHub
Bug-Assert Component-FullMode Hotlist-Release OpSys-Linux
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

On WSL the initial stack's random range includes a region Umbra assumes is empty:

```
shadow_table_init
new segment: app [0x00007f0000000000, 0x00007fffff400000), shadow [0x000014c000000000, 0x000014ffffd00000), reserve [0x0000123000000000, 0x0000123ffff40000)
new segment: app [0x00007fffff800000, 0x0000800000000000), shadow [0x000014ffffe00000, 0x0000150000000000), reserve [0x0000123ffff80000, 0x0000124000000000)
new segment: app [0x0000000000000000, 0x0000010000000000), shadow [0x0000110000000000, 0x0000114000000000), reserve [0x0000114000000000, 0x0000115000000000)
ERROR: new app segment [0x00007f0000000000, 0x0000800000000000)'s shadow segment [0x000014c000000000, 0x0000150000000000) conflicts with app seg [0x00007f0000000000, 0x00007fffff400000)
ASSERT FAILURE (thread 301): /work/drmemory/git/src/drmemory/shadow.c:297: false (fail to create shadow memory mapping)
```

Something is allocated in that gap between [0x7FFFFF400000-0x7FFFFF800000),
breaking our assumptions.

It's the initial stack:
```
7fffff0d9000-7fffff8d9000 rw-p 00000000 00:00 0 [stack]
7fffffd1a000-7fffffd1b000 r-xp 00000000 00:00 0 [vdso]
```

Esan has a different gap, but this stack breaks it too:
```
// [0x00000000'00000000, 0x00000100'00000000) non-PIE + heap
// [0x00005500'00000000, 0x00005700'00000000) PIE
// [0x00007e00'00000000, 0x00007fff'ff600000) libraries + stack, part 1
// [0x00007fff'ff601000, 0x00008000'00000000) libraries + stack, part 2
// [0xffffffff'ff600000, 0xffffffff'ff601000) vsyscall
```

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.