You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2021/11/02 20:02:53 UTC
[incubator-nuttx] 01/03: sim: fix sim runtime err under sanitize
check mode.
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit c82a67663038ca9a1b47d46639995d74f3e5514c
Author: mage1 <ma...@xiaomi.com>
AuthorDate: Wed Mar 17 15:41:18 2021 +0800
sim: fix sim runtime err under sanitize check mode.
since gcc sanitize can not stub proper code in nuttx kernel code.
---
arch/sim/src/sim/up_initialstate.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/sim/src/sim/up_initialstate.c b/arch/sim/src/sim/up_initialstate.c
index 1b11ebb..eba0bd1 100644
--- a/arch/sim/src/sim/up_initialstate.c
+++ b/arch/sim/src/sim/up_initialstate.c
@@ -26,6 +26,9 @@
#include <stdint.h>
#include <string.h>
+#ifdef CONFIG_SIM_ASAN
+#include <sanitizer/asan_interface.h>
+#endif
#include <nuttx/arch.h>
@@ -83,4 +86,7 @@ void up_initial_state(struct tcb_s *tcb)
tcb->adj_stack_size -
sizeof(xcpt_reg_t);
tcb->xcp.regs[JB_PC] = (xcpt_reg_t)tcb->start;
+#ifdef CONFIG_SIM_ASAN
+ __asan_unpoison_memory_region(tcb->stack_alloc_ptr, tcb->adj_stack_size);
+#endif
}