Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1439307rdb; Mon, 2 Oct 2023 09:29:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrSIBccRfu8BK+XBlXh7QmPgu2JuiZL0Kq3UEqYXMwL9JPNbMCbSmyP2NlwJM29y8pUpN6 X-Received: by 2002:a17:902:d4c4:b0:1c5:f110:efa0 with SMTP id o4-20020a170902d4c400b001c5f110efa0mr12289655plg.30.1696264196162; Mon, 02 Oct 2023 09:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696264196; cv=none; d=google.com; s=arc-20160816; b=fR2E3vb5eaZ7GInCQfOJDEXrRgWGQF/rNR+KSvVv/DQu//UieGTtk4sOXyiE0/cHhV EmQcEJaJyrdkSDizT/45LsXIZcxS/TC464VC0N8STX/5tdAaqILVxb0n9OQhcJPF7D6j IkH02iX0y5950abA4oqrTzqhB9ZUWuikpVZ+JSaA66bqBxrzrw2sfTgKj6PU3Nyr1QPR ZrBU4LvYM0xvV8Uad0TjcTMnZCQ6r6h7JlN5fjGAPLbpaST3cKzhLO2SzpHwYsPs9AoF RTjLnpKxl10D7RZGi4LQRi/tvLZf1b33WorhpEQN+JPF1z/fVq0dzFkWu/YxBN4PolKm P5Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=b39lp3fCffOmCI5yo3gcT6hS1/f5YdDMWzbh/Ll7HeY=; fh=mZuuzH01ON1Qbm5VKvaRMIh0lEtiT3xrERe4WfTi9iU=; b=Nn9td42rXCFeDZBCteTpFzOIR7+MHBI8i8ejl71S4vAZ2grNT320gMJD8dgnl+Liga 0J438aE/PMgwdPF+zeqjKV4aiCRupAoTyrYe8dueubkrTsdbOKgsV6wdydFkffcJuKHz ZTEzSvmdYk/hiDKrAlXDipx61k9w1GQHMGVcl1d2YARD/6VGLqHEhQhIUkzIQY1cS5CE NmSv8ru1vtk1QRbVsPg7hEhdceZfPOHyoKtBeVe2KaP7E6W/safz3SPPsnYMCOvFRCVL +mNI44ohBfFQITB/khkKCjE6xaIUfBDG7QhOJVEb5muTegF+/WUo99i8gG2a/D7r/qfD Ieww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GbwsDYRm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id b1-20020a1709027e0100b001c60d6a620bsi19415278plm.95.2023.10.02.09.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 09:29:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GbwsDYRm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0048C8051921; Mon, 2 Oct 2023 09:14:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238432AbjJBQOi (ORCPT + 99 others); Mon, 2 Oct 2023 12:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238414AbjJBQOh (ORCPT ); Mon, 2 Oct 2023 12:14:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73E72B3 for ; Mon, 2 Oct 2023 09:14:31 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA69BC433C7; Mon, 2 Oct 2023 16:14:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696263271; bh=z2fk8YtqV+V10VoyiNxtWZBlzYiMUwqKV/e12y8Dpx0=; h=Date:From:To:Cc:Subject:From; b=GbwsDYRm+UDgIYREREAZP0jTTQBCIV4CJJHH7wEetdjC+jxysZa0rBH8QzAwzAFwZ v7lxoCioIVK/r5zbt1IOpNUptgXs7b3khb6v3d7hOAEGjrnJJ4yvcESo7MtDHwXTDP VdkN1SdElzRobMstfIArea3xeRsFkk8p+DIIEkIFGhJ/oqwOipzgGy0oLPoMTcuM8S 3u67P2ISVpF4mDi/QhrtiiQdxlSnVoCP0S6B8GM98iE4Yse5HtdyRDf1Ljk5oPm8N+ 6V8OiI3ER7Dx0VnidTST7wrI//SY7+4gj1/0fHBNLzT2sbyzOLUScUS1vNSaxojfOO bwl94dkd8l2sw== Date: Mon, 2 Oct 2023 18:14:26 +0200 From: "Gustavo A. R. Silva" To: Jan Kara Cc: linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] udf: Fix undefined behavior bug in struct udf_fileident_iter Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, 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 pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:14:57 -0700 (PDT) `struct fileIdentDesc` is a flexible structure, which means that it contains a flexible-array member at the bottom. This could potentially lead to an overwrite of the objects following `fi` in `struct udf_fileident_iter` at run-time. Fix this by placing the declaration of object `fi` at the end of `struct udf_fileident_iter`. -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting ready to enable it globally. Fixes: d16076d9b684 ("udf: New directory iteration code") Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva --- fs/udf/udfdecl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 88692512a466..736f591abc89 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h @@ -93,11 +93,11 @@ struct udf_fileident_iter { sector_t loffset; /* Block offset of 'pos' within above * extent */ struct extent_position epos; /* Position after the above extent */ - struct fileIdentDesc fi; /* Copied directory entry */ uint8_t *name; /* Pointer to entry name */ uint8_t *namebuf; /* Storage for entry name in case * the name is split between two blocks */ + struct fileIdentDesc fi; /* Copied directory entry */ }; struct udf_vds_record { -- 2.34.1