Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp132767rbe; Wed, 28 Feb 2024 14:52:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWQ4Yiw8f4AV4MoQe6eQP3QFDywPnYKiUOwTIcOowJlasu+0AdZFPtPFZoM2w5o9aAPkNgrgDPkl4shphKttD28su2LDQQ7ynSPEtd08Q== X-Google-Smtp-Source: AGHT+IF4kK4sj8YVg2SzbnYVVHofxyq6vwmhV5jPfQ0UJoChz4C/azT3TRZXIETL+g+MTcrqww70 X-Received: by 2002:a17:90a:ae01:b0:29a:bf47:e133 with SMTP id t1-20020a17090aae0100b0029abf47e133mr600922pjq.23.1709160775568; Wed, 28 Feb 2024 14:52:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709160775; cv=pass; d=google.com; s=arc-20160816; b=XI1MF/Rv0UEzsoYW0KIV96WcLM8di6ooPEw8V5RMcZG9hHmWFzhUIjw639hmp825tK LQ1UNyMY9hC3z7BM5jkqonnd6d5Io7bdgl49yMnkCs6VvWNviT38yUAT3+VaQjfrYBS/ MzVXPlIilJF9r9lRwCdYh7yYj6z7m85UlkQnbpAZa01dWMWvLL/iCMepMx1MKsMx3BWN chFvSRYEIsQyo9ab5MLdSA7iftBU5fqHUwCpKIIaOjuVyyjjldNoZEhWeFgt0rW9TSoC 6ip88T4oTGm1zikkzSh4ergt/9Sq25ca5Vfo7Xs/FCA5wuzE0szksCkigrFIxa+ATiAd tnTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=GvEP733Tqit7rH+Qb/g7SXGhhW+9i2hvTL1WFGdXa8g=; fh=I+wNhN54JXqsP8tW5AKFfPYq5lqJ5wvTW68JrBsFGdg=; b=jteETIwugKq5c9rQJe6XF+JFPWYBiptaRdcGQ4u6d6wkA1426HrhU5nmGqvvnEdPcL Caly1/ncfRUl9ZFH0evgVNCIbqkR1xezMrmXVRaIEGvzkWY9C789QA67XPc4z/zQLko3 YPAran2rEuPxgIA6UYwQXhuewEJ8LDHm1AtpStQFO/SWmVaMkvNsuHp824PHTDu7gSKf 9/hpVwy4JVmH9Dd3U3TRaAP5AIEIfMSxTskvaK44YJ7vMY4ZcC/adW1A/GIQdRoMmhT7 zHk3FkMxgXkVP584zCVNlZ/d9ZD6Oiw67kBeWb++diJVExKoKkjG+huGnRwY6uEr5Tmt QUzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=riY0y4Fx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85792-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85792-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u18-20020a17090abb1200b0029a702ed482si763207pjr.1.2024.02.28.14.52.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:52:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85792-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=riY0y4Fx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85792-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85792-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 432DFB26577 for ; Wed, 28 Feb 2024 22:42:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9246E7290C; Wed, 28 Feb 2024 22:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="riY0y4Fx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D90F2B9A7; Wed, 28 Feb 2024 22:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160110; cv=none; b=oMFSD1NVvqM3EgWERLc1UzZk4Xp6a/LCQSQwGHVFFb/rY05o3goYQZXYHugOFYKFs1RM4+ehZ5Neq6PwC9GzfvfxGnEVy+DqDWWmgwoQAmF3yxpEHs1U0tO53W/60mK39j+6GrUpNfXlTju1AjqzpN5W0V8EC+7zFs+hxjsVK/o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160110; c=relaxed/simple; bh=tjZVW+wfEpV5hm2GKoaS8QIBTAqnujkBvNvmFWcTTLc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qLCtoNmnyd0U9TG/tB7PNN0sW9JEMn7c5/JfaR1hnpxQ+lIE4V/i6M3KJr12Axa5l91haet2d2XYUjGQiQuo4adpiR53IE2pG0j9SrlJk/pJHdcKZND4SDOWRvWkn0D5asLsMYOCLwYY8zmg32b945j/iKa2A3dM3L+PLds669A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=riY0y4Fx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C851C433C7; Wed, 28 Feb 2024 22:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709160110; bh=tjZVW+wfEpV5hm2GKoaS8QIBTAqnujkBvNvmFWcTTLc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=riY0y4Fx+9tYTZwqjeMsvr4+CHnvM+egJckNzF8PFaNWQ4EcaJYupvlD7D/scvNCv OhTNiq2/vxp/DVYtwKstTH3GAs1WmKe8yIY1CUOu7+oAK4EjG6PWlW5nZZj/ylk/xd 9Osn0CC2JXqYGhqhpjD+IOdYMgVLSQLQIgWQ8GvziuaEoSKgQ5/+gk9d5rqnvYJyKh WOn77ZDAlVWd8VC4fDQ6lEprgplYLB9xmm50yk2Fw7mM8ribnczNkB4HznWNedrKbx 0Zi5KnVyCs3gsId7Prbd3CVRBlNzEzTBkG0FuvZyKyNF8B/BkVTOKkG38ds7GZgeJM RMKDJwj4vNoHg== Date: Wed, 28 Feb 2024 14:41:48 -0800 From: Jakub Kicinski To: Kees Cook Cc: Andy Shevchenko , Vinod Koul , Linus Walleij , Jonathan Cameron , Mark Brown , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-spi@vger.kernel.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , "David S. Miller" , Eric Dumazet , Paolo Abeni , "Gustavo A. R. Silva" Subject: Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs Message-ID: <20240228144148.5c227487@kernel.org> In-Reply-To: <202402281341.AC67EB6E35@keescook> References: <20240228204919.3680786-1-andriy.shevchenko@linux.intel.com> <20240228204919.3680786-8-andriy.shevchenko@linux.intel.com> <202402281341.AC67EB6E35@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 28 Feb 2024 13:46:10 -0800 Kees Cook wrote: > I really don't like hiding these trailing allocations from the compiler. > Why can't something like this be done (totally untested): > > > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > index 118c40258d07..dae6df4fb177 100644 > --- a/include/linux/netdevice.h > +++ b/include/linux/netdevice.h > @@ -2475,6 +2475,8 @@ struct net_device { > /** @page_pools: page pools created for this netdevice */ > struct hlist_head page_pools; > #endif > + u32 priv_size; > + u8 priv_data[] __counted_by(priv_size) __aligned(NETDEV_ALIGN); I like, FWIW, please submit! :)