* [PATCH] sandbox: disable tracing before unmapping RAM
@ 2023-04-12 18:55 Pavel Skripkin
2023-04-19 1:45 ` Simon Glass
0 siblings, 1 reply; 7+ messages in thread
From: Pavel Skripkin @ 2023-04-12 18:55 UTC (permalink / raw)
To: sjg, xypron.glpk, u-boot; +Cc: Pavel Skripkin
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 <paskripkin@gmail.com>
---
arch/sandbox/cpu/state.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index 69da378ab5..d8d5da25b1 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -10,6 +10,7 @@
#include <fdtdec.h>
#include <log.h>
#include <os.h>
+#include <trace.h>
#include <asm/malloc.h>
#include <asm/state.h>
#include <asm/test.h>
@@ -525,6 +526,9 @@ int state_uninit(void)
if (state->jumped_fname)
os_unlink(state->jumped_fname);
+ /* Disable tracing before unmapping RAM */
+ trace_set_enabled(0);
+
os_free(state->state_fdt);
os_free(state->ram_buf);
memset(state, '\0', sizeof(*state));
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] sandbox: disable tracing before unmapping RAM
2023-04-12 18:55 [PATCH] sandbox: disable tracing before unmapping RAM Pavel Skripkin
@ 2023-04-19 1:45 ` Simon Glass
2023-04-25 13:43 ` Pavel Skripkin
0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2023-04-19 1:45 UTC (permalink / raw)
To: Pavel Skripkin; +Cc: xypron.glpk, u-boot
On Wed, 12 Apr 2023 at 12:55, Pavel Skripkin <paskripkin@gmail.com> wrote:
>
> 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 <paskripkin@gmail.com>
> ---
> arch/sandbox/cpu/state.c | 4 ++++
> 1 file changed, 4 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sandbox: disable tracing before unmapping RAM
2023-04-19 1:45 ` Simon Glass
@ 2023-04-25 13:43 ` Pavel Skripkin
2023-04-25 13:59 ` Tom Rini
0 siblings, 1 reply; 7+ messages in thread
From: Pavel Skripkin @ 2023-04-25 13:43 UTC (permalink / raw)
To: trini; +Cc: xypron.glpk, u-boot, Simon Glass
Hi Simon,
Simon Glass <sjg@chromium.org> says:
> On Wed, 12 Apr 2023 at 12:55, Pavel Skripkin <paskripkin@gmail.com> wrote:
>>
>> 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 <paskripkin@gmail.com>
>> ---
>> arch/sandbox/cpu/state.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Thank you for review!
+Tom, I guess?
@Tom, could you, please, pick following patch?
https://lists.denx.de/pipermail/u-boot/2023-April/515192.html
With regards,
Pavel Skripkin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sandbox: disable tracing before unmapping RAM
2023-04-25 13:43 ` Pavel Skripkin
@ 2023-04-25 13:59 ` Tom Rini
2023-04-25 14:00 ` Pavel Skripkin
0 siblings, 1 reply; 7+ messages in thread
From: Tom Rini @ 2023-04-25 13:59 UTC (permalink / raw)
To: Pavel Skripkin; +Cc: xypron.glpk, u-boot, Simon Glass
[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]
On Tue, Apr 25, 2023 at 04:43:19PM +0300, Pavel Skripkin wrote:
> Hi Simon,
>
> Simon Glass <sjg@chromium.org> says:
> > On Wed, 12 Apr 2023 at 12:55, Pavel Skripkin <paskripkin@gmail.com> wrote:
> > >
> > > 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 <paskripkin@gmail.com>
> > > ---
> > > arch/sandbox/cpu/state.c | 4 ++++
> > > 1 file changed, 4 insertions(+)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Thank you for review!
>
> +Tom, I guess?
>
> @Tom, could you, please, pick following patch?
>
>
> https://lists.denx.de/pipermail/u-boot/2023-April/515192.html
Simon takes sandbox patches himself and I've assigned this to him in
patchwork, thanks for submitting the patch.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sandbox: disable tracing before unmapping RAM
2023-04-25 13:59 ` Tom Rini
@ 2023-04-25 14:00 ` Pavel Skripkin
2023-04-28 19:20 ` Simon Glass
0 siblings, 1 reply; 7+ messages in thread
From: Pavel Skripkin @ 2023-04-25 14:00 UTC (permalink / raw)
To: Tom Rini; +Cc: xypron.glpk, u-boot, Simon Glass
Hi Tom,
Tom Rini <trini@konsulko.com> says:
> Simon takes sandbox patches himself and I've assigned this to him in
> patchwork, thanks for submitting the patch.
>
Ah, sorry for noise then. I am just unfamiliar with u-boot development
process.
Thank you!
With regards,
Pavel Skripkin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sandbox: disable tracing before unmapping RAM
2023-04-25 14:00 ` Pavel Skripkin
@ 2023-04-28 19:20 ` Simon Glass
2023-04-28 19:21 ` Simon Glass
0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2023-04-28 19:20 UTC (permalink / raw)
To: Pavel Skripkin; +Cc: xypron.glpk, u-boot, Simon Glass, Tom Rini
Hi Tom,
Tom Rini <trini@konsulko.com> says:
> Simon takes sandbox patches himself and I've assigned this to him in
> patchwork, thanks for submitting the patch.
>
Ah, sorry for noise then. I am just unfamiliar with u-boot development
process.
Thank you!
With regards,
Pavel Skripkin
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sandbox: disable tracing before unmapping RAM
2023-04-28 19:20 ` Simon Glass
@ 2023-04-28 19:21 ` Simon Glass
0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2023-04-28 19:21 UTC (permalink / raw)
To: Pavel Skripkin; +Cc: xypron.glpk, u-boot, Tom Rini
Hi Pavel,
On Fri, 28 Apr 2023 at 13:20, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Tom,
>
> Tom Rini <trini@konsulko.com> says:
> > Simon takes sandbox patches himself and I've assigned this to him in
> > patchwork, thanks for submitting the patch.
> >
>
> Ah, sorry for noise then. I am just unfamiliar with u-boot development
> process.
>
> Thank you!
Note, I had to add a check for tracing being enabled, to avoid build errors.
Regards,
SImon
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-04-28 19:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-12 18:55 [PATCH] sandbox: disable tracing before unmapping RAM Pavel Skripkin
2023-04-19 1:45 ` Simon Glass
2023-04-25 13:43 ` Pavel Skripkin
2023-04-25 13:59 ` Tom Rini
2023-04-25 14:00 ` Pavel Skripkin
2023-04-28 19:20 ` Simon Glass
2023-04-28 19:21 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox