TencentOS-kernel/security/integrity/ima
Roberto Sassu bbad2a93c3 ima: Don't modify file descriptor mode on the fly
commit 207cdd565dfc95a0a5185263a567817b7ebf5467 upstream.

Commit a408e4a86b36b ("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: 0014cc04e8ec0 ima: Set file->f_mode
Fixes: 2fe5d6def1672 ("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>
2021-03-16 16:43:35 +08:00
..
Kconfig ima: move APPRAISE_BOOTPARAM dependency on ARCH_POLICY to runtime 2021-03-16 16:33:11 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ima.h ima: extend boot_aggregate with kernel measurements 2021-03-16 16:41:53 +08:00
ima_api.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ima_appraise.c ima: move APPRAISE_BOOTPARAM dependency on ARCH_POLICY to runtime 2021-03-16 16:33:11 +08:00
ima_crypto.c ima: Don't modify file descriptor mode on the fly 2021-03-16 16:43:35 +08:00
ima_fs.c ima: Fix return value of ima_write_policy() 2021-03-16 16:28:06 +08:00
ima_init.c ima: Call ima_calc_boot_aggregate() in ima_eventdigest_init() 2021-03-16 16:29:41 +08:00
ima_kexec.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ima_main.c ima: Evaluate error in init_ima() 2021-03-16 16:29:41 +08:00
ima_modsig.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ima_mok.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ima_policy.c ima: Have the LSM free its audit rule 2021-03-16 16:33:35 +08:00
ima_queue.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ima_template.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ima_template_lib.c ima: Call ima_calc_boot_aggregate() in ima_eventdigest_init() 2021-03-16 16:29:41 +08:00
ima_template_lib.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00