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 04913E95A9A for ; Mon, 9 Oct 2023 11:01:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94CAF8D0055; Mon, 9 Oct 2023 07:01:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FCE08D0031; Mon, 9 Oct 2023 07:01:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EB6A8D0055; Mon, 9 Oct 2023 07:01:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6E7988D0031 for ; Mon, 9 Oct 2023 07:01:20 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 429E61CA622 for ; Mon, 9 Oct 2023 11:01:20 +0000 (UTC) X-FDA: 81325631520.21.4F7C799 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf14.hostedemail.com (Postfix) with ESMTP id 86970100026 for ; Mon, 9 Oct 2023 11:01:17 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=r5UjdL6x; spf=pass (imf14.hostedemail.com: domain of alx@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=alx@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696849277; 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=x93uBmLbim+K4za3OFmNlqK2CHfj8Lk9ZssSz+jZufs=; b=NQXrDrWqafUVUNHlJkn+jFo0j5jBZqLqmddVPwHpLhEx3Pk0+d7Ry2FXRU8Qr1/X1pexpH 4CQ+8MWtpqoVQ7HbSH12AFlusNm8z5m1TxFFet+jnS0f5S2xRtIJClWCAMrORVkDEUIfzk jh/r5eQWfz5ryI0W7yJYkFF61zXFjEE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696849277; a=rsa-sha256; cv=none; b=Q8/xuJcVMjGtxs6V3HO282a04kX0YH0mYHC3p+BVuxmc05H+YA/SWuDFjC2KcJ2friMmOA F6OoxJI6mqMeflTi8BoNvZauesBgJshwqwbZIoKTHFXXrqQcTpxtjhWw2+djZYnJKzY5YJ eYLRajfDijVN8U30jEVT61CnvSxv3V0= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=r5UjdL6x; spf=pass (imf14.hostedemail.com: domain of alx@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=alx@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 124B5B80ED2; Mon, 9 Oct 2023 11:01:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10713C433C7; Mon, 9 Oct 2023 11:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696849275; bh=GM6lil/Db0A1tuVrZOEG4FKtpcXLCTM68+3297DcxXI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r5UjdL6xkr0Mtjg6lUjJB8wIJq7fxLJqz6bbMvMnFwixDqF2H/JUQWeY0W0QCn0qi TRkgvElF2pKWNFe3u9J7BdZY7FdXhIFDj6ufpIL7rDsRyfjJ28aX1M/U4+nkFo+aG4 oEIAVPdOn7u6Y9aRZhjOOQQ5JtVB+iME2F8QKB69XBTzmCxJnJCxe70r7Oh2L0chTl t1kU9P79bIorKHzFGZPYjeHvH9kRj4LYVnOokLzpVHmKV5ITZTwXnOAhZcw0S1nTTi YYj4gui7iA6jXXEl8TAeEH8H/JRK8GcNNyz96mo/tQ8I28cHqti0/xGiaJKpqzvdBQ 73bl8jeAjw0vA== Date: Mon, 9 Oct 2023 13:01:11 +0200 From: Alejandro Colomar To: Mike Rapoport Cc: Axel Rasmussen , Peter Xu , linux-man@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/10] ioctl_userfaultfd.2: correct and update UFFDIO_API ioctl error codes Message-ID: References: <20230919190206.388896-1-axelrasmussen@google.com> <20230919190206.388896-8-axelrasmussen@google.com> <5ddepg57wqnidtvsio2pse44dot6pvr3rcmhwld6ml3sflwcz3@ijd3h4teqblr> <20231009084911.GK3303@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="DvgcUIV2tNB0f+sm" Content-Disposition: inline In-Reply-To: <20231009084911.GK3303@kernel.org> X-Rspamd-Queue-Id: 86970100026 X-Rspam-User: X-Stat-Signature: tqenn8za9txhci9d7henpsun4es5tcsm X-Rspamd-Server: rspam03 X-HE-Tag: 1696849277-531997 X-HE-Meta: U2FsdGVkX1+hEzVSFlQBaDeyli3mthqx0xKfrIYPVQmRwWQhkvmYl3+K0nLDVepLE2dScxVUP0SfIWwkZyaP81ShlpmZWdjzG1j221SFaqfauH9cEpBh9Tbv6jI+tPyUBR3SQ0GGVwxK0Ywy4f+OZ1Kh1z60FcEb80pqxVerIrkq6VeLJkOq9RclKa1F2cZpLqawUByYuYfXFo4qMcisMYwhvmn56W1L50NOMiEsn9yF6yjNUx4RUpfi144XHRT3WwaG1eKoBwLkaTJS+JhuBNjL4LXSuQm8Q8wG1U24gm53k5USkktKSAE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hbFEqn4/2XNQOul1oaLk3eQsSjcP9mdBwDkP6PkZCFD4AdCeZ65BscksbsZGNEmKgRawGaJhbip3SDrz5ABNSC/s X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --DvgcUIV2tNB0f+sm Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Mon, 9 Oct 2023 13:01:11 +0200 From: Alejandro Colomar To: Mike Rapoport Cc: Axel Rasmussen , Peter Xu , linux-man@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/10] ioctl_userfaultfd.2: correct and update UFFDIO_API ioctl error codes Hi Mike, On Mon, Oct 09, 2023 at 11:49:11AM +0300, Mike Rapoport wrote: > On Tue, Sep 26, 2023 at 01:52:34AM +0200, Alejandro Colomar wrote: > > Hi Axel, > >=20 > > On Tue, Sep 19, 2023 at 12:02:03PM -0700, Axel Rasmussen wrote: > > > First, it is not correct that repeated UFFDIO_API calls result in > > > EINVAL. This is true *if both calls enable features*, but in the case > > > where we're doing a two-step feature detection handshake, the kernel > > > explicitly expects 2 calls (one with no features set). So, correct th= is > > > description. > > >=20 > > > Then, some new error cases have been added to the kernel recently, and > > > the man page wasn't updated to note these. So, add in descriptions of > > > these new error cases. > > >=20 > > > Signed-off-by: Axel Rasmussen > > > --- > > > man2/ioctl_userfaultfd.2 | 24 +++++++++++++++++++----- > > > 1 file changed, 19 insertions(+), 5 deletions(-) > > >=20 > > > diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 > > > index 53b1f473f..1aa9654be 100644 > > > --- a/man2/ioctl_userfaultfd.2 > > > +++ b/man2/ioctl_userfaultfd.2 > > > @@ -280,17 +280,31 @@ refers to an address that is outside the callin= g process's > > > accessible address space. > > > .TP > > > .B EINVAL > > > -The userfaultfd has already been enabled by a previous > > > -.B UFFDIO_API > > > -operation. > > > -.TP > > > -.B EINVAL > > > The API version requested in the > > > .I api > > > field is not supported by this kernel, or the > > > .I features > > > field passed to the kernel includes feature bits that are not suppor= ted > > > by the current kernel version. > > > +.TP > > > +.B EPERM > >=20 > > This EPERM should probably be at the end. Unless you have a good reason > > to break alphabetic order. >=20 > I agree with Alex here, other than that feel free to add >=20 > Reviewed-by: Mike Rapoport (IBM) Thanks. Since v2 only reorders these, I've added your tag. Cheers, Alex >=20 > =20 > > Thanks, > > Alex > >=20 > > > +The > > > +.B UFFD_FEATURE_EVENT_FORK > > > +feature was enabled, > > > +but the calling process doesn't have the > > > +.B CAP_SYS_PTRACE > > > +capability. > > > +.TP > > > +.B EINVAL > > > +A previous > > > +.B UFFDIO_API > > > +call already enabled one or more features for this userfaultfd. > > > +Calling > > > +.B UFFDIO_API > > > +twice, > > > +the first time with no features set, > > > +is explicitly allowed > > > +as per the two-step feature detection handshake. > > > .\" FIXME In the above error case, the returned 'uffdio_api' structu= re is > > > .\" zeroed out. Why is this done? This should be explained in the ma= nual page. > > > .\" > > > --=20 > > > 2.42.0.459.ge4e396fd5e-goog > > >=20 >=20 >=20 >=20 > --=20 > Sincerely yours, > Mike. --=20 --DvgcUIV2tNB0f+sm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmUj3XcACgkQnowa+77/ 2zJ3OA//TkwE8xHpU+OC/EDqkSMUQlYNsehg5XZg6x3xnyvU5yoZM5IdN5CeUuZE LoCeoEVsPgtUSejsWSr9FvDm/pSydyuxl+STppA8xN8SvlXOFJqQi0XM4WC3Elgq gqzN0/yNsDN1hz3Rs+g0CqJdLuvkDu6+KAXmwxPzzf5AdGh6kzaGPsgDLmOnyB0X Cs287bja5vs54JuNYgnLV7fivotp0q6XzWuf2tno0AOLVNtbmEerHcTLU/haBgKc +34hrrNgf0lGStXv1uhM8uZC4vb60NyvvE+AfTthJ0kkC5nHxRQmJ6b4xEpjPSzR kndiMBC+Uq/kDGQHOaX6zgDVPbSjCUIcR9lhJ97QM1vKIFZJDovaj7242repcc5z ols8lYQXA6tfhNgsff58IH6B7ca69weAv2PxqtDCYunejkZpMwDq9YMKB9pcaNdx hKECDguag+FG1g9PY36fJjHzP1yiWVhW4LF48ECkuq2sjfFP83ZO4T8KEqxl4HkN ZuNdNRVIV2Xz9wN2gotn0g6KFgJwdfJik9Ul+UvSEjsUu8zuvyJFAupdUZuU3+tJ AgRc1dRClhSdu9CLT7utnRq8Pb2oYZjebNnAxClewtLptGpz+/uexUIsJ46sMXzJ o4qevWxEH/d9ICOEyQqke3Rp7ptcOBlUISjANeS1is98gC1W5zs= =zWY9 -----END PGP SIGNATURE----- --DvgcUIV2tNB0f+sm--