[Openvpn-devel,v2] BUILD: enable CFG and Spectre mitigation for MSVC

Message ID 20210922095756.1929-1-chipitsine@gmail.com
State Accepted
Headers show
Series [Openvpn-devel,v2] BUILD: enable CFG and Spectre mitigation for MSVC | expand

Commit Message

Ilya Shipitsin Sept. 21, 2021, 11:57 p.m. UTC
found by BinSkim

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
---
 src/compat/Release.props                    | 1 +
 src/compat/compat.vcxproj                   | 6 ++++++
 src/openvpn/openvpn.vcxproj                 | 9 +++++++++
 src/openvpnmsica/openvpnmsica-Release.props | 1 +
 src/openvpnmsica/openvpnmsica.vcxproj       | 6 ++++++
 src/openvpnserv/openvpnserv.vcxproj         | 6 ++++++
 src/tapctl/tapctl.vcxproj                   | 6 ++++++
 7 files changed, 35 insertions(+)

Comments

Lev Stipakov Sept. 23, 2021, 8:41 p.m. UTC | #1
Built and smoke-tested locally.

Acked-by: Lev Stipakov <lstipakov@gmail.com>
Arne Schwabe Sept. 23, 2021, 11:20 p.m. UTC | #2
Am 22.09.21 um 11:57 schrieb Ilya Shipitsin:
> found by BinSkim
> 
Did you do a performance comparison? IN the past some of the Spectre
mitigations have had really hard performance impact.

Arne
Lev Stipakov Sept. 26, 2021, 9:58 p.m. UTC | #3
I didn't, but here

https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/

it says that

"On the MSVC team, we’ve reviewed information in detail and conducted
extensive tests, which showed the performance impact of the new
/Qspectre switch to be negligible."
Gert Doering Sept. 26, 2021, 10:13 p.m. UTC | #4
Your patch has been applied to the master branch.

commit e80e36d75538abff0661b21392f541d946be6d29
Author: Ilya Shipitsin
Date:   Wed Sep 22 14:57:55 2021 +0500

     BUILD: enable CFG and Spectre mitigation for MSVC

     Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
     Acked-by: Lev Stipakov <lstipakov@gmail.com>
     Message-Id: <20210922095756.1929-1-chipitsine@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22870.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
Ilya Shipitsin Sept. 27, 2021, 12:06 a.m. UTC | #5
I'll setup test stand similar to this one
https://community.openvpn.net/openvpn/wiki/PerformanceTestingOpenVPN
hopefully in next 1-2 weeks

I also believe that spectre mitigation is neglectable, but it is good to
have numbers

пн, 27 сент. 2021 г. в 12:58, Lev Stipakov <lstipakov@gmail.com>:

> I didn't, but here
>
> https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/
>
> it says that
>
> "On the MSVC team, we’ve reviewed information in detail and conducted
> extensive tests, which showed the performance impact of the new
> /Qspectre switch to be negligible."
> --
> -Lev
>
<div dir="ltr"><div>I&#39;ll setup test stand similar to this one <a href="https://community.openvpn.net/openvpn/wiki/PerformanceTestingOpenVPN">https://community.openvpn.net/openvpn/wiki/PerformanceTestingOpenVPN</a></div><div>hopefully in next 1-2 weeks</div><div><br></div><div>I also believe that spectre mitigation is neglectable, but it is good to have numbers<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пн, 27 сент. 2021 г. в 12:58, Lev Stipakov &lt;<a href="mailto:lstipakov@gmail.com">lstipakov@gmail.com</a>&gt;:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I didn&#39;t, but here<br>
<br>
<a href="https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/" rel="noreferrer" target="_blank">https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/</a><br>
<br>
it says that<br>
<br>
&quot;On the MSVC team, we’ve reviewed information in detail and conducted<br>
extensive tests, which showed the performance impact of the new<br>
/Qspectre switch to be negligible.&quot;<br>
-- <br>
-Lev<br>
</blockquote></div>
Lev Stipakov Nov. 24, 2021, 3:21 a.m. UTC | #6
Since we're preparing the next 2.5 release, let's take this in. The
performance numbers, reported in different thread, look good.

ma 27. syysk. 2021 klo 13.06 Илья Шипицин (chipitsine@gmail.com) kirjoitti:
>
> I'll setup test stand similar to this one https://community.openvpn.net/openvpn/wiki/PerformanceTestingOpenVPN
> hopefully in next 1-2 weeks
>
> I also believe that spectre mitigation is neglectable, but it is good to have numbers
>
> пн, 27 сент. 2021 г. в 12:58, Lev Stipakov <lstipakov@gmail.com>:
>>
>> I didn't, but here
>>
>> https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/
>>
>> it says that
>>
>> "On the MSVC team, we’ve reviewed information in detail and conducted
>> extensive tests, which showed the performance impact of the new
>> /Qspectre switch to be negligible."
>> --
>> -Lev
Ilya Shipitsin Nov. 24, 2021, 3:31 a.m. UTC | #7
Performance report was delayed due to oversize. It was only delivered to
Lev and Gert.

Thank you Lev for bringing this up:)


Performance was captured by WPT. I'd like to make some similar
investigation if needed (to compare other perf impact)

On Wed, Nov 24, 2021, 7:21 PM Lev Stipakov <lstipakov@gmail.com> wrote:

> Since we're preparing the next 2.5 release, let's take this in. The
> performance numbers, reported in different thread, look good.
>
> ma 27. syysk. 2021 klo 13.06 Илья Шипицин (chipitsine@gmail.com)
> kirjoitti:
> >
> > I'll setup test stand similar to this one
> https://community.openvpn.net/openvpn/wiki/PerformanceTestingOpenVPN
> > hopefully in next 1-2 weeks
> >
> > I also believe that spectre mitigation is neglectable, but it is good to
> have numbers
> >
> > пн, 27 сент. 2021 г. в 12:58, Lev Stipakov <lstipakov@gmail.com>:
> >>
> >> I didn't, but here
> >>
> >> https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/
> >>
> >> it says that
> >>
> >> "On the MSVC team, we’ve reviewed information in detail and conducted
> >> extensive tests, which showed the performance impact of the new
> >> /Qspectre switch to be negligible."
> >> --
> >> -Lev
>
>
>
> --
> -Lev
>
<div dir="auto">Performance report was delayed due to oversize. It was only delivered to Lev and Gert.<div dir="auto"><br></div><div dir="auto">Thank you Lev for bringing this up:)</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Performance was captured by WPT. I&#39;d like to make some similar investigation if needed (to compare other perf impact)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 24, 2021, 7:21 PM Lev Stipakov &lt;<a href="mailto:lstipakov@gmail.com">lstipakov@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Since we&#39;re preparing the next 2.5 release, let&#39;s take this in. The<br>
performance numbers, reported in different thread, look good.<br>
<br>
ma 27. syysk. 2021 klo 13.06 Илья Шипицин (<a href="mailto:chipitsine@gmail.com" target="_blank" rel="noreferrer">chipitsine@gmail.com</a>) kirjoitti:<br>
&gt;<br>
&gt; I&#39;ll setup test stand similar to this one <a href="https://community.openvpn.net/openvpn/wiki/PerformanceTestingOpenVPN" rel="noreferrer noreferrer" target="_blank">https://community.openvpn.net/openvpn/wiki/PerformanceTestingOpenVPN</a><br>
&gt; hopefully in next 1-2 weeks<br>
&gt;<br>
&gt; I also believe that spectre mitigation is neglectable, but it is good to have numbers<br>
&gt;<br>
&gt; пн, 27 сент. 2021 г. в 12:58, Lev Stipakov &lt;<a href="mailto:lstipakov@gmail.com" target="_blank" rel="noreferrer">lstipakov@gmail.com</a>&gt;:<br>
&gt;&gt;<br>
&gt;&gt; I didn&#39;t, but here<br>
&gt;&gt;<br>
&gt;&gt; <a href="https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/" rel="noreferrer noreferrer" target="_blank">https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/</a><br>
&gt;&gt;<br>
&gt;&gt; it says that<br>
&gt;&gt;<br>
&gt;&gt; &quot;On the MSVC team, we’ve reviewed information in detail and conducted<br>
&gt;&gt; extensive tests, which showed the performance impact of the new<br>
&gt;&gt; /Qspectre switch to be negligible.&quot;<br>
&gt;&gt; --<br>
&gt;&gt; -Lev<br>
<br>
<br>
<br>
-- <br>
-Lev<br>
</blockquote></div>
Gert Doering Nov. 24, 2021, 4:40 a.m. UTC | #8
Hi,

On Wed, Nov 24, 2021 at 04:21:38PM +0200, Lev Stipakov wrote:
> Since we're preparing the next 2.5 release, let's take this in. The
> performance numbers, reported in different thread, look good.

Yes, sir!

commit dab73f90983c929645c74f1c1c045e175d5ca2b6 (HEAD -> release/2.5)
Author: Ilya Shipitsin <chipitsine@gmail.com>
Date:   Wed Sep 22 14:57:55 2021 +0500

    BUILD: enable CFG and Spectre mitigation for MSVC
    
    found by BinSkim
    
    Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
    Acked-by: Lev Stipakov <lstipakov@gmail.com>
    Message-Id: <20210922095756.1929-1-chipitsine@gmail.com>
    URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22870.html
    Signed-off-by: Gert Doering <gert@greenie.muc.de>
    (cherry picked from commit e80e36d75538abff0661b21392f541d946be6d29)


... totally untested, but this is all MSVC build stuff, not code change...

gert

Patch

diff --git a/src/compat/Release.props b/src/compat/Release.props
index 63828b79..50eaa8de 100644
--- a/src/compat/Release.props
+++ b/src/compat/Release.props
@@ -15,6 +15,7 @@ 
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ControlFlowGuard>Guard</ControlFlowGuard>
     </ClCompile>
     <Link>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
diff --git a/src/compat/compat.vcxproj b/src/compat/compat.vcxproj
index 49824783..fe03a51a 100644
--- a/src/compat/compat.vcxproj
+++ b/src/compat/compat.vcxproj
@@ -38,33 +38,39 @@ 
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <CharacterSet>MultiByte</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <CharacterSet>MultiByte</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <CharacterSet>MultiByte</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj
index 5b3e0c6c..65ee6839 100644
--- a/src/openvpn/openvpn.vcxproj
+++ b/src/openvpn/openvpn.vcxproj
@@ -38,33 +38,39 @@ 
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>NotSet</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>NotSet</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>NotSet</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>NotSet</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>NotSet</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>NotSet</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
@@ -191,6 +197,7 @@ 
       <WarningLevel>Level2</WarningLevel>
       <TreatWarningAsError>true</TreatWarningAsError>
       <AdditionalIncludeDirectories>..\compat;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ControlFlowGuard>Guard</ControlFlowGuard>
     </ClCompile>
     <ResourceCompile />
     <Link>
@@ -206,6 +213,7 @@ 
       <WarningLevel>Level2</WarningLevel>
       <TreatWarningAsError>true</TreatWarningAsError>
       <AdditionalIncludeDirectories>..\compat;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ControlFlowGuard>Guard</ControlFlowGuard>
     </ClCompile>
     <ResourceCompile />
     <Link>
@@ -221,6 +229,7 @@ 
       <WarningLevel>Level2</WarningLevel>
       <TreatWarningAsError>true</TreatWarningAsError>
       <AdditionalIncludeDirectories>..\compat;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ControlFlowGuard>Guard</ControlFlowGuard>
     </ClCompile>
     <ResourceCompile />
     <Link>
diff --git a/src/openvpnmsica/openvpnmsica-Release.props b/src/openvpnmsica/openvpnmsica-Release.props
index 848fda8f..47727b35 100644
--- a/src/openvpnmsica/openvpnmsica-Release.props
+++ b/src/openvpnmsica/openvpnmsica-Release.props
@@ -8,6 +8,7 @@ 
   <ItemDefinitionGroup>
     <ClCompile>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <ControlFlowGuard>Guard</ControlFlowGuard>
     </ClCompile>
   </ItemDefinitionGroup>
   <ItemGroup />
diff --git a/src/openvpnmsica/openvpnmsica.vcxproj b/src/openvpnmsica/openvpnmsica.vcxproj
index c39b1240..11aa78bb 100644
--- a/src/openvpnmsica/openvpnmsica.vcxproj
+++ b/src/openvpnmsica/openvpnmsica.vcxproj
@@ -40,18 +40,21 @@ 
     <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -60,6 +63,7 @@ 
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -67,6 +71,7 @@ 
     <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -74,6 +79,7 @@ 
     <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
diff --git a/src/openvpnserv/openvpnserv.vcxproj b/src/openvpnserv/openvpnserv.vcxproj
index 8009ab3d..5fd7d60b 100644
--- a/src/openvpnserv/openvpnserv.vcxproj
+++ b/src/openvpnserv/openvpnserv.vcxproj
@@ -38,33 +38,39 @@ 
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
     <PlatformToolset>v142</PlatformToolset>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
diff --git a/src/tapctl/tapctl.vcxproj b/src/tapctl/tapctl.vcxproj
index ad96f02c..79da9d33 100644
--- a/src/tapctl/tapctl.vcxproj
+++ b/src/tapctl/tapctl.vcxproj
@@ -40,18 +40,21 @@ 
     <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
@@ -60,6 +63,7 @@ 
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
@@ -67,6 +71,7 @@ 
     <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
@@ -74,6 +79,7 @@ 
     <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
+    <SpectreMitigation>Spectre</SpectreMitigation>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">