Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp729215rwl; Wed, 5 Apr 2023 07:03:41 -0700 (PDT) X-Google-Smtp-Source: AKy350aN+LMehNFl0VH6a0WEXVu4Df55jAcsbCTRx+zllxyuIaTZbzEhVor9bmSWMDOsTyrW3H9Y X-Received: by 2002:a17:906:d9cf:b0:92c:138e:ff1f with SMTP id qk15-20020a170906d9cf00b0092c138eff1fmr3602043ejb.18.1680703421444; Wed, 05 Apr 2023 07:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680703421; cv=none; d=google.com; s=arc-20160816; b=F4iQKHMKlJbvB0CyA5JmDbaerPRU4z1K+xE/Y/5Joahq/y3jv0nMcU5f6lluZ48oSl uMqSGrmOjPzVzFklgvI2OTDEUW3+SZX8Pcb/k2Uc9bKhk2ilLRGFI9ialPsGKT+sGC1/ GqI1nqHyCh+AaH1I3VHZIO14IF+OC94XIHNpep40ZuvsdiJW5gSMD9JPjvPdHCltilKJ 9hCO4TVoIU2w7WnNsiFmZPVn6FgkKS/qJ+DHE4wcyLeqpwlTaIOQtTSMWZ2j1fcqMsOj OQDPn4nabmuU8LsbdCj4/ywaEUW86XKmc/kYss2uymdAPtfLC0paokyYPzzqTVFg2EgT ZicA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HYSMPMeHX/0HLWIE1l4pijnGU+H8cea/XdX8cwt5ORk=; b=PdEnqYa4HOmXsHWTPRrMNuGYYy2yYklOC6sYULz1FZ24WvgvD9Oze+TX36G8zTGxgk ATT/lY7RXD0tkmFJu7CaDs4f6jmcNdD4CfmjSWQ9ipzvSVOdEuNZm1dqLlm9DAs3DXPh 4yGOVmr4YJ4xEQwkmUtycAFETFI/ln+MhlJIaEZuwtXm6G4NxBFn2fU5XgiDa4OP2miF w2mJC1KJ1w8Oh2A62wJW6YjNKOPhtjpGpLpfLiJ8YY3E61P9lgrLWbEHSUJtmYE9tN01 +bbVZ29rluyDxeyB6ObBgp9GTj0q0gaH9VfVo+8DQIrNY5+8tfTOS6RyRyhEBM+yXPo+ OWaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z20-20020a170906945400b008b17ae97330si11207707ejx.880.2023.04.05.07.03.16; Wed, 05 Apr 2023 07:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238150AbjDEOBH (ORCPT + 99 others); Wed, 5 Apr 2023 10:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237860AbjDEOAz (ORCPT ); Wed, 5 Apr 2023 10:00:55 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E45F5525D; Wed, 5 Apr 2023 07:00:47 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.1.0) id 5d14c08f8e88d672; Wed, 5 Apr 2023 16:00:46 +0200 Received: from kreacher.localnet (unknown [213.134.163.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 911C91B4EA5B; Wed, 5 Apr 2023 16:00:45 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Bob Moore , Kees Cook Subject: [PATCH 26/32] ACPICA: acpi_pci_routing_table: Replace fixed-size array with flex array member Date: Wed, 05 Apr 2023 15:54:25 +0200 Message-ID: <2656292.X9hSmTKtgW@kreacher> In-Reply-To: <4845957.31r3eYUQgx@kreacher> References: <4845957.31r3eYUQgx@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.163.219 X-CLIENT-HOSTNAME: 213.134.163.219 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejuddgjeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepledtieekkeekveeikeetgffgteeuteefjeevjeegudelvdduheeiuedvieehieevnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepvddufedrudefgedrudeifedrvdduleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieefrddvudelpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeegpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhosggvrhhtrdhmohhorhgvsehinhhtvghlrdgtohhmpdhrtghpthhtohepkhgvvghssehouhht fhhluhigrdhnvght X-DCC--Metrics: v370.home.net.pl 1024; Body=4 Fuz1=4 Fuz2=4 X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook ACPICA commit f4a3afd78c28dede0907f47951f0b73c9a776d4e The "Source" array is actually a dynamically sized array, but it is defined as a fixed-size 4 byte array. This results in tripping both compile-time and run-time bounds checkers (e.g. via either __builtin_object_size() or -fsanitize=bounds). To retain the padding, create a union with an unused Pad variable of size 4, and redefine Source as a proper flexible array member. No binary changes appear in the .text nor .data sections. Link: https://github.com/acpica/acpica/commit/f4a3afd7 Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- include/acpi/acrestyp.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h index 52e82d65016b..4c3b7b393f82 100644 --- a/include/acpi/acrestyp.h +++ b/include/acpi/acrestyp.h @@ -693,7 +693,10 @@ struct acpi_pci_routing_table { u32 pin; u64 address; /* here for 64-bit alignment */ u32 source_index; - char source[4]; /* pad to 64 bits so sizeof() works in all cases */ + union { + char pad[4]; /* pad to 64 bits so sizeof() works in all cases */ + ACPI_FLEX_ARRAY(char, source); + }; }; #endif /* __ACRESTYP_H__ */ -- 2.35.3