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
{{ message }}
Repository navigation
Commit 5d7d7fa
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/sanitizers/asan-building.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ The dual stack frame in the heap remains after the return from the function that
75
75
76
76
Stack frames are allocated in the heap and remain after functions return. The runtime uses garbage collection to asynchronously free these fake call-frame objects, after a certain time interval. Addresses of locals get transferred to persistent frames in the heap. It's how the system can detect when any locals get used after the defining function returns. For more information, see the [algorithm for stack use after return](https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn) as documented by Google.
Copy file name to clipboardExpand all lines: docs/sanitizers/asan-known-issues.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,10 @@ helpviewer_keywords: ["AddressSanitizer known issues"]
7
7
8
8
# AddressSanitizer known issues
9
9
10
-
> [!NOTE] Send us [feedback](https://aka.ms/vsfeedback/browsecpp) on what you'd like to see in future releases, and [report bugs](https://aka.ms/feedback/report?space=62) if you run into issues.
10
+
> [!NOTE]
11
+
> Send us [feedback](https://aka.ms/vsfeedback/browsecpp) on what you'd like to see in future releases, and [report bugs](https://aka.ms/feedback/report?space=62) if you run into issues.
11
12
12
-
## Incompatible options and functionality
13
+
## <aname="incompatible-options"></a> Incompatible options and functionality
13
14
14
15
These options and functionality are incompatible with [`/fsanitize=address`](../build/reference/fsanitize.md) and should be disabled or avoided.
Copy file name to clipboardExpand all lines: docs/sanitizers/asan-offline-crash-dumps.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,11 +21,11 @@ This [dump file](/previous-versions/windows/desktop/proc_snap/export-a-process-s
21
21
22
22
Visual Studio can display the error information in the context of the original source code. To do so, Visual Studio requires [debugging symbols](/windows/win32/dxtecharts/debugging-with-symbols) and [indexed source code](/windows-hardware/drivers/debugger/source-indexing). For the best debugging experience, the EXE, PDB, and source code used to produce those binaries must match.
23
23
24
-
For more information about storing sources and symbols, see the [source and symbols](#Source-and-symbols) section. For information about implementation details and fine grained control, see [debugger integration](asan-debugger-integration.md).
24
+
For more information about storing sources and symbols, see the [source and symbols](#source) section. For information about implementation details and fine grained control, see [debugger integration](asan-debugger-integration.md).
25
25
26
26
## Example - build, test, and analyze
27
27
28
-
Consider three machines: A, B, and C. Builds are done on machine B, tests are run on machine C, and you analyze failures on machine A. The errors are reported against source line and column numbers in your source code. You can see the call stack together with a set of symbols in the PDB file produced using that [exact version of the source code](#Source-and-symbols).
28
+
Consider three machines: A, B, and C. Builds are done on machine B, tests are run on machine C, and you analyze failures on machine A. The errors are reported against source line and column numbers in your source code. You can see the call stack together with a set of symbols in the PDB file produced using that [exact version of the source code](#source).
29
29
30
30
The following steps are for local or distributed scenarios that lead to creation of a .dmp file, and for viewing that AddressSanitizer dump file offline.
31
31
@@ -36,9 +36,9 @@ The following steps are for local or distributed scenarios that lead to creation
36
36
- Copy a generated .dmp file to the build directory
37
37
- Open the .dmp file with the paired .pdb, in the same directory
38
38
39
-
### Product a .dmp on a distributed system
39
+
### Produce a .dmp on a distributed system
40
40
41
-
- Build and [post-process the PDB](#Source-and-symbols) for [source indexing data blocks](/windows/win32/debug/source-server-and-source-indexing)
41
+
- Build and [post-process the PDB](#source) for [source indexing data blocks](/windows/win32/debug/source-server-and-source-indexing)
42
42
- Copy the atomic pair of (.exe, .pdb) to the test machine and run tests
43
43
- Write the atomic pairs of (.pdb, .dmp) to the bug-reporting database
44
44
- Visual Studio opens a .dmp file with the paired .pdb, in the same directory
@@ -64,13 +64,13 @@ This screenshot shows the final loaded dump file, with sources and AddressSaniti
64
64
65
65

66
66
67
-
## Source and symbols
67
+
## <aname="source"></a> Source and symbols
68
68
69
69
Source server lets a client retrieve the **exact version** of the source files used to build an application. The source code for an executable or DLL can change over time, and between versions. You can use it to look at the same source code that built a particular version of the application.
70
70
71
71
While debugging an EXE with its PDB file, the debugger can use the embedded source server data block to retrieve the appropriate files from source control. It loads the files that map to the fully qualified names put in the PDB automatically by the **`/Zi`** compiler option.
72
72
73
-
To use source server, the application must be "source indexed" by using pdbstr.exe to write a `srcsrv` data block into your PDB file. For more information, see the Data Block section of [Source server and source indexing](/windows/win32/debug/source-server-and-source-indexing). You'll find [the steps to index sources and publish symbols](/azure/devops/pipelines/tasks/build/index-sources-publish-symbols?view=azure-devops) and [how to specify symbols and source code for the debugger](/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2019) useful, too.
73
+
To use source server, the application must be "source indexed" by using *`pdbstr.exe`* to write a `srcsrv` data block into your PDB file. For more information, see the Data Block section of [Source server and source indexing](/windows/win32/debug/source-server-and-source-indexing). You'll find [the steps to index sources and publish symbols](/azure/devops/pipelines/tasks/build/index-sources-publish-symbols) and [how to specify symbols and source code for the debugger](/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger) useful, too.
The AddressSanitizer runtime library intercepts common memory allocation functions and operations to enable inspection of memory accesses. There are several different runtime libraries that support the various types of executables the compiler may generate. The compiler and linker automatically link the appropriate runtime libraries, as long as you pass the [`/fsanitize=address`](../build/reference/fsanitize.md) option at compile time. You can override the default behavior by using the `/nodefaultlib` option at link time. See the section on [linking](./asan-building.md#Linker) for further detail.
10
+
The AddressSanitizer runtime library intercepts common memory allocation functions and operations to enable inspection of memory accesses. There are several different runtime libraries that support the various types of executables the compiler may generate. The compiler and linker automatically link the appropriate runtime libraries, as long as you pass the [`/fsanitize=address`](../build/reference/fsanitize.md) option at compile time. You can override the default behavior by using the `/nodefaultlib` option at link time. For more information, see the section on [linking](./asan-building.md#linker) in the [AddressSanitizer language, build, and debugging reference](./asan-building.md).
11
11
12
12
Below is an inventory of runtime libraries for linking to the AddressSanitizer runtime, where `arch` is either `i386` or `x86_64`.
13
13
@@ -29,7 +29,7 @@ When compiling with `cl /fsanitize=address`, the compiler generates instructions
29
29
30
30
The AddressSanitizer achieves function interception through many hot-patching techniques. These techniques are [best documented within the source code itself](https://github.com/llvm/llvm-project/blob/1a2eaebc09c6a200f93b8beb37130c8b8aab3934/compiler-rt/lib/interception/interception_win.cpp#L11).
31
31
32
-
The runtime libraries intercept many common memory management and memory manipulation functions. [A complete list of intercepted functions is available below.](#AddressSanitizer-list-of-intercepted-functions-Windows) The allocation interceptors manage metadata and shadow bytes related to each allocation call. Every time a CRT function such as `malloc` or `delete` is called, the interceptors set specific values in the AddressSanitizer shadow-memory region to indicate whether those heap locations are currently accessible and what the bounds of the allocation are. These shadow bytes allow the compiler-generated checks of the [shadow-bytes](./asan-shadowbytes.md) to determine whether a load or store is valid.
32
+
The runtime libraries intercept many common memory management and memory manipulation functions. For a list, see [A complete list of intercepted functions is available below.](#intercepted_functions) The allocation interceptors manage metadata and shadow bytes related to each allocation call. Every time a CRT function such as `malloc` or `delete` is called, the interceptors set specific values in the AddressSanitizer shadow-memory region to indicate whether those heap locations are currently accessible and what the bounds of the allocation are. These shadow bytes allow the compiler-generated checks of the [shadowbytes](./asan-shadowbytes.md) to determine whether a load or store is valid.
33
33
34
34
Interception isn't guaranteed to succeed. If a function prologue is too short for a `jmp` to be written, interception can fail. If an interception failure occurs, the program throws a `debugbreak` and halts. If you attach a debugger, it makes the cause of the interception issue clear. If you have this problem, [report a bug](https://aka.ms/feedback/report?space=62).
35
35
@@ -38,9 +38,9 @@ Interception isn't guaranteed to succeed. If a function prologue is too short fo
38
38
39
39
## Custom allocators and the AddressSanitizer runtime
40
40
41
-
The AddressSanitizer runtime provides interceptors for common allocator interfaces, `malloc`/`free`, `new`/`delete`, `HeapAlloc`/`HeapFree` (via `RtlAllocateHeap`/`RtlFreeHeap`). Many programs make use of custom allocators for one reason or another, an example would be any program using `dlmalloc` or a solution using the `std::allocator` interface and `VirtualAlloc()`. The compiler is unable to automatically add shadow-memory management calls to a custom allocator. It's the user's responsibility to use the [provided manual poisoning interface](#Manual-AddressSanitizer-poisoning-interface). This API enables these allocators to function properly with the existing AddressSanitizer runtime and [shadow byte](./asan-shadowbytes.md) conventions.
41
+
The AddressSanitizer runtime provides interceptors for common allocator interfaces, `malloc`/`free`, `new`/`delete`, `HeapAlloc`/`HeapFree` (via `RtlAllocateHeap`/`RtlFreeHeap`). Many programs make use of custom allocators for one reason or another, an example would be any program using `dlmalloc` or a solution using the `std::allocator` interface and `VirtualAlloc()`. The compiler is unable to automatically add shadow-memory management calls to a custom allocator. It's the user's responsibility to use the [provided manual poisoning interface](#poisoning). This API enables these allocators to function properly with the existing AddressSanitizer runtime and [shadow byte](./asan-shadowbytes.md) conventions.
The interface for enlightening is simple, but it imposes alignment restrictions on the user. Users may import these prototypes by importing [`sanitizer/asan_interface.h`](https://github.com/llvm/llvm-project/blob/main/compiler-rt/include/sanitizer/asan_interface.h). Here are the interface function prototypes:
46
46
@@ -74,7 +74,7 @@ Microsoft C/C++ (MSVC) uses a runtime based on the [Clang AddressSanitizer runti
74
74
> [!NOTE]
75
75
> The AddressSanitizer runtime option `halt_on_error` doesn't function the way you might expect. In both the Clang and the MSVC runtime libraries, many error types are considered **non-continuable**, including most memory corruption errors.
76
76
77
-
For more information, see the [Differences with Clang 12.0](./asan-top-level.md#Differences-with-Clang-12.0) section.
77
+
For more information, see the [Differences with Clang 12.0](./asan.md#differences) section.
@@ -86,7 +86,7 @@ For more information, see the [Differences with Clang 12.0](./asan-top-level.md#
86
86
>
87
87
> The option `windows_hook_rtl_allocators`, previously an opt-in feature while AddressSanitizer was experimental, is now enabled by default.
88
88
89
-
## AddressSanitizer list of intercepted functions (Windows)
89
+
## <aname="intercepted_functions"></a> AddressSanitizer list of intercepted functions (Windows)
90
90
91
91
The AddressSanitizer runtime hot-patches many functions to enable memory safety checks at runtime. Here's a non-exhaustive list of the functions that the AddressSanitizer runtime monitors.
92
92
@@ -161,7 +161,7 @@ The AddressSanitizer runtime hot-patches many functions to enable memory safety
0 commit comments