Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp43356rdb; Wed, 7 Feb 2024 20:34:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXXe4kqYL3EEC5IvcKZoietzNrrdfKsANgUaR6vFoRAA6i2KhaL8SyBNqxZZGNRFe29Ep+wtuOhTI0/oJV2zOmwj18eWRKNptLWDQnXdw== X-Google-Smtp-Source: AGHT+IHJshymFxVgj7DhAIGsCjcCPUu6qRj+AY/RtKlrf6PaiNUPCOH6k91wHoEEhFEV0edANl/A X-Received: by 2002:ad4:5aac:0:b0:68c:3d2a:47e7 with SMTP id u12-20020ad45aac000000b0068c3d2a47e7mr9081805qvg.27.1707366844076; Wed, 07 Feb 2024 20:34:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707366844; cv=pass; d=google.com; s=arc-20160816; b=oR25OOspEizZPKSWEllGRpFn7XoKCXfo/55A0T443l3klXWPeNyVopGl9RTcxdgWFM 0N6PbpvFqper//2b6X93L2Ds0gg6aV0j7DABtRMSJHcbdf34+w/faHDwCUhzGCZYxZiq xvj4aQu7M9G2Xe+Uj/AnyCvomfW+4JCvT9MnlNdDTIqeulfk2tSv+URDOi2BLNCGRS0k tEzplIIkngfkxH0kz/XFOAWR6FfildqElmIVDdZO0jqcN6QvJYqeyYHd3FSThZaiIGJ+ Fo7bQo85OfBcDQUPpLCZa1XCxaipF1JzHstROpC8z+N6uL6kB4QIKSHfyqeADL8vzJFi hOCg== 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=M7pV2CyUMGO3yGsmIUepIF4ySs2q1OUCPI8hTu4xRsk=; fh=YLzPKYCFxzrLaIXN402CJSoddU+ROYA46x80qlBKf1Y=; b=fXXlozjv6UGmfXb098fQZLqt8UDf5pZcqfi9xcdjPa/lzdM4vMUddAMrGX2rew7Aa5 cASmcMt135mRonyh0NBXua5h0s1zADfpOjGhms8pTAe58Nn08sZt924zrYm7HxVwM1+w 2jX6JO8DLmcnz4vcRlmQMa3/HKmFpGbIjpFFToU5uAoOanu/nCPF3u+CskdAhBtteDbs B1wqscd0HN1gjMSMqFWD6Eu+K1DfYLdoVjO4qw/a565Nv4vP2ALoMhPwb8XQKLWI6Njl 9E1XO1e77G2UD9N1b9Pq8fjbbepDhU58dyy/vHBkhvOhwkEBNGUr4Mq5k7oDhuB2mZe7 t41Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PNuW4y3n; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-57464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57464-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; AJvYcCV9QmLiEWVAc5SQTmduiZ5X7/twIyU6e4E2313B2HklAQr9GoK72PXK+/L3n4JG3J4KtyIODHGdH/KhPX0LufWoU+FXCCy9Q3U9h+euZQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ey8-20020a0562140b6800b0068c3dc8e55asi3054241qvb.0.2024.02.07.20.34.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 20:34:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57464-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=PNuW4y3n; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-57464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57464-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 A28661C23C32 for ; Thu, 8 Feb 2024 04:34:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D72C4679FE; Thu, 8 Feb 2024 04:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PNuW4y3n" 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 F16A5679E4; Thu, 8 Feb 2024 04:33:56 +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=1707366837; cv=none; b=ZMwvzCn03m17a3Tt+vp2ITxiq8p7rYW0bX/5Pc4RlA5sR7tu8o43NUpc80u6UzezbGLL5jIWaCj5hIYWc7tDMBWfLTFF77oLEM1hZl8w1sDM9+399ukwVf+8b2NMrmqBuswhmsezTPSKcrJARWf3N6RF7SCaiTZtweNNBCfqZyg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707366837; c=relaxed/simple; bh=C7j0tAo/NFqY6hcIUhHuuq4BNMXR+xMhI1f048lYM3w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hG2xo2wD5Fx3DgMRSZqFM4KZgq0FrH6RySsYeq1sbO6LX9COlwqLne6rlA1h7UQyoKijDIeqeFnLZ4qJdP4cK07EkPMMeFJFdeOmdwTi2Mwr1jCE8UhWMOc7j+9ZHjdKqosCv+lWg3UmjRcd4/LiK7W9ubAvC03w1pGPbtr2TKM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PNuW4y3n; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F5B0C433C7; Thu, 8 Feb 2024 04:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707366836; bh=C7j0tAo/NFqY6hcIUhHuuq4BNMXR+xMhI1f048lYM3w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PNuW4y3n7vxEL/aVwQa7NqH3jMfaa3e7Dbc6zjIgzS2BayymbNMfJl1oXl+3YkN4U dZZRp+mz1u06SpERwRHfZgiavY78SDMUfrSBw47skVMox0TuR+OiWsdirk7TF+ctmS pYRYwQXHZO3QpuC7CRauhCQ0o9aCaSJDS5W0TQ5SZcdyo48LAgMUkR5Ibgxj71DqAf 3WyPVbfUNa2Rb7NPEbdhAjPQWX2IXeqNmiCBNC0ryv90iV+svla21lLd8FNlYhAgT8 WLMF0xlxkJ+w8SYV2wBXwaOb1BborsqBD9IdWvIrQiyOrdXwytJNw7Vdn6C7SQSjt1 36o1Mv+nstsaw== Date: Wed, 7 Feb 2024 20:33:54 -0800 From: Eric Biggers To: wenyang.linux@foxmail.com Cc: Christian Brauner , 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: <20240208043354.GA85799@sol.localdomain> References: 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: 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. - Eric