Linux EFI development
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Matthew Garrett
	<matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org>
Cc: Matt Fleming
	<matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>,
	Dan Carpenter
	<dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	"linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: EFI: Stash ROMs if they're not in the PCI BAR
Date: Wed, 20 Mar 2013 09:27:23 +0000	[thread overview]
Message-ID: <1363771643.26810.41.camel@shinybook.infradead.org> (raw)
In-Reply-To: <1363622520.2553.8.camel-tCUS0Eywp2Pehftex57rkxo58HMYffqeLoYNBG0abjxeoWH0uzbU5w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1954 bytes --]

On Mon, 2013-03-18 at 16:02 +0000, Matthew Garrett wrote:
> On Mon, 2013-03-18 at 11:36 +0000, Matt Fleming wrote:
> > On Fri, 2013-03-15 at 08:57 +0000, David Woodhouse wrote:
> > > True. It probably doesn't *matter* because the size is zero so the
> > > firmware is just going to ignore the pointer anyway. Although in that
> > > case I wonder why we couldn't have just passed NULL. Perhaps we expected
> > > that some firmware might do some validation on the pointer before
> > > getting to the size check?
> > 
> > I doubt that the firmware checks the validity of pci_handle when size is
> > zero, and I agree it's worth passing NULL to silence the warning (which
> > is also more explicit that just initialising pci_handle), unless Matthew
> > knows of a reason we shouldn't do that?
> 
> No reason I can think of, and any failure will be pretty immediately
> obvious.

I agree with Matthew that I can think of no reason why a sane
implementation of EFI would ever actually dereference the pointer in
that case¹.

But there's an important difference in the way I phrased it...

I can't see why a *sane* implementation of EFI would do a lot of things.
Many of which have actually been seen in the field, much to our
distress.

So I'm starting to to think "hm, maybe we should give it a valid pointer
anyway, just in case".

Remember: Any sufficiently advanced incompetence is indistinguishable
from malice.

Assuming malice on the part of firmware authors is a fairly good way to
model their potential behaviour. So I'm perfectly prepared that someone
would ship an implementation which does *no* input checking, ever.
Except for gratuitously checking that particular pointer for NULL and
bailing out with an 'invalid parameters' error, even if the length was
zero.

-- 
dwmw2

¹ Although I haven't actually checked the spec to see if the pointer is
  required to be valid even when length is zero.



[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]

      parent reply	other threads:[~2013-03-20  9:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15  8:29 EFI: Stash ROMs if they're not in the PCI BAR Dan Carpenter
     [not found] ` <20130315082928.GA14520-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
2013-03-15  8:57   ` David Woodhouse
     [not found]     ` <1363337872.2444.9.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2013-03-18 11:36       ` Matt Fleming
     [not found]         ` <1363606563.15011.333.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-03-18 16:02           ` Matthew Garrett
     [not found]             ` <1363622520.2553.8.camel-tCUS0Eywp2Pehftex57rkxo58HMYffqeLoYNBG0abjxeoWH0uzbU5w@public.gmane.org>
2013-03-20  8:44               ` Matt Fleming
     [not found]                 ` <514976F3.2-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-03-20  9:09                   ` Dan Carpenter
2013-03-20  9:27               ` David Woodhouse [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=1363771643.26810.41.camel@shinybook.infradead.org \
    --to=dwmw2-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org \
    --cc=matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.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