All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] sandbox: don't set SA_NODEFER in signal handler
@ 2021-07-05 17:43 Heinrich Schuchardt
  2021-07-07 17:37 ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2021-07-05 17:43 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot, Heinrich Schuchardt

The sandbox can handle signals. Due to a damaged global data pointer
additional exceptions in the signal handler may occur leading to an endless
loop. In this case leave the handling of the secondary exception to the
operating system.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 arch/sandbox/cpu/os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 0d21827e1b..9a73ae3b18 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -226,7 +226,7 @@ int os_setup_signal_handlers(void)

 	act.sa_sigaction = os_signal_handler;
 	sigemptyset(&act.sa_mask);
-	act.sa_flags = SA_SIGINFO | SA_NODEFER;
+	act.sa_flags = SA_SIGINFO;
 	if (sigaction(SIGILL, &act, NULL) ||
 	    sigaction(SIGBUS, &act, NULL) ||
 	    sigaction(SIGSEGV, &act, NULL))
--
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] sandbox: don't set SA_NODEFER in signal handler
  2021-07-05 17:43 [PATCH 1/1] sandbox: don't set SA_NODEFER in signal handler Heinrich Schuchardt
@ 2021-07-07 17:37 ` Simon Glass
  2021-07-17 21:41   ` Simon Glass
  2021-07-22  2:12   ` Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-07 17:37 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: U-Boot Mailing List

Hi Heinrich,

On Mon, 5 Jul 2021 at 11:43, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> The sandbox can handle signals. Due to a damaged global data pointer
> additional exceptions in the signal handler may occur leading to an endless
> loop. In this case leave the handling of the secondary exception to the
> operating system.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  arch/sandbox/cpu/os.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I'm OK with this since it doesn't actually matter, now that the
signal-catching behaviour is optional.

But as I understand it, it will mean that the second exception is
reported, but not the first? In other words, any core dump will be
'incorrect' in that it is not suitable for postmortem debugging.

>
> diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
> index 0d21827e1b..9a73ae3b18 100644
> --- a/arch/sandbox/cpu/os.c
> +++ b/arch/sandbox/cpu/os.c
> @@ -226,7 +226,7 @@ int os_setup_signal_handlers(void)
>
>         act.sa_sigaction = os_signal_handler;
>         sigemptyset(&act.sa_mask);
> -       act.sa_flags = SA_SIGINFO | SA_NODEFER;
> +       act.sa_flags = SA_SIGINFO;
>         if (sigaction(SIGILL, &act, NULL) ||
>             sigaction(SIGBUS, &act, NULL) ||
>             sigaction(SIGSEGV, &act, NULL))
> --
> 2.30.2
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] sandbox: don't set SA_NODEFER in signal handler
  2021-07-07 17:37 ` Simon Glass
@ 2021-07-17 21:41   ` Simon Glass
  2021-07-22  2:12   ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-17 21:41 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: U-Boot Mailing List

Hi Heinrich,

On Wed, 7 Jul 2021 at 11:37, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Heinrich,
>
> On Mon, 5 Jul 2021 at 11:43, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > The sandbox can handle signals. Due to a damaged global data pointer
> > additional exceptions in the signal handler may occur leading to an endless
> > loop. In this case leave the handling of the secondary exception to the
> > operating system.
> >
> > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > ---
> >  arch/sandbox/cpu/os.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> I'm OK with this since it doesn't actually matter, now that the
> signal-catching behaviour is optional.
>
> But as I understand it, it will mean that the second exception is
> reported, but not the first? In other words, any core dump will be
> 'incorrect' in that it is not suitable for postmortem debugging.

I tested this by:

- setting sandbox's 'state' pointer to NULL in the 'md' command
- dropping state = &main_state from state_uninit
- running it and typing 'md'

This causes a recursive crash without your patch. With your patch it
is not recursive.

So I think it makes the -S option work better.

Reviewed-by: Simon Glass <sjg@chromium.org>

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] sandbox: don't set SA_NODEFER in signal handler
  2021-07-07 17:37 ` Simon Glass
  2021-07-17 21:41   ` Simon Glass
@ 2021-07-22  2:12   ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-22  2:12 UTC (permalink / raw)
  To: Simon Glass; +Cc: U-Boot Mailing List, Heinrich Schuchardt

Hi Heinrich,

On Wed, 7 Jul 2021 at 11:37, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Heinrich,
>
> On Mon, 5 Jul 2021 at 11:43, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > The sandbox can handle signals. Due to a damaged global data pointer
> > additional exceptions in the signal handler may occur leading to an endless
> > loop. In this case leave the handling of the secondary exception to the
> > operating system.
> >
> > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > ---
> >  arch/sandbox/cpu/os.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> I'm OK with this since it doesn't actually matter, now that the
> signal-catching behaviour is optional.
>
> But as I understand it, it will mean that the second exception is
> reported, but not the first? In other words, any core dump will be
> 'incorrect' in that it is not suitable for postmortem debugging.

I tested this by:

- setting sandbox's 'state' pointer to NULL in the 'md' command
- dropping state = &main_state from state_uninit
- running it and typing 'md'

This causes a recursive crash without your patch. With your patch it
is not recursive.

So I think it makes the -S option work better.

Reviewed-by: Simon Glass <sjg@chromium.org>

Regards,
Simon

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-22  2:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 17:43 [PATCH 1/1] sandbox: don't set SA_NODEFER in signal handler Heinrich Schuchardt
2021-07-07 17:37 ` Simon Glass
2021-07-17 21:41   ` Simon Glass
2021-07-22  2:12   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.