From: Mimi Zohar <zohar@linux.ibm.com>
To: 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, 31 May 2023 18:43:54 -0400 [thread overview]
Message-ID: <8308a411a50a1168aa5a1a0d70138b29cea73914.camel@linux.ibm.com> (raw)
In-Reply-To: <41270374-dc5e-3aa2-d2ed-9b8fc73ad65f@linux.microsoft.com>
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 went through Thiago's patches he wrote several years ago, and tried to develop a solution.
> >>
> >> I was facing some issues with physical to virtual address translation.
> >> One of my co-worker at Microsoft helped my re-write the logic which seems to be working.
> >> See the attached patch and *Appendix B* for details.
> >>
> >> The basic functionality is working. I need to polish the code, and handle error paths in a better way.
> >> But before doing that, I need your feedback on the fundamental approach.
> >> Since I am not a kexec expert, it’d be great if I could get help with the code review
> >> and also suggestions on scenarios to test to validate the patch thoroughly.
> >> Let me know if I should first post the patch as RFC on public forums for that.
> > Thanks, Tushar. Measurements can and are currently being added to the
> > IMA measurement list between kexec load and execute, but are not being
> > carried across kexec. These measurements also extend the TPM. After
> > the soft reboot, without these additional measurements the IMA
> > measurement list cannot be verified against the TPM PCRs.
> Yup. IMA measurement list goes out of sync with TPM PCRs after the soft
> reboot.
> So the measurement list cannot be verified against PCRs. That's the issue.
> Thanks for acknowledging it.
> > Your proposed patch, like Thiago's, saved the entire IMA measurement
> > list again. Assuming the buffer size can't change between kexec load
> > and execute, as per the comment, why not just allocate the buffer on
> > kexec load and fill it on kexec exec?
> >
> > To simulate the existing behavior, fill the buffer with as many
> > complete measurement records as the buffer will hold.
> I was under the impression that I was doing the same. i.e. allocate at
> 'load' and fill on 'execute'.
> But I realized that in my patch ima_dump_measurement_list() gets called
> twice - once at 'load' and once at 'execute'.
> Is that what you meant by "my patch saved the entire IMA measurement
> list again" ?
Exactly, there's no need for copying the measurement list twice. The
first N number of measurements haven't changed.
> ima_dump_measurement_list() calls vmalloc, memset, and memcpy.
> So there is definitely some redundancy. Let me see how can I optimize it.
Please look at my suggestion.
> Attaching my original patch again for reference.
Patches should be posted inline. Please don't do this.
--
thanks,
Mimi
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2023-05-31 22:44 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 [this message]
2023-06-06 15:37 ` Stefan Berger
2023-06-06 15:59 ` Mimi Zohar
2023-06-07 18:42 ` Stefan Berger
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=8308a411a50a1168aa5a1a0d70138b29cea73914.camel@linux.ibm.com \
--to=zohar@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 \
/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