Skip to content

illustrate ASan's manual poisoning alignment requirements.

Notifications You must be signed in to change notification settings

mcgov/asan_alignment_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Manual ASan poisoning and alignment

ASan poisoning has alignment requirements: the user must add padding such that the padding ends on a byte boundary in the shadow memory. Since each bit in the ASan shadow memory encodes the state of a byte in real memory, this means that the size + padding for each allocation must align on a 8 byte boundary. If this requirement is not satisfied it can lead to incorrect bug reporting, including missed and false-positive reports.

See the included examples for a little background. One is a small program to show what can go wrong with manual shadow memory poisoning. The second is an example implementation of manual poisoning using the std::allocator interface.

To build and run the allocator example:

nmake allocator && allocator.exe

To build the 'bad unpoisoning' example:

nmake unpoison && unpoison.exe

For further information on the shadow bytes and asan see

AddressSanitizer: A Fast Address Sanity Checker

Microsoft documentation for Sanitizers/Shadow Bytes

About

illustrate ASan's manual poisoning alignment requirements.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published