You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cpp/ASAN/asan-building.md
+18-6Lines changed: 18 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -52,19 +52,31 @@ You can customize address sanitizer functionality compiled into the binaries use
52
52
53
53
There are smaller tweaks that can be made by setting the environment variable `ASAN_OPTIONS`
54
54
55
-
## Address Sanitizer Runtimes
55
+
## Address Sanitizer Binaries
56
56
57
-
This implementation of AddressSanitizer makes use of the Clang ASan runtime libraries. The runtime library version packaged with Visual Studio may contain features that are not yet available in the version packaged with Clang.
57
+
58
+
This implementation of AddressSanitizer makes use of the Clang ASan runtime libraries. The runtime library version packaged with Visual Studio may contain features that are not yet available in the version packaged with Clang on Windows10.
58
59
59
60
An overview of the features in this ported version of the Address Sanitizer runtime runtime is available here: [AddressSanitizer runtime overview](address-sanitizer-runtime.md)
60
61
61
-
### Static (x86,AMD64)
62
62
63
-
These would appear on the raw link lines
63
+
### Linking – With static CRT
64
+
65
+
Link the EXE with
66
+
67
+
- set _LINK_= /debug -incremental:no /wholearchive:%MyVS%\lib\{arch}\clang_rt.asan-{arch}.lib
We briefly summarize the concept of shadow bytes and how they can be used by the runtime implementation of `-fsanitize=address`. For further details we refer you to the [seminal paper](
@@ -11,7 +11,7 @@ The shadow-byte describes how many bytes in the 8-byte user address are currentl
11
11
12
12
- 0 means all 8 bytes
13
13
- 1-7 means 1 to seven bytes
14
-
- Negtive numbers encode context for the runtime to diagnose
14
+
- Negtive numbers encode context for the runtime to use for reporting diagnostics.
15
15
16
16
Consider this shadow byte legend:
17
17
@@ -20,7 +20,7 @@ Consider this shadow byte legend:
20
20
21
21
## Mapping
22
22
23
-
Every 8-byte address that is 0 mod 8 aligned, can be mapped to the shadow byte that describes that slot in the virtual address space. This mapping can be accomplished with a simple shift and add.
23
+
Every 8-byte address that is 0 mod 8 aligned, can be mapped to the shadow byte that describes that slot in the virtual address space. This mapping can be accomplished with a **simple shift and add**.
Assume that specific shadow bytes will have been written, either by the compiler generated code, static data, or the runtime. Then the following pseudo code shows how it would be simple to generate a check which would precede any load or store.
37
36
@@ -53,8 +52,12 @@ When instrumenting 1-, 2-, or 4- byte accesses, the instrumentation is slightly
53
52
54
53
The runtime and the compiler generated code, will write shadow bytes to allow or revoke access when scopes end or storage is freed. Thus the checks above, are reading shadow bytes describing 8-byte slots in your application space, **at a certain time in the programs execution**.
55
54
56
-
## See Also
55
+
In addition to these explicitly generated checks the runtime will check shadow bytes after it "intercepts or hooks" many functions in the CRT. See [the list of intercepted functions](#address-sanitizer-intercepted-functions.md)
57
56
58
-
The Address Sanitizer [algorithm](https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm) for further details.
57
+
## Setting shadow bytes
59
58
59
+
Both the code the compiler generates and and the Address Sanitizer runtime can write shadow bytes. For example the compiler can set shadow bytes to allow fixed sized access to stack locals defined in an inner scope. The runtime can surround global variables in the data section with shadow bytes.
60
60
61
+
## See Also
62
+
63
+
The Address Sanitizer [algorithm](https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm) for further details.
Copy file name to clipboardExpand all lines: docs/cpp/ASAN/asan-top-level.md
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,8 @@ Microsoft recommends using the Address Sanitizer in these **three standard workf
44
44
45
45
This MSDN article will cover all the information needed to enable your builds for any of the three workflows listed above. The information will be specific to the Microsoft Windows 10 platform and supplement existing documentation from [Google, Apple and GCC](#Google,-Apple-and-GCC-documentation). We start with a simple command line use of the compiler and linker.
46
46
47
-
> [!NOTE] Current support is limited to x86 and AMD64 on Windows10. **Customer feedback** would help us prioritize shipping these sanitizers in the future: -fsanitize=thread, -fsanitize=leak, -fsanitize=memory, -fsanitize=hwaddress or -fsanitize=undefined.
47
+
> [!NOTE] Current support is limited to x86 and AMD64 on Windows 10. **Customer feedback** would help us prioritize shipping these sanitizers in the future: -fsanitize=thread, -fsanitize=leak, -fsanitize=memory, -fsanitize=hwaddress or -fsanitize=undefined.
48
+
48
49
49
50
## Simple command line interface
50
51
@@ -121,7 +122,7 @@ From top to bottom
121
122
122
123
4.) The [**shadow bytes**](.\asan-shadowbytes.md) that correspond to the address used in the overflowing store, indicate 13 bytes (8 + 5) were explicitly allocated for the alloca.
123
124
124
-
**Note:** The call stack is converted to function names through the [LLVM symbolizer](https://llvm.org/docs/CommandGuide/llvm-symbolizer.html). The Address Sanitizer creates the resto of the report based on its context, the shadow bytes, and meta-data the compiler produces.
125
+
**Note:** The call stack is converted to function names through the [LLVM symbolizer](https://llvm.org/docs/CommandGuide/llvm-symbolizer.html). The Address Sanitizer creates the rest of of the report based on its context, the shadow bytes, and meta-data the compiler produces.
0 commit comments