Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1268538rdb; Mon, 19 Feb 2024 09:19:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW/G2D7ONxKaAiNkg38NyjCAe+LadrlEikgkVYsgcv4L6H86XqfCSRIq2S+cw3kG7v1b4M08Vtzc4Iy0P6uZM5Y2B2TOg33OletSB2kbA== X-Google-Smtp-Source: AGHT+IFvo+0zIVQped47cEBccuAqtmzOVLGRd8uPOHerJnmmDD+8RLaMj6+JkawXxVtX2RJIc/2P X-Received: by 2002:a17:907:7047:b0:a3e:e699:901e with SMTP id ws7-20020a170907704700b00a3ee699901emr144412ejb.2.1708363176441; Mon, 19 Feb 2024 09:19:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708363176; cv=pass; d=google.com; s=arc-20160816; b=OvUHmxP/59qjHwHJOnWwFzJJ1HxymE316AAI6yNcsg2/ggQeA0FwBHlXCfFcbpWuiL MlTVnavS2+NLEvaO2jInjkr9y9vh9xGTe8gGuZa1l6aDiChx0W2QrM82bw5duiwo1AM7 kwPNtaLRF7lLoHLDR9rLlFigyC0hGSLbMMknMxNSt72MOBntQe/1ehMz+xpk4MEZCznE fKF4rPDcm4ribSadsYH5pTHPgIXv5Jm+b0NBtznxsgB9dghk+3krk90+TRv2HfytrAsb BartHJyRuy8uqgx7xv2htmh6xUJ8jlbdWLcO43eBNCyeJLyZaa+qC19y/JMW0FjZr3ZW TuyQ== 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:dkim-signature; bh=nkaR3pkkZxmLGuo0+g1MO3UveJ5ArBTUXRWUQPTf90c=; fh=RBw23p86iQbyP7vo+m+lfWawyexB8VzmGTPsxsgJoQA=; b=wpfGu1SbQT1bwyBemE6RlfPv0k8LOqBF0hLQNje28BrMQiIEhLWVVMDf5lfFDYNuPT +NrRsf95DMoooXb1OibuZ23EftQms1IsiS1yPdYhUom0ekyukTiGaMQ/rvyFZxKFtOZX Kqym584aqPudGrYdxHAA2NuJvKxV1O0LNUqQ3wrhIEQVxdkBa58hV18NrpCtKg81LTQl 1Z52QaM8OLL4ffZQVB2X1xyt9gfagNTrR9rZaYeUCqMFDLKAQYraA9mfZx8Y3Oz/lspU 5fH5ovELqcpdfks0iP5EmSqxzO8VtWpsX6Lk+vCAWLmDLBiYI6Y+UDq4EB7d2T1oZ/Va T5AQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J6uvawix; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71744-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71744-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 i26-20020a170906a29a00b00a3ecb834df9si494047ejz.230.2024.02.19.09.19.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 09:19:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71744-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J6uvawix; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71744-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71744-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0B8ED1F21CDB for ; Mon, 19 Feb 2024 17:19:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4167D4594C; Mon, 19 Feb 2024 17:19:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J6uvawix" 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 55EE544C70; Mon, 19 Feb 2024 17:19:21 +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=1708363161; cv=none; b=eI8G+beuqTaSr7ywlUakxTmBfKSg/WocIKeAA1ZnFNNSJKhb/kkFUEC7VhU/0lTZsCCP+LZA+J7nLF6J1UtiPcZ3iEgtOngtYvhuDedonzoTmQylXtecBoblrmB6CvOlzlaSKN8CvkUUWUfKeZ5Ov59sTKN1l8KpiWalPpIA9XM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708363161; c=relaxed/simple; bh=6JXZWExM5zRAitroyxUGPwJV90fJfV2ON2sr9M8S0mU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k3kMP4akg8P86imyCQys36Pa0FPbBeAn4iwtk8amBIlAGziw61DM4hCtPMrhdPWi9j35ms8h2N8QeWA274gsu2SgIcKdjcMoiG1DHyLK2R35ce24cpAcTcpJRQEpsRekP/D0IStzmF4vXP88ougmsEc43pzt0+oIHyYLqqVSiUc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J6uvawix; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3647AC433F1; Mon, 19 Feb 2024 17:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708363161; bh=6JXZWExM5zRAitroyxUGPwJV90fJfV2ON2sr9M8S0mU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J6uvawixlaFBjUq1IQMwYzKZIjt9Eywp0GmxEDsidINoTfYEUVjIr9EzIjpE+89SP RtZPgnDEkAvt/hTOTObZHCYflata7pRnZVE7h8Rlk5HOexV2y5DM+DPv2VY2Q9IybC h/BOog0wGukp2bzI5CP1tyC5FZsD/F23zEJbocaWLzspbMQJcQL+fsgrAI4F0BQiWR 7PPiPDtRGISQXd68efdyrXwQKdgR4TAwK3shDGi1wzulx5iIDeVhYg+WxlCK25iOpa O7VtgenW15VmCNXQ/zrQoRfZ957j9fySDZO3gSB4ZXEZMB+fizAJHHGr7y1RydbqgH xdanfUqYnhLHw== Date: Mon, 19 Feb 2024 17:17:46 +0000 From: Simon Horman To: Kees Cook Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Gustavo A . R . Silva" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] netfilter: x_tables: Use unsafe_memcpy() for 0-sized destination Message-ID: <20240219171746.GI40273@kernel.org> References: <20240216233128.work.366-kees@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: <20240216233128.work.366-kees@kernel.org> On Fri, Feb 16, 2024 at 03:31:32PM -0800, Kees Cook wrote: > The struct xt_entry_target fake flexible array has not be converted to a > true flexible array, which is mainly blocked by it being both UAPI and > used in the middle of other structures. In order to properly check for > 0-sized destinations in memcpy(), an exception must be made for the one > place where it is still a destination. Since memcpy() was already > skipping checks for 0-sized destinations, using unsafe_memcpy() is no > change in behavior. > > Signed-off-by: Kees Cook Reviewed-by: Simon Horman