Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1056581lqs; Wed, 6 Mar 2024 05:16:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUktHJN4/pHf6GsYHzSO0ePPkB1JcJliygxlpMQEVoVVED+U4aJHyUhvYyjVhXVMPdY0JlIaOG6bDRPsu4nBGhBNrZ+FEysBDCtUGKVyg== X-Google-Smtp-Source: AGHT+IGBwDpACIBnmNNJRyW4cG3KbAWBcnHDmLwHm+B7YAa41QfjxvKp5M9tCfOSpGslAG+FH4Aq X-Received: by 2002:a17:906:f751:b0:a45:566a:b652 with SMTP id jp17-20020a170906f75100b00a45566ab652mr5713494ejb.11.1709730996599; Wed, 06 Mar 2024 05:16:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709730996; cv=pass; d=google.com; s=arc-20160816; b=sKYxF0uQsMtTaiDSky0yf3ftCtWyDbkqL3vxmbIoGqRr8ave2V3Ab1XXEUcJbz7/8d 0vnnRxyigYVk/pRay2laeTiI5IHcG5e/CHyKz+XyLIVSyAjaBe+XWmc/051daQo2UxUe l99flH3++eEpMFpMFKMAz4K2hjzHXSQjRMU3STxh5NEyLs3DohW2fh0jRiMIoTYy2vMT 9w3UCf2+77Jjwof9bvWh7/d8lUhzHDCCcPcLtEScIgXaEPW74U02/i4OPeXUdJGpxV7r O9eKpbuYpNOMXcXBiEK6AxllF+GjoJvji+UqOZyNgiK8uPyMpfQBn+KCcz+jbnivWhcw oRsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=L/tWs4fwCFAZTFAAtDBZh8EOdci0pgq2gOC8rOm/wUU=; fh=wvltM9QbJPTjRFb1YwgcJ6gOVWpo1sEcVAfutZaKWHA=; b=luI16LorlQEl4FkYVWzDdWSWTvYOV10MM8/Pl0yycJo4Hz2LIoq3aXLyubypHp/d3o JDiWv8DzaycpMa/sMFTd5IFeUFsBKE27DNRIFjUQNuQtXQwVunhIhEmNeJm6dRw0eB3K IxlSTn0FNsAKiCjO2vde3HjyC5C4+0eoLWjlPTMirsCCCbPOb6aviR/S967YjX8Bc3LX 4vq4EcDI6twg878q1Tf00qGO7H8yF0LeQj8gcXB4fTZ59Kt3XtJ2yLEk33oTeYxo+NTl lgi6bEugEQy+Ib3bO0oMT8jJZgLhuvJTGAeKGBcR/tprpp+U3NW34dqkUjpzuQOMKEVm HzAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-93962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93962-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l20-20020a17090615d400b00a3e9176fca8si6090761ejd.1017.2024.03.06.05.16.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 05:16:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-93962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93962-linux.lists.archive=gmail.com@vger.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 120561F20D44 for ; Wed, 6 Mar 2024 13:16:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2020130E29; Wed, 6 Mar 2024 13:16:23 +0000 (UTC) Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B062F7FBAA; Wed, 6 Mar 2024 13:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709730983; cv=none; b=hInI7OaA/HHKN2z6REn6neHUdBGg7o8SarNiSGgHnD1zrO6q2QqfyQDzYGXg7QeOLmoGa8Wqqxdi2m2VWP9FN7YworXcp9DoB6uXS3Erhgnd3+gOQd2U4gzyC+r9IpO+MUs3dRbKqMhgFfActasL7o3GMtCdRxD0VyM+1Iptp/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709730983; c=relaxed/simple; bh=UN5GxUcdpytO2U2Ldms6mARi4xRRCE3E9Hta9POhZ64=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HjINBt1OtV7fXtK3CkaP0t3XJ3fQZY13iazPg3ZntdP8vsLpSkR4HILLBWmclHqFd1fg0EasczI1UXWCXKAPEsRWyQzb0/QA8XSoH0Vyzm8b/AZ6WNmH19FNnbmdoy5I8GI9thIvMMChSkr1LS5u/DMLOEXwhU14KZSGB5G+gCY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a3ed9cae56fso151513166b.1; Wed, 06 Mar 2024 05:16:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709730980; x=1710335780; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L/tWs4fwCFAZTFAAtDBZh8EOdci0pgq2gOC8rOm/wUU=; b=WXm1vZPoK4l4oN79kgOiioPM8WcqbpiBWALVMq3iSEMtkqq+E6sNv0XPpTifs8Mrre ZTrVak9EnpMVpbqaMDeughU22zqrbJ6Hp1dSqmjR14BKTJ8RMFL2oQ6L0T9FRTwjEvnz h45I1KmJbE5Hab2TJYiylbt72iKoo9o9D5zVd1HncMkcJm2LZGNHitjXeah9QL4fHp+q JgcuMziSNHYSepo4nrFjq3qI5s/grfjYmp+gcVyj02Vuv0LltT5kHObJLedxUCYxpvTB LgyV0QycFwlwzNOOIBHsDweZzKdBZ5N6EJyo7W9cV7ljZJbYBuWgHj9jYGmF9pK6SZHG yAhQ== X-Forwarded-Encrypted: i=1; AJvYcCVJ2v129hMhBWInqAjOHSe4fHPHHva5lU7F6Je/nDGO2BUXHeo6M5JeSGk4VKGDKSSIuLhnHI17H8F1lQ4kej/1rTlfDJQmB0hy28qHmcAyJZ2z9moyuOJOP264mB7Zk1kZbYmFosO+1f2AfUQp+QCcqKzy57D7Yi8InG6lAQNGQobpFwdZ X-Gm-Message-State: AOJu0YwJmPP82Xe9s4GWjGHoTV/pl65cMnft8jQuH6zu0pLrZ0HGJAyx 4WJnBf17slJJiUxJVDDbHuB9tz25RlpTtHwiJuqNX/rf3STcJTjS X-Received: by 2002:a17:906:57d4:b0:a45:a2cc:eb93 with SMTP id u20-20020a17090657d400b00a45a2cceb93mr5652823ejr.4.1709730979709; Wed, 06 Mar 2024 05:16:19 -0800 (PST) Received: from gmail.com (fwdproxy-lla-007.fbsv.net. [2a03:2880:30ff:7::face:b00c]) by smtp.gmail.com with ESMTPSA id k14-20020a1709063e0e00b00a45beabb104sm499441eji.159.2024.03.06.05.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 05:16:19 -0800 (PST) Date: Wed, 6 Mar 2024 05:16:16 -0800 From: Breno Leitao To: Jakub Kicinski , keescook@chromium.org Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Andy Shevchenko , "Gustavo A. R. Silva" , netdev@vger.kernel.org, linux-hardening@vger.kernel.org, Simon Horman , Jiri Pirko , Daniel Borkmann , Coco Li , Amritha Nambiar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] netdev: Use flexible array for trailing private bytes Message-ID: References: <20240229213018.work.556-kees@kernel.org> <20240229225910.79e224cf@kernel.org> 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-Disposition: inline In-Reply-To: <20240229225910.79e224cf@kernel.org> On Thu, Feb 29, 2024 at 10:59:10PM -0800, Jakub Kicinski wrote: > On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > Introduce a new struct net_device_priv that contains struct net_device > > but also accounts for the commonly trailing bytes through the "size" and > > "data" members. > > I'm a bit unclear on the benefit. Perhaps I'm unaccustomed to "safe C". > > > As many dummy struct net_device instances exist still, > > it is non-trivial to but this flexible array inside struct net_device > > put > > Non-trivial, meaning what's the challenge? > We also do somewhat silly things with netdev lifetime, because we can't > assume netdev gets freed by netdev_free(). Cleaning up the "embedders" > would be beneficial for multiple reasons. I've been looking at some of these embedders as reported by Kees[1], and most of them are for dummy interfaces. I.e, they are basically used for schedule NAPI poll. From that list[1], most of the driver matches with: # git grep init_dummy_netdev That said, do you think it is still worth cleaning up embedders for dummy net_devices? [1] https://lore.kernel.org/all/202402281554.C1CEEF744@keescook/