From: Stefan Berger <stefanb@linux.ibm.com>
To: Mimi Zohar <zohar@linux.ibm.com>,
Tushar Sugandhi <tusharsu@linux.microsoft.com>,
Jonathan McDowell <noodles@fb.com>,
bauermann@kolabnow.com
Cc: "kexec@lists.infradead.org" <kexec@lists.infradead.org>,
Alasdair G Kergon <agk@redhat.com>,
Lakshmi Ramasubramanian <nramas@linux.microsoft.com>,
Tyler Hicks <tyhicks@linux.microsoft.com>,
code@tyhicks.com
Subject: Re: need help: patches to capture events between kexec load and execute
Date: Wed, 7 Jun 2023 14:42:49 -0400 [thread overview]
Message-ID: <dcc8f01e-0971-e826-3a48-ea0c1f2381ae@linux.ibm.com> (raw)
In-Reply-To: <91dd069c090522be1e3369e83520d3813336b5bf.camel@linux.ibm.com>
On 6/6/23 11:59, Mimi Zohar wrote:
> On Tue, 2023-06-06 at 11:37 -0400, Stefan Berger wrote:
>>
>> On 5/31/23 18:43, Mimi Zohar wrote:
>>> On Wed, 2023-05-31 at 15:02 -0700, Tushar Sugandhi wrote:
>>>> Hi Mimi,
>>>>
>>>> On 5/31/23 04:39, Mimi Zohar wrote:
>>>>> Hi Tushar,
>>>>>
>>>>> On Thu, 2023-05-25 at 10:21 -0700, Tushar Sugandhi wrote:
>>>>>
>>>>>> The issue of IMA measurements getting lost between kexec 'load' and 'execute' still exists.
>>>>>> I verified it on the mainline kernel 6.4.rc3. See *Appendix A* for details.
>>
>> I think there's a 2nd problem. Once the IMA measurement list is frozen (at kexec 'exec' stage)
>> IMA must stop extending PCRs. It can log (into the void) if it wanted to but the PCR extensions
>> have to stop otherwise the TPM's PCR state won't match the log in the kexec'ed-to kernel. I have
>> seen that on PPC64 some processes are being kicked off by kexec 'exec' that end up causing TPM
>> driver error message due to what seems to be a shutdown of the driver subsystem at this point.
>> I am not sure what an elegant method would be to stop PCR extensions. Maybe a flag on the level
>> of IMA would do? Or notifying the TPM driver to reject PCR extensions or just any command?
>
> Thank you for raising this concern.
>
> Agreed "kexec exec" might trigger additional measurements. As long as
> these are known, consistent measurements, they could be pre-measured
> before calling "kexec exec".
>
Tushar, Mimi,
I tried this now on ppc64 and with the following patch applied on top of yours it seems to work.
Also the problem with the TPM PCR extensions seems to be gone with your changes to
ima_add_template_entry() -- it's probably worth mentioning this in the patch description.
phys_to_page doesn't seem to be generally available, so hopefully this will be a solution for more architectures.
[I haven't tested this on x86_64 since I couldn't get kexec to work just to begin with in any of my VMs.]
Regards,
Stefan
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index f0bbdd403b6c..30ab7f81b508 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -966,7 +966,7 @@ void *kimage_map_segment(struct kimage *image,
else if (entry & IND_SOURCE) {
if (dest_page_addr >= addr && dest_page_addr < eaddr) {
src_page_addr = entry & PAGE_MASK;
- src_pages[i++] = phys_to_page(src_page_addr);
+ src_pages[i++] = virt_to_page(__va(src_page_addr));
if (i == npages)
break;
dest_page_addr += PAGE_SIZE;
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2023-06-07 18:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-04 6:16 need help: patches to capture events between kexec load and execute Tushar Sugandhi
2022-06-06 8:19 ` Jonathan McDowell
2022-06-06 17:22 ` Tushar Sugandhi
[not found] ` <87775c1e-d1d3-519c-599b-30cdb1691cb2@linux.microsoft.com>
2023-05-31 11:39 ` Mimi Zohar
[not found] ` <41270374-dc5e-3aa2-d2ed-9b8fc73ad65f@linux.microsoft.com>
2023-05-31 22:43 ` Mimi Zohar
2023-06-06 15:37 ` Stefan Berger
2023-06-06 15:59 ` Mimi Zohar
2023-06-07 18:42 ` Stefan Berger [this message]
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=dcc8f01e-0971-e826-3a48-ea0c1f2381ae@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=agk@redhat.com \
--cc=bauermann@kolabnow.com \
--cc=code@tyhicks.com \
--cc=kexec@lists.infradead.org \
--cc=noodles@fb.com \
--cc=nramas@linux.microsoft.com \
--cc=tusharsu@linux.microsoft.com \
--cc=tyhicks@linux.microsoft.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