nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx] branch master updated: arch/stack: fix check stack breakage
Date Mon, 18 May 2020 13:27:23 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 86a412d  arch/stack: fix check stack breakage
86a412d is described below

commit 86a412d65a52d51fa561b34fa9c70047a1656cb5
Author: chao.an <anchao@xiaomi.com>
AuthorDate: Mon May 18 15:41:59 2020 +0800

    arch/stack: fix check stack breakage
    
    remove the TLS alignment check
    
    Regression by:
    
    --------------------------------------------------------
    commit a6da3c2cb6a214b642fa09c48638f1442fdf9117
    Author: Ouss4 <abdelatif.guettouche@gmail.com>
    Date:   Thu May 7 18:50:07 2020 +0100
    
        arch/*/*_checkstack.c: Get aligned address only when
        CONFIG_TLS_ALIGNED is enabled.
    
    --------------------------------------------------------
    commit c2244a2382cf9c62937cc558cc947fae9f211b81
    Author: Gregory Nutt <gnutt@nuttx.org>
    Date:   Thu May 7 09:46:47 2020 -0600
    
        Remove CONFIG_TLS
    
        A first step in implementing the user-space error is
        force TLS to be enabled at all times.  It is no longer optional
    
    Signed-off-by: chao.an <anchao@xiaomi.com>
---
 arch/arm/src/common/arm_checkstack.c       |  7 ++-----
 arch/or1k/src/common/up_checkstack.c       |  7 ++-----
 arch/risc-v/src/common/riscv_checkstack.c  |  7 ++-----
 arch/sim/src/sim/up_checkstack.c           |  8 +++-----
 arch/xtensa/src/common/xtensa_checkstack.c | 12 ++++--------
 5 files changed, 13 insertions(+), 28 deletions(-)

diff --git a/arch/arm/src/common/arm_checkstack.c b/arch/arm/src/common/arm_checkstack.c
index ebdab95..61faad4 100644
--- a/arch/arm/src/common/arm_checkstack.c
+++ b/arch/arm/src/common/arm_checkstack.c
@@ -92,22 +92,19 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
-#ifdef CONFIG_TLS_ALIGNED
   if (!int_stack)
     {
       /* Skip over the TLS data structure at the bottom of the stack */
 
+#ifdef CONFIG_TLS_ALIGNED
       DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
+#endif
       start = alloc + sizeof(struct tls_info_s);
     }
   else
     {
       start = alloc & ~3;
     }
-#else
-  UNUSED(int_stack);
-  start = alloc & ~3;
-#endif
 
   end   = (alloc + size + 3) & ~3;
 
diff --git a/arch/or1k/src/common/up_checkstack.c b/arch/or1k/src/common/up_checkstack.c
index e6f4cd9..aa499a8 100644
--- a/arch/or1k/src/common/up_checkstack.c
+++ b/arch/or1k/src/common/up_checkstack.c
@@ -97,22 +97,19 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
-#ifdef CONFIG_TLS_ALIGNED
   if (!int_stack)
     {
       /* Skip over the TLS data structure at the bottom of the stack */
 
+#ifdef CONFIG_TLS_ALIGNED
       DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
+#endif
       start = alloc + sizeof(struct tls_info_s);
     }
   else
     {
       start = alloc & ~3;
     }
-#else
-  UNUSED(int_stack);
-  start = alloc & ~3;
-#endif
 
   end   = (alloc + size + 3) & ~3;
 
diff --git a/arch/risc-v/src/common/riscv_checkstack.c b/arch/risc-v/src/common/riscv_checkstack.c
index a8f28fa..dcc50d5 100644
--- a/arch/risc-v/src/common/riscv_checkstack.c
+++ b/arch/risc-v/src/common/riscv_checkstack.c
@@ -91,22 +91,19 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
-#ifdef CONFIG_TLS_ALIGNED
   if (!int_stack)
     {
       /* Skip over the TLS data structure at the bottom of the stack */
 
+#ifdef CONFIG_TLS_ALIGNED
       DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
+#endif
       start = alloc + sizeof(struct tls_info_s);
     }
   else
     {
       start = alloc & ~3;
     }
-#else
-  UNUSED(int_stack);
-  start = alloc & ~3;
-#endif
 
   end   = (alloc + size + 3) & ~3;
 
diff --git a/arch/sim/src/sim/up_checkstack.c b/arch/sim/src/sim/up_checkstack.c
index 955ea6b..8d276e9 100644
--- a/arch/sim/src/sim/up_checkstack.c
+++ b/arch/sim/src/sim/up_checkstack.c
@@ -89,22 +89,20 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
-#ifdef CONFIG_TLS_ALIGNED
   if (!int_stack)
     {
       /* Skip over the TLS data structure at the bottom of the stack */
 
+#ifdef CONFIG_TLS_ALIGNED
       DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
+#endif
       start = alloc + sizeof(struct tls_info_s);
     }
   else
     {
       start = alloc & ~3;
     }
-#else
-  UNUSED(int_stack);
-  start = alloc & ~3;
-#endif
+
   end   = (alloc + size + 3) & ~3;
 
   /* Get the adjusted size based on the top and bottom of the stack */
diff --git a/arch/xtensa/src/common/xtensa_checkstack.c b/arch/xtensa/src/common/xtensa_checkstack.c
index cbac16a..8a177cc 100644
--- a/arch/xtensa/src/common/xtensa_checkstack.c
+++ b/arch/xtensa/src/common/xtensa_checkstack.c
@@ -89,18 +89,14 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
       return 0;
     }
 
-  /* Get aligned addresses of the top and bottom of the stack */
+  /* Get aligned addresses of the top and bottom of the stack
+   * Skip over the TLS data structure at the bottom of the stack
+   */
 
 #ifdef CONFIG_TLS_ALIGNED
-
-  /* Skip over the TLS data structure at the bottom of the stack */
-
   DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
-  start = alloc + sizeof(struct tls_info_s);
-#else
-  start = alloc & ~3;
 #endif
-
+  start = alloc + sizeof(struct tls_info_s);
   end   = (alloc + size + 3) & ~3;
 
   /* Get the adjusted size based on the top and bottom of the stack */


Mime
View raw message