Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1546096rdh; Mon, 25 Sep 2023 16:53:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTO4HaDk6e658M3X2rM+FJeiRzCz8MNUlqjdIxeLX0vKkmQyu3ygvzrIsYkXX8TrKUNdUS X-Received: by 2002:a17:902:a714:b0:1c0:d5c6:748f with SMTP id w20-20020a170902a71400b001c0d5c6748fmr5205392plq.67.1695686008649; Mon, 25 Sep 2023 16:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695686008; cv=none; d=google.com; s=arc-20160816; b=miv0XtnbEQ3x8WbRWv18URyqG9Lc9jb0yMqfjTeRcZFSBaCF8NS5/mpdX63A5JuSAj fSqOBA7ensqQcxD6c8Anzh/627+Z66phVJNl7AopnSAEfBbxUb21ALINERqfA4MImDZ0 h3LC3oown3pV/3uIkBjaRjl3WYvgcKR9m/JI+x10UjtrxO2oZFv73u+/qMBQr969X1Ew whf+2lyPJWyQhwpT2PtuS7FzK/qM43imQtyaGy4SAQJhf3V5WG6PqVbf1x3lNb8ZthRk xY3qcZqeD9aHiKHrJbZlFSs+SK677eMkpz9ApK/LQlKogs8M7Hi1/ueUqeXX1vgKL37r +W5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Y4MSIUIAC76ucGUH6q71RUs+DfD1vpqNb6GeIXYGmDA=; fh=wtPNz5QEtytCPPuNNoj9k3ZLKUvhc5S3xSbNrMwZr3o=; b=ffBRHmM8AmbbLZWIVRgm/5CPH3qTj5KTIbboDMtqKzK2P+kUFo4imBmXySJ72wQKP4 dPL3F/iNUzpzrHjDZSrb52zDcb+/ng96kgk9vca+afhlByjyDT8ZFZYO5dZtDOVQxtER ox8ltQC9umxF7khlUpeDK3Kg4XJJRZygxAScFYxeU7BuFBYDeoRN40nHYnfGussBSonc 43IZ0mY6d7WYCEgTBCNlatQzRiZFkAt3Tx14P/4d0Ln+4K+iyfX7gP7enXAKi03vjl7f K+g893GMSn8B+hxm9jWNR5vkiuZHOxu/TgWVkYxPj4sfthQ/motM83C2xZ5gVtddUNWB CyQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C5+tF4bi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id m9-20020a170902c44900b001b3bd85f54bsi10572591plm.35.2023.09.25.16.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 16:53:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C5+tF4bi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4DB2D8027EB5; Mon, 25 Sep 2023 16:52:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233600AbjIYXwq (ORCPT + 99 others); Mon, 25 Sep 2023 19:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233592AbjIYXwo (ORCPT ); Mon, 25 Sep 2023 19:52:44 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B15E124; Mon, 25 Sep 2023 16:52:38 -0700 (PDT) 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-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 25 Sep 2023 16:52:48 -0700 (PDT) --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--