linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
	Matthew Garrett <mjg59@srcf.ucam.org>
Subject: Re: [PATCH] efi: Work around bogus pointers in BGRT
Date: Thu, 23 May 2013 22:37:38 -0700	[thread overview]
Message-ID: <20130524053737.GB6380@leaf> (raw)
In-Reply-To: <7ccd9d84f7407ba65c1f03d144e2113dee0d797a.1368824585.git.luto@amacapital.net>

On Fri, May 17, 2013 at 02:05:33PM -0700, Andy Lutomirski wrote:
> The MSI MS-7760 supplies a BGRT marked "invalid" that contains a
> pointer to nowhere.  Since an "invalid" BGRT isn't particularly
> useful (userspace isn't supposed to use it anyway), ignore the BGRT
> if it's marked "invalid" and the pointer points outside of EFI boot
> services space.
> 
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>

I'd suggest generalizing the comment to not just mention the one system
you observed it on.  In any case, I'm fine with this patch, but I seem
to recall Matthew Garrett having some objections to ignoring the BGRT
when the valid bit is not set.  Also, if you're going to do so, you
might as well not expose the valid bit to userspace.

> This seems to fix the problem for me.
> 
>  arch/x86/platform/efi/efi-bgrt.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
> index 7145ec6..c77b7cf 100644
> --- a/arch/x86/platform/efi/efi-bgrt.c
> +++ b/arch/x86/platform/efi/efi-bgrt.c
> @@ -49,6 +49,18 @@ void __init efi_bgrt_init(void)
>  
>  	image = efi_lookup_mapped_addr(bgrt_tab->image_address);
>  	if (!image) {
> +		if (!(bgrt_tab->status & 1)) {
> +			/*
> +			 * The MSI MS-7760 exposes an "invalid" BGRT
> +			 * containing a pointer to nowhere.  This heuristic
> +			 * will avoid following that pointer.  (The idea
> +			 * is that an "invalid" image pointing into boot
> +			 * services data is probably sensible, but other
> +			 * "invalid" pointers are questionable.)
> +			 */
> +			return;
> +		}
> +
>  		image = ioremap(bgrt_tab->image_address, sizeof(bmp_header));
>  		ioremapped = true;
>  		if (!image)
> -- 
> 1.8.1.4
> 

  reply	other threads:[~2013-05-24  5:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-17 19:36 BGRT wild pointer Andy Lutomirski
2013-05-17 21:05 ` [PATCH] efi: Work around bogus pointers in BGRT Andy Lutomirski
2013-05-24  5:37   ` Josh Triplett [this message]
2013-05-25  1:15     ` Andy Lutomirski
2013-05-25 19:50       ` Josh Triplett

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=20130524053737.GB6380@leaf \
    --to=josh@joshtriplett.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mjg59@srcf.ucam.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 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).