Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8098733rwi; Tue, 25 Oct 2022 02:25:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IS3UkoqppITBcN+E4g/sfbeQAqcTKtZfvbYP4ZJ1Id9rJPnXRQYtZUkTF/nkHFfCH2foR X-Received: by 2002:a17:906:9745:b0:78d:480f:cee7 with SMTP id o5-20020a170906974500b0078d480fcee7mr31551998ejy.192.1666689902263; Tue, 25 Oct 2022 02:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666689902; cv=none; d=google.com; s=arc-20160816; b=cRgobcMcNdQ3FpkMHKKErM//RMQLKFaGX8l2Pifl0c/BnLXacMU4ZR5MUDBGi9ZB9O VH30cAOCN2JHZ0yJBbfTY+kLZ6WsZE/jCc/J8bf6wuMHirxKs7IvfmiVgnmU0JXWw/Mj xXsDz18U0n1XdTqkY75SgzMVv7KVx52ajRV2+s8Lf/D8cZC+IgV/FPGFF17e6HeDbnse ot6U1MXRPxMISG3tbUBv3wAHzJp0Fl3Vt30kn0mNwHEaYZXIdMgW4mEM3QcVhCgk1rwl h2tdwJ5qtQT0Kr4f4PJk1SqZAtfgb3kXiu1qxpWwV3SwXiBjhpJNgxQ8GUdNRxBaTAcV FPQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Ced7TPjOfPWmLkqVxi08sTITn/iilbKR0l21pgYaVXQ=; b=Di1W4z0GS1cipTvP5ihspKHxuKp1KKh19aqse4rxh23hJAj06ojpN5iSBh/ySvCXUl 9ap8vcyT/W6zEbpk9BZnyQ4lMptHYq3mSp+HByIliAbRO/SH30udz/jOqz1+1iVJpt25 mqiYe7nANg8+CQCP6wY25kCXhZhh0L6peiLyAlMLChs84ERgl7hwOlCgg6FedA/LX5v1 8zPdLHGiAtV+NH55wMGxFRZ3k3ZwfDayhHGmr9LzwhvTWuYAyTdXRUdhUIKdDBcn0BZZ eL5+QfFduFvhU8nPy23FuPYlpFgFP1LRhqZPhdZCYrw1u80D0ZGYwv0AybSzKD8+sP/1 Dr0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DX0A2hmb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020aa7d652000000b00461fa05b004si2065433edr.105.2022.10.25.02.24.37; Tue, 25 Oct 2022 02:25:02 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=DX0A2hmb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231274AbiJYI6t (ORCPT + 99 others); Tue, 25 Oct 2022 04:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbiJYI6q (ORCPT ); Tue, 25 Oct 2022 04:58:46 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8F73F6179; Tue, 25 Oct 2022 01:58:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666688325; x=1698224325; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wobCzPymTGLVzVS8xvZoimtbG8thJgFTUNq5m2nYbf8=; b=DX0A2hmbJd6Y0GVRp/YAmFAWb9SBxsVoummfNRHb5sW8OhuiSHlL3uot tdzhk13bzIPOY907arjmmKrmjYega+BUwIEhOX8HHpM43VTYmSd+9HxLk xdHIeKilpplajrBkbFFKDtld3JymtVOGJk8aD5NZzfT9LZR/+y2yDVMps 8r74ExbmHkkhxr7NCZpUooawI98aHPomtaDJHDnsy3GtyZn9WW6o1T3i5 x17c+HrzdJRGX4MlQuWubHFcCKspyDniuCkrYWPClN52w9VkTNAY2dA9E kHQBAuCWdj2tbG8COvqUOtD5wYxjNhJosnpBOIdpAwb64t7YMuoybtytI A==; X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="393941983" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="393941983" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 01:58:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="582704669" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="582704669" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP; 25 Oct 2022 01:58:39 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1onFld-001udB-05; Tue, 25 Oct 2022 11:58:37 +0300 Date: Tue, 25 Oct 2022 11:58:36 +0300 From: Andy Shevchenko To: Kees Cook Cc: "Darrick J . Wong" , Zorro Lang , linux-xfs@vger.kernel.org, "Gustavo A. R. Silva" , Keith Packard , Francis Laniel , Daniel Axtens , Dan Williams , Vincenzo Frascino , Guenter Roeck , Daniel Vetter , Tadeusz Struk , Geert Uytterhoeven , Paolo Abeni , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 2/2] xfs: Use flex_cpy() to check extent copying Message-ID: References: <20221024171848.never.522-kees@kernel.org> <20221024172058.534477-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221024172058.534477-2-keescook@chromium.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham 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 On Mon, Oct 24, 2022 at 10:20:58AM -0700, Kees Cook wrote: > Use flex_cpy() instead of memcpy() to copy the bui_fmt flexible array > structure, which will perform bounds checking internally. Avoids the > false positive warning seen under FORTIFY_SOURCE: > > memcpy: detected field-spanning write (size 48) of single field "dst_bui_fmt" at fs/xfs/xfs_bmap_item.c:628 (size 16) ... > #include "xfs_error.h" > #include "xfs_log_priv.h" > #include "xfs_log_recover.h" > +#include Wouldn't it be better to include it before any "local" headers? -- With Best Regards, Andy Shevchenko