From nobody Mon Apr 29 05:49:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620220501; cv=none; d=zohomail.com; s=zohoarc; b=hqJhW+yANKbjAS/bOhn76I7wLgUqInk4KNJCFk3JTvrBghiJz7310Z4Njuo6f2ZurxehpmOSikHCIsEshPOF44zAp7DUOsOaEefpFdFz6mRTFv3WtBOQCC3QMEDlfEXNnxij08AJJ9d1h0bPh+QTEyBJ5K2XSoSRpLhWMDdaxfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620220501; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eJ+YtCn15wCy4YJYX/B7Kmrq/ewOQZctunu38ZfuKhE=; b=BpoMS+lzPqpFv4PQq3sz+BoQWFzY2m3oGSIVJ0mPIosd1ZIE1aS7Oc5xzExRz2JdUHdmPrhPKi6hzcJIMckp+pZ5vzzkjo+Pn5gIAVRqMOqXxiMvuZ3SxRr53navh2yQlWAfhEAdBHPACaROFEPyTnIr7Pdirp0Bjm5V592bF0o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620220501765953.0313954174443; Wed, 5 May 2021 06:15:01 -0700 (PDT) Received: from localhost ([::1]:47424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leHMi-0004EX-L4 for importer@patchew.org; Wed, 05 May 2021 09:15:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFP-00031f-Ru for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFO-0000YW-Ak for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-33-OGshXMU7OYSrkw4j0fqfXw-1; Wed, 05 May 2021 09:07:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8CF40824FAF; Wed, 5 May 2021 13:07:21 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC64960875; Wed, 5 May 2021 13:07:17 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 792F5180079E; Wed, 5 May 2021 15:07:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620220045; 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; bh=eJ+YtCn15wCy4YJYX/B7Kmrq/ewOQZctunu38ZfuKhE=; b=aywrsFKtjnb4vXc9GjLjQOUO/DVm3s5FLHapB1AqU3BZl86pl2VnxKTNGvD0SYHhld00Tt 9VUQ8oJeA56dpdJBfJWdfJRGIGl6jtEkXFJuwWtoifD1/kA/LB6fh5+BfpeOmr0tM+NiQq 3/5CvxutH/NVIzbWD9FHXYI66Xi8LxU= X-MC-Unique: OGshXMU7OYSrkw4j0fqfXw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 1/6] hw/usb/host-stub: Remove unused header Date: Wed, 5 May 2021 15:07:11 +0200 Message-Id: <20210505130716.1128420-2-kraxel@redhat.com> In-Reply-To: <20210505130716.1128420-1-kraxel@redhat.com> References: <20210505130716.1128420-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.693, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210424224110.3442424-2-f4bug@amsat.org> Signed-off-by: Gerd Hoffmann --- hw/usb/host-stub.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/usb/host-stub.c b/hw/usb/host-stub.c index 538ed29684cb..80809ceba542 100644 --- a/hw/usb/host-stub.c +++ b/hw/usb/host-stub.c @@ -31,7 +31,6 @@ */ =20 #include "qemu/osdep.h" -#include "ui/console.h" #include "hw/usb.h" #include "monitor/monitor.h" =20 --=20 2.31.1 From nobody Mon Apr 29 05:49:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620220447; cv=none; d=zohomail.com; s=zohoarc; b=lAumpYP/yWgssqeIDr4ABu7BQBZJBl2Tc3w9Wy6gDVqSYQc0+nuWkm8CKLp74S4/ZazphGh1g64EFzqTWJIqD8xLiEvVFjpLwdgHFD4gT8y1tmT0k8Qi2gR2N4kd6Da4YTkNGoEV2WJM/JxXdQFADuXylEmKvF5fLVi7ATobmRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620220447; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7I6nvE9PgDTqJtNi5ocnpmYow/E+zwmJsA5Y+dscM/s=; b=OhnYvNwa2qgcMr4iZtivTJ1FnCEzDLAKjESeYPQHwllvAm96b5iy1bWNApOmjd9rSeUFHO8pvEpx150aRleBbnDBGSgWZs0aKMHgLGk9lKPcmRwbs4W4BNJeDoah4oBnIMXWEtvOUODTNKSLhGY3rhM9LxP1XyMJomrAtlmus14= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620220447921103.18982941119123; Wed, 5 May 2021 06:14:07 -0700 (PDT) Received: from localhost ([::1]:44820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leHLr-00038u-8B for importer@patchew.org; Wed, 05 May 2021 09:14:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFV-0003Fl-60 for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFR-0000ad-Ap for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-491-CnpQyyJLOnezNl1AhMEt-g-1; Wed, 05 May 2021 09:07:26 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8DF48107ACCD; Wed, 5 May 2021 13:07:25 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E98DE5D9C0; Wed, 5 May 2021 13:07:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 89E1B18007A1; Wed, 5 May 2021 15:07:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620220048; 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; bh=7I6nvE9PgDTqJtNi5ocnpmYow/E+zwmJsA5Y+dscM/s=; b=AqEZ/Po8RDxHlAPfw2k9Jtaxh6yljdFpTdAdRFJIxygtJOAqsc+wBw+WI9mOMqJgRho+QC ZuMqd/EAfZMVNK9RxkNUe2NAxOTAU2A7oU9/2RiK17rjFs2hb5Ac0WiAtRB8JjZ37NRRx7 JIEoiCIFFbLXeBK4lVBddZPrCLfu4fc= X-MC-Unique: CnpQyyJLOnezNl1AhMEt-g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 2/6] hw/usb: Do not build USB subsystem if not required Date: Wed, 5 May 2021 15:07:12 +0200 Message-Id: <20210505130716.1128420-3-kraxel@redhat.com> In-Reply-To: <20210505130716.1128420-1-kraxel@redhat.com> References: <20210505130716.1128420-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.693, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 If the Kconfig 'USB' value is not selected, it is pointless to build the USB core components. Add a stub for the HMP commands and usbdevice_create() which is called by usb_device_add in softmmu/vl.c. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210424224110.3442424-3-f4bug@amsat.org> Signed-off-by: Gerd Hoffmann --- stubs/usb-dev-stub.c | 25 +++++++++++++++++++++++++ MAINTAINERS | 1 + hw/usb/meson.build | 9 +++------ stubs/meson.build | 1 + 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 stubs/usb-dev-stub.c diff --git a/stubs/usb-dev-stub.c b/stubs/usb-dev-stub.c new file mode 100644 index 000000000000..b1adeeb4548d --- /dev/null +++ b/stubs/usb-dev-stub.c @@ -0,0 +1,25 @@ +/* + * QEMU USB device emulation stubs + * + * Copyright (C) 2021 Philippe Mathieu-Daud=C3=A9 + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "sysemu/sysemu.h" +#include "monitor/monitor.h" +#include "hw/usb.h" + +USBDevice *usbdevice_create(const char *driver) +{ + error_report("Support for USB devices not built-in"); + + return NULL; +} + +void hmp_info_usb(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "Support for USB devices not built-in\n"); +} diff --git a/MAINTAINERS b/MAINTAINERS index 4c05ff8bbabd..6f7e5db3b102 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1804,6 +1804,7 @@ USB M: Gerd Hoffmann S: Maintained F: hw/usb/* +F: stubs/usb-dev-stub.c F: tests/qtest/usb-*-test.c F: docs/usb2.txt F: docs/usb-storage.txt diff --git a/hw/usb/meson.build b/hw/usb/meson.build index fb7a74e73ae8..f357270d0b6b 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -1,17 +1,14 @@ hw_usb_modules =3D {} =20 # usb subsystem core -softmmu_ss.add(files( +softmmu_ss.add(when: 'CONFIG_USB', if_true: files( 'bus.c', 'combined-packet.c', 'core.c', - 'pcap.c', - 'libhw.c' -)) - -softmmu_ss.add(when: 'CONFIG_USB', if_true: files( 'desc.c', 'desc-msos.c', + 'libhw.c', + 'pcap.c', )) =20 # usb host adapters diff --git a/stubs/meson.build b/stubs/meson.build index be6f6d609e58..3faef16892be 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -50,6 +50,7 @@ if have_block endif if have_system stub_ss.add(files('semihost.c')) + stub_ss.add(files('usb-dev-stub.c')) stub_ss.add(files('xen-hw-stub.c')) else stub_ss.add(files('qdev.c')) --=20 2.31.1 From nobody Mon Apr 29 05:49:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620220289; cv=none; d=zohomail.com; s=zohoarc; b=Ru88ARYeLQtxd4XLltp+eyb8NLpX3UfVz2aKQYsKPggaRS6zDx5sLWsFukAPs42F7Eu8gOqFpNibmBPyaNdTmab/7IcW9tGDT1cLwRG+PEZt8b5+jDieS8pDNwLs+qh3AHRZKirun9olTDcPKhBF1ZbuNoo0hzfquOjmGSiJJjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620220289; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MG8+HLYcLD6OQYXdck3O/eW9YnIf4YN4tJ6E6N4FxpQ=; b=dOXupWk1KNquqZQvjAVi2EEg4Cv+b9B+oApXNBk7lKDB9/B6I9fOZvLWBkIRsaPgUWoLLR5+jUX8sFNTGnbjhbsjCXSo8WvgF32mPjecXVkz1N+O1B0Ue78jvdmMTR5Pe766IyQuPwmfFn6HRn90dyzPBNHpL5lcefYrnOvQDa0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16202202893151.4614708476088936; Wed, 5 May 2021 06:11:29 -0700 (PDT) Received: from localhost ([::1]:36446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leHJI-0008Bn-5Y for importer@patchew.org; Wed, 05 May 2021 09:11:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFQ-00034a-R6 for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFO-0000Yd-IN for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-327-SI7E-ga8MOeS8X10gmi9Lg-1; Wed, 05 May 2021 09:07:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 708926D4E0 for ; Wed, 5 May 2021 13:07:23 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3776E60875; Wed, 5 May 2021 13:07:23 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 963CD18007A2; Wed, 5 May 2021 15:07:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620220046; 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; bh=MG8+HLYcLD6OQYXdck3O/eW9YnIf4YN4tJ6E6N4FxpQ=; b=Pm5+/y5KWtLm3+Yd05d/3dKfxrG2T6PDC/tBn4OHtk4wRKf1G5zbDpHQYc+RXgHFj4cNMp lXg+qTmUSZ8jJg+g8Aqn1aTk6vYj3GwzxmufH6m6kMUDMpe7rFUGIhq28woTVZ9qKY5hQ+ oaaSZKEHym3dE/1CgiORwc7NGnF8oSI= X-MC-Unique: SI7E-ga8MOeS8X10gmi9Lg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 3/6] usb/hid: avoid dynamic stack allocation Date: Wed, 5 May 2021 15:07:13 +0200 Message-Id: <20210505130716.1128420-4-kraxel@redhat.com> In-Reply-To: <20210505130716.1128420-1-kraxel@redhat.com> References: <20210505130716.1128420-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.693, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Use autofree heap allocation instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210503132915.2335822-2-kraxel@redhat.com> --- hw/usb/dev-hid.c | 2 +- hw/usb/dev-wacom.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index fc39bab79f94..1c7ae97c3033 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -656,7 +656,7 @@ static void usb_hid_handle_data(USBDevice *dev, USBPack= et *p) { USBHIDState *us =3D USB_HID(dev); HIDState *hs =3D &us->hid; - uint8_t buf[p->iov.size]; + g_autofree uint8_t *buf =3D g_malloc(p->iov.size); int len =3D 0; =20 switch (p->pid) { diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c index b59504863509..ed687bc9f1eb 100644 --- a/hw/usb/dev-wacom.c +++ b/hw/usb/dev-wacom.c @@ -301,7 +301,7 @@ static void usb_wacom_handle_control(USBDevice *dev, US= BPacket *p, static void usb_wacom_handle_data(USBDevice *dev, USBPacket *p) { USBWacomState *s =3D (USBWacomState *) dev; - uint8_t buf[p->iov.size]; + g_autofree uint8_t *buf =3D g_malloc(p->iov.size); int len =3D 0; =20 switch (p->pid) { --=20 2.31.1 From nobody Mon Apr 29 05:49:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620220304; cv=none; d=zohomail.com; s=zohoarc; b=fN2muy1QIIJFgZ/ydeo3Rp9NV1Ya21JVD/0R3DOeDycqtCZ6VTOdIsK5qn8FkDv54+NVYfzzDWiBKjRN0zsAP0WdMoB8N9EDoOXoqYZL+pm7RSlboVEX5xKs4Ww0e9bJkep0YBOo9KAX8G+1JV7wef04GZ73HF766YwEmNe70kI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620220304; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nPYwBw46BnBLKZc2EQxjso6vQ9RVFrLDdA1GUaPYS10=; b=i6XtCm0u+ADnmdsdOmFJWdyqPA8GFOj4uIjGJGLVm1+Qmtfv+K8on9DAxFOzfW9ah5MbURWHIpBDYOYGJRpnJ6N7tnafW4NW+G50FAlxJjRK7gTdshGRzjG8Dyl82EdipMDEIXaa4h9o9cHLvMbSrYYpqEcZjhlBrFIvO3hSpHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620220304305114.12487028656142; Wed, 5 May 2021 06:11:44 -0700 (PDT) Received: from localhost ([::1]:37630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leHJW-0000Dy-Uo for importer@patchew.org; Wed, 05 May 2021 09:11:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFW-0003IF-5X for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFT-0000bU-Ds for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:33 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-LE1E4cgRMmuO8pEZ53aKjQ-1; Wed, 05 May 2021 09:07:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7574280293C for ; Wed, 5 May 2021 13:07:28 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 009B25D703; Wed, 5 May 2021 13:07:24 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A110518007A3; Wed, 5 May 2021 15:07:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620220050; 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; bh=nPYwBw46BnBLKZc2EQxjso6vQ9RVFrLDdA1GUaPYS10=; b=OIbOQjIONjejJRownG66McTm92wtGWQrs/B7MOvQNYMrUfSHf9cW+Xf7gJzMw5WplICrEM xvoM6iJAQFklejxLRYUjDerGARMi68FqmNyoCItkPiKjd0jaRWC/1ZxmFrKYNQinHTcVKz 2nCFhwh58S+YUnYhgNmdN39of5u6PBU= X-MC-Unique: LE1E4cgRMmuO8pEZ53aKjQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 4/6] usb/redir: avoid dynamic stack allocation (CVE-2021-3527) Date: Wed, 5 May 2021 15:07:14 +0200 Message-Id: <20210505130716.1128420-5-kraxel@redhat.com> In-Reply-To: <20210505130716.1128420-1-kraxel@redhat.com> References: <20210505130716.1128420-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.693, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Use autofree heap allocation instead. Fixes: 4f4321c11ff ("usb: use iovecs in USBPacket") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Gerd Hoffmann Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210503132915.2335822-3-kraxel@redhat.com> --- hw/usb/redirect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 17f06f34179a..6a75b0dc4ab2 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -620,7 +620,7 @@ static void usbredir_handle_iso_data(USBRedirDevice *de= v, USBPacket *p, .endpoint =3D ep, .length =3D p->iov.size }; - uint8_t buf[p->iov.size]; + g_autofree uint8_t *buf =3D g_malloc(p->iov.size); /* No id, we look at the ep when receiving a status back */ usb_packet_copy(p, buf, p->iov.size); usbredirparser_send_iso_packet(dev->parser, 0, &iso_packet, @@ -818,7 +818,7 @@ static void usbredir_handle_bulk_data(USBRedirDevice *d= ev, USBPacket *p, usbredirparser_send_bulk_packet(dev->parser, p->id, &bulk_packet, NULL, 0); } else { - uint8_t buf[size]; + g_autofree uint8_t *buf =3D g_malloc(size); usb_packet_copy(p, buf, size); usbredir_log_data(dev, "bulk data out:", buf, size); usbredirparser_send_bulk_packet(dev->parser, p->id, @@ -923,7 +923,7 @@ static void usbredir_handle_interrupt_out_data(USBRedir= Device *dev, USBPacket *p, uint8_t ep) { struct usb_redir_interrupt_packet_header interrupt_packet; - uint8_t buf[p->iov.size]; + g_autofree uint8_t *buf =3D g_malloc(p->iov.size); =20 DPRINTF("interrupt-out ep %02X len %zd id %"PRIu64"\n", ep, p->iov.size, p->id); --=20 2.31.1 From nobody Mon Apr 29 05:49:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620220788; cv=none; d=zohomail.com; s=zohoarc; b=JSzTpHZsmYabzpTBxAvBqOLY/dJA8k92oDVZRVAR/zS9dkgval2IIshkzrvXnUghx8i4aknntKSuXzlqXg7mn4Ftq8Mp+Y0iSOd1OAITeuKv0bEPS3PQ9y8aav1zvV/IXoUAAD01lPekFtX00m1m+qUoJItHlkdvelHqMtuoOXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620220788; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5iBUj/I7FT92H26S+L0vtNiLZUhLn9iF24YepnZ/+EQ=; b=c4s/xROGetNMh/dZoZlvjr7MR3hGLcCpbD+8dMqNCjRvqk4Z5Vm7a3ULeCMwLKRW9L9xIzJhZ0pmAnC1olQqgjE2cJ9+7NhnNSaY8PDoy/twJzBQsxMDYC8icruA4JZTI0lEqsy35q3fcuWgZQI9S3Ml2HW0K6ScV7/am4l2gMg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620220788816788.0530850456416; Wed, 5 May 2021 06:19:48 -0700 (PDT) Received: from localhost ([::1]:57372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leHRM-0008Rp-2O for importer@patchew.org; Wed, 05 May 2021 09:19:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFa-0003Td-PL for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFX-0000ea-0r for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:38 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-yPFtmae_PkiUUoOvJLVd5A-1; Wed, 05 May 2021 09:07:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D2356D4E0 for ; Wed, 5 May 2021 13:07:32 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2BA1B60C17; Wed, 5 May 2021 13:07:27 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AB94D18007A4; Wed, 5 May 2021 15:07:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620220054; 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; bh=5iBUj/I7FT92H26S+L0vtNiLZUhLn9iF24YepnZ/+EQ=; b=C7KyJ14aSGGqB1qhfxYHIyDwfNpvodIbMqnQ81nJEjiA633Lb4diaachXf0c8PWU44t9mu h2bGLWetAsl67c0juLR3CrYEpZMZRtzSo/TM/By5ZVtikW6DcKTFNWp9yGqHMAGL2mP3Q6 ZY9nq255i+FxukOD1eAwMgkmhfCBgAg= X-MC-Unique: yPFtmae_PkiUUoOvJLVd5A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 5/6] usb/mtp: avoid dynamic stack allocation Date: Wed, 5 May 2021 15:07:15 +0200 Message-Id: <20210505130716.1128420-6-kraxel@redhat.com> In-Reply-To: <20210505130716.1128420-1-kraxel@redhat.com> References: <20210505130716.1128420-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.693, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Use autofree heap allocation instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210503132915.2335822-4-kraxel@redhat.com> --- hw/usb/dev-mtp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index bbb827434482..2a895a73b083 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -907,7 +907,8 @@ static MTPData *usb_mtp_get_object_handles(MTPState *s,= MTPControl *c, MTPObject *o) { MTPData *d =3D usb_mtp_data_alloc(c); - uint32_t i =3D 0, handles[o->nchildren]; + uint32_t i =3D 0; + g_autofree uint32_t *handles =3D g_new(uint32_t, o->nchildren); MTPObject *iter; =20 trace_usb_mtp_op_get_object_handles(s->dev.addr, o->handle, o->path); --=20 2.31.1 From nobody Mon Apr 29 05:49:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620220698; cv=none; d=zohomail.com; s=zohoarc; b=bBICQHPGdjJz63e8rDu/VIbdWJYdSJIlh0Pes9fpftQ0fXjNdzY3xBmWwcKqmMjmrlaWYZi/xU0iTYtNmD1MpSzhcELuIwcZkjzK6omsxxvFyVNKvttL1+4ZAlUYsm52vMclwg5s/3qMoNspKwmbRIbT9pHyEwnSCXihWDUezeI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620220698; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ml9dSvV90BoAjVYGJB+DWuOm7SdKQR3W5okVQfvcDxQ=; b=kyQWrP2LVPcQv6VuxbxCBds5q5j2cI9HZQ+JqpwbJnqrTjcN8Q/XU2fkR0j1LhdJWKeFA1ZD+p25ENNsvoiqR5j1xvWqfTegPDZtKonBF1UhTKSOU+Tka+n2ksljNtcS8lrBn1ZmXAYToZTkUikiKt+prr7GsXitZhvPweYUthA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620220698502426.1140435663593; Wed, 5 May 2021 06:18:18 -0700 (PDT) Received: from localhost ([::1]:53632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leHPt-0006tr-Cs for importer@patchew.org; Wed, 05 May 2021 09:18:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFX-0003Kr-4D for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leHFV-0000cd-9g for qemu-devel@nongnu.org; Wed, 05 May 2021 09:07:34 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-McRSSZ0IN-S9vs4AhmI7Fw-1; Wed, 05 May 2021 09:07:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 69CFA1006C80 for ; Wed, 5 May 2021 13:07:30 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30D895D703; Wed, 5 May 2021 13:07:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B693218007A5; Wed, 5 May 2021 15:07:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620220052; 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; bh=Ml9dSvV90BoAjVYGJB+DWuOm7SdKQR3W5okVQfvcDxQ=; b=YMiarEv/M4QG2k9Rhzn4MsLLzgC/RVfTSZmWM4TpDkMK6K8vQJRWdEThACynCyIduD3AbR 8cbcKyKIf7sfP9MshbtZNx/pi3XaDLPNfhwLe5gU2r/jSUqzwMBGYasWE9npI8Qt0uASBN XOJCqYifP5ib1LuOK+bVdPTWQpiGmOE= X-MC-Unique: McRSSZ0IN-S9vs4AhmI7Fw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 6/6] usb: limit combined packets to 1 MiB (CVE-2021-3527) Date: Wed, 5 May 2021 15:07:16 +0200 Message-Id: <20210505130716.1128420-7-kraxel@redhat.com> In-Reply-To: <20210505130716.1128420-1-kraxel@redhat.com> References: <20210505130716.1128420-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.693, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" usb-host and usb-redirect try to batch bulk transfers by combining many small usb packets into a single, large transfer request, to reduce the overhead and improve performance. This patch adds a size limit of 1 MiB for those combined packets to restrict the host resources the guest can bind that way. Signed-off-by: Gerd Hoffmann Message-Id: <20210503132915.2335822-6-kraxel@redhat.com> --- hw/usb/combined-packet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c index 5d57e883dcb5..e56802f89a32 100644 --- a/hw/usb/combined-packet.c +++ b/hw/usb/combined-packet.c @@ -171,7 +171,9 @@ void usb_ep_combine_input_packets(USBEndpoint *ep) if ((p->iov.size % ep->max_packet_size) !=3D 0 || !p->short_not_ok= || next =3D=3D NULL || /* Work around for Linux usbfs bulk splitting + migration = */ - (totalsize =3D=3D (16 * KiB - 36) && p->int_req)) { + (totalsize =3D=3D (16 * KiB - 36) && p->int_req) || + /* Next package may grow combined package over 1MiB */ + totalsize > 1 * MiB - ep->max_packet_size) { usb_device_handle_data(ep->dev, first); assert(first->status =3D=3D USB_RET_ASYNC); if (first->combined) { --=20 2.31.1