linux-stable/security/integrity
Roberto Sassu 8171c8a99f ima: Allow template selection with ima_template[_fmt]= after ima_hash=
commit bb8e52e490 upstream.

Commit c2426d2ad5 ("ima: added support for new kernel cmdline parameter
ima_template_fmt") introduced an additional check on the ima_template
variable to avoid multiple template selection.

Unfortunately, ima_template could be also set by the setup function of the
ima_hash= parameter, when it calls ima_template_desc_current(). This causes
attempts to choose a new template with ima_template= or with
ima_template_fmt=, after ima_hash=, to be ignored.

Achieve the goal of the commit mentioned with the new static variable
template_setup_done, so that template selection requests after ima_hash=
are not ignored.

Finally, call ima_init_template_list(), if not already done, to initialize
the list of templates before lookup_template_desc() is called.

Reported-by: Guo Zihua <guozihua@huawei.com>
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Cc: stable@vger.kernel.org
Fixes: c2426d2ad5 ("ima: added support for new kernel cmdline parameter ima_template_fmt")
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-16 12:54:16 +01:00
..
evm evm: mark evm_fixmode as __ro_after_init 2021-11-18 14:03:46 +01:00
ima ima: Allow template selection with ima_template[_fmt]= after ima_hash= 2022-02-16 12:54:16 +01:00
platform_certs integrity: Load mokx variables into the blacklist keyring 2021-06-30 08:47:30 -04:00
digsig.c fs/kernel_file_read: Add "offset" arg for partial reads 2020-10-05 13:37:04 +02:00
digsig_asymmetric.c integrity-v5.10 2020-10-15 15:58:18 -07:00
iint.c integrity: double check iint_cache was initialized 2021-03-30 14:31:55 +02:00
integrity.h integrity: Add errno field in audit message 2020-07-16 21:48:11 -04:00
integrity_audit.c integrity: check the return value of audit_log_start() 2022-02-16 12:54:16 +01:00
Kconfig powerpc: Load firmware trusted keys/hashes into kernel keyring 2019-11-13 00:33:23 +11:00
Makefile powerpc: Load firmware trusted keys/hashes into kernel keyring 2019-11-13 00:33:23 +11:00