Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A05AC43458 for ; Mon, 13 Jul 2026 09:48:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wjDHG-0001uO-7q; Mon, 13 Jul 2026 05:48:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wjDH9-0001r6-4Q for qemu-devel@nongnu.org; Mon, 13 Jul 2026 05:48:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wjDH7-0003hJ-DY for qemu-devel@nongnu.org; Mon, 13 Jul 2026 05:48:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783936112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=pRZT4NuvWIAeHFE2GhlNeOk0wqZ0JLM90ntjUcxEA1w=; b=HHPtb4rYMcFC4Zxrv8qApCrNMcb7bUmfAO2gLZ8R7j3+LsSjlPh6zw+tsmTUdKfM+GKIlD Rfk9X+LX1/6mdkW2uptcFgSabGDHwJWoa8oROuCrrOkTAFMNDdU4E/rG9LzC8aHIcbLSs4 5EbCsgFMt/7CcKPGwWzruIsphNHMpDc= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-RtLFQLwvOc26yejeev8EPg-1; Mon, 13 Jul 2026 05:48:30 -0400 X-MC-Unique: RtLFQLwvOc26yejeev8EPg-1 X-Mimecast-MFC-AGG-ID: RtLFQLwvOc26yejeev8EPg_1783936109 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-493e9ea2c77so23347705e9.0 for ; Mon, 13 Jul 2026 02:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1783936109; x=1784540909; darn=nongnu.org; h=content-transfer-encoding:content-type:in-reply-to:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to:content-type; bh=pRZT4NuvWIAeHFE2GhlNeOk0wqZ0JLM90ntjUcxEA1w=; b=FvcVBdCqSOd2v066hGQli1+ppc6JBQZqGcMxuhZI9+hsJdZukCWP0KaZBP1s2i7pvk 2RL6e8MMxC1ZcsXY2C5ZHLa1Y83Ike2QAt2oqctSmhL8EFLaY/zst59rmD20qTdt9e+D +OeEJkdf8P3zjRVArpBoVd+nsG0AGSXx/azlZRm9ZRvOIqJA1F4+aDuWUQ9Wa/4PxEJW XgbdtGYeyX6p7+y0vuCyYFmTOxkUXYyLHkQRFdYQz9zTEeRn1FX2Bc41xdZnjyvSFVsx P+1HUlJEuGt4arShSHFbzOwr4A2iALgul1pdTxOyQa8ayR/8JkkMgS7FnvAEQWP4PG20 FJlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783936109; x=1784540909; h=content-transfer-encoding:content-type:in-reply-to:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type;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P id 5b1f17b1804b1-493f87e5a53mr87224045e9.14.1783936109494; Mon, 13 Jul 2026 02:48:29 -0700 (PDT) X-Received: by 2002:a05:600c:8285:b0:492:41c9:886b with SMTP id 5b1f17b1804b1-493f87e5a53mr87223775e9.14.1783936109070; Mon, 13 Jul 2026 02:48:29 -0700 (PDT) Received: from ?IPV6:2a01:599:b03:293:fac1:f1ba:b82b:441e? ([2a01:599:b03:293:fac1:f1ba:b82b:441e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47a9de1e736sm88781849f8f.7.2026.07.13.02.48.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jul 2026 02:48:28 -0700 (PDT) Message-ID: Date: Mon, 13 Jul 2026 11:48:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] hw/usb/hcd-xhci: Turn guest-triggerable abort() into qemu_log_mask() To: Peter Maydell Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org, qemu-stable@nongnu.org, =?UTF-8?Q?Daniel_P_=2E_Berrang=C3=A9?= , Gerd Hoffmann , =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= References: <20260710144327.600572-1-thuth@redhat.com> From: Thomas Huth Content-Language: en-US Autocrypt: addr=thuth@redhat.com; keydata= xsFNBFH7eUwBEACzyOXKU+5Pcs6wNpKzrlJwzRl3VGZt95VCdb+FgoU9g11m7FWcOafrVRwU yYkTm9+7zBUc0sW5AuPGR/dp3pSLX/yFWsA/UB4nJsHqgDvDU7BImSeiTrnpMOTXb7Arw2a2 4CflIyFqjCpfDM4MuTmzTjXq4Uov1giGE9X6viNo1pxyEpd7PanlKNnf4PqEQp06X4IgUacW tSGj6Gcns1bCuHV8OPWLkf4hkRnu8hdL6i60Yxz4E6TqlrpxsfYwLXgEeswPHOA6Mn4Cso9O 0lewVYfFfsmokfAVMKWzOl1Sr0KGI5T9CpmRfAiSHpthhHWnECcJFwl72NTi6kUcUzG4se81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r2cK2weInTBwXwqVWjsXZ4tq5+jQrwDK cvxIcwXdUTLGxc4/Z/VRH1PZSvfQxdxMGmNTGaXVNfdFZjm4fz0mz+OUi6AHC4CZpwnsliGV ODqwX8Y1zic9viSTbKS01ZNp175POyWViUk9qisPZB7ypfSIVSEULrL347qY/hm9ahhqmn17 Ng255syASv3ehvX7iwWDfzXbA0/TVaqwa1YIkec+/8miicV0zMP9siRcYQkyTqSzaTFBBmqD oiT+z+/E59qj/EKfyce3sbC9XLjXv3mHMrq1tKX4G7IJGnS989E/fg6crv6NHae9Ckm7+lSs IQu4bBP2GxiRQ+NV3iV/KU3ebMRzqIC//DCOxzQNFNJAKldPe/bKZMCxEqtVoRkuJtNdp/5a yXFZ6TfE1hGKrDBYAm4vrnZ4CXFSBDllL59cFFOJCkn4Xboj/aVxxJxF30bn In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: permerror client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, T_SPF_PERMERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 10/07/2026 17.35, Peter Maydell wrote: > On Fri, 10 Jul 2026 at 15:44, Thomas Huth wrote: >> >> From: Thomas Huth >> >> 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. >> >> Reported-by: Feifan Qian >> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3784 >> Reviewed-by: Philippe Mathieu-Daudé >> Signed-off-by: Thomas Huth >> --- >> 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..002f801348f 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\n"); >> 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\n"); >> return CC_RESOURCE_ERROR; > > I get the impression from the comment that these cases are not > guest errors, but unimplemented QEMU support for a corner case > of the spec, so should be LOG_UNIMP. I had a quick look through > the XHCI spec, and it seems to define the streams handling > purely as a per-endpoint thing, making it valid for a device > to have multiple endpoints with different max streams settings. > It's just that it doesn't happen in practice so we haven't > implemented the "group identical endpoints and call > usb_device_alloc_streams for each group" solution the comment > sketches out. > > Incidentally, there is just one remaining use of the FIXME macro > in this file: the "unhandled USB_RET_*" default case in > xhci_try_complete_packet(). I think we could (as a separate patch) > replace that with g_assert_not_reached(), because the function > handles all the USB_RET_* values except for USB_RET_ADD_TO_QUEUE and > USB_RET_REMOVE_FROM_QUEUE, which are both internal return > values for when an async packet needs to be queued or dequeued, > and which (I believe) shouldn't still be the status by the time we > get to this function. > > There's also one raw printf that should be a LOG_UNIMP: > fprintf(stderr, "xhci: FIXME: secondary streams not implemented yet"); Thanks, Peter, these are good suggestions, I'll send a v3 and patches for the other things that you've spotted. Thomas