Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5538791rwb; Wed, 9 Aug 2023 05:54:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6aGhqI6wZ2yolr7hzEktqdVOZLbQvj6FMCDEyexT9EKR5/z6YPirfpNmSN3oo9rzt314w X-Received: by 2002:a17:902:708c:b0:1b6:c229:c350 with SMTP id z12-20020a170902708c00b001b6c229c350mr2447095plk.18.1691585648469; Wed, 09 Aug 2023 05:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691585648; cv=none; d=google.com; s=arc-20160816; b=gjg2+9+cbmUmbxha0a96CwKYxc+aBqFbucul4YoDvR/LpO+OYNeqW0izSb4YYHFOaT iCfOUnQ939mQx7IJk3ZLyqGlHkamDZFa7IDSEnjvcHxlXtaXSR0q+/Hqwi2N3eDmxb6p Db2PS8YEeLxec7JSelmkwbaDPUgzRwDL0ruURGG3pXMmdvGE8LOIKPHdxH6txfAQaGHo 65eZIMp7Rz5Y2zXn2C9n10PBKy8DCxpPnXI5GRO4t+1ZAqZsw8nOOxP1GoQHNaaXhxWb 4YUBRsn66TBePl2nqy6k2STidB5e5JdYy5vTZErV5e67w0uP7JBXz7c2mdh1LVgJnEQk rIAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=d17QRRDz4a3yB9VqDQfZ1kNb0Ad7373UP8r/61U6Bys=; fh=1mX3l7IceH0Hp09HwIZoZFg34u9xxtb0DTbM9GuPwko=; b=tBHKxoGsD2XUPOBUjyQSIFDMqcwsGIFV7WwML3HcvnFxpiwPvNzVdyuBHTinqnDjYx uVrwL6Nh8s/z2ctaK93zDMtSc6HPNXt0guEaKkYwMsY6IUKjmi0h4o5ctYhyj/sV92hi z2zf6fD7X6cY6fIvJ4WLzn/JzjG+z33GqmxCB2Vi0PTytHyb3jYJllbkLmXQfvy9p+3M gELZhSNylcmwi2TCVFieOpMPiJ0EUwecDz6Eh/2QTw1aYXGZKrhM+pQCwpCGMzaz/Mo9 4B6QZtunILDgQF1/HUuXhwB5H7zALTiyqF7oejxQQI+R6kq75d6qQowgriiuLFDP1yNE ieOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="lpoK/uAN"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a170902f68700b001b8a5cec6e4si9682878plg.251.2023.08.09.05.53.56; Wed, 09 Aug 2023 05:54:08 -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=@kernel.org header.s=k20201202 header.b="lpoK/uAN"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232276AbjHIM2g (ORCPT + 99 others); Wed, 9 Aug 2023 08:28:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjHIM2f (ORCPT ); Wed, 9 Aug 2023 08:28:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2362E1FCC; Wed, 9 Aug 2023 05:28:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD68D63889; Wed, 9 Aug 2023 12:28:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25A73C433C7; Wed, 9 Aug 2023 12:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691584114; bh=sEM6A7v8beM65GOpgbPHHqgeliizvdkk3E1U4YHkLoU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lpoK/uANDrW8WWjFdIuPn8HIUyukQYCDHPHUzvttZ439ycDydHiICm5YqRDCqY6fX GhUTaH+Tj/1szgSGYR7S6EQdOjsMVdj4pvqmSSrtvP5avxFBLiaWavN8Kb3h28jJXg 0VqS1lIIo9GuUeiOgZH1PUu7H7QSp23twNms3I9JUpceKvuKxSZpnG5ZNNoIHDz3Ed UMGCP3VYYbXzf8n4GhWVDo8RVGAGAuw7lwGS4GMhtU3bZxpSZum6GlCMb07OXLrdwn 5fLzVBS/OUNhIv+pdDtHcBi114C5FDI0zl8wpha3dCK7Ny0bGlzjDJ21vQU6w/HEoR FzVF/NRyH3dQQ== Date: Wed, 9 Aug 2023 14:28:27 +0200 From: Simon Horman To: "GONG, Ruiqi" Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Roopa Prabhu , Nikolay Aleksandrov , Kees Cook , "Gustavo A . R . Silva" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Wang Weiyang , Xiu Jianfeng , gongruiqi1@huawei.com Subject: Re: [PATCH v3] netfilter: ebtables: fix fortify warnings in size_entry_mwt() Message-ID: References: <20230809074503.1323102-1-gongruiqi@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230809074503.1323102-1-gongruiqi@huaweicloud.com> X-Spam-Status: No, score=-4.4 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_PASS 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 Wed, Aug 09, 2023 at 03:45:03PM +0800, GONG, Ruiqi wrote: > From: "GONG, Ruiqi" > > When compiling with gcc 13 and CONFIG_FORTIFY_SOURCE=y, the following > warning appears: > > In function ‘fortify_memcpy_chk’, > inlined from ‘size_entry_mwt’ at net/bridge/netfilter/ebtables.c:2118:2: > ./include/linux/fortify-string.h:592:25: error: call to ‘__read_overflow2_field’ > declared with attribute warning: detected read beyond size of field (2nd parameter); > maybe use struct_group()? [-Werror=attribute-warning] > 592 | __read_overflow2_field(q_size_field, size); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > The compiler is complaining: > > memcpy(&offsets[1], &entry->watchers_offset, > sizeof(offsets) - sizeof(offsets[0])); > > where memcpy reads beyong &entry->watchers_offset to copy nit: beyong -> beyond ...