Reviewers: Michael Starzinger, Sven Panne,

Description:
Disable cfi-unrelated-cast sanitizer in OpParameter function.

This function deliberately casts to an unrelated type. This is forbidden under
the cfi-unrelated-cast policy, but it is unclear how to fix the underlying
problem. This change at least unblocks things.

BUG=v8:3809
[email protected],[email protected]

Please review this at https://codereview.chromium.org/1196483003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+12, -0 lines):
  M src/base/macros.h
  M src/compiler/operator.h


Index: src/base/macros.h
diff --git a/src/base/macros.h b/src/base/macros.h
index e98b4f569f2bab5bc91d691293089b12254ce157..2baba262d17ebf408c7828f121eb33e38b0f8ec2 100644
--- a/src/base/macros.h
+++ b/src/base/macros.h
@@ -273,6 +273,16 @@ V8_INLINE Dest bit_cast(Source const& source) {
 #define DISABLE_ASAN
 #endif

+#if defined(__has_attribute)
+#if __has_attribute(no_sanitize)
+#define DISABLE_CFI_UNRELATED_CAST \
+  __attribute__((no_sanitize("cfi-unrelated-cast")))
+#else
+#define DISABLE_CFI_UNRELATED_CAST
+#endif
+#else
+#define DISABLE_CFI_UNRELATED_CAST
+#endif

 #if V8_CC_GNU
 #define V8_IMMEDIATE_CRASH() __builtin_trap()
Index: src/compiler/operator.h
diff --git a/src/compiler/operator.h b/src/compiler/operator.h
index 5b15b9728916dc76aaeea209e0cdefcdf6e511f4..6a12c69d911ff6b7db758c93c570cdbd11cdf3e6 100644
--- a/src/compiler/operator.h
+++ b/src/compiler/operator.h
@@ -9,6 +9,7 @@

 #include "src/base/flags.h"
 #include "src/base/functional.h"
+#include "src/base/macros.h"
 #include "src/zone.h"

 namespace v8 {
@@ -180,6 +181,7 @@ class Operator1 : public Operator {

 // Helper to extract parameters from Operator1<*> operator.
 template <typename T>
+DISABLE_CFI_UNRELATED_CAST
 inline T const& OpParameter(const Operator* op) {
   return reinterpret_cast<const Operator1<T>*>(op)->parameter();
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to