[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1363661587.3937.360.camel@deadeye.wl.decadent.org.uk>
Date: Tue, 19 Mar 2013 02:53:07 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
kernel-team@...ts.ubuntu.com, Kees Cook <keescook@...omium.org>,
halfdog <me@...fdog.net>, P J P <ppandit@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Luis Henriques <luis.henriques@...onical.com>
Subject: Re: [PATCH 42/88] exec: use -ELOOP for max recursion depth
On Thu, 2013-03-14 at 10:35 +0000, Luis Henriques wrote:
> 3.5.7.8 -stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Kees Cook <keescook@...omium.org>
>
> commit d740269867021faf4ce38a449353d2b986c34a67 upstream.
>
> To avoid an explosion of request_module calls on a chain of abusive
> scripts, fail maximum recursion with -ELOOP instead of -ENOEXEC. As soon
> as maximum recursion depth is hit, the error will fail all the way back
> up the chain, aborting immediately.
>
> This also has the side-effect of stopping the user's shell from attempting
> to reexecute the top-level file as a shell script. As seen in the
> dash source:
>
> if (cmd != path_bshell && errno == ENOEXEC) {
> *argv-- = cmd;
> *argv = cmd = path_bshell;
> goto repeat;
> }
>
> The above logic was designed for running scripts automatically that lacked
> the "#!" header, not to re-try failed recursion. On a legitimate -ENOEXEC,
> things continue to behave as the shell expects.
>
> Additionally, when tracking recursion, the binfmt handlers should not be
> involved. The recursion being tracked is the depth of calls through
> search_binary_handler(), so that function should be exclusively responsible
> for tracking the depth.
>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> Cc: halfdog <me@...fdog.net>
> Cc: P J P <ppandit@...hat.com>
> Cc: Alexander Viro <viro@...iv.linux.org.uk>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
> [ luis: backport to 3.5 ]
> Signed-off-by: Luis Henriques <luis.henriques@...onical.com>
[...]
Greg, I also included this in 3.2.y (commit 511d07b) but it is missing
from 3.0.y and 3.4.y. I hope one or other of these backports will be
suitable for them (it was just a context fix for 3.2.y).
Ben.
--
Ben Hutchings
When you say `I wrote a program that crashed Windows', people just stare ...
and say `Hey, I got those with the system, *for free*'. - Linus Torvalds
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists