From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 498F2C433EF for ; Fri, 19 Nov 2021 18:41:53 +0000 (UTC) Received: from lists.zx2c4.com (lists.zx2c4.com [165.227.139.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B3A7615E2 for ; Fri, 19 Nov 2021 18:41:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6B3A7615E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.zx2c4.com Received: by lists.zx2c4.com (OpenSMTPD) with ESMTP id c032651e; Fri, 19 Nov 2021 18:41:50 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by lists.zx2c4.com (OpenSMTPD) with ESMTPS id 9c4d06e1 (TLSv1.2:ECDHE-ECDSA-AES256-GCM-SHA384:256:NO) for ; Fri, 19 Nov 2021 18:41:48 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D943C6138D; Fri, 19 Nov 2021 18:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637347306; bh=VDecXgh+gqvqzCSucgweelQi68hZPxtxs57AziUhTGY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XGKJLsInYofTjadHspqU2HMfhVAxZ0KFwOgGw3bOS+PJxQb+ntU4Jsq1bKfRCn64c jKMUrAvj/VPf+4a09Sbbk2AIlSG6+vJ1yF8CnG45d00dtnM3SWJnLqx4UaImWZh59E CddibKZFfXfs0Zq0T517uzJiFW44XZvct8zA/awaC3bPcipPhpecHeCwo6Zr9zfwKS tx+uW5t+z+fwteKFx/qOeKGsVjcwrb6uyfwCn0k6w7FMfDBjJKJCtQ29LQoqOC0pp4 Ua3mRa7JwTDQ1ERiy8D0WCG+BEOjsg2BSDfk++IVcUV+TeNgEaYpmlD49gicMuI24I e3T0V+QclMpgg== Date: Fri, 19 Nov 2021 10:41:44 -0800 From: Jakub Kicinski To: Kees Cook Cc: "Jason A. Donenfeld" , "Gustavo A . R . Silva" , "David S. Miller" , Jonathan Lemon , Alexander Lobakin , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Eric Dumazet , Cong Wang , Paolo Abeni , Talal Ahmad , Kevin Hao , Ilias Apalodimas , Kumar Kartikeya Dwivedi , Vasily Averin , linux-kernel@vger.kernel.org, wireguard@lists.zx2c4.com, netdev@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] skbuff: Switch structure bounds to struct_group() Message-ID: <20211119104144.7cb1eac6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <202111191015.509A0BD@keescook> References: <20211118183615.1281978-1-keescook@chromium.org> <20211118231355.7a39d22f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <202111191015.509A0BD@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: wireguard@lists.zx2c4.com X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: Development discussion of WireGuard List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: wireguard-bounces@lists.zx2c4.com Sender: "WireGuard" On Fri, 19 Nov 2021 10:26:19 -0800 Kees Cook wrote: > On Thu, Nov 18, 2021 at 11:13:55PM -0800, Jakub Kicinski wrote: > > On Thu, 18 Nov 2021 10:36:15 -0800 Kees Cook wrote: > > > In preparation for FORTIFY_SOURCE performing compile-time and run-time > > > field bounds checking for memcpy(), memmove(), and memset(), avoid > > > intentionally writing across neighboring fields. > > > > > > Replace the existing empty member position markers "headers_start" and > > > "headers_end" with a struct_group(). This will allow memcpy() and sizeof() > > > to more easily reason about sizes, and improve readability. > > > > > > "pahole" shows no size nor member offset changes to struct sk_buff. > > > "objdump -d" shows no object code changes (outside of WARNs affected by > > > source line number changes). > > > > This adds ~27k of these warnings to W=1 gcc builds: > > > > include/linux/skbuff.h:851:1: warning: directive in macro's argument list > > Hrm, I can't reproduce this, using several GCC versions and net-next. What > compiler version[1] and base commit[2] were used here? gcc version 11.2.1 20210728 (Red Hat 11.2.1-1) (GCC) HEAD was at: 3b1abcf12894 Merge tag 'regmap-no-bus-update-bits' of git://... > [1] https://github.com/kuba-moo/nipa/pull/10 > [2] https://github.com/kuba-moo/nipa/pull/11 Thanks for these! Will pull in as soon as the bot finishes with what it's chewing on right now.