From patchwork Thu Jan 25 17:32:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 765961 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1007:b0:337:62d3:c6d5 with SMTP id a7csp74129wrx; Thu, 25 Jan 2024 09:32:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjD8t0KtyJx17ItYJzQbCbZ7WBXD4B/ZzEXsFEjOZRZYJaHyQSog+YtHY0HRdYD3zhYmX+ X-Received: by 2002:a05:6214:4107:b0:686:262a:3ee8 with SMTP id kc7-20020a056214410700b00686262a3ee8mr1162981qvb.85.1706203973493; Thu, 25 Jan 2024 09:32:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706203973; cv=none; d=google.com; s=arc-20160816; b=OLVzoWLdzVDfYH16HrUJQiM5x0cDAwlPNNOeUBTUKEJl8p98jkWsDhnCP8j74FXhw2 X6TgOX8y+oJaWdC2UbiT+RfF3B5YeyaEK2h/+j0EH/bhvbRoOnkIlIkuxRaDS5NX9wRv 3cu4ruT0SXVdBxz3oijM44CesvwbAXzMHcAGrD7TN4uMvlN2mGwZZ3PztENZbdLLbUXU 4F5tFGdJa+mMCL3JAs9G8X1Q0GrTCU5xNr1+HwyoJRnVIas0I5kNV+lprVboEsMdbTQk OJnDXq3xomUgoWxDV+i9hbMg+ywxJETsHcV6AQpWVDptjkMdu8855+Zcxuzb8yj8bKTl J0Qg== 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:to:from:dkim-signature; bh=59hk5vLV+YriYiITrglneSa9mhMufI4e7Kn6+RlSZS0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=tzH5AIqcMGUahIKfdUjiQ277ed+zySFFazf9AZx1BaoAesjuFI8av0xzMG2P1JClJ3 NfYbkjHo9UBcNX+rXQ6diq4oKUvg+RopRYPvBVfQ0T/7zQWk6NZ/MxUuuYn0L8yZ0GFx lx69bzaJbh5MtQb6YKRLty8+zl72AfsCyZegkgVA1AtMxvA8dmWPHkcf5FWx0W4S9c66 sm5SoA1ZI3nkoFUmKbXAXpw0fcz+lpOq53ZdkEJBGiGFcGq91HeCs54gPeD+ohULKvxB nflR/w6LZUG83Pr8ZKLQAOwecHCT86sDZgKoD6eCeTM/6f8vmfzm/5+SGPUothJHgOtD 8o4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jVaQ9Ag8; 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 b18-20020a0cf052000000b0068181e87595si12986199qvl.362.2024.01.25.09.32.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Jan 2024 09:32:53 -0800 (PST) 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=jVaQ9Ag8; 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 1rT3aO-0006Bl-K7; Thu, 25 Jan 2024 12:32:20 -0500 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 1rT3aM-0006Ax-AJ for qemu-devel@nongnu.org; Thu, 25 Jan 2024 12:32:18 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rT3aJ-0006nZ-4A for qemu-devel@nongnu.org; Thu, 25 Jan 2024 12:32:18 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40e8fec0968so89836395e9.1 for ; Thu, 25 Jan 2024 09:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706203932; x=1706808732; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=59hk5vLV+YriYiITrglneSa9mhMufI4e7Kn6+RlSZS0=; b=jVaQ9Ag84uj3F5n1FRBy3mnqukCZo+3jFMJqjAH9haFmzhBgG3XaHVzl91x0qzfp5e i3hvYZHqW1kGj21BYDnUs1o73K/sShoTyqpNgPQmoF2m59vGK0Gbp7rgFsFX0glu93JP p7P4GHQTpP7CJAEtieQtf3WpZhmw52d//NQrwh8agX0s3JRgFmryTz5oaTKZA5XzwWTe NFEQPPDbollke9HgIjnp1ocQvq0HeSuEG4ewVQtXRBeBmgZRBaae2B+1DIrt2iBfrA1F 6EUPiDGM4m6zGdDs4GDhaKi05CELPQvipvQO/RvKAcfLMUHD97SzvpPlqZ83Rfz4eggK YSpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706203932; x=1706808732; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=59hk5vLV+YriYiITrglneSa9mhMufI4e7Kn6+RlSZS0=; b=OcpNzWBKs6ptLPUkpdLV6dvoZejj5iuDWaGOKPIUstCZU+S0zifct4Q+E9qjqVvMLI ORahqOxnXjzQfZH6zJI9P2dPCF+6q12VHEQ9Wggr6uW2oEclGS8sG6fLVGiNbd1veTlw 4k9NhuJkmM4ac44KHWqD6RPhCXWFOjAvop49SRlaAKoTKIuGAhkIF8x3lGoXHJVpHUFZ p0pHE/LnC29whpfZAO0Zk6Uj3A7QDpxD3fk1qQ3WWXa94fMMK5h4LomcbahJgajNYrdO kqzN6v2A0/R8JKM1PgjBopTq9DH+u+NPe7u40QEuHjDNTZ1vxgnlsYXI7BGvWu3jNaiM dDHg== X-Gm-Message-State: AOJu0YztjvOhkh24l1EgKeXTHXS6xPe1zk4HfeeAQZ7TEEtUONGVhxrL HJcPAr2vAnRgCzdMrhHSKbb6UdyScd4Uuf5mxsqS6+dS1bVb46tYyi5GyRRNkFwxKDWvwqPpw5j T X-Received: by 2002:a05:600c:3514:b0:40e:7232:be0b with SMTP id h20-20020a05600c351400b0040e7232be0bmr53461wmq.12.1706203932091; Thu, 25 Jan 2024 09:32:12 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020a05600c354d00b0040e45799541sm3287805wmq.15.2024.01.25.09.32.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 09:32:11 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 0/2] Enable -Wvla, forbidding use of variable length arrays Date: Thu, 25 Jan 2024 17:32:09 +0000 Message-Id: <20240125173211.1786196-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::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 For a while now I've had an on-and-off-again campaign to get rid of the handful of uses of C variable-length-array syntax in our codebase. The rationale for this is that if the array size can be controlled by the guest and we don't get the size limit checking right, this is an easy to exploit security issue. (An example problem of this kind from the past is CVE-2021-3527). Forbidding them entirely is a defensive measure against further bugs of this kind. I submitted a bunch of patches to this effect last year, and the result is we're now down to just a single use of VLAs, in a test program. This patchset removes that last VLA usage, and enables -Wvla in our warning options, so that we will catch any future attempts to use this C feature. thanks -- PMM Peter Maydell (2): tests/qtest/xlnx-versal-trng-test.c: Drop use of variable length array meson: Enable -Wvla meson.build | 1 + tests/qtest/xlnx-versal-trng-test.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) Reviewed-by: Richard Henderson