linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: eajames@linux.ibm.com, jgg@ziepe.ca, yangyingliang@huawei.com,
	linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	peterhuewe@gmx.de, Stefan Berger <stefanb@linux.ibm.com>
Subject: Re: [PATCH 1/2] powerpc/tpm: Create linux,sml-base/size as big endian
Date: Thu, 2 Mar 2023 01:09:53 +0200	[thread overview]
Message-ID: <Y//bQe1Zd32bLy+J@kernel.org> (raw)
In-Reply-To: <87r0uaujb3.fsf@mpe.ellerman.id.au>

On Tue, Feb 28, 2023 at 10:21:36PM +1100, Michael Ellerman wrote:
> Jarkko Sakkinen <jarkko@kernel.org> writes:
> > On Mon, Feb 27, 2023 at 06:08:31PM -0500, Stefan Berger wrote:
> >> On 2/23/23 22:25, Michael Ellerman wrote:
> >> > There's code in prom_instantiate_sml() to do a "SML handover" (Stored
> >> > Measurement Log) from OF to Linux, before Linux shuts down Open
> >> > Firmware.
> >> > 
> >> > This involves creating a buffer to hold the SML, and creating two device
> >> > tree properties to record its base address and size. The kernel then
> >> > later reads those properties from the device tree to find the SML.
> >> > 
> >> > When the code was initially added in commit 4a727429abec ("PPC64: Add
> >> > support for instantiating SML from Open Firmware") the powerpc kernel
> >> > was always built big endian, so the properties were created big endian
> >> > by default.
> >> > 
> >> > However since then little endian support was added to powerpc, and now
> >> > the code lacks conversions to big endian when creating the properties.
> >> > 
> >> > This means on little endian kernels the device tree properties are
> >> > little endian, which is contrary to the device tree spec, and in
> >> > contrast to all other device tree properties.
> >> > 
> >> > To cope with that a workaround was added in tpm_read_log_of() to skip
> >> > the endian conversion if the properties were created via the SML
> >> > handover.
> >> > 
> >> > A better solution is to encode the properties as big endian as they
> >> > should be, and remove the workaround.
> >> > 
> >> > Typically changing the encoding of a property like this would present
> >> > problems for kexec. However the SML is not propagated across kexec, so
> >> > changing the encoding of the properties is a non-issue.
> >> > 
> >> > Fixes: e46e22f12b19 ("tpm: enhance read_log_of() to support Physical TPM event log")
> >> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> >> 
> >> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
> >
> > 2/2 does not have a fixes tag.
> 
> True. Arguably the bug goes back to the introduction of
> kexec_file_load() support, although the patch won't backport that far
> due to code refactoring. So that would be:
> 
> Fixes: a0458284f062 ("powerpc: Add support code for kexec_file_load()")

Hmm... IMHO, it would still make sense to document this.

BR, Jarkko

      reply	other threads:[~2023-03-01 23:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  3:25 [PATCH 1/2] powerpc/tpm: Create linux,sml-base/size as big endian Michael Ellerman
2023-02-24  3:25 ` [PATCH 2/2] powerpc/tpm: Reserve SML log when kexec'ing Michael Ellerman
2023-02-28 19:18   ` Stefan Berger
2023-03-02 22:05     ` Michael Ellerman
2023-02-27 23:08 ` [PATCH 1/2] powerpc/tpm: Create linux,sml-base/size as big endian Stefan Berger
2023-02-28  3:10   ` Jarkko Sakkinen
2023-02-28 11:21     ` Michael Ellerman
2023-03-01 23:09       ` Jarkko Sakkinen [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=Y//bQe1Zd32bLy+J@kernel.org \
    --to=jarkko@kernel.org \
    --cc=eajames@linux.ibm.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=peterhuewe@gmx.de \
    --cc=stefanb@linux.ibm.com \
    --cc=yangyingliang@huawei.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;
as well as URLs for NNTP newsgroup(s).