Skip to content

Commit 653335d

Browse files
Merge pull request #5995 from davidmrdavid/dev/dajusto/document-that-users-are-responsible-to-unpoison
[ASan] Document that manually posioned memory must be eventually manually unpoisoned
2 parents fc8d9d5 + ccb7ec6 commit 653335d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/sanitizers/asan-runtime.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ For convenience, the [AddressSanitizer interface header file](https://github.com
9090
#define ASAN_UNPOISON_MEMORY_REGION(addr, size)
9191
```
9292

93+
> [!NOTE]
94+
> If you manually poison memory, you must unpoison it before reuse. This is especially important for stack addresses (e.g. a stack local variable), which are frequently reused during program execution. You risk introducing `use-after-poison` false positives in manually poisoned stack addresses if you fail to unpoison them before their stack frame is removed.
95+
9396
## Alignment requirements for AddressSanitizer poisoning
9497

9598
Any manual poisoning of shadow bytes must consider the alignment requirements. The user must add padding if necessary so the shadow bytes end on a byte boundary in the shadow memory. Each bit in the AddressSanitizer shadow memory encodes the state of a single byte in the application's memory. This encoding means the total size of each allocation, including any padding, must align to an 8-byte boundary. If the alignment requirement isn't satisfied, it can lead to incorrect bug reporting. The incorrect reporting could manifest as missing reports (false negatives) or reports on non-errors (false-positives).

0 commit comments

Comments
 (0)