[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pns2q2ug.fsf@xmission.com>
Date: Thu, 07 Feb 2019 23:13:59 -0600
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Ivan Delalande <colona@...sta.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Dmitry Safonov <0x7f454c46@...il.com>,
Oleg Nesterov <oleg@...hat.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH v2] exec: don't force_sigsegv processes with a pending fatal signal
Ivan Delalande <colona@...sta.com> writes:
> On Tue, Feb 05, 2019 at 01:11:19PM -0800, Andrew Morton wrote:
>> On Mon, 4 Feb 2019 18:53:08 -0800 Ivan Delalande <colona@...sta.com> wrote:
>> > --- a/fs/exec.c
>> > +++ b/fs/exec.c
>> > @@ -1660,7 +1660,12 @@ int search_binary_handler(struct linux_binprm *bprm)
>> > if (retval < 0 && !bprm->mm) {
>> > /* we got to flush_old_exec() and failed after it */
>> > read_unlock(&binfmt_lock);
>> > - force_sigsegv(SIGSEGV, current);
>> > + if (!fatal_signal_pending(current)) {
>> > + if (print_fatal_signals)
>> > + pr_info("load_binary() failed: %d\n",
>> > + retval);
>>
>> Should we be using print_fatal_signal() here?
>
> I don't think so, the force_sigsegv() already ensures it will be called
> from get_signal() when the signal is handled, and so the process
> information will be printed then.
>
>> > + force_sigsegv(SIGSEGV, current);
>> > + }
>> > return retval;
>> > }
>> > if (retval != -ENOEXEC || !bprm->file) {
>
I just noticed this. From my patch queue that I intend to send to
Linus tomorrow. I think this change fixes your issue of getting
the SIGSEGV instead of the already pending fatal signal.
So I think this fixes your issue without any other code changes.
Ivan can you verify that the patch below is enough?
diff --git a/kernel/signal.c b/kernel/signal.c
index 9ca8e5278c8e..5424cb0006bc 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2393,6 +2393,11 @@ bool get_signal(struct ksignal *ksig)
goto relock;
}
+ /* Has this task already been marked for death? */
+ ksig->info.si_signo = signr = SIGKILL;
+ if (signal_group_exit(signal))
+ goto fatal;
+
for (;;) {
struct k_sigaction *ka;
@@ -2488,6 +2493,7 @@ bool get_signal(struct ksignal *ksig)
continue;
}
+ fatal:
spin_unlock_irq(&sighand->siglock);
Powered by blists - more mailing lists