All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/usb/hcd-xhci: Turn guest-triggerable abort() into qemu_log_mask()
@ 2026-07-10 14:27 Thomas Huth
  2026-07-10 14:36 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2026-07-10 14:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Daniel P . Berrangé, Gerd Hoffmann

From: Thomas Huth <thuth@redhat.com>

The FIXME macros in xhci_alloc_device_streams() can be triggered
by a (malicious) guest. Since the macro also contains an abort()
statement, this terminates QEMU. Turn the FIXME statements into
a qemu_log_mask() instead to avoid that a guest can shoot itself
this way.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3784
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/usb/hcd-xhci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 2cdab3ba0e4..9ff50d0b7f9 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -965,11 +965,13 @@ static TRBCCode xhci_alloc_device_streams(XHCIState *xhci, unsigned int slotid,
          * together and make an usb_device_alloc_streams call per group.
          */
         if (epctxs[i]->nr_pstreams != req_nr_streams) {
-            FIXME("guest streams config not identical for all eps");
+            qemu_log_mask(LOG_GUEST_ERROR,
+                          "guest streams config not identical for all eps");
             return CC_RESOURCE_ERROR;
         }
         if (eps[i]->max_streams != dev_max_streams) {
-            FIXME("device streams config not identical for all eps");
+            qemu_log_mask(LOG_GUEST_ERROR,
+                          "device streams config not identical for all eps");
             return CC_RESOURCE_ERROR;
         }
     }
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/usb/hcd-xhci: Turn guest-triggerable abort() into qemu_log_mask()
  2026-07-10 14:27 [PATCH] hw/usb/hcd-xhci: Turn guest-triggerable abort() into qemu_log_mask() Thomas Huth
@ 2026-07-10 14:36 ` Philippe Mathieu-Daudé
  2026-07-10 14:40   ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-07-10 14:36 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel
  Cc: qemu-trivial, Daniel P . Berrangé, Gerd Hoffmann

On 10/7/26 16:27, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> The FIXME macros in xhci_alloc_device_streams() can be triggered
> by a (malicious) guest. Since the macro also contains an abort()
> statement, this terminates QEMU. Turn the FIXME statements into
> a qemu_log_mask() instead to avoid that a guest can shoot itself
> this way.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3784
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/usb/hcd-xhci.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
> index 2cdab3ba0e4..9ff50d0b7f9 100644
> --- a/hw/usb/hcd-xhci.c
> +++ b/hw/usb/hcd-xhci.c
> @@ -965,11 +965,13 @@ static TRBCCode xhci_alloc_device_streams(XHCIState *xhci, unsigned int slotid,
>            * together and make an usb_device_alloc_streams call per group.
>            */
>           if (epctxs[i]->nr_pstreams != req_nr_streams) {
> -            FIXME("guest streams config not identical for all eps");
> +            qemu_log_mask(LOG_GUEST_ERROR,
> +                          "guest streams config not identical for all eps");

With trailing \n:

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

>               return CC_RESOURCE_ERROR;
>           }
>           if (eps[i]->max_streams != dev_max_streams) {
> -            FIXME("device streams config not identical for all eps");
> +            qemu_log_mask(LOG_GUEST_ERROR,
> +                          "device streams config not identical for all eps");
>               return CC_RESOURCE_ERROR;
>           }
>       }



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/usb/hcd-xhci: Turn guest-triggerable abort() into qemu_log_mask()
  2026-07-10 14:36 ` Philippe Mathieu-Daudé
@ 2026-07-10 14:40   ` Thomas Huth
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2026-07-10 14:40 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Daniel P . Berrangé, Gerd Hoffmann

On 10/07/2026 16.36, Philippe Mathieu-Daudé wrote:
> On 10/7/26 16:27, Thomas Huth wrote:
>> From: Thomas Huth <thuth@redhat.com>
>>
>> The FIXME macros in xhci_alloc_device_streams() can be triggered
>> by a (malicious) guest. Since the macro also contains an abort()
>> statement, this terminates QEMU. Turn the FIXME statements into
>> a qemu_log_mask() instead to avoid that a guest can shoot itself
>> this way.
>>
>> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3784
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   hw/usb/hcd-xhci.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
>> index 2cdab3ba0e4..9ff50d0b7f9 100644
>> --- a/hw/usb/hcd-xhci.c
>> +++ b/hw/usb/hcd-xhci.c
>> @@ -965,11 +965,13 @@ static TRBCCode xhci_alloc_device_streams(XHCIState 
>> *xhci, unsigned int slotid,
>>            * together and make an usb_device_alloc_streams call per group.
>>            */
>>           if (epctxs[i]->nr_pstreams != req_nr_streams) {
>> -            FIXME("guest streams config not identical for all eps");
>> +            qemu_log_mask(LOG_GUEST_ERROR,
>> +                          "guest streams config not identical for all eps");
> 
> With trailing \n:

D'oh! Thanks!

I just noticed that I also forgot to add a "Reported-by" line to the 
description. I'll send a v2...

> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Thanks!

  Thomas



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-10 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 14:27 [PATCH] hw/usb/hcd-xhci: Turn guest-triggerable abort() into qemu_log_mask() Thomas Huth
2026-07-10 14:36 ` Philippe Mathieu-Daudé
2026-07-10 14:40   ` Thomas Huth

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.