Skip to content

Commit

Permalink
Enable Hardware Enforced Stack Protection in Windows
Browse files Browse the repository at this point in the history
With this commit, both Mozc and Qt executables are build with the
following flag set:

  IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT [1]

This is an optional flag that tells the OS that executables are
compatible with Intel Control Flow Enforcement Technology (CET) [2].

The flag simply ignored on environment where the feature is not
available.  There must be no user observable behavior change.

Closes google#835.

 [1]: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#extended-dll-characteristics
 [2]: https://www.intel.com/content/www/us/en/developer/articles/technical/technical-look-control-flow-enforcement-technology.html

PiperOrigin-RevId: 576253756
  • Loading branch information
yukawa authored and hiroyuki-komatsu committed Oct 24, 2023
1 parent 410834f commit a0133fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/build_tools/build_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ def make_configure_options(args: argparse.Namespace) -> list[str]:
]
elif is_windows():
qt_configure_options += ['-force-debug-info',
'-intelcet',
'-ltcg', # Note: ignored in debug build
'-no-feature-texthtmlparser',
'-no-freetype',
Expand Down
3 changes: 3 additions & 0 deletions src/gyp/common_win.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@
'user32.lib',
'uuid.lib',
],
'AdditionalOptions': [
'/CETCOMPAT',
],
'DataExecutionPrevention': '2', # /NXCOMPAT
'EnableCOMDATFolding': '2', # /OPT:ICF
'GenerateDebugInformation': 'true', # /DEBUG
Expand Down

0 comments on commit a0133fb

Please sign in to comment.