Skip to content

Commit 26085a2

Browse files
Merge pull request #4835 from MicrosoftDocs/main638370525295588604sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 39387eb + 2e527f5 commit 26085a2

File tree

6 files changed

+60
-12
lines changed

6 files changed

+60
-12
lines changed

docs/build/reference/qspectre-jmp.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "/Qspectre-jmp"
3+
description: "Describes the Microsoft C/C++ compiler (MSVC) /Qspectre-jmp option."
4+
ms.date: 11/30/2023
5+
helpviewer_keywords: ["/Qspectre-jmp"]
6+
---
7+
# `/Qspectre-jmp`
8+
9+
Causes the compiler to generate an `int3` instruction (software interrupt) after unconditional direct branches. This option extends the [`/Qspectre`](qspectre.md) flag and mitigates speculative execution side-channel attacks on unconditional direct branches.
10+
11+
## Syntax
12+
13+
> **/Qspectre-jmp**
14+
15+
## Remarks
16+
17+
**`/Qspectre-jmp`** causes the compiler to detect executable instructions following unconditional direct branches. An `int3` is inserted following unconditional direct branches to ensure that no instructions are speculatively executed beyond the branch. For example, the compiler mitigates `jmp addr` by adding an `int3` instruction following the `jmp` instruction as shown here:
18+
19+
```asm
20+
jmp addr
21+
int3
22+
```
23+
24+
`/Qspectre-jmp` is off by default. It's supported for all optimization levels.
25+
26+
### Set this compiler option programmatically
27+
28+
To set this option programmatically, see [VCCLCompilerTool.AdditionalOptions property](/dotnet/api/microsoft.visualstudio.vcprojectengine.vcclcompilertool.additionaloptions).
29+
30+
## See also
31+
32+
[`/Qspectre`](qspectre.md)\
33+
[`/Qspectre-jmp`](qspectre-jmp.md)\
34+
[`/Qspectre-load`](qspectre-load.md)\
35+
[`/Qspectre-load-cf`](qspectre-load-cf.md)\
36+
[/Q options (Low-Level Operations)](q-options-low-level-operations.md)\
37+
[MSVC compiler options](compiler-options.md)\
38+
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)

docs/build/reference/qspectre-load-cf.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Specifies compiler generation of serializing instructions for every control-flow
1515
1616
## Remarks
1717

18-
**/Qspectre-load-cf** causes the compiler to detect `JMP`, `RET`, and `CALL` control-flow instructions that load from memory, and to insert serializing instructions after the load. Where possible, these instructions are split into a load and a control flow transfer. The load is followed by an `LFENCE` to ensure the load is protected. There are cases where the compiler can't split instructions, such as the `JMP` instruction, so it uses an alternate mitigation technique. For example, the compiler mitigates `jmp [rax]` by adding instructions to load the target non-destructively before inserting an LFENCE, as shown here:
18+
**/Qspectre-load-cf** causes the compiler to detect `JMP`, `RET`, and `CALL` control-flow instructions that load from memory, and to insert serializing instructions after the load. Where possible, these instructions are split into a load and a control flow transfer. The load is followed by an `LFENCE` to ensure the load is protected. There are cases where the compiler can't split instructions, such as the `JMP` instruction, so it uses an alternate mitigation technique. For example, the compiler mitigates `jmp [rax]` by adding instructions to load the target nondestructively before inserting an LFENCE, as shown here:
1919

2020
```asm
2121
xor rbx, [rax]
@@ -44,6 +44,9 @@ The **/Qspectre-load-cf** option is available in Visual Studio 2019 version 16.5
4444

4545
## See also
4646

47+
[`/Qspectre`](qspectre.md)\
48+
[`/Qspectre-jmp`](qspectre-jmp.md)\
49+
[`/Qspectre-load`](qspectre-load.md)\
4750
[/Q options (Low-level operations)](q-options-low-level-operations.md)\
4851
[MSVC compiler options](compiler-options.md)\
4952
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)

docs/build/reference/qspectre-load.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Specifies compiler generation of serializing instructions for every load instruc
1414
1515
## Remarks
1616

17-
**/Qspectre-load** causes the compiler to detect loads from memory, and insert serializing instructions after them. Control flow instructions that load memory, including `RET` and `CALL`, are split into a load and a control flow transfer. The load is followed by an `LFENCE` to ensure the load is protected. There are cases where the compiler can't split control flow instructions, such as the `jmp` instruction, so it uses an alternate mitigation technique. For example, the compiler mitigates `jmp [rax]` by adding instructions to load the target non-destructively before inserting an LFENCE, as shown here:
17+
**/Qspectre-load** causes the compiler to detect loads from memory, and insert serializing instructions after them. Control flow instructions that load memory, including `RET` and `CALL`, are split into a load and a control flow transfer. The load is followed by an `LFENCE` to ensure the load is protected. There are cases where the compiler can't split control flow instructions, such as the `jmp` instruction, so it uses an alternate mitigation technique. For example, the compiler mitigates `jmp [rax]` by adding instructions to load the target nondestructively before inserting an LFENCE, as shown here:
1818

1919
```asm
2020
xor rbx, [rax]
@@ -43,6 +43,9 @@ The **/Qspectre-load** option is available in Visual Studio 2019 version 16.5 an
4343

4444
## See also
4545

46+
[`/Qspectre`](qspectre.md)\
47+
[`/Qspectre-jmp`](qspectre-jmp.md)\
48+
[`/Qspectre-load-cf`](qspectre-load-cf.md)\
4649
[/Q options (Low-Level Operations)](q-options-low-level-operations.md)\
4750
[MSVC compiler options](compiler-options.md)\
4851
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)

docs/build/reference/qspectre.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The **`/Qspectre`** option is off by default.
2323

2424
In its initial release, the **`/Qspectre`** option only worked on optimized code. Starting in Visual Studio 2017 version 15.7, the **`/Qspectre`** option is supported at all optimization levels.
2525

26-
Several Microsoft C++ libraries are also available in versions with Spectre mitigation. The Spectre-mitigated libraries for Visual Studio can be downloaded in the Visual Studio Installer. They're found in the **Individual Components** tab under **Compilers, build tools, and runtimes**, and have "Libs for Spectre" in the name. Both DLL and static runtime libraries with mitigation enabled are available for a subset of the Visual C++ runtimes: VC++ start-up code, vcruntime140, msvcp140, concrt140, and vcamp140. The DLLs are supported for application-local deployment only. The contents of the Visual C++ Runtime Libraries Redistributable haven't been modified.
26+
Several Microsoft C++ libraries are also available in versions with Spectre mitigation. The Spectre-mitigated libraries for Visual Studio can be downloaded in the Visual Studio Installer. They're found in the **Individual Components** tab under **Compilers, build tools, and runtimes**, and have "Libs for Spectre" in the name. Both DLL and static runtime libraries with mitigation enabled are available for a subset of the Visual C++ runtimes: VC++ start-up code, vcruntime140, msvcp140, concrt140, and vcamp140. The DLLs are supported for application-local deployment only. The contents of the Visual C++ Runtime Libraries Redistributable are unmodified.
2727

2828
You can also install Spectre-mitigated libraries for MFC and ATL. They're found in the **Individual Components** tab under **SDKs, libraries, and frameworks**.
2929

@@ -72,7 +72,7 @@ The default MSBuild-based project system in the Visual Studio IDE lets you speci
7272

7373
::: moniker range="msvc-150"
7474

75-
The default MSBuild-based project system in the Visual Studio IDE lets you specify a [Spectre Mitigation](./c-cpp-prop-page.md#spectre-mitigation) property for your projects. This property sets the **`/Qspectre`** compiler option and changes the library paths to link the Spectre-mitigated runtime libraries. If these libraries aren't installed when you build your code, the build system reports warning MSB8038: "Spectre mitigation is enabled but Spectre mitigated libraries are not found". If your MFC or ATL code fails to build, and the linker reports an error such as "fatal error LNK1104: cannot open file 'oldnames.lib'", these missing libraries may be the cause.
75+
The default MSBuild-based project system in the Visual Studio IDE lets you specify a [Spectre Mitigation](./c-cpp-prop-page.md#spectre-mitigation) property for your projects. This property sets the **`/Qspectre`** compiler option and changes the library paths to link the Spectre-mitigated runtime libraries. If these libraries aren't installed when you build your code, the build system reports warning MSB8038: "Spectre mitigation is enabled but Spectre mitigated libraries are not found." If your MFC or ATL code fails to build, and the linker reports an error such as "fatal error LNK1104: cannot open file 'oldnames.lib'", these missing libraries may be the cause.
7676

7777
::: moniker-end
7878

@@ -134,6 +134,9 @@ For an overview of Spectre vulnerabilities addressed by the MSVC mitigations, se
134134

135135
## See also
136136

137+
[`/Qspectre-jmp`](qspectre-jmp.md)\
138+
[`/Qspectre-load`](qspectre-load.md)\
139+
[`/Qspectre-load-cf`](qspectre-load-cf.md)\
137140
[`/Q` options (Low-level operations)](q-options-low-level-operations.md)\
138141
[MSVC compiler options](compiler-options.md)\
139142
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)

docs/build/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ items:
700700
href: ../build/reference/qsafe-fp-loads.md
701701
- name: /Qspectre
702702
href: ../build/reference/qspectre.md
703+
- name: /Qspectre-jmp
704+
href: ../build/reference/qspectre-jmp.md
703705
- name: /Qspectre-load
704706
href: ../build/reference/qspectre-load.md
705707
- name: /Qspectre-load-cf

docs/c-runtime-library/reference/splitpath-wsplitpath.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
---
22
description: "Learn more about: _splitpath, _wsplitpath"
33
title: "_splitpath, _wsplitpath"
4-
ms.date: "4/2/2020"
4+
ms.date: 11/30/2023
55
api_name: ["_wsplitpath", "_splitpath", "_o__splitpath", "_o__wsplitpath"]
66
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-filesystem-l1-1-0.dll"]
77
api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["wsplitpath", "_splitpath", "splitpath", "_wsplitpath", "_tsplitpath"]
1010
helpviewer_keywords: ["_splitpath function", "pathnames", "wsplitpath function", "splitpath function", "_wsplitpath function", "tsplitpath function", "path names", "_tsplitpath function"]
11-
ms.assetid: 32bd76b5-1385-4ee8-a64c-abcb541cd2e4
1211
---
1312
# `_splitpath`, `_wsplitpath`
1413

15-
Break a path name into components. More secure versions of these functions are available, see [`_splitpath_s`, `_wsplitpath_s`](splitpath-s-wsplitpath-s.md).
14+
Break a path into components. For more secure versions of these functions are available, see [`_splitpath_s`, `_wsplitpath_s`](splitpath-s-wsplitpath-s.md).
1615

1716
## Syntax
1817

@@ -42,19 +41,19 @@ Full path.
4241
Drive letter, followed by a colon (**:**). You can pass `NULL` for this parameter if you don't need the drive letter.
4342

4443
*`dir`*\
45-
Directory path, including trailing slash. Forward slashes ( **/** ), backslashes ( **\\** ), or both may be used. You can pass `NULL` for this parameter if you don't need the directory path.
44+
Directory path, including trailing slash. Forward slashes ( `/` ), backslashes ( `\` ), or both may be used. Pass `NULL` for this parameter if you don't need the directory path.
4645

4746
*`fname`*\
48-
Base filename (no extension). You can pass `NULL` for this parameter if you don't need the filename.
47+
Base filename (no extension). Pass `NULL` for this parameter if you don't need the filename.
4948

5049
*`ext`*\
51-
Filename extension, including leading period (**.**). You can pass `NULL` for this parameter if you don't need the filename extension.
50+
Filename extension, including leading period (`.`). Pass `NULL` for this parameter if you don't need the filename extension.
5251

5352
## Remarks
5453

5554
The **`_splitpath`** function breaks a path into its four components. **`_splitpath`** automatically handles multibyte-character string arguments as appropriate, recognizing multibyte-character sequences according to the multibyte code page currently in use. **`_wsplitpath`** is a wide-character version of **`_splitpath`**; the arguments to **`_wsplitpath`** are wide-character strings. These functions behave identically otherwise.
5655

57-
**Security Note** These functions incur a potential threat brought about by a buffer overrun problem. Buffer overrun problems are a frequent method of system attack, resulting in an unwarranted elevation of privilege. For more information, see [Avoiding buffer overruns](/windows/win32/SecBP/avoiding-buffer-overruns). More secure versions of these functions are available; see [`_splitpath_s`, `_wsplitpath_s`](splitpath-s-wsplitpath-s.md).
56+
**Security Note** These functions are subject to buffer overrun. Buffer overrun problems are a frequent method of system attack, resulting in an unwarranted elevation of privilege. For more information, see [Avoiding buffer overruns](/windows/win32/SecBP/avoiding-buffer-overruns). More secure versions of these functions are available; see [`_splitpath_s`, `_wsplitpath_s`](splitpath-s-wsplitpath-s.md).
5857

5958
By default, this function's global state is scoped to the application. To change this behavior, see [Global state in the CRT](../global-state.md).
6059

@@ -81,7 +80,7 @@ If the full path doesn't contain a component (for example, a filename), **`_spli
8180

8281
You can pass `NULL` to **`_splitpath`** for any parameter other than *`path`* that you don't need.
8382

84-
If *`path`* is `NULL`, the invalid parameter handler is invoked, as described in [Parameter validation](../parameter-validation.md). If execution is allowed to continue, `errno` is set to `EINVAL` and the function returns `EINVAL`.
83+
If *`path`* is `NULL`, the invalid parameter handler is invoked, as described in [Parameter validation](../parameter-validation.md). If execution is allowed to continue, `errno` is set to `EINVAL`.
8584

8685
## Requirements
8786

0 commit comments

Comments
 (0)