From patchwork Fri Aug 11 17:47:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 712617 Delivered-To: patch@linaro.org Received: by 2002:ab3:63ce:0:b0:238:c968:2573 with SMTP id m14csp11105ltf; Fri, 11 Aug 2023 10:49:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtcMwsD9ae/Wnpiqj1arGCcpbFYEGxHNxX9InyUFiAY5xdMn7/7qApvW3JUY0hn3xtgfir X-Received: by 2002:a05:620a:410a:b0:75e:bdee:367e with SMTP id j10-20020a05620a410a00b0075ebdee367emr3161265qko.47.1691776144398; Fri, 11 Aug 2023 10:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691776144; cv=none; d=google.com; s=arc-20160816; b=cMQMcQjhkh0nNTWOGSg+OBFqtqCHz8MAndAZT/Tk5BEm7Fl0cHFoek/w/si6I9G52f 4OG501JaJ6Kozmll7wFwNGBTgYLX9+EI8CvwhDch/xhEbKYR5z0TZwlfvrHvIEh+WZ6O 3s6NyMLuiaonQGGGf2yHOGYejURKhVUUhSLRQhNZrq2vB3c8ESbU9uy25oi/hmnTPlbi daNRmc9Zt7JdV40zwl0v3BaGhGlzkE0N9wy9+NzaM5o6T5szND1eqMl+3h5aAzkWUYfN 1UBOPoBR7SRpOhpFvx3yCjMHf+52T0xxvt+o2GWH2m+ObgAvPd8Is8J+XHf3xUnCYVJ8 axJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=0ZjqSHq7/cZ8OsQEHGhOPAij5Qo4MVYdiXsrrjnC+xs=; fh=7DBmaFwVaJYwFDZ3gGQwZmes/0ragOw7RBzk+ZtwYi8=; b=HC2eir5gqud/nihQuSPmDIIj7LK37zdj1A1ncWRQOW/OE4ZAoQSgN6L1EfUydvq2S4 gVCbWt795jtqkyt34HA/opZQVet6m5A+dBzKfhGaFGXKVpIyGQKOszXewLMk3NqwOaNg 6EGypSutgNCLt4uqa3yaDDmhUnFghu1MDzPkut/RLjozerQLhRqY8tEx32/KWWjIqL92 iVqfY92rLe3PE+gVcmj/pioR1Y/Qfo41ZBxbw5Ol0fCjwxGtwdOcXeUyePclvZJ+lb27 hT3Abs+o/fmWBm7h8zjLMsP/FrdoBIH1DUsRDRYSuGOQjzlfJGhwx07PHBDipsc8BBF/ i4Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w35ls+Ed; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ro1-20020a05620a398100b007672916d246si2334503qkn.606.2023.08.11.10.49.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Aug 2023 10:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w35ls+Ed; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUWEw-0006rP-Ow; Fri, 11 Aug 2023 13:47:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUWEu-0006mL-M0 for qemu-devel@nongnu.org; Fri, 11 Aug 2023 13:47:56 -0400 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 1qUWEs-0004sl-NH for qemu-devel@nongnu.org; Fri, 11 Aug 2023 13:47:56 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fe5c0e587eso21133735e9.0 for ; Fri, 11 Aug 2023 10:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691776073; x=1692380873; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0ZjqSHq7/cZ8OsQEHGhOPAij5Qo4MVYdiXsrrjnC+xs=; b=w35ls+EdmPgGvIip0cTaiXQ9UynsHAHrBCe91OI05JM1YbjcbWBQ8LfODYmJ5hKzwG n5NC3+/iFJASEAV1QDyntd5ywzEidfxlhNQb7X+cbLbpcjC+OSOUOMWj2JiXMli4D25X qX41y1DT1pJS1dI8i9f7aDMhL2gCDcEfvC2UX0YSIMgJcIyJqrN1ZLfY9L/ZLTTUSJ8L X146ZluavpXG9NyI7tEnvMf6ddU7EaVfePjVX3lZ420amt9vNaqhwErLI461ABqGuTQI fcgR7jZ30vb7T8AofcQmXizN/xVHHvEYGHRn7Jyill8zeZ0lI+J596mo7Tw7LUDYIbRG lszg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691776073; x=1692380873; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0ZjqSHq7/cZ8OsQEHGhOPAij5Qo4MVYdiXsrrjnC+xs=; b=PIyYVrVpsv5hKqDjITNUlnI3Tuv6Q1hJVRRVfa/oCN8NCdXrhqqVXZcwOn1U1ScR22 zEKTm5g4KHMsGgSQM+6ctaVmakVV6+L9qaNOoGfhIJRZxm7T0ILyk8L0/p8w4r03OZPq U5u++IaovbxATZ7spDs5EM7Gyaz0ZjUwO/O3xGnlqZKXnRMFskifDUq/7J/uAr2PYDXw MR9xFf+yTeD8QFBuHzM9gBrRv+rYtxOt1EGt+Dt+8Pb1SMu/BAo9PgqLUBoOQWE16Rcw lxXPoaFICc3RYH6NSM23xfsIwEY0BHvyAfuOb1VCOSqxj9bvqCSxOpwZYi+84ixhMRhm ZGRg== X-Gm-Message-State: AOJu0YwvybellUuV5wyZk8eTYTMBUo+qwRCdR5S9faprMJa/jGXB1SJk cqVbc57DcmbJkLk22eyOtfQ5JM9kijqdMFKjUa0= X-Received: by 2002:a1c:6a14:0:b0:3f5:fff8:d4f3 with SMTP id f20-20020a1c6a14000000b003f5fff8d4f3mr2229738wmc.7.1691776073060; Fri, 11 Aug 2023 10:47:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id c21-20020a05600c0ad500b003fbb346279dsm5874940wmr.38.2023.08.11.10.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 10:47:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Keith Busch , Klaus Jensen Subject: [PATCH 0/2] nvme: avoid dynamic stack allocations Date: Fri, 11 Aug 2023 18:47:49 +0100 Message-Id: <20230811174751.784620-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The QEMU codebase has very few C variable length arrays, and if we can get rid of them all we can make the compiler error on new additions. This is a defensive measure against security bugs where an on-stack dynamic allocation isn't correctly size-checked (e.g. CVE-2021-3527). We last had a go at this a few years ago, when Philippe wrote patches for this: https://patchew.org/QEMU/20210505211047.1496765-1-philmd@redhat.com/ Some of the fixes made it into the tree, but some didn't (either because of lack of review or because review found some changes that needed to be made). I'm going through the remainder as a non-urgent Friday afternoon task... This patchset deals with two VLAs in the NVME code. thanks -- PMM Peter Maydell (1): hw/nvme: Avoid dynamic stack allocation Philippe Mathieu-Daudé (1): hw/nvme: Use #define to avoid variable length array hw/nvme/ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé