linux-stable/security/integrity
Roberto Sassu 09fa241bc1 ima: Align ima_file_mmap() parameters with mmap_file LSM hook
commit 4971c268b8 upstream.

Commit 98de59bfe4 ("take calculation of final prot in
security_mmap_file() into a helper") moved the code to update prot, to be
the actual protections applied to the kernel, to a new helper called
mmap_prot().

However, while without the helper ima_file_mmap() was getting the updated
prot, with the helper ima_file_mmap() gets the original prot, which
contains the protections requested by the application.

A possible consequence of this change is that, if an application calls
mmap() with only PROT_READ, and the kernel applies PROT_EXEC in addition,
that application would have access to executable memory without having this
event recorded in the IMA measurement list. This situation would occur for
example if the application, before mmap(), calls the personality() system
call with READ_IMPLIES_EXEC as the first argument.

Align ima_file_mmap() parameters with those of the mmap_file LSM hook, so
that IMA can receive both the requested prot and the final prot. Since the
requested protections are stored in a new variable, and the final
protections are stored in the existing variable, this effectively restores
the original behavior of the MMAP_CHECK hook.

Cc: stable@vger.kernel.org
Fixes: 98de59bfe4 ("take calculation of final prot in security_mmap_file() into a helper")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-11 16:26:46 +01:00
..
evm evm: mark evm_fixmode as __ro_after_init 2021-11-26 11:40:23 +01:00
ima ima: Align ima_file_mmap() parameters with mmap_file LSM hook 2023-03-11 16:26:46 +01:00
Kconfig security: integrity: Remove select to deleted option PUBLIC_KEY_ALGO_RSA 2016-04-12 19:54:58 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
digsig.c integrity/security: fix digsig.c build error with header file 2018-05-30 07:52:02 +02:00
digsig_asymmetric.c integrity: Small code improvements 2017-06-21 14:37:12 -04:00
iint.c ima: re-initialize iint->atomic_flags 2018-12-01 09:43:00 +01:00
integrity.h ima: re-introduce own integrity cache lock 2018-12-01 09:43:00 +01:00
integrity_audit.c integrity: check the return value of audit_log_start() 2022-02-16 12:44:48 +01:00