1
0
Fork 0
alistair23-linux/security/integrity/ima
Roberto Sassu 26d72a8460 ima: Don't modify file descriptor mode on the fly
commit 207cdd565d upstream.

Commit a408e4a86b ("ima: open a new file instance if no read
permissions") already introduced a second open to measure a file when the
original file descriptor does not allow it. However, it didn't remove the
existing method of changing the mode of the original file descriptor, which
is still necessary if the current process does not have enough privileges
to open a new one.

Changing the mode isn't really an option, as the filesystem might need to
do preliminary steps to make the read possible. Thus, this patch removes
the code and keeps the second open as the only option to measure a file
when it is unreadable with the original file descriptor.

Cc: <stable@vger.kernel.org> # 4.20.x: 0014cc04e8 ima: Set file->f_mode
Fixes: 2fe5d6def1 ("ima: integrity appraisal extension")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-30 11:51:39 +01:00
..
Kconfig ima: move APPRAISE_BOOTPARAM dependency on ARCH_POLICY to runtime 2020-08-11 15:33:41 +02:00
Makefile ima: Add modsig appraise_type option for module-style appended signatures 2019-08-05 18:40:21 -04:00
ima.h ima: extend boot_aggregate with kernel measurements 2020-12-08 10:40:24 +01:00
ima_api.c ima: ima_api: Use struct_size() in kzalloc() 2019-08-29 14:23:30 -04:00
ima_appraise.c ima: move APPRAISE_BOOTPARAM dependency on ARCH_POLICY to runtime 2020-08-11 15:33:41 +02:00
ima_crypto.c ima: Don't modify file descriptor mode on the fly 2020-12-30 11:51:39 +01:00
ima_fs.c ima: Fix return value of ima_write_policy() 2020-05-27 17:46:08 +02:00
ima_init.c ima: Call ima_calc_boot_aggregate() in ima_eventdigest_init() 2020-06-22 09:31:15 +02:00
ima_kexec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ima_main.c ima: Evaluate error in init_ima() 2020-06-22 09:31:14 +02:00
ima_modsig.c ima: Fix use after free in ima_read_modsig() 2019-08-28 15:01:24 -04:00
ima_mok.c Revert "Merge tag 'keys-acl-20190703' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs" 2019-07-10 18:43:43 -07:00
ima_policy.c ima: Have the LSM free its audit rule 2020-08-19 08:16:12 +02:00
ima_queue.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441 2019-06-05 17:37:17 +02:00
ima_template.c ima: use struct_size() in kzalloc() 2019-08-29 14:23:22 -04:00
ima_template_lib.c ima: Call ima_calc_boot_aggregate() in ima_eventdigest_init() 2020-06-22 09:31:15 +02:00
ima_template_lib.h ima: Define ima-modsig template 2019-08-05 18:40:25 -04:00