From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
qemu-devel@nongnu.org, mcascell@redhat.com, f4bug@amsat.org
Subject: Re: [PATCH] hw/usb/hcd-xhci: Fix endless loop in case the DMA access fails (CVE-2020-14394)
Date: Thu, 4 Aug 2022 13:43:14 +0200 [thread overview]
Message-ID: <d2c8abec-1f87-01e5-a882-8502d9547f39@redhat.com> (raw)
In-Reply-To: <CAFEAcA9azLEWsK-ewXT_ovsc2u+2ykMMJNK8b9UXdfBZ49w6eA@mail.gmail.com>
On 04/08/2022 12.17, Peter Maydell wrote:
> On Thu, 4 Aug 2022 at 11:07, Thomas Huth <thuth@redhat.com> wrote:
>>
>> On 04/08/2022 10.56, Peter Maydell wrote:
>>> But the point of TRB_LINK_LIMIT is that regardless of what the
>>> contents of the TRBs are, the loop is not supposed to
>>> be able to continue for more than TRB_LINK_LIMIT iterations,
>>> ie 32 times. In this example case, do we stop after 32 TRBs
>>> (case 2) or not (case 1)?
>>
>> Oh, wait, I think we were maybe looking at different spots. The problem
>> likely does not occur in the xhci_ring_fetch() function
>> (which you were likely looking at), but only in the xhci_ring_chain_length()
>> function (which I was looking at)!
>> xhci_ring_chain_length() can certainly continue more than 32 times. In
>> xhci_ring_chain_length() the TRB_LINK_LIMIT only applies if "type ==
>> TR_LINK", but the TRBs we're talking about here are *not* of type TR_LINK.
>
> That sounds like we do still have an unbounded-loop problem,
> then: there's no limit on the number of consecutive TRBs
> we try to read in that function. Maybe we're missing an
> error check of some kind (does the spec limit how many
> consecutive TRBs there can be somehow?) or else we need
> another artificial limit.
I'm not an XHCI expert at all, but while at least having a quick glance at
the spec, I did not see any limit there. So I assume that we should enforce
an artificial limit? What would be a good value for this? Gerd, do you maybe
have any opinion?
Thomas
next prev parent reply other threads:[~2022-08-04 11:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 13:48 [PATCH] hw/usb/hcd-xhci: Fix endless loop in case the DMA access fails (CVE-2020-14394) Thomas Huth
2022-08-02 14:09 ` Peter Maydell
2022-08-04 8:00 ` Thomas Huth
2022-08-04 8:56 ` Peter Maydell
2022-08-04 10:07 ` Thomas Huth
2022-08-04 10:17 ` Peter Maydell
2022-08-04 11:43 ` Thomas Huth [this message]
2022-08-04 12:29 ` Thomas Huth
2022-08-16 8:37 ` Gerd Hoffmann
2022-08-16 8:42 ` Thomas Huth
2022-08-04 8:45 ` Mauro Matteo Cascella
2022-08-04 8:48 ` Thomas Huth
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=d2c8abec-1f87-01e5-a882-8502d9547f39@redhat.com \
--to=thuth@redhat.com \
--cc=f4bug@amsat.org \
--cc=kraxel@redhat.com \
--cc=mcascell@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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).