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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3A9DE95A67 for ; Sun, 8 Oct 2023 22:06:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64A056B019B; Sun, 8 Oct 2023 18:06:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FA236B019C; Sun, 8 Oct 2023 18:06:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49AF76B019E; Sun, 8 Oct 2023 18:06:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3996A6B019B for ; Sun, 8 Oct 2023 18:06:56 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 688151CA417 for ; Sun, 8 Oct 2023 22:06:55 +0000 (UTC) X-FDA: 81323679990.03.A48F10F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id B295CC0020 for ; Sun, 8 Oct 2023 22:06:53 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=V0K1LsS9; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of alx@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alx@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696802813; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3jTvlHEeSvRAOw2Mf/zQG8Jap3P9mqDNG7d5FScCIbg=; b=QtU8Dj3NUJ7oZ2Kkon8I8wfbeJxp3zS6/g6WQgSei8U3cEuQaKqZvN4CuWPbX4MEfdKKYP k8ZYm879p7VulilRqwsUxLM/oUvRYEeaFIHndReKoKoVXHIHQKppbECmMZfaoGAfHC7EIF W1zeWR3ulyJA0hEzaJeEnENf1qh8+5E= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=V0K1LsS9; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of alx@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alx@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696802813; a=rsa-sha256; cv=none; b=1btxBH5p1N1iUxphF/if9MTDY9JbKPRfyNA8pQ/bBsI2qS0NoVXsxGi+QyAhJP9xnKO7cg TYqxnBAfCww0YVcb6KmTEeXUk8MnWQ1fx1Sr/hpd3u2iftjsWicDLPIKJr/08bRFug0YCp zgAz5ReJax65CiY5dIC8VhSAQ6WlXpY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A58FA60BB5; Sun, 8 Oct 2023 22:06:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC907C433C8; Sun, 8 Oct 2023 22:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696802812; bh=0pgaCqdeAC9oYqQwp+fAUXWfLCkTVfVj142U7LMJu84=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V0K1LsS9IXtU23mzJmfuhi6jxvIg8Plh0RLghOkBmWceExoHskC5FMPI6uqMcWB8v X51m1BBL8wZgwVXNTOUt6wNhzxzXHdPgwUb7qglsKpvmczVnW07APA/LNFGGxD/jOL Pr7lp51wRtBk3Il7rpgePvQDn0umhi1gv2vf/vekY95WHT3m2bIU9uRq333mXXqobL FYs1B3yE0wNNnK1b2JvqNsL3jnu2hqVjCX12r5nxFuHlxnneA5dXgPp6+WWQOXEpJ6 ERVJesAPIfpVLpnB6AHeHqw2BHCoKbCJH8P8hGX91c2x7G44R4KCJnlOk4tvlR7I8o Uf0Sy1ay3yLyg== Date: Mon, 9 Oct 2023 00:06:48 +0200 From: Alejandro Colomar To: Axel Rasmussen Cc: Peter Xu , linux-man@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: Re: [PATCH v2 4/5] ioctl_userfaultfd.2: fix / update UFFDIO_REGISTER error code list Message-ID: References: <20231003194547.2237424-1-axelrasmussen@google.com> <20231003194547.2237424-5-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ZX3Bwr4/cWeWkBvg" Content-Disposition: inline In-Reply-To: <20231003194547.2237424-5-axelrasmussen@google.com> X-Rspamd-Queue-Id: B295CC0020 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: yy1zw6uakgetb9w59wu1wg84ts6xfojk X-HE-Tag: 1696802813-341912 X-HE-Meta: U2FsdGVkX19EPFIll4MPtbcSNb5y2PJfqh/QORGzOg1fFVCV0Ss+xYYxbeNRXKT8ZImle/qguV93HES7ZI+8IoI0I6WYeeUQlBw/DLuSYcYdL8uEQ6loPPRgC1jyfvHqnr3asezPoX+B7vqJXGVTsDrsVDiBOXdr7Qf7GgfEhXCDI/G8UAY/DF98R0N0VrDfQlnwAooXtUtnC/V7VOq7H5xXyMGV7spPOH4sT8gp7AcxfD7H1dpITcuBGY9iJBBHwjzTrKFc4LE3zOSe4gxF4U1uNXrNkrUeyyA1aAMDGEkBiNHXW5L1eb7ADizKE6ye3cOpxtiCSxI6ZC3L1ILK4k5zEhy51gxdjzMuTR2T+gofQFGIo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000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --ZX3Bwr4/cWeWkBvg Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Mon, 9 Oct 2023 00:06:48 +0200 From: Alejandro Colomar To: Axel Rasmussen Cc: Peter Xu , linux-man@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: Re: [PATCH v2 4/5] ioctl_userfaultfd.2: fix / update UFFDIO_REGISTER error code list Hi Axel, On Tue, Oct 03, 2023 at 12:45:46PM -0700, Axel Rasmussen wrote: > The list of error codes in the man page was out of date with respect to > the current state of the kernel. Some errors were partially / > incorrectly described. >=20 > Update the error code listing, so it matches the current state of the > kernel, and correctly describes all the errors. >=20 > Signed-off-by: Axel Rasmussen > --- > man2/ioctl_userfaultfd.2 | 37 +++++++++++++++++++++---------------- > 1 file changed, 21 insertions(+), 16 deletions(-) >=20 > diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 > index 2ee6a0532..95d69f773 100644 > --- a/man2/ioctl_userfaultfd.2 > +++ b/man2/ioctl_userfaultfd.2 > @@ -388,12 +388,6 @@ On error, \-1 is returned and > .I errno > is set to indicate the error. > Possible errors include: > -.\" FIXME Is the following error list correct? > -.\" > -.TP > -.B EBUSY > -A mapping in the specified range is registered with another > -userfaultfd object. > .TP > .B EFAULT > .I argp > @@ -408,21 +402,32 @@ field; or the > field was zero. > .TP > .B EINVAL > -There is no mapping in the specified address range. > -.TP > -.B EINVAL > +The specified address range was invalid. > +More specifically, > +no mapping exists in the given range, > +or the mapping that exists there is invalid > +(e.g. unsupported type of memory), > +or the range values ( This produces some unwanted space. Please apply the following fix to your patch. diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 index 6e954e98c..795014794 100644 --- a/man2/ioctl_userfaultfd.2 +++ b/man2/ioctl_userfaultfd.2 @@ -432,11 +432,11 @@ .SS UFFDIO_REGISTER no mapping exists in the given range, or the mapping that exists there is invalid (e.g. unsupported type of memory), -or the range values ( -.I range.start +or the range values +.IR ( range.start or -.I range.len -) are not multiples of the relevant page size, +.IR range.len ) +are not multiples of the relevant page size, or .I range.len is zero. > .I range.start > or > .I range.len > -is not a multiple of the system page size; or, > +) are not multiples of the relevant page size, > +or > .I range.len > -is zero; or these fields are otherwise invalid. > +is zero. > .TP > -.B EINVAL > -There as an incompatible mapping in the specified address range. > -.\" Mike Rapoport: > -.\" ENOMEM if the process is exiting and the > -.\" mm_struct has gone by the time userfault grabs it. > +.B ENOMEM > +The process is exiting, > +and its address space has already been torn down > +when userfaultfd attempts to reference it. > +.TP > +.B EPERM > +The userfaultfd would allow writing to a file backing the mapping, > +but the calling process lacks such write permissions. > +.TP > +.B EBUSY > +A mapping in the specified range is registered with another > +userfaultfd object. Why would you move EBUSY to the end? Do you see any reasons to order it that way? Thanks, Alex > .SS UFFDIO_UNREGISTER > (Since Linux 4.3.) > Unregister a memory address range from userfaultfd. > --=20 > 2.42.0.609.gbb76f46606-goog >=20 --=20 --ZX3Bwr4/cWeWkBvg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmUjJ/gACgkQnowa+77/ 2zJN7hAAm7wo2fbdDYvR3+ZwXtzAbAyd56Hr86xq4WlvzNVY8NMqnniq/PEi8f2P yrYjeIoY6I2lIbHpM3Sh2GREALv6TfoIxaGd+6460sukgH0AxppnTjGZuv0U+rRm C3leZZGuOAdvYeAnxIXnK9k4/35HM4KDfkTjh7hO0OvcuXU0e7UlYapm0A/cpAwM zNBDIXgM9JL5nKKOWxFoMNCm5cK+NH9xqq0on0EYkbk5O3dJp7UXzRmjzbP+uNl1 2XVG5hdfwH8BMLxYjdqcNXl5t9rvcEMHdE2Om+c/M4FLvlsax0IE+wAV1WgPn7xm J928Z0/a7wwIYqvZ9cM6gmqiD6wEgebQ4C2n4BAK/yMB0ukG21EZVPpiRhEvpmI0 LOYywyxxTI4a1VZxEka/lHBrCemWloylMADbMMtnm+V1ctRo4BHq71S8UheoqFQC w2cHhYxPTCxRum1BgxAeTvTlCbYzYG7O2aEl3y7bNFWKvIKyCxs6e6OT5+o5nwoN 99YMdh8bkBkRk3dm7gvqzlhJYmJoVYj+yFzTXDq5oif/8zh9oB1qGzRIhNYj0/7T 2br7FdLGNMwlDW1maUKqqbRutvxdZOU5VD7DnlLPJgU11nqaDPQhueNp3aR2kTqS cVaVUMoe/bg8gPRSx5YOSbMkE0R+Nwxo8/W3ywraMrCvih6l7aY= =/Xp5 -----END PGP SIGNATURE----- --ZX3Bwr4/cWeWkBvg--