Skip to content

Commit 5d7d7fa

Browse files
author
Colin Robertson
committed
Fix build issues
1 parent 691bee3 commit 5d7d7fa

5 files changed

Lines changed: 37 additions & 35 deletions

File tree

‎docs/sanitizers/asan-building.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The dual stack frame in the heap remains after the return from the function that
7575

7676
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.
7777

78-
## Linker
78+
## <a name="linker"></a> Linker
7979

8080
### `/INFERASANLIBS[:NO]` linker option
8181

‎docs/sanitizers/asan-known-issues.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ helpviewer_keywords: ["AddressSanitizer known issues"]
77

88
# AddressSanitizer known issues
99

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.
1112
12-
## Incompatible options and functionality
13+
## <a name="incompatible-options"></a> Incompatible options and functionality
1314

1415
These options and functionality are incompatible with [`/fsanitize=address`](../build/reference/fsanitize.md) and should be disabled or avoided.
1516

‎docs/sanitizers/asan-offline-crash-dumps.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ This [dump file](/previous-versions/windows/desktop/proc_snap/export-a-process-s
2121

2222
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.
2323

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).
2525

2626
## Example - build, test, and analyze
2727

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).
2929

3030
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.
3131

@@ -36,9 +36,9 @@ The following steps are for local or distributed scenarios that lead to creation
3636
- Copy a generated .dmp file to the build directory
3737
- Open the .dmp file with the paired .pdb, in the same directory
3838

39-
### Product a .dmp on a distributed system
39+
### Produce a .dmp on a distributed system
4040

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)
4242
- Copy the atomic pair of (.exe, .pdb) to the test machine and run tests
4343
- Write the atomic pairs of (.pdb, .dmp) to the bug-reporting database
4444
- 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
6464

6565
![Screenshot of the debugger showing source files and AddressSanitizer metadata](./media/asan-view-crash-metadata.png)
6666

67-
## Source and symbols
67+
## <a name="source"></a> Source and symbols
6868

6969
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.
7070

7171
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.
7272

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.
7474

7575
For external documentation, see:
7676

‎docs/sanitizers/asan-runtime.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ helpviewer_keywords: ["AddressSanitizer runtime", "Address Sanitizer runtime", "
77

88
# AddressSanitizer runtime
99

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. 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).
1111

1212
Below is an inventory of runtime libraries for linking to the AddressSanitizer runtime, where `arch` is either `i386` or `x86_64`.
1313

@@ -29,7 +29,7 @@ When compiling with `cl /fsanitize=address`, the compiler generates instructions
2929

3030
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).
3131

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 [shadow bytes](./asan-shadowbytes.md) to determine whether a load or store is valid.
3333

3434
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).
3535

@@ -38,9 +38,9 @@ Interception isn't guaranteed to succeed. If a function prologue is too short fo
3838
3939
## Custom allocators and the AddressSanitizer runtime
4040

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.
4242

43-
## Manual AddressSanitizer poisoning interface
43+
## <a name="poisoning"> Manual AddressSanitizer poisoning interface
4444

4545
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:
4646

@@ -74,7 +74,7 @@ Microsoft C/C++ (MSVC) uses a runtime based on the [Clang AddressSanitizer runti
7474
> [!NOTE]
7575
> 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.
7676
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.
7878

7979
### MSVC-specific AddressSanitizer runtime options
8080

@@ -86,7 +86,7 @@ For more information, see the [Differences with Clang 12.0](./asan-top-level.md#
8686
>
8787
> The option `windows_hook_rtl_allocators`, previously an opt-in feature while AddressSanitizer was experimental, is now enabled by default.
8888
89-
## AddressSanitizer list of intercepted functions (Windows)
89+
## <a name="intercepted_functions"></a> AddressSanitizer list of intercepted functions (Windows)
9090

9191
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.
9292

@@ -161,7 +161,7 @@ The AddressSanitizer runtime hot-patches many functions to enable memory safety
161161
- [`strtok`](../c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l.md)
162162
- [`strtol`](../c-runtime-library/reference/strtol-wcstol-strtol-l-wcstol-l.md)
163163
- [`wcslen`](../c-runtime-library/reference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l.md)
164-
- [`wcsnlen`](../c-runtime-library/reference/strnlen-strnlen.md)
164+
- [`wcsnlen`](../c-runtime-library/reference/strnlen-strnlen-s.md)
165165

166166
### Optional interceptors
167167

0 commit comments

Comments
 (0)