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 DF417E95A91 for ; Mon, 9 Oct 2023 08:50:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DC7D8D0021; Mon, 9 Oct 2023 04:50:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58B598D0001; Mon, 9 Oct 2023 04:50:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 479AE8D0021; Mon, 9 Oct 2023 04:50:09 -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 35AB88D0001 for ; Mon, 9 Oct 2023 04:50:09 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0B3E1A0147 for ; Mon, 9 Oct 2023 08:50:09 +0000 (UTC) X-FDA: 81325300938.17.C1C43E0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 43B4D40008 for ; Mon, 9 Oct 2023 08:50:07 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bsFIjY0V; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696841407; 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=awWpB4uK8XPsYxQLy7DRlOQtBFqer/jJisyGCXxLoO4=; b=FfjWkIAitQUkjOA7iGtt+Rv6huyc9KSEuSnx+Rez4puId8JaxJkRBPWfF6wVZogUA+vF0a 8mcU3Ju+jrdFGkCegFBUDGP3BBiDuSZWMQHNJXWvP+YjPOQZakrL6Dcy37KRKBwkV4WBeB w78HJq8JGohKhPyAHdV8xGkviuimfSQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bsFIjY0V; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696841407; a=rsa-sha256; cv=none; b=K8O65+qo8hZEwtw4u85FhKrRiZql/lJ2rCLfR0IFLtcTTIXNpBun3v2exEXnhE9wYLOfiR Ls7xwH2j3y2boarFX5IA+eYRJb7ni+aTF4fn+/vJSaSq1juDEnqj9A1Xg3tJBfoExINF5S HUMkhZZavWNVjNWud0BZDC+BQfM0zAA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1312C60F79; Mon, 9 Oct 2023 08:50:06 +0000 (UTC) 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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 43B4D40008 X-Stat-Signature: s4c1u9bn8yukndbdi7633b8ydryco56k X-HE-Tag: 1696841407-67935 X-HE-Meta: U2FsdGVkX1/YgJITEcM8fRzTViWOM72b/IeSD8Upf0QyeQ+0Wmp7TfpVTm9WuUMIGCgTNnRJL6Rv6eMf7uVhQS2Nd4EP2lFSN5DQgdRmZVaIejtd+dVx35axXBbT5REIaE2h/3A/+Nyru2pRIsdf0IRyGObOfPqh+2vAk/DgunvOjso6wG0aj/j3Y5Nrg126GHD4kMxO+pAhsJ3fCAi4uvHALpqRxzblQ0SAFaazglbaU8NFoxmqgQ9IhEw6ps2aba4JWZUBOGK4T33/oLHoTDm3PbvDD55FvsWR5lYI5X5NvjxT8nGhaatExWRzTLx6SypUJpg4jhzJeSCAwiDnH+aeObuKF9A/9BfmM5hxRNXgxXnix9GngttdQ1JRIGl0Bwrgu681HR21TuBmWjYmMVxt9+z4RhkNcf45vsib3WuPgVQPYzS/JnBIsWy46iSsUTdaIXfKilWnMZ6PCYInnRHwAV9I0TuH8IuiIvdb4EF/z86r/DvaHJYVK6QPHB0OFz12RKeyWICzK+IM90/TG7fuK+prTFdPJBQa/qD2T/5XuddXMNP2LcKsDXHcADxV+rK39XYEJq+S1+rgG7omt8xb5nXDV81Nz9Hnp9IPluZP2MpIrkkaC9ekChHj/3Izxq3t9yKgkR+nmrTy7MzLloRoKMsTfHQWlN7K18MRzacBKTFgxwVNFJWhEfNHkguKfw8551F4x17p1OUywsqEX8x+P4BWZ2AMdQ28TvqcEX0cH4ouBvgmxuoVyFYDy1idUXeWKfuH6YPXmg3rAVi0iCh1BjYMOKRuivd6D/pj7OwDrE2koZ14BzkWap7hz8K3PEF31W8HYrbIHGm1gZcKxy9JoGH67CoBKRF0I4Pj0GK2kr1eK5J0csEiZs3GgidZtrut8sYW378hkVLo/A/Wd6XO8gVknIyQgQ8ACAgrauxydJOzXtm6SukViPOeys+ZmJaVGBy4ESbKVa5+OQH LTmh/RjS UysNap+bVc7r8Yw7zMnFUpzNQ4k9Qtx7Ljr6KRVWkEYWPgZgeJ1lIKFYP0XtmHA63SNMyIxIoCulZj7usC3HS3tGw81uzVW0uxqBIYeIFzkg0CJTWJhcFGnM/A6WjagvI4W03Q3O0npFBAfyvmZAOghpHBYtBiwHT8K1T7l3WVg3Njm6AE4RHx/RDYjAXZVt5sNn6PXXSpXU8Kakm1xJP3SN3oeKu1FSf3zw9pIeVmRrKqSAnR6tTEpwOwClAxv1Wm/y3o7KH+ZCIAHdWmyf0T9c1C15eDCALlBsRETNhj1uwpG4TLvDPP7OStT636TkEfhm+ 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: 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.