All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Carlos López" <clopez@suse.de>,
	cve@kernel.org, linux-kernel@vger.kernel.org,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Jonas Gorski" <jonas.gorski@gmail.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>
Subject: Re: CVE-2023-52466: PCI: Avoid potential out-of-bounds read in pci_dev_for_each_resource()
Date: Tue, 27 Feb 2024 11:39:26 -0600	[thread overview]
Message-ID: <20240227173926.GA242161@bhelgaas> (raw)
In-Reply-To: <2024022706-kindle-tapering-5f66@gregkh>

On Tue, Feb 27, 2024 at 06:24:38PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Feb 27, 2024 at 09:07:44AM -0600, Bjorn Helgaas wrote:
> > [+cc Mika, author of 09cc90063240]
> > 
> > On Tue, Feb 27, 2024 at 02:26:26PM +0100, Greg Kroah-Hartman wrote:
> > > On Tue, Feb 27, 2024 at 02:18:51PM +0100, Carlos López wrote:
> > > > On 25/2/24 9:16, Greg Kroah-Hartman wrote:
> > > > > There is no actual issue right now because we have another check
> > > > > afterwards and the out-of-bounds read is not being performed. In
> > > > > any case it's better code with this fixed, hence the proposed
> > > > > change.
> > > > 
> > > > Given that there is no actual security issue this looks more like a
> > > > hardening, and thus not deserving of a CVE, no?
> > > 
> > > This was a tricky one, I think it's needed as we do not know how people
> > > are really using these macros, right?  If the PCI maintainer agrees (on
> > > the cc:), I'll be glad to revoke it, it's their call.
> > 
> > 09cc90063240 ("PCI: Introduce pci_dev_for_each_resource()") added
> > pci_dev_for_each_resource(), which expands to:
> > 
> >   for (...; res = (&(dev)->resource[(bar)]), bar < PCI_NUM_RESOURCES; ...)
> > 
> > We compute "res" before the bounds-check of "bar", so the pointer may
> > be out-of-bounds, but the body of the pci_dev_for_each_resource() loop
> > is never executed with that out-of-bounds value.
> > 
> > So I don't think this is a security issue, no matter how
> > pci_dev_for_each_resource() is used, unless the mere presence of an
> > invalid address in a register is an issue.
> 
> Ah, yeah, now I remember, stuff like this was fixed up in other loops as
> just reading off into the wild can be a speculation issue and so we had
> to fix up a bunch of places in the kernel where we did have "invalid
> data" in a register.  The code didn't use that, but the processor would
> fetch from there, and boom, speculation mess.  There's a whole research
> paper published on this type of thing somewhere...
> 
> So let's keep this as a CVE unless someone really doesn't want it marked
> as such.  Again, it is a "weakness that is fixed" in the kernel, and
> because of that, a CVE can be allocated for it.

Sounds good, I'm happy to have it as a CVE.  Thanks for the
speculation details; I'm certainly not an expert on that.

Bjorn

  reply	other threads:[~2024-02-27 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-25  8:16 CVE-2023-52466: PCI: Avoid potential out-of-bounds read in pci_dev_for_each_resource() Greg Kroah-Hartman
2024-02-27 13:18 ` Carlos López
2024-02-27 13:26   ` Greg Kroah-Hartman
2024-02-27 15:07     ` Bjorn Helgaas
2024-02-27 17:24       ` Greg Kroah-Hartman
2024-02-27 17:39         ` Bjorn Helgaas [this message]
2024-02-28  9:20         ` Jiri Kosina
2024-03-03  7:28           ` Greg Kroah-Hartman

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=20240227173926.GA242161@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=clopez@suse.de \
    --cc=cve@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonas.gorski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.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 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.