From 0c58583ba8b2febb07722494b96991741ddc7087 Mon Sep 17 00:00:00 2001 From: Will Harris Date: Fri, 26 Jun 2020 14:02:24 -0700 Subject: [PATCH] Add support for __declspec(nocf). __declspec(nocf) syntax was added in https://reviews.llvm.org/D72167 and annotates that checks should not be added on indirect calls within that function. BUG=chromium:584575 Change-Id: Ib2e2d2a827186a9c1fd3de15356b2b04d6a69e49 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2270707 Reviewed-by: Clemens Backes Commit-Queue: Will Harris Cr-Commit-Position: refs/heads/master@{#68590} --- src/base/macros.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/base/macros.h b/src/base/macros.h index 4eb652cae5..5dd52b18ae 100644 --- a/src/base/macros.h +++ b/src/base/macros.h @@ -176,7 +176,14 @@ V8_INLINE Dest bit_cast(Source const& source) { // DISABLE_CFI_ICALL -- Disable Control Flow Integrity indirect call checks, // useful because calls into JITed code can not be CFI verified. +#ifdef V8_OS_WIN +// On Windows, also needs __declspec(guard(nocf)) for CFG. +#define DISABLE_CFI_ICALL \ + V8_CLANG_NO_SANITIZE("cfi-icall") \ + __declspec(guard(nocf)) +#else #define DISABLE_CFI_ICALL V8_CLANG_NO_SANITIZE("cfi-icall") +#endif #if V8_CC_GNU #define V8_IMMEDIATE_CRASH() __builtin_trap()