[all-commits] [llvm/llvm-project] 694b13: [sanitizer_common] Fix edge case for stack mapping...
Thurston Dang via All-commits
all-commits at lists.llvm.org
Wed Jul 10 13:49:32 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 694b132177a96a61dac62b3e3d2989a063feafa7
https://github.com/llvm/llvm-project/commit/694b132177a96a61dac62b3e3d2989a063feafa7
Author: Thurston Dang <thurston at google.com>
Date: 2024-07-10 (Wed, 10 Jul 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
Log Message:
-----------
[sanitizer_common] Fix edge case for stack mapping parsing (#98381)
On some systems (e.g., at least two AArch64 Linux instances), the
process map can have:
```
fffffffdf000-1000000000000 ... [stack]
```
instead of:
```
fffffffdf000- ffffffffffff
```
The stack top value is larger than `GetMaxUserVirtualAddress()`, which
violates the precondition that shadow memory calculations expect. This
patch fixes the issue by saturating off-by-one values (and also adds
checks for more flagrant violations).
This fixes an issue that was observed with DFSan on AArch64 Linux (with
high-entropy ASLR, resulting in ASLR being disabled on some runs):
```
==11057==ERROR: DataflowSanitizer failed to allocate 0x1600000800000 (387028101365760) bytes at address 4fffff800000 (errno: 12)
```
(https://lab.llvm.org/staging/#/builders/90/builds/552/steps/9/logs/stdio)
This was trying to allocate a shadow at `[0x4fffff800000, 0x4fffff800000
+ 0x1600000800000] = [0x4fffff800000, 0x1b00000000000]`. Notice that the
end of the shadow region - an invalid value - is equal to
`MEM_TO_SHADOW(0x1000000000000)`, where `MEM_TO_SHADOW` is defined as
`(mem ^ 0xB00000000000ULL)`.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list