From: Tushar Sugandhi <tusharsu@linux.microsoft.com>
To: Mimi Zohar <zohar@linux.ibm.com>,
roberto.sassu@huaweicloud.com, roberto.sassu@huawei.com,
eric.snowberg@oracle.com, stefanb@linux.ibm.com,
ebiederm@xmission.com, noodles@fb.com, bauermann@kolabnow.com,
linux-integrity@vger.kernel.org, kexec@lists.infradead.org
Cc: code@tyhicks.com, nramas@linux.microsoft.com, paul@paul-moore.com
Subject: Re: [PATCH v4 6/7] ima: make the kexec extra memory configurable
Date: Thu, 25 Jan 2024 11:14:57 -0800 [thread overview]
Message-ID: <2bdabacb-fafb-48c5-9328-6749f70f9a96@linux.microsoft.com> (raw)
In-Reply-To: <e2b67ca4e3f0869bcab683feef9b8f4ad773e38e.camel@linux.ibm.com>
On 1/24/24 06:07, Mimi Zohar wrote:
>
>> --- a/security/integrity/ima/ima_kexec.c
>> +++ b/security/integrity/ima/ima_kexec.c
>> @@ -121,6 +121,7 @@ void ima_add_kexec_buffer(struct kimage *image)
>> .buf_min = 0, .buf_max = ULONG_MAX,
>> .top_down = true };
>> unsigned long binary_runtime_size;
>> + unsigned long extra_size;
>>
>> /* use more understandable variable names than defined in kbuf */
>> void *kexec_buffer = NULL;
>> @@ -128,15 +129,19 @@ void ima_add_kexec_buffer(struct kimage *image)
>> int ret;
>>
>> /*
>> - * Reserve an extra half page of memory for additional measurements
>> - * added during the kexec load.
>> + * Reserve extra memory for measurements added during kexec.
>> */
>
> The memory is still being allocated at kexec "load", so the extra memory is for
> additional measurement records "since" kexec load.
>
> Mimi
>
This wording was an attempt to address the comment in v3[1].
So I tried to make the comment generic. But maybe I made it too generic.
I will update.
[1] Re: [PATCH v3 6/7] ima: configure memory to log events between kexec
load and execute
https://lore.kernel.org/all/fbe6aa7577875b23a9913a39f858f06f1d2aa903.camel@linux.ibm.com/
"Additional records could be added as a result of the kexec
load itself.
...
Please remove any references to measurements between kexec load and
execute."
~Tushar
>> - binary_runtime_size = ima_get_binary_runtime_size();
>> + if (CONFIG_IMA_KEXEC_EXTRA_MEMORY_KB <= 0)
>> + extra_size = PAGE_SIZE / 2;
>> + else
>> + extra_size = CONFIG_IMA_KEXEC_EXTRA_MEMORY_KB * 1024;
>> + binary_runtime_size = ima_get_binary_runtime_size() + extra_size;
>> +
>> if (binary_runtime_size >= ULONG_MAX - PAGE_SIZE)
>> kexec_segment_size = ULONG_MAX;
>> else
>> - kexec_segment_size = ALIGN(ima_get_binary_runtime_size() +
>> - PAGE_SIZE / 2, PAGE_SIZE);
>> + kexec_segment_size = ALIGN(binary_runtime_size, PAGE_SIZE);
>> +
>> if ((kexec_segment_size == ULONG_MAX) ||
>> ((kexec_segment_size >> PAGE_SHIFT) > totalram_pages() / 2)) {
>> pr_err("Binary measurement list too large.\n");
>
next prev parent reply other threads:[~2024-01-25 19:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 18:37 [PATCH v4 0/7] ima: kexec: measure events between kexec load and execute Tushar Sugandhi
2024-01-22 18:37 ` [PATCH v4 1/7] ima: define and call ima_alloc_kexec_file_buf Tushar Sugandhi
2024-01-24 2:54 ` Stefan Berger
2024-01-24 3:38 ` Stefan Berger
2024-01-26 22:14 ` Tushar Sugandhi
2024-01-24 13:33 ` Mimi Zohar
2024-01-25 19:03 ` Tushar Sugandhi
2024-01-22 18:37 ` [PATCH v4 2/7] kexec: define functions to map and unmap segments Tushar Sugandhi
2024-01-23 17:03 ` Stefan Berger
2024-01-23 20:39 ` Tushar Sugandhi
2024-01-22 18:38 ` [PATCH v4 3/7] ima: kexec: skip IMA segment validation after kexec soft reboot Tushar Sugandhi
2024-01-22 18:38 ` [PATCH v4 4/7] ima: kexec: move ima log copy from kexec load to execute Tushar Sugandhi
2024-01-24 16:11 ` Mimi Zohar
2024-01-25 19:06 ` Tushar Sugandhi
2024-01-22 18:38 ` [PATCH v4 5/7] ima: suspend measurements during buffer copy at kexec execute Tushar Sugandhi
2024-01-23 18:18 ` Stefan Berger
2024-01-23 20:55 ` Tushar Sugandhi
2024-01-22 18:38 ` [PATCH v4 6/7] ima: make the kexec extra memory configurable Tushar Sugandhi
2024-01-23 19:02 ` Stefan Berger
2024-01-23 21:19 ` Tushar Sugandhi
2024-01-24 1:48 ` Stefan Berger
2024-01-24 14:07 ` Mimi Zohar
2024-01-25 19:14 ` Tushar Sugandhi [this message]
2024-01-22 18:38 ` [PATCH v4 7/7] ima: measure kexec load and exec events as critical data Tushar Sugandhi
2024-01-24 14:35 ` Mimi Zohar
2024-01-25 19:16 ` Tushar Sugandhi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2bdabacb-fafb-48c5-9328-6749f70f9a96@linux.microsoft.com \
--to=tusharsu@linux.microsoft.com \
--cc=bauermann@kolabnow.com \
--cc=code@tyhicks.com \
--cc=ebiederm@xmission.com \
--cc=eric.snowberg@oracle.com \
--cc=kexec@lists.infradead.org \
--cc=linux-integrity@vger.kernel.org \
--cc=noodles@fb.com \
--cc=nramas@linux.microsoft.com \
--cc=paul@paul-moore.com \
--cc=roberto.sassu@huawei.com \
--cc=roberto.sassu@huaweicloud.com \
--cc=stefanb@linux.ibm.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox