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 55F0BE6FE31 for ; Mon, 25 Sep 2023 23:52:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDF248D0058; Mon, 25 Sep 2023 19:52:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D67888D0007; Mon, 25 Sep 2023 19:52:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C09018D0058; Mon, 25 Sep 2023 19:52:45 -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 ADF498D0007 for ; Mon, 25 Sep 2023 19:52:45 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 83583A0789 for ; Mon, 25 Sep 2023 23:52:45 +0000 (UTC) X-FDA: 81276772290.06.36E2F0F Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf10.hostedemail.com (Postfix) with ESMTP id 3C661C0002 for ; Mon, 25 Sep 2023 23:52:41 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=C5+tF4bi; spf=pass (imf10.hostedemail.com: domain of alx@kernel.org designates 145.40.73.55 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=1695685962; 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=Y4MSIUIAC76ucGUH6q71RUs+DfD1vpqNb6GeIXYGmDA=; b=iQ//eo1oGbuU5QA7KGZUu/7qUBl/j8ppVkFL2BJFwvTqVNwBMerN1DrEKb9t5zQcEnj8K0 Z0GQBOr7CDucm2QTiC1/EmYagpzIteBdWD8M2k90ZryfmovnhSa/pWRx0BdH92f7yb5+XU Kj4oZg8GITpP6Wn8Z+HI/1dVuJ95YEY= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=C5+tF4bi; spf=pass (imf10.hostedemail.com: domain of alx@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alx@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695685962; a=rsa-sha256; cv=none; b=LhmQ7dsi9CbEvLsTtaWmqH391W1FrY7tf339nNAjlBWP/Bf8Hr4eadh1a4qkqpBa6XNfrM 8ju4T3+YE2Sq/9IOzYarC2ZIKCqMsUsc2rl/dQHWClTva9yU1bcdLmDjK7W88OyRW7udly 1SHPdIGSyrh/pgyyOs6NAumXEkwg2b4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 64CBFCE124A; Mon, 25 Sep 2023 23:52:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E90EC433C8; Mon, 25 Sep 2023 23:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695685957; bh=+IaHrNrOxLOD1YS6ga2A3hF6ROVR2Bld68y96OWaFR8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=C5+tF4bilx1bDbrjbn6CjV2Jqd8sexFYVppGHx6VERRComb8mTSbKMSa+s7qJb6m2 FJD9Qg1j9hspw/4/DyBucE7S1ICBuZeEahGTp1I3Ej1iO+g+844hOO0hBJ8HsCvL2G 743Ugzp9YtGG9hV+03SZ83ObmNqIMT8uYyVYTUBcdUhyyRCOLIZyMGrGM04+Cq2/Hd JLHBZZNS53F+L65kG1qH62Pqca9OlzZP+KW6ByUIW78xvnXDrAQ9/D92oU0x55F4fC 8TiyY4WRpGsa9iKSweKnA1Y1jGBwiKsomM924syyCqWdCev8dLoNvrDwj7q4iINOIy GS3hc1yyhf3xw== Date: Tue, 26 Sep 2023 01:52:34 +0200 From: Alejandro Colomar To: Axel Rasmussen Cc: 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: <5ddepg57wqnidtvsio2pse44dot6pvr3rcmhwld6ml3sflwcz3@ijd3h4teqblr> References: <20230919190206.388896-1-axelrasmussen@google.com> <20230919190206.388896-8-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sfquo6rq2unvsafx" Content-Disposition: inline In-Reply-To: <20230919190206.388896-8-axelrasmussen@google.com> X-Rspamd-Queue-Id: 3C661C0002 X-Rspam-User: X-Stat-Signature: 11p37n67k5uikh9anp9853rk1mfyn646 X-Rspamd-Server: rspam01 X-HE-Tag: 1695685961-587645 X-HE-Meta: U2FsdGVkX1+SvVxatCYAIZqN9qV91wp5+ev9gxOV4DBNKo68IjxfY1htb3THdRyK7avIK5HAgO+j8tGWCIm3ClNMj7F1ierZvGnathv6mS7sJ8j1DOK0YqA+PuwloBQ6ZkTOMcs9g04MiJa5lYO/AuIQSRTj3R9NqTO2apT0Xp9yUXwBoVGTv3+bHm/+hMn8yDjuqIL7z7o53IHagmJspzhRCvb5bywIr+VWqyfBExfbleYAjSBxRkiNqcJU4/PhKdLpR30nLtxyBbRNaehJieRSsRisCvY1uvIUEIdqT+ahzlkamndQEqv0JXkfY3n89euR2MDyDRCnDnXeFNplX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ence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --sfquo6rq2unvsafx Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 07/10] ioctl_userfaultfd.2: correct and update UFFDIO_API ioctl error codes MIME-Version: 1.0 Hi Axel, 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 this > 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 calling pr= ocess'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 supported > by the current kernel version. > +.TP > +.B EPERM This EPERM should probably be at the end. Unless you have a good reason to break alphabetic order. Thanks, Alex > +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' structure is > .\" zeroed out. Why is this done? This should be explained in the manual= page. > .\" > --=20 > 2.42.0.459.ge4e396fd5e-goog >=20 --sfquo6rq2unvsafx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmUSHUIACgkQnowa+77/ 2zJvng/+MbsU5MfmXIe0erS8L+2Cfzvvt85W8o6bTu7AEasSaESg7NtFhZ6wyQSk tJcmVIh4F9UeVBwvs77EOapbDrcZuw0MfExT66INr0bxhCcZDEar3sKW6V9IDMYf EgOaB83nGebwIkIU0nQNCZoBwnlnlGhPygmOl10IFwdSYV+Q/hkUFOY/5vLlSvdI /kOSyq1S7r99I5EydbmZRzxlYtGlCoIiL8PuFtZuDv1JzpxkqL9gFDHIkkINfEcG MhmMLi00ERAgWA3QQcREXnx7wI39mWthNHPTXGxkpdIDTVFfWJQ6uJdLpPAblU6z /bnmX1ESYvOxBv/JgXExFu6dTZ2IeqncdOjwWdwrF3+E8lTkaMC+6S24QLYO7OBx PESaaXkSdAIkTg+sgQQSdDdWIJJKlh5b9f5fUMIZaUpMhWkf2D9xK2aqvfYUP7od 2wV8iLjO/AGH3jopaHX+91lablgztxQSwGegH6X83PQSGpy946farEiYU0CT7j3y gUk8UY5p4g2OIJqvQoPEkvTeU+bx1aWwPNJ4YdrlQh5oQaVNlHSMzqa+HxONJ9G1 K8WFVJyoMpiryQf49Gpvp8MBzmlilNB1zox2mTx/cDqJJPwKt/qE1/0ON0xaLJ+i gp2ra6xS4+a8EjbPLjfbFQSU7GBJJje8/yoxKB7nTVGwYEdomh8= =I/3k -----END PGP SIGNATURE----- --sfquo6rq2unvsafx--