]> git.baikalelectronics.ru Git - kernel.git/commit
exec: Set file unwritable before LSM check
authorKees Cook <keescook@chromium.org>
Fri, 9 Mar 2018 19:30:20 +0000 (11:30 -0800)
committerJames Morris <james.morris@microsoft.com>
Mon, 19 Mar 2018 04:49:32 +0000 (15:49 +1100)
commit93652615d3f0ffd8eb13ca0693471ed218890726
treed15e529bab47370611aa871465662775f9798027
parentafa8e264f839b6dc962fb3e3c652bae238f50db3
exec: Set file unwritable before LSM check

The LSM check should happen after the file has been confirmed to be
unchanging. Without this, we could have a race between the Time of Check
(the call to security_kernel_read_file() which could read the file and
make access policy decisions) and the Time of Use (starting with
kernel_read_file()'s reading of the file contents). In theory, file
contents could change between the two.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
fs/exec.c