Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp827410rdb; Fri, 9 Feb 2024 02:18:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWwlgR7zcVIVsv2eq4+uHt4YS9tuy5qLHBnOta6/a1I3o60y6nw7j61KL7PZzGml0gMka9ns0B+OWA5fi+2rtVGHRZi33zvbMCPiKdbOg== X-Google-Smtp-Source: AGHT+IFgGSt6esZ8n20QwVSS1no8qlJZxCktHhb1LqPDVn2f6Cgjbh13l3gkwarFUYFDeq3Efczf X-Received: by 2002:a05:620a:262a:b0:783:9bd6:742 with SMTP id z42-20020a05620a262a00b007839bd60742mr1398525qko.77.1707473933943; Fri, 09 Feb 2024 02:18:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707473933; cv=pass; d=google.com; s=arc-20160816; b=AQl/1jk1hFt9zYivkrkV2ZVTZ8jtGx7PIJ6z2bjd7WYTuYr+BgQw+qwa+XVKQAj1/6 FNbZoROJXwg2ehe/VvKMcjcJ9e5+A5LVnFrFGlFLKBWTeb3rlFvHpgqEJ4bTpA/4cM4d aa+aZBWPYOIWjtDs+Ljx4vPFL9uTfoSZd6V3HexnP/ul1qUmeuvH4N7OUz7xbWWiziJK uuie71zBHac44D0Of7G80Ntcdap9eCQH68X/P3jIJRPvH7TaPTzYksXEN/QtyacpiidI +OQvaInIjqoRsmmv5eWi/JZazQGuTP4ur84BGvFkpIHEQzGuA/ZcuXCQuNJZ9HYwBduU d3HA== 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=tH6NXwNSfKBvnH8Lc26izIVVlpLOzfxhd0jfDsGlo1w=; fh=0Gi2jX3Z6C2KV2YSk4HXLmji1jtD7BMVPs2SHyUx6co=; b=bjvETgArSu1uc49wmUONXa4zLkFMRzxmv+8uCaGYCd3XNAjutGH5Ntwl2lyY0sbtsB qYWgBB9eZhHd2vz2vloXjATgqLY0YPnluSwBosTcVF37zyp4FsLHtwZBOm2w7ix8DNXb 8iGRUG7J2lFR0Ea2rRRHNMmOGE8egGFAiKobUiA71TLmtjJ4ra8xqJTy42iKY+qGwQiO A9jpoNPVG0CTHXnwdvZsktDpRAThd1GvMj5HozxTHt2KiI0urkhUPLu3wkTkj3myqVUn 8Vjm7p+ABGIYEp8K6LDZE/CWb0pIkl0TaZnr2QuLumu+Q9eM6gD3+0xMtUp/7DcHfQnE 4F3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bdVkSWTT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-59204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWZbsX5nzJmEgjuowI2lAWMkWUG/rShv1KJBNucGZ3uJW2K+P376vRiAw579N8KpHqmmjMm+Fcn2B8eNrv3AgyLi6arqVD+XKm0TgtdgQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id vy3-20020a05620a490300b007859bb25bd8si1663688qkn.174.2024.02.09.02.18.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 02:18:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bdVkSWTT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-59204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59204-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A73F31C20E4C for ; Fri, 9 Feb 2024 10:18:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BACB269951; Fri, 9 Feb 2024 10:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bdVkSWTT" 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 E22DA69940; Fri, 9 Feb 2024 10:18:42 +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=1707473923; cv=none; b=pVBRimPbuHp6Zco12m1IPf9K4dAjm7fVc7Dx6mZMySEssaSlQlVsWEGU2EUoqnqfllTQsflPRPFxNaYlrN0BWnxp5MCPXMwCpuy5CD1r6lia2l4jZlHjzX9R18rdwm0ckvQjZojztHyKvskZ3CxFLKTbZgrD0z20bD1Z8sn9uVU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707473923; c=relaxed/simple; bh=9/lwSuAm2fFdzrC5XkKYo4LL/EvpSjXS9OJF5310rJY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UvPPVvKZmWUCzWt9kODGgMdrtkTebBRDw7tUF3vpwlReTvyA5y589GCMfrjPIozID8AkxjIY1JBEL8N1K0Vz53/n1ygE3IR07fsQi8a8hn6y2+zeHGnLivGJrNSourHvipH6ChGkC1N8yo9qElaSS1IT4sxOBE5kRc6mIvX5084= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bdVkSWTT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF0F0C433F1; Fri, 9 Feb 2024 10:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707473922; bh=9/lwSuAm2fFdzrC5XkKYo4LL/EvpSjXS9OJF5310rJY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bdVkSWTTJr0e84YjnFyaFyP0EiUoLupLdiM2h+FIQHrIut7HwHklAoSLqLEh7ecUO cAeHyqVkya4kgs+4CITgaCwnDzGRoU9dvs24d2wq3pt6qXK+QQNueII14KqDQ0LM4k o2xxWzapK19fS1GhUrshESzn7O2jF7gJjXmwPSAUhomep4bPZBf/jBZZelzLwAPi1h OoTLScLGrTOHF4S9TotNLMSmS26O27dlylvlezRtURavuVrGaTDqbP1F6UoCxy64Cy /28e5QsmuJpkGhi72WctNkve43hdBlWKDROfWi0jhRzi8F8lH81zkF8c218kFV3l7N 0fmrZlE6JSCyg== Date: Fri, 9 Feb 2024 11:18:37 +0100 From: Christian Brauner To: Eric Biggers Cc: wenyang.linux@foxmail.com, Jens Axboe , Alexander Viro , Jan Kara , David Woodhouse , Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] eventfd: strictly check the count parameter of eventfd_write to avoid inputting illegal strings Message-ID: <20240209-milchglas-aufzuarbeiten-f34f1491be02@brauner> References: <20240208043354.GA85799@sol.localdomain> 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=utf-8 Content-Disposition: inline In-Reply-To: <20240208043354.GA85799@sol.localdomain> On Wed, Feb 07, 2024 at 08:33:54PM -0800, Eric Biggers wrote: > On Wed, Feb 07, 2024 at 12:35:18AM +0800, wenyang.linux@foxmail.com wrote: > > By checking whether count is equal to sizeof(ucnt), such errors > > could be detected. It also follows the requirements of the manual. > > Does it? This is what the eventfd manual page says: > > A write(2) fails with the error EINVAL if the size of the supplied buffer > is less than 8 bytes, or if an attempt is made to write the value > 0xffffffffffffffff. > > So, *technically* it doesn't mention the behavior if the size is greater than 8 > bytes. But one might assume that such writes are accepted, since otherwise it > would have been mentioned that they're rejected, just like writes < 8 bytes. > > If the validation is indeed going to be made more strict, the manual page will > need to be fixed alongside it. Do you prefer we drop this patch?