From: ebiederm@xmission.com (Eric W. Biederman)
To: Ivan Delalande <colona@arista.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Dmitry Safonov <0x7f454c46@gmail.com>,
Oleg Nesterov <oleg@redhat.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH v2] exec: don't force_sigsegv processes with a pending fatal signal
Date: Thu, 07 Feb 2019 23:13:59 -0600 [thread overview]
Message-ID: <87pns2q2ug.fsf@xmission.com> (raw)
In-Reply-To: <20190206031029.GB9368@visor> (Ivan Delalande's message of "Tue, 5 Feb 2019 19:10:29 -0800")
Ivan Delalande <colona@arista.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@arista.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);
next prev parent reply other threads:[~2019-02-08 5:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-05 2:53 [PATCH v2] exec: don't force_sigsegv processes with a pending fatal signal Ivan Delalande
2019-02-05 21:11 ` Andrew Morton
2019-02-06 3:10 ` Ivan Delalande
2019-02-08 5:13 ` Eric W. Biederman [this message]
2019-02-09 0:16 ` Ivan Delalande
2019-02-10 17:05 ` Eric W. Biederman
2019-02-11 23:25 ` Ivan Delalande
2019-02-11 16:02 ` Oleg Nesterov
2019-02-11 17:12 ` Oleg Nesterov
2019-02-11 23:20 ` Ivan Delalande
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=87pns2q2ug.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=0x7f454c46@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=colona@arista.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=oleg@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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).