You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/08/30 11:35:34 UTC

[incubator-nuttx] 01/02: compiler.h: Add a new attribute nosanitize_undefined

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 7e316d0ba9c7f9fcd17fcb41b87ad9dbc3c7ca3b
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Tue Aug 30 08:15:58 2022 +0000

    compiler.h: Add a new attribute nosanitize_undefined
    
    This allow us to disable UBSan for particular function.
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 include/nuttx/compiler.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h
index 227ceb488a..bd81d09971 100644
--- a/include/nuttx/compiler.h
+++ b/include/nuttx/compiler.h
@@ -195,6 +195,10 @@
 
 #  define nosanitize_address __attribute__ ((no_sanitize_address))
 
+/* The nosanitize_undefined attribute informs GCC don't sanitize it */
+
+#  define nosanitize_undefined __attribute__((no_sanitize("undefined")))
+
 /* The nostackprotect_function attribute disables stack protection in
  * sensitive functions, e.g., stack coloration routines.
  */
@@ -465,6 +469,7 @@
 #  define noinline_function
 #  define noinstrument_function
 #  define nosanitize_address
+#  define nosanitize_undefined
 #  define nostackprotect_function
 
 #  define unused_code
@@ -597,6 +602,7 @@
 #  define noinline_function
 #  define noinstrument_function
 #  define nosanitize_address
+#  define nosanitize_undefined
 #  define nostackprotect_function
 #  define unused_code
 #  define unused_data
@@ -698,6 +704,7 @@
 #  define noinline_function
 #  define noinstrument_function
 #  define nosanitize_address
+#  define nosanitize_undefined
 #  define nostackprotect_function
 #  define unused_code
 #  define unused_data
@@ -765,6 +772,7 @@
 #  define noinline_function
 #  define noinstrument_function
 #  define nosanitize_address
+#  define nosanitize_undefined
 #  define nostackprotect_function
 #  define unused_code
 #  define unused_data