Skip to content

Commit e987533

Browse files
author
Colin Robertson
committed
Build preview fixes
1 parent 5d7d7fa commit e987533

5 files changed

Lines changed: 32 additions & 32 deletions

File tree

‎docs/build/reference/fsanitize.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Use the **`/fsanitize`** compiler options to enable sanitizers. As of Visual Stu
1313

1414
> **`/fsanitize=address`**\
1515
> **`/fsanitize-address-use-after-return`**\
16-
> **`/fno-sanitize-address-vcasan-lib`**\
16+
> **`/fno-sanitize-address-vcasan-lib`**
1717
1818
## Remarks
1919

‎docs/sanitizers/asan-building.md‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The [`/fsanitize=address`](../build/reference/fsanitize.md) compiler option inst
6060

6161
**`/fsanitize=address`** is compatible with all existing C++ or C optimization levels (for example, **`/Od`**, **`/O1`**, **`/O2`**, **`/O2 /GL`**, and profile guided optimization). The code produced with this option works with static and dynamic CRTs (for example, **`/MD`**, **`/MDd`**, **`/MT`**, and **`/MTd`**). This compiler option can be used to create an .EXE or .DLL targeting x86 or x64. Debug information is required for optimal formatting of call stacks.
6262

63-
See [the examples](asan.md#error-types) for sample usage.
63+
See [the examples in the error reference](asan-error-examples.md) for sample usage.
6464

6565
### `/fsanitize-address-use-after-return` compiler option (experimental)
6666

@@ -79,18 +79,18 @@ Stack frames are allocated in the heap and remain after functions return. The ru
7979

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

82-
The **`/fsanitize=address`** compiler option marks objects to specify the AddressSanitizer library to link into your executable. The libraries have names that begin with `clang_rt.asan*`. The [`/INFERASANLIBS`](../build/reference/inferasanlibs.md) linker option (on by default) links these libraries from their default locations automatically. Here are the libraries chosen and automatically linked in:
82+
The **`/fsanitize=address`** compiler option marks objects to specify the AddressSanitizer library to link into your executable. The libraries have names that begin with *`clang_rt.asan*`*. The [`/INFERASANLIBS`](../build/reference/inferasanlibs.md) linker option (on by default) links these libraries from their default locations automatically. Here are the libraries chosen and automatically linked in:
8383

84-
| CRT option | DLL or EXE | DEBUG? | AddressSanitizer runtime libraries |
85-
|----------|------------|--------|------------------------------------------------------------------------------------|
86-
| MT | EXE | NO | `clang_rt.asan-{arch}, clang_rt.asan_cxx-{arch}` |
87-
| MT | DLL | NO | `clang_rt.asan_dll_thunk-{arch}` |
88-
| MD | EITHER | NO | `clang_rt.asan_dynamic-{arch}, clang_rt.asan_dynamic_runtime_thunk-{arch}` |
89-
| MT | EXE | YES | `clang_rt.asan_dbg-{arch}, clang_rt.asan_dbg_cxx-{arch}` |
90-
| MT | DLL | YES | `clang_rt.asan_dbg_dll_thunk-{arch}` |
91-
| MD | EITHER | YES | `clang_rt.asan_dbg_dynamic-{arch}, clang_rt.asan_dbg_dynamic_runtime_thunk-{arch}` |
84+
| CRT option | DLL or EXE | DEBUG? | AddressSanitizer runtime libraries |
85+
|--|--|--|--|
86+
| MT | EXE | NO | *`clang_rt.asan-{arch}`*, *`clang_rt.asan_cxx-{arch}`* |
87+
| MT | DLL | NO | *`clang_rt.asan_dll_thunk-{arch}`* |
88+
| MD | EITHER | NO | *`clang_rt.asan_dynamic-{arch}`*, *`clang_rt.asan_dynamic_runtime_thunk-{arch}`* |
89+
| MT | EXE | YES | *`clang_rt.asan_dbg-{arch}`*, *`clang_rt.asan_dbg_cxx-{arch}`* |
90+
| MT | DLL | YES | *`clang_rt.asan_dbg_dll_thunk-{arch}`* |
91+
| MD | EITHER | YES | *`clang_rt.asan_dbg_dynamic-{arch}`*, *`clang_rt.asan_dbg_dynamic_runtime_thunk-{arch}`* |
9292

93-
The linker option [`/INFERASANLIBS:NO`](../build/reference/inferasanlibs.md) prevents the linker from linking a `clang_rt.asan*` library file from the default location. Add the library path in your build scripts if you use this option. Otherwise, the linker reports an unresolved external symbol error.
93+
The linker option [`/INFERASANLIBS:NO`](../build/reference/inferasanlibs.md) prevents the linker from linking a *`clang_rt.asan*`* library file from the default location. Add the library path in your build scripts if you use this option. Otherwise, the linker reports an unresolved external symbol error.
9494

9595
## Visual Studio integration
9696

‎docs/sanitizers/asan-runtime.md‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ 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. For more information, see the section on [linking](./asan-building.md#linker) in the [AddressSanitizer language, build, and debugging reference](./asan-building.md).
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

12-
Below is an inventory of runtime libraries for linking to the AddressSanitizer runtime, where `arch` is either `i386` or `x86_64`.
12+
Below is an inventory of runtime libraries for linking to the AddressSanitizer runtime, where *`{arch}`* is either *`i386`* or *`x86_64`*.
1313

1414
> [!NOTE]
1515
> These libraries keep the Clang conventions for architecture names. The MSVC conventions are normally x86 and x64 rather than i386 and x86_64. They refer to the same architectures.
1616
17-
| CRT option | DLL or EXE | DEBUG? | AddressSanitizer runtime binaries libraries |
18-
|----------|------------|--------|------------------------------------------------------------------------------------|
19-
| MT | EXE | NO | `clang_rt.asan-{arch}, clang_rt.asan_cxx-{arch}` |
20-
| MT | DLL | NO | `clang_rt.asan_dll_thunk-{arch}` |
21-
| MD | EITHER | NO | `clang_rt.asan_dynamic-{arch}, clang_rt.asan_dynamic_runtime_thunk-{arch}` |
22-
| MT | EXE | YES | `clang_rt.asan_dbg-{arch}, clang_rt.asan_dbg_cxx-{arch}` |
23-
| MT | DLL | YES | `clang_rt.asan_dbg_dll_thunk-{arch}` |
24-
| MD | EITHER | YES | `clang_rt.asan_dbg_dynamic-{arch}, clang_rt.asan_dbg_dynamic_runtime_thunk-{arch}` |
17+
| CRT option | DLL or EXE | DEBUG? | AddressSanitizer runtime binaries libraries |
18+
|--|--|--|--|
19+
| MT | EXE | NO | *`clang_rt.asan-{arch}`*, *`clang_rt.asan_cxx-{arch}`* |
20+
| MT | DLL | NO | *`clang_rt.asan_dll_thunk-{arch}`* |
21+
| MD | EITHER | NO | *`clang_rt.asan_dynamic-{arch}`*, *`clang_rt.asan_dynamic_runtime_thunk-{arch}`* |
22+
| MT | EXE | YES | *`clang_rt.asan_dbg-{arch}`*, *`clang_rt.asan_dbg_cxx-{arch}`* |
23+
| MT | DLL | YES | *`clang_rt.asan_dbg_dll_thunk-{arch}`* |
24+
| MD | EITHER | YES | *`clang_rt.asan_dbg_dynamic-{arch}`*, *`clang_rt.asan_dbg_dynamic_runtime_thunk-{arch}`* |
2525

26-
When compiling with `cl /fsanitize=address`, the compiler generates instructions to manage and check the [shadow-bytes](./asan-shadowbytes.md). Your program uses this instrumentation to check memory accesses on the stack, in the heap, or in the global scope. The compiler also produces metadata describing stack and global variables. This metadata enables the runtime to generate precise error diagnostics: function names, lines, and columns in your source code. Combined, the compiler checks and runtime libraries can precisely diagnose many types of [memory safety bugs](./asan.md#error-types) if they're encountered at run-time.
26+
When compiling with `cl /fsanitize=address`, the compiler generates instructions to manage and check the [shadow bytes](./asan-shadowbytes.md). Your program uses this instrumentation to check memory accesses on the stack, in the heap, or in the global scope. The compiler also produces metadata describing stack and global variables. This metadata enables the runtime to generate precise error diagnostics: function names, lines, and columns in your source code. Combined, the compiler checks and runtime libraries can precisely diagnose many types of [memory safety bugs](./asan-error-examples.md) if they're encountered at run-time.
2727

2828
## Function interception
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. 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.
32+
The runtime libraries intercept many common memory management and memory manipulation functions. For a list, see [AddressSanitizer list of intercepted functions](#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

@@ -40,7 +40,7 @@ Interception isn't guaranteed to succeed. If a function prologue is too short fo
4040

4141
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-
## <a name="poisoning"> Manual AddressSanitizer poisoning interface
43+
## <a name="poisoning"></a> 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

@@ -101,19 +101,19 @@ The AddressSanitizer runtime hot-patches many functions to enable memory safety
101101
- [`_calloc_crt`](../c-runtime-library/reference/calloc.md)
102102
- [`_calloc_dbg` (debug runtime only)](../c-runtime-library/reference/calloc-dbg.md)
103103
- [`_except_handler3` (x86 only)](../c-runtime-library/except-handler3.md)
104-
- `_except_handler4` (x86 only)(undocumented)
104+
- [`_except_handler4` (x86 only)](../c-runtime-library/internal-crt-globals-and-functions.md) (undocumented)
105105
- [`_expand`](../c-runtime-library/reference/expand.md)
106106
- `_expand_base` (undocumented)
107107
- [`_expand_dbg` (debug runtime only)](../c-runtime-library/reference/expand-dbg.md)
108-
- `_free_base` (undocumented)
108+
- [`_free_base`](../c-runtime-library/internal-crt-globals-and-functions.md) (undocumented)
109109
- [`_free_dbg` (debug runtime only)](../c-runtime-library/reference/free-dbg.md)
110-
- `_malloc_base` (undocumented)
110+
- [`_malloc_base`](../c-runtime-library/internal-crt-globals-and-functions.md) (undocumented)
111111
- `_malloc_crt` (undocumented)
112112
- [`_malloc_dbg` (debug runtime only)](../c-runtime-library/reference/malloc-dbg.md)
113113
- [`_msize`](../c-runtime-library/reference/msize.md)
114114
- `_msize_base` (undocumented)
115115
- [`_msize_dbg` (debug runtime only)](../c-runtime-library/reference/msize-dbg.md)
116-
- `_realloc_base` (undocumented)
116+
- [`_realloc_base`](../c-runtime-library/internal-crt-globals-and-functions.md) (undocumented)
117117
- `_realloc_crt` (undocumented)
118118
- [`_realloc_dbg` (debug runtime only)](../c-runtime-library/reference/realloc-dbg.md)
119119
- [`_recalloc`](../c-runtime-library/reference/recalloc.md)

‎docs/sanitizers/asan.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This article covers the information you require to enable the three workflows li
7878

7979
Use the **`/fsanitize=address`** compiler option in a [developer command prompt](../build/building-on-the-command-line.md#developer_command_prompt_shortcuts) to enable compiling for the AddressSanitizer runtime. The **`/fsanitize=address`** option is compatible with all existing C++ or C optimization levels (for example, `/Od`, `/O1`, `/O2`, `/O2 /GL`, and `PGO`). The option works with static and dynamic CRTs (for example, `/MD`, `/MDd`, `/MT`, and `/MTd`). It works whether you create an EXE or a DLL. Debug information is required for optimal formatting of call stacks. In the example below, `cl /fsanitize=address /Zi` is passed on the command line.
8080

81-
The AddressSanitizer libraries (.lib files) get linked for you automatically. For more information, and for guidelines on partitioned build systems, see [building to target the AddressSanitizer runtime](./asan-building.md).
81+
The AddressSanitizer libraries (.lib files) get linked for you automatically. For more information, see [AddressSanitizer language, build, and debugging reference](asan-building.md).
8282

8383
### Example - basic global buffer overflow
8484

‎docs/sanitizers/error-stack-use-after-return.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Consider the [Clang summary](https://github.com/google/sanitizers/wiki/AddressSa
1818
1919
Examples sourced from [LLVM compiler-rt test suite](https://github.com/llvm/llvm-project/tree/main/compiler-rt/test/asan/TestCases).
2020

21-
## Example - Simple 'C'
21+
## Example - Simple C
2222

2323
```cpp
2424
// example1.cpp
@@ -47,7 +47,7 @@ set ASAN_OPTIONS=detect_stack_use_after_return=1
4747
devenv /debugexe example1.exe
4848
```
4949

50-
### Resulting error - Simple 'C'
50+
### Resulting error - Simple C
5151

5252
![Screenshot of debugger displaying error in example1](media/stack-use-after-return-example1.png)
5353

0 commit comments

Comments
 (0)