lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_3373B90C5A9E646DDCF91C0D8CAD2184BC0A@qq.com>
Date:   Fri,  8 Sep 2023 00:53:49 +0800
From:   Yan Zhu <zhuyan2015@...mail.com>
To:     zohar@...ux.ibm.com
Cc:     dmitry.kasatkin@...il.com, paul@...l-moore.com, jmorris@...ei.org,
        serge@...lyn.com, linux-integrity@...r.kernel.org,
        linux-security-module@...r.kernel.org,
        linux-kernel@...r.kernel.org, Yan Zhu <zhuyan2015@...mail.com>
Subject: [PATCH] ima: fix return value of ima_restore_measurement_list

When the function restore_template_fmt returns NULL due to insufficient
memory, the ima_restore_measurement_list function will exit and the IMA
measurement list recovery fails. However, since the return value of
ima_restore_measurement_list is 0, there will be no prompt for IMA
measurement list recovery failure in ima_load_kexec_buffer, which can
easily cause misunderstandings for users.

Signed-off-by: Yan Zhu <zhuyan2015@...mail.com>
---
 security/integrity/ima/ima_template.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index 04c49f0..1b030cd 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -489,8 +489,10 @@ int ima_restore_measurement_list(loff_t size, void *buf)
 		template_desc = lookup_template_desc(template_name);
 		if (!template_desc) {
 			template_desc = restore_template_fmt(template_name);
-			if (!template_desc)
+			if (!template_desc) {
+				ret = -ENOMEM;
 				break;
+			}
 		}
 
 		/*
-- 
2.33.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ