Re: [PATHC v2 5/9] ima: on soft reboot, save the measurement list

From
Mimi Zohar <hidden>
Date
2016-09-02 13:23:15
Also in
kexec, lkml
Reply to
Dave Young, 2016-09-01
Hi Dave,

On Thu, 2016-09-01 at 09:57 +0800, Dave Young wrote:
On 08/30/16 at 06:40pm, Mimi Zohar wrote:
quoted
+ * Called during kexec_file_load so that IMA can add a segment to the kexec
+ * image for the measurement list for the next kernel.
+ */
+void ima_add_kexec_buffer(struct kimage *image)
+{
+	static int registered = 0;
+	struct kexec_buf kbuf = { .image = image, .buf_align = PAGE_SIZE,
+				  .buf_min = 0, .buf_max = ULONG_MAX,
+				  .top_down = true, .skip_checksum = true };
+	int ret;
+
+	if (!kexec_can_hand_over_buffer())
+		return;
+
+	kexec_segment_size = ALIGN(ima_get_binary_runtime_size() + PAGE_SIZE,
+				   PAGE_SIZE);
+
+	if (kexec_segment_size >= (ULONG_MAX - sizeof(long))) {
+		pr_err("Binary measurement list too large.\n");
+		return;
+	}
Now we added a limitation that total segment size can not be larger than
half of totalram. see kernel/kexec_core.c sanity_check_segment_list()

So can it fail early here if kexec_segment_size is over half of total
ram?
Sure, I'll include this change in the next post.

Mimi
Thread (15 messages) 15 messages, 3 authors, last reply 2016-09-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help