* Re: [PATCH] ima: add check for khdr->buffer_size
[not found] <639b3953.170a0220.35d95.65e9@mx.google.com>
@ 2022-12-15 15:20 ` Mimi Zohar
0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2022-12-15 15:20 UTC (permalink / raw)
To: iuppiterlucas, dmitry.kasatkin, paul, jmorris, serge, akpm,
linux-integrity, linux-security-module, linux-kernel
Hi Lucas,
On Thu, 2022-12-15 at 23:12 +0800, iuppiterlucas@gmail.com wrote:
> When khdr->buffer_size > size, continuing to use ima_parse_buf
>
> may cause memory access out of bounds.
>
>
> Fixes: 94c3aac567a9 ("ima: on soft reboot, restore the measurement list")
>
>
> Signed-off-by: Lucas Iuppiter <iuppiterlucas@gmail.com>
When posting patches to the linux-integrity mailing list, patches
should be posted in plain text, not mime encoded.
thanks,
Mimi
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] ima: add check for khdr->buffer_size
@ 2023-08-30 7:31 Yan Zhu
0 siblings, 0 replies; 2+ messages in thread
From: Yan Zhu @ 2023-08-30 7:31 UTC (permalink / raw)
To: zohar; +Cc: dmitry.kasatkin, serge, linux-kernel, Yan Zhu
When khdr->buffer_size > size, continuing to use ima_parse_buf
may cause memory access out of bounds.
Fixes: 94c3aac567a9 ("ima: on soft reboot, restore the measurement list")
Signed-off-by: Yan Zhu <zhuyan2015@126.com>
---
security/integrity/ima/ima_template.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index e5d941f48..02a38b2ee 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -399,6 +399,12 @@ int ima_restore_measurement_list(loff_t size, void *buf)
return -EINVAL;
}
+ if (khdr->buffer_size > (u64)size) {
+ pr_err("hkdr->buffer_size(%llu) is larger then size(%lld)", khdr->buffer_size,
+ size);
+ return -EINVAL;
+ }
+
bitmap_zero(hdr_mask, HDR__LAST);
bitmap_set(hdr_mask, HDR_PCR, 1);
bitmap_set(hdr_mask, HDR_DIGEST, 1);
--
2.33.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-04 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <639b3953.170a0220.35d95.65e9@mx.google.com>
2022-12-15 15:20 ` [PATCH] ima: add check for khdr->buffer_size Mimi Zohar
2023-08-30 7:31 Yan Zhu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®