android_kernel_motorola_sm6225/security
Roberto Sassu 0b1a3d4137 ima: Align ima_file_mmap() parameters with mmap_file LSM hook
commit 4971c268b85e1c7a734a61622fc0813c86e2362e 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:31:51 +01:00
..
apparmor apparmor: Fix abi check to include v8 abi 2023-01-18 11:30:21 +01:00
integrity ima: Align ima_file_mmap() parameters with mmap_file LSM hook 2023-03-11 16:31:51 +01:00
keys KEYS: trusted: Fix migratable=1 failing 2021-03-04 09:39:53 +01:00
loadpin
selinux selinux: Add boundary check in put_entry() 2022-08-25 11:15:00 +02:00
smack Fix incorrect type in assignment of ipv6 port for audit 2022-04-15 14:14:54 +02:00
tomoyo tomoyo: fix broken dependency on *.conf.default 2023-02-06 07:49:37 +01:00
yama
commoncap.c capabilities: fix potential memleak on error path from vfs_getxattr_alloc() 2022-11-10 17:46:55 +01:00
device_cgroup.c device_cgroup: Roll back to original exceptions after copy failure 2023-01-18 11:30:44 +01:00
inode.c
Kconfig fortify: Explicitly disable Clang support 2021-11-26 11:36:18 +01:00
lsm_audit.c dump_common_audit_data(): fix racy accesses to ->d_name 2021-01-19 18:22:37 +01:00
Makefile
min_addr.c
security.c ima: Align ima_file_mmap() parameters with mmap_file LSM hook 2023-03-11 16:31:51 +01:00