WSL2-Linux-Kernel/security/integrity/ima
Roberto Sassu 1cb936fee7 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-10 09:40:03 +01:00
..
Kconfig ima: remove the IMA_TEMPLATE Kconfig option 2022-06-09 10:23:25 +02:00
Makefile ima: generalize x86/EFI arch glue for other EFI architectures 2020-11-06 07:40:42 +01:00
ima.h IMA: introduce a new policy option func=SETXATTR_CHECK 2021-08-16 17:35:35 -04:00
ima_api.c IMA: add support to restrict the hash algorithms used for file appraisal 2021-08-16 17:30:41 -04:00
ima_appraise.c ima: fix blocking of security.ima xattrs of unsupported algorithms 2022-10-26 12:34:35 +02:00
ima_asymmetric_keys.c ima: Add digest and digest_len params to the functions to measure a buffer 2021-07-23 09:27:02 -04:00
ima_crypto.c ima: Fix potential memory leak in ima_init_crypto() 2022-07-21 21:24:29 +02:00
ima_efi.c ima: force signature verification when CONFIG_KEXEC_SIG is configured 2022-07-21 21:24:29 +02:00
ima_fs.c ima: Remove ima_policy file before directory 2022-02-16 12:56:03 +01:00
ima_init.c ima: Add digest and digest_len params to the functions to measure a buffer 2021-07-23 09:27:02 -04:00
ima_kexec.c ima: Fix warning: no previous prototype for function 'ima_add_kexec_buffer' 2021-06-11 11:27:03 -04:00
ima_main.c ima: Align ima_file_mmap() parameters with mmap_file LSM hook 2023-03-10 09:40:03 +01:00
ima_modsig.c ima: Move comprehensive rule validation checks out of the token parser 2020-07-20 13:28:15 -04:00
ima_mok.c IMA: remove -Wmissing-prototypes warning 2021-07-23 08:05:06 -04:00
ima_policy.c ima: Simplify ima_lsm_copy_rule 2022-12-31 13:14:45 +01:00
ima_queue.c IMA: support for duplicate measurement records 2021-06-11 12:54:13 -04:00
ima_queue_keys.c ima: Add digest and digest_len params to the functions to measure a buffer 2021-07-23 09:27:02 -04:00
ima_template.c ima: Fix a potential NULL pointer access in ima_restore_measurement_list 2023-01-12 11:58:57 +01:00
ima_template_lib.c ima: Fix fall-through warning for Clang 2021-06-08 23:33:48 -04:00
ima_template_lib.h ima: Define new template fields xattrnames, xattrlengths and xattrvalues 2021-06-02 18:56:13 -04:00