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:33 UTC

[incubator-nuttx] branch master updated (1b04bfae20 -> 28872ca3ed)

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

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


    from 1b04bfae20 sched: Remove the unnecessary weak_function
     new 7e316d0ba9 compiler.h: Add a new attribute nosanitize_undefined
     new 28872ca3ed libc: Fix wrong report from UBSan

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 include/nuttx/compiler.h          | 8 ++++++++
 libs/libc/symtab/symtab_allsyms.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)


[incubator-nuttx] 02/02: libc: Fix wrong report from UBSan

Posted by xi...@apache.org.
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 28872ca3edbc5237917e8c25a172fc80edf14b64
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Tue Aug 30 08:23:13 2022 +0000

    libc: Fix wrong report from UBSan
    
    ```
    ubsan_prologue: ================================================================================
    ubsan_prologue: UBSAN: array-index-out-of-bounds in symtab/symtab_allsyms.c:62:37
    __ubsan_handle_out_of_bounds: index 1619 is out of range for type 'symtab_s [1]'
    ubsan_epilogue: ================================================================================
    ```
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 libs/libc/symtab/symtab_allsyms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/libc/symtab/symtab_allsyms.c b/libs/libc/symtab/symtab_allsyms.c
index 021528ea25..eb34ec1c80 100644
--- a/libs/libc/symtab/symtab_allsyms.c
+++ b/libs/libc/symtab/symtab_allsyms.c
@@ -28,7 +28,7 @@
  * Public Data
  ****************************************************************************/
 
-extern const struct symtab_s g_allsyms[1];
+extern const struct symtab_s g_allsyms[];
 extern const int             g_nallsyms;
 
 /****************************************************************************


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

Posted by xi...@apache.org.
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