From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Roland McGrath <roland@redhat.com>,
Chuck Ebbert <cebbert@redhat.com>
Subject: [17/17] execve: make responsive to SIGKILL with large arguments
Date: Fri, 22 Oct 2010 11:39:42 -0700 [thread overview]
Message-ID: <20101022184034.003754079@clark.site> (raw)
In-Reply-To: <20101022184048.GA25391@kroah.com>
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Roland McGrath <roland@redhat.com>
commit 9aea5a65aa7a1af9a4236dfaeb0088f1624f9919 upstream.
An execve with a very large total of argument/environment strings
can take a really long time in the execve system call. It runs
uninterruptibly to count and copy all the strings. This change
makes it abort the exec quickly if sent a SIGKILL.
Note that this is the conservative change, to interrupt only for
SIGKILL, by using fatal_signal_pending(). It would be perfectly
correct semantics to let any signal interrupt the string-copying in
execve, i.e. use signal_pending() instead of fatal_signal_pending().
We'll save that change for later, since it could have user-visible
consequences, such as having a timer set too quickly make it so that
an execve can never complete, though it always happened to work before.
Signed-off-by: Roland McGrath <roland@redhat.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
fs/exec.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -393,6 +393,9 @@ static int count(char __user * __user *
argv++;
if(++i > max)
return -E2BIG;
+
+ if (fatal_signal_pending(current))
+ return -ERESTARTNOHAND;
cond_resched();
}
}
@@ -436,6 +439,10 @@ static int copy_strings(int argc, char _
while (len > 0) {
int offset, bytes_to_copy;
+ if (fatal_signal_pending(current)) {
+ ret = -ERESTARTNOHAND;
+ goto out;
+ }
cond_resched();
offset = pos % PAGE_SIZE;
prev parent reply other threads:[~2010-10-22 18:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-22 18:40 [00/17] 2.6.27.55-stable review Greg KH
2010-10-22 18:39 ` [01/17] aio: check for multiplication overflow in do_io_submit Greg KH
2010-10-22 18:39 ` [02/17] guard page for stacks that grow upwards Greg KH
2010-10-22 18:39 ` [03/17] ALSA: sound/pci/rme9652: prevent reading uninitialized stack memory Greg KH
2010-10-22 18:39 ` [04/17] ALSA: prevent heap corruption in snd_ctl_new() Greg KH
2010-10-22 18:39 ` [05/17] v4l1: fix 32-bit compat microcode loading translation Greg KH
2010-10-22 18:39 ` [06/17] dmaengine: fix interrupt clearing for mv_xor Greg KH
2010-10-22 18:39 ` [07/17] wext: fix potential private ioctl memory content leak Greg KH
2010-10-22 18:39 ` [08/17] atl1: fix resume Greg KH
2010-10-22 18:39 ` [09/17] [SCSI] bsg: fix incorrect device_status value Greg KH
2010-10-22 18:39 ` [10/17] r6040: fix r6040_multicast_list Greg KH
2010-10-22 18:39 ` [11/17] r6040: Fix multicast list iteration when hash filter is used Greg KH
2010-10-22 19:13 ` Jack Stone
2010-10-22 19:23 ` Greg KH
2010-10-22 19:29 ` Jack Stone
2010-10-22 21:18 ` Ben Hutchings
2010-10-22 21:23 ` Jack Stone
2010-10-22 18:39 ` [12/17] powerpc: Initialise paca->kstack before early_setup_secondary Greg KH
2010-10-22 18:39 ` [13/17] powerpc: Dont use kernel stack with translation off Greg KH
2010-10-22 18:39 ` [14/17] b44: fix carrier detection on bind Greg KH
2010-10-22 18:39 ` [15/17] setup_arg_pages: diagnose excessive argument size Greg KH
2010-10-22 18:39 ` [16/17] execve: improve interactivity with large arguments Greg KH
2010-10-22 18:39 ` Greg KH [this message]
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=20101022184034.003754079@clark.site \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=cebbert@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--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