Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1761007rdb; Mon, 9 Oct 2023 01:50:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHz5ULXjPwY0N8ro9Tva529X+tZ/a3mRMY5xVSI6O9vtS7rISeAYml+hgu/IpDO0uJy5vwd X-Received: by 2002:a17:903:2352:b0:1b8:8682:62fb with SMTP id c18-20020a170903235200b001b8868262fbmr17719676plh.4.1696841424826; Mon, 09 Oct 2023 01:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696841424; cv=none; d=google.com; s=arc-20160816; b=Gddi5Q7bOXmfOalQ3YczBQD6RVQ/pUQoBJ6OTToLIkvW6ungkuF3TN2vZSQqF+yp0c gg+BV6poLIrr56nY7DJhai3r98vtcpiYmMnlf2nLJnsXEjJUwePw08n1uR8MCCBLIwPa DqdgP4K/LFt5u7MI1AOd1zPjCmGewsi4Q4VDSnTVusJz/cTkk34mpA7qX9XFezVPhXrD 5zI8CZ68OLu2AfNP0WisQNpoS5NTSQun0ZD5ldAaBe9LFolO9P6stjAcbnZaMWEcou4l HoAgsHVyGsutjCXY+2Lhp04RG66fYLpEKdu/QoJKJ7TXloKZUCS6luxFC8Lx3iJarCA2 OG1g== 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=awWpB4uK8XPsYxQLy7DRlOQtBFqer/jJisyGCXxLoO4=; fh=BWbWfT91ZoObkyv/CUh2YcKncoGd0AN7/sDhs+nlN4I=; b=osN5Nw6b1nn9GChok3K5UUT6NLZgkYwLJtxt1+afu116ke+terXpYXLPBqpXns7heN UJLcMyDuvAVfL2DhgVb0U5+FAvwKt3jyOGko5Pa5RKFvYyFQyvZwMeUFrupg18KTbVVp iZSqVWeFcWPDyFefXqicBV4Z956nT5uC0sPhA8r0YkIdPH3Z4UOcW62g1tKk5MSGPE86 euVnxcdswimj/vmCZ09os9hXdmNH5w/dHqU2f8uKGJeBaLkj9hfgSFpgaWM0cHRayp94 vfMFCPE5JaLHM3kmIzfgk6j0n18uGKX6zrafEOUlARjyAj7qrH/PnuHdogtdrKxRO/Aj HUTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bsFIjY0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l71-20020a63884a000000b005891f742953si8998699pgd.29.2023.10.09.01.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 01:50:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bsFIjY0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 59A1A805D5C8; Mon, 9 Oct 2023 01:50:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345551AbjJIIuI (ORCPT + 99 others); Mon, 9 Oct 2023 04:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345549AbjJIIuG (ORCPT ); Mon, 9 Oct 2023 04:50:06 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 773D0B6; Mon, 9 Oct 2023 01:50:05 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08C01C433C9; Mon, 9 Oct 2023 08:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696841405; bh=v/wmFXeFO8DxY0ma5UxE0sJMP9dgiKFa27sxu++CIu8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bsFIjY0VLVYQaqLRnSrTz6IwoA0CpE/WsT34CJe9hMZyePmmJm4Eh35/kWXhW6GiJ B4mKBygdefdqEK6Tpgrteu7YfB9jKMBN0mpAHrTivi7q5ugHo4NKTUk1xYYXHpa+jN QjoOdTpg+Tf/h0rj9ZrhFHLHUDpnnq7lr6vQiMby+f6pZC1xWbAAYu8sPxt5FIAaO+ Vd1Yji1o7N40FlZtJ0UBfd79LNJ9KKumOYm6uMvWrds04P6rGydA8rB2mffzifBs8w eEbk0a/2BZ7yJi1WFjCebFxQkr5bthgJTwtQbZ8JRmoLaucs/R3bU09gfz0wHKnOMN 1azUB+Nsnbd6w== Date: Mon, 9 Oct 2023 11:49:11 +0300 From: Mike Rapoport To: Alejandro Colomar 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: <20231009084911.GK3303@kernel.org> References: <20230919190206.388896-1-axelrasmussen@google.com> <20230919190206.388896-8-axelrasmussen@google.com> <5ddepg57wqnidtvsio2pse44dot6pvr3rcmhwld6ml3sflwcz3@ijd3h4teqblr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ddepg57wqnidtvsio2pse44dot6pvr3rcmhwld6ml3sflwcz3@ijd3h4teqblr> X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 01:50:22 -0700 (PDT) X-Spam-Level: ** On Tue, Sep 26, 2023 at 01:52:34AM +0200, Alejandro Colomar wrote: > 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. > > > > 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. > > > > Signed-off-by: Axel Rasmussen > > --- > > man2/ioctl_userfaultfd.2 | 24 +++++++++++++++++++----- > > 1 file changed, 19 insertions(+), 5 deletions(-) > > > > 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 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 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. I agree with Alex here, other than that feel free to add Reviewed-by: Mike Rapoport (IBM) > 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. > > .\" > > -- > > 2.42.0.459.ge4e396fd5e-goog > > -- Sincerely yours, Mike.