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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B5E1CD1292 for ; Mon, 8 Apr 2024 07:48:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 198BA40A75; Mon, 8 Apr 2024 07:48:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id aWQYSBy8B8hn; Mon, 8 Apr 2024 07:48:37 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 38B064092B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1712562517; bh=lYa3AETRGu43DEiQhYxZTFZAvQ/cpPANqCuO4mDL3mg=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=82yIfbBSiqiiGvysVsFg0RoE9UzMf9lrtgC3akuzSVQm4D+wxLjm8tYR8LcwerQ8v bpfps8tziZ8WqAaXDPxYvwin675o+iaBZjuazyAx7sdu4dM750kfYC5O+o7KqVLOxs MVbGH7ziLckhElrFTFiXbdKbFhjrHblCmIwuVzIq/N4Ri9HvDFGaNE6cDg7SoeinAK Ng8jwy9jCWao/MQh5qbmbL25tRVyV/Ht7dA39FtDHT5ggqpTfzfYfcVYDA6tX1UWuY 7NeyRMnWNcA+t07E20rs2ih9kbVx66S6k9qhh8Z+nQUCTN93KtkxghXAvdAcryo1nM TRgOLLFXPLcXQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 38B064092B; Mon, 8 Apr 2024 07:48:37 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 57C991BF489 for ; Mon, 8 Apr 2024 07:48:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 403056058D for ; Mon, 8 Apr 2024 07:48:35 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id n57FXMMAHwse for ; Mon, 8 Apr 2024 07:48:34 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org E41A460087 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org E41A460087 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by smtp3.osuosl.org (Postfix) with ESMTPS id E41A460087 for ; Mon, 8 Apr 2024 07:48:33 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B367960E8A; Mon, 8 Apr 2024 07:48:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6E45C433C7; Mon, 8 Apr 2024 07:48:29 +0000 (UTC) Date: Mon, 8 Apr 2024 08:48:26 +0100 From: Simon Horman To: Alexander Lobakin Message-ID: <20240408074826.GA26556@kernel.org> References: <20240404160302.3585661-1-aleksander.lobakin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240404160302.3585661-1-aleksander.lobakin@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712562512; bh=OyivqxCyCQHaU0TBvZu93VhrYPwd0djlXetBhWNnesg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B5J8RCAsrKzRVEhhwi/e38juo3WpjVWQRnbyNanqNA6q/wEidu68HX91oGo+Wts8M HSrpru0oR2wUqZq9D+fZQi6I84bKIyh7Enb7oHQHXWYdlAcylmkepJI1OKJo2scDII 7o/efqaTf1SyH5XZWL20kh29NdFdsDcTljpDSZIjs8VlSnpwqV0ry3N+ce4m1fp9Z+ D16nABgcaVDmzyXmXuhbuU+bZkEPTrbPThBBk7MaMb6np+OubsWPXAMM62NcID6MPt l4KWRstfel4q0W2nWeYICj5y7GWvzx3pYRowW6oG+TQZXw78gnJX7UUAhBUghxvTSA sEBn334ShUFmg== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=B5J8RCAs Subject: Re: [Intel-wired-lan] [PATCH net-next] ip_tunnel: harden copying IP tunnel params to userspace X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, David Ahern , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, nex.sw.ncis.osdt.itp.upstreaming@intel.com, Jakub Kicinski , Paolo Abeni , "David S. Miller" , Dan Carpenter Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Thu, Apr 04, 2024 at 06:03:02PM +0200, Alexander Lobakin wrote: > Structures which are about to be copied to userspace shouldn't have > uninitialized fields or paddings. > memset() the whole &ip_tunnel_parm in ip_tunnel_parm_to_user() before > filling it with the kernel data. The compilers will hopefully combine > writes to it. > > Fixes: 117aef12a7b1 ("ip_tunnel: use a separate struct to store tunnel params in the kernel") > Reported-by: Dan Carpenter > Closes: https://lore.kernel.org/netdev/5f63dd25-de94-4ca3-84e6-14095953db13@moroto.mountain > Signed-off-by: Alexander Lobakin Reviewed-by: Simon Horman From mboxrd@z Thu Jan 1 00:00:00 1970 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 871F15FB95; Mon, 8 Apr 2024 07:48:32 +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=1712562512; cv=none; b=e3y3+mL4GtWTLUqtHEVQmfySzENNMmlfHQCqL/LrtGT5rRHnYoTu4i8dmylTQtrDLDl/5Z2NjEUwRixKAcP1NBQeqilSsG3mXW8b64ilZHrFQFBdoaY96UBtIWq4qVmUVc7cEhx47o3obIGNYerITeQwUqzZ7G19WC3kpQ8MVrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562512; c=relaxed/simple; bh=OyivqxCyCQHaU0TBvZu93VhrYPwd0djlXetBhWNnesg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pxs8y2cBebP20ZMzIVPeyFU7CeUGGQ4jvr4n/Yerc1EJZ7qYRzMRqKBGRsZljS/3U9eyB6vNzG/fztruHmpEdH8lE+f2T8e4lgVv+oV/tfwotwq1SyLmU5xhrgK7L/wjwXg9kjaT6W6f0RBjz+FOp32Eq/vZFClacVoBVXNSesA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B5J8RCAs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B5J8RCAs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6E45C433C7; Mon, 8 Apr 2024 07:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712562512; bh=OyivqxCyCQHaU0TBvZu93VhrYPwd0djlXetBhWNnesg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B5J8RCAsrKzRVEhhwi/e38juo3WpjVWQRnbyNanqNA6q/wEidu68HX91oGo+Wts8M HSrpru0oR2wUqZq9D+fZQi6I84bKIyh7Enb7oHQHXWYdlAcylmkepJI1OKJo2scDII 7o/efqaTf1SyH5XZWL20kh29NdFdsDcTljpDSZIjs8VlSnpwqV0ry3N+ce4m1fp9Z+ D16nABgcaVDmzyXmXuhbuU+bZkEPTrbPThBBk7MaMb6np+OubsWPXAMM62NcID6MPt l4KWRstfel4q0W2nWeYICj5y7GWvzx3pYRowW6oG+TQZXw78gnJX7UUAhBUghxvTSA sEBn334ShUFmg== Date: Mon, 8 Apr 2024 08:48:26 +0100 From: Simon Horman To: Alexander Lobakin Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Dan Carpenter , David Ahern , nex.sw.ncis.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] ip_tunnel: harden copying IP tunnel params to userspace Message-ID: <20240408074826.GA26556@kernel.org> References: <20240404160302.3585661-1-aleksander.lobakin@intel.com> 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: <20240404160302.3585661-1-aleksander.lobakin@intel.com> On Thu, Apr 04, 2024 at 06:03:02PM +0200, Alexander Lobakin wrote: > Structures which are about to be copied to userspace shouldn't have > uninitialized fields or paddings. > memset() the whole &ip_tunnel_parm in ip_tunnel_parm_to_user() before > filling it with the kernel data. The compilers will hopefully combine > writes to it. > > Fixes: 117aef12a7b1 ("ip_tunnel: use a separate struct to store tunnel params in the kernel") > Reported-by: Dan Carpenter > Closes: https://lore.kernel.org/netdev/5f63dd25-de94-4ca3-84e6-14095953db13@moroto.mountain > Signed-off-by: Alexander Lobakin Reviewed-by: Simon Horman