Skip to content

Commit e75d19b

Browse files
author
3836425+corob-msft@users.noreply.github.com
committed
Edit pass for i18n, grammar, and style
1 parent e668c4f commit e75d19b

File tree

3 files changed

+47
-25
lines changed

3 files changed

+47
-25
lines changed

docs/build/reference/fsanitize-coverage.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ helpviewer_keywords: ["/fsanitize-coverage [C++]", "sanitizer compiler option [C
77
---
88
# `/fsanitize-coverage` (Configure Sanitizer Coverage)
99

10-
The **`/fsanitize-coverage`** compiler options instruct the compiler to add various instrumentation points where user-defined functions are called. These options are primarily useful for fuzzing scenarios with **`/fsanitize=fuzzer`**. See the OneFuzz [documentation page](https://www.microsoft.com/en-us/research/project/project-onefuzz/) and [GitHub project](https://github.com/microsoft/onefuzz) for more information.
11-
12-
As of Visual Studio 2022 17.0, the follow options have experimental support: **`/fsanitize-coverage=edge`**, **`/fsanitize-coverage=inline-8bit-counters`**, **`/fsanitize-coverage=trace-cmp`**, **`/fsanitize-coverage=trace-div`**.
10+
The **`/fsanitize-coverage`** compiler options instruct the compiler to add various kinds of instrumentation points where user-defined functions are called. These options are useful for fuzzing scenarios that use **`/fsanitize=fuzzer`**. For more information, see the [OneFuzz documentation](https://www.microsoft.com/en-us/research/project/project-onefuzz/) and [OneFuzz GitHub project](https://github.com/microsoft/onefuzz).
1311

1412
## Syntax
1513

@@ -24,13 +22,31 @@ As of Visual Studio 2022 17.0, the follow options have experimental support: **`
2422
2523
## Remarks
2624

27-
The **`/fsanitize-coverage`** compiler options offer code coverage support and various options to modify which compiler-provided instrumentation is generated. Currently, all the options available are also ones that are automatically set when using [**`/fsanitize=fuzzer`**](fsanitize.md), which requires the instrumentation points and callbacks mentioned in these options. You do not need to provide the callbacks mentioned below when using **`/fsanitize=fuzzer`**.
25+
In Visual Studio 2022 version 17.0, the following options have experimental support:
26+
27+
- **`/fsanitize-coverage=edge`**,
28+
- **`/fsanitize-coverage=inline-8bit-counters`**,
29+
- **`/fsanitize-coverage=trace-cmp`**,
30+
- **`/fsanitize-coverage=trace-div`**.
31+
32+
The **`/fsanitize-coverage`** compiler options offer code coverage support and various options to modify which compiler-provided instrumentation is generated. All these options are automatically set when [`/fsanitize=fuzzer`](fsanitize.md) is specified. The **`/fsanitize=fuzzer`** option requires the same instrumentation points and callbacks mentioned in these options. You don't need to provide the callbacks mentioned below when using **`/fsanitize=fuzzer`**.
33+
34+
The **`/fsanitize-coverage`** option doesn't allow comma-separated syntax, for example: **`/fsanitize-coverage=edge,inline-8bit-counters,trace-cmp,trace-div`**. Specify these options individually.
35+
36+
The **`/fsanitize-coverage`** options are available beginning in Visual Studio 2022 version 17.0.
37+
38+
### Code coverage
39+
40+
The **`/fsanitize-coverage=edge`** compiler option enables code coverage instrumentation along all non-redundant edges. Use **`/fno-sanitize-coverage=edge`** to disable this option if it's already provided or implied by another option.
2841

29-
The **`/fsanitize-coverage=edge`** compiler option enables code coverage instrumentation along all non-redundant edges. Use **`/fno-sanitize-coverage=edge`** to disable this option if it has already been provided or implied by another option.
42+
### Inline counters
3043

31-
The **`/fsanitize-coverage=inline-8bit-counters`** compiler option instructs the compiler to add an inline counter increment on every relevant edge. This option will also add a call to `extern "C" void __sanitizer_cov_8bit_counters_init(uint8_t *start, uint8_t *stop)` that will need to be implemented. The arguments correspond to the start and end of an array containing all the 8-bit counters created. Use **`/fno-sanitize-coverage=inline-8bit-counters`** to disable this option if it has been already provided or implied by another option.
44+
The **`/fsanitize-coverage=inline-8bit-counters`** compiler option instructs the compiler to add an inline counter increment on every relevant edge. This option also adds a call to `extern "C" void __sanitizer_cov_8bit_counters_init(uint8_t *start, uint8_t *stop)` that you must implement. The arguments correspond to the start and end of an array that contains all the 8-bit counters created. Use **`/fno-sanitize-coverage=inline-8bit-counters`** to disable this option if it's already provided or implied by another option.
45+
46+
### Trace comparisons
3247

3348
The **`/fsanitize-coverage=trace-cmp`** compiler option instructs the compiler to insert calls to the following functions:
49+
3450
```C
3551
// Before each comparison instruction of the stated size.
3652
void __sanitizer_cov_trace_cmp1(uint8_t Arg1, uint8_t Arg2);
@@ -44,33 +60,34 @@ void __sanitizer_cov_trace_const_cmp2(uint16_t Arg1, uint16_t Arg2);
4460
void __sanitizer_cov_trace_const_cmp4(uint32_t Arg1, uint32_t Arg2);
4561
void __sanitizer_cov_trace_const_cmp8(uint64_t Arg1, uint64_t Arg2);
4662
```
47-
Use **`/fno-sanitize-coverage=trace-cmp`** to disable this option if it has been already provided or implied by another option.
63+
64+
Use **`/fno-sanitize-coverage=trace-cmp`** to disable this option if it's already provided or implied by another option.
65+
66+
### Trace divisions
4867
4968
The **`/fsanitize-coverage=trace-div`** compiler option instructs the compiler to insert calls to the following functions:
69+
5070
```C
5171
// Before a division instruction of the stated size.
5272
void __sanitizer_cov_trace_div4(uint32_t Val);
5373
void __sanitizer_cov_trace_div8(uint64_t Val);
5474
```
55-
Use **`/fno-sanitize-coverage=trace-div`** to disable this option if it has been already provided or implied by another option.
56-
57-
Currently, **`/fsanitize-coverage=`** does not allow comma-separated syntax, for example: **`/fsanitize-coverage=edge,inline-8bit-counters,trace-cmp,trace-div`**. These options must be provided individually.
5875

59-
The **`/fsanitize-coverage`** options are available beginning in Visual Studio 2022.
76+
Use **`/fno-sanitize-coverage=trace-div`** to disable this option if it's already provided or implied by another option.
6077

6178
### To set the advanced compiler options
6279

6380
1. Open your project's **Property Pages** dialog box.
6481

6582
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
6683

67-
1. Modify the **Additional Options** property to set **/fsanitize-coverage=\<option\>**.
84+
1. Modify the **Additional Options** property to set **/fsanitize-coverage** options.
6885

6986
1. Choose **OK** or **Apply** to save your changes.
7087

7188
## See also
7289

7390
[MSVC compiler options](compiler-options.md)\
7491
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)\
75-
[`/fsanitize` (Enable Sanitizers) compiler option](fsanitize.md)\
92+
[`/fsanitize` (Enable Sanitizers)](fsanitize.md)\
7693
[AddressSanitizer build and language reference](../../sanitizers/asan-building.md)

docs/build/reference/fsanitize.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ helpviewer_keywords: ["/fsanitize [C++]", "-fsanitize=address [C++]", "address s
77
---
88
# `/fsanitize` (Enable sanitizers)
99

10-
Use the **`/fsanitize`** compiler options to enable sanitizers. As of Visual Studio 2019 16.9, the only supported sanitizer is [AddressSanitizer](../../sanitizers/asan.md). As of Visual Studio 2022 17.0, LibFuzzer has experimental support.
10+
Use the **`/fsanitize`** compiler options to enable sanitizers.
1111

1212
## Syntax
1313

@@ -18,16 +18,14 @@ Use the **`/fsanitize`** compiler options to enable sanitizers. As of Visual Stu
1818
1919
## Remarks
2020

21-
The **`/fsanitize=address`** compiler option enables [AddressSanitizer](../../sanitizers/asan.md), a powerful compiler and runtime technology to light up [hard-to-find bugs](../../sanitizers/asan.md#error-types).
21+
The **`/fsanitize=address`** compiler option enables [AddressSanitizer](../../sanitizers/asan.md), a powerful compiler and runtime technology to uncover [hard-to-find bugs](../../sanitizers/asan.md#error-types). The option is available starting in Visual Studio 2019 version 16.9.
2222

23-
The **`/fsanitize=fuzzer`** compiler option enables LibFuzzer (experimental), a coverage-guided fuzzing library that can be used to find bugs and crashes caused by user-provided input. It is recommended to use **`/fsanitize=address`** alongside LibFuzzer. See the OneFuzz [documentation page](https://www.microsoft.com/en-us/research/project/project-onefuzz/) and [GitHub project](https://github.com/microsoft/onefuzz) for more information.
23+
The **`/fsanitize=fuzzer`** compiler option enables experimental support for LibFuzzer. LibFuzzer is a coverage-guided fuzzing library that can be used to find bugs and crashes caused by user-provided input. We recommended you use **`/fsanitize=address`** with LibFuzzer. For more information, see the [OneFuzz documentation](https://www.microsoft.com/en-us/research/project/project-onefuzz/) and [OneFuzz GitHub project](https://github.com/microsoft/onefuzz). Support for the **`/fsanitize=fuzzer`** option is available starting in Visual Studio 2022 version 17.0.
2424

25-
Currently, **`/fsanitize=`** does not allow comma-separated syntax, for example: **`/fsanitize=address,fuzzer`**. These options must be provided individually.
25+
The **`/fsanitize`** option doesn't allow comma-separated syntax, for example: **`/fsanitize=address,fuzzer`**. These options must be specified individually.
2626

2727
The **`/fsanitize-address-use-after-return`** and **`/fno-sanitize-address-vcasan-lib`** compiler options, and the [`/INFERASANLIBS` (Use inferred sanitizer libs)](./inferasanlibs.md) and **`/INFERASANLIBS:NO`** linker options offer support for advanced users. For more information, see [AddressSanitizer build and language reference](../../sanitizers/asan-building.md).
2828

29-
The **`/fsanitize`** options are available beginning in Visual Studio 2019 version 16.9.
30-
3129
### To set the **`/fsanitize=address`** compiler option in the Visual Studio development environment
3230

3331
1. Open your project's **Property Pages** dialog box.
@@ -67,7 +65,7 @@ The **`/fsanitize`** options are available beginning in Visual Studio 2019 versi
6765
[MSVC compiler options](compiler-options.md)\
6866
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)\
6967
[`/INFERASANLIBS` (Use inferred sanitizer libs)](./inferasanlibs.md)\
70-
[`/fsanitize-coverage` (Configure Sanitizer Coverage) compiler option](fsanitize-coverage.md)\
68+
[`/fsanitize-coverage` (Configure Sanitizer Coverage)](fsanitize-coverage.md)\
7169
[AddressSanitizer overview](../../sanitizers/asan.md)\
7270
[AddressSanitizer known issues](../../sanitizers/asan-known-issues.md)\
7371
[AddressSanitizer build and language reference](../../sanitizers/asan-building.md)

docs/sanitizers/asan-building.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "AddressSanitizer language, build, and debugging reference"
33
description: "Technical description of building for the AddressSanitizer"
4-
ms.date: 03/02/2021
4+
ms.date: 09/15/2021
55
f1_keywords: ["__SANITIZE_ADDRESS__", "ASAN_VCASAN_DEBUGGING"]
66
helpviewer_keywords: ["ASan reference", "AddressSanitizer reference", "Address Sanitizer reference"]
77
---
@@ -56,17 +56,24 @@ void test3() {
5656

5757
### `/fsanitize=address` compiler option
5858

59-
The [**`/fsanitize=address`**](../build/reference/fsanitize.md) compiler option instruments memory references in your code to catch memory safety errors at runtime. The instrumentation hooks loads, stores, scopes, alloca, and CRT functions. It can detect hidden bugs such as out-of-bounds, use-after-free, use-after-scope, and so on. For a non-exhaustive list of errors detected at runtime, see [AddressSanitizer error examples](./asan-error-examples.md).
59+
The [**`/fsanitize=address`**](../build/reference/fsanitize.md) compiler option instruments memory references in your code to catch memory safety errors at runtime. The instrumentation hooks loads, stores, scopes, `alloca`, and CRT functions. It can detect hidden bugs such as out-of-bounds, use-after-free, use-after-scope, and so on. For a non-exhaustive list of errors detected at runtime, see [AddressSanitizer error examples](./asan-error-examples.md).
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

6363
For examples of code that demonstrates several kinds of error detection, see [AddressSanitizer error examples](asan-error-examples.md).
6464

6565
### `/fsanitize=fuzzer` compiler option (experimental)
6666

67-
The [**`/fsanitize=fuzzer`**](../build/reference/fsanitize.md) compiler option will add LibFuzzer to the default library list, as well as also set the following sanitizer coverage options: [edge instrumentation points (**`/fsanitize-coverage=edge`**)](../build/reference/fsanitize-coverage.md), [inline 8-bit counters (**`/fsanitize-coverage=inline-8bit-counters`**)](../build/reference/fsanitize-coverage.md), and extra instrumentation around [comparisons (**`/fsanitize-coverage=trace-cmp`**)](../build/reference/fsanitize-coverage.md) and [integer divisions (**`/fsanitize-coverage=trace-div`**)](../build/reference/fsanitize-coverage.md). It is recommended to use **`/fsanitize=address`** alongside **`/fsanitize=fuzzer`**.
67+
The [`/fsanitize=fuzzer`](../build/reference/fsanitize.md) compiler option adds LibFuzzer to the default library list. It also sets the following sanitizer coverage options:
6868

69-
Here are the libraries added to the default library list when specifying **`/fsanitize=fuzzer`**:
69+
- [Edge instrumentation points (**`/fsanitize-coverage=edge`**)](../build/reference/fsanitize-coverage.md),
70+
- [inline 8-bit counters (**`/fsanitize-coverage=inline-8bit-counters`**)](../build/reference/fsanitize-coverage.md),
71+
- [comparisons (**`/fsanitize-coverage=trace-cmp`**)](../build/reference/fsanitize-coverage.md), and
72+
- [integer divisions (**`/fsanitize-coverage=trace-div`**)](../build/reference/fsanitize-coverage.md).
73+
74+
We recommend you use **`/fsanitize=address`** with **`/fsanitize=fuzzer`**.
75+
76+
These libraries are added to the default library list when you specify **`/fsanitize=fuzzer`**:
7077

7178
| Runtime option | LibFuzzer library |
7279
|--|--|
@@ -75,7 +82,7 @@ Here are the libraries added to the default library list when specifying **`/fsa
7582
| **`/MTd`** | *`clang_rt.fuzzer_MTd-{arch}`* |
7683
| **`/MDd`** | *`clang_rt.fuzzer_MDd-{arch}`* |
7784

78-
There is also a version of the LibFuzzer libraries that omit the **`main`** function, leaving the responsibility to define **`main`** and call **`LLVMFuzzerInitialize`** and **`LLVMFuzzerTestOneInput`** to the user. You will need to use [**`/NODEFAULTLIB`**](../build/reference/nodefaultlib-ignore-libraries.md) to ensure the libraries listed above are not included and link with one of the libraries listed below instead:
85+
LibFuzzer libraries that omit the **`main`** function are also available. It's your responsibility to define **`main`** and to call **`LLVMFuzzerInitialize`** and **`LLVMFuzzerTestOneInput`** when you use these libraries. Use [`/NODEFAULTLIB`](../build/reference/nodefaultlib-ignore-libraries.md) to link with one of the libraries listed below:
7986

8087
| Runtime option | LibFuzzer no_main library |
8188
|--|--|

0 commit comments

Comments
 (0)