arch/assert: flush the syslog before stack dump

flush the syslog before stack dump to avoid buffer overwrite

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2021-12-15 19:40:52 +08:00
committed by Xiang Xiao
parent ed1e4ddfa7
commit b11833cbba
22 changed files with 107 additions and 8 deletions
+5
View File
@@ -31,6 +31,7 @@
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/syslog/syslog.h>
#include <arch/board/board.h>
#include "sched/sched.h"
@@ -50,6 +51,10 @@ static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack;
/* Flush any buffered SYSLOG data to avoid overwrite */
syslog_flush();
for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
@@ -31,6 +31,7 @@
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/syslog/syslog.h>
#include <arch/board/board.h>
#include "sched/sched.h"
@@ -50,6 +51,10 @@ static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack;
/* Flush any buffered SYSLOG data to avoid overwrite */
syslog_flush();
for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
{
uint32_t *ptr = (uint32_t *) stack;