From: Pavel Skripkin Date: Wed, 12 Apr 2023 18:55:44 +0000 (+0300) Subject: sandbox: disable tracing before unmapping RAM X-Git-Url: http://git.dujemihanovic.xyz/img/static/gitweb.css?a=commitdiff_plain;h=763f0a1f0d2b3ee0b3f7248dee874c3e65e93345;p=u-boot.git sandbox: disable tracing before unmapping RAM Currently doing 'reset' command in sandbox with tracing enabled causes SIGSEV ``` Hit any key to stop autoboot: 0 => => => reset resetting ... Segmentation fault (core dumped) ``` Tracing callback uses RAM buffer for storing tracing reports, but state_uninit() function unmaps whole RAM, which causes SIGSEV on umapped memory inside tracing subsystem. Fix it by disabling tracing before unmapping memory Signed-off-by: Pavel Skripkin Reviewed-by: Simon Glass Add missing check for CONFIG_TRACE: Signed-off-by: Simon Glass --- diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 69da378ab5..d67834988f 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -525,6 +526,10 @@ int state_uninit(void) if (state->jumped_fname) os_unlink(state->jumped_fname); + /* Disable tracing before unmapping RAM */ + if (IS_ENABLED(CONFIG_TRACE)) + trace_set_enabled(0); + os_free(state->state_fdt); os_free(state->ram_buf); memset(state, '\0', sizeof(*state));