]> git.baikalelectronics.ru Git - kernel.git/commit
exec: load_script: Do not exec truncated interpreter path
authorKees Cook <keescook@chromium.org>
Tue, 19 Feb 2019 00:36:48 +0000 (16:36 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 19 Feb 2019 00:49:36 +0000 (16:49 -0800)
commit2abb82cd92a58b2bc679fa0a18a437c1d9b3a325
tree75ca80d49613a8daf9b2f59707fb051eb1e545f6
parent024d1b6107161403977ac7a7125749eb752676aa
exec: load_script: Do not exec truncated interpreter path

Commit a1f041b053d2 ("exec: load_script: don't blindly truncate
shebang string") was trying to protect against a confused exec of a
truncated interpreter path. However, it was overeager and also refused
to truncate arguments as well, which broke userspace, and it was
reverted. This attempts the protection again, but allows arguments to
remain truncated. In an effort to improve readability, helper functions
and comments have been added.

Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Samuel Dionne-Riel <samuel@dionne-riel.com>
Cc: Richard Weinberger <richard.weinberger@gmail.com>
Cc: Graham Christensen <graham@grahamc.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/binfmt_script.c