From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827808; cv=none; d=zohomail.com; s=zohoarc; b=JvNNLhAv+6DkObt+iSekojZvS7Hp7CRW3IW4kPyLLTH4OinSUeAXe4YogPWT0DqPVu9AJasky6IuOTvrRTE5FjDF9MJ6AQrqwjU4wCzv1MH2j6gln3gI26hkYI94nDOed0PawugO55HY/UQkUqR/xkdEA9/vt/CXN8Nz2YV4aJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827808; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=ga/sbnWQ8Rp+xdNe/cHzOy1FCcskcCSsEElXR/zwWWM=; b=gB3gJzbeQpdYgWXdkM28MYvIyJ/+mdqQy2AgRGxIGz6HwFcYPjYVCT9zyVrSmTFy2no8qXJIqLiEEinisnh1+EHGPr92I8WnwXUDcADYQw9UY9WKwMZZ2WjAu06ZPQmLM/17Pq014Rx+uENTKCxjIt11gdUEoUcJeE4nNAKAWRY= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827808691787.0202705929438; Mon, 16 Nov 2026 03:16:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueQ-0003r4-HP; Mon, 16 Nov 2026 06:13:32 -0500 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 1xSueF-0003p0-Tu for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueB-00027e-Hw for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-490d59c3edaso1957827f8f.1 for ; Mon, 16 Nov 2026 03:13:07 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827587; x=1795432387; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=ga/sbnWQ8Rp+xdNe/cHzOy1FCcskcCSsEElXR/zwWWM=; b=rCxVS+8Gm1rFLfwsHZ6QegHqFPx2i5fOn4FSZfg5yrZ/zXrB79ZQFTBm89G0VK7XBz 8T5SdsQYTVpoewCWuOerldzlItMGVAnBmqkRgnEf6TG0HKo5VvWShaGNqpVuT57FY4kp OZp1EMtkSGOBcEImt7pAxE4fCNU7Vf7tqUydJJnHSZtQhbWOoXZOB7/SHlgIkkq3U7RA pUVljgAKjUHvLAg3UOSFidg0TWcQXt0/9RGdouFBGeH/54CvEKGY8BLkfiEVYv5nsc3t yKTFWFVCkV7lxCkV/CjXHGhv4pLZ7uIYzRDGN6w9NhbyD943E97YSmlHqen7FeVJ8LZ2 splQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827587; x=1795432387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=ga/sbnWQ8Rp+xdNe/cHzOy1FCcskcCSsEElXR/zwWWM=; b=lun1IavqNi9DHTKVyyG8DXhv5tTlhw1cVjuM//4JU5Ly5XWtLyht+UYo0m4RVMpQ5F q5hGN5nKjHzeIRH0CBBsaAqTu90lwpWCuARRUfHL4xIr0t9OEOV2mOL8AHEtCzu4LDrG L8JtpFTEPBWkXXL3PwXWUzf1Xap+cLc9aNDtDENoVQV/X0nk+la5yMfn9OOUzqXXCcPh 3lKO79kiyii3AWNSbnlfgNuGcCOX+sEznmlEa/KDM+mbAZCbi+8qMLLXllliDtU3zEIb ViO+1zD4EH7z1+wsbnn6IN19l76Uv98DJhU+X5hs1g/xSty9GDJtMA3LMsMhbtsv/sIy STtg== X-Gm-Message-State: APuU4Z9kfbWd+UKMv1uu5rALhjiHd6h2fTYtZOb5cqlbMGjM0CeIqpba pCxITXATJ9e0bZVu3s+nOMMaHm5nNMDmJZa7fF3/JJLX1LA+8XDxK0vWAjnv7Jb0AtLaHq3HUvn tane/G/o= X-Gm-Gg: AZFdTZdWF2rEY+/iqOnCl7Zs3iEt/dwIoBVDFwS6eZYeIwHWHhkEA/QKRyFJnuH3MBi 9PvQrltMMeiLuAtLk5QSg+KtYUDqK2ExmOhF/3Cg8QsfHa+Px+Nx6TZ51ykD/pxD1Ik38/0DXca sFRYc+p/2M6rcx/l29Ge1JxuLMd665iuL/uRNzt8G9+cP2GBP7feZ6xexyLpbpQsCnkQ+XHoJyw GbspzOfy4vP5foSv48ebPINZ9CycsHr0haODVnl++4Q3Ble9GJ+v02qs6Lc5QlINMS+t5GCEy5C tfkwd+o6DFvsQ8VY2pcBB4xZX3yJj4WWn7cZ8teZksKwE6LF+zA0qnfbZuMtYElv94uu8Q1LMV4 zXVnfONyt4HSoeeA5GBrDPgTheBj0Lf/OcSBDCOmI4IPHOLL221UXbNb+ZYr9fpbxM+zf2h+La/ qfcuGG7F2g2CjcCG9J3NmclQfvYLtqVFZkiR4nYFlQwd9McHIq03LdXGbgDdjruIt15ndzzjc7D rkRb553wL355EOGn9l5AkWli+kV4akSLsvX7cpfLomjJiQONv9pochXazXJgOHlV4GtjQHxiFYO YpnwxgyQgsHrXfiWBe/4a+necVcOVmS7a8AJeGoA/hCV9amvZZgt6m8i8BS5WzwO/ze46cklLmN n2gGYXnY9yy+AkocC7s5t8eaiyzjraFFBh3dIb0uamDIxrcxnFYrNBeE= X-Received: by 2002:a05:6000:4211:b0:498:364d:7509 with SMTP id ffacd0b85a97d-49b02d4cd48mr32112594f8f.24.1794827586600; Mon, 16 Nov 2026 03:13:06 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/33] hw/ssi/stm32f2xx_spi: avoid transferring data on DR reads Date: Mon, 16 Nov 2026 11:12:31 +0000 Message-ID: <20261116111303.1692832-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827809188158500 Content-Type: text/plain; charset="utf-8" From: Manuele Conti Writing SPI_DR already performs the synchronous SSI transfer and stores its response in spi_dr. Reading SPI_DR performs another transfer, using the previous response as transmit data, and returns the new response. Consequently a normal write/read pair clocks two frames on the bus and can skip bytes in a peripheral's response. Return the response saved by the write and clear RXNE without starting another transfer. Repeated reads then leave the peripheral state alone. Add a qtest using the upstream netduino2 machine and an M25P80 flash. Check the JEDEC ID, RXNE clearing, and repeated DR reads. The test requires no board changes and reproduces the unwanted extra transfers before the fix. Fixes: 5ae74402d1f ("STM32F2xx: Add the SPI device") Signed-off-by: Manuele Conti Reviewed-by: Alistair Francis Message-id: 20261021065238.15220-1-conti.manuele@gmail.com Signed-off-by: Peter Maydell --- MAINTAINERS | 1 + hw/ssi/stm32f2xx_spi.c | 1 - tests/qtest/stm32f2xx-spi-test.c | 50 ++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 2 ++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 tests/qtest/stm32f2xx-spi-test.c diff --git a/MAINTAINERS b/MAINTAINERS index 3d53e104c5b..15942aaba3a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1225,6 +1225,7 @@ F: hw/char/stm32f2xx_usart.c F: hw/timer/stm32f2xx_timer.c F: hw/adc/* F: hw/ssi/stm32f2xx_spi.c +F: tests/qtest/stm32f2xx-spi-test.c F: include/hw/*/stm32*.h =20 STM32F405 diff --git a/hw/ssi/stm32f2xx_spi.c b/hw/ssi/stm32f2xx_spi.c index 871d57324d1..da1dbb7bd7a 100644 --- a/hw/ssi/stm32f2xx_spi.c +++ b/hw/ssi/stm32f2xx_spi.c @@ -82,7 +82,6 @@ static uint64_t stm32f2xx_spi_read(void *opaque, hwaddr a= ddr, case STM_SPI_SR: return s->spi_sr; case STM_SPI_DR: - stm32f2xx_spi_transfer(s); s->spi_sr &=3D ~STM_SPI_SR_RXNE; return s->spi_dr; case STM_SPI_CRCPR: diff --git a/tests/qtest/stm32f2xx-spi-test.c b/tests/qtest/stm32f2xx-spi-t= est.c new file mode 100644 index 00000000000..619191cf6cc --- /dev/null +++ b/tests/qtest/stm32f2xx-spi-test.c @@ -0,0 +1,50 @@ +/* + * STM32F2XX SPI controller tests + * + * Copyright (c) 2026 Manuele Conti + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "libqtest.h" + +/* The first SSI bus found by -device belongs to SPI3. */ +#define SPI3_BASE 0x40003c00 +#define SPI_CR1 (SPI3_BASE + 0x00) +#define SPI_SR (SPI3_BASE + 0x08) +#define SPI_DR (SPI3_BASE + 0x0c) +#define SPI_RXNE (1U << 0) + +static void test_jedec_id(void) +{ + static const uint8_t jedec_id[] =3D { 0x20, 0x20, 0x14 }; + QTestState *qts =3D qtest_init("-machine netduino2 " + "-device m25p80,bus=3Dssi"); + + /* Enable SPI in master mode, with software slave management. */ + qtest_writel(qts, SPI_CR1, (1U << 9) | (1U << 8) | + (1U << 6) | (1U << 2)); + + qtest_writeb(qts, SPI_DR, 0x9f); + qtest_readb(qts, SPI_DR); + + for (unsigned i =3D 0; i < ARRAY_SIZE(jedec_id); i++) { + qtest_writeb(qts, SPI_DR, 0); + g_assert_cmphex(qtest_readl(qts, SPI_SR) & SPI_RXNE, =3D=3D, SPI_R= XNE); + g_assert_cmphex(qtest_readb(qts, SPI_DR), =3D=3D, jedec_id[i]); + g_assert_cmphex(qtest_readl(qts, SPI_SR) & SPI_RXNE, =3D=3D, 0); + + /* Reading DR again must not clock another byte out of the flash. = */ + g_assert_cmphex(qtest_readb(qts, SPI_DR), =3D=3D, jedec_id[i]); + g_assert_cmphex(qtest_readl(qts, SPI_SR) & SPI_RXNE, =3D=3D, 0); + } + + qtest_quit(qts); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + qtest_add_func("/stm32f2xx/spi/jedec-id", test_jedec_id); + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 79946960869..626791d1eb4 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -258,6 +258,8 @@ qtests_exynos4210 =3D \ qtests_arm =3D \ (config_all_devices.has_key('CONFIG_OLIMEX_STM32_H405') ? \ ['stm32f405-timer-test', 'stm32f405-rcc-test'] : []) + \ + (config_all_devices.has_key('CONFIG_NETDUINO2') and + config_all_devices.has_key('CONFIG_SSI_M25P80') ? ['stm32f2xx-spi-test'= ] : []) + \ (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-= dualtimer-test'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-time= r-test'] : []) + \ --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827656; cv=none; d=zohomail.com; s=zohoarc; b=Z5Js1X3cmsuJljXEH5rpAwkTuSiIZtgOiP1I03VTtiO0tU67jcjDC8VgOSTux2L5P18cworwtEd3p5AIySc6eC/k5mhdkrs9UZ28hALqiZhOmqTO8N8/W+H2L2eEBSIUqlM1LZ+8gZ1mNsR0Uo5TZ0X3pGV+9B2+pJ1MkT/cNL0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827656; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=5rBiFwwMVmpfqyc5w3Wjsy/YNwNF2ZPWBBCtGodzQgA=; b=NyVpOMMVkxidVe+bO9lt9CNoSZVSwYq03gTaCV2q3CE7cTqixCGZz5EIDKvAyp6F7sfNZtKfSuKCMPt7sYfXMKyJ2gJt7ySaCp7LgXAM+DQaUHpm8Xfs92e4HcnY3TiipT8J7yU5jhSS5vhOMoTYANvFzYoKLQYWkaN3+fPC2ug= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827656759807.5930573712055; Mon, 16 Nov 2026 03:14:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueO-0003qL-Jk; Mon, 16 Nov 2026 06:13:30 -0500 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 1xSueE-0003ow-OZ for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueB-00027k-I1 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:18 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-48fd2e38825so2074335f8f.2 for ; Mon, 16 Nov 2026 03:13:09 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827588; x=1795432388; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=5rBiFwwMVmpfqyc5w3Wjsy/YNwNF2ZPWBBCtGodzQgA=; b=pAsVYxeradEM3CNCBVrwvXEWgpaMICqsLSWmWiP1cQa8MuvldEGdfkVbmmYbMo5XhT MnmIfLLG+96P8fQZpFV60oZOGEDyVf7yPr/eF6nmZFo9R+2oA8MTBaBGrQTGJWaPjR7N E3BEvQ7niwjlhvdaclDzAHc3705JQCVnPKsmWQDnltVS5G6IniyPAfyuGFXmDHVDZ+uC bgeA0QQcqyIoAwKKd2dIsOFfsxNr4xUZlTNcd9mdu2iSyxR+gEn979yDV4YFvDSHSlKZ /Z7tLmfx0lKGFo6y1X2AaTGZQTr8iYW50Y8Vcf0YXf2pbed1cqnxHs31JHCvxKH8F6IM O6xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827588; x=1795432388; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=5rBiFwwMVmpfqyc5w3Wjsy/YNwNF2ZPWBBCtGodzQgA=; b=uGxfp3Y1EGLucugj6YmToBc3ZLI2RISwZNI7nXUKcfPlXMO/b+tHo3y8PA/DyeDjBu 3kVBIh+CKjVDAIy9+lHxpjBqUf8dYl9Ug8U2xlQ/lh2oMR4ToEks97diDugDDafLf/Xa cU2t4pJ/oknaamd1BL0oifKgpWcs+E+A0GpL5d4ct9wGRAHP8pZLN+ukfCRtcH6S+ObT 8CLC2TAaswAoUgY9sZ6m0uxYChSb9Zmdo6gJzX0J3BE8I17eKrbu+wBvDzMuSbjJ2DPy PHoUSblNUnNqN4BX+jeVzGz5VRMxJuyCS8xK5eOfoWGaTh1d4CoQREe+2wwjX0GrGi2+ qqWA== X-Gm-Message-State: APuU4Z+7tSJpw8iSF4cHbbUdj+OeypMPrLPLF+4hbRk1MyqmuLN/R8ar AkVbA6Q4E86RGf34UUOEW14prhp9hwHaBV7kAHLhN72UlNItp9nJ+hPm+2codVXDVKNTfiHOAoQ jM3qqdqs= X-Gm-Gg: AZFdTZdpsy7bo1X/3n+nK1hMRkH9Bt9T+7PUJekPzvQvl6ugan3il6mI6TKqAlgpZBJ FGZm5U5z4jjPVx5HNLpX6hS4s+Gf3kdLd/mMMdw/ydU2hZOiUyDUrIVJydV1PZx36gK4jpeWRpL ds3Fd7q6eYXMwvH/A7gCQsZ6OC8o/dcNdAgF39Npkwu27hHs/M/TsTrhBV/FLTGcbilWobWHBVz FTPFlGAc3pnCks/KeCeZ2pIw0kvq9nL+SZUGmWEHaNesG4quYVcIkK33BCPln7O5RxoFC6qO4O9 SfNeiOpZNc4aVLdRWhyinOwfYHBprSM2CKB96iQiD7orN1EiVNfjyOGK2g6RZqVDpuNvNiPgvdU 3hCvAkaRKvtGytF6ycRhOPkFRZSUN+PctFUDb4UiFqmysqP0FP9wLztKRtBTi/hbExDguukqQgJ vh5Vi/adoQEBPGj/V54U6q76yApy1j8c6ALm+6v+WH0hiZK8bC6jMh87B2z/Gt7lB0x/w2Udtay 0v5zzVZZ19KcKEwHd6pyiQzA0nX/0EPZNgAiFo3vevQ9fWX9BOwV6rUi+YtEPPg4SW3cnJ1eSsP 532awdlHH38/D5RNzoOvXxx27Z8IABAX3vgXke5rciHz47WWcczJtPT8qOYuQx7EIezMcPOOJdt d2222XxnHIcXPfanYBdDGRVI1oRqh1d9FjA== X-Received: by 2002:a05:6000:4b0b:b0:48e:20f9:8d75 with SMTP id ffacd0b85a97d-49c72c9c398mr21246550f8f.48.1794827587675; Mon, 16 Nov 2026 03:13:07 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/33] hw/arm/bcm2838: Route SPI0 interrupt to GIC Date: Mon, 16 Nov 2026 11:12:32 +0000 Message-ID: <20261116111303.1692832-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827657942158500 Content-Type: text/plain; charset="utf-8" From: Hanyu On raspi4b, SPI0's interrupt is connected only to the legacy interrupt controller. Linux guests whose device trees use the GIC therefore can't detect an SPI0 interrupt. This patch adds a two-output IRQ splitter to deliver SPI0's interrupt to both the legacy controller and GIC SPI 118. This follows commit fb3e0557a4cb ("hw/arm/bcm2838: Route I2C interrupts to GIC"). Testing Add these options to the QEMU invocation: -device m25p80,bus=3Dspi,drive=3Dflash0 \ -blockdev node-name=3Dflash0,driver=3Dfile,filename=3Dflash.bin Before the change, probing fails and /proc/mtd contains no devices: spi-nor spi0.0: SPI transfer timed out spi_master spi0: failed to transfer one message from queue spi-nor: probe of spi0.0 failed with error -2 After the change, the flash is detected: spi-nor spi0.0: m25p80 (1024 Kbytes) # cat /proc/mtd dev: size erasesize name mtd0: 00100000 00010000 "spi0.0" Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3013 Signed-off-by: Hanyu Message-id: 20261109035234.722952-1-hywei787@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/arm/bcm2835_peripherals.h | 1 + include/hw/arm/bcm2838_peripherals.h | 1 + hw/arm/bcm2835_peripherals.c | 14 +++++++++++--- hw/arm/bcm2838.c | 4 ++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_= peripherals.h index 4f356f46435..cd66a734e7c 100644 --- a/include/hw/arm/bcm2835_peripherals.h +++ b/include/hw/arm/bcm2835_peripherals.h @@ -71,6 +71,7 @@ struct BCMSocPeripheralBaseState { BCM2835SDHostState sdhost; UnimplementedDeviceState i2s; BCM2835SPIState spi[1]; + SplitIRQ spi_irq_splitter; BCM2835I2CState i2c[3]; OrIRQState orgated_i2c_irq; SplitIRQ orgated_i2c_irq_splitter; diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_= peripherals.h index 60bfacdce49..f9279daa4d0 100644 --- a/include/hw/arm/bcm2838_peripherals.h +++ b/include/hw/arm/bcm2838_peripherals.h @@ -27,6 +27,7 @@ #define GIC_SPI_INTERRUPT_DMA_9_10 88 #define GIC_SPI_INTERRUPT_AUX_UART1 93 #define GIC_SPI_INTERRUPT_I2C 117 +#define GIC_SPI_INTERRUPT_SPI 118 #define GIC_SPI_INTERRUPT_SDHOST 120 #define GIC_SPI_INTERRUPT_UART0 121 #define GIC_SPI_INTERRUPT_RNG200 125 diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index 558c180df9f..be40c6b92a4 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -166,6 +166,8 @@ static void raspi_peripherals_base_init(Object *obj) /* SPI */ object_initialize_child(obj, "bcm2835-spi0", &s->spi[0], TYPE_BCM2835_SPI); + object_initialize_child(obj, "spi-irq-splitter", + &s->spi_irq_splitter, TYPE_SPLIT_IRQ); =20 /* I2C */ object_initialize_child(obj, "bcm2835-i2c0", &s->i2c[0], @@ -480,10 +482,16 @@ void bcm_soc_peripherals_common_realize(DeviceState *= dev, Error **errp) =20 memory_region_add_subregion(&s->peri_mr, SPI0_OFFSET, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi[0]), 0)); + qdev_prop_set_uint32(DEVICE(&s->spi_irq_splitter), "num-lines", 2); + if (!qdev_realize(DEVICE(&s->spi_irq_splitter), NULL, errp)) { + return; + } sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[0]), 0, - qdev_get_gpio_in_named(DEVICE(&s->ic), - BCM2835_IC_GPU_IRQ, - INTERRUPT_SPI)); + qdev_get_gpio_in(DEVICE(&s->spi_irq_splitter), 0)); + qdev_connect_gpio_out(DEVICE(&s->spi_irq_splitter), 0, + qdev_get_gpio_in_named(DEVICE(&s->ic), + BCM2835_IC_GPU_IRQ, + INTERRUPT_SPI)); =20 /* I2C */ for (n =3D 0; n < 3; n++) { diff --git a/hw/arm/bcm2838.c b/hw/arm/bcm2838.c index 650b1fe8f44..1bde9e68af9 100644 --- a/hw/arm/bcm2838.c +++ b/hw/arm/bcm2838.c @@ -188,6 +188,10 @@ static void bcm2838_realize(DeviceState *dev, Error **= errp) qdev_connect_gpio_out(DEVICE(&ps_base->orgated_i2c_irq_splitter), 1, qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_I2C)); =20 + /* Connect the SPI interrupt to the interrupt controller */ + qdev_connect_gpio_out(DEVICE(&ps_base->spi_irq_splitter), 1, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_SPI)); + /* Connect VC mailbox to the interrupt controller */ sysbus_connect_irq(SYS_BUS_DEVICE(&ps_base->mboxes), 0, qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_MBOX)); --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827905; cv=none; d=zohomail.com; s=zohoarc; b=EzlfJdd6dh2ZoIneZ9B/BCbkGKUZ6B9ihwTpBzYBxunyOLg7t59huMDI2tuhsV3A8BRIrQcBOS0WWo+oewnRxcE02Q/wplZmhB17tUB0By3Q6MJ0ml1Q8awRNC9cw/LT4DO5TXdq33wY5sCFeuVRVr/f0xiwByxWvqN5TYQyuUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827905; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=nZ4tCCJcAOPP39YCI9vL7fD1+Nt2oG42ItWO83osFLo=; b=OHx4xy+piHloTv1pnqo9cvqorhgJqphC5QzaZQoy/C0KtcaxGv/tkHv4g8gp8zK8wERdFpV3Sai8GhlkoNPCrE4u/nMwRxqQKpfsY8KD61DHmDXnAyDH4aNoZlNpabOsFVzIl8uOczQPUooyXC6SlwO86r6oBre+jwIoVoGTVgQ= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1794827905317172.99374344774867; Mon, 16 Nov 2026 03:18:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufQ-0004IE-SE; Mon, 16 Nov 2026 06:14:36 -0500 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 1xSueE-0003ot-JP for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueB-00027n-Kj for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:18 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-48e09aa5264so1530186f8f.2 for ; Mon, 16 Nov 2026 03:13:09 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827589; x=1795432389; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=nZ4tCCJcAOPP39YCI9vL7fD1+Nt2oG42ItWO83osFLo=; b=t6ZgohL/7Wj04leYUOMpBNfzU2cLrhX88418TAx7DNqNxFmkspFUxWbR39AohZ7u+c c6i6/CK/VthsRQaYPeAhtPUh6YKeqIx3ARAR8wpMnxTIKtAQS9svf7EdsEWYjun1C0Ax yBBDnL+mtKkl9dLNqHPTQ7IkSHd+28HK9RZTZ8rYgF9dCIq2JKROMeevpfPwHlybML+p Z9/YcqxWvcmpVI9ZPaLBOFtEsKONoVlZi51nS1ruTsKtvpryjL2lZtV2ibOsno+9KOFG vu5fBexGteQYu+LNgf9aHc66ybtjnEs7xoIx/0UinBbMML5l5l4oOqTRFITQ4Ortbs6R Srug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827589; x=1795432389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=nZ4tCCJcAOPP39YCI9vL7fD1+Nt2oG42ItWO83osFLo=; b=ecWeJNEpXKpWk+5hDVY2cS+hQ+EmJyETgEvsDnerJwQin2Z9bYIrBvwOfPf4ueNFHY 04HOvQtu8otQkOu/MXOcRcjePrPNcnf5npPmkBTRPsZ2dEVbz1ltaCynX8lGMLf/HeDk iPQtoDGCCewIZE2NfeK7Nyy5HnnZ2FXho9moN+wVqYRYU0ttrWXRAalMPjo8nn8HpDDH wasu5H/6vj8TEXLS8I0RGbDwPOuVyP5XOmx+JsJRf/1RNKwehwESAqMYE2MuKQ1HhlaL i15lV8pcjORE5nE0zP2zyJq7we3uqwH0af0KF85YkIhGCgfPTnHvZq18uug7G43m2EIE hqew== X-Gm-Message-State: APuU4Z9AQdh6RwszIPUmtyrFwSNlGz40/1cgz+o78RS2Q+gQfga+u6Hw DCz3kmaS/HUgpF5+JrawcEHEwEOf4XYRGNBusB7czpkfMG0w0wkCKnSiVJA4Ml9FYqErOL3FrjM gSncD4i4= X-Gm-Gg: AZFdTZfkJsalrixREtuDXuyaObU8MoD3IFL2NUyl9gWaBtlIbJ7+jDKCLZ7i5JsPsFX vqBDkPbcclNJzaccB4dU7CYOUFuwE0rG8v0zEtRE7fo1OeYZcZovo4Zr755bS86ecIZfzbNMtuO nEsVoWc4Q8LZMThIHi1f8CksHwr0KDvoFHkfdkuxwVY7oUJucWxzbgzzj5HfN+hcGCTVeF4EDmL LX0vq3ZoF4cHHz5eJZZ6+UtC885CypXH3snK8QZ7CmOE36m2PF/u7pgE712i85aCvL+YWUAoA9C VF2kMJVYH4lQudkv1ixjMprZ3yHVczEqGNJ4sK9yZUUgkcRPAM2Cs8RSr6wEbYZa7HZWwpOKwM8 1f+AiCKKOR34WCrIDvJL9w2iGVnTCGFDTzh9IHcHg+t+ropUfy86pl7d2POKV1+n/BV9yDlx+Rk 6IPidHncKj/zgp6++JgAzV1BTzKLUUQLdHhpzFjjAftk4kHZpHvgut+jRXz65NLZvBPPVqYdhyS VGC3OapiKAwnK7ee7aMYQwMOu7lANk490qaZeTJrbaYcQccC/2Lpxq5Xie08ovcwsG5/tMhv0Hg 6/qYyDbvHzKKEcXHVoSt1wQe071rn0iyFViGy8uSbM7tCCvdVqoXWgcjb+iUGJsMcwJ5umKqfEd pFfbJ5u6f6pconKN1wyGu/8Zx1fRWrf9rgA== X-Received: by 2002:a05:6000:26c8:b0:491:8462:20cc with SMTP id ffacd0b85a97d-49c73ce5e65mr23453273f8f.37.1794827588680; Mon, 16 Nov 2026 03:13:08 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/33] hw/intc/arm_gicv5: Use cached IRS_IST_BASER.VALID state Date: Mon, 16 Nov 2026 11:12:33 +0000 Message-ID: <20261116111303.1692832-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827906184158500 Content-Type: text/plain; charset="utf-8" When the guest writes to IRS_IST_BASER we effectively cache the value of the VALID bit in the GICv5ISTConfig valid field entry. In a few places we check whether the IST is valid by doing a bit extract on the register value; switch those to look at cfg->structure instead. Signed-off-by: Peter Maydell Reviewed-by: Jim MacArthur Message-id: 20261103172616.2400758-2-peter.maydell@linaro.org --- hw/intc/arm_gicv5.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/intc/arm_gicv5.c b/hw/intc/arm_gicv5.c index 5d0a50ab6aa..d0a8574916b 100644 --- a/hw/intc/arm_gicv5.c +++ b/hw/intc/arm_gicv5.c @@ -1222,8 +1222,7 @@ static void irs_map_l2_istr_write(GICv5 *s, GICv5Doma= in domain, uint64_t value) uint64_t l1_iste; MemTxResult res; =20 - if (!FIELD_EX64(cs->irs_ist_baser[domain], IRS_IST_BASER, VALID) || - !cfg->structure) { + if (!cfg->valid || !cfg->structure) { /* WI if no IST set up or it is not 2-level */ return; } @@ -1293,7 +1292,7 @@ static void irs_ist_baser_write(GICv5 *s, GICv5Domain= domain, uint64_t value) { GICv5Common *cs =3D ARM_GICV5_COMMON(s); =20 - if (FIELD_EX64(cs->irs_ist_baser[domain], IRS_IST_BASER, VALID)) { + if (s->phys_lpi_config[domain].valid) { /* If VALID is set, ADDR is RO and we can only update VALID */ bool valid =3D FIELD_EX64(value, IRS_IST_BASER, VALID); if (valid) { @@ -1604,7 +1603,7 @@ static bool config_writel(GICv5 *s, GICv5Domain domai= n, hwaddr offset, deposit64(cs->irs_ist_baser[domain], 32, 32, d= ata)); return true; case A_IRS_IST_CFGR: - if (FIELD_EX64(cs->irs_ist_baser[domain], IRS_IST_BASER, VALID)) { + if (s->phys_lpi_config[domain].valid) { qemu_log_mask(LOG_GUEST_ERROR, "guest tried to write IRS_IST_CFGR for %s config= frame " "while IST_BASER.VALID set\n", domain_name[domai= n]); --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827713; cv=none; d=zohomail.com; s=zohoarc; b=Mx6OhE0P/l+9FOcdLETDPtl/RLNl+QTkId3ZTja8wAwmTw1bIMxDk/JwAKeGJPfw/Xub6FX7CCKWxEJ307hjntOc6cN3m6GTLoV2QtP2m6wXEr1iCaj1kSIVxakxqV3dTkIfI2Ma5wwjhYih6isV26+bTXCuKnaeSEPYZFpNN9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827713; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=RNd36oaJ1HdGT+rhZlENz1yPtG0nBRRajHzmEN2ptno=; b=MuqAgd4U7ElbN95RmBhueRVZapxcOhf+5gFkkA7Nfk6isS6hL+ILgXdzCsf54K2MeUk5q5vgd1uACORx6va+VVLYTq3/t2+cXKa8rf68s3G/meNz5wz8NMQ9IM8zNnvNy+UYTUA2AN1hyYvq7CNxBexGXnImt8RkwjC6C4WiGx0= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827713917752.2205448411737; Mon, 16 Nov 2026 03:15:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueY-0003sC-Mi; Mon, 16 Nov 2026 06:13:39 -0500 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 1xSueE-0003ou-Ju for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueB-00027s-Jl for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:18 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-48e10a70540so1790958f8f.1 for ; Mon, 16 Nov 2026 03:13:10 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827589; x=1795432389; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=RNd36oaJ1HdGT+rhZlENz1yPtG0nBRRajHzmEN2ptno=; b=z5Mfaf3wiFPnWoDT9dbmKjfZFPAeU4xRCXOtKVhqdv1q33+BUEC+Rd5yOwjaZTowbq xV9jL4Jhc6R3hYcZokVo10xBChiYGvaRz0w11cMVBSjna09dDCi7RbMS/V8QDyVdx+RO fPs+mVAdSUnDqw6KTZBLECR3fBvSsKF0W2QiRzK/IgdocmyUtmLjj4gOxwupcFOFXlps eOi1m5Huo10oRj37UuJu79aVO9lGXTngLiMmuzuk6aBJWEUldI/QfDPDP+vmXiS7rqTr i0ZkeRrGO3+TMcDCX2cYHmOtZkWCOUNBpckxepMzh0yaU7ukzFHskfnbyNi5A2YIh3Fb tixA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827589; x=1795432389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=RNd36oaJ1HdGT+rhZlENz1yPtG0nBRRajHzmEN2ptno=; b=mtM+EZFcZsd3sdoZwlE9gkVeNPAaTbONGJxmifra91geBQu7jtFpboylCf8AeUQ03H MfR/OWBimIeE6jPOj3OMFsYW1tw0+UHgIFQSEqSlOQ1MHWFbH+g3LKojjfuldWMemakF N62UsG/QK0RZ6Aqoer4MLQLwZ78hRl997u47wwf38b5rQyNDY+HgS2Z56ryI7u9FwyTM MY2N7iMd4TYuBlf79+qO4Gbq+sz2sSjkf+gsAfPRxAwdwKpazpSowFjTKnh6LHXEiRwP fW0S6yuHcNnO4ZFhW+QtKnGCcfdLPOFThvrnBUHtkC16I1dCTh/LDy7ZOgARDMA+kErJ dt8A== X-Gm-Message-State: APuU4Z/BKlgXtoKWj5R/OjaScTu6Mwb6YtlF7q4xPu8mocQqzKA1dynD H1sX1ol5dHUOVpGXS2WREkFocMpw8C07UzpHRjxEDQ/CLYHCsmevsiVqs4vBdZAKZ8mxByJQaUi NNrGAnSg= X-Gm-Gg: AZFdTZdBuiJLz70IT5q2rzQ9lsUUSP3YLTcivj4WCxI/H/HrRibBrHybXIMfzkr2a+q +19loT44GH/BrYbxumT6DTO3Z3rDvL+rpn0yEg9aRmQywJjG1GjEAboExR7bHvNv9eTJebA1C0F Usz46+wRPQpHe1AoeF781WgmiFR3UoSeVICdWLxwxlnsLZi02ucE2lkYRa+HVX3E89nM2nok3BR XO3CCbA3jILifU663k/IbgEW2Y1tuv/d+3THZQZ2le2jW9+//kncstHHm4X+gYRzcG2jK4cvtV/ RIEJzpS9PE9Y2PycGxSmIh+Je8gFJexlXwGUeqUEr+62mylo+UU4gJ2ZcyTQBimwWXpKWQsVav3 bT8OEjNKLHkEBe5Zex0+hglo0QkXzjS0s6Z62CjMDVmZxALfmOfB7+a0F0Calo7N3/gWivDVJTd v791jFm48IeU0nEEv0zyPw+0/XqDJKKiC969DELWDWULKcDAlCdEoL1k5xhP/XFZ6zEGWPhCJuQ 1TDCAppWVxEvdPs/YsWsES9Yuc0zhorPe6lHiANShczMx9P2HzlDCJTRvSp3GHW8oTpzwDioUiH xeshM9ANKvPePRDC3vDJmPNOBkg+ungdng9nkoosQyZYDGYP3KpyXNSBDPxCYGEam53LNXUblsG BieJBvnaZJ+kLJF4NaMHneeCAX0MCSSE5uytgCAHyuDn0H8qUojs49Sg= X-Received: by 2002:a05:6000:22c1:b0:488:83f7:6352 with SMTP id ffacd0b85a97d-49c6fc9e5bemr22822140f8f.4.1794827589562; Mon, 16 Nov 2026 03:13:09 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/33] hw/intc/arm_gicv5: Free memory in finalize Date: Mon, 16 Nov 2026 11:12:34 +0000 Message-ID: <20261116111303.1692832-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827714309158500 Content-Type: text/plain; charset="utf-8" The GICv5 allocates memory and creates hashtables during realize and as part of its operation. Free those resources in finalize. Since the GICv5 is created at QEMU startup and remains in existence for the lifetime of the process, this isn't an in-practice leak, only a theoretical one. Signed-off-by: Peter Maydell Reviewed-by: Jim MacArthur Message-id: 20261103172616.2400758-3-peter.maydell@linaro.org --- hw/intc/arm_gicv5.c | 11 +++++++++++ hw/intc/arm_gicv5_common.c | 3 +++ 2 files changed, 14 insertions(+) diff --git a/hw/intc/arm_gicv5.c b/hw/intc/arm_gicv5.c index d0a8574916b..fd6456cd8aa 100644 --- a/hw/intc/arm_gicv5.c +++ b/hw/intc/arm_gicv5.c @@ -1970,6 +1970,17 @@ static void gicv5_init(Object *obj) =20 static void gicv5_finalize(Object *obj) { + GICv5 *s =3D ARM_GICV5(obj); + + for (int i =3D 0; i < NUM_GICV5_DOMAINS; i++) { + GHashTable *ht =3D s->phys_lpi_config[i].lpi_cache; + + if (ht) { + g_hash_table_destroy(ht); + } + + g_free(s->hppi[i]); + } } =20 static void gicv5_class_init(ObjectClass *oc, const void *data) diff --git a/hw/intc/arm_gicv5_common.c b/hw/intc/arm_gicv5_common.c index 2920b11cc39..cfadfee4f05 100644 --- a/hw/intc/arm_gicv5_common.c +++ b/hw/intc/arm_gicv5_common.c @@ -112,6 +112,9 @@ static void gicv5_common_init(Object *obj) =20 static void gicv5_common_finalize(Object *obj) { + GICv5Common *cs =3D ARM_GICV5_COMMON(obj); + + g_free(cs->spi); } =20 static void gicv5_common_realize(DeviceState *dev, Error **errp) --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827989; cv=none; d=zohomail.com; s=zohoarc; b=KOh2JZ9WfZPRmdqJ7xYhGGz+MvyxDWLRiAYGnHdX6kyuVIOczJNLTaq1ujmhZxKJsy6LM0lDp+CPq3fsOETwerF82z12OnGlboU9nanPHHHDo4MIqgO4HkS2xCkE7D6qfYDYoCXY+cw8zJgZU3FbzynimAXSMM1g+K9pm+YE+rA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827989; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=wq8OK6FeZj9sXMcKYgkOQQCcjCveIvDl0grNK9jCDt4=; b=bwpxVUihppoT8F5C5T9FZAmW7pcVLbeVt9Pv5kPeb5p283WQv972zpRV79V1DD7QAJr9Fe2MFZ4VjuXV8jk9O6e2TbnmTLm/mztZ3X5slRxm9DkvWE6iD+Hw9b9WWbTwk1GIChyhOfYv2uJWkV/o5jveu+6x4ndPA31YZtO7ff4= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827989143166.21867033224441; Mon, 16 Nov 2026 03:19:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSuef-0003vz-0b; Mon, 16 Nov 2026 06:13:45 -0500 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 1xSueE-0003ov-Kw for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueB-00027w-Kq for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:18 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-490d59c3edaso1957880f8f.1 for ; Mon, 16 Nov 2026 03:13:11 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827591; x=1795432391; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wq8OK6FeZj9sXMcKYgkOQQCcjCveIvDl0grNK9jCDt4=; b=GQlO4zHnnzvpYFTUd3uQwmDNnzROUGQSNr3SCMd1qjyqlLdmGNpGNBvLZ6WOb72O3a dXQTrAfx7qmDZ6nr/0Dg2Zj+6kw5L/gYoBBgFDn87rDsvxWB/gF07ec6u5ur16eiW96w Nsd/Fit4jZmUcpullEISnbyPVrVfZEc9T6bR+HGupXkKZRJN84l2d5FAy5GezjitzzyO Q6oaItae1z1YgjDm5nnhsM072vrKxQnD+pGOlKa2IEJ2ESnxEvArAcyLvcO1ZSeHHFlv dGAoiYlatXCnzK26HAE93Ce3b9D6eS7K9gJzOXHo5es5U6K67xf5aUOmsXVp2NyWk6Tk A8SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827591; x=1795432391; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wq8OK6FeZj9sXMcKYgkOQQCcjCveIvDl0grNK9jCDt4=; b=YNTiXyj4LB1dPTWEAyK5XCCHzmjKE+ERRALsdDrdl8ymzHp9Gpo/TWHNNnKr7xgXql TcP0IlwsTiSJDRacDAwbWm8WkHwuAEFbUkDgbQHEc48gbSLce45wcMqTLbRQdT2dFNQ/ rH6a97rHQq6zGS0UmOQfXZSB2uU0R/2OuN7MNF1MKlfpACB6wrsUcAKTVGBG20tP7pPm Dp2HOeW+Dtx/98WSskplraDj07UK/Pkv3D+eW2BPb/nx6V4FFhdk0ouflsPaRjUQogTx e1evWFHjjzN0fN69GNIlGu5SSlx1pOgDieUFikPeoX1yimsGLgkx5TgTST1xZFevj0CG g1zQ== X-Gm-Message-State: APuU4Z9hogxDmyiIj94Sqec+3CY32IZSkd6WkUmW7qzhmZcDLvV5DLHW EvtnYlBgr2ve4f4NnFzru6RWYs79CEIMbVVuPkU77g+xiZJzX4xuhB0+TMwnirUDllhHkM0/L7S 36MUgqh4= X-Gm-Gg: AZFdTZcNH2Y9ruRR18JIr37aYbuFGn5Bi0ZQehlwWZyOTjdMYoa2JOQKW+TsnZpR1Hn frPU2yMW3CwpLkKYUd2e4YmdHkgTdDU9Si1uqyabYtGjXs1IwL3ZpT2AH7O0RdZJlUOBjk90Fwc qUfralbIXRYOw6zQWlAGIXCZV/sq6atxwacYdbYY0JyQqN1MI1Fn4NZzgfDZLWYXCZuWHqaakef 61DoVd+HcNeFv1+VAq4T4Mwh11KngOZftNaUNORa/2pzggr/PjR1FAmCReOHzn0hjG7lrSL0Yv5 HT9Z8wK4a3GvnpnS8W6wQkz2MjPg23bBm5Za9HXWDILQ/yEueszTBVbkR2QvNUJzegYIGd9nuLi xwtaHci9FZ7KgHozpBKjHn/JT3O8hekrJvqsVRIu+rlFo0Jv028f3OMDKk7QofH0Vg6UbwTy44P Rj99oSoizxILwOIJ+03LVar0bi86wPM6ZcPunaztgqs6p4aMFJ45cpF5aG5pcLibVkUyipfs4tZ 63MMyV/pnq9/LXFGjp/cKz9z7lKV6sfV8Db0oqkMmFQUxGMKAF+TSBxbSh8tSKezWWxLa6foZBi 9RxxzBl7Ot35cny+AAdNBRQcTdz+XPKE9swxx5wkqaYiXwzciqpcipAoERNXniSb0Z4VyXwD1w+ h+6jSgbdRGKkx1f0aTkOnzztwgdWSQgxXGQ== X-Received: by 2002:a05:6000:24c5:b0:49a:94e6:378d with SMTP id ffacd0b85a97d-49b03217a27mr34168762f8f.30.1794827590511; Mon, 16 Nov 2026 03:13:10 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/33] target/arm: Only allow GICv5 on CPUs without AArch32 at EL1..3 Date: Mon, 16 Nov 2026 11:12:35 +0000 Message-ID: <20261116111303.1692832-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827990940158500 We previously allowed the GICv5 on any 64-bit CPU, with a hack where enabling the GICv5 silently disabled AArch32 for EL1..3. Now that we have a separate 'max-v8' and 'max-v9' where max-v9 correctly doesn't implement AArch32 at EL1..3, we can fix the "when do we expose the has_gcie property" condition so that we only allow the GICv5 when AArch32 doesn't exist above EL0, and remove the hack disabling AArch32. We could instead have defined a new ARM_FEATURE_V9, but "allow the feature to be present on CPUs where it doesn't actively break anything" fits the way we've generally handled things in QEMU, and it avoids having a new V9 feature bit that we only use for this one thing and where it's not clear when we should be setting it for KVM, hvf, etc accelerators. In practice the only CPUs which will allow GICv5 now are max, max-v9 and a64fx. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20261103172616.2400758-4-peter.maydell@linaro.org --- target/arm/cpu-features.h | 8 ++++++++ target/arm/cpu.c | 37 +++++++------------------------------ 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h index 96ec12f64f4..b0edec28378 100644 --- a/target/arm/cpu-features.h +++ b/target/arm/cpu-features.h @@ -1130,6 +1130,14 @@ static inline bool isar_feature_aa64_aa32_el3(const = ARMISARegisters *id) return FIELD_EX64_IDREG(id, ID_AA64PFR0, EL3) >=3D 2; } =20 +static inline bool isar_feature_aa64_aa32_above_el0(const ARMISARegisters = *id) +{ + /* True if any EL above EL0 has AArch32 support */ + return isar_feature_aa64_aa32_el1(id) || + isar_feature_aa64_aa32_el2(id) || + isar_feature_aa64_aa32_el3(id); +} + static inline bool isar_feature_aa64_ras(const ARMISARegisters *id) { return FIELD_EX64_IDREG(id, ID_AA64PFR0, RAS) !=3D 0; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 71681447b21..dde03ffdd6f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1596,8 +1596,13 @@ static void arm_cpu_post_init(Object *obj) &cpu->rvbar_prop, OBJ_PROP_FLAG_READWRITE); =20 - /* We only allow GICv5 on a 64-bit v8 CPU */ - if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { + /* + * We only allow GICv5 on a CPU with no AArch32 support above EL0 + * (which is typically a v9 CPU), because GICv5 defines no AArch32 + * system registers to control it. + */ + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64) && + !cpu_isar_feature(aa64_aa32_above_el0, cpu)) { qdev_property_add_static(DEVICE(obj), &arm_cpu_has_gcie_proper= ty); } } @@ -2274,34 +2279,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Erro= r **errp) =20 /* Report FEAT_GCIE in our ID registers if property was set */ FIELD_DP64_IDREG(isar, ID_AA64PFR2, GCIE, cpu->has_gcie); - if (cpu_isar_feature(aa64_gcie, cpu)) { - if (!arm_feature(env, ARM_FEATURE_AARCH64)) { - /* - * We only create the have_gcie property for AArch64 CPUs, - * but the user might have tried aarch64=3Doff with has_gcie= =3Don. - */ - error_setg(errp, "Cannot both enable has_gcie and disable aarc= h64"); - return; - } - - /* - * FEAT_GCIE implies Armv9, which implies no AArch32 above EL0. - * Usually we don't strictly insist on this kind of feature - * dependency, but in this case we enforce it, because the - * GICv5 CPU interface has no AArch32 versions of its system - * registers, so interrupts wouldn't work if we allowed AArch32 - * in EL1 or above. Downgrade "AArch32 and AArch64" to "AArch64". - */ - if (cpu_isar_feature(aa64_aa32_el3, cpu)) { - FIELD_DP64_IDREG(isar, ID_AA64PFR0, EL3, 1); - } - if (cpu_isar_feature(aa64_aa32_el2, cpu)) { - FIELD_DP64_IDREG(isar, ID_AA64PFR0, EL2, 1); - } - if (cpu_isar_feature(aa64_aa32_el1, cpu)) { - FIELD_DP64_IDREG(isar, ID_AA64PFR0, EL1, 1); - } - } =20 if (cpu_isar_feature(aa64_mte, cpu)) { /* --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827734; cv=none; d=zohomail.com; s=zohoarc; b=f3BJKkUGej+pEbRjvGHmPhMEycwt54OnvkewQhE1Q6tZ4eCrbYtEb38tUK3Vuqdh5Kd/z5Fz/F8+wSGP5L6DLDYOaIAltmzcMPOH7dve0PGU9zm3LP63hM4tm138mdVP9LG1jaylu1a4cR6ujHrEm/5RMA5lrvhZ1eQk+hgo2gQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827734; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=pjw8iuDZkRxk9QIN6UyEUQIMdDyB9ab6e2fltNT38po=; b=btDVd70AWVuRh+R0w/zs0sBQoDs6yyoDlkro/cm4drjPsP476AoMyuj2o1xknIfM0lW7wnmbfsNtU8ScwCwbbVrcfz/YdFkVzJwZ7ugP1gPJAwskT5SEVPm9xp5oPB9uDxVLPAJM0mCeDorvmb+h3m9k7v9zQ7C49DrQ/BUyyfg= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827734795404.8016580043652; Mon, 16 Nov 2026 03:15:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufs-0004x5-7v; Mon, 16 Nov 2026 06:15:02 -0500 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 1xSueG-0003pb-2Z for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:20 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueB-000284-LO for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-492fcbfaa87so1692833f8f.3 for ; Mon, 16 Nov 2026 03:13:12 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827592; x=1795432392; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pjw8iuDZkRxk9QIN6UyEUQIMdDyB9ab6e2fltNT38po=; b=t/bDt15FD3a6+7aOtj71DjOO/omUggUOg95rivDrF2Nw34Pr34F6OwL4v/QJesZero H9M22Or+L5Pwk6+qTKOUWkWqNfrULgCsUOGbfexym2NTRV3gkkl6vK6LUjh5r0coa+E+ 56pE/IT5hQjGdf0xPvc7H1bbRmrpFqDLBQYWqVz6BlasnaaEeTUo6QCL/1zNTmLIYzNr OmxM/17hG+pXZDu9BrRenpawIc6wchV4s4HCavY4FGyyDOe8Ka5Ll26af5epRxplE7mh UV/a+doDgg5ROyXo1xRMVLgtDnKDF76J0DIgOzTj7C8BimrPL3czZTp/6ELkmv0LuPgd +c0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827592; x=1795432392; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pjw8iuDZkRxk9QIN6UyEUQIMdDyB9ab6e2fltNT38po=; b=pQAHrMGwD0F/3g3S8UydzxaaPpgJbwOrx8ZuSdHVGyYD4ogd6Nejh2m385NN5QlrKR umXyAQrru52P34qd4LbFJpR6RxzbyGulE1oCNM6TpERvxUIxU/v8eYWEEwftyoZdYSnF 7iEjKQ4Z8Lzl33JOJqg35C/yPa//vODSGbjbgVQ5UgQbX3gYW7/YtVndFds12/lKoCvA bdvGI/vXcrDWtmAR6KfmA02xDu3WSabrrOi03wmPS83eOLlU8Wl/wfD3EM8c4HyNKkAQ 7ZiaGmSHEZ1By21L3tdGpmb5hMPL5mUmQ/Yl+kOp8nMuPz8scn2iRpeDTmhndlyhs+fW Qh3Q== X-Gm-Message-State: APuU4Z+esuXxfbA89Ox5phy6LI3/GklOEki2Oab+i6jnHyLm9dwegSj6 xFDrrxbD5V7JYn+z3RqQbwGgZKrBUmZBsiuusPhUWrYQL5LHLfGw0AtO7FU4gEtOQd94MTlIGjc dAX5u4+c= X-Gm-Gg: AZFdTZe/ORQu86YLfRiEpfgvlviTls88LYnAAy7nisHd2bF49gp0Q2oLT/pn4e+dV7k C4BJm7Hu5Q755u8JSkIr4qr/h5965TF0TZHySnLtVqIfKh1vGY9pL3NFXjydNVxUwZzyvxDmyVd Xu2LWhCnN4TjveO+kScaBjM0EeO0L4HIOPxtSTbXEwU2KYBp+09jVp0IpgXgWi5JyTrLlZBd+E5 vUfKE6vA25059yban0anflBcnPydT7aJUqo/CvZLFcD60+xqU+ymreBWNsBZ4jMfPlMyTsL0TD1 xiWOdfiTqPQKQm7A4KtfTFdTi2Pd2kkFI7c1if3OyTkHa8enkNPSqNavMn+MhRFAsHDxxsBU3yB 1gq6LRVqCMZwZpYReRBFY1TrKJOzLRGTeAIc4W7uggWUX3nsjxsqXLB3/cEw607wcs+GOlkwDCI 5U5FfVAD+Fqd/uCq659Nw71BeS1oqmgQNciAnMYpso5vfY215mmWVE8VctSR1YL26kqPxf/V2QX ttsZVLWMtn5ogHLylwwfuBt8ZBz9lZeX3ZXcsZecJc/aiJzckWKoKsKq/MYZcCurL5581Xs1ypn vB098rewQ0nIgpMNxzm76hgy/p6iJhu/2tC3vbfqQUkspNOOyESNOxHtjPdfA1O5jhwcAXdaY/a KJK40fb2tj8HUYMw8HJQWJk0WZRgWLVcRDA== X-Received: by 2002:a05:6000:2613:b0:48e:3085:7cf0 with SMTP id ffacd0b85a97d-49c7467b551mr18246962f8f.51.1794827591579; Mon, 16 Nov 2026 03:13:11 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/33] hw/intc/arm_gicv5: Use correct type for value in lpi_cache_get_hppi() Date: Mon, 16 Nov 2026 11:12:36 +0000 Message-ID: <20261116111303.1692832-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827736561158500 lpi_cache_get_hppi() is a function we pass to g_hash_table_foreach() to iterate over the LPI cache hashtable. This hash table has keys which are GINT_TO_POINTER(intid) and values which hold the L2 ISTE value, allocated as "hashvalue =3D g_new(uint32_t, 1)". The function is passed the key and value as type 'gpointer' and has to cast them to the real types itself, but it incorrectly casts the value pointer to a uint64_t*. This works on little-endian hosts (since we only read specific fields of the L2 ISTE using bitmasking), but won't work on big-endian, and trips the clang sanitizer. Fix the pointer type; for consistency we fix also the type of the local variable, though that was not producing any incorrect behaviour. Cc: qemu-stable@nongnu.org Fixes: a0562ada75e ("hw/intc/arm_gicv5: Calculate HPPI in the IRS") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20261103172616.2400758-5-peter.maydell@linaro.org --- hw/intc/arm_gicv5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/arm_gicv5.c b/hw/intc/arm_gicv5.c index fd6456cd8aa..26dcbc82ed4 100644 --- a/hw/intc/arm_gicv5.c +++ b/hw/intc/arm_gicv5.c @@ -390,7 +390,7 @@ typedef struct GetHPPIUserData { static void lpi_cache_get_hppi(gpointer key, gpointer value, gpointer user= _data) { uint64_t id =3D GPOINTER_TO_INT(key); - uint64_t l2_iste =3D *(uint64_t *)value; + uint32_t l2_iste =3D *(uint32_t *)value; uint32_t prio, iaffid; GetHPPIUserData *ud =3D user_data; =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827990; cv=none; d=zohomail.com; s=zohoarc; b=bXx3hfb1mQaZBQGARkACSwV+sHZOSbFtNDT/LndsVgY5z2mLUiOHFGBEWaFPIkRVzqTN+sTzkGLTIkt4hKowStHWhZQgjY3v+Ap8uZRJzPi7NKtmijp+ImGX+hgX9h/2NC9ioeFL3glWoYOxz4XgTHhfE6rZn3ddn06xqMO3Qhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827990; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=x9fh8JA9gVFz8cwQu86NZFxxA8oztzeT72ENqRdxmBc=; b=N1Fcy9hMGUbe7m32bX2vVvS5wXXrxLV4Qq9IGPpa/YAJFWc0H8jwt4DkMQiav9kIZA8AVUNu+Rnga/kQKJpWQ6gsHOSUmILxsBmHGJLEI5+gSCawLQtDvGLsfqRUDD1GSz+vvU0QPpxZ9XER7YqEbm6vteEV6wbO30IAV+g4A3I= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827990168288.0820326588706; Mon, 16 Nov 2026 03:19:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueh-0003xD-1V; Mon, 16 Nov 2026 06:13:50 -0500 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 1xSueF-0003p8-VS for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:20 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueB-000288-LW for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-4922dbcee23so1533886f8f.0 for ; Mon, 16 Nov 2026 03:13:13 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827593; x=1795432393; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=x9fh8JA9gVFz8cwQu86NZFxxA8oztzeT72ENqRdxmBc=; b=XEORzx0P/liPYcGORXFJwGiPSIkLxLKn7LamSAWFjuXmbkpRSjqK85LeON61hgIGVP f2Go62wJ2S5DKuVlu19hEh9aHUezAnlD3Nklo/paV5iVQwQGzk76EqivRwOp9sFL4yNL aHfJmxvB8grQgmmurhhWgnsYGIlIZJ4iFFXCSyco25SO1B9TQL7cCAPF3/1dP59+ndyR hhZ6b4jZR55+ZyLAJ5NJkOY72xZM1p5GCXunFirl2HDDDRNYlLKFOYy/RNZL4ceQEXOx XSpNx/TOLVpfWDK2I57/T10iLioiEmF8AelFLkm75hUDhC84taGZ0RjKWNd6jhYrX3R3 1iQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827593; x=1795432393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=x9fh8JA9gVFz8cwQu86NZFxxA8oztzeT72ENqRdxmBc=; b=dmBFS7V6DWXQfK+BlZjENQFQWqgJzfmEedxIdn5jkKmu2jDubWGScQYKr4tqetEt+u uT4bOw8UPph6Ng6tXci/ZAJIlWHT8rkoiMZiDLpqqkewU64OesuB2lAqccqI8nu0M7WB 9C9Aez1qmFdQ5ixbFm72MSD6PbmQrXcLygV8zrbunreyhr7z0EWN1LwWxGuXGRn/4du/ kh+J1Pd51xQW47Z2vUrPbZx7Qt53Z0LxxlpL2l+8GS6AltfgvkpkqfLQGf5e52PeOsOa 1DUQ7fvyyWjCQ3VD68yTwMRbzI+6bolTADg1JMeGyK9chrJdJiUdNnOQk9L70IHJQxHS j+YA== X-Gm-Message-State: APuU4Z9jV/pEyPLFCoQlOLpPWD6hr63En6puCMZXt6+rDzKJVhYl2AV2 CSE5Zr7LnYvbnuMQv+RFsvVuZyarQ0AmlBnWWPpEFMu14BjjR+Hog7BJA1oDnjm5CVlHm4ylv8o tcWJrpWc= X-Gm-Gg: AZFdTZc2eWgG8ZEhOFUM8aSya2Ny0J4mK7dksnQH10lB6iInSLA1h5TgBgHOMDfpepS bDT/6oLlzW/HnboLEGbwaB7iiSqArS3XaFw2JsRLzuU3ztknRUcr0HcYpGv6cm7h1//j6imiNI0 nQdzybQeZ40dvDSv/qakG/t4u2NThq8Ym1sHYLX8KE6gwrzGeni7k2WJSEJeAHPtQ5lR08mJ1zu 7rxlxvcqlXCw+mQkXVFzj/Cx1+QEE8tSi8FpdEAc0evITldJKkya7i8Np06Tw6vloTpmPNjOkow lxXUQa9wdAIZ8RS+o/SoS8E2yXfntReMlJr59PZjqXxJwYQgMaR6Ro3sQvynV9M9vH+9ZRQg4BP Nkh467W9pRhkhdEUjiXjePtwVNu3Ecz5oVuVb7F6H0jBetsdEDhTRVz4BS0SiptIHOmnziyUSvT OQ5mbEiE4HcNH0yVWwtj8nsE80d4NB1engA4JoN87bkAgo766Oaa+yeXqzBsmXG8ld4Nl60k1/Q RpKCZs25bjVL29PF6vYhEz7UO8cwkv5kGzSsIDVSKSqhaLa+4ClYZmwxh02GNjBtBpfMf0lgVJm hkcKS+PN0Zr5TzZGfGLKJst/ExE6KRWNnXHhBbKPFHK/7YjGpC8MpiEIu6MgpdnLg6QQdza7XZ/ WYn6Kacc6nE8bGf3f9PhgjcRgT/K7cWM2iA== X-Received: by 2002:a5d:5e02:0:b0:499:81db:47a3 with SMTP id ffacd0b85a97d-49c71e3e123mr21600359f8f.11.1794827592704; Mon, 16 Nov 2026 03:13:12 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/33] hw/core/qdev-properties-system.c: Don't leak str in set_drive_helper() Date: Mon, 16 Nov 2026 11:12:37 +0000 Message-ID: <20261116111303.1692832-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827990936158500 Content-Type: text/plain; charset="utf-8" In set_drive_helper(), we call visit_type_str() to get the value being set as a string. This is an allocated string, and we're supposed to free it, but not all paths out of this function do so. In particular, the "block backend already exists, change the attached node" code path does not free the string. This shows up as a memory leak under the newly added virtio-scsi-tests/replaced-node-size qtest: $ UBSAN_OPTIONS=3Dhalt_on_error=3D1:abort_on_error=3D1:print_summary=3D1:pr= int_stacktrace=3D1 \ QTEST_QEMU_BINARY=3D./qemu-system-i386 \ ASAN_OPTIONS=3Dhalt_on_error=3D1:abort_on_error=3D1:print_summary=3D1:pri= nt_stacktrace=3D1 \ ./tests/qtest/qos-test --tap -k \ -p /i386/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-scsi-pci/virtio-scsi= /virtio-scsi-tests/replaced-node-size [...] Direct leak of 4 byte(s) in 1 object(s) allocated from: #0 0x55f7744155e3 in malloc (/home/pm215/qemu/build/x86-tgt-san-dbg/qem= u-system-i386+0x20115e3) (BuildId: 271ffb42d2e322de7813813d8c6cc85351e48a4f) #1 0x713dbd345b79 in g_malloc /usr/src/glib2.0-2.80.0-6ubuntu3.10/debia= n/build/deb/../../../glib/gmem.c:100:13 #2 0x713dbd35b988 in g_strdup /usr/src/glib2.0-2.80.0-6ubuntu3.10/debia= n/build/deb/../../../glib/gstrfuncs.c:323:17 #3 0x55f777208021 in g_strdup_inline /usr/include/glib-2.0/glib/gstrfun= cs.h:321:10 #4 0x55f777208021 in qobject_input_type_str /home/pm215/qemu/build/x86-= tgt-san-dbg/../../qapi/qobject-input-visitor.c:542:12 #5 0x55f777204d1c in visit_type_str /home/pm215/qemu/build/x86-tgt-san-= dbg/../../qapi/qapi-visit-core.c:349:10 #6 0x55f774df80d1 in set_drive_helper /home/pm215/qemu/build/x86-tgt-sa= n-dbg/../../hw/core/qdev-properties-system.c:129:10 #7 0x55f774dee9fa in set_drive_iothread /home/pm215/qemu/build/x86-tgt-= san-dbg/../../hw/core/qdev-properties-system.c:224:5 #8 0x55f7767cc5c8 in field_prop_set /home/pm215/qemu/build/x86-tgt-san-= dbg/../../hw/core/qdev-properties.c:89:12 #9 0x55f7767ec12b in object_property_set /home/pm215/qemu/build/x86-tgt= -san-dbg/../../qom/object.c:1562:5 Switch to using g_autofree so that the string is properly freed all all exit paths. Cc: qemu-stable@nongnu.org Fixes: d1a58c176a11b ("qdev: allow setting drive property for realized devi= ce") Signed-off-by: Peter Maydell Reviewed-by: Denis V. Lunev Message-id: 20261105114635.3286252-1-peter.maydell@linaro.org --- hw/core/qdev-properties-system.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 4d605c20561..d5b227dbecb 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -120,7 +120,7 @@ static void set_drive_helper(Object *obj, Visitor *v, c= onst char *name, DeviceState *dev =3D DEVICE(obj); const Property *prop =3D opaque; void **ptr =3D object_field_prop_ptr(obj, prop); - char *str; + g_autofree char *str =3D NULL; BlockBackend *blk; bool blk_created =3D false; int ret; @@ -155,7 +155,6 @@ static void set_drive_helper(Object *obj, Visitor *v, c= onst char *name, } =20 if (!*str) { - g_free(str); *ptr =3D NULL; return; } @@ -209,8 +208,6 @@ fail: /* If we need to keep a reference, blk_attach_dev() took it */ blk_unref(blk); } - - g_free(str); } =20 static void set_drive(Object *obj, Visitor *v, const char *name, void *opa= que, --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827701; cv=none; d=zohomail.com; s=zohoarc; b=kCRU5mRzTZYVtCcXVqKEHAI2+fQzARX4gd1d8OdMEZUS3Lb2yHNQ3ISF0QI+Vsr0fHf/MYaCgiJ5bpfmla24sCKwmz3iSgulTHRjsVt6T36lvw1ejwJ2Gouc1V0cCtbw1784aBKjYmmGOCA+fGQ268NpwzhMhhd9yvyK/z+yops= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827701; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=EkTO5OKhIvmjA8dCdWmtqg7FDtpodxdkVq2Or8ASgtw=; b=Ssw2kOlhy4UnZ7Lcc7ilwrILNcr0PsWhLfZVZfrw89WQtzBj9koloYB1He1OCzy7kTU7L+uZ+CMBam7f2amMCCChwySkeC5eUhhQ1iNTV/kk+1HyMg4wZwpdK5lQlNajGKFvLWM737EeDw5gxmHNEAd915DStOor2DLEQdMmKo0= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827701347903.6817481452309; Mon, 16 Nov 2026 03:15:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueZ-0003t8-WE; Mon, 16 Nov 2026 06:13:40 -0500 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 1xSueF-0003oy-IE for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueB-00028C-LZ for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:19 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4b467581b98so27278645e9.0 for ; Mon, 16 Nov 2026 03:13:14 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827594; x=1795432394; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=EkTO5OKhIvmjA8dCdWmtqg7FDtpodxdkVq2Or8ASgtw=; b=X2bB9d778RP+icoc5MZ4Q533/cc9dwiLtlBhti4pTP3ciOHWFmMeWdzlusxrgmbU0X j4jPAfKxNiBEy1Xd2jurttyDMaLxwnqmacZoHgwX1D27NvVc4D47BM/Z4vIivCLM+Xes Y9Xcb5bafTlCndSWRhMCGhDEgpKCcJRhQu+RAK0HcAYKncm4PzoVerj0Yo2pHUxr4mgV agZ6WHs97gcfPYndiG38vU81FsVoF/9myFCZJoPho5gZEDbgTyuiJCLq0N/AvFL7lOaQ EKxptJcGnKOo2TJchpcutYZPlgFEnOHnk2QhD27NqY+WHen/ppZNuxMHmJJiLX7s/9Pc rf5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827594; x=1795432394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=EkTO5OKhIvmjA8dCdWmtqg7FDtpodxdkVq2Or8ASgtw=; b=k4DA1LvR8zyVY+kxdOMNdGPsZpAFFjP1nyEfKur1Uvq5PfFksD11dsVoj5XFe9cu3d GJjyKZKLSOgsOQGfRrSrorviU6+bDYMTPi/RJAkXA68a5mfla0ZUEqMqNOoaV26mUTRG jfo5BAjU1Dtm6Y8XAclsX03zTOcu1+UO5xSP/waZiwcMYPLNbxdU+Fij4JIiv1yV6uGV CkaSO+wZ2Dy9ZoVVx23Jfc8jnwDnThw0t5H5+cfk/JBlT4jsV2UDpjcSTQmZXZK+UU5U 0wwvOgr+FSSK4QBLOt2xxQZCf/Tx62vsNnkcBtteg1zQ61TCESL0v/eH3tz3rcr/7Xhk RSug== X-Gm-Message-State: APuU4Z/Fa2xR3gyTle9mx1EFbME3NyUOVah4WRxUNULFedO32PSQzdrg fBNJYuOdPQBZbHy7/uK2fbr6bHmyEatXFSwigbPNCht1BifuyGUN8mEzMf4wX3Zn+NZs+jDYpW9 vbmg5aW8= X-Gm-Gg: AYBFou3b0qDjUHoFQCtgUcdH1KrDEWuhEju6DSH/XrHj0nRJHn/ibMTzb6APSTAoL/G ibcgMkmshGJMuTlOT5305F4GYhvonfWVxRZ51jhCyuGh/a9HGUJ2CaySfr5ouNpgiLVZWK/cAJy gCSBasgt9znPls61px9BEw7PNV2QksEg96gegLYv5TG54vCtNvhFH+sg/+qpoxkWaDNOEbO+WkD dnTlGo8AlX2cERRxxMRkJsrHIyybHJGt+DbDJH/6+daCoZ5+9j5cJVyXmbCb7XjKH/OmEer85jI fPE2zH8cVdmIwsIi7fo5+MMrP4NEQle+pphmSK+u6ap+EpgzYgE5I7QFVYF9PgU6MHNv1AT+E1U QFqIoPod3EfgwK3vE+PNcYLuGm401jrFM3n2a8J5CoNbi7JDOTbwStqWlm/hiEOu+xrtSP3bZwN VgJQicdP67Uu1mH76q86wBIlnGT/T1/4d61+XSmwTfTP777DTc8IWehqTYG6lyV8iIMTi1+/p41 b3EmZ2NLM+OOuyAc59i+G2IST0TB/2HrDbbkjSjhH7cGvm+2UAvvwkLEwzRzYOvSucKPtrb0p59 UF/MRrUk0vmD5gP53PP0rNfxN/dDm2yiLXWCQe1xvr+1iWC1iYKuAsjBB4tmKpESA2btg3MsYF3 sTz3yGBliquB18mcjBqWRLmCfqt9d5HaSDA== X-Received: by 2002:a05:600c:628c:b0:4ba:7e6:53d6 with SMTP id 5b1f17b1804b1-4bb55ae78c1mr218033985e9.33.1794827593736; Mon, 16 Nov 2026 03:13:13 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/33] hw/watchdog/wdt_imx2: Set vmstate minimum_version_id to 1 Date: Mon, 16 Nov 2026 11:12:38 +0000 Message-ID: <20261116111303.1692832-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827702218158500 Content-Type: text/plain; charset="utf-8" In commit d9abd0253be90 we made a non-compatible migration state change, and set version_id to 1. However we forgot to also set minimum_version_id to 1, so the state struct now incorrectly claims it can accept migrations from the old version 0 format. Bump minimum_version_id also to 1, so that attempted migrations from the old QEMU fail cleanly. Fixes: d9abd0253be90280 ("hw/watchdog/wdt_imx2: Remove redundant attributes= ") Signed-off-by: Peter Maydell Reviewed-by: Alistair Francis Message-id: 20261106163657.3825938-2-peter.maydell@linaro.org --- hw/watchdog/wdt_imx2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c index f8129625e58..abb8edfae25 100644 --- a/hw/watchdog/wdt_imx2.c +++ b/hw/watchdog/wdt_imx2.c @@ -224,6 +224,7 @@ static const MemoryRegionOps imx2_wdt_ops =3D { static const VMStateDescription vmstate_imx2_wdt =3D { .name =3D "imx2.wdt", .version_id =3D 1, + .minimum_version_id =3D 1, .fields =3D (const VMStateField[]) { VMSTATE_PTIMER(timer, IMX2WdtState), VMSTATE_PTIMER(itimer, IMX2WdtState), --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827836; cv=none; d=zohomail.com; s=zohoarc; b=hjdl7OK/e99Rf2T7W26gfI+qAoznpUVetj3mWMSWeaX4l8DMIs4/Po7r7eDAPz7NNk9kuwQkOINgwykPFZemQEqGTk4Wm1Xc3IiRW4mhEtsXiMIzGAFyvimdADSEwndsbWaeJE5gJfBfwosqziRcfeuZ1NNhcEK7QiSMfsh9IlI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827836; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=jW4FwOrNyMRAp5MwOlDG5ApuPE9Vl4v1defYt6joA24=; b=GBhHSeox4a55PZwc80v/Xi7eK8iXWw8vN8nSMNDNFudcmy4354BMZZAgIRpJYJ6d35SHfMZ8FwbkYoWVq+ICOXYTpZB0BxtV51hR06cQyodznoNnkvYGaLofd65oMlehMGwJRoDCvPDoFZYRU+XDe1qBm3WCMYiJoFdcGWJvx+g= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179482783645796.2735540813311; Mon, 16 Nov 2026 03:17:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueq-0003yE-8e; Mon, 16 Nov 2026 06:13:56 -0500 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 1xSueG-0003pl-Mr for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:21 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueC-00028G-Cj for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:20 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-491971ac844so2911069f8f.2 for ; Mon, 16 Nov 2026 03:13:16 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827595; x=1795432395; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=jW4FwOrNyMRAp5MwOlDG5ApuPE9Vl4v1defYt6joA24=; b=KjB54yk2q9i6hE0/WuQUyeTE0gdmZaRodemN1SVoaRb0Xf/RrDVoY3FSZpI8nwGSIk AybVa1r+NbxwpR65cWgIbC9yW/Iim8fKXFTmcxB6AgfIAA9eKPx2e8efL80F3PD+bbUX H5zXWZAG+o28Z0vVFylovz9NzHx2P+YErhTidLMPE/jtcXQSphhRZ5uJxp0vNEWlQga6 0BRo0DrFWRyO5oIN9K4nWCi4Qfk0y1rMEeTYewWV22KM3mshOYG/eCH+Hx+P86rpdNUC 77QKonVjClTGAZ3uZDgvCkG9O1xl7RG54TQza15if0GPWRZmUu8C8mMvr0lVvF+Tt7SA G+5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827595; x=1795432395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=jW4FwOrNyMRAp5MwOlDG5ApuPE9Vl4v1defYt6joA24=; b=hzBZoJlIDKvAadSBiFhdtGDHoqFPRUmTWRy7AyYLuAKIyvMgfZ8dEIEVI0oixt6q6b yL6FEenvjcIUcuCVpZl/C3idLlfLLUwZ/1rj5UVKtGoOO54cqDrz2SylHkiLVdyA6x3k 329Xq8DmtfPAE/q660BNJwYNarTEwNAIfcYD9DH3RShpL34QK3eEaeyl/AAfladnrbrb Ui6KSX16eqaL8QrWiddcfC/C7kLa3MGJN6s3DibzyIlppzZb2/VvGsi+u7M8ZMsQUQ88 te9fY3+lwPEpKWx3mbcHZ+hrVokd+yi47E6pV1PMjBGpey2Uat30gntLLzOI4QhAPHS6 N6ng== X-Gm-Message-State: APuU4Z9OxU+psGUj6Kdyqu0/lUStjcRlJSybXmE9R76ekwP1Tm+a8Sn4 Os6c3DqEbqrxy3ye+kVkj9OPcbZYuoNel+/Axz3uuvMqjpVS0TKoj90vQHBOMnk++Vrw3vCd5eI kC28JqxE= X-Gm-Gg: AZFdTZfSHvrmzKgJUbDExRNYadEhaNEade+Ajy6wrQ66kdU0QabltAIJ+jKKnYfbs2V BRxeTW+fg1b4EHSrK00YTeipY5pKgZiTxBcF3WpDcB6GJ99Wct9C/HdJvPwRndl6ACATVcBuPRE vp9er2Xr3TQ8eRBqS2YriWwNOd4+Evkz43XEoVao5cqkiHrXjrdNrPXFsoP13Gmnr7wSyXdqmw1 Yh+o0a4btuh21vsv0OgXyiI22FQ2M6FtLIw1HopNI/hMRz6ZEimO5HUnN7V3tNQHb3x3nr43Mww fISTBmzutAZyq2te34OcYp9NPkNacrWsxk9jcA6M79o9pk4WhWI2DCvFwKgfarb7moFaTFfFr7D Lee1GXUuyRVgd4ogundcXPOpfM7BODBPcCoFm/lvXs+jywkbEdt4mdcvOQBpf37nAoeDqpMvmWd URzu8Fakeo0ysV8IflQSoDtU/XoxEYc0xmbdn8k2eTjdH98gy0N4M/J68uI77uc7G5aRpQeqEOw 5sn7Euu9xp0dnqWlVJ40ClGJLUuYKU2GGUDdMbvQGlBDjodbVYY3crO8LWbppg9cewNhyAl+Ovv j79uUMcD72QORExM8QMUoLQCEaNGHbI8IBI90eIckGY6zcJSIox1EQGaby6r/8txA6qTGqIPyDm UfH1PpKZ10nwNe6NT3BJOaWduSOgzfwQkxw== X-Received: by 2002:a05:6000:2087:b0:488:57ad:d5c8 with SMTP id ffacd0b85a97d-49c6d453dbbmr27879732f8f.3.1794827594648; Mon, 16 Nov 2026 03:13:14 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/33] include/hw/core/ptimer.h: Fix 'version' argument of VMSTATE_PTIMER Date: Mon, 16 Nov 2026 11:12:39 +0000 Message-ID: <20261116111303.1692832-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827837512158500 Content-Type: text/plain; charset="utf-8" The VMSTATE_PTIMER macro is defined to pass a 'version' argument of 1 to VMSTATE_STRUCT_POINTER_TEST_V. This means that the field will only be used in migration when the vmstate struct that uses VMSTATE_PTIMER has a version_id of at least 1. This doesn't match how we define other VMSTATE_FOO which don't take an explicit version_id, which is to use a version argument of 0 (e.g. all the common macros like VMSTATE_UINT32 are written to pass 0 to their VMSTATE_UINT32_V counterparts, and so on). It also doesn't match how we define VMSTATE_PTIMER_ARRAY. The practical effect of this is that users of VMSTATE_PTIMER in vmstate structs which explicitly or implicitly have a version_id of 0 were actually not getting their ptimers migrated. This affects: vmstate_xlnx_csu_dma in wh/dma/xlnx_csu_dma.c vmstate_k230_wdt in hw/watchdog/k230_wdt.c which are used in: * Arm Xilinx versal and zynq machines * RISC-V K230 machine Most ptimer users are unaffected because they took the usual approach of explicitly setting their starting version_id to 1. Fix the version_id in this field. This is a migration compatibility break for all the above listed devices/machines. Since the timers involved are in devices where the timer is usually stopped (e.g. the watchdogs only have the timer active when the watchdog is enabled and counting down), the consequences of the bug are likely not visible to most users. We could perhaps attempt to preserve migration compatibility here, but none of the affected machine types are versioned and so we do not promise cross-version compatibility, so do the simple thing. Bump the version_id and version_id on the two affected vmstate structs so that attempted migration between old and new QEMU fails cleanly. Fixes: 852f771ec9e5c ("vmstate: port pmtimer") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4705 Signed-off-by: Peter Maydell Reviewed-by: Alistair Francis Reviewed-by: Bernhard Beschow Message-id: 20261106163657.3825938-3-peter.maydell@linaro.org --- include/hw/core/ptimer.h | 2 +- hw/dma/xlnx_csu_dma.c | 4 ++-- hw/watchdog/k230_wdt.c | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/hw/core/ptimer.h b/include/hw/core/ptimer.h index 4dc02b0de47..8513f8917e3 100644 --- a/include/hw/core/ptimer.h +++ b/include/hw/core/ptimer.h @@ -300,7 +300,7 @@ void ptimer_stop(ptimer_state *s); extern const VMStateDescription vmstate_ptimer; =20 #define VMSTATE_PTIMER(_field, _state) \ - VMSTATE_STRUCT_POINTER_V(_field, _state, 1, vmstate_ptimer, ptimer_sta= te) + VMSTATE_STRUCT_POINTER_V(_field, _state, 0, vmstate_ptimer, ptimer_sta= te) =20 #define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \ VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, 0, \ diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c index 436f9915e02..ea703dc00ce 100644 --- a/hw/dma/xlnx_csu_dma.c +++ b/hw/dma/xlnx_csu_dma.c @@ -679,8 +679,8 @@ static void xlnx_csu_dma_realize(DeviceState *dev, Erro= r **errp) =20 static const VMStateDescription vmstate_xlnx_csu_dma =3D { .name =3D TYPE_XLNX_CSU_DMA, - .version_id =3D 0, - .minimum_version_id =3D 0, + .version_id =3D 1, + .minimum_version_id =3D 1, .fields =3D (const VMStateField[]) { VMSTATE_PTIMER(src_timer, XlnxCSUDMA), VMSTATE_UINT16(width, XlnxCSUDMA), diff --git a/hw/watchdog/k230_wdt.c b/hw/watchdog/k230_wdt.c index 1f83b499e82..fba2013b8f3 100644 --- a/hw/watchdog/k230_wdt.c +++ b/hw/watchdog/k230_wdt.c @@ -234,6 +234,8 @@ static const MemoryRegionOps k230_wdt_ops =3D { =20 static const VMStateDescription vmstate_k230_wdt =3D { .name =3D "k230.wdt", + .version_id =3D 1, + .minimum_version_id =3D 1, .fields =3D (const VMStateField[]) { VMSTATE_PTIMER(timer, K230WdtState), VMSTATE_UINT32(cr, K230WdtState), --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827819; cv=none; d=zohomail.com; s=zohoarc; b=YXme3RG7z3Lm46keNGLCH3l+uuAmkOOoFaUiIx9ODmg3jprS3qoKm6uHiv2NFU2iRzvGqC9GvroLiBClF0vxiZo2IqbkeAr6WB54SefG3iYIh0WgLq+3/3y51dTGh0FucYRSTEMU8XqM2pNvz25hRw7mXPuSi+k5OodoQa+ro+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827819; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=du6iacM3+OChFwCRCiaLKdvRu0Ssw2623VpPE1+iVeo=; b=E51dYT0JY75gqKGVoBNibbMwCpDBZlGlrFAZdrPsFU7w5xw20X2QpLfVz1FI2vfj2OKuKyGKj5AaTJqVef8A9/3YciZMr8DLum7H2G15rgllMVhjYw8Ix3H3decT9kDp2xL0Bz/Mz3JX2GhWna+f2KxlwKRhktZBZQ3QssHk7/I= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827819190566.0442509875222; Mon, 16 Nov 2026 03:16:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSuex-0003z3-4e; Mon, 16 Nov 2026 06:14:04 -0500 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 1xSueI-0003q9-E5 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:22 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueD-00028V-1y for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:21 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-498f5fa5103so1385063f8f.2 for ; Mon, 16 Nov 2026 03:13:16 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827596; x=1795432396; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=du6iacM3+OChFwCRCiaLKdvRu0Ssw2623VpPE1+iVeo=; b=De2bGksdxQdnEm85qpWN89yX1BqIyfR1GHIE8RAZtnKYwNRbXf9whqGohw3IOo8hYF clPE3MvjtwNHZQ7SvOdtPcf0310wS5R/T0q4caSHnyo/4kyS1tIhZBRxgHex7cEKwq0S Gu2FwQ149zPxlvt6TByhfphROVhPPX1bIyzbh7NuwBzy1IEKwCEXuOR2F3qR85lIv7LB cI+hpNNfOiviIf8NKYveE9pRrgVdmG2PcMB0pUqeAormzz0UiX5MUcYnXZ+VFkPfbHaW juUK2gBl9PNi83OjGFjFVAHY3lKK4eMf0jJTFtOelgAX/m018kR/RUUAlE/o/gJubPgN aLhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827596; x=1795432396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=du6iacM3+OChFwCRCiaLKdvRu0Ssw2623VpPE1+iVeo=; b=MVEW8AL1FPfn/PBsNLtX8hxvSY9Ggmhr33yPQ/8dD6Iwla3js3OmwtEhz6UMkAqZPL 2NJboxmM4qwLn6wrzBZCmMDGLsdsYRdFkrD2j3TDns5Pd9p0bVE0kiw0Wt0NqiOdRF3/ m/UggFMnCATSGXo+Vw2VIgrALq+OgE4cnQzJZC60NP+W8eiqLN0BikV93d8WizhYgWaX hAjgY0vI6uSORqzFo6QRIoPwYquvph3WRROzQQAIeQtsQhqwiOkYVX8e/PlgkvdSRw7W xyPmtJIwXteQgnCcTf8fa9bWoRERDpcXmDTazSlZbYIWJlt6ofZ36hFrScnSi9IW58t5 Ra5A== X-Gm-Message-State: APuU4Z+NI6hQO1X68adkMa955Qo0b42kug10VlERr9IB0G8vJvsDSOVr oRDjGexwLXrPNLLdsvTsXXDfO/0GVPeEFn729P4K2Pw+EQ5IvE6FVnYN50Zmy85nm3qlYQIN0DQ NFmEYTIY= X-Gm-Gg: AZFdTZdxGxKXi/8e7gmqtmSNEvMXYvIBUtWqrvy651OwIUDDEghBcflqr5DactBh2BA pk2jBnCQLccHv/wPhFNF6p9n/ZBpGU/LhvjApVrqD0wqRTCoxj821F7lkpqSVsk1WF6jlT/a3eO VCWFtRCMZEQD7LPYHmnOhOb/pkyiqjs5nDTALnJcKncBNyVYh9xgbJoSCcNPYsI1dC4LIYPynh6 XnsC6BBoHS0D4dED6JgiKI2YK/JcgLqR9oqLbHWABjGj0JbyTqHHy4SCi+ZXNPE23WCHfeqKopw 3PTYoWHlEsGjzAxWOi8hcp8VAv3tMHHqRHLICzNR63MMBrA2dMss2h7n+FL5U72s3ucf1DQWQvh 3LBmye7PlsL07pv2klyna0LYdPqYmfUIIqo4WB1LuASYNyEcQIwAqxvHdsrmg1k/W/khJm34+QS Rg//FRD27AT/19ZoMQ7nlxIcrQANkvu8hgSb7U71HcgvkMRD1SsJvXFYpItkz/eSJFNkVgWvRaO r2GERRq0/dwId+9Hv3a8RTN1SYeCZgfXe6V7xqU2/wpKhQ7fdYcF7S03EfnwsKJBjPEVsombQAu HN66vCrJhotlVjIYfaXrO48lwIy/ygtnRtsGAnhibZPZuloPV32LqIOC8PIqFG7/4WW9SubtVl6 U5JK22gzBXfYBm1JRlHkrqfQ8NR3nxJHxxg== X-Received: by 2002:adf:e19b:0:b0:498:b92a:2f7 with SMTP id ffacd0b85a97d-49c71d49040mr20864152f8f.30.1794827595594; Mon, 16 Nov 2026 03:13:15 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/33] hw/net/net_rx_pkt: Handle bogus l4hdr_off when validating SCTP checksum Date: Mon, 16 Nov 2026 11:12:40 +0000 Message-ID: <20261116111303.1692832-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827821374158500 Content-Type: text/plain; charset="utf-8" In _net_rx_pkt_validate_sctp_sum() we calculate a checksum that starts at the NetRxPkt::l4hdr_off offset. If this offset (which might be guest controlled) is larger than the size of the packet, the loop that walks through the iovec can walk off the end of it. The resulting out-of-bounds read in attempting to convert the iov to a buffer might cause a segfault. We also weren't correctly checking the return values of iov_to_buf() and iov_from_buf() when reading and writing the checksum word: if the l4hdr_off claims the checksum word is half off the end of the packet these functions will return the count of how much data they were able to access, and we should fail if they don't write the entire 4 byte word. Return "checksum not valid" if the l4hdr_off is too large or the iov accesses don't do the full read/write. Note that this affects only the igb network device; the other user of this function (e1000e) does its own check on the l4 header and won't calculate a checksum if it's out of range. Cc: qemu-stable@nongnu.org Fixes: 907209e3111dd62 ("igb: Implement Rx SCTP CSO") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4138 Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-1-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- hw/net/net_rx_pkt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index f87b6f046cc..03a35f03154 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -549,19 +549,23 @@ _net_rx_pkt_validate_sctp_sum(struct NetRxPkt *pkt) uint32_t original; bool valid; =20 - for (vec =3D pkt->vec; vec->iov_len < off; vec++) { + for (vec =3D pkt->vec; vec_len > 0 && vec->iov_len < off; vec++) { off -=3D vec->iov_len; vec_len--; } + if (vec_len =3D=3D 0) { + return false; + } =20 csum_off =3D off + 8; =20 - if (!iov_to_buf(vec, vec_len, csum_off, &original, sizeof(original))) { + if (iov_to_buf(vec, vec_len, csum_off, + &original, sizeof(original)) !=3D sizeof(original)) { return false; } =20 - if (!iov_from_buf(vec, vec_len, csum_off, - &calculated, sizeof(calculated))) { + if (iov_from_buf(vec, vec_len, csum_off, + &calculated, sizeof(calculated)) !=3D sizeof(calculat= ed)) { return false; } =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827755; cv=none; d=zohomail.com; s=zohoarc; b=iY4V/S3AMnTnF2tNa3tPqMsO4kMGy8lVWetg/XU3ss6nm6pfGsjZcNdckTm388evsW0mQ98vnBU9bq3KM4uPeNLp4VKuhuZPXLMUPuQ4SkizQYiaZfsfZh5c6fTOJp7dd+VRGIJy4tGOGd0R2XXxzSHfO2rCIlsc8fLXk1H093M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827755; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=gNUPkpbDXQCDBt3QEsN8Lb8ogQufVlkJZMGSxDNGCaw=; b=bmcMhzRCUgDHQKSQQgcuMOMKbltjHVCsk2/5kuIxDmm0SmU/mqr0ePfJb1i6fTMu0NHTdP38XWRYegxWtG9SnAR3RtIr057LUCDXWJGfA28p132nqya1pVP9tzEj9CWioepZxMUHN20DE1dCbBR6jkkmsVUtVTn5wb3rERa0Aak= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179482775506370.93159902754667; Mon, 16 Nov 2026 03:15:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSuec-0003uu-T3; Mon, 16 Nov 2026 06:13:42 -0500 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 1xSueI-0003qB-Fe for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:24 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueE-00028p-B2 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:21 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-49134c8509fso3274508f8f.1 for ; Mon, 16 Nov 2026 03:13:17 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827596; x=1795432396; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=gNUPkpbDXQCDBt3QEsN8Lb8ogQufVlkJZMGSxDNGCaw=; b=CouZtneyNMtccaoXudVmuJc8T9N5RdpsQMjHeAzTQWO0wkVKw5vMtIMPp4y6FWKhEc ZRBHtNaUoSK6vXYsbirSJsShbaUIyYM2sRUpqCd8jhI0pnnXMJg2A+EOrwtwS1gAD6J6 maLR2Ohzg6ouhCGMkcKOqYp86Kuicf54TQw4cwVLxaft6JE7sStxEHcM8rz3upgtZKX1 WKNumYRe4w50jgbCVLvPrIR2GbxfB4Vs23yrDq5tZt2c6MNxJ/BGywn9Cw+r5hFR3BpU 45r1fnF3L+p0iX7cjpQ3VBzaepkgWIEVL4hRA/GX9PmZMIOCGgWhU4e1qMzIyYxKQ1yL dSxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827596; x=1795432396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=gNUPkpbDXQCDBt3QEsN8Lb8ogQufVlkJZMGSxDNGCaw=; b=fAWdE3v8oI50QjxGd4pyNYcJYM+6Ixk42Bz/J3ojhwSaCtO4cJtAK21HYK//je8qP7 NX87TtrPQK0ZqBKU3IzaNxXr6XHHsjPidPWQNDTP5HYpk+5j37rWuhlKnhCCsk1DT4xn vWVRdSLpyFeSQK3Cn0JRs3mOs9GhoofWOaa1RwamWgq4E/kXP0RpkmuXuIJ0+k1MRqBB S6UvFuem38g/x3Hw/pcA9o4jSMECuI+eJiXCT+TTVUOiYWX/t3WOQra2zvk1MzQHZMxe fHxiZjrKxFHKHCpr/kEYe7tqBB+jR32gDumyFw343S7jZPzZK8+8IjZLLd6GiYlTpQzn XXvw== X-Gm-Message-State: APuU4Z9REQuvg2LUaAQazPMwBbfPdzDMLYcxKdNQmgNvTcEr3dZGHfjN l9n/H7wu1CP74xKuBEnFsVY6xQMlXpIyCkpzbcBIrodQAzzK+dm4kyXCJgSESbhUfsBIyzdfKun biyRE6kc= X-Gm-Gg: AZFdTZcx4HNLinHpqbkZyWk+qvAz+e0Lw51XMX6jXtyo7fxrS4QBWeHan0cTQ4jrRuJ 5vDRU/Tr9hHYcGtn4120EF7Np8gCEOxKGJPVq3zL676e/45IxFVBGjvUPIDX9CEUnAT5Onkg+Fb iQAPB0qUXNnFoTF1Y2OgztFNi6drPp9Rw1t7KUN2IbXSBGTufgLdO/+HyTSCWkEwnxE4hJoHSV3 DU+XM4yDfFEXFSTI54144+o66Z4C/LPG+pO1faOMnx3VmgDB5QVqGsimx2hi9v8Mf+sV3zmGaxA crrL4Fr6S0tTm1IdA/veSmQg30B+bmJvE4rlBK8qlASGsMWnpBsE2yT/SfaFwsQY1W/qV3Xxanv d+0AOyOnFkmwT93siWmC1f6QPCp+ZBgAKF6jrdPX/dIoA1fGpd4xSSY7LTTZoMJVpUyZRYhgCvo 4G+uswfy/OnOe/jmjfq9UWcFjjh9Wd0zosE6TnQqt678GSrjAUBKacUhdM9fnG3la78TBf2yrrC vPpLreXHHnvq5eeIYE0iJS77geK7V9e0GPkYu5+uqGQPEBtSY7JYNsR+TIks8/Q1BCdqzBcoIhq RI5xuEgKuTwKM/XNlj9rpYPEHTDkInCCJgwQTgBI5Xxl+cCu0LsYnT9dOZSfBWBsmyWN/2sr8wv RazyDAw+jQWBCdySQg8Q1JODRmfQ23dTc9g== X-Received: by 2002:a05:6000:29d9:b0:498:b92a:30b with SMTP id ffacd0b85a97d-49c70ed7d88mr14144803f8f.15.1794827596569; Mon, 16 Nov 2026 03:13:16 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/33] net/eth.c: Check for undersized L2 headers in eth_get_protocols() Date: Mon, 16 Nov 2026 11:12:41 +0000 Message-ID: <20261116111303.1692832-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827756699158500 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki We already have some header bounds checks. Add a missing check for L2 headers. Signed-off-by: Akihiko Odaki Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell Message-id: 20261109-eth-v2-2-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- net/eth.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/net/eth.c b/net/eth.c index 12ec316e240..59b278b887c 100644 --- a/net/eth.c +++ b/net/eth.c @@ -139,21 +139,28 @@ void eth_get_protocols(const struct iovec *iov, size_= t iovcnt, size_t iovoff, bool fragment =3D false; size_t input_size =3D iov_size(iov, iovcnt); size_t copied; + uint32_t hdr_size; uint8_t ip_p; =20 *hasip4 =3D *hasip6 =3D false; - *l3hdr_off =3D iovoff + eth_get_l2_hdr_length_iov(iov, iovcnt, iovoff); l4hdr_info->proto =3D ETH_L4_HDR_PROTO_INVALID; =20 + if (input_size < iovoff) { + return; + } + + hdr_size =3D eth_get_l2_hdr_length_iov(iov, iovcnt, iovoff); + if (input_size - iovoff < hdr_size) { + return; + } + + *l3hdr_off =3D iovoff + hdr_size; + proto =3D eth_get_l3_proto(iov, iovcnt, *l3hdr_off); =20 if (proto =3D=3D ETH_P_IP) { struct ip_header *iphdr =3D &ip4hdr_info->ip4_hdr; =20 - if (input_size < *l3hdr_off) { - return; - } - copied =3D iov_to_buf(iov, iovcnt, *l3hdr_off, iphdr, sizeof(*iphd= r)); if (copied < sizeof(*iphdr) || IP_HEADER_VERSION(iphdr) !=3D IP_HEADER_VERSION_4) { --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827739; cv=none; d=zohomail.com; s=zohoarc; b=GOdZMAPtBVrXBW20K8NJ/UZyelgN2eSfdk6o/yXC0at0q7zkmbcQWU1pHPu/xXGRsn422unkUkuF0CPE9Vd0zi3y9dDJG7viqgupApME1uYgEruK3+uL0lVyL68M6DUiGraShqfnDGOJ4FhD1+IErEl9gXZ4f8+C9m1vIvyMJ+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827739; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=TkQoPkRLNFdXq+ep1WWHdvaKfBTMnRBtHIYGuPuCr+U=; b=ZWuQ1twNaRe4tQTguLRU+uDKOz7bo0XjpPPmKZx+GLEITY0wc1ptVIroCk1I8YBg4/ASLHRIcd/Ia6BgKDYhYtvI/G+zJM1vM/P72ct7WEadsHpWuMPhiwpSd27rPvp05OIElWEjsIvK0Fr6tyESqMcoVCOCUIK7YUe+ZKwqG9E= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827738941659.0660563582467; Mon, 16 Nov 2026 03:15:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueb-0003uG-Pu; Mon, 16 Nov 2026 06:13:41 -0500 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 1xSueI-0003qA-F9 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:24 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueF-00029J-Ar for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:21 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-498f5fa4f70so3570123f8f.0 for ; Mon, 16 Nov 2026 03:13:18 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827598; x=1795432398; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=TkQoPkRLNFdXq+ep1WWHdvaKfBTMnRBtHIYGuPuCr+U=; b=Mn807bSd2cbbhvPpTnCc6WkwfT/C6gWvcz1Xnnp6BZBYwZaX8XJchk3FzrxFmBjTnv WlJXhI7aLxb9SUh9mgl6/ptmxPrdb9fTaUaVNKhSxnkKsNiyppz8/F3zLIZIJ0yTZjFl 4kBFEYapcXCumwR/C7LD/LJdFF2o/xLDNcJZul86YsBAQCaUS5pUp7aCu+LYj7Wu2s36 xggYqNsFV/cbnILnEY9gfWPKU9h+BJT4a6fQv5btaZ2aCwgxgl7p2cIwz+yP1YMytpQl TzPp5wSMyR88QTVLerznimCruBPcaJB6kQl/qt41y811E5e50VnSaXzxFsZrGhcTUo6Y efVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827598; x=1795432398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=TkQoPkRLNFdXq+ep1WWHdvaKfBTMnRBtHIYGuPuCr+U=; b=0a4AcUQNu45KdoxjAN4JtwpLervTy29UYnSRFpMMlNBIBM1gLsM8q/Lzkw7CwSf2As 3KuYhfdlL25xOh6n6KxpOOrekJlX3Q+VT4lZb+JT2GOwbEgJRI0BosAzeh662J5wYsbd s8HXY2g4saaTnVXO1OqLlaFS/69Fu/SuoJlL0mzX5D7CutewSze/ZjZ1UOmAZEnahTon uIm/dkwYYN34B1g157hiM2SZtIlxbtQsSqRKUai7fawF1tIr8AFamUkY8gixdY09cw6S 5d0+ZclQ9nRsH2CT4/hUVFJt4Wd0RXWBzuWdpyWJwt9Z6778eFT7yklSv8y4DJ40vNqJ NFyw== X-Gm-Message-State: APuU4Z/9X9Y6g/hR9PEjqLOU5w4lKkjnvDVbqUI5Pp02Lfo+54/ys/AV oPJLUZkFsdFymtWHx62tPbsLiqLQp1MOXAO013057O9N4Gm3G4wMvbaMviL7836T1zhtbJxvUG9 Yy/7fYRo= X-Gm-Gg: AYBFou3aM/aXjEf/HDuFHPtXuTVwSBlT3hEVJBWDtZVhyaQY7rr8GwLPY6ID+d5tQET BNlLFN3fkh9aUDUBIKoGdAJqBz3FUhKPUbU/WJxHYc8mrZYRNkJTd7/4Y86CuOD0x6pNNLXM2VC e9SeQFlysCER9JFi06aDQ15lGxUBGJ+s6nfH5h5fQJzRnTCdMKiXxLlkAYxfJAhUg3LvfxCKPj+ t352/PpH8Fv2ei2QyhyWiyMZ9QCu9RRjvEtwM1bDJ5pvzm5cWsf9Fm+3P2ztplLasNwW0Gb5uP7 2yjKYqSimXeFMjWzFGz+sBEoXJ9YXt0p3OX8ObshNfuLalE/xurYl71X4NNZDIy5B6+QbONBvZ5 DFOHhO/XIyupJL1jF7SI6+ZCONcRAaElE4Y5e646biD1eShQ/iy6xVSlfXziPjeB+uLtm4pZ/bb s0z8GDwhDkxz8gymGD11VFU0CGydSr0Sj9f/7XrXFwmCg2F9CT4rrmaSZrDabB79WdUm6RH0XU2 sA9KM1Lblyz/nC7b59DLEA6ukrKL/Sj5FZXM8J7xPmFzadlcrQQxfO0EKzztWEDRKR2eFX55Ihy ENgqiWrRlYymK6zJ1XIJqRy/PP0ZhnxtLjDgVWPfwv2HfzZ5vDG+9lreXKsXGxm9Z2TYXp8Dq+i DeT7VovwkkGJ7V9gzFFPVYjzNHvzeeTqbBA== X-Received: by 2002:a05:600c:83ca:b0:4aa:2339:a375 with SMTP id 5b1f17b1804b1-4bb55a4d9b3mr218691645e9.13.1794827597816; Mon, 16 Nov 2026 03:13:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/33] net/eth.c: Check for undersized IPv4 headers in eth_get_protocols() Date: Mon, 16 Nov 2026 11:12:42 +0000 Message-ID: <20261116111303.1692832-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827740538158500 Content-Type: text/plain; charset="utf-8" In the IPv6 path of eth_get_protocols(), eth_parse_ipv6_hdr() does various sanity checks on the packet's IPv6 header, so we won't tell the caller we have an IPv6 header when we have a malformed one. However for IPv4 we only check the version and that we have at least the minimum header size. Harden this codepath by checking also that the header size declared in the packet's own headers is neither smaller than the minimum nor larger than the actual packet size. Missing these checks shouldn't cause problems if the caller is validating all offsets and lengths before use, but checking here too is defence-in-depth, hence the cc to stable. Cc: qemu-stable@nongnu.org Fixes: 69ff5ef847457555 ("net/eth: Report if headers are actually present") Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-3-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- net/eth.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/eth.c b/net/eth.c index 59b278b887c..038f7d889c3 100644 --- a/net/eth.c +++ b/net/eth.c @@ -163,6 +163,8 @@ void eth_get_protocols(const struct iovec *iov, size_t = iovcnt, size_t iovoff, =20 copied =3D iov_to_buf(iov, iovcnt, *l3hdr_off, iphdr, sizeof(*iphd= r)); if (copied < sizeof(*iphdr) || + IP_HDR_GET_LEN(iphdr) < sizeof(*iphdr) || + input_size - *l3hdr_off < IP_HDR_GET_LEN(iphdr) || IP_HEADER_VERSION(iphdr) !=3D IP_HEADER_VERSION_4) { return; } --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827657; cv=none; d=zohomail.com; s=zohoarc; b=SG59flzqE2fg7oKz1W2/gEYHIAIn/tQfhBSvKVDlkfXS+FwHGkYhstO4iMv6Ff/YKHc0DX6uzr9ic1I4aGE94Zq0Fdnowk7C8BO2lTp/EcRvq4J2pYj9HME0K2DyEBewKJALcVl8IOw8s5Ls6mSU+QF8vGqCZemdpl3Dw9+BFMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827657; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=CnMUk4PqwLKmABb5XS8dEwBI81Oyl0v4bv0Q38Wo4ZM=; b=Z8ziWpwnrdDEZHHmdifhc8mb4pzwAh9LmZYNJoklO9V+00sMu9pZ/r2ciAO9m8aYr9UaeEKZS9orkk85qv2vw1uUDTbkLBQFflxPkm7k41T7iyM7uLdT+9hyQFG8H5JG6qsOUIquM64+DRv7gE8RmqKF8hEMFfH8KTDgb/y3BKE= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827656176125.52823122323105; Mon, 16 Nov 2026 03:14:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueZ-0003sO-7M; Mon, 16 Nov 2026 06:13:39 -0500 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 1xSueL-0003qk-87 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:28 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueG-00029s-Fl for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:23 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-492f0a1b685so2354291f8f.0 for ; Mon, 16 Nov 2026 03:13:19 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827599; x=1795432399; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=CnMUk4PqwLKmABb5XS8dEwBI81Oyl0v4bv0Q38Wo4ZM=; b=fmOpOhgHFfxL1XKQVXOME1NV3ZqIEZuOE37dn6jIsObvPLmaTT48dy/YnGqROq8Yz4 SeFOGPqXRSFZ3iqJmelGgtE185DV9BedUa1MalZT7M9R7HYltHaTI/7vbvIqIxZ5ls+U 2/VYYpClQQUJwVI1pMJdZ3EoMCIHdI7twOaT8uT22OuYJzkM63hfcTAzRxQiOHCZFxAq c4dC8T+ad05Ll9G1m7puq3uLJJZPV7GPfej7/dcg0egByFXQro+p//7H/YEZ+jgwVsww ZrTQGFgtQ6VGRs47LZFF/M/m858bwEM8lAUorw5d1vE2r48DPJ/W/TMIbHkpinDCs+SV 2xJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827599; x=1795432399; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=CnMUk4PqwLKmABb5XS8dEwBI81Oyl0v4bv0Q38Wo4ZM=; b=i8I7VV8Ep3b+bmrH8L5ad6+155NwdnZqCQ9tsfQY0gazJIMyln5iCekMCfbiGFW+w2 7/sCRnqw9ySeqtIG/dDPGON57bsEB4AWZEcb/DahAQTXw97KCcgB7osGA2/uMD12D5dO rEThtDdRkdSf903ORH6y9YdzFH7KSsk0t5rarMk4UoJVx0/DOirWosFouSdfDO4Cb8qZ rQwqv6+Sk9tUAebBvd5ko2B9nc6InR1YrpK+VgjZ3G5U14o3tHjqKNoZcy2I2vaFPXq+ 7uo/kLk+qRoHnbGP/8l6rDoXv9UMDTa05614RCV6/YlmOavdHIk+CA8di1NbZAif5zo2 Ewng== X-Gm-Message-State: APuU4Z+3KmwQ2GUeZsurDVM5NmgwGzx1G8iZWVk/GLEmVaGOMj3PbYSI 89uKKsWNq4MftEpqKOYrk+dX8SRGyysfzAjdi5bVq9PzU8/uDfLu3z41X9eeK7hohWEnqbic3Nu nKI9NZhY= X-Gm-Gg: AZFdTZdFvDFFS0Ipd0xYx3vfUdEsAtCoy6Kw4GbvrexXeNT/InWxtuVCC0WJxzJgEo6 NoScSZuSS1P0u+vWpTqy7nAWxChevI8QY5QJVrvHcJPJWcClWL8hznV6fhIUC6OuDMjAoqnNHLL cxxWOAifykT3piASKFeVJhtshTp86uPjRd6cCWQGrfII4ST2o8rEeVHA4sTfo9m8pnsr8mxqMgy TqC+JIr5pURR8EbZz353IS+D6LHp7p46c4XI7g6EBh7DiqAJw8kETIvgvff1gRJTnspTHRh9Z5e 9PLjBXIjPt6eygx0Anr7FsCHaYYjkwXnTaaS/ZyoMDHed7OJuHguarELOFx5sfJ3x/TG8ivTYXU 8ilPM1fMeNsW+fRndDhtB7pGQ63mpyxpUboP7urWtEbXib4a4XooPsnV2dcoQq1OiRCeZHU2oA4 exORqje3KwpYvOwm9P0NMeAzxDqYOT6ChL24Yf2+PbNbUEmBLU+N1SJqTs2GKXUmsboGDLcfFop 378ksUczdk2LzBTNjwi1+mz25DAryWnrg0WVBqDddj1MO1zQEcO8av6Bo7IZcNDzMrCHb+TWCsm JTnVvUR++R6LFIgGIWTEDnR1JZXVkttg3vzix6r4UncdWeX2sn1mXVgT2yd0BSCvuDP63pIp2Op NaGWhzu4/QLeUa7bDdfwYpE42Hlwm6tUXCbG9AxwCXnRidlmmxBtKnIU= X-Received: by 2002:a5d:64cf:0:b0:48d:f3ee:7cc with SMTP id ffacd0b85a97d-49c71a66085mr19840265f8f.30.1794827598759; Mon, 16 Nov 2026 03:13:18 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/33] net/eth.c: In eth_get_protocols(), don't report TCP data offset off end of packet Date: Mon, 16 Nov 2026 11:12:43 +0000 Message-ID: <20261116111303.1692832-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827657754158500 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki eth_get_protocols() already rejects some out-of-bounds offsets found in packets. Add a missing check for TCP data offset. Fixes: eb700029c783 ("net_pkt: Extend packet abstraction as required by e10= 00e functionality") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4155 Cc: qemu-stable@nongnu.org Signed-off-by: Akihiko Odaki Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell Message-id: 20261109-eth-v2-4-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- net/eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/eth.c b/net/eth.c index 038f7d889c3..a444377fd0a 100644 --- a/net/eth.c +++ b/net/eth.c @@ -197,7 +197,8 @@ void eth_get_protocols(const struct iovec *iov, size_t = iovcnt, size_t iovoff, if (_eth_copy_chunk(input_size, iov, iovcnt, *l4hdr_off, sizeof(l4hdr_info->hdr.tcp), - &l4hdr_info->hdr.tcp)) { + &l4hdr_info->hdr.tcp) && + input_size - *l4hdr_off >=3D TCP_HEADER_DATA_OFFSET(&l4hdr_inf= o->hdr.tcp)) { l4hdr_info->proto =3D ETH_L4_HDR_PROTO_TCP; *l5hdr_off =3D *l4hdr_off + TCP_HEADER_DATA_OFFSET(&l4hdr_info->hdr.tcp); --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827656; cv=none; d=zohomail.com; s=zohoarc; b=UenluzJzrVftVFiJXi5t6EIz0DmrzBIy+RqvE8XPCDZ9zp2VSQtRIHAEHIxdOfjzazrvEdphdqIJ2n2i/LaeqsyW9Y5T8MKrqVBdPvdinT85wziFqSWRny+ZD8dklhAnk1sUibcLmZWTPHu/AB0DxlrV1wY6FgFNA4DnRVJ+k9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827656; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=wvLYgJXw/izo9VYCdQNMzOW7fc8DozKo291I/rkHb6M=; b=KsoLAgZCQdtXxyFVuyORZn6MUwKzdnDnB92R1oE50duUnfQpjZaxC+7zwtu8UVwpV+xN7//3ogfY+EgkJsK88kR9LhrJNFhldM7Mv0eNbR4HROyejiOuouP+rzTFy4514kO0mGzLlsUSvuVqNWIy0umprSqaq05Gt/85WFDrTus= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827656928858.7343818579; Mon, 16 Nov 2026 03:14:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSued-0003vB-Lz; Mon, 16 Nov 2026 06:13:43 -0500 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 1xSueM-0003qv-TN for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:28 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueI-0002AT-1g for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:23 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-49465892f7bso2737603f8f.1 for ; Mon, 16 Nov 2026 03:13:21 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827600; x=1795432400; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wvLYgJXw/izo9VYCdQNMzOW7fc8DozKo291I/rkHb6M=; b=bFd8WNu82iG64daQ9Q4NvjgYPxKHdAIbxqIMxsbpiZ5Ca3o9c9J7IXiQAQhYp2VGdR IJjhpPmORSsE7y0TWmVANbiC7yA70cBJYmPXssuZGggKw9sTljHZ6umz1L7WFejDuaK2 25c/jkWY1S3qA/6N1Nnbn6sH0DB+Dq9XNRYI3FtO0NF+eOhqARGkzVo0imwsU06Z3c7+ WFqR0eS+ciFZIcX7giHo0p9B6ltaaLEMecjMfk6RUEvliO573obAjcc1hPdeyqVcBshD 6CONMqIpOFCtWlmmDPePvr5UaB2Ynsv+E4GfgdF3Op+tMDxh41leC2Knusbq6TDPkmfm 1JlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827600; x=1795432400; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wvLYgJXw/izo9VYCdQNMzOW7fc8DozKo291I/rkHb6M=; b=WEzsTVgxEWK7Dxav/heRt/sa4ep+2Cj4KFATUrOnoSpVI97WY1E8mPWHFT+YdgkeIP TH5Nsb3tVm9U1H90QOz5C16rwmideUmE+YghL+WjP+R46mjcSxOH39ixpnX1yHr1GwTz y5bHOb4YEzHnlhKEJi7/40h+LFAXDQtf3PFsxT8K2XqGu4Cg0Mk+af9A6pj8Ocf+bsAP QJT8twomVHtp3PcWErjcl0TcOnru6Q6yYnellHxfytAQYJT1K9nQqWfvKH92q9AEfFWx bUe3R8L0ySvoNUSrXb5EFr4vj/T3GqVXsDnz7+xMxCiDoYOUgLbbKPYxzwMN6TKJcHRd Wcow== X-Gm-Message-State: APuU4Z9efBnEpQC+zQdeVCrMNaWGeKIBpry4q251ewQPmqPVsSR9oIs5 zy2YEcNtak2A/oAL7KiT15O1GGjOgW7B+l0lMlC07QnIvu/+ocs64qpCdo8d4wLl4m2r77Lfrri q7yE252E= X-Gm-Gg: AZFdTZcOu95qK+UeTSjPHTSnHpOUOuSJQUC7F2fPXOF2z+DlKan6DkbnUk+dIgmvH8J A3OWKtQSvLtBSPCw+wUiUm0xqFXvno213D6gNMeVVeBtGJub7p9D58VjnrNw3cIctLlST3ah+Zu 3iAvD7pYjaYL4kwZhz/CwNYrSU/zHyFrarVroK2NgCxlF5YPgre7+34wqoMWXtTRdH2OMsklFud g20gj5o03IhBvGWTh2D6+KSc0o1gBuEV8ugK+liSjn9snJnU7J5h1vEltCqaPoZi9O0b45f5S28 CMawMnMFYTCO8HFUogCnFaZEx0uigSBe1AGYdZ4DtD9oizFQzDYY5nhKURVtKLAR/W0fExF8Ojq EU1q9CheRkhThBQ7/dUXNrLZMEpl8T274sWbVNR05iWv53QGB92E+zkLjC0OtbUqye+EOQuba7a XoNQD872QbKlFHK03jVqE4bE0rOgBYH/EKWMwfGy2spU+qbA7ANpSKOTid7xlqroEtBfewbCQOX 3mIWfHYm+DZp5VUy5AoTjNxZT+GueXj8w3/MJX7isarqM4sCUcYvj58jKLDAuRer1hc2goMtkm0 DADMZ7HOp8MFISndBclxIm54U6Az9eF2XGsWp4+JWgEDcCKhWJ0Yhkm3HLX9UU3iEshc6ykCpZK CGX43AyzwpsA/OgIZY1gMLQaF1ZfkO1JWXQ== X-Received: by 2002:a5d:5f47:0:b0:491:d224:aa78 with SMTP id ffacd0b85a97d-49c713ae2aemr22664891f8f.26.1794827599733; Mon, 16 Nov 2026 03:13:19 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/33] net/eth.c: In eth_get_protocols(), don't report SCTP header off end of packet Date: Mon, 16 Nov 2026 11:12:44 +0000 Message-ID: <20261116111303.1692832-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827657772158500 eth_get_protocols() parses an ethernet packet and tells the caller about various offsets into it and other properties of the packet. For the L4 protocol, in both the IP_PROTO_TCP and IP_PROTO_UDP branches we implicitly check that the packet does contain a whole TCP or UDP header at the l4hdr_off offset, because _eth_copy_chunk() will fail if the input packet size isn't big enough for the whole header we are copying out of it. But for IP_PROTO_SCTP we don't copy the SCTP common header. In this case we should still do the length check, so we don't set l4hdr_info->proto to say there's an SCTP header present when there isn't. This shouldn't have any visible effects if the downstream consumers of the l4hdr_info are conservative about checking before they access into the packet, but checking here too adds defence in depth, hence the cc to stable. Cc: qemu-stable@nongnu.org Fixes: 907209e3111d ("igb: Implement Rx SCTP CSO") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Akihiko Odaki Message-id: 20261109-eth-v2-5-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp [Reversed the condition and changed it to use input_size - *l4hdr_off] Signed-off-by: Peter Maydell --- include/net/eth.h | 2 ++ net/eth.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/eth.h b/include/net/eth.h index 46dc9ed5acd..e10684ed923 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -394,6 +394,8 @@ typedef struct eth_l4_hdr_info_st { bool has_tcp_data; } eth_l4_hdr_info; =20 +#define SCTP_COMMON_HEADER_LEN 12 + void eth_get_protocols(const struct iovec *iov, size_t iovcnt, size_t iovo= ff, bool *hasip4, bool *hasip6, size_t *l3hdr_off, diff --git a/net/eth.c b/net/eth.c index a444377fd0a..55d85cecd1d 100644 --- a/net/eth.c +++ b/net/eth.c @@ -223,7 +223,14 @@ void eth_get_protocols(const struct iovec *iov, size_t= iovcnt, size_t iovoff, break; =20 case IP_PROTO_SCTP: - l4hdr_info->proto =3D ETH_L4_HDR_PROTO_SCTP; + /* + * We don't copy the SCTP common header into l4hdr_info, but + * don't report SCTP as present if the packet isn't big enough + * to actually have an SCTP header. + */ + if (input_size - *l4hdr_off >=3D SCTP_COMMON_HEADER_LEN) { + l4hdr_info->proto =3D ETH_L4_HDR_PROTO_SCTP; + } break; } } --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827919; cv=none; d=zohomail.com; s=zohoarc; b=BTFc99ZEjCa++UOxBbbHeiQqJwqWQX2e4bra4CZAeWimkLsCTXM4/o8evtSbrADrfPBUw5NGo3+OIxyy543m+kaEBUm/0aUZHeDeBGDaBU9F6KqMC9AzxyXYtzLhfRdVPr7IPRTerRXoSPQdWqqFWuDumVZFdE+J1AF0qHUqgPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827919; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=kL4SgvltG+W6ILZgCdTxarRkRdAKAfKGrZ36FtoArh4=; b=nar2MV0tVAmiLmC5HFdjYmTndfcBhw1R9G3+/oRZc6efdh2YuPEAy0LUXux8ci5S2XLYYnYpHat6aLO4Fxzj7F7Ues1Wxez9dHmy3/qPP567cyLC4q9HkGxREFRrriw7rLz2h/4pBc2tU+MrO+utZ0Urj2ivla6ouZ8tG+hbuNM= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827919336126.15091105307602; Mon, 16 Nov 2026 03:18:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufv-00054V-0g; Mon, 16 Nov 2026 06:15:05 -0500 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 1xSueO-0003r1-Pk for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:30 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueJ-0002Af-25 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:26 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4a9a8d6cea8so33920465e9.1 for ; Mon, 16 Nov 2026 03:13:22 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827601; x=1795432401; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=kL4SgvltG+W6ILZgCdTxarRkRdAKAfKGrZ36FtoArh4=; b=DLaLrIomN4ZAmrSJmDA+sQiJzHnFannjHwcxlA2w8587Uk3vBtpXGnB593AEYet5Cx ztV0sEmW0r8U2v6C/gYL8vM4X3ASMIttA4tVqAJiAZOe71SISCuYlx2kJV+Wvo/Q99u4 BgULn5dRlmUJ/mK0pIADsjs06tq90bQCzFedcZ5DxydnXVS3g9D38cGwUVBJZNpAzYOx cXDNiVSpDM14FlNt0vwhPuHAlLMvw2X54P3w5X3YXMAkY+7+GrjlpNLgxI+pRQwDZSZA ep+uX/U2koPx9a3qrtpzt8t+zJFcFOJC7AwMXg3JY+1uDHJ4ZectGTX3xXJiOAtOgETT Zbog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827601; x=1795432401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=kL4SgvltG+W6ILZgCdTxarRkRdAKAfKGrZ36FtoArh4=; b=LsapmWOGG7v0SH78q6tdEhB23H1TTIathwazdywohjq+tI9x5JqtVn5w3+Thc9E5ig C9duxdlub8FFb8HKkI8VoUt7yHPzrz3pfi3+0J6o97k36rz8mR8zsYgHqiYL50tt2qUM g7DYq7TRV+/bsquspFi9x/zgLXRFWBtc+McY82WpdHyHmSIcgPhpM6IndhOirCpHn39L V1yrsWfATZ64hgKXVhX7z1uTL6LpU6qDzav8Tc6zAfdxvvSTfC+/5mKTJRJgLFXdRV6X Es/48z6PRCZjD3T8fjE2xP9FNXWg1o+/xegqMfzgyWELkuBIUwuOF8s30k4fxdMx055U zFJw== X-Gm-Message-State: APuU4Z/xBCjIbqe09qosZyrPYsvTQAubWiNDa+QNJn7JuU/Bjv3sZmTO tcPUq2eInX3cVJjB94r+zjra5t5SSMK4yudXRPfX2ZYfyfagl6pA8Tf/vkwK6rH2FS+j3wECOm3 yJeQbTOI= X-Gm-Gg: AYBFou3x+ZCY9EUQwcGrY4IytTb/T2k3Is/TXExTzjRzDephR0+oKPHuzzAwe4+0GxX Dd+R6DV+yRB+KWoS9GRTUA0nmeHuAWucDjs8k0ZeovM75rEFJ6gxyBH2HRNHDxIcIYmSzbw2QVj QmLzhqqkEDyWCGeKLQ28wIQWZOAYFF8GZHpSG4nUTJyGAcxdYTRi8AFcoEKNDfJu8izJdGYSP8P Q0WKBVJOxDW2kKHs4yCdP5ajntgGKpPpwg7d0DH/WVhV0M9yLZExr435CLQB5TubltQvnnWf9J9 MPUrv+PhVzA53yX5Fqzvv4JsMyPNwxmVigHyZ+8YFs3J/VI6vzkejaBejViInbKW4wKFOlOzcgm ldlws/rUMrc4VOkE51DS85VEa5ve5L6eNBQy+ZaEKJHERlWqEeyPrcHgPdqxyUOxDV3oWhvSF27 FjRGk8iKJWfmzvbXPkCPIwSM7TR51UwEEuJMpEMVyDOwYC/1C+72MwSooSAowS72SCCOjqjsX8T kNtsWRqdmK0CRIq/7i1Sk7I5/poI8TjrwFzGtNXtLX43Td9tUay2cF0Gsy9phl5Q/C4Ea3IrO08 VEAEuMgcBE+e9leBRFBudqktxqJdb9cUC6vFusA4w1Z/n7/Lcj1CgPfRj6T3T25idgbMC4Qv/nk fEci+hHOV+Alri1S9evyvpKDvABsmbtv/lA== X-Received: by 2002:a05:600c:3b16:b0:4a2:1960:6fa with SMTP id 5b1f17b1804b1-4bb55a6116bmr221997925e9.4.1794827601376; Mon, 16 Nov 2026 03:13:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/33] net/eth.c: In eth_parse_ipv6_hdr(), fix check of input size Date: Mon, 16 Nov 2026 11:12:45 +0000 Message-ID: <20261116111303.1692832-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827920357158500 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki We already have some L4/L5 header bound checks. Add the missing coverage for IPv6. The IPv6 header parser incorrectly derives L4 offsets greater than actual values. Adding a bound check without fixing it would reject valid packets while fixing it without adding a bound check can result in an out-of-bounds access, so fix it along with the bound check addition. One fixed problem of the parser is that extension header size is not properly computed for the Fragment Header and the IP Authentication Header. RFC 8200 "Internet Protocol, Version 6 (IPv6) Specification" section 4.5. "Fragment Header" says the Fragment Header has a fixed size. The byte represented by ext_hdr.ip6r_len is reserved and "ignored on reception". RFC 4302 "IP Authentication Header" section 2.2. "Payload Length" says it specifies the length of AH in 32-bit words (4-byte units), minus "2". Another fixed problem is that the parser continues parsing extensions in noninitial fragments. RFC 8200 "Internet Protocol, Version 6 (IPv6) Specification" section 4.5 "Fragment Header" says the noninitial fragment packets have the Fragment Header containing "the Next Header value that identifies the first header after the Per-Fragment headers of the original packet" followed by "the fragment itself." Therefore, the data following the Fragment Header in the noninitial fragment packet must be treated as a fragment instead of another extension header, regardless of the Next Header value the Fragment Header contains. Fixes: eb700029c783 ("net_pkt: Extend packet abstraction as required by e10= 00e functionality") Fixes: 75020a702151 ("Common definitions for VMWARE devices") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4155 Cc: qemu-stable@nongnu.org Reported-by: Lazymio Signed-off-by: Akihiko Odaki Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell Message-id: 20261109-eth-v2-6-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp [PMM: fixed typo in comment] Signed-off-by: Peter Maydell --- net/eth.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/net/eth.c b/net/eth.c index 55d85cecd1d..484f61ef31d 100644 --- a/net/eth.c +++ b/net/eth.c @@ -16,6 +16,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/bitops.h" #include "qemu/log.h" #include "net/eth.h" #include "net/checksum.h" @@ -473,7 +474,9 @@ bool eth_parse_ipv6_hdr(const struct iovec *pkt, int pk= t_frags, struct ip6_ext_hdr ext_hdr; size_t bytes_read; uint8_t curr_ext_hdr_type; + uint16_t buf; size_t input_size =3D iov_size(pkt, pkt_frags); + bool subsequent =3D false; =20 info->rss_ex_dst_valid =3D false; info->rss_ex_src_valid =3D false; @@ -513,25 +516,73 @@ bool eth_parse_ipv6_hdr(const struct iovec *pkt, int = pkt_frags, return false; } =20 - if (curr_ext_hdr_type =3D=3D IP6_ROUTING) { + switch (curr_ext_hdr_type) { + case IP6_ROUTING: if (ext_hdr.ip6r_len =3D=3D sizeof(struct in6_address) / 8) { info->rss_ex_dst_valid =3D _eth_get_rss_ex_dst_addr(pkt, pkt_frags, ip6hdr_off + info->full_hdr_l= en, &ext_hdr, &info->rss_ex_dst); } - } else if (curr_ext_hdr_type =3D=3D IP6_DESTINATON) { + info->full_hdr_len +=3D (ext_hdr.ip6r_len + 1) * IP6_EXT_GRANU= LARITY; + break; + + case IP6_DESTINATON: info->rss_ex_src_valid =3D _eth_get_rss_ex_src_addr(pkt, pkt_frags, ip6hdr_off + info->full_hdr_len, &ext_hdr, &info->rss_ex_src); - } else if (curr_ext_hdr_type =3D=3D IP6_FRAGMENT) { + info->full_hdr_len +=3D (ext_hdr.ip6r_len + 1) * IP6_EXT_GRANU= LARITY; + break; + + case IP6_FRAGMENT: + bytes_read =3D iov_to_buf(pkt, pkt_frags, + ip6hdr_off + info->full_hdr_len + 2, + &buf, sizeof(buf)); + if (bytes_read < sizeof(buf)) { + return false; + } + + /* + * Per RFC 8200, the Fragment header does not have the Hdr Ext= Len. + */ + info->full_hdr_len +=3D 8; + info->fragment =3D true; + + /* + * Detect a subsequent fragment per RFC 8200. + * + * A subsequent fragment contains no extension headers while t= he + * Next Header value identifies the first header after the + * Per-Fragment headers of the original packet. + * + * The subsequent fragment is detected by checking if the Frag= ment + * Offset is nonzero. + */ + subsequent =3D extract16(be16_to_cpu(buf), 3, 13); + break; + + case IP6_AUTHENTICATION: + /* + * Per RFC 4302, the Authentication Header has the Payload Len + * instead of the Hdr Ext Len. The Payload Len specifies the l= ength + * of AH in 4-byte units. + */ + info->full_hdr_len +=3D (ext_hdr.ip6r_len + 2) * 4; + break; + + default: + info->full_hdr_len +=3D (ext_hdr.ip6r_len + 1) * IP6_EXT_GRANU= LARITY; } =20 - info->full_hdr_len +=3D (ext_hdr.ip6r_len + 1) * IP6_EXT_GRANULARI= TY; curr_ext_hdr_type =3D ext_hdr.ip6r_nxt; - } while (eth_is_ip6_extension_header_type(curr_ext_hdr_type)); + } while (!subsequent && + eth_is_ip6_extension_header_type(curr_ext_hdr_type)); + + if (input_size < ip6hdr_off + info->full_hdr_len) { + return false; + } =20 info->l4proto =3D ext_hdr.ip6r_nxt; return true; --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827681; cv=none; d=zohomail.com; s=zohoarc; b=SEMgJHm12XJlC+qKwqxFln7/UTp7LaL5p5YSh0TNOSz7y5k0OPaWaN11YCeQzJDbwdAlWL+2ctLlEfwVhKcigxLFSS+ccgl057BlsegI9ztRgZ3zKEirERiVR7lKyKiBdE3nZMfLEvpP7+i/LwlOiLalbnSYnfqgr4YkP7Tv7S4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827681; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=cFs0jMd9FQ081ajvl89T/IIEC/4yeBrwaqCaW0cbeP8=; b=VCcxotSw5LCeffCANut1k+PfU7y4AmCnrRoMKVZr2B98KzrSouynkl3H0yHri2wHRPJ+WRUYOFDe5SLAJbFZ+6RinOnaObJ80S/0G1rMIzZbMq++nRhWv/epEufK63v96XSle88BouIdbYPvBTatSDZBuOUeWdY7NNOxfhk6rCI= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179482768091444.09807296440226; Mon, 16 Nov 2026 03:14:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufB-000404-Os; Mon, 16 Nov 2026 06:14:19 -0500 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 1xSueO-0003r0-PD for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:30 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueK-0002B6-Ge for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:26 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-491d1f66968so536460f8f.0 for ; Mon, 16 Nov 2026 03:13:24 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827603; x=1795432403; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=cFs0jMd9FQ081ajvl89T/IIEC/4yeBrwaqCaW0cbeP8=; b=f1+YE6kPutS4QTw/LlrZ+78HlkrxIxxLuct0qScw6J+BnzjfII3lmFw+IDTs+jN77H oLn1qfzGWvLZ3BP9yaeRzYsjzBdQ1w/7Bj/yJGJ169mLdOgWw7zSyT1opXUIYrm0I3+O OhXMUdQTaIh615lPxsUaFzlXaN2+oisd9VKmBLgy9PMHs8qJ81yZKW/HnTYRA4rjLChL 7cfuuzPpo7rvfZNb/Rx0E9i0Xmm6A9LJRQuCqkhCK3hTqkupjGinQfAXAb1QEQlgMYQ9 lCsnFfO31QY8twPEBv8uDMaFFLJ32FYJ4qs6vZ/XhQV3feXucLzSC/bA56sT+Npah+ri /gIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827603; x=1795432403; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=cFs0jMd9FQ081ajvl89T/IIEC/4yeBrwaqCaW0cbeP8=; b=NX0EIBfrfyKriPhTFoe6vhaGWUAP5QJBWNy3Shb9pZtNGxwoZer8kiHY1jdEiFPwqv hfYoaItma5NtzCSSzPzJtYE7ENcqyxWWXg1v0ON2J6NsTAFPsY0kOYdUJbcZKaN5qH+F 8+kroP2vMqhUmIcN4kVV2f5/Zkrqw2Y0Aqzj8nITRE5NCo90aPR4MAJ9FU5Qzjp5i1VS FRQjIskbFJzi7fCySY9dqk6yo8yrM9dg7QcaaZ1JUl+J++pliMlzHaCee0wWgIwk9wN2 zcsa9AMxg4F9vFFUzSDBXwmvKCGyv3c6W9GqSI2pAzBAGhxjvs1PPWUaHpoW2mjIWZU/ YQIg== X-Gm-Message-State: APuU4Z9bvmnWGxCxtibXi2twb/yML9Hl+d9M2tRGMb5udUWwnR86l0zG F80WKygwPQETDk6dEoyjIXi3188ZUhnqY1b4MAh9HDxzxFs6360zLTzwX51I1I1fezjEgUn9xK6 UY0brPcY= X-Gm-Gg: AZFdTZcXFblsLQbn9o9py+glznUUwqG2bfQVca3DI07n8m7u2uaU6aO2ZR2R9tPescy IdBtavYTFUUQQTeyzTugkpq4sUM6bAQXlxC4CD9ksONU5ZrpzucsbNLk8zHY2C6fVY3kQ7yhAVV DgFIfyTViFXOR3881CQHztgyolJHPLeVf5O88yzz4MvVqbh4Ssxc+KcKwZQRp/yyWbZUN9QDkdj YlsRO2QevCQFK/DAHNFo04d3Sv9N1pfzDjuHMO4RmjUoCNRusyhMUfkDC8velsZQD4tN2nrhzWU L6lZiwMpU4DjMXj6io/ehbgmM5IIIoQtDEt9WyhiH516AbY+bMwX1y/vVRxuXtRzkdQxXkDKSjB fc9+9x1naa7FMYVKJEtvwUaEUKk87usrcmEn92mMgazUhFh8uSzgLHPUNrH8UO25n2g72UylZ21 BiG++LtM2XjaYRppSHH+aYuGy6OabbCEpV/WF6pt3rB8Ib5n6CvhfpVUhiz7gikqnW8IT2tUvkJ GlbksA/k+Bv6RWVGscB2rB4k8gQES6p1Xyl2krQ/vyvsYI7c6XA/GMw8P+EYq1CuK+OipjbIlTp tmLvKZQGd5QbsPfJ2bMMuBvuyB8QRQmr6tIc6xMmOXeh0IZWwTN2uDrH/mN5LubKiEW4GiOZ5FK JXehQbtY8MMekihDXB1bxrPpvixHU0r0QXw== X-Received: by 2002:a5d:5887:0:b0:48d:fd4d:7fbf with SMTP id ffacd0b85a97d-49c6d4539d5mr24594811f8f.4.1794827602915; Mon, 16 Nov 2026 03:13:22 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/33] net/eth.c: Move the Routing Header Hdr Ext Len check Date: Mon, 16 Nov 2026 11:12:46 +0000 Message-ID: <20261116111303.1692832-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827682017158501 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki RFC 8200 - Internet Protocol, Version 6 (IPv6) Specification section 4.4 [1] says the Routing Header length depends on the Routing Type, so place the checks of the Hdr Ext Len and the Routing Type together. [1] https://datatracker.ietf.org/doc/html/rfc8200#section-4.4 Signed-off-by: Akihiko Odaki Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell Message-id: 20261109-eth-v2-7-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- net/eth.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/net/eth.c b/net/eth.c index 484f61ef31d..54b0a77fa0a 100644 --- a/net/eth.c +++ b/net/eth.c @@ -407,7 +407,8 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int p= kt_frags, bytes_read =3D iov_to_buf(pkt, pkt_frags, ext_hdr_offset, &rt_hdr, sizeof(rt_hdr)); assert(bytes_read =3D=3D sizeof(rt_hdr)); - if ((rt_hdr.rtype !=3D 2) || (rt_hdr.segleft !=3D 1)) { + if (rt_hdr.len !=3D sizeof(struct in6_address) / 8 || + rt_hdr.rtype !=3D 2 || rt_hdr.segleft !=3D 1) { return false; } bytes_read =3D iov_to_buf(pkt, pkt_frags, ext_hdr_offset + sizeof(rt_h= dr), @@ -518,12 +519,10 @@ bool eth_parse_ipv6_hdr(const struct iovec *pkt, int = pkt_frags, =20 switch (curr_ext_hdr_type) { case IP6_ROUTING: - if (ext_hdr.ip6r_len =3D=3D sizeof(struct in6_address) / 8) { - info->rss_ex_dst_valid =3D - _eth_get_rss_ex_dst_addr(pkt, pkt_frags, - ip6hdr_off + info->full_hdr_l= en, - &ext_hdr, &info->rss_ex_dst); - } + info->rss_ex_dst_valid =3D + _eth_get_rss_ex_dst_addr(pkt, pkt_frags, + ip6hdr_off + info->full_hdr_len, + &ext_hdr, &info->rss_ex_dst); info->full_hdr_len +=3D (ext_hdr.ip6r_len + 1) * IP6_EXT_GRANU= LARITY; break; =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827656; cv=none; d=zohomail.com; s=zohoarc; b=NtC25j7iM4346JgHeobPmHYd7WnWmZM4wQlnM00M7Da46Hgelv+906WTcfvcWHLmx3D+DeQddQGd6nbJe3t9hlmDEnp0QajNplhJ566U+/jHuKs5mhPqcBkdkkUuFPAVarhrw8h+wo/9nPe97yxhD2yaXNe83CEgaYRDQsj90YQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827656; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=5Y4/vqJflN7tAP8idq7EOJGSBtQ7FAx/pao0uWnr4hg=; b=SeB8x4HpJUBcE3bGOSasDhq7ei3augUCUNfEwEFJY48f7P0ZQboYJ/0UAzJJthNKevC+QpMP161meL0lCjnI8lqnA01mNcenocLy2p/ZvWg6iZ9G/BZGLuTxhlIWuzi2xqHqhM6qDiE4WufLQPPkjwqHTm1Tb0seOlV6SraliU8= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827656176296.66564687611924; Mon, 16 Nov 2026 03:14:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSued-0003vX-Rz; Mon, 16 Nov 2026 06:13:43 -0500 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 1xSueQ-0003rW-MA for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:32 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueM-0002BB-Mx for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:29 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-492690dd5daso3178054f8f.1 for ; Mon, 16 Nov 2026 03:13:25 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827604; x=1795432404; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=5Y4/vqJflN7tAP8idq7EOJGSBtQ7FAx/pao0uWnr4hg=; b=LqbEwCaeHzGxl4aszRUeqrS/Eu8exsgnZuF5JV5g8ZSMqQn6GKhZHuTSJC7KEeTNvz lbiFaMpWQSHwDqNYxBKozqABBItfAUgW0ERIG6IuMADuVnv1xq01MGmfMUzjQsv9Us9d O8ewYglpTn4+v2lL+cJ/PJkX0EgBMTKWX7khXRZsJj3KafZ7/+IsuyEarkW1y+ngPyHf ewH9hKL/0BiytyFtBSoGCv1upknFdwD9B9FFV0SnWrFVwkVLzORTRAsBBoOI1+h+LhbB K3qADMBChDI1W76dKRxDMSV7HH115CQbKVRI5XnD357rfCygb/scpbjn9JCKcCWje12h 4b0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827604; x=1795432404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=5Y4/vqJflN7tAP8idq7EOJGSBtQ7FAx/pao0uWnr4hg=; b=gbvejbBZUx+9DrIUuU42MJR2AUOevs01xA3fq4ixZIl7cxln6upK0WRlMyLPlvdFLy PNX1Woqa0b5LIEKD4985gFLTUarIakk1KXVNJ9ZnqSpmd7ko5CNwGOfvUgDCl1i+XZnO t+XtVAdHf5iglaJUCE0GHnO1tYZKqhfwjA13rpXx/33UZj/EUmf5cdVW6TbRAC4Jv6Xf RqNeju+b1xrMsEVhzzYEBZUQ4Y/tQTrzlETKJ7rtoMGbzOffdnGqo5Fs3hTLf47jbWPx iWrhCTVBDXhl9JverpqvXtGvHO9b9yAP2l3O9tXbdIwfy3054FzHzG/34qxM6CSgyRpC H6Tg== X-Gm-Message-State: APuU4Z/izyswPxkwNNqhfM7H/etlmhORcQvTRz2RpFz7302HL8lI6ghG AtloLRoZK15DPCsNYWYp1UYdQW7q4DJiQksnqoj6mrt1QMmpIPR9J3Q6nF0gwvd2NDcfn3Gb4zW Hd6y5AwM= X-Gm-Gg: AZFdTZd8Y9Mtj+I1CcPszFwneDrqmag27cgv+hxlT+DrgwUTalzcKNt35Sx+NwQxqUe xzacFYdOwDgSCCqwTtJpag2ZT5YvKM0+3oZBKvnsKHhsZq0ds9CKOWWimVavhRUgZsx5uZ9l2n+ ArWCnbQTZgoMErJYYzqSXbJXBFgTjOuU7knS4kCjIu/sa4gGvYQiEOqNDeTj6hwEJ6sDkeH/Qt9 mFnKYnVZdVGuBIcLyabF8o09iRaAPEfN3/LgJgE2nIJLStGitaVX0DPBHOnqW9jbPk9WFLVUBKG a8dFUoTswKKU9969IyjGQk3lVY5RwA7K23d7yS4PqDIZ0doS7JklA3i1nZ+w6/KjvnM72HWpjBt aYDEr4ORZ0PXawk0fYJB4sc+41Ih8il0zY9gt/RI93b9KzhKzx5cDv/6bYYMVmRX2LvRB+bXXDE ZX4V/2Hg6klSH5nDJb8tuGz+5OpL4pttSyKYnetA4mwqZM1friuRCbiH/1uOiSQhoXdg00SJ83S Quz9y6suMkt0hzjTu9Pp7h/K1ebNPovCF47oY3H4c+rJmKoIaEfCX822qP9k6EgkoKAI3SmCXIO /kvNsIlWP33wl2VrJFWYhSuijm1DThB3tn5WVyckYeaOMb5NYsSV3bf2IdC8aCb/VYNzFdtOK1G 9KzB7aib/qt5fT8ke7QuUQ0cgA07jq0nkew== X-Received: by 2002:a05:6000:4022:b0:49e:1601:2fb1 with SMTP id ffacd0b85a97d-49e1601310bmr14177618f8f.24.1794827604059; Mon, 16 Nov 2026 03:13:24 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/33] net/eth.c: Harden _eth_tcp_has_data() against short lengths Date: Mon, 16 Nov 2026 11:12:47 +0000 Message-ID: <20261116111303.1692832-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827657748158500 Content-Type: text/plain; charset="utf-8" In _eth_tcp_has_data() we calculate the length of the rest of the packet after the ipv4 header by subtracting the header offset from the packet length. If this subtraction underflows we'll return the wrong answer. This shouldn't cause any problems if other layers of the code are checking lengths and offsets, but defence-in-depth suggests doing a checked-subtraction and returning "has no data" if the subtraction underflows. Cc: qemu-stable@nongnu.org Fixes: eb700029c783 ("net_pkt: Extend packet abstraction as required by e10= 00e functionality") Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-8-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- net/eth.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/eth.c b/net/eth.c index 54b0a77fa0a..74a705a2679 100644 --- a/net/eth.c +++ b/net/eth.c @@ -118,10 +118,20 @@ _eth_tcp_has_data(bool is_ip4, uint32_t l4len; =20 if (is_ip4) { - l4len =3D be16_to_cpu(ip4_hdr->ip_len) - IP_HDR_GET_LEN(ip4_hdr); + if (usub32_overflow(be16_to_cpu(ip4_hdr->ip_len), + IP_HDR_GET_LEN(ip4_hdr), &l4len)) { + /* packet too short for claimed IP header: no data */ + return false; + } } else { size_t opts_len =3D full_ip6hdr_len - sizeof(struct ip6_header); - l4len =3D be16_to_cpu(ip6_hdr->ip6_ctlun.ip6_un1.ip6_un1_plen) - o= pts_len; + uint64_t l4len_64; + if (usub64_overflow(be16_to_cpu(ip6_hdr->ip6_ctlun.ip6_un1.ip6_un1= _plen), + opts_len, &l4len_64)) { + /* packet too short for claimed IP header: no data */ + return false; + } + l4len =3D l4len_64; } =20 return l4len > TCP_HEADER_DATA_OFFSET(tcp); --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827737; cv=none; d=zohomail.com; s=zohoarc; b=I3yU4WL7XqToXqPy13XPRunum1a+iQa75fMbBc9PdVUllGe204ukrnpI3pRBaxs/ihim0F2xpQ9Cg0yFJnPj0PiV/VD/GXWCfFAoUAMU1BqV9eQsIQSyYwpXo4yhyB4yH2l6RxNEn79Ajx6jlb3amCdxzfnhnxPHixasVMkcbtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827737; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=7SS6FJJkWZhO26FG6U9/l0Wg9zApFtclZ49Uvh8f1NA=; b=ikfrdf/4GjzMiuvVyRIY9QPqVcqarmUXSkTXShvluQZJSwTnpUJXHHeL409AVAG2nC+wQbxYLWiFp4MYuZxxKHu+OnrRizJ0VdfhrsJP8uXfPunqAXdhhRhj9MND7lj8vOlpg2kWQRMkpxsydkyX9dhGAyV8UQ6BG6DFrwUJ3gs= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827737000665.835767834627; Mon, 16 Nov 2026 03:15:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueg-0003wa-Nf; Mon, 16 Nov 2026 06:13:46 -0500 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 1xSueS-0003rr-MJ for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:34 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueO-0002BN-HB for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:31 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-4910b863b84so2390366f8f.0 for ; Mon, 16 Nov 2026 03:13:26 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827605; x=1795432405; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=7SS6FJJkWZhO26FG6U9/l0Wg9zApFtclZ49Uvh8f1NA=; b=GNZwUL0hG9qTCcNfjXo7NkZ73gVLUKO7/+UyBAwm1kZgqEHAF7xesubqIBeGfycU1i 9FWUEUCFX3VND+FulPTkzdFbK1MSKOniOat9lPVobkjgQoMTcpa2Oa1l63ecahOBaT2m k3Df8UQW6MNeb6ypA/DbsCEWySr+VOCTyTmoODOwwD0DmcHIBQE7Yoy97RPt7J2zOf+6 KT9Zkv0SlSkQJkYUopFMXd5bOBR/VaGciGju/v4Cv5jIJXJfbUissFqW8Q6/YF01RvIp t5Nz4d0VU7ouOR+z+AJ/ha8E30aMxklfm63QSEe64ib5uckn3UGrrh4BfXev4xRqEtnm JLJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827605; x=1795432405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=7SS6FJJkWZhO26FG6U9/l0Wg9zApFtclZ49Uvh8f1NA=; b=FqytCEIOxMc92vYLjEBrNx0nVLryvNJwVHEiNM4nC+QmgT2OM6PFDwNJMKeP9u7nRX ++uSOuV1P4g0jDXyzSMPZUUx7G4+TnA3MTgqjn8HPoWTjE0R5bS6gzWfMMpgyNvIFD5v zgFUtZHhtcjqpYKkYgHyRU0hSMGjUZQWm7s33G0fQ93h1EmHzhHH1784Vfd2+5gMmsYK xAaVn494iMHSJVrEWP8RDaYOpD6UqseTrNa6RFpKoqX/JqrJjrZfvugQpPbTUR0KZMbB YsS9Slj4xEY1em1QWSy9H1nFGMC/KQUlff4mbGBNdxrC09Tzz2gxo8bZRgH8WjwD1Rjt +4SQ== X-Gm-Message-State: APuU4Z/s0XRjT235RCo0q7yMCYAz5CeepguaIpyb66ei2oFHgBRJb66+ /Iw8NTXMJIq/MpQnX/OcY+rAqDTG3oe7OyRkQ5x1qYQjaF5+/vq4nYeyKXwh9OmxD9s/QsRwYIb Pnhg9qE0= X-Gm-Gg: AYBFou220phzi2R5ZK2zf2m7U6WweaqAqr1BXGS4f+sTZLdw+JgGiJObrd6QzN+f9Mc sdVv6CfnUBy+9WUXNYev3qHncqq4iqW+vkNRKRf2uZopOn9cv01RX7ktaaJq3KqBqzfuYnRHOBd KhcwIx8YKRuaFpm8V+HF3fDdRJSTtGoOtlAg16p+f/fLmY0Zox80Kyt45pl4L8yX40WpKgn03qh awOklgp2ZUbaryhWN+YfE3NLB3RiBvvmEtLf3U7cnqCA71oN09r0v/2Kex0Zktz7sUHH7ZMipdF yBaSYO02vVSKCejeB1PW6RZtsTX+cArI47Uw2zYpsoDIRWfJjSzY+JeKFulOHia3TXCrn7QPB2N DuWD8BeNuQOjvd3X+o14mTTMocUXhzOmgEXJrFpsgUxv6rt6Rq1t2DktP/fMdn2e3jdlD0Rg6no fwSfREpJP9rncQMM1x//d9rMEFcl1q2wbGNf5L4KwXItq57xO678+zqR1itSNGlDy8gi6vnNhMy EUSDJJen1EW0t7UF2iis0W3pPRV3uH/kNbr9tQaUvzIGVrtZVonFVGUeaS7VxXu+bsASnyBGvLN 1tuRZD5OW9t83GdRZ+Hq+x+jzQqdVsMILozJLFfSHfiQ595a+WbT1ztDasOUqTRMm22Qkxy2wgg Nblb9eplB1xFyl0ptU770lRnoVPHROe0dDg== X-Received: by 2002:a05:600c:4703:b0:4ba:4928:8aec with SMTP id 5b1f17b1804b1-4bb55a755b2mr221758535e9.9.1794827605254; Mon, 16 Nov 2026 03:13:25 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/33] net/eth.c: Tighten size checks in eth_get_l3_proto() Date: Mon, 16 Nov 2026 11:12:48 +0000 Message-ID: <20261116111303.1692832-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827738526158500 Content-Type: text/plain; charset="utf-8" Currently eth_get_l3_proto() has a check that the offset of the protocol field is not off the end of the iovec; this is actually unnecessary because iov_to_buf() guarantees to return 0 for offsets off the end of the iovec. On the other hand, it assumes that the l2hdr_len it is passed is not so small that the protocol offset calculation underflows and it doesn't check that the packet is actually big enough for the l2hdr_len. This shouldn't matter if other parts of the code are checking, but for defence in depth we tighten this check. Cc: qemu-stable@nongnu.org Fixes: eb700029c783 ("net_pkt: Extend packet abstraction as required by e10= 00e functionality") Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-9-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- net/eth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/eth.c b/net/eth.c index 74a705a2679..33b61cac414 100644 --- a/net/eth.c +++ b/net/eth.c @@ -75,11 +75,13 @@ eth_get_l3_proto(const struct iovec *l2hdr_iov, int iov= cnt, size_t l2hdr_len) uint16_t proto; size_t copied; size_t size =3D iov_size(l2hdr_iov, iovcnt); - size_t proto_offset =3D l2hdr_len - sizeof(proto); + size_t proto_offset; =20 - if (size < proto_offset) { + if (l2hdr_len < sizeof(struct eth_header) || size < l2hdr_len) { + /* We don't have a complete ethernet header */ return ETH_P_UNKNOWN; } + proto_offset =3D l2hdr_len - sizeof(proto); =20 copied =3D iov_to_buf(l2hdr_iov, iovcnt, proto_offset, &proto, sizeof(proto)); --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827714; cv=none; d=zohomail.com; s=zohoarc; b=HcYhDxY88HhDuq4os+Mn5OebJcl+YpV3vNOtnBKpRt/q/NX0r+VlK4iG+hGpqKTwpfzMKvwcFxEL9a8ZBSE1dO8F1pJYlHJ6bhna+WtMIsGnOwMnzASRF3gcVUjLnu8n+cFWmS3W48hHO7AJfa56uSaoZkeLx2f9Xoa1qXB1UJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827714; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=HEFF52zQcGWzOKUVmjH4myjX8doFqqSzEqp+wmFiVeE=; b=a4rvHURrE+BZG4YNpzcLG+j+UivgczFmkJN+PMslxi2xXgwBR1oouNblxcnlQ7M6nKfT1rI7gXu9ea+rh5lacc3RBGmqAPo0f/MSesK3AnafoXQzy0EK1zaInCl78X0WEfR0607V14F0rAxzlMZb09Y1pDuZTAruUazQMumZ89Q= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827714843789.3036195394272; Mon, 16 Nov 2026 03:15:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufF-00046Q-NF; Mon, 16 Nov 2026 06:14:25 -0500 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 1xSueS-0003rs-Mz for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:34 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueO-0002Ba-HZ for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:31 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-48e10a70540so1791204f8f.1 for ; Mon, 16 Nov 2026 03:13:27 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827606; x=1795432406; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=HEFF52zQcGWzOKUVmjH4myjX8doFqqSzEqp+wmFiVeE=; b=gwN75Gwc/mWbnqwDoTitrUYVswGDdiEC06cYQA7ronwDdPe+UfwjqmloOJqEvozKJ/ NaGsu3OAjtf50fWhce4PM8iH21r1X2OwC5Px5SXftSQlhAaLjdB78VL79Ce+qWByDM0t iiN8DG6E5sB2wYbBdlBCWZm3WEjQUvMIVgt9YhDML0K6so4gTgq/9SxjjI6S1mzPjTja JGfcWg8b20BD85CEpSldvojgV6K4IysVwU8ht+JtVAoX/jG1iC+NQNXpMEzGaXfqlHUN nQIXviFaoi6ag3Id9w/XgDhaJa9vM7eMipmzR4w1A8WwejBuEo0Q1oKHY68pydpQKXRO kneQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827606; x=1795432406; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=HEFF52zQcGWzOKUVmjH4myjX8doFqqSzEqp+wmFiVeE=; b=qhZvaIv9rPVqpVd6MdOkHVizfELxdMN4ANn4b6y4C5NHqVaEkEcVQHfq/xiYdRjZ+3 peb9+X+DH+7nz4htYwH2IiUXMV5V3/ZFYgIlra4m5A2NP1JiZaNQDV0irIKvFkTFxko2 oRwY85KvwUN8vOP7aYF2uA5n6Jx1P/l3iarsrUCzAl2hl/uGedXv0y98FMzfldmYJu2d 556Z+7b0np68HsYZHUbXl52uMliFlAVYvvYGfTb0mxwArK+72uEHMesMsZjAhbDetJB8 Ohd2CRmMfRV/vh/fO+Rgk5fVkykqI8OFShyE6POalBYAEwJAy6rR6BEQnAM7vnoS8X6T j+lQ== X-Gm-Message-State: APuU4Z80pNd+9YgRiHS6Fnks7niz45OhXFFkZsDIDFNBUoLKVxOFEj1N 9OFd6qRJD4f4w62D8IdcIRwUmolfZC7Qea1+B0DAb5aq+woym1WpzyyvRd5oy17RndiEtv8MCqc 9CVkAklE= X-Gm-Gg: AZFdTZciFHxQ06wfqmzpYkPeSdCgyuBlZDgZJMIipVuO3rsv66lJaNo54+abgo9Bkg8 kwxPMqF2yflVDYYGPXvJBomSsw9VL+gF4k6pvbtN2qS8Zfxa6Fxr+MD4kWpEx5HyZ4S7sj14v3C AQBDkMMi1R6OxA5mG1YVey6uup5+SXze8BQfd8OvyonxB0vN7acUNk/WGXI3F+LZ4UeGzVIwf5F D/tcQ7EAT9RmRzJbRDO76WUl6o0yAz8J25RjtmHpbPJd3Jsy3nSeFcOA5AkUyHiX3Hg1cXTufbm HSFfJdwDfcXvXTPskrxgAfHM8yKBSvRnP5A9BWYWdZxktTYlD5vwogEhaC09ODmAk37PX4lrMtJ cH91HsEzMC0fhUxqhT7kiUqhsR77hEc9fVlYMmA38hspQ+CO6Nr8gtN9+xB2tUcVZaE3PJgetLH 6W5UBNWLrxwM6faLLumadCugciwOVhXgVCWE+fWpdR9KdTc6su+CE9gg8fUesWbbwj5GEtnWpNZ uYLohTa1EVYYNo6caOMiMxT87pS2OZ8+wocVe7Dt5MpZSSGDG+isRgj6dKoXtDV7A55gzj6v27p 5ycnsc52546FBH5Cs5YW/m74oG+rg6CAU3hYVXm0h3jGNUKTwQoMq71pDjJvdGZXjmY1QM3QuZQ PmSWRSUQ/AUa9hTlSGQEUmiDpLvKlGAfJnw== X-Received: by 2002:a5d:5e85:0:b0:48d:f391:5c45 with SMTP id ffacd0b85a97d-49c740bcf7amr19942300f8f.42.1794827606194; Mon, 16 Nov 2026 03:13:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/33] include/net/eth.h: Make eth_get_l2_hdr_length_iov() check protocol Date: Mon, 16 Nov 2026 11:12:49 +0000 Message-ID: <20261116111303.1692832-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827716321158500 Content-Type: text/plain; charset="utf-8" In eth_get_l2_hdr_length() we return sizeof(eth_header) for any protocol other than VLAN or DVLAN. However, in the iov version of this function, if the packet is larger than the ethernet header but not large enough for both the eth_header and the vlan_header we'll end up returning the actual packet size rather than the eth_header size. Fix the "not enough data" return case. This will only cause issues if the caller isn't already checking offsets and sizes, so this is defence-in-depth. It also in theory corrects the result for the hypothetical case of an ethernet-level protocol that allows a payload of less than 4 bytes. Cc: qemu-stable@nongnu.org Fixes: eb700029c783 ("net_pkt: Extend packet abstraction as required by e10= 00e functionality") Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-10-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- include/net/eth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/eth.h b/include/net/eth.h index e10684ed923..3e83f5d68c0 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -321,7 +321,7 @@ eth_get_l2_hdr_length_iov(const struct iovec *iov, size= _t iovcnt, size_t iovoff) size_t copied =3D iov_to_buf(iov, iovcnt, iovoff, p, ARRAY_SIZE(p)); =20 if (copied < ARRAY_SIZE(p)) { - return copied; + return MIN(copied, sizeof(struct eth_header)); } =20 return eth_get_l2_hdr_length(p); --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827988; cv=none; d=zohomail.com; s=zohoarc; b=jqVeGBUR70QJhud8WW/jnmTaDDI1UbirBJhIlcN9CuEJ6oK259CWlDq5PlsOFaWRvQQLNfks3sJnJMxdJxwwMWGvTAcyvJIKUOlIrgPvKQ5DoB0m/NpZY/b5WWbmjR4LPARbZzNB4DJVhPIjl3y5kMVttf0q2zaq9Rk7fDVpoeM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827988; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=MMRHoVzzc0EDS3fwZLo7PKSoGIS2Ack5SdX/7J5QnFw=; b=BHyolV5tO1gKucutkmbgKTwd+t4OtpHdEIlyG2+/FrU50pyt7z5I1OG75aXhfRfixiEqA7i2LxL69cCE3TbQuLuQEloF4Yhb+K0E9HjP2tbnW8GRhNb7OtRXhyXisuUHApB+8gSOCTFWN5iENO2dJd2Wuhk9rNwEXgAnIgQkE4Q= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827988542519.7857842197045; Mon, 16 Nov 2026 03:19:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSuef-0003wD-Nb; Mon, 16 Nov 2026 06:13:45 -0500 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 1xSueU-0003sA-Pj for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:36 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueQ-0002Bg-31 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:32 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4a140e7405dso34867535e9.3 for ; Mon, 16 Nov 2026 03:13:28 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827607; x=1795432407; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=MMRHoVzzc0EDS3fwZLo7PKSoGIS2Ack5SdX/7J5QnFw=; b=VRFPpCOqaD5DaJ7PMV4tEzc882kDp8jPwhZsHEI3cMZamAbaDy8ILueRRqZgSROei2 RWAydRjxfLspQHqaagGN0MkZvs6A/nA0xu9z3yhg2FPHBUgKOe/9ew1P7+2AFAG7CDmJ IQ4VHRveVkeubxBBS9i5wQDO4B/6gQdeTd8k2TweVWQpDRj6ATnJi0UAyYiCfYAh2Xci RnXImj2OG4qjYa8bUCKcRbJSvqsVqhYwiG5RE6xqeHIh2frV08lQ9GCQEaMxU3UFsPGb fTm4nu5xPx75LLuoeSkmf96zZGBu3hBKH/y4vtGSHZyyHYRUEV+xoNIz0TbY4KfdlyIO ikvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827607; x=1795432407; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=MMRHoVzzc0EDS3fwZLo7PKSoGIS2Ack5SdX/7J5QnFw=; b=kwpoOb3RTnIevUcujSjbzOxNmrUJx6kJguBVW2xBpJtcDvIMyiq24x5wJhFozr2UfQ F+3souEW9fuYjuCyS1CX/5PCsNWdMz4mlIGPoqU0kjymJ+JKG6I+CM6DkMGY9RiECFZ4 nxfmhcKqSYphujdcaPijjaKE/Exkfps4xzSEvmXeCXhH2Ih5QEZgNf4aY3zCn1ImvqJc uAZQjg2dUeAd9B7/Fpwo2IE15CZI2FcWw8qVNv5XzV4y4A93J09zYk17OVTFv4Zrn9Tx dCf6RTSO1xLbGk/sD9HjUclRG0JuFcw8N682i/sbUpfwuklLeBpS/GTHACMyhg+yG8cW 19ZA== X-Gm-Message-State: APuU4Z8bcaHN5k/23X6afv1PH6/2Jc9PV32dl//RvNOQJZKIo3Tg97HE Rz0QUsVWEHur0IwwaxnhUlupof3JhLc58BLiCehH9ysOFjst2njWmVnzLGmAc51HwO/w4hbB2so tNcFWZCc= X-Gm-Gg: AYBFou0SptXzXTNZcljnsyRgdW1NnO8yCI7WJzIVBhoDWPHSZrkDDDun1vLH6xLq3BF JuVEnEr/VDqolEVjXDPn/iH2Mz1XWM8oGb1VNX8L7R1tTQN+M8CstVg5r9eWI/vx6faayx/dQS9 0LzSDkLANV7nnysm6Eh3bWM3qVo6elxB3QjVu8lz4p1cVAF82bBcT73droNofF13dei0UCLPC/0 VJ4X65jeLhGVqai4+BQ+ptbsymlAsH2EqMV1h5JAj3QsQw9teHI7d37PNtqbC2P0XOG6Ev+tSdA RNrAasXpid2oEW8A/ZDVBMkg9pFtdWdFeyavEpLrzNzH+XOjmUju4HYSg45D9V7sib4EdeIJFlN rb7+quKA8QE4iT6mVfJTm7uOeLSVd83I6wdVSwFZDBUI6repNW8aUWoH/9nSP5+tXVVFipmK/Df yatuyOL3Dok5ldpaWTiq89HPF0MgniKSHW6DYAM+JYkG2LRvU3iGL2C44bHUuTQZjrbNHhO0Cb9 iPk3HHYSMsq73pFkYA9DhWoc/hHr9pl+rxlixK0aFltQ2lJ9ASvShrMEk/XyeSKKtKXjcu79EW7 sYSrU/Ikc6FHo4xVWDJTCtnDAq3S5cfsdDFtafUz0Qmf2h5dqp/5BmY550KlRIPPAebgFOKwL85 NXaU+dicOWiG39/m5NOqUpcUgZAS7UfHZWg== X-Received: by 2002:a05:600c:37cf:b0:4b2:2ec5:8a2b with SMTP id 5b1f17b1804b1-4bb55a4301emr218097165e9.10.1794827607242; Mon, 16 Nov 2026 03:13:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/33] hw/net/net_tx_pkt: Sanity check GSO headers in net_tx_pkt_build_vheader() Date: Mon, 16 Nov 2026 11:12:50 +0000 Message-ID: <20261116111303.1692832-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827988902158500 Content-Type: text/plain; charset="utf-8" In net_tx_pkt_build_vheader(), we are insufficiently cautious about headers from the packet from the guest. Add more checking: * that the segment offload payload gso_size isn't 0 * that the packet is not too small * that the TCP th_off is inside the payload * that we aren't going to overflow in our header length calculation Of these, the most significant extra check is in calculation of the virt_hdr length. We calculate this with pkt->virt_hdr.hdr_len =3D pkt->hdr_len + l4hdr.th_off * sizeof(uint32_t); The struct field is 16 bits, and so this can overflow if the guest hands us a packet of close to 64K in size and an appropriate l4hdr.th_off. The effect is that we record a bogus virt_hdr.hdr_len, and later on in net_tx_pkt_tcp_fragment_init() this will cause us to make a very large allocation that causes g_malloc() to abort. This is a hardening issue rather than a security issue, because the amount of guest control over the allocation size is such that it can only generate allocations very close to SIZE_MAX which always make g_malloc() abort, and so it's a guest self-denial-of-service only. Cc: qemu-stable@nongnu.org Fixes: e263cd49c73c595 ("Packet abstraction for VMWARE network devices") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3648 Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-11-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- hw/net/net_tx_pkt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index b134348fe80..b2935900fe7 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -335,6 +335,11 @@ bool net_tx_pkt_build_vheader(struct NetTxPkt *pkt, bo= ol tso_enable, break; =20 case VIRTIO_NET_HDR_GSO_UDP: + if (IP_FRAG_ALIGN_SIZE(gso_size) =3D=3D 0 || + pkt->payload_len < sizeof(struct udp_header) || + pkt->hdr_len + sizeof(struct udp_header) > UINT16_MAX) { + return false; + } pkt->virt_hdr.gso_size =3D gso_size; pkt->virt_hdr.hdr_len =3D pkt->hdr_len + sizeof(struct udp_header); break; @@ -344,7 +349,10 @@ bool net_tx_pkt_build_vheader(struct NetTxPkt *pkt, bo= ol tso_enable, bytes_read =3D iov_to_buf(&pkt->vec[NET_TX_PKT_PL_START_FRAG], pkt->payload_frags, 0, &l4hdr, sizeof(l4hd= r)); if (bytes_read < sizeof(l4hdr) || - l4hdr.th_off * sizeof(uint32_t) < sizeof(l4hdr)) { + gso_size =3D=3D 0 || + l4hdr.th_off * sizeof(uint32_t) < sizeof(l4hdr) || + l4hdr.th_off * sizeof(uint32_t) > pkt->payload_len || + pkt->hdr_len + l4hdr.th_off * sizeof(uint32_t) > UINT16_MAX) { return false; } =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827759; cv=none; d=zohomail.com; s=zohoarc; b=CnGCTrLz4PslkfmzLSAvkC9YtLtaCtiUJza/Ythw3KWFWas08zrLg5xM+PQOs3gVrPqPJNJpkLA/Y4/qi8xmxLfpkveXQoTe1yDyP8AK3miYi2ABsZ190ou8rqPDaxM79MQye3ilc8lsmJ6R//BQehvJmznt5BQLDSnp2hTotFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827759; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=cwdI2ks2UX6ufxBpWH5uqNqrepl84PaA06uzdEISrr4=; b=EQaWhdrKNn5Tc75EGcZltWUo5UMC+f6Qag8U6gh96QvdGkiAyvU60yTYEaoUZGMTTDwm9A9WZv9UcYAxlvJ0mUN1wwH4Db62hbFjCVGRPId/mLzdRxbNHBGblfLz9oH6sGmt+l0Si60kDDLk7tlN8GusN9rAnmUS2f+GZWpgqX4= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827759781936.2852311549037; Mon, 16 Nov 2026 03:15:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSuf4-0003zt-Td; Mon, 16 Nov 2026 06:14:12 -0500 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 1xSueU-0003s9-PB for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:36 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueQ-0002Bv-DK for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:33 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-491846221ffso2996475f8f.3 for ; Mon, 16 Nov 2026 03:13:29 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827608; x=1795432408; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=cwdI2ks2UX6ufxBpWH5uqNqrepl84PaA06uzdEISrr4=; b=x+Gpba3EcWbUtBnulFNEi2bb8fHdiPxXfp55iE3ngp5MHkrzuX/GTQRRL1xOOas/c8 t5OP63dxrqM6ecFc1EyCOANctUFB1jhhWZZNNG3TJR7O8BW/7WPTcoVKTfnnQsHqsnJE 30fJmekJ1pAgLM2D/vE0rapgy2NqT2k1JkzUjknDEPfzZsuFzubOTdBPuzRlrpZt1THb AivheXDOGtqEsSI9bkDv56dP4l8PTmvvCArfU8MOWx0U1JpY4eqlBLd251k0fAyd1QvE QZ6DGbHHAz3HLdMQMk25l5cJ7WlgpiaVkEENQhZwAvlMIPG4i4gfXjqM+b+/gAWHPaAy 1soA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827608; x=1795432408; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=cwdI2ks2UX6ufxBpWH5uqNqrepl84PaA06uzdEISrr4=; b=NZyD5JM94w6hFtiSy1AkJoFhZ36A7cuh9MFJtGb9ktxTg4BNZH6IpwBdp/N3T17dOw EriVrsWy+20gAQsgZZBFIgMnaJpCzNtc27tKYedzgsdW3uBxU495FTRl2D2v4+tVcsdC fIvhpqVQtkxcPIgCI/cIXiNquN772/rxPn/y36goFJdXYb4Xwjs/3lPd8GCA5fE5FpFr E4RJHir9mFWknrLZ9LwsqwBHS2iXSlcM7ByuJebIAYotazA7LdACG8acfYPqQl13pwml LgwPsbYzCbv53q5sQ6BoAAgGsCntKuNIVZWKLJYpa88/iTUkYkzkgvJOyffG4WmanlTW qzug== X-Gm-Message-State: APuU4Z8GwMt4QgEiT0wfJ60fwA/vTdwTFwVQcP1Qt3QrlrBmh1SOXTAl 5pKoH8o/Tmo/O5/o8R7JVsRow1M0p4jg7bfT4s6hSLjyqlCIxxigttxCy9vfRJmcJzo3tzkYjni r9QxNgH0= X-Gm-Gg: AZFdTZfPyg0c1usf7mJC+zTaEbw2KQ+fymOQVdxa/d87ztGLc2XnMTOwUw1Ld8tw5cm 8z77ADdIzIj1pmV7yWSDq7uARGOH+72D8p4Zx7voz7li53nqXnyAE7axFymo0Y2HxxIGWMnDBbM DobnN8wQA1LehnsxeBIKHhgGy0NHLxHAjXPUf7goVFL5Gj9+h9pTwUUqGtDIM68idIOo3DgWE45 GwQPvhtNTj91LN34vcBbYXs1ykenGyCAQ9i+bSDC8Ytc7y1NYLhhB/kUkXcaSHvJao21yUu1SP2 ++L4GTZYDeyHzRiEFvHjNvS3xruWsRf6UkflDwWCqeqom583BJqDvuaKrxpOHTsDoyLLv/VPQIJ q7z6zOLTr7SsYLwNbZHLgwJfqhn5XVNr8XQZV+BZqmBJa772Ov++ecteUv2hqykiFfqII6Tgq96 HWp3zQ2g5LMlFG0BnDLICYV6k1xjGXPSKV+ft2pzrR3nyniWnee+/zrJRJo2E9QNgOZR4jwHzga +qN5ahXSWJnWAov/LCUy3UeTW74eTCSuWpjiwsu8Vjrho0DgCDlqBUzWtSwbg+HYTbJP0UJWBqn maphGeEE1iUT5pUFrBfDUDnHCfMsn0T8+AJ+KU/9W6/a99o7+Fc1ymc57lPh38xhHKhVIYn6bqa XMx2QTS/3zXq5u2UMEs/8mBrJnLudC7/nFA== X-Received: by 2002:a5d:5f51:0:b0:48e:d88:55f4 with SMTP id ffacd0b85a97d-49c6d63fad2mr23388887f8f.2.1794827608197; Mon, 16 Nov 2026 03:13:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/33] hw/net/net_tx_pkt: Sanity check virt hdr len in net_tx_tcp_fragment_init Date: Mon, 16 Nov 2026 11:12:51 +0000 Message-ID: <20261116111303.1692832-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827760755158500 Content-Type: text/plain; charset="utf-8" In net_tx_pkt_tcp_fragment_init() we calculate the l4 header size by subtracting the packet's virt_hdr.hdr_len from its overall length, and then we g_malloc() that many bytes. This shouldn't underflow if the caller has been sanity checking sizes and offsets, but as defence-in-depth, check again here before relying on it for the malloc size. This change would suffice to avoid the guest self-denial-of-service via overflowing the virt_hdr.hdr_len calculation in net_tx_pkt_tcp_fragment_init() which we fixed in the preceding commit. Cc: qemu-stable@nongnu.org Fixes: 02ef5fdc092bd4 ("hw/net/net_tx_pkt: Implement TCP segmentation") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3648 Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-12-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- hw/net/net_tx_pkt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index b2935900fe7..dc2563721e8 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -604,7 +604,7 @@ static bool net_tx_pkt_tcp_fragment_init(struct NetTxPk= t *pkt, size_t bytes_read =3D 0; struct tcp_hdr *th; =20 - if (!pkt->payload_frags) { + if (!pkt->payload_frags || pkt->virt_hdr.hdr_len <=3D pkt->hdr_len) { return false; } =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827956; cv=none; d=zohomail.com; s=zohoarc; b=hglMmV2h4ifw9rcVcPdRfr7pUjsrabmPu+Wpf480uFnVKcyGXSFfUVfGK/5KBcWKM9QEGMTRECYLWB3yjk3LxUnHiIxzJmN0dpOA0yayJlQGQAgSu8WTULkbcIxHI2iA0o+WY6cMzS0YAm4Nb5S86Q+n2C0zkryxmgAVy483WcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827956; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=RHrYP9A7x+UL7YQcUbon2OHooVJuSg4b3FVW4Ndxt5M=; b=kPJ1NBX+mokV7+bPVlO6nLK5UqbihyTIc0oPPl4XdfpkP3RN3vFxlXgjJKJhDS9rafP68al5eRZ5UDBiVx9BJR2UGAzQG9kjdoYwDrlJTkQ5jwJm8v8ZQHcbYylrIpAgIRJEAmd1GhYxvcvTIqqCvJlM+UTSo+c77wIwRgTxIv0= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827956454578.8831152670755; Mon, 16 Nov 2026 03:19:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSuee-0003vi-Au; Mon, 16 Nov 2026 06:13:44 -0500 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 1xSueU-0003s8-Ou for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:36 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueR-0002C4-8l for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:33 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-491846221ffso2996486f8f.3 for ; Mon, 16 Nov 2026 03:13:30 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827609; x=1795432409; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=RHrYP9A7x+UL7YQcUbon2OHooVJuSg4b3FVW4Ndxt5M=; b=S6ovq8++P4dxLej5STXq8SZ0VSN67USDcP5W0Lf9ryHKkXTrNc8s0gAdGgtC5cXBOv aYc45LVoS+mmLcGLLAGagCa8TFqSN7aj+orkhSNMTCIBgKv8WBgiCndsmamdle61sbRx dKrKC59g7Z71D4jAB2K9cCk+4Uz5td41MkaZTpq9yjs/1kxA67Bfr8kvFqeeKvTOVSbv zTS8qM0b/vYj0sQ6vK3duCDHNQzvOdvrTK6dVwV1jgMDRD5u+VbAmQj9Hmqv1wGoSOWt O6rqGO6v97HG87bNhPcABQkjdCq7g2+K1s3Nq2yvOq/ENr41xdCwENBZLRszj6v5sJoQ 23PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827609; x=1795432409; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=RHrYP9A7x+UL7YQcUbon2OHooVJuSg4b3FVW4Ndxt5M=; b=UuAQk1XZXbtRORn38jp5R+ErXIYf4P+ZaimFEjjzqIVqrXEx9rVuywhH0yLGuPrMTH hECbiVqnZXmF5aMsrmi/4cAG7IcQj7W8wc6561FQ9cCD+/YvZ6N+m7FB8vfjEbT9NoNc 4kXWj5BFE1y0GIE9+J5Wl1j4mMlKDxsDX2f/ljk1OQKB0G8IQAsV3Vw86/lhfopBdItr TkbqIcOmcdzFlvAuXZvtBQxFb35dJErx5f+yH4FEcReJDiL1OZyhZoX5wcgFIXgx59do DCGo/w5O3nqu39jZKlDystmeTLGB6X2dfFRVrNZQ5i4KqHi1k/EQEmUoSWIfYE3U/4Ig hXLQ== X-Gm-Message-State: APuU4Z9NoRzEAqE1wBgFy4lfp0cPL+mK8JYKUhxcGcloLkNk38NFzBW3 L3y9RIFiixsCQ4jT2BwaqwIsR79oc5Vn0cNie4B5FjQfcT+EW98gJVxrJ1TrgonTDgpP/3N/bdr Bao1mjSU= X-Gm-Gg: AYBFou2ntpCfeFn7XJKcfk3y4QrP9To3iCoeth1RZk9uNeiLXbYNBCBF+KgQvGayCv9 4SRQf7pvNfpKYl8B3Il6wIdrYxfRJaHj0lQ2HmwBbT76GlGfFPLggcP+JEkit8sZWnpYIwHpNbu 0ZxAXyRabDeVWd+qUvZO2RdbkkPOWBV9HFdb3xx2ZgCcmM7FT8c95+ysRreU4R42ZK00iLaEKBj jY9jtx+E4akCM/cyXiBZ/PBZXEJMKLDKzLMUmE/co2UEjyxp1V9/TogNbfEAskCMcnH5yaK3sN2 bftSP6sCfA7wQlmQ5AeOWxvXyxdytv/GoI7/joWp2FgCCEkBsbcadLWnfBbbo3khFLUG9sCC4w8 EjS5gVtrIItOzoybT/3IKGcMjBfJ9wOCR6GoMiIR42VEYtytf4EpqLf7l4bxmmyAyP6CfS9IqXi 86pNmPpcQmGm/e/uDwGz3MTVj3Ep+UX+5kDBELfElKagkXN83m1nB53YBDSDUb+TmI065pd5/Xu zyz4Q3fkL3bOOwFJ3TUJ5ri/DruAnVzb9tm1b766+/PXbVzQ6i2ZyOoVczS+8V6pDpSMnjXV7jQ WaPA7dqokRRjcheoyRJTeQgwiuDE/lBPj4kKlBe75LFpESlTzZnz7YXq5x5xMlNBC0IPX5maN5T EKUMvKiFlxrazNn48bFU8jhsqQpFi/kKYPA== X-Received: by 2002:a05:600c:800e:b0:4bb:6fd3:5ac0 with SMTP id 5b1f17b1804b1-4bb6fd35c5cmr67778235e9.28.1794827609121; Mon, 16 Nov 2026 03:13:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/33] hw/net/net_tx_pkt: Sanity check L2+L3 header len in net_tx_pkt_parse_headers() Date: Mon, 16 Nov 2026 11:12:52 +0000 Message-ID: <20261116111303.1692832-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827958799158500 Content-Type: text/plain; charset="utf-8" In net_tx_pkt_parse_headers() we examine the L2 and L3 headers one after the other. Add a sanity check that the two together don't exceed the packet length or the maximum IP packet size. This shouldn't happen if the L3 parsing was done right, but is worth doing for defence-in-depth. Cc: qemu-stable@nongnu.org Fixes: e263cd49c73c595 ("Packet abstraction for VMWARE network devices") Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-13-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- hw/net/net_tx_pkt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index dc2563721e8..c331628134e 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -267,6 +267,14 @@ static bool net_tx_pkt_parse_headers(struct NetTxPkt *= pkt) break; } =20 + if (l2_hdr->iov_len + l3_hdr->iov_len > ETH_MAX_IP_DGRAM_LEN || + l2_hdr->iov_len + l3_hdr->iov_len > + iov_size(pkt->raw, pkt->raw_frags)) { + l2_hdr->iov_len =3D 0; + l3_hdr->iov_len =3D 0; + return false; + } + net_tx_pkt_calculate_hdr_len(pkt); return true; } --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827822; cv=none; d=zohomail.com; s=zohoarc; b=TcW8Bpy3Ky2J2Y+FCxn86Q+TMX+7fofVsLnFTbhFG6Y4yQMV8NO0hAs5wLyWDqNazcoF6Wikt9Tfvi8l0LkuwLlBOfFLnr32SmJ6Dq7oYgDMqh28PMdWj/bbH3OWMYgJQlD2UWnFKWHuB5gj+oMHHc7dB+9EA8NJD5uGbE73eKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827822; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=mcnGsYx296n1KwArJiNQTyaA32M8m7TVAvnpqGuU26Q=; b=Rbobln3+hhJpERG0W6oeB5sjyjSrlHq4nxtELpeGDi4v0n5x9kOoMXd3OQyfsrExiicyqITU5zNsUIvJVBPViLtvnyE6Wd3ngz8DSwj/LpSwPm+DNZ5JcriHlYuNwaYmV50qTBqCYrf9f9SJRzbs9XDvKzRTrGdl5s1v5MklGC8= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179482782197790.28740863507346; Mon, 16 Nov 2026 03:17:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSueg-0003wG-0H; Mon, 16 Nov 2026 06:13:46 -0500 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 1xSueU-0003s7-OZ for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:36 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueS-0002CH-Ek for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:34 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-48dee593f18so3508419f8f.3 for ; Mon, 16 Nov 2026 03:13:31 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827610; x=1795432410; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=mcnGsYx296n1KwArJiNQTyaA32M8m7TVAvnpqGuU26Q=; b=XSbQ1c3NYpvyu6yLfNLos72MfYcVeQlNT71pUzI2HJfSkcLbdmB3rZPSPfT4kod71s kPBg9xrAjVpZ98ka09b3Ztr7XRr/mXdSBZRyV9MMedOTIRO8N/vv5/1DHZGklmZfFnvI Nf+wz7z6sDTrlIgmH7GJqui2k/JDDgLZFypQfXPGyyFFxdcov4ceQxIpS8QNzaQgrpbH 3kTz9LuWxcy64uBud2annOA1PFctjv2Wslt7eDOrf5zDiNk9WGrd7SI9aU3SI1iSNpvA 9olBkjfdtfyqUi6SBHxBTq0ez4Ff/6stPESY4ZW2wdGb5vYB1Wjywv07hG80ChqJn1YQ RC3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827610; x=1795432410; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=mcnGsYx296n1KwArJiNQTyaA32M8m7TVAvnpqGuU26Q=; b=i38WUHJMud2dkqSWgE6ZuVsav0QPO+aTAt40Tx9rrZIbrKQXdp+sA+hldP7nUscN45 eSANTRHbRtFkxuqv9oWzZDo7QGccivsMA1Qxulb204EskMknKSvkyD+uLuYxbPim8xJT oWMnFaoNirJjZSuXxrGIVB3Ui9gPzeqQLsvVQKclHcj2Xk8s5y4TQ+kCowL1QBBILK9c pYvGZ5d6JIvBV0P3hIpHWaHmEigYrExBLLckhb6uCXdz/Gc/mpT8eqkd1NnvjeqKl73T CyBN1l525ezcufxZr9VqpqqZ2O0MTeeoUZzw8dAt4HBFnP2Mnb+MWJl6JrgwjVLgDB1X z69A== X-Gm-Message-State: APuU4Z9eQmkVuWmkc7lXm+tS8n3VJh6AGYnrWN7SQcfWr72dw+7zfhOA VNmaykWl2bkaw593PBTOzTH/b2t3/bMHfJuGCaliwu1sERumOCbyLRoHBqL/D+4AW32o6V2aiiT O+tOJfDo= X-Gm-Gg: AZFdTZeW19IjKnqg8MHmmtL1QxqjpQYJXxIqawYdZtDYKqFo4IJPRhyfoBo9nmMJn8A qnQww7QJGc6roktfi2k5GxfgwQgmhSBQ60PNqQqV8H0xPzBrJHonoi00tdLGw/RnUs2OVICI+4m s2RdUXOpEM+rhaX5Ym9rzga5RJQGbvllQuEbcWUbBlGKD9hpcbyMM1CJR4TySvoQRxW7Ox4jdEZ l/JsolnLsdFjinRAo7rBafXjMOm6030FjEfS3somDQNdOaUWu1WqqsqtX+cezLGnho4lvhIA66m Ii4qvhIfCVY2BgstHceaNtPa0CjscNANKh5SHD0kuGPOXrRE2r9VS88iEJyAUrYPqIXscFnLKs3 XEpy8b7sRrQpUgBf2URuVtUMbkRt+sUr6OqNNLifPKxqbhhzBi24Otzx6Rc1mPoMI7FWe9JUyb5 iRC74xu+9kcngnXMOWiVkrbKo0wdFm8dhwdkc4aYKGSPM22W0f5OqmgAufOHW8ccar37SaW/+91 5b0ZNZ9Vx7JDeupIQFOEitUtjY1EyYTxNj9F3MpTK43H/1wOI7fzvcpSjFtg+M7TsErk5uPF5Nm 73OdXMUh+puvOY9i+OZyDLpNiRgLYeLhi3DllOtDbJIVmOWHvFSalmRKVFWzi++ik2P5DLjsd+p iH61mhUCtr3jdfkmtR503UVbK/XeD7RQt7g== X-Received: by 2002:adf:e00e:0:20b0:490:1881:80ec with SMTP id ffacd0b85a97d-49c710c24f8mr15815630f8f.36.1794827610272; Mon, 16 Nov 2026 03:13:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/33] hw/net/net_rx_pkt: Check for overflow in _net_rx_pkt_calc_l4_csum() Date: Mon, 16 Nov 2026 11:12:53 +0000 Message-ID: <20261116111303.1692832-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827823355158500 Content-Type: text/plain; charset="utf-8" In _net_rx_pkt_calc_l4_csum() we calculate the number of bytes to run the checksum over by subtracting the IP header length from the total IP packet size. This shouldn't underflow if other parts of the code have been correctly checking and calculating sizes and offsets, but for defence in depth check here, and don't checksum any bytes if we would otherwise underflow. Cc: qemu-stable@nongnu.org Fixes: eb700029c783 ("net_pkt: Extend packet abstraction as required by e10= 00e functionality") Signed-off-by: Peter Maydell Signed-off-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-id: 20261109-eth-v2-14-334cc08e2f2e@rsg.ci.i.u-tokyo.ac.jp Signed-off-by: Peter Maydell --- hw/net/net_rx_pkt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index 03a35f03154..110496e9c81 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -501,8 +501,10 @@ _net_rx_pkt_calc_l4_csum(struct NetRxPkt *pkt) csl =3D be16_to_cpu(pkt->l4hdr_info.hdr.udp.uh_ulen); trace_net_rx_pkt_l4_csum_calc_ip4_udp(); } else { - csl =3D be16_to_cpu(pkt->ip4hdr_info.ip4_hdr.ip_len) - - IP_HDR_GET_LEN(&pkt->ip4hdr_info.ip4_hdr); + uint16_t iplen =3D be16_to_cpu(pkt->ip4hdr_info.ip4_hdr.ip_len= ); + uint16_t iphdr_len =3D IP_HDR_GET_LEN(&pkt->ip4hdr_info.ip4_hd= r); + + csl =3D (iplen >=3D iphdr_len) ? (iplen - iphdr_len) : 0; trace_net_rx_pkt_l4_csum_calc_ip4_tcp(); } =20 @@ -517,9 +519,9 @@ _net_rx_pkt_calc_l4_csum(struct NetRxPkt *pkt) struct ip6_header *ip6hdr =3D &pkt->ip6hdr_info.ip6_hdr; size_t full_ip6hdr_len =3D pkt->l4hdr_off - pkt->l3hdr_off; size_t ip6opts_len =3D full_ip6hdr_len - sizeof(struct ip6_hea= der); + uint16_t plen =3D be16_to_cpu(ip6hdr->ip6_ctlun.ip6_un1.ip6_un= 1_plen); =20 - csl =3D be16_to_cpu(ip6hdr->ip6_ctlun.ip6_un1.ip6_un1_plen) - - ip6opts_len; + csl =3D (plen >=3D ip6opts_len) ? (plen - ip6opts_len) : 0; trace_net_rx_pkt_l4_csum_calc_ip6_tcp(); } =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827983; cv=none; d=zohomail.com; s=zohoarc; b=Yd5rdWTAXjCAG6WKKpzwvNytWqk0twZ3RMow8B63at2zRiL7mMtWk7jKT8u2d5tjCwNpE3bQ/5E+D79v2FahJuU9ewuTShRMOcl98/2ixOAHnR4zYLEeDX7pU25y7ttB7Ng6q92POIreIN8RCnvWvIyUV6Ck4ac+DJnF7Um6m1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827983; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=aJLetTbZJ7Rf7k1mQrskTb9PQBrK7zGSIhhOsVLO8KY=; b=Dcacmo/njVJK1CdHEeKUcS+q52f8keoBFQbz9dpP2m591YBsL7kqVNvXrctgaQ9Jhqx/5uxWKqgtpLTY6NzsrZMKe2I/Rf4Qu1pgvxysaBT6jgDu3GPbvWgL6kKjlTZfoSG3/qoCvkmBPJFGBOlToqIzyhpR9rZyPIQJdcVz3gQ= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827983347647.3798092507237; Mon, 16 Nov 2026 03:19:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufQ-0004En-JH; Mon, 16 Nov 2026 06:14:32 -0500 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 1xSued-0003v8-5G for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:43 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueS-0002CP-Q9 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:36 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-49465892f7bso2737793f8f.1 for ; Mon, 16 Nov 2026 03:13:32 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827611; x=1795432411; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=aJLetTbZJ7Rf7k1mQrskTb9PQBrK7zGSIhhOsVLO8KY=; b=FA2NRU3jN/rh/pitxyrgYkS0D81jyXzKH2c0WJBU7hfBuRs3kaENLzleXDfUd/xs8W Qh2o0qkD402ysq6Epdr65hYE7qTNUy5dRid8qEW4ALs63+BGBPAEPillQ6qY8z6KldQi 9SxSE08tkLV0OtZPdw4qZVzKKrt77b8etxf/6bpOfzeLKK9qAunM9THKgLhHpJJSjW6J isfdNiy5rJRGZhwqenpQzNF8ZDeh9s61il16oybaP6d593BXXPWzODdHe+JQjhIgTofU QpkOd3T8vgUiE8RZRfSJrArlqvaZN4TgFvKd4/B0wrXLXFh5AKQUp0Yt5oTBltk9fk3o quLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827611; x=1795432411; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=aJLetTbZJ7Rf7k1mQrskTb9PQBrK7zGSIhhOsVLO8KY=; b=yjq/uGLBrluCZ9YcKtGsufXWPMXkjHE5fQKT4Q7/svzZ+mRMXpdESYUw2lws/P9Mww t2Gp18k0ebsiSo7qUIHFjUwe9SkN0vITnmil7d00prRAkxEZ9PCfmNPzN+bcTRxHxq8z SD1X5oMSD3tE8M0EsA7Wpv5nrygszu72IaJE6G1909GfIdbLU6BgPFUWEiZTl2NYZ1AW Gv4i08u9K0Y/IyHjcNMO+JwtaJlaYmR55YY10r+pMM1+4QwAtDNkJwppJ5oHAUVCBlkD nn61CRGO9sCjIuydufFxuvakyoT4lHN548QjQJJnMrz+3wcH9huHdMmzZM9MKsN2CKfu FNUA== X-Gm-Message-State: APuU4Z81lhNyfGCB9dNDxtE043SK0UluHFocv4oGgMrhyIoqGXK0rtCT 37ALpiHwUIzcVj8V1h3n1QmY2Qf3ncawlhsTpg9J8USU59I7pTAfX5jlvxkUxqIJZaA65vfgkv5 VvYop3xk= X-Gm-Gg: AZFdTZekmnOyM8fJCe1rHsR8nEG7vv+61kFE3zRu4SY3GXeT7NKxKXBMVUEFPBhz2kG baA4PV+sl8HprGjPMo1wT/44xUt15ngA+sMAqojfBAOva7oO2mqEKBqGkyf6quH1AbaWGI9+iuS cuhsdfTL0kVIcHjrexzy6HwrD+6wuCJh98SCDgeOHNkeRydbxtIF6mZV/ALk5JF3F2FkYzR0kDM 89hZbTSfm0UoKnUy5ElqMEzXodYE6xonxRlNKRjgaf5U7dt8nyNpO1gCoDytKW5q0tQnO9vMZxq sTZk2iCeJXfgegiMAw1MzhpByWCXl4wdvIhlzedWjHvZS3Wt20xW5p7VebNI9DVN3ssJqzx7Ej3 gj6oyA0hQNh/ivMreSQDPJQhq3X2sOttqzbqku7wOMxO+yjRTxjsCcjuywo6Fwe/v+IeJp7fZXF 5XH1s0btINtynzVSiRHYWz6w8hpJGdhM1CmX87K+OIYVuBUmlGFwfCG/i1cCbY/2M7i0szvpl/X +gXT1qyEqo0VBIT2rPzim/tRNcxZmmg5bMAVcQX5WGAK/utRbMFZIs++IwgPhhcmIZPBI8afXvs f/Er0l03ZY97PoxxJVuaY4KnjfECF8Dwpu0vKfd24VB8nQomjvaN6r39leBeuip2V+ZOc1U3O9G rB4Kn/PF6ysIB9r3Zcb1MWSGQH7gVL2UDHg== X-Received: by 2002:a05:6000:4b0b:b0:48e:20f9:8d75 with SMTP id ffacd0b85a97d-49c72c9c398mr21249342f8f.48.1794827611186; Mon, 16 Nov 2026 03:13:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/33] tests/qtest: Make netfilter tests accept padded ethernet packets Date: Mon, 16 Nov 2026 11:12:54 +0000 Message-ID: <20261116111303.1692832-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827984937158501 Currently the various netfilter tests assume and assert that the data they get from the filter is an exact match for the data that they send in to it via the net socket backend. This happens to be the case currently because the net socket backend fails to pad frames to the ethernet minimum when the device expects that (unlike e.g. the tap backend). When we fix the socket backend to honour the device's request for padding, the netfilter will see padded packets for devices that require them (which is most of them), and not for those that don't (notably virtio-net). This seems best considered as a test error: if you're using netfilter to look at what a particular network device is receiving, you want to actually see what it is receiving. And most real-world users of filtering will be doing it with the backends like TAP that were already doing pad-before-filter; it's only the oddball backends like 'socket' that forgot to pad. Make the test cases accept as valid both padded and unpadded frames. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Fabiano Rosas Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20261110180655.2072265-2-peter.maydell@linaro.org --- tests/qtest/test-filter-buffer.c | 4 +++- tests/qtest/test-filter-mirror.c | 4 +++- tests/qtest/test-filter-redirector.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/qtest/test-filter-buffer.c b/tests/qtest/test-filter-buf= fer.c index 441cbb975ca..418caccf00a 100644 --- a/tests/qtest/test-filter-buffer.c +++ b/tests/qtest/test-filter-buffer.c @@ -11,6 +11,7 @@ #include "qobject/qdict.h" #include "qemu/iov.h" #include "qemu/sockets.h" +#include "net/eth.h" =20 /* * Test that changing interval at runtime affects packet release timing. @@ -148,7 +149,8 @@ static void test_change_interval_timer(void) ret =3D recv(recv_sock, &len, sizeof(len), 0); g_assert_cmpint(ret, =3D=3D, sizeof(len)); len =3D ntohl(len); - g_assert_cmpint(len, =3D=3D, sizeof(send_buf)); + /* The snooped network device might or might not have asked for paddin= g */ + g_assert(len =3D=3D sizeof(send_buf) || len =3D=3D MAX(sizeof(send_buf= ), ETH_ZLEN)); =20 ret =3D recv(recv_sock, recv_buf, len, 0); g_assert_cmpint(ret, =3D=3D, len); diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mir= ror.c index 723d2c2f291..9972712cb49 100644 --- a/tests/qtest/test-filter-mirror.c +++ b/tests/qtest/test-filter-mirror.c @@ -15,6 +15,7 @@ #include "qemu/sockets.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" +#include "net/eth.h" =20 static void test_mirror(void) { @@ -58,7 +59,8 @@ static void test_mirror(void) g_assert_cmpint(ret, =3D=3D, sizeof(len)); len =3D ntohl(len); =20 - g_assert_cmpint(len, =3D=3D, sizeof(send_buf)); + /* The snooped network device might or might not have asked for paddin= g */ + g_assert(len =3D=3D sizeof(send_buf) || len =3D=3D MAX(sizeof(send_buf= ), ETH_ZLEN)); recv_buf =3D g_malloc(len); ret =3D recv(recv_sock[0], recv_buf, len, 0); g_assert_cmpint(ret, =3D=3D, len); diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter= -redirector.c index 5540c232c0b..a4f9b73c72a 100644 --- a/tests/qtest/test-filter-redirector.c +++ b/tests/qtest/test-filter-redirector.c @@ -57,6 +57,7 @@ #include "qemu/sockets.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" +#include "net/eth.h" =20 static void test_redirector_tx(void) { @@ -115,7 +116,8 @@ static void test_redirector_tx(void) g_assert_cmpint(ret, =3D=3D, sizeof(len)); len =3D ntohl(len); =20 - g_assert_cmpint(len, =3D=3D, sizeof(send_buf)); + /* The snooped network device might or might not have asked for paddin= g */ + g_assert(len =3D=3D sizeof(send_buf) || len =3D=3D MAX(sizeof(send_buf= ), ETH_ZLEN)); recv_buf =3D g_malloc(len); ret =3D recv(recv_sock, recv_buf, len, 0); g_assert_cmpint(ret, =3D=3D, len); --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827905; cv=none; d=zohomail.com; s=zohoarc; b=IAGxLcsOPSzlC/OaFQ52l+vXS4rEW2FqpGWOxLZlQb2oMFWWmSXWhcVCPMP4COW1Kf5DehHxnNSjUz9Lw1GJa6XiWRos/2oHy6IPU5eGHv+0A7m4rrMV0YT1/nXLBqv72NcYY82HcAUA52+jRSRNiX7JtWoE3ilPUqsFW9nPUNM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827905; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=hYdP2QqsjzPzdS/VLWbqC6NWgm20YgV1NBhwCvuGAoo=; b=KRBVg89ONOTY+jgLLHuvo7w2aJA0pVdZzq2fQiABslLBQ2POM5IvPt9g29oR/8VtCFQuwXPtO5HNZKtfpAuaEdmIBwWpQHENX/WlHg8HDxnUXR+lWhZoapJr0SY7N5xTrKe42T3BrRI1VixUgRL6t/P5AFvbD50XuCR6TiaJfYA= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1794827904996326.81443617584137; Mon, 16 Nov 2026 03:18:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSug5-0005Zs-Hj; Mon, 16 Nov 2026 06:15:14 -0500 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 1xSued-0003v9-5z for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:43 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueU-0002Co-GX for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:36 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-48e47347279so1421377f8f.1 for ; Mon, 16 Nov 2026 03:13:33 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827612; x=1795432412; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hYdP2QqsjzPzdS/VLWbqC6NWgm20YgV1NBhwCvuGAoo=; b=TDqm6niHooFT6I/OvOHwV2VRlrLMlnhrqvgZnYXrVGzuCRWO9ChmmFl8K7nLaxLN7V C8idSVcR3ayInhSYTakd3Ss+ccn4G0I5Phf4CUY7pkKi81kCTBBqbKOUjR1RkXsOjO54 AMPO3+VdOaf2lwLBlWeCI4QpHkOcCJmkBGyoBS/j4Yiny6q6wUBTdOR7+i2ggJE9PefL aIhTugUPhaHV954wCyYTtnI/aKy3lBR6tD2xFfi+4TKcXzyslifKKguUIG4nuWX1+gqv Oyg/EuqaoHEkwye/CN1+P8TEDKOxf5LUKWg5FhcMLOr16vB3w14DRSjI07jB0SlVD2SX AkSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827612; x=1795432412; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hYdP2QqsjzPzdS/VLWbqC6NWgm20YgV1NBhwCvuGAoo=; b=gOL2DCAUozMTusmFRlvwUGCM2LqUK+LI+NtpO1jkiQZLxb9+5fZjncm3jlxUlWt+Lm XVWhEhGCkpLJ1xZm8HK8cLXikZ8JeCuBoL3V7SGYP7uJg25oN9tKoopoTefx5DWwe//1 ZHqPwriZVNuvNYApX6jTsI3qxCTrUWzRJ6LYEijd6i/pcfdpcS/rsWsmwWksMXT562TN 4FzznvHxpLhddZNkAicKD/cYC9ThOZc27C97EjmnBAILc3wXVpkh9zxK6+bXJ6KDhLAF FOu71ris3E5hEYne+Xn1nxhhrQiNcs0oSmcCi12yfnyZJhc/p9H7I4ZFAsLRig5SBHdl Cg4g== X-Gm-Message-State: APuU4Z8jbebJVFX3RqebaDjfK3C9U8Fy3w7QR9P4zs5U4g5qjhYp9ntw 5efq3EwbR74FWvKEBFdFMuJWwzAps70kj01QFMvCv9ZGGlIXQfioCqDkkNYdZyMj2uKlFax4Ic7 jJR66sqg= X-Gm-Gg: AZFdTZfoneaLnvjXfkfoQ372/007OOgoTUKlqT+3pI5zwJP8dd8GjeflCv1GDuEN3lG m3z6gT5ZW/kKmAxDNrEuSq397WZkOpVlLIbCYQ4qhsIovJiEfjmFlyJ2+p6ZXaxnXcq7JEfLlDD vZPTVHblx+B3ME8rkRf8kazgu0qsEDdAexZ3pOySFhLkeqfqgpkxYrDViIPbfttA1dh1vy260OE 5OXuNQG814lv1YIhB9BpTf01C4JAPkr9UmpHdDbrrzttQOHcuMQvKbOEeZc0fQ+oM/Cr9oa15Qk QQCdOrp89FGZRep2TN7S4keOcN1OIaWkv1dr70jZkM8kIJaM1uPRnn5Gb0jsgFAWH4dHNz0XbN3 v+UaMgPQwd0Wp5VQWZBkzCh1ywBQ5FLGYBf8aot9YWqQtxCYuhIvvYfUC9v8sZHX4pjRcY0U1I4 4+DuJf/trJ+A8sNlAswIwRRnOvEMvGesJ2UOPUNcRz5tOu6KCToZzqO2B46Jn+w8aRysvS8iDdP 6ruIs//r2ratA8wrhT+UHXzHY7Tem4jmevNPYNk9/Na2co1ZXHUrlq+0DA/w0VNWL83U7yqgLHT 0NLIgUwqyfE6u0v/zDW6YPGs9rc3Y6RCdW3kZg5tAl2vYOV8p+Ka4z0NxFAJk5WIFHwvdFSBC3w X0Ypax7wvfVP4GAy8N2duhonCa4+NkHUH+A== X-Received: by 2002:a05:6000:4b02:b0:48c:7386:af18 with SMTP id ffacd0b85a97d-49c6dbfff8fmr20619083f8f.8.1794827612274; Mon, 16 Nov 2026 03:13:32 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/33] net: Pad short packets consistently regardless of backend Date: Mon, 16 Nov 2026 11:12:55 +0000 Message-ID: <20261116111303.1692832-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827906265158500 Currently our handling of short network packets (i.e. those which are smaller than the minimum ethernet frame size of 60 bytes) is a little confused. The intention is that we allow network device models to transmit short packets, but we protect them from having to deal with receiving short packets unless they explicitly opt into it. This means we don't have to have a lot of code in each network device to try to handle the short packet size -- historically that code was untested, and often a source of "carefully crafted packet can cause an out-of-bounds memory access" bugs. Our implementation of the padding is currently done when each network backend feeds a packet into the system via one of the qemu_send_packet family of functions. This mostly works, except that we missed some of the more obscure backends (e.g. the socket backend), and it means code duplication in each backend. We'd like to switch to making qemu_send_packet do the padding itself. To do that, we first need to make sure that all the NetClientState implementations which do not want padding set the do_not_pad flag. We do this by setting the flag for NetClientState instances created by qemu_new_net_client() and qemu_new_net_control_client(). Emulated network devices use qemu_new_nic(), which does not set the flag. Note that this also causes the net/hub client to request no padding. This is the right behaviour: we want the hub to accept short packets and forward them on to all destinations. Each destination then gets to choose whether it sees a padded packet or the short one. The hub.c code is length-agnostic and doesn't look inside the packets it is passing on, so it has no issues with short packets. That change means we can rely on do_not_pad being correct for all NetClientInfo structs, and so we can pad short packets in the qemu_send_packet() and qemu_sendv_packet() family of functions. If the callsite is already padding, then this will have no effect, but callsites like the socket and dgram backends will now correctly add padding. This fixes the bug where when two QEMU instances are connected via one of those backends a short ARP packet transmitted by one is not correctly padded by the other and gets dropped. Note that if we pad a packet, our return value on success will be the size of the padded packet, not the original. This is OK because this function (like the NetQueueDeliverFunc function type documented in include/net/queue.h and which we will eventually end up calling and returning the return value of) returns >0 - success 0 - queue packet for future redelivery <0 - failure (discard packet) and doesn't guarantee to return exactly the size of the packet sent. None of the callers try to use the return value as an exact size. Cc: qemu-stable@nongu.org Fixes: CVE-2026-118490 Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2362 Signed-off-by: Peter Maydell Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20261110180655.2072265-3-peter.maydell@linaro.org --- include/net/eth.h | 22 ++++++++++++++++++++++ include/net/net.h | 3 ++- net/eth.c | 18 ++++++++++++++++++ net/net.c | 32 ++++++++++++++++++++++++++++---- net/tap.c | 2 +- 5 files changed, 71 insertions(+), 6 deletions(-) diff --git a/include/net/eth.h b/include/net/eth.h index 3e83f5d68c0..a1bc0c2fd58 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -439,4 +439,26 @@ eth_parse_ipv6_hdr(const struct iovec *pkt, int pkt_fr= ags, bool eth_pad_short_frame(uint8_t *padded_pkt, size_t *padded_buflen, const void *pkt, size_t pkt_size); =20 +/** + * eth_pad_short_frame_iov - pad a short frame, iovec version + * + * This is equivalent to eth_pad_short_frame(), except that it works + * on a packet stored in a struct iovec. + * + * If the Ethernet frame size is shorter than 60 bytes, it will be padded = to + * 60 bytes at the address @padded_pkt (and the caller will need to handle + * it as a not-in-an-iovec packet). + * + * @padded_pkt: buffer address to hold the padded frame + * @padded_buflen: pointer holding length of @padded_pkt. If the frame is + * padded, the length will be updated to the padded one. + * @iov: iovec holding the original Ethernet frame + * @iovcnt: number of elements in @iov + * @pkt_size: size of the original Ethernet frame (i.e. iov_size(iov, iovc= nt)) + * @return true if the frame is padded, otherwise false + */ +bool eth_pad_short_frame_iov(uint8_t *padded_pkt, size_t *padded_buflen, + const struct iovec *iov, int iovcnt, + size_t pkt_size); + #endif diff --git a/include/net/net.h b/include/net/net.h index de4f03c3013..c2fd451f17e 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -171,7 +171,8 @@ void qemu_net_client_setup(NetClientState *nc, const char *model, const char *name, NetClientDestructor *destructor, - bool is_datapath); + bool is_datapath, + bool do_not_pad); NetClientState *qemu_new_net_client(NetClientInfo *info, NetClientState *peer, const char *model, diff --git a/net/eth.c b/net/eth.c index 33b61cac414..d5590bb671e 100644 --- a/net/eth.c +++ b/net/eth.c @@ -615,3 +615,21 @@ bool eth_pad_short_frame(uint8_t *padded_pkt, size_t *= padded_buflen, =20 return true; } + +bool eth_pad_short_frame_iov(uint8_t *padded_pkt, size_t *padded_buflen, + const struct iovec *iov, int iovcnt, + size_t pkt_size) +{ + assert(padded_buflen && *padded_buflen >=3D ETH_ZLEN); + + if (pkt_size >=3D ETH_ZLEN) { + return false; + } + + /* pad to minimum Ethernet frame length */ + iov_to_buf(iov, iovcnt, 0, padded_pkt, pkt_size); + memset(&padded_pkt[pkt_size], 0, ETH_ZLEN - pkt_size); + *padded_buflen =3D ETH_ZLEN; + + return true; +} diff --git a/net/net.c b/net/net.c index bf7e5d9b125..7c7fb4bd30e 100644 --- a/net/net.c +++ b/net/net.c @@ -267,7 +267,8 @@ void qemu_net_client_setup(NetClientState *nc, const char *model, const char *name, NetClientDestructor *destructor, - bool is_datapath) + bool is_datapath, + bool do_not_pad) { nc->info =3D info; nc->model =3D g_strdup(model); @@ -287,6 +288,7 @@ void qemu_net_client_setup(NetClientState *nc, nc->incoming_queue =3D qemu_new_net_queue(qemu_deliver_packet_iov, nc); nc->destructor =3D destructor; nc->is_datapath =3D is_datapath; + nc->do_not_pad =3D do_not_pad; QTAILQ_INIT(&nc->filters); } =20 @@ -301,7 +303,7 @@ NetClientState *qemu_new_net_client(NetClientInfo *info, =20 nc =3D g_malloc0(info->size); qemu_net_client_setup(nc, info, peer, model, name, - qemu_net_client_destructor, true); + qemu_net_client_destructor, true, true); =20 return nc; } @@ -317,7 +319,7 @@ NetClientState *qemu_new_net_control_client(NetClientIn= fo *info, =20 nc =3D g_malloc0(info->size); qemu_net_client_setup(nc, info, peer, model, name, - qemu_net_client_destructor, false); + qemu_net_client_destructor, false, true); =20 return nc; } @@ -344,7 +346,7 @@ NICState *qemu_new_nic(NetClientInfo *info, =20 for (i =3D 0; i < queues; i++) { qemu_net_client_setup(&nic->ncs[i], info, peers[i], model, name, - NULL, true); + NULL, true, false); nic->ncs[i].queue_index =3D i; } =20 @@ -742,6 +744,8 @@ static ssize_t qemu_send_packet_async_with_flags(NetCli= entState *sender, { NetQueue *queue; int ret; + uint8_t min_pkt[ETH_ZLEN]; + size_t min_pktsz =3D sizeof(min_pkt); =20 #ifdef DEBUG_NET printf("qemu_send_packet_async:\n"); @@ -752,6 +756,13 @@ static ssize_t qemu_send_packet_async_with_flags(NetCl= ientState *sender, return size; } =20 + if (net_peer_needs_padding(sender)) { + if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) { + buf =3D min_pkt; + size =3D min_pktsz; + } + } + /* Let filters handle the packet first */ ret =3D filter_receive(sender, NET_FILTER_DIRECTION_TX, sender, flags, buf, size, sent_cb); @@ -906,6 +917,19 @@ ssize_t qemu_sendv_packet_async(NetClientState *sender, return size; } =20 + if (net_peer_needs_padding(sender)) { + uint8_t min_pkt[ETH_ZLEN]; + size_t min_pktsz =3D sizeof(min_pkt); + + /* + * If we pad the packet, we get back a simple buffer, so handle + * it by sending it to the non-iov qemu_send_packet function + */ + if (eth_pad_short_frame_iov(min_pkt, &min_pktsz, iov, iovcnt, size= )) { + return qemu_send_packet_async(sender, min_pkt, min_pktsz, sent= _cb); + } + } + /* Let filters handle the packet first */ ret =3D filter_receive_iov(sender, NET_FILTER_DIRECTION_TX, sender, QEMU_NET_PACKET_FLAG_NONE, iov, iovcnt, sent_= cb); diff --git a/net/tap.c b/net/tap.c index 9bce0d088f9..ee6430d34a5 100644 --- a/net/tap.c +++ b/net/tap.c @@ -627,7 +627,7 @@ static TAPState *new_tap(NetClientState *peer, TAPState *s =3D TAP_NETDEV(object_new(TYPE_TAP_NETDEV)); =20 qemu_net_client_setup(&s->nc, &net_tap_info, peer, model, name, - tap_net_client_destructor, true); + tap_net_client_destructor, true, true); =20 s->queue_index =3D queue_index; =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827907; cv=none; d=zohomail.com; s=zohoarc; b=SzMsWr5faNBdvANShMDCYZWaPXgKWU5643Ypw4r+VvzWatqKaWJAgkuAK9+WwoWl4OpFhj+0PKLCfLGF44eDP1eMdiQCkRRoyBnEHtBiOWcdN0S4FHhHDJphmU+Aj6ek773o9yS7Ee4D0qq8GZgZb3RKrSxg3Nry8R3Iaq5siHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827907; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=zIEgskHLHp1xxZ0CrCgRpaQC5xY5tGTsVVzDXmvtLvA=; b=JiwW99ZOFcudMLyDlJjC3WxJ76RUdGXAMjnB+n96p/CU/EjV1NuPWYCrTOFKro3os2a/FQs3FBMVMFT7FEHQTQJpzk/Zav3dQXYxI+0Bv3qku1dlsonzuy6ZvyIxaMWfIVnPiXKujAmwl7dhxbiQVeBLS7EQ5EABVe4r3K8BCH8= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827907026564.4580041450955; Mon, 16 Nov 2026 03:18:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufY-0004Op-Ih; Mon, 16 Nov 2026 06:14:42 -0500 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 1xSued-0003vA-5f for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:43 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueU-0002Cx-SB for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:37 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-4918c2d727fso1808075f8f.3 for ; Mon, 16 Nov 2026 03:13:34 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827613; x=1795432413; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zIEgskHLHp1xxZ0CrCgRpaQC5xY5tGTsVVzDXmvtLvA=; b=zKamMwgnzuNDh1T+A4XThJlKhhV8Ze9TXcHjaYmzGbQnGR3N7Ha6rDw522MVgVE36T srviPDQnEiHvBGJVXDogmxEO0Py7ShovXxqhVIu0ebjF9dgjhn714PnUJAYE1Etz/zD5 jydXI7TJSldgIluuz7rvKl2ZNHgVG8+XvLBE3349+I5R7xpA/ykohSxhTgbpCTzWW9ZF P403eUubGpbTBNQpWVVG6wzZCk0JJWfgqDfxUUBFgrAVRZemmeEtrlRvPFA1OHb7Hyeu wU8GSwhYvSBFgPDXfLVAPHh5zg0XmkCFmu43aRqULAN6gdW88tx2PimxPyp3qwMtqhoh 1ObA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827613; x=1795432413; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=zIEgskHLHp1xxZ0CrCgRpaQC5xY5tGTsVVzDXmvtLvA=; b=Qba247UKWH4ePc+xxRvF6NDPlDcCvnxmks2n+t7PDpQUMZ9zblUbGXMOUPb+sSd131 mKwRhqV6p0Fp0EoCACwWaHUn0zDl1qlVvkGbtqPrpL289ovi5p0E/7rmlUHiOLjsrjE0 y6Nbvtds2wgSPKtr58RyY0yRD48Ndw10TaI4x6z9Qbfks0MUMFucyDvzXVoa9ObY/oq9 1holseqM95ulWroLO0kQcD394o4opJHvxl1BFS1vZKszgkQ79JZX6zIdrPZY5NfGDmnz jdqAi/JhTdDzorzaVjgq2NOWuM3Q6PGY1lRN3XBV5Qi+bMQPsZlgvsodmrf4InM3YKHx EB8A== X-Gm-Message-State: APuU4Z+kgGzJ8mtUe31TdKJ+269Mya7PP2QwqkLTUlxi17CXCDtQObR4 FXrbjAWA7ylbC8MTqRPkUf+7uin8fJX30TE1t82g4q+vMdXmMwhnqeBXpmrvQ3BiG0DOa79X6RG lJasCkYE= X-Gm-Gg: AZFdTZfKC//xfZhPy6ZrcrVG25XR5ZDoxFgUYC6TaWRlLPMqmGP3o2tViZm6B5InkO8 MdFZ5H4azCYIkDxob04lIZJ1lVJy6MV1tKROWfAosHSqadKC9tvvvKCflfo9FBbMzPGQq8j79Ek 54aMei2fxLTHVFwIzF/7N36FovjdE5ynVtfrhgYgfbdik50SrKsLK6yaunm4Fxj8Iu9TatOTYET 5claXEfMIhhWTcWvjGZhjaJF6gpqq/wA1XcTbnrFkYzfC81A8JBen5Yzgh3A2rHP4SqBKd81i1w r/0e1YorifiDWxBBAcOTt455V+UUqt9Ae5oxumqRNQUr+IA56Z7EXlEnFKauZtaBu9JkBIBDxx0 /noNM3w/3byF7jsPO5djcjgECsIr2GZ72KiIoai5nbxkSD5c1R0mW3ehVi4sA6K44JTgjaXc2q3 3/UpUiM3Z23JI++YxqPfiyancdLaDv371luTAErkgfpDAt40w0wIXone/ujZ9yKXsdg5SB0qksz UoOdlg/5mVTXWNT3KcIHB+Huyk4j2Vwbs9K56md/cgyuwUkgA9CesVsYKxTz38rv6GFM3/H3zWt 9RWzy93dqog+1pFDvN9DaCcfFgZS9aUvBVXPpJr93IzwwQLj1uNDIUwf+M43Mboj4D7T5L9yM32 ol0S0NSQpFTOGgb3pq2Hf60GeRo8D/SrHFA== X-Received: by 2002:a05:6000:25ee:b0:48d:ee0d:8b3d with SMTP id ffacd0b85a97d-49c71a66cffmr19293116f8f.28.1794827613321; Mon, 16 Nov 2026 03:13:33 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/33] net: Remove padding code from net backends Date: Mon, 16 Nov 2026 11:12:56 +0000 Message-ID: <20261116111303.1692832-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827908202158500 We can remove the short-frame padding code from the net backends that were previously doing it, because the qemu_send_packet and qemu_sendv_packet calls they use now do the padding for them. Signed-off-by: Peter Maydell Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20261110180655.2072265-4-peter.maydell@linaro.org --- net/slirp.c | 9 --------- net/tap-win32.c | 15 ++------------- net/tap.c | 9 --------- net/vmnet-common.m | 11 ----------- 4 files changed, 2 insertions(+), 42 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 451c0fd1ba4..eea12e79816 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -120,15 +120,6 @@ static ssize_t net_slirp_send_packet(const void *pkt, = size_t pkt_len, void *opaque) { SlirpState *s =3D opaque; - uint8_t min_pkt[ETH_ZLEN]; - size_t min_pktsz =3D sizeof(min_pkt); - - if (net_peer_needs_padding(&s->nc)) { - if (eth_pad_short_frame(min_pkt, &min_pktsz, pkt, pkt_len)) { - pkt =3D min_pkt; - pkt_len =3D min_pktsz; - } - } =20 return qemu_send_packet(&s->nc, pkt, pkt_len); } diff --git a/net/tap-win32.c b/net/tap-win32.c index 38baf90e0b3..2fccfdbaacf 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -682,25 +682,14 @@ static ssize_t tap_receive(NetClientState *nc, const = uint8_t *buf, size_t size) static void tap_win32_send(void *opaque) { TAPState *s =3D opaque; - uint8_t *buf, *orig_buf; + uint8_t *buf; int max_size =3D 4096; int size; - uint8_t min_pkt[ETH_ZLEN]; - size_t min_pktsz =3D sizeof(min_pkt); =20 size =3D tap_win32_read(s->handle, &buf, max_size); if (size > 0) { - orig_buf =3D buf; - - if (net_peer_needs_padding(&s->nc)) { - if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) { - buf =3D min_pkt; - size =3D min_pktsz; - } - } - qemu_send_packet(&s->nc, buf, size); - tap_win32_free_buffer(s->handle, orig_buf); + tap_win32_free_buffer(s->handle, buf); } } =20 diff --git a/net/tap.c b/net/tap.c index ee6430d34a5..9f3d0b08ab7 100644 --- a/net/tap.c +++ b/net/tap.c @@ -261,8 +261,6 @@ static void tap_send(void *opaque) =20 while (true) { uint8_t *buf =3D s->buf; - uint8_t min_pkt[ETH_ZLEN]; - size_t min_pktsz =3D sizeof(min_pkt); =20 size =3D tap_read_packet(s->fd, s->buf, sizeof(s->buf)); if (size <=3D 0) { @@ -279,13 +277,6 @@ static void tap_send(void *opaque) size -=3D s->host_vnet_hdr_len; } =20 - if (net_peer_needs_padding(&s->nc)) { - if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) { - buf =3D min_pkt; - size =3D min_pktsz; - } - } - size =3D qemu_send_packet_async(&s->nc, buf, size, tap_send_comple= ted); if (size =3D=3D 0) { tap_read_poll(s, false); diff --git a/net/vmnet-common.m b/net/vmnet-common.m index ab33ce2b0c2..4dfc8abbc15 100644 --- a/net/vmnet-common.m +++ b/net/vmnet-common.m @@ -150,23 +150,12 @@ static void vmnet_write_packets_to_qemu(VmnetState *s) { uint8_t *pkt; size_t pktsz; - uint8_t min_pkt[ETH_ZLEN]; - size_t min_pktsz; ssize_t size; =20 while (s->packets_send_current_pos < s->packets_send_end_pos) { pkt =3D s->iov_buf[s->packets_send_current_pos].iov_base; pktsz =3D s->packets_buf[s->packets_send_current_pos].vm_pkt_size; =20 - if (net_peer_needs_padding(&s->nc)) { - min_pktsz =3D sizeof(min_pkt); - - if (eth_pad_short_frame(min_pkt, &min_pktsz, pkt, pktsz)) { - pkt =3D min_pkt; - pktsz =3D min_pktsz; - } - } - size =3D qemu_send_packet_async(&s->nc, pkt, pktsz, vmnet_send_completed); =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827675; cv=none; d=zohomail.com; s=zohoarc; b=eN8xr6SXl4OWBUZF0oIG0Ytw08v5Z7rt/a3thHr7Vz/lcLks/5pHqJHHq/ZNcMvIdPP2O781IDUdnVVwsCNfDESj6M+rZ8iIcZx3L2lOrttP5tb9GxofvOuOvGDdG0PLpQxDWI8WlTvcZlCYnw2HYfWkKL1t+t42kLzbU14L9X0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827675; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=lqHPBwg6LCXp8nV/5IqQVT0IUGaBPYvsZU88BJzDtTE=; b=ilzaRi6/Fs/zt+R9F18tcKQ0edTOf0QTjaEbTl1X3dmSs2AFq5GnA1718zn/AQTfifWjO3qsz8qcxFA1/G0h7gn+60nYmPuOqgZ5Iy/le3g+hfmvmAn5reFU1hWz6HEliGRILEpaWtkuAyJKoKwMAbOtYhd4/0suchsIVscVMmI= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827675322902.7189949741542; Mon, 16 Nov 2026 03:14:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSuep-0003xk-Tu; Mon, 16 Nov 2026 06:13:56 -0500 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 1xSuee-0003vs-Kx for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:44 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSueZ-0002DK-Uz for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:44 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-492f0a1b685so2354487f8f.0 for ; Mon, 16 Nov 2026 03:13:35 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827615; x=1795432415; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=lqHPBwg6LCXp8nV/5IqQVT0IUGaBPYvsZU88BJzDtTE=; b=eIZHYdXTwSNhuJ6HDD8HGXbfwyEjExbr/getboERDmR+/ClOCS0olSqw7Wr+CwH7xx In2IeVUvqs2sbi9dGaHYKyMCa0QyxJH8W05+4BY1mgLoE5dVZPWDhcgwECiEY+PE5wKg ZGeCy5PCENLR4gPLCFqfPRgDoeG++ELmLyeD7Ps7yYvMp0ddwGgc0Ndta7T1T/3iIcju Vb/b+aPyis0Yik86KBCUQ21MbUpAHzaq/XOhiQ7RQZd1hecirhvSj6nK5FZPj86fhDCq rgupe2noYm71SE66KuSvB4xE8pzxIaBv0YVnkFrgoFWxLDXD01uTIflKhOhwgkFDS9/s WW4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827615; x=1795432415; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=lqHPBwg6LCXp8nV/5IqQVT0IUGaBPYvsZU88BJzDtTE=; b=25uaRA3jhMB5Oyfq72X2Z582NRFQwgLHAeceNWYYGYmQaFOo+fJLTIi+GezP7EV2HN bUmRCmzlhV9+rw+1z23RFOWB2UYpayLZ1HKnfZLDyGN87+8EwbnqlX/O5bzqtAZs7dJs xzCOy7kmod9NqTIwQnws3aP/9VlxmjbYFh1szSVBj859lAcEF9aym4FvVeheHYVSmU13 Ee/b9t2Qzm6lDLjXpW3DZ3OO58WhKyN/BDHGaH/TFcdfLMW78Ra6DYJmSvI90Z7E0xgT tmvKy+Ge8o/r5mVpWrX2ElS1FKlrZrBOmqRoT4nBl/7ErH/IktIZi5/FMrKAN1JD2kuQ yHuw== X-Gm-Message-State: APuU4Z9j7Oe/r74qRcQjKs1XGXRwz/1iptdN0oAyUhXsrPYohD5ULT15 uQ8I9mmm08BV4LA4y8K1ePxN2tXi75QyOJ0VJX82y2OoSYpxGtw0plqUBJATAbZ3RYipciv4WU9 zpkXGtLY= X-Gm-Gg: AZFdTZeVP4hX/U4Ck+5dBGeHAaui6J6xZvQhfY6FdvdIYgGY7dy0efyOCvNzgOf9uN6 Hg48qNgkVkUXyhft3QKOni/wIzh640KTgHIcXB1vjy7hMxu7Lri7aKLXD6QD9BB5mf0+gUlISr1 hrrZlt5KuGUWdnPobAdy54UDaTwe2IndJRdQXyafVv+fDNXXlot1iXl5A0rJYPqnM/KrLeS6iDM egAzP8rA30mHaTAK+I0/zH4q5TGAJG1sCM3uLvsoJ3LEMBro8bOhhJIc5B+t/nSLKyZTY9T9U2k Kb4VyREstuhHWgfLvpwfdLdpapCAoxAja/WmgIx4xaBclx+eM+S9KnRiNJRPjb9BX70hpWUfdhr MEOroh0oYDV0gD1oPSKDbUtLQ0wxTIYS+f+JuU0lpU3OTamHEMROifz1p2cubMtdV0367uS6W3v 5ETLqTSaupkSOECbpq/8yH9bRw3GKaCcznSyp6DPjtrfkzMitFSZ4U7KglHkFpozMcyYsedl34X b9FMnFTXOQsiD3lKP75abalP+/nKWirvG7jE4MCGOer/tCs9XU+TbVZrvE5f88L3qmCoq+2IUdW t/1K1ku1QvnrTEgt/l5PwYx4DALGzfs/zBNX5O6XjKXbGsXpJLwufHCYq38DAzi+HObOKBthxdN S9Kf1ZRZ92ljxlkrO1C7yWRaKmD5+7UZ6Pg== X-Received: by 2002:a05:6000:2888:b0:493:d5f0:4e68 with SMTP id ffacd0b85a97d-49c72307130mr23606735f8f.36.1794827614728; Mon, 16 Nov 2026 03:13:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/33] hw/net/eepro100: fix use-after-free on reset after hot-unplug Date: Mon, 16 Nov 2026 11:12:57 +0000 Message-ID: <20261116111303.1692832-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827676023158501 Content-Type: text/plain; charset="utf-8" From: Stefan Weil e100_nic_realize() registers a system reset handler via qemu_register_reset(nic_reset, s), but pci_nic_uninit() never unregisters it. After the device is hot-unplugged, the LegacyReset object stored in the root reset container still holds the raw pointer to the freed EEPRO100State, so the next system reset invokes nic_reset() on freed memory. Instead, define a reset phase on the device itself: assign phases.hold in eepro100_class_init() to a wrapper around nic_reset(). The device is already part of the resettable tree via its parent bus (TYPE_DEVICE implements the Resettable interface), so no explicit registration is needed, and the reset state is automatically dropped when the device is unplugged. This follows the approach used by the e1000, e1000e and igb emulations. Reported-by: Hui Peng Reported-by: MyeonghunPak Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Message-id: 20261103215430.703404-1-sw@weilnetz.de Suggested-by: Peter Maydell Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4058 Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4510 Signed-off-by: Stefan Weil Signed-off-by: Peter Maydell --- hw/net/eepro100.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index aaa3eb60f8a..8fe7f31bd2f 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -617,6 +617,13 @@ static void nic_reset(void *opaque) nic_selective_reset(s); } =20 +static void eepro100_reset_hold(Object *obj, ResetType type) +{ + EEPRO100State *s =3D DO_UPCAST(EEPRO100State, dev, PCI_DEVICE(obj)); + + nic_reset(s); +} + #if defined(DEBUG_EEPRO100) static const char * const e100_reg[PCI_IO_SIZE / 4] =3D { "Command/Status", @@ -1871,8 +1878,6 @@ static void e100_nic_realize(PCIDevice *pci_dev, Erro= r **errp) qemu_macaddr_default_if_unset(&s->conf.macaddr); logout("macaddr: %s\n", nic_dump(&s->conf.macaddr.a[0], 6)); =20 - nic_reset(s); - s->nic =3D qemu_new_nic(&net_eepro100_info, &s->conf, object_get_typename(OBJECT(pci_dev)), pci_dev->qdev.id, @@ -1881,8 +1886,6 @@ static void e100_nic_realize(PCIDevice *pci_dev, Erro= r **errp) qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); TRACE(OTHER, logout("%s\n", qemu_get_queue(s->nic)->info_str)); =20 - qemu_register_reset(nic_reset, s); - s->vmstate =3D g_memdup(&vmstate_eepro100, sizeof(vmstate_eepro100)); s->vmstate->name =3D qemu_get_queue(s->nic)->model; vmstate_register_any(VMSTATE_IF(&pci_dev->qdev), s->vmstate, s); @@ -2064,6 +2067,7 @@ static void eepro100_class_init(ObjectClass *klass, c= onst void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); E100PCIDeviceInfo *info; =20 info =3D eepro100_get_class_by_name(object_class_get_name(klass)); @@ -2080,6 +2084,7 @@ static void eepro100_class_init(ObjectClass *klass, c= onst void *data) k->revision =3D info->revision; k->subsystem_vendor_id =3D info->subsystem_vendor_id; k->subsystem_id =3D info->subsystem_id; + rc->phases.hold =3D eepro100_reset_hold; } =20 static void eepro100_register_types(void) --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827955; cv=none; d=zohomail.com; s=zohoarc; b=k92fZN7+vMXjDsb3zMSmNHrUK2XG03nx6mwleX10t2v0KUIibg/5nVBvcVaUEmJylqvluxcoOWw59D4/TQCYdvtizNTNLVpbt4cxXBFHp/S9rHCOifRXPE5zhKk/8N3sHuuNdhjZBqZqCSLk+5J5+VvhdK7EzUvdd+Zlh3xr8bA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827955; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=U2TJBdmaT9802sOwSLNMILIxCRxhEyMKotbJLoaw8xo=; b=bczCCXBibo/boXInUKPnejApMA0WWgncCs3k5UFGoiy7gXF59n/TsHgB3PV3uNkG/V4CsLrwEfWDermtZ9vf5BoAdo46r5yyJAde1tHAc7VC5JC66VSX5lF8jSvOfSz8Ns9Lt4+mmmjUpIL0lWkgMCJXtBs5E2s+tEFG8KI8p3s= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827955736986.3591995678595; Mon, 16 Nov 2026 03:19:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSugQ-000611-7W; Mon, 16 Nov 2026 06:15:36 -0500 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 1xSueg-0003wQ-0b for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:46 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSuec-0002DW-Te for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:45 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-48dfc0421d9so2971836f8f.1 for ; Mon, 16 Nov 2026 03:13:37 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827616; x=1795432416; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=U2TJBdmaT9802sOwSLNMILIxCRxhEyMKotbJLoaw8xo=; b=qL5Q/PpSRskrwlyxRXSU6xm1XrQCdrWtQYrRQpspZiLlqqic810je2ootepU4G6WpP tzKpA7wPFnr5ei3VkMAm9p+g+mXaoQDhKupgK0XAVyZVq/o/H6WeyXQ+Qesjk7e0dJDo /VC5Gq1+iuf748XtJF822xZLyfVmgKijCjuiPaLvI5tuMfH88oI9iD3KW41F2erRQzQO fpZmZfHOCqkqS7tJm4EWRYK/hMYN30c2Tl3n3/hFfbXTJ9nwREvFIYHCdUL/vfml3kwg JyXeJTUdB949snc0+o08WR1UmPJMtzFOU/Hno3viNa8Lo6Cm+GhL35yjGQeeisU3BSD7 XcpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827616; x=1795432416; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=U2TJBdmaT9802sOwSLNMILIxCRxhEyMKotbJLoaw8xo=; b=fFmZmUfdSBRwCasK1RSMi/p8MH5lfewQZZLbyJ0YD/R8AmE+gZU1Uek1LQWa01vRqf J44MUp+KFismDVBlY47u8aL/bEFeWr96h1pNhD4YSQ9XscK9tbSRQKlp2FXV74UOpn9v kfzE+LsMQeCOMAJcgZamSAMp82adbX3ISKDqXMsUI5xFpjaDnjrzAf3HfUL/C6r3o5n0 WkAobvCcVPJQJxCx1KSQdKMassMS5IiUoRr4jJTMv1wj3Oj3p7ioyV8YUYbLi/JtQ2Eq gJCT+gKBJHprYNHB2/VcDp/F1mZFCHMyvwUILkuATS1N25a3Rb7yhkwKAhRa07fRq3qT NEBQ== X-Gm-Message-State: APuU4Z+fpz4fgr80uNGj0Mp0cqcZokxsyUsrq/IRDs4/dx9osZVsoTFL 3Jh9Y3u2Rn7b054BBZKSJZAr4EOasALwkzDs99gUDCiqGC1A4gw08mv0InojX5+psjMPv9QsKtT HvHFbYh4= X-Gm-Gg: AZFdTZe/0uMrv2hh2a+PTnicTHVfnoNG5KOGrZLuIpHdb7YxwJxJplsx3dcCMbKk9IH YyAIaVtIZD9IyMtM0N2OBngv6Jf8R25krn7D9aet7ddDvJ0JwlXLyMpyX9iw2JqoM2CLEZGTezn b8K2lObLOAb83qaMwWCgL/XZpaab1KjH5Cmn5QdSzQv/cBUT6WiU3MaavL3j16cYek8Tud1jqjY n+c793C7CiHFLURv+Nm4OXxoYT34PSeU6Q2BJGJOOiqkdblq1sjEcnKc2a9AWy3RjCfiWUHFqH4 BWPyElEjGK7m523tW1NuWtWK6Kf/wRxrYFPHbffoz6hzWj3Hz4PyFuxbJaa0HyGlIQZPb60hVkL 1UFxDf0q3AAYwqULghfUzCgeR/9k5r0krOEFdy1RWemvN3KN0zSaBPNdWgpcE9onWtoT9OTxV2t ZQhjNhSsDRbNZLlh55lDcMrr+80PmEJ2Wg2HUdVH4mRvm/FnhGbhuV/ZSKYoIQ1rW5OsenjC5Bo fNccJQMH6x/DmdKCGqkSSKQ/VTlf2RhoHlcJaVmAAAFHJKo8p0VFeAe/6xVjc5APyoeLK2YhXMs LzFCwIASbRGzW9ABJB38Fy7kOjGLCKopVMkiX4qwxW+bv4l/eBDN3zqQk0JO4Vp4EwhQr2xTbUK ifUBsIIBQEwqkc3SVNt7rD15c3a/bd7YXrQ== X-Received: by 2002:a05:6000:27db:10b0:49c:9e8a:31ad with SMTP id ffacd0b85a97d-49c9e8a32c3mr15104672f8f.42.1794827616274; Mon, 16 Nov 2026 03:13:36 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/33] hw/arm: Deprecate Nuvoton quanta-gsj board model Date: Mon, 16 Nov 2026 11:12:58 +0000 Message-ID: <20261116111303.1692832-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827956691158500 Content-Type: text/plain; charset="utf-8" The latest OpenBMC release as of June 2026 no longer supports the quanta-gsj board model (as noted in docs/system/arm/nuvoton.rst); support was removed by OpenBMC back in 2023: https://github.com/openbmc/openbmc/commit/ab5062cf6f562ad0c844570ba1ea00899= 61848ca If OpenBMC don't care about this model any more, it's unlikely to have many users. Deprecate it, with the intention of deletion after the usual two-release period. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20261030095731.581512-1-peter.maydell@linaro.org --- docs/about/deprecated.rst | 10 ++++++++++ hw/arm/npcm7xx_boards.c | 1 + 2 files changed, 11 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 0891bbc44de..de7d502babb 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -287,6 +287,16 @@ The machine never got fully implemented and can only s= how the firmware prompt. Given the incomplete state and slow progress on improvements, it might get removed again without replacement. =20 +``quanta-gsj`` Arm machine (since 11.2) +''''''''''''''''''''''''''''''''''''''' + +The ``quanta-gsj`` machine models a system with a Nuvoton SoC +intended for use as a baseband management controller in a server. +Support for this machine type was dropped from the OpenBMC project +in 2023. If OpenBMC no longer care about this hardware, the QEMU +model is unlikely to have many users, so we are deprecating it. +Users should consider one of the other Nuvoton-based board models. + =20 Backend options --------------- diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 9c526a26839..ec4b530986b 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -496,6 +496,7 @@ static void gsj_machine_class_init(ObjectClass *oc, con= st void *data) mc->init =3D quanta_gsj_init; mc->auto_create_sdcard =3D true; mc->default_ram_size =3D 512 * MiB; + mc->deprecation_reason =3D "No longer supported by OpenBMC"; }; =20 static void gbs_bmc_machine_class_init(ObjectClass *oc, const void *data) --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827820; cv=none; d=zohomail.com; s=zohoarc; b=ETpHfhoppNnBX+fuyPADvYtEoXdaElpP/Ag/hkZGBFWFiYalvd0lz07dpJzjZb466wNa8x7IYUcrM+CW4NQHRowNszOcYwztIwAQLQxF5FWBfLgpFt7wCJc0gi+K9yg2OFjrVMuvshJqf8O3eh3ODwqYuXFjg1Ei8Agd+fiU7J8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827820; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=3oLvKLNFfyQdIc5Ssx0Wha578zuNyp8H42uMNEjgyog=; b=MTC18swU43Qf/yow2gfIs91mx+JcBiMrMPlC1MzNTpyq7HAhpqjX3hCK/vLF9p9zfN33JW6SeOVbBjwK/oycpxyhGJtVqos+rzUdQs577e4qttXEdshx1u08N3ljUvz0MEd44ar+wq1XW0gMlLGpCnt+sqhW4VG2bPZwWn6xPHI= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827820529961.0593097384286; Mon, 16 Nov 2026 03:17:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufo-0004gS-0p; Mon, 16 Nov 2026 06:14:56 -0500 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 1xSuee-0003vk-GR for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:44 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSuec-0002De-SS for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:44 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4a1fbd52ab6so26119425e9.0 for ; Mon, 16 Nov 2026 03:13:38 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827617; x=1795432417; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3oLvKLNFfyQdIc5Ssx0Wha578zuNyp8H42uMNEjgyog=; b=lA1mwQBr3ovd9N+00SnHhixEhl0F7Zhxp7fJLqsWWHmDcISxIu2okTYvoQTuqlq6yj O7655KTPnq19lIErAMc/Lflj2Sv1xst50dnSS/xxEGOGfq7MvgwCRNLr5ipmzpbEs833 Ypnr+M1C4VT1Nn+PcvIxSyJ3F/qsixjWWHIgM4fMUXbbPg2rE6dblA5uxlJa3S+5dIXD BDLautNBl/LIa5PHXxQXxRxtr18wCFP8Fkh452U0erAFzcqVYVx7Q67jS6srid//EFj7 aKa0LGzsWp2msbYmRHjdGxhH9fasBYPM4OtNqKgAWU2XedbHJmntIwuGkkiY0wNKHbk8 Kjww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827617; x=1795432417; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3oLvKLNFfyQdIc5Ssx0Wha578zuNyp8H42uMNEjgyog=; b=JTT4lMFmGzOUa0/4Jn12BG9U6Fiy4vGGyUuWocay39V9jJHYm4X50J7Yp+ihqaHYal Wo0OHnmUAnZVWFTQW4RRjY7FNZl5FkMDmjEMfnUE1LGHdSa1mHUUkW3qrXVhE5ryKtq3 tpVba14fI3J+ZV0x32+Myez5tDsm4CmaclS54BRkLGovEQuo/ddQ/MhZ1TZnzxrKYbw1 mAoVpA28LJuXTF/N3ZsgOmBqpx8/Q2wMDPw5lEJBT2hYWPAnXolq4ayUlqSc+/thPf+E zujFKxxf0PY96zEl7Ub+UodDhrZkHciQvneqaDvkqGgGMld/CkHpF8J/SPzl5zeLNZzp 9aVQ== X-Gm-Message-State: APuU4Z+pYTHsD/lzZGk+YHKwQ/S4qekwbYQ4fLLGPDCpUdU9CW+9/HtI m9ev3jgiCuzgUFqVq2nT1UATLpP4yq/8zB4E43GYO0iXKWvKw/J5WNgE7f3WkCSARtv1pOr33QQ l0YOLhbg= X-Gm-Gg: AYBFou3Ii9dfcUuXLchrvS+0MA7qe0Sry7qJUBOYjyhqo4ViWPfnywp4+tsmwk+oYuw lr1SyDNggeFumCqK3KfaJZ2Aj2Gtd8DKEcUB4S0XLGAsG4lAjeTsiFNeXrsVa9nM1X5aGsBCgGD 6FFx5zMEL8B0YMRAvUsh4zDsEG6+DSUmqWdCjXU8x1n+Wr4ixzhYrXgRHhMQNphJBnSpjCELu3e 2QUub/m8dOMP9nuaPFNg9HJyq3WaaIy5e/QECyDv7mZwE65WQZZwC6NaCcoPPAzkssVR0N3k9gW hc1SnNmGemZLB8kt7eW7bIk9QdAERHIOSoUPtCPHP9CYSUCyC4NfFBLmYlC+NopjwxFl+8FLyXx hfcNUXdiDvWUEKhHcq3Htf/2M/zQpQVNUcxgzXP3YMnYtNetzr89DFIDk9wIiKychx/h3VtRpeZ Ty3QtzDoF2TlZQBIA6iNTBnkr/HdEZA05bwdQ0ZJZzyUBpwyZdYyEh+Kg31DH174FBxGskASR26 3mYUAGt+HRXH9+Kse3TD/M0JDZ7UXUxqlNVNuZO0vmFWCvruhxON9MTlgIrr6NoDWLvDj4Egn76 m/xvVF5kn/Rpa6+aq5v0a6ayixldXPxsuoU0igguaHx5YarkK4jmf0E2PFs2UdFJmj/Rq3QlRqH cyvhEsI6O8LBwbPUaK4mdfeZrkzZueaoPbA== X-Received: by 2002:a05:600c:4e8c:b0:4bb:60ba:49e0 with SMTP id 5b1f17b1804b1-4bb60ba4a70mr144443695e9.26.1794827617567; Mon, 16 Nov 2026 03:13:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/33] Revert ".dir-locals: include QEMU code in PYTHONPATH" Date: Mon, 16 Nov 2026 11:12:59 +0000 Message-ID: <20261116111303.1692832-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827821364158500 From: Alex Benn=C3=A9e Unfortunately this relied on trusting the source tree via the safe-local-variable-directories otherwise users keep being prompted that ".dir-locals.el contains values that may not be safe". An alternative is for the user to add something like this to their local emacs config: (defun my-return-source-if-in-qemu-tree() "Return the root of source when in QEMU code." (when-let ((src (expand-file-name (locate-dominating-file default-direc= tory ".git")))) (if (file-exists-p (concat src "/qemu-options.hx")) src))) (defun my-set-qemu-python-path() "Set local python environment for QEMU." (when-let ((root (my-return-source-if-in-qemu-tree))) (setq-local process-environment (copy-sequence process-environment)) (setenv "PYTHONPATH" (concat (expand-file-name "python" root) ":" (expand-file-name "tests/functional" roo= t))))) (use-package python :hook ((python-mode python-ts-mode) . my-set-qemu-python-path)) This reverts commit 3112269be3ac92343a5f0e5d9eae919edd176a35. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell Message-id: 20261113004452.3027978-1-alex.bennee@linaro.org Signed-off-by: Peter Maydell --- .dir-locals.el | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index 51871619422..3ac0cfc6f0d 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,8 +1,2 @@ ((c-mode . ((c-file-style . "stroustrup") - (indent-tabs-mode . nil))) - (python-mode . - ((eval . (when-let* ((root (locate-dominating-file default-d= irectory ".dir-locals.el"))) - (setq-local process-environment (copy-sequence pr= ocess-environment)) - (setenv "PYTHONPATH" - (concat (expand-file-name "python" root) = ":" - (expand-file-name "tests/function= al" root)))))))) + (indent-tabs-mode . nil)))) --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827714; cv=none; d=zohomail.com; s=zohoarc; b=TAw6jLhxjFUzKv2CANr6QwDL2mboax2zw5xA7if+r+NwrqP2sAAIOwiywmWrfojeerHX6G+CfcGsUmmxzYOVTN30cXHouK+HMWw+gBRSgB3pcqcZYS55qe6M8PQ+Vp8tkCILS3naoRe7vEfQ6nXKfBBC7epsHA1ZMuPRQSnzoP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827714; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=zOcK/FpIa2soozQBIj8qTA+KfQuG2+4S2+axJptJAD4=; b=TQirNKlmhOTUIY8O1kwntPkausSP+VhQrNLRoYOH/aOjKmgfzxosXWs6WBngPN1z9g6w1MEG+I5khUUHzUF19jSEkbvAHz7lPYshdewzc7P0u3/ttAul35o6wBPJg45TPlVL4oghNQBXv732/9KGUahX/qS6lGrS9Os3ztXMAYY= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827714628703.8710068309241; Mon, 16 Nov 2026 03:15:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufi-0004UJ-CH; Mon, 16 Nov 2026 06:14:52 -0500 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 1xSuef-0003wE-Np for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:45 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSuec-0002Dj-TC for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:45 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4a1b07c3c5fso37332985e9.1 for ; Mon, 16 Nov 2026 03:13:39 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827619; x=1795432419; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=zOcK/FpIa2soozQBIj8qTA+KfQuG2+4S2+axJptJAD4=; b=spH6fKGqJ2z8jD+/2Xp55le0J2AAJ+uQXE6FkIhwDWeWoHoEn3ex3yuIzLI7u1f4cp jfkEQREeAgbASX+0DHR9uqMcM7BRYKne117cpi5p79KzGfZaKTtVvjDAN7UzY3+O7XMA eL0I3iOVZg3EWQjP+e7+djMgK6hjMvmR8iE4UVs+Uh7Af9XEgbWG3nwlGmH/JbHUvEJi HN6xIkGmKofQ8lorSI9InzfGqYTpccWMY58+aaULHwfJpQkl34Ltg385Fkv0vhhW9Cds Z9Yqs8KUOouEzWsykKqIKR7VVnSAYMsOoqeBIWP+mCygNwSry9q98dbnsc//pIdXzCHU OUkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827619; x=1795432419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=zOcK/FpIa2soozQBIj8qTA+KfQuG2+4S2+axJptJAD4=; b=20ZEHxrxh3E0NJ8s7e3wymWmB4jP2I+RwJdLYsOlZXLe+ODGqucfsv9S+mITkvgOiY hmQ+OrZOE0Abuj0XLPDrICiOYT8Cj/uzgpmQoBLMTCnY7NYnYYBqPzdaGjS0QFvCeAPn UH4JASbAjSq+DTdBeVQf2ozQEiPfBWiMh4EWydS0evVF45ZrCFiIMtdJxI5e5PrXjmZ2 F/BxFhFlgoFWMPCLOyo/LKh9H+Wff+5WU/9whoQe2JGMIYoBrJPixD72KqkStYO+kV1s 1Iqmlm43prWVm/wSsm8xT6qeSPZrdFobVTmx+pqUF7WbAFPB1dZJIkf1jtygvVLyR2zA 2khg== X-Gm-Message-State: APuU4Z8Ku7Gyt+2oXX4eCPWrb2Djn71C6Cg+jJUskj8g4ydLADE9dAVP 8I2xmqh4/Q23u/GQu0DCXSBlK9TxIKbApDCK+CqSVR1VeRD98edcL8c062rRbW8Fg0lJ7qBScT+ S/qX7N2o= X-Gm-Gg: AYBFou3WqQWalJcleMDID/yCO3zAX7R+A1AdD/Jtypui+XGL8RC+ICES1xqctQ4KCB7 4gwNXzYHMkgJyjBK+X9QRixjJ5Q+WUCWIJscvzlm6yo3V474J8rP/n9IcppCK5gW9USiGFEDfe9 hf4ti1rFATl7ygSikuIT+sRytz8ZWbDY9rldtKi45Pqx+LvAFofakU8Jg89bCliQ4U78dxKA5PX 1HqlSb88M0UvAVYTqXP40Q4T7GjS7tZx56pFSmPxNpsR8KkD8mOMbE6T9d+XQIMrrxXErFmtswz pbPW/DS3IeT3scBHQ0lLuDoo2z2OpDmz1YolHh+hHq9wJC2KS7qqWAzaEX+V++umvVGKTNg8+id qC0rXkdEEXcwtTuqlGA2FV8bJOLJtlUQ71k0G7SGeXpN5+mNRB+PnAgRSQ0JXbcZ5GfAjrsflsz GidC1/Ac+X/ArRyi2mRx/NWlDpjmEGZBEVU4hvxl2tBr5PDfqVIgHP4hNB0a61vq+nBqkVCpAwm EpisxXFhaRBHFBYJ9mjj3ZqWMTAhaTvVsFJsMN8IjDVAL5bVBzGitBlBj92MxeTzyCWS4/EkPfk pAeelmb5CMmXXW+YQl1LE29hm7vMooOOy0LhBrkCRqCJdQk4gqwByAH0g9PkOKNtO8XDjRLNBS5 c2gnZY+8y6DIvm13dQWKFzRyYTVEaADsB0ms= X-Received: by 2002:a05:600c:8b23:b0:4bb:6f6a:1976 with SMTP id 5b1f17b1804b1-4bb6f6a1e5amr80203685e9.2.1794827618633; Mon, 16 Nov 2026 03:13:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/33] docs/about/deprecated: Add missing "since" marker for OABI/NWFPE Date: Mon, 16 Nov 2026 11:13:00 +0000 Message-ID: <20261116111303.1692832-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827716315158500 Content-Type: text/plain; charset="utf-8" In 750c2d53ee4 we deprecated our linux-user support for the Arm OABI and NWFPE emulation; however we forgot to mark the text in deprecated.rst with the usual indication of what version it was deprecated in. We announced the deprecation of this feature in the 11.0 release, so note that. Cc: qemu-stable@nongnu.org Fixes: 750c2d53ee48f1e ("docs: Deprecate Arm OABI and NWFPE support") Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier Message-id: 20261112093824.2281467-2-peter.maydell@linaro.org --- docs/about/deprecated.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index de7d502babb..4188445ed45 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -451,8 +451,8 @@ across versions). linux-user mode CPUs -------------------- =20 -OABI and NWFPE support for Arm CPUs -''''''''''''''''''''''''''''''''''' +OABI and NWFPE support for Arm CPUs (since 11.0) +'''''''''''''''''''''''''''''''''''''''''''''''' =20 Linux for 32-bit Arm has had two major ABIs: the original OABI and the more modern EABI. OABI support was marked as obsolete in GCC 4.7 and --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827700; cv=none; d=zohomail.com; s=zohoarc; b=V2tWr33KuzPz/GJftC88m8+H+L42QV5c9kHUcbRAbfPNEFKiUKb6Njdw5OzoA5mGwxyeDkl3aq2vM5xzArtnI9yw/SidePSxMHi/2LZTvKsohR64pxG7osMQkEFjmtgkYTm5XxrNccv4f74x6W/nqKKQO9neTV7YXpGHgXQnnrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827700; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=ZeIoUKJuIFtwvLGxQyj4VF/I9F4rg7HdJbidZ6Y8hPM=; b=Lsm2TWGDO6Xn1vSe2vJAt43QCa/0ibfiTeJIc3cbMtMWI2l8VDimII66/aRNg8AEUQ0SxpFJcFaMCAdBLhN6yi6L7RO6/+h1DUR47MOmq+DBkNtucPkYGow2vYARIYaWBxyGvqlnqkyAYYuiS66Y4W6w6nwVe84tZQ4ZyJ3vdQQ= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827700040223.10886011041862; Mon, 16 Nov 2026 03:15:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSuev-0003yd-CX; Mon, 16 Nov 2026 06:14:01 -0500 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 1xSuef-0003wI-SG for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:45 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSuec-0002Dq-Uk for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:45 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-49d05d51553so18071755e9.2 for ; Mon, 16 Nov 2026 03:13:40 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827620; x=1795432420; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=ZeIoUKJuIFtwvLGxQyj4VF/I9F4rg7HdJbidZ6Y8hPM=; b=OrDVLv9x0J3PUSJZV1cqjGr1TmGtOtYAVBqcuf02VnKf9tgWiSt7TPjRvsvLQUQXC0 pDjTSZ4HOWsOrtMJJ/ZJoDkx/UcBUUmw06ILtkTZw/ePELc8NZOljxYi5n/j/O3aaV/2 8Z8Ja5KPqjIUZNH9jgkZ2EO7T7Mi2L4bJ644xY+I7gqpWCRVIavVbslUG6Wi6V6iVQAg sBFIUGPeJOlDHf9ABIe661THhM5h8Qz1V3amj63T/UEoA2E+EmUFJEsb95LD9dPrqXnD +tEyoSuNWH1jzpP/rjsnoTkPhy6sp4BCjlfY73vFXp/q1Cj39/4p0KUFd/9isn6vJuMO fqyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827620; x=1795432420; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=ZeIoUKJuIFtwvLGxQyj4VF/I9F4rg7HdJbidZ6Y8hPM=; b=dh+HjS8VACDJTkkQdMIl78oBPp7KRO369ZiOLZDaxHHlt8ZJGnCqC/pK10T/6BzIEV koKpfQgMZysjDRsrAYXwkhPOhtWZhIYvtbgKQUoKa2wlIGo+dzmVK/8etVxnYq+TBD3A LxIWg46pZZqMwiDUDd091gEAnna+jh/d7qJev+GIJkKlE95hXQOpwy5FCM/Wnwj36skx S4Q3mnuImvB/2kVFlkD+jSCEvpwgYn+0eWKrgD8xZDLy1GNCaDP+6Q63avc7TuBduGqZ FkN6rz2TqV0adZkULUFrtklRyzZi2hVF63izblJSc9VaJnM3l1MuoXxI4MbyyPsKfaIY Yl6Q== X-Gm-Message-State: APuU4Z9Tb6BtVpbBQ+/a4MEhUl4Uj1hz9g48ILiHlC/NglMDAjC5KsoU izyRIphZzDjGz8ri3zFFjlElNsgqa4JfrkXuZm0JsIM9nHAc8aqcPr478if7aVuDVkMx7FmY+OZ +hVH9vrs= X-Gm-Gg: AYBFou3AtoqNOUTgmlLNd4Xrja3WgY+eJw1oYQeE13f6u8oPd2gZMSKAgHS/42WuucY rncU/ss29SqdzZX44flXgSkTEp7ADsxKZDylA7ogTTkR4OYotw9GgDT4J9aRoysNd7UX1zjINPS 27rQgn2/LXcsepx/4QYT6GVVV0BkK3Pd5X2GD98C6q3wtNeyqLb03hrLBrPgZiv8+cfP8po4Uku 9/85jWGTVIbVMrpR42un/uuBpoyfL0TQ/zKRm3mceAJWVn2jExs0dKVoqztkNec5fE1H47Hx7CZ YhUGx1AlByfSBGc8FfoPNnwPnXl+gFJCOpE4SOexr+GqvWnJ0bUHRK/Xgzgy7/n8aKNhGQwRwP5 bNq2UVr68Loye9J2zk/SThkDAhnGl/X9RifZT4gr40NmgRPBn5y0dNvbZ0HN+M4ePT7BKLgpkhG 51XRYluQRYKYOxfDlJ7XsWNhi/Q9uEAN3z5frN30rLNVnJQJ+Uo7nH5Lt7ZHEVuU06ivzoRmn5x DOOc3+D+O9ORobHTGW+CM2y79jaxgXnC6ViWPsXSuc7co+pIv8JMQdbrVJXxt7xbEGMx7X6JCe4 57xBuhQoPexYb0BVByZofmPht9a4Jc6NQNvKRqLOb2wnfToA4mPI69dnYfwcwLbtah/jqrXs0Kk 3vrNKVqrS1BZdu6/9dAXNHkzgKf99UUuKRw== X-Received: by 2002:a05:600c:4e12:b0:4bb:69b2:d3b3 with SMTP id 5b1f17b1804b1-4bb69b2da58mr99771245e9.27.1794827619754; Mon, 16 Nov 2026 03:13:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/33] docs/about/deprecated: Fix heading level for AF_ALG heading Date: Mon, 16 Nov 2026 11:13:01 +0000 Message-ID: <20261116111303.1692832-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827702198158501 Content-Type: text/plain; charset="utf-8" rST heading levels are marked by using different underline levels. In commit 00e70abb8500a979 we added what was intended to be a new section "Build features" with one sub-section "Crypto AF_ALG backend", but because the same underline character is used in both cases they ended up both as sections at the same level. Fix the underline for the AF_ALG heading. Fixes: 00e70abb8500a9 ("crypto: deprecate the AF_ALG crypto backend") Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier Message-id: 20261112093824.2281467-3-peter.maydell@linaro.org --- docs/about/deprecated.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 4188445ed45..3362dbf0acd 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -476,7 +476,7 @@ Build features -------------- =20 Crypto AF_ALG backend (since 11.2) ----------------------------------- +'''''''''''''''''''''''''''''''''' =20 The use of the AF_ALG backend for cryptography has been deprecated with no replacement. --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827735; cv=none; d=zohomail.com; s=zohoarc; b=Gapi8rGZw1K92MGmN4mZutX8hH9wIMShX4adXh3WUDu50gYDUWSiebPsdDXqM3Qq/z9uUEdlAwKJtaOJyCCzBmvjcedxX0sysWJFAv8bhRq+g+fuV3H1lLzKnebHnTsfM/Lh4ICj89T9KHjUpmmCwagNTNMHWCxr4eEaQ8dEAzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827735; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=adxIr/XFyHr4P8yYnBX6Rcv9bXNf1Ug2i/vRC0a93N8=; b=IXSCIzT+bTBjNua/knruon421bWrhu00puA8JDMwLRU5FZK0wmwYhGavFVfrZHoy3Pd1Cvn+dymHiC9wYSn3cRVORR2aZ2M5Jg3TCIjkOgjEAAKZWr5FVP/f8QPygG7YGTtLMh19JvEtdH2AcO5IsLsQ66F9BuqNjEaUPEfcjpQ= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179482773574013.676179751854875; Mon, 16 Nov 2026 03:15:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSufe-0004QN-C9; Mon, 16 Nov 2026 06:14:46 -0500 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 1xSueg-0003wg-7S for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:46 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSuec-0002Dy-Uq for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:45 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-48e10a70540so1791370f8f.1 for ; Mon, 16 Nov 2026 03:13:42 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827621; x=1795432421; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=adxIr/XFyHr4P8yYnBX6Rcv9bXNf1Ug2i/vRC0a93N8=; b=i7CdxeNSfktXkNIQjlQu5mi1EOXFTCaUvpH2C84tejRGkQknjBRE1m/paX5lDKTnV0 LNf/7WYe7KKgeyAQoc3DyblKAkoFO7PfuHjzi7mYu6DEOwKwNxC7Yi2fhP7+Wxi1NtfE YJuXbK/bWHkJeMbbj3+aYToqmiPF0ZWMmi3sougY03B5iw8QKun+w1smlhqP6MOVlayi rQUpLzIboaZxz0wQNUOIA4j688pbhxA8cb819uFJqoGGyqaKfKJ8wuGVMml1Nn3ej+Kl nDH0MvecinO4SM0u8s17wTUFmihnEOvWP5NX3hAsF8QnzjUhK5LySYS+ohmL2rUWxSkK m0ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827621; x=1795432421; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=adxIr/XFyHr4P8yYnBX6Rcv9bXNf1Ug2i/vRC0a93N8=; b=AhU6n/7/YcbYO/A7noJ2BnU/769CAMqj8EGaAwGawh61F/sJkUJtK0Vjrvf7KSlo9r EXOIe8/rGGeU7/OOOztheQP7vlc8v5mN8Vwr9x9nzSrxI1ixiMguIU+YC8s6Y8HqSf43 L2ABiHM3MIe9oDs/beLT6sE197BsHW9Ki3dSUB2bDgbxoHNovCRIDD1RghNd/RfJz+kk 3FbrUodLur9aruADALh+xwqaqFiRgKGtfEQRFV0QSkq2i0cJpQHDc3RuTaeIREEVNoIa DjTaWsk7W1w08645Z7GGDSQOk7RjZEBa5/G0B0qnN5BF4fn0nDh9EUu/YRF/TWNcZkbX VRsA== X-Gm-Message-State: APuU4Z++0a0xwy8tn0kt2wHDbI23L33Nj9XFaFDQt1jMQM4EMM9tvjiR WEfPi431gxTUWZtkZ0pBhk6KkK7q7gMhsDQ5eqglbDm2/kNe1Ov6RCYmEZHllyEMk4+AZfz6eIo L9gIIUUM= X-Gm-Gg: AZFdTZdMzUn7Vs7ASGkvszer0+d+LkFnSx/faba0ydNCCpDYeu7BpF1GVhFzEzaIorz NofFqMWHy4UMUDGVHJINixOvo+rw5LXqh26CHQa0CRliZQ0/1ZxYTGoXs+6RSCHMuAqQA7eEHUV UrzGypYQJq+JWu945+NpOPCthA2eUQ+iAkNJEYdTZSXT3ywRqKry1R/RIClq+uM6G4R4HCLNN7g 8a8dmJHPw/xFjNTh0yDxLtQHfsgvasAwKcF7Qxker0MRm2O3ixaPRT8iXUvSdw4qvEN71glzFYq fLNz9ngINgGKd/Zq3D5eHNsyLwqBXkLlb/Xtl5CluACmJdVw3FmlrskXYRGILhLV8jFph4Rci9Z OJ8mSkSmIE4EEOOKpVNrXhLdUX4cuZJI/JdPVFS6eyiHxUI1NnKQLemAS1GDsMMBRPI6nbDdmHS 4ikQs9kMlagCH2EuoVypEPNb4ekCiWqnC8iMAGNZ/HkNva9U52qCqXyPEbHsw7qpmBxriXtDsx0 8dtqKcl2ZSaqhupz/8FYrPvrN2JQw765K5aHAVlaMdl2iLW9V3bG9kgwcEJ95innN2cnrz5bla5 deRCttVnAY2xtdK62mAx5HOfDwmWiMDtPJi/Qu7ZYePlnMPpEjNWund8C+sUci9JN0LX62Mo06p Z7+8qm+zJYnByijOCAOgiOBu8XCpeEW4+3JXjHupRK3N1SK4ACulWvHU= X-Received: by 2002:a05:6000:480c:b0:491:45bc:d691 with SMTP id ffacd0b85a97d-49c6fc9e626mr20756606f8f.2.1794827620996; Mon, 16 Nov 2026 03:13:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/33] hw/net: cadence: Honor subword lanes in the GEM registers Date: Mon, 16 Nov 2026 11:13:02 +0000 Message-ID: <20261116111303.1692832-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827736609158500 From: Bin Meng The GEM MMIO callbacks ignored the low address bits and access size. Byte reads therefore always returned lane zero, causing guest driver that reads the station address byte by byte to turn four unique MAC addresses into the same value. Partial writes had the corresponding lane-selection problem. Extract the requested little-endian read lane and merge partial writes with the current register value. Preserve the existing read-clear and write-clear behavior and dynamic queue pointer readback. With this change, reset the TX queue pointers only when a write covers TX-enable and leaves it clear, and only start a PHY operation when a write covers the OP/ST fields in the PHY maintenance register. Fixes: e9f186e514a7 ("cadence_gem: initial version of device model") Signed-off-by: Bin Meng Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20261109143410.3279305-1-bin.meng@processmission.com Signed-off-by: Peter Maydell --- hw/net/cadence_gem.c | 55 +++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index 9a94b3b8ca4..7456f0e18e7 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -1603,8 +1603,11 @@ static uint64_t gem_read(void *opaque, hwaddr offset= , unsigned size) { CadenceGEMState *s; uint32_t retval; + unsigned shift; + s =3D opaque; =20 + shift =3D (offset & 3) * 8; offset >>=3D 2; retval =3D s->regs[offset]; =20 @@ -1638,7 +1641,7 @@ static uint64_t gem_read(void *opaque, hwaddr offset,= unsigned size) =20 DB_PRINT("0x%08x\n", retval); gem_update_int_status(s); - return retval; + return extract32(retval, shift, size * 8); } =20 /* @@ -1649,35 +1652,43 @@ static void gem_write(void *opaque, hwaddr offset, = uint64_t val, unsigned size) { CadenceGEMState *s =3D (CadenceGEMState *)opaque; - uint32_t readonly; + uint32_t access_mask; + uint32_t writable_mask; + uint32_t write_val; + unsigned shift; int i; =20 DB_PRINT("offset: 0x%04x write: 0x%08x ", (unsigned)offset, (unsigned)= val); + shift =3D (offset & 3) * 8; + access_mask =3D MAKE_64BIT_MASK(shift, size * 8); + write_val =3D (uint32_t)val << shift; offset >>=3D 2; =20 /* Squash bits which are read only in write value */ - val &=3D ~(s->regs_ro[offset]); - /* Preserve (only) bits which are read only and wtc in register */ - readonly =3D s->regs[offset] & (s->regs_ro[offset] | s->regs_w1c[offse= t]); + write_val &=3D ~(s->regs_ro[offset]); =20 - /* Copy register write to backing store */ - s->regs[offset] =3D (val & ~s->regs_w1c[offset]) | readonly; + /* Copy writable bits in the accessed lanes to the backing store */ + writable_mask =3D access_mask & + ~(s->regs_ro[offset] | s->regs_w1c[offset]); + s->regs[offset] =3D (s->regs[offset] & ~writable_mask) | + (write_val & writable_mask); =20 /* do w1c */ - s->regs[offset] &=3D ~(s->regs_w1c[offset] & val); + s->regs[offset] &=3D ~(s->regs_w1c[offset] & write_val); =20 /* Handle register write side effects */ switch (offset) { case R_NWCTRL: - if (FIELD_EX32(val, NWCTRL, ENABLE_RECEIVE)) { + if (FIELD_EX32(write_val, NWCTRL, ENABLE_RECEIVE)) { for (i =3D 0; i < s->num_priority_queues; ++i) { gem_get_rx_desc(s, i); } } - if (FIELD_EX32(val, NWCTRL, TRANSMIT_START)) { + if (FIELD_EX32(write_val, NWCTRL, TRANSMIT_START)) { gem_transmit(s); } - if (!(FIELD_EX32(val, NWCTRL, ENABLE_TRANSMIT))) { + if ((access_mask & R_NWCTRL_ENABLE_TRANSMIT_MASK) && + !(FIELD_EX32(s->regs[offset], NWCTRL, ENABLE_TRANSMIT))) { /* Reset to start of Q when transmit disabled. */ for (i =3D 0; i < s->num_priority_queues; i++) { s->tx_desc_addr[i] =3D gem_get_tx_queue_base_addr(s, i); @@ -1692,37 +1703,37 @@ static void gem_write(void *opaque, hwaddr offset, = uint64_t val, gem_update_int_status(s); break; case R_RXQBASE: - s->rx_desc_addr[0] =3D val; + s->rx_desc_addr[0] =3D s->regs[offset]; break; case R_RECEIVE_Q1_PTR ... R_RECEIVE_Q7_PTR: - s->rx_desc_addr[offset - R_RECEIVE_Q1_PTR + 1] =3D val; + s->rx_desc_addr[offset - R_RECEIVE_Q1_PTR + 1] =3D s->regs[offset]; break; case R_TXQBASE: - s->tx_desc_addr[0] =3D val; + s->tx_desc_addr[0] =3D s->regs[offset]; break; case R_TRANSMIT_Q1_PTR ... R_TRANSMIT_Q7_PTR: - s->tx_desc_addr[offset - R_TRANSMIT_Q1_PTR + 1] =3D val; + s->tx_desc_addr[offset - R_TRANSMIT_Q1_PTR + 1] =3D s->regs[offset= ]; break; case R_RXSTATUS: gem_update_int_status(s); break; case R_IER: - s->regs[R_IMR] &=3D ~val; + s->regs[R_IMR] &=3D ~write_val; gem_update_int_status(s); break; case R_JUMBO_MAX_LEN: - s->regs[R_JUMBO_MAX_LEN] =3D val & MAX_JUMBO_FRAME_SIZE_MASK; + s->regs[R_JUMBO_MAX_LEN] &=3D MAX_JUMBO_FRAME_SIZE_MASK; break; case R_INT_Q1_ENABLE ... R_INT_Q7_ENABLE: - s->regs[R_INT_Q1_MASK + offset - R_INT_Q1_ENABLE] &=3D ~val; + s->regs[R_INT_Q1_MASK + offset - R_INT_Q1_ENABLE] &=3D ~write_val; gem_update_int_status(s); break; case R_IDR: - s->regs[R_IMR] |=3D val; + s->regs[R_IMR] |=3D write_val; gem_update_int_status(s); break; case R_INT_Q1_DISABLE ... R_INT_Q7_DISABLE: - s->regs[R_INT_Q1_MASK + offset - R_INT_Q1_DISABLE] |=3D val; + s->regs[R_INT_Q1_MASK + offset - R_INT_Q1_DISABLE] |=3D write_val; gem_update_int_status(s); break; case R_SPADDR1LO: @@ -1738,7 +1749,9 @@ static void gem_write(void *opaque, hwaddr offset, ui= nt64_t val, s->sar_active[(offset - R_SPADDR1HI) / 2] =3D true; break; case R_PHYMNTNC: - gem_handle_phy_access(s); + if (access_mask & (R_PHYMNTNC_OP_MASK | R_PHYMNTNC_ST_MASK)) { + gem_handle_phy_access(s); + } break; } =20 --=20 2.43.0 From nobody Mon Nov 23 04:36:03 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1794827967; cv=none; d=zohomail.com; s=zohoarc; b=oG/pGlJx07aC7ylCO9XgdyiSbqFSdxtyytOuQl/CnMOmZau9jn4hYD0f16Hu+Ms/uvP7djGLvG0r8sIaWn9sObx7iphCLDue8Cw6RgOm6mB7rY9Nuf1LCIJVUpfyhTATpk8kFN6TyGQcYcreyHlOspJKwHCwisi2UIFk5Np7CN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794827967; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=axHm2KD5tqEhcxv0LLLMI45i4rCgo/rHakMhYkIY7So=; b=ZblY+s/hyPFBzbm9RqHZvTFFd62d+lgJpwDNqSDpL9kKRKXC3MigrxfcxWd/9vrJiDxh0uvtCnbIqhvKiTRYBV1wmr8G4XRiVXMjc9j9+WPMAqWPQSADSHgcqCA2xEaDlcq6sm+a2Z2ucw0oo0QSRIpeHijDp658TNqBIu+PmG4= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794827967442725.6066180185916; Mon, 16 Nov 2026 03:19:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSug5-0005aO-Me; Mon, 16 Nov 2026 06:15:14 -0500 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 1xSuef-0003wH-VP for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:46 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSued-0002E4-CU for qemu-devel@nongnu.org; Mon, 16 Nov 2026 06:13:45 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-498f5fa5103so1385323f8f.2 for ; Mon, 16 Nov 2026 03:13:42 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c6d079a2asm19490469f8f.16.2026.11.16.03.13.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794827622; x=1795432422; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=axHm2KD5tqEhcxv0LLLMI45i4rCgo/rHakMhYkIY7So=; b=WjejhTfLYcL1uOethNh4Ec3L6OO4uh68aVBZDRHZJc9tPpEFKrk4cIdTf0SrPukg03 xd1sdpQnd7pU7J5HH8q2aq4F2JBZihyHjPh9Ibxg6h4IAKNcy2wqeGgT59LlVNnNX8VT 8R28fgxciBMyg/LVZ6oQTfweLd/GtAaD2IydZPXbEhYIpt6kM7Fer9zKAU0Zp/sr3lRy ouR00QBnoUtoJWvAtkeGvq1FXzXoroVXCNpiIhU+fkMv0c6qGXZkGCgp+muT1TW6nVyo o4nLh9XcOW/qIJIBEnwyovGB/5H6z1HAqXFd7CBkGTWuDNOJwTqeYnpbAMhE5ZYk75M3 iLYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794827622; x=1795432422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=axHm2KD5tqEhcxv0LLLMI45i4rCgo/rHakMhYkIY7So=; b=uL1nqau81ERBG0QHe79FC4UVF5AkAIDPYsQitd9AKxqF27FbKSLvgwT71DYCokL73/ PWWw/xzMp/sPlSm09kE9x7m+3jCoYSeeocRSv1wXZcww0JUp44eRmnxIIawxultQqKJX Xex9T0Y2QCuYbJyMUUlSf7s9m5z++CwFBlMipHHVTAEI2keIVmagvWg2uR6KOkvxPgA3 HJ9TwU05N+Gtp5BUABsQdbb/yRdIY5bCVE4ElGrgMaTVdhIzFahOYqQbqc11CktzZBJK xDB5Fla4ulM6/NVFRfyUCY8t0MpoIQ/zn8lF1QuEr7ipDsoSJcw0A5xaE8s2rpUkeQs1 YHbw== X-Gm-Message-State: APuU4Z/MfR6NsSvkrzmnEAQL4voF6Bxo7iiioQLlHlz90kaXNROhv67W v7JFUo1iu4jiBaRIYIXZBHqWslXvqAsszt/ouR4blLK89+0hg3xiqKju8my+WOB+/E0akpiIxqq /Eil/ekQ= X-Gm-Gg: AZFdTZcPkVEKCmKT/E1LmP00bPC/zP87amj9ngAgJAeeGWsPXMJ0ij+3uRyDkgVItFD Lebe4XXRBVP6ktDg/O+e2hEOoMV3qeMR9zttRgUf6/mcJmdp7R8W0RLl7i7VArxiZZXC68O0nRj Bbf1RQXarUVXrOdiJP9Kq4TCQ/svK4owpgMnhrVkCBz71chG4HEpTKOs+augh39XZurE+PVBP/W fISmrTV/S/DtI0LxdpCy9Hx4alMBm5u8ea0uaGW9Ztf++WsZBuHnBEhl2kdtK54Xv0u8+CwB78t xVgiUl07rjNGpSpUfYtiCU/1r+KbS3478myEihctY7y486d32TbyFkuUu6BvZj+NwgsCApTgON/ EI45/oXJl6IfEprJ1H1/OJ4cUFgpdghqCLEe8WIlLOmP52gzUZCPh6YkfnHmxaH9IORkIffx0Xt nVewchzmpZ4+t3o2s2j1BhbS8Wqv424k8gbPH43txJ7n7CZV2PDmqfbwSxyqflZYuST4i8K5LrX fqiuloTTTk/yHERLeL7YbDv6y8fQftzfYF/UOqc7J9pKYby/bGr+XsfZJv3avwtNbPhBXHkBHuN TSt5FmCd8iVIEKNYG3q1wLYdIhLcA9vYQDiqbsoRn1uc24cqImEyqigiGE6dElHwOkvL5xrHwHo bNg1xgm+AN+BlzDtWKl+G6LR2xxzYzC/0nQ== X-Received: by 2002:adf:e19b:0:b0:498:b92a:2f7 with SMTP id ffacd0b85a97d-49c71d49040mr20866683f8f.30.1794827621929; Mon, 16 Nov 2026 03:13:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/33] hw/arm/virt-acpi-build: test vms->acpi_dev before building HEST Date: Mon, 16 Nov 2026 11:13:03 +0000 Message-ID: <20261116111303.1692832-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116111303.1692832-1-peter.maydell@linaro.org> References: <20261116111303.1692832-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794827968781158500 Content-Type: text/plain; charset="utf-8" From: Ren Yanyi virt_acpi_build() gates HEST table construction on: acpi_ged_state =3D ACPI_GED(vms->acpi_dev); ags =3D &acpi_ged_state->ghes_state; if (ags) { ags is the address of the ghes_state member of AcpiGedState and can never be NULL, so the check always passes. Whether the GED device exists is a separate condition (has_ged also depends on firmware being loaded and on ACPI being enabled), so a machine started with ras=3Don but without a GED device reaches this code with a NULL acpi_ged_state; ags then holds a bogus non-NULL pointer and acpi_build_hest() dereferences it. Test vms->acpi_dev in the enclosing condition instead, so the HEST table is only built when the GED device exists and the ACPI_GED() cast is always valid. Fixes: 2e9c5c5bc85a ("acpi/ghes: prepare to change the way HEST offsets are= calculated") Signed-off-by: Ren Yanyi Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/virt-acpi-build.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index d368913e766..5670d1eca71 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -1406,7 +1406,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuild= Tables *tables) acpi_add_table(table_offsets, tables_blob); build_dbg2(tables_blob, tables->linker, vms); =20 - if (vms->ras) { + if (vms->ras && vms->acpi_dev) { AcpiGedState *acpi_ged_state; static const AcpiNotificationSourceId *notify; unsigned int notify_sz; @@ -1414,21 +1414,20 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBui= ldTables *tables) =20 acpi_ged_state =3D ACPI_GED(vms->acpi_dev); ags =3D &acpi_ged_state->ghes_state; - if (ags) { - acpi_add_table(table_offsets, tables_blob); =20 - if (!ags->use_hest_addr) { - notify =3D hest_ghes_notify_10_0; - notify_sz =3D ARRAY_SIZE(hest_ghes_notify_10_0); - } else { - notify =3D hest_ghes_notify; - notify_sz =3D ARRAY_SIZE(hest_ghes_notify); - } + acpi_add_table(table_offsets, tables_blob); =20 - acpi_build_hest(ags, tables_blob, tables->hardware_errors, - tables->linker, notify, notify_sz, - vms->oem_id, vms->oem_table_id); + if (!ags->use_hest_addr) { + notify =3D hest_ghes_notify_10_0; + notify_sz =3D ARRAY_SIZE(hest_ghes_notify_10_0); + } else { + notify =3D hest_ghes_notify; + notify_sz =3D ARRAY_SIZE(hest_ghes_notify); } + + acpi_build_hest(ags, tables_blob, tables->hardware_errors, + tables->linker, notify, notify_sz, + vms->oem_id, vms->oem_table_id); } =20 if (ms->numa_state->num_nodes > 0) { --=20 2.43.0