All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stotland, Inga <inga.stotland@intel.com>
To: ell@lists.01.org
Subject: Re: [PATCH] main: Add handler for SIGSEGV signal
Date: Tue, 26 Jan 2021 23:46:57 +0000	[thread overview]
Message-ID: <fb1a8ad92aa6c9b5b8a5bae819882cecc2e1a577.camel@intel.com> (raw)
In-Reply-To: <B16AD30C-C72C-4E20-A1D5-9BDC126598E1@holtmann.org>

[-- Attachment #1: Type: text/plain, Size: 1742 bytes --]

Hi Marcel,

On Tue, 2021-01-26 at 10:02 +0100, Marcel Holtmann wrote:

Hi Inga,


When an ell main loop based process is spun off as a child

and the parent process dies due to a segfault, the child process

is still left running and needs to detect the segfault condition.

To address this need, add watch and signal handler for SIGSEGV.

---

ell/main.c | 11 +++++++++++

1 file changed, 11 insertions(+)


diff --git a/ell/main.c b/ell/main.c

index a479b74..712cfb7 100644

--- a/ell/main.c

+++ b/ell/main.c

@@ -619,6 +619,14 @@ static void sigterm_handler(void *user_data)

                data->callback(SIGTERM, data->user_data);

}


+static void sigsegv_handler(void *user_data)

+{

+       struct signal_data *data = user_data;

+

+       if (data->callback)

+               data->callback(SIGSEGV, data->user_data);

+}

+


actually this is not enough. I never included SIGSEGV here for the simple reason since you have to do a lot of work when that signal happens.


What we need to do is to add proper child spawning handling that does all the nasty signal handling for you. Otherwise you are just about to create zombies. For now if you need child handling, then add your own signal handler instead trying to overload l_main_run_with_signal with it.


I don't disagree that this is not enough.

However, this is the easiest way I could come up that allows a child to detect a parent process crash.

Not very elegant as I had to add prctl() call to the child (but only in testing mode, so should not be awful).


Do you have better suggestions on to how to catch a segfault originating in another process without modifying ell?


Best regards,

Inga

[-- Attachment #2: attachment.htm --]
[-- Type: text/html, Size: 2620 bytes --]

  reply	other threads:[~2021-01-26 23:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 22:31 [PATCH] main: Add handler for SIGSEGV signal Inga Stotland
2021-01-26  0:35 ` Denis Kenzior
2021-01-26  9:02 ` Marcel Holtmann
2021-01-26 23:46   ` Stotland, Inga [this message]
2021-01-27 17:53   ` Stotland, Inga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb1a8ad92aa6c9b5b8a5bae819882cecc2e1a577.camel@intel.com \
    --to=inga.stotland@intel.com \
    --cc=ell@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.