All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
To: Michael Roth <michael.roth@amd.com>
Cc: "NOMURA JUNICHI(野村 淳一)" <junichi.nomura@nec.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>, "bp@suse.de" <bp@suse.de>
Subject: Re: [Regression v5.19-rc1] kernel fails to boot, no console output (Re: [PATCH v12 38/46] x86/sev: Add SEV-SNP feature detection/setup)
Date: Thu, 8 Sep 2022 11:35:46 +0200	[thread overview]
Message-ID: <Yxm3clMvSK8uLKju@jpiotrowski-Surface-Book-3> (raw)
In-Reply-To: <20220822163933.b5hee76fsis376ji@amd.com>

On Mon, Aug 22, 2022 at 11:39:33AM -0500, Michael Roth wrote:
> On Wed, Aug 17, 2022 at 10:40:40AM +0200, Jeremi Piotrowski wrote:
> > On Tue, Aug 16, 2022 at 10:06:37AM -0500, Michael Roth wrote:
> > > And if that does not avoid the issue, can you retry with the below change
> > > (without the above change in place)?
> > > 
> > >   diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
> > >   index 7b668f91c9ab..0b430f98e053 100644
> > >   --- a/arch/x86/kernel/sev.c
> > >   +++ b/arch/x86/kernel/sev.c
> > >   @@ -2073,10 +2073,12 @@ static __init struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> > >           struct cc_blob_sev_info *cc_info;
> > >   
> > >           /* Boot kernel would have passed the CC blob via boot_params. */
> > >   +#if 0
> > >           if (bp->cc_blob_address) {
> > >                   cc_info = (struct cc_blob_sev_info *)(unsigned long)bp->cc_blob_address;
> > >                   goto found_cc_info;
> > >           }
> > >   +#endif
> > >   
> > >           /*
> > >            * If kernel was booted directly, without the use of the
> > >   @@ -2087,7 +2089,7 @@ static __init struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> > >           if (!cc_info)
> > >                   return NULL;
> > >   
> > >   -found_cc_info:
> > >   +//found_cc_info:
> > >           if (cc_info->magic != CC_BLOB_SEV_HDR_MAGIC)
> > >                   snp_abort();
> > > 
> > > Trying to see if you're hitting a separate issue or not.
> > 
> > This version boots correctly.
> 
> Hi Jeremi,
> 
> Still haven't been able to reproduce this on my systems, but it looks like
> it's either an issue dereferencing boot_params, or bp->cc_blob_address is
> pointing to garbage, so the cc_info->magic check fails. The latter seems
> more likely, since sme_enable() previously made use of the same boot_params
> pointer without any issues.
> 
> To confirm, please give the below fix a try:
> 
> 
> diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
> index 52f989f6acc2..dd6cd0d7c740 100644
> --- a/arch/x86/boot/compressed/sev.c
> +++ b/arch/x86/boot/compressed/sev.c
> @@ -392,6 +392,13 @@ bool snp_init(struct boot_params *bp)
>         if (!bp)
>                 return false;
> 
> +       /*
> +        * bp->cc_blob_address should only be set by boot/compressed kernel.
> +        * Initialize it to 0 to ensure that uninitialized values from
> +        * buggy bootloaders aren't propagated.
> +        */
> +       bp->cc_blob_address = 0;
> +
>         cc_info = find_cc_blob(bp);
>         if (!cc_info)
>                 return false;
> 

Sorry, couldn't get back to you sooner.
I tested the patch https://lore.kernel.org/lkml/20220823160734.89036-1-michael.roth@amd.com/
and it solves the issue.

Thanks for looking into this
Jeremi

> Thanks!
> 
> -Mike
> 
> > 
> > > 
> > > Thanks,
> > > 
> > > Mike
> > > 
> > > 

      reply	other threads:[~2022-09-08  9:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24  0:44 [Regression v5.19-rc1] crash kexec fails to boot the 2nd kernel (Re: [PATCH v12 38/46] x86/sev: Add SEV-SNP feature detection/setup) NOMURA JUNICHI(野村 淳一)
2022-06-24  9:03 ` Borislav Petkov
2022-06-24 10:14   ` NOMURA JUNICHI(野村 淳一)
2022-06-29  0:41 ` Michael Roth
2022-06-29  7:38   ` NOMURA JUNICHI(野村 淳一)
2022-06-29  8:20     ` Borislav Petkov
2022-06-29 11:06       ` NOMURA JUNICHI(野村 淳一)
2022-06-29 13:52         ` Michael Roth
2022-06-29 15:35           ` Michael Roth
2022-06-29 13:54     ` Michael Roth
2022-06-30  8:25       ` NOMURA JUNICHI(野村 淳一)
2022-08-16 14:25 ` [Regression v5.19-rc1] kernel fails to boot, no console output " Jeremi Piotrowski
2022-08-16 15:06   ` Michael Roth
2022-08-17  8:40     ` Jeremi Piotrowski
2022-08-22 16:39       ` Michael Roth
2022-09-08  9:35         ` Jeremi Piotrowski [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=Yxm3clMvSK8uLKju@jpiotrowski-Surface-Book-3 \
    --to=jpiotrowski@linux.microsoft.com \
    --cc=bp@suse.de \
    --cc=junichi.nomura@nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.