linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Simon Holm Thøgersen" <odie@cs.aau.dk>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Davide Libenzi <davidel@xmailserver.org>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] fix the long standing exec vs kill race
Date: Sun, 02 Dec 2007 19:08:21 +0100	[thread overview]
Message-ID: <1196618901.5698.23.camel@odie.local> (raw)
In-Reply-To: <20071202171805.GA14701@tv-sign.ru>


søn, 02 12 2007 kl. 20:18 +0300, skrev Oleg Nesterov:
> On 12/02, Simon Holm Th?gersen wrote:
> > 
> > s??n, 02 12 2007 kl. 18:14 +0300, skrev Oleg Nesterov:
> > > 
> > > Please comment, I think at least the idea is promising.
> > > 
> > I have an issue that sounds related, but I might be completely off. I
> > would expect the simple attached program to keep receiving the same
> > signal, i.e. respond to
> > 	killall signal-exec -s SIGHUP
> > 
> > I tried your patches, but they didn't help.
> > 
> > Any ideas?
> > 
> > 
> > Simon Holm Th??gersen
> 
> > #include <signal.h>
> > #include <stdio.h>
> > #include <unistd.h>
> > 
> > static char **argv_;
> > 
> > static void handler(int signal)
> > {
> > 	printf("got signal %d\n", signal);
> > 	execv(argv_[0], argv_);
> > }
> > 
> > int main(int argc, char *argv[])
> > {
> > 	printf("spawned\n");
> > 	argv_ = argv;
> > 	if (signal(SIGTERM, handler) == SIG_ERR)
> > 		err(1, "could not set signal handler for SIGTERM");
> > 	if (signal(SIGHUP, handler) == SIG_ERR)
> > 		err(1, "could not set signal handler for SIGTERM");
> > 	sleep(60);
> > 	return 0;
> > }
> > 
> 
> I think this is another issue which should be solved (?).
> 
> exec() from the signal handler doesn't do sys_sigreturn(), so we don't unblock
> the signal, and it remains blocked after exec().
> 
> Hmm. Is this linux bug, or application bug?

Good question. I haven't been able to find something in the
documentation for execve(2) and signal(2) saying it shouldn't be
possible, and it works on Solaris 10, so I'd say it is a Linux bug.
Actually, having another look at the documentation, signal(7) mentions
that POSIX.1-2003 requires that execve is safe to call from inside a
signal handler.


Simon Holm Thøgersen


  reply	other threads:[~2007-12-02 18:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-02 15:14 [PATCH 0/2] fix the long standing exec vs kill race Oleg Nesterov
2007-12-02 17:06 ` Simon Holm Thøgersen
2007-12-02 17:18   ` Oleg Nesterov
2007-12-02 18:08     ` Simon Holm Thøgersen [this message]
2007-12-02 18:52       ` Oleg Nesterov
2007-12-02 20:26     ` Linus Torvalds
2007-12-03 16:37 ` Linus Torvalds
2007-12-03 17:41   ` Oleg Nesterov

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=1196618901.5698.23.camel@odie.local \
    --to=odie@cs.aau.dk \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).