Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp396993rwi; Mon, 31 Oct 2022 02:53:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48syy1U+1l1N0cuPUiZK3Iz0nIRlIut2JDU3zsbKuPtVQD+Qr6oat45DooY/hVHt7RspYn X-Received: by 2002:a05:6a00:1687:b0:565:a932:f05a with SMTP id k7-20020a056a00168700b00565a932f05amr13304701pfc.21.1667210028692; Mon, 31 Oct 2022 02:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667210028; cv=none; d=google.com; s=arc-20160816; b=pkJibYec1uCc1eGALcnl1rIq2qk8Bfj50b7gGby8Cm1J9n3wsqCpRKOV5JxTd93N0n mDMIb1gZhnrJN1o3995qw9qQyOSrgXyrzKTTx84IAC2tBKYm+Luy0fxqs+6z84WJXOAX jnT0Dtsw0h81HGIUlMSzLbUWb/TwobE18cd3o0mNrAXlj7AfG9dJOjTKEi7lC5WoalWC pFwgRPVovmnOrN2DRGE8oTnzGRT40E6A9BPGHlaWqaFj3pBgm9dI9d93K5hVnDxTsXom cB0GfYUv9lgIwQmwtM7weoDG9GMH6aV4WOU7Mk+wxkVMPlSBOqJO7czWdeqnmCcYnW7O HVFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=GtCCU4upZ4yKaxgjPWuaabnUmK1e/z9M1vFDS23PUFI=; b=Ncg9ruhrUbzufZOti6ffsLPBAKPbsbrxZgNA79XRMAD3S+a3GdyZrBgM1khKtEczNH lkjBKSIB8/f5gMG5a1zxAr/VgAlZ9ZeOCOXSiN7u0JrZiBHTGjJ+FxmHU6P70I4VUBI5 NKMHYRTqaowAFACTrx8yV3xFMFm8pb2GpnPLaep27p10tD418JaiObPVU5hHx/9PUsrN uH+Au+MMtYb3/gMgAXFCZ39QN+nhas0l7b2FceS16u/3hVguBfpsM0rho+pDxmWse2E5 7T9nD71MB2iHTG5ZM9Lbo8Wdx/d5FS+bsYRzf2K0t8blbdyKACgGtZoxAUD5M/0o2bOD fLnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NSjuXmHY; 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 d10-20020a056a00244a00b0056d2ae385desi7369414pfj.381.2022.10.31.02.53.36; Mon, 31 Oct 2022 02:53:48 -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=NSjuXmHY; 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 S229885AbiJaJiN (ORCPT + 99 others); Mon, 31 Oct 2022 05:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbiJaJiM (ORCPT ); Mon, 31 Oct 2022 05:38:12 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 689AD63AE for ; Mon, 31 Oct 2022 02:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667209091; x=1698745091; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=3HEhlyRyhTi1FcIpdqcmYBvpi5mKFGVbhxYqGdD60I8=; b=NSjuXmHYHlBlIJ82Wjlq0D8BastfBKCEEoj4vAU0pfKWnTx54Th0T7Sp 4zMYGXynWuYmHGY1veHRwY3dkoZiOriFeNFalsqbEPsCUF8uZtwGM1EQi jGAjsznBxjZRZ4HNlmLSUc4IQ664VRmq37GBZzOix4a7EFJlXMXeShTqJ GwsvVhWD6A2neIVrDCrEMCnv3QInZ1YuWE/GKbJgBcLE8mIF4Lo9ZBcad QDva/SFYUINgBro0BSS8/zb1uNtxa8a4b00nq+MAHSf0romj00E6DlmH4 SEzy8f7CpfIFiE4cwN1QYHbzi+cTT+FtFhjqLJi0rijR77NQmt9hxnZOw w==; X-IronPort-AV: E=McAfee;i="6500,9779,10516"; a="395171945" X-IronPort-AV: E=Sophos;i="5.95,227,1661842800"; d="scan'208";a="395171945" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 02:38:11 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10516"; a="722751836" X-IronPort-AV: E=Sophos;i="5.95,227,1661842800"; d="scan'208";a="722751836" Received: from rongch2-mobl.ccr.corp.intel.com (HELO [10.254.214.212]) ([10.254.214.212]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 02:38:10 -0700 Subject: Re: include/linux/fortify-string.h:220:25: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? To: Kees Cook , kernel test robot Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org References: <202210230440.8ZaljZvp-lkp@intel.com> <202210281501.29D9A905@keescook> From: "Chen, Rong A" Message-ID: <659aee78-b911-1ff8-87ee-c15fdf735f8b@intel.com> Date: Mon, 31 Oct 2022 17:38:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <202210281501.29D9A905@keescook> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 10/29/2022 6:03 AM, Kees Cook wrote: > On Sun, Oct 23, 2022 at 04:45:58AM +0800, kernel test robot wrote: >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master >> head: 4da34b7d175dc99b8befebd69e96546c960d526c >> commit: 28e77cc1c0686621a4d416f599cee5ab369daa0a fortify: Detect struct member overflows in memset() at compile-time >> date: 8 months ago >> config: arm-randconfig-r012-20221023 >> compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0 >> reproduce (this is a W=1 build): >> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross >> chmod +x ~/bin/make.cross >> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=28e77cc1c0686621a4d416f599cee5ab369daa0a >> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git >> git fetch --no-tags linus master >> git checkout 28e77cc1c0686621a4d416f599cee5ab369daa0a >> # save the config file >> mkdir build_dir && cp config build_dir/.config >> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash fs/ocfs2/ >> >> If you fix the issue, kindly add following tag where applicable >> | Reported-by: kernel test robot >> >> All warnings (new ones prefixed by >>): >> >> In file included from include/linux/string.h:253, >> from include/linux/bitmap.h:11, >> from include/linux/cpumask.h:12, >> from include/linux/smp.h:13, >> from include/linux/lockdep.h:14, >> from include/linux/spinlock.h:62, >> from include/linux/mmzone.h:8, >> from include/linux/gfp.h:6, >> from include/linux/slab.h:15, >> from fs/ocfs2/dlmglue.c:11: >> In function 'fortify_memset_chk', >> inlined from 'ocfs2_lock_res_free' at fs/ocfs2/dlmglue.c:790:2: >>>> include/linux/fortify-string.h:220:25: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning] >> 220 | __write_overflow_field(p_size_field, size); >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > This appears to be a compiler bug. The line in question is: > > memset(&res->l_lksb, 0, sizeof(res->l_lksb)); > > Looking at binary output, something is failing in dead code elimination, > as the copy of the code holding this is never called, and has a > non-literal value for the __builtin_object_size() output, which isn't > possible. > > -Kees > Hi Kees, Thanks for your feedback, we'll add it to ignore list. Best Regards, Rong Chen