From: Thomas Huth <thuth@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
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: Tue, 16 Aug 2022 10:42:42 +0200 [thread overview]
Message-ID: <2b40953b-3514-2e69-b2df-0790eb7fe4a3@redhat.com> (raw)
In-Reply-To: <20220816083703.vopxgj2omjittb6j@sirius.home.kraxel.org>
On 16/08/2022 10.37, Gerd Hoffmann wrote:
> On Thu, Aug 04, 2022 at 01:43:14PM +0200, Thomas Huth wrote:
>> On 04/08/2022 12.17, Peter Maydell wrote:
>>> 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?
>
> Hmm, dunno. Typical workflow is that the driver allocates a page
> (or multiple physically contiguous pages) for the TRBs, and when
> it reaches the end of the allocation it gets a new block and chains
> it using TRB_LINK.
>
> Right now we have a limit for type=TRB_LINK only, having another one for
> all TRBs makes sense. The number of TRBs for a transfer can be quite
> large (think usb-storage reads/writes), so don't set that too low, 64k
> maybe?
Yes, after some more reading, I found a remark in the spec (in chapter 6)
saying that each segment should be limited by 64 kb.
I've sent a v2 with that limit check here (it has a slightly different
subject, so it's hard to relate it to this v1 here):
https://patchwork.kernel.org/project/qemu-devel/patch/20220804131300.96368-1-thuth@redhat.com/
Thomas
next prev parent reply other threads:[~2022-08-16 8:43 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
2022-08-04 12:29 ` Thomas Huth
2022-08-16 8:37 ` Gerd Hoffmann
2022-08-16 8:42 ` Thomas Huth [this message]
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=2b40953b-3514-2e69-b2df-0790eb7fe4a3@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).