[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1196618901.5698.23.camel@odie.local>
Date: Sun, 02 Dec 2007 19:08:21 +0100
From: Simon Holm Thøgersen <odie@...aau.dk>
To: Oleg Nesterov <oleg@...sign.ru>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Davide Libenzi <davidel@...ilserver.org>,
Ingo Molnar <mingo@...e.hu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Roland McGrath <roland@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/2] fix the long standing exec vs kill race
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists