Files
android_kernel_xiaomi_sm8450/include/linux
Kees Cook d740269867 exec: use -ELOOP for max recursion depth
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@chromium.org>
Cc: halfdog <me@halfdog.net>
Cc: P J P <ppandit@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-17 17:15:23 -08:00
..
2012-11-26 10:19:17 -08:00
2012-12-07 17:02:47 +00:00
2012-11-30 12:37:36 +01:00
2012-07-30 17:25:21 -07:00
2012-10-08 13:50:20 +10:30
2012-12-02 00:05:12 +00:00
2012-09-19 19:08:46 -06:00
2012-09-20 14:31:45 +02:00
2012-07-30 17:25:11 -07:00
2012-09-17 15:00:38 -07:00
2012-11-15 00:34:23 +01:00
2012-03-23 16:58:38 -07:00
2012-05-25 12:46:23 +05:30
2012-05-10 12:00:56 +02:00
2012-09-30 18:02:20 -07:00
2012-11-28 11:54:40 +01:00
2012-10-16 18:49:15 -07:00
2012-05-29 23:28:33 -04:00
2012-11-22 13:43:27 +09:00
2012-11-28 21:49:02 -05:00
2012-11-28 21:49:02 -05:00
2012-04-27 10:46:45 +08:00
2012-11-21 10:07:48 +01:00
2012-10-29 21:31:32 +01:00
2012-03-26 21:47:19 +02:00
2012-03-26 21:47:19 +02:00
2012-03-26 21:47:19 +02:00
2012-11-23 12:23:40 +01:00
2012-10-06 03:04:56 +09:00
2012-09-07 14:57:45 -04:00
2012-03-20 12:47:48 +01:00
2012-09-11 10:15:02 +02:00
2012-03-20 12:47:47 +01:00
2012-11-21 15:09:26 -08:00
2012-11-08 11:24:46 -05:00
2012-07-17 09:13:37 -07:00
2012-05-31 17:49:32 -07:00
2012-12-17 17:15:22 -08:00
2012-09-26 13:52:36 -07:00
2012-11-20 16:15:02 +10:00
2012-11-03 14:50:15 -04:00
2012-10-10 01:15:44 -04:00
2012-03-15 21:41:34 +01:00
2012-12-12 17:38:33 -08:00
2012-10-10 20:00:55 +10:30
2012-07-29 21:24:13 +04:00
2012-12-11 17:22:27 -08:00
2012-10-17 15:53:02 -05:00
2012-10-10 22:41:05 -04:00
2012-07-10 10:32:06 -05:00
2012-05-21 14:31:48 +01:00
2012-07-31 18:42:43 -07:00
2012-06-20 14:39:36 -07:00
2012-12-17 17:15:22 -08:00
2012-03-20 21:29:38 -04:00
2012-11-16 14:33:04 -08:00
2012-10-06 03:05:01 +09:00
2012-03-28 18:30:03 +01:00
2012-09-27 12:45:28 +02:00
2012-10-11 20:02:04 -04:00
2012-06-05 17:32:30 +02:00
2012-06-13 21:16:42 +02:00
2012-10-27 15:38:29 -07:00
2012-10-09 16:22:55 +09:00
2012-08-21 16:28:31 +02:00
2012-10-09 16:22:32 +09:00
2012-07-22 23:57:55 +04:00
2012-10-22 16:58:28 -07:00
2012-11-15 17:20:58 -08:00
2012-09-05 17:21:36 -07:00