hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/10427 -------------------------------- The ima_eventdigest_init() function in ima_template_lib.c directly uses ima_tpm_calc_boot_aggregate() which creates dependency on TPM hardware. When ROT device is non-TPM (e.g. virtcca device) and the ima_template_field selects "d" field_id, this causes three critical issues: 1. TPM device lookup failure (ENODEV) during PCR extension operations 2. Boot aggregate calculation failure breaking IMA measurement chain 3. System boot failure in TPM-dependent IMA policy configurations This patch introduces a device-agnostic approach to solve these issues by replacing direct TPM function call with ima_rot's generic calc_boot_ aggregate(). Fixes: e23277a48529 ("ima: rot: Make RoT kick in") Signed-off-by: Zhao Yipeng <zhaoyipeng5@huawei.com> Signed-off-by: Gong Ruiqi <ruiqi.gong@huawei.com> --- security/integrity/ima/ima_template_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c index bd74b87ad438..38e92b7135fe 100644 --- a/security/integrity/ima/ima_template_lib.c +++ b/security/integrity/ima/ima_template_lib.c @@ -364,7 +364,7 @@ int ima_eventdigest_init(struct ima_event_data *event_data, if ((const char *)event_data->filename == boot_aggregate_name) { if (ima_rot_inst) { hash.hdr.algo = HASH_ALGO_SHA1; - result = ima_calc_boot_aggregate(&hash.hdr); + result = ima_rot_inst->calc_boot_aggregate(&hash.hdr); /* algo can change depending on available PCR banks */ if (!result && hash.hdr.algo != HASH_ALGO_SHA1) -- 2.43.0