All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ima: Fix a potential integer overflow in ima_appraise_measurement
@ 2022-07-05  5:14 luhuaxin1
  2022-07-07 21:39 ` Mimi Zohar
  0 siblings, 1 reply; 2+ messages in thread
From: luhuaxin1 @ 2022-07-05  5:14 UTC (permalink / raw)
  To: linux-integrity; +Cc: zohar, dmitry.kasatkin

From: Huaxin Lu <luhuaxin1@huawei.com>

When the ima-modsig is enabled, the rc passed to evm_verifyxattr() may be
negative, which may cause the integer overflow problem.

Signed-off-by: Huaxin Lu <luhuaxin1@huawei.com>
---
 security/integrity/ima/ima_appraise.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
index 3fb378017f9d..956fb0f4c006 100644
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -412,7 +412,8 @@ int ima_appraise_measurement(enum ima_hooks func,
 		goto out;
 	}
 
-	status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, rc, iint);
+	status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value,
+				 rc < 0 ? 0 : rc, iint);
 	switch (status) {
 	case INTEGRITY_PASS:
 	case INTEGRITY_PASS_IMMUTABLE:
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ima: Fix a potential integer overflow in ima_appraise_measurement
  2022-07-05  5:14 [PATCH v2] ima: Fix a potential integer overflow in ima_appraise_measurement luhuaxin1
@ 2022-07-07 21:39 ` Mimi Zohar
  0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2022-07-07 21:39 UTC (permalink / raw)
  To: luhuaxin1, linux-integrity; +Cc: dmitry.kasatkin

On Tue, 2022-07-05 at 13:14 +0800, luhuaxin1@huawei.com wrote:
> From: Huaxin Lu <luhuaxin1@huawei.com>
> 
> When the ima-modsig is enabled, the rc passed to evm_verifyxattr() may be
> negative, which may cause the integer overflow problem.
> 
> Signed-off-by: Huaxin Lu <luhuaxin1@huawei.com>

Thanks, Huaxin.  This patch is now queued in next/next-testing.

Mimi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-07 21:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05  5:14 [PATCH v2] ima: Fix a potential integer overflow in ima_appraise_measurement luhuaxin1
2022-07-07 21:39 ` Mimi Zohar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.