Message ID | 20231003194547.2237424-5-axelrasmussen@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2313156vqb; Tue, 3 Oct 2023 12:46:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElvndjK0mQ6hzy4fRu8fHi3PlJ9TQ3kV5ExwzS4KIn1lTzJFdXRh6RC0gYUuqhfxP7k1WD X-Received: by 2002:a05:6a00:399f:b0:692:780a:de90 with SMTP id fi31-20020a056a00399f00b00692780ade90mr514303pfb.30.1696362400801; Tue, 03 Oct 2023 12:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696362400; cv=none; d=google.com; s=arc-20160816; b=W0hHowfhYlr+uh17UxmVanlbUL805c5bs18xaac6HRAVwrPyHdpiGIFvwD87wspprS CwJ8F2NPzpcFXTIKCOWCnnJvZDM6dpMQp5C/6ZjInKfbn9LKY9AvxlYhzuAML31YXJPN x2oeUvM8/Ls8zv/65DKkNP6Lbc1Gx91HE9ld8W5XS5pDPfg7tZRHwn+h5ZmLJGVhvVG+ zgq5wgfQ/iqQIOtBNVhWBrXbxc4g4UJ3PwrNS/rPAVXZUNeoY1E0k4VGiNuP1/iOA/Cx RLt0Z9F2W0yrxQ5nTcS2u37emzQz2gCyBtCFaJwXyMcjg3uB+eojhUwIcx4TXZ5LyNF5 pLbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=KHojRgQcvHJlG3tNkbT5JYy4vaQ9RVgTVjOSA6AH+sQ=; fh=SqwPTGdhTS3wVH9FltNQ4n/lDM1p3ApEDnroT8zra0U=; b=MhHHv9MANzePqmuOvfj0qPgQX5NTZPqU5M4rrbZr/Q5Hem51JRl8Iswv6sFwqnWIiy dNIsDxVJ+H/H2HoUR9sdGZLnhqghy8R1gt8ew/i6qpdwmyy4hiM7+4TYrFOoabNPZPvn d2DhU0KNESJn7Rw5UQfiejQvhDK/h2gIAO1E9ICdzdVYj/D8wNjdvSsDGjUPU1SEts56 eacB+VLrlJCBjpwyRHTTzIMYCNQC0XxyAiFtjN9uiBIsBT+IHRgkm23N03BCnH65/jsr Jpvv3u8m4yuuT4RkFX2u3QP9p/p6bYZ8/mTSK9yAaPtPy6qZp88Mn9Mz6jd20VdCq/yP jcSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XiqKhHZP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id br10-20020a056a00440a00b006910e8e46e0si2121183pfb.371.2023.10.03.12.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 12:46:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XiqKhHZP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 469E5812047A; Tue, 3 Oct 2023 12:46:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241019AbjJCTqM (ORCPT <rfc822;chrisfriedt@gmail.com> + 17 others); Tue, 3 Oct 2023 15:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241001AbjJCTqH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 3 Oct 2023 15:46:07 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8968ABF for <linux-kernel@vger.kernel.org>; Tue, 3 Oct 2023 12:46:03 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d865f1447a2so1687926276.2 for <linux-kernel@vger.kernel.org>; Tue, 03 Oct 2023 12:46:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696362363; x=1696967163; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KHojRgQcvHJlG3tNkbT5JYy4vaQ9RVgTVjOSA6AH+sQ=; b=XiqKhHZPLH4u07w/7Cv0397UGeq3riVtQ+6IopmmJTx1IBU7ENDtd36FIaIzzriX1l TRm4vEBzWPhJiMhlKZCS5fPNxbIwFPk36izfGFF8VsrnWr8CiTMLpiO1CkXo9T8C7JzS YopAEjxgCBeokfCuu3mE/nERXoSs67zRnWtwx5xqgSOhWXE07OW5BT6us0Hp7VFT8S4V qrQBpym+hI9XtEMnN4pgQmOINSxTQioD1xzrzsqODAuQa2vakzXLZPWIY7MHC5+Y8drV UYC52RHymY2pjv65CMfVikh8SYrTxNWNyAl08YDJdsLyL28b/bv9mQAjpRDRbyPz3dAe 13vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696362363; x=1696967163; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KHojRgQcvHJlG3tNkbT5JYy4vaQ9RVgTVjOSA6AH+sQ=; b=eoBpoMgSZVjbxnY7ZeH1HiBDjH6nXGE2qOtqyoBWraK+K7w3Z7/dJ4tiirsb7AunuF 6MItxV9u30XmL9CVEozEPRw9GC/MNJF8VWhtG73ckLU1z4N6yASy1tctQYTOXBA3Clth MRuC3Val3xfb2UpZIcUwxyYMIomDZGyj0Mk4+B3knFd3JsVae0Coss29JAvCS3/PFhq4 /GO+RR6APf6lVEqQbwwN0kD1sH76OiJqrdizHFtxz1PvXI0arVYJ27tfcfB0No/eldoH 3mcML7nQt/5qgHoepTd8T4hp/4dMnCEkZzNWNIQN40RvLW00e1AWXlC/C70M8G3MvTqz Pk/g== X-Gm-Message-State: AOJu0Yx938LzaAgWtMOnikOEtDoth0cWo1/sK3uimRsVHv2RGRSlDYVF 5EEK0PQB05Wg55tHBrYDVdJT5Doy8aiPe29HADXl X-Received: from axel.svl.corp.google.com ([2620:15c:2a3:200:6577:b8c1:dd2d:1c93]) (user=axelrasmussen job=sendgmr) by 2002:a05:6902:212:b0:d89:b072:d06f with SMTP id j18-20020a056902021200b00d89b072d06fmr3912ybs.7.1696362362806; Tue, 03 Oct 2023 12:46:02 -0700 (PDT) Date: Tue, 3 Oct 2023 12:45:46 -0700 In-Reply-To: <20231003194547.2237424-1-axelrasmussen@google.com> Mime-Version: 1.0 References: <20231003194547.2237424-1-axelrasmussen@google.com> X-Mailer: git-send-email 2.42.0.609.gbb76f46606-goog Message-ID: <20231003194547.2237424-5-axelrasmussen@google.com> Subject: [PATCH v2 4/5] ioctl_userfaultfd.2: fix / update UFFDIO_REGISTER error code list From: Axel Rasmussen <axelrasmussen@google.com> To: Alejandro Colomar <alx@kernel.org>, Peter Xu <peterx@redhat.com> Cc: linux-man@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Axel Rasmussen <axelrasmussen@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 12:46:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778764901097510469 X-GMAIL-MSGID: 1778764901097510469 |
Series |
userfaultfd man page updates
|
|
Commit Message
Axel Rasmussen
Oct. 3, 2023, 7:45 p.m. UTC
The list of error codes in the man page was out of date with respect to
the current state of the kernel. Some errors were partially /
incorrectly described.
Update the error code listing, so it matches the current state of the
kernel, and correctly describes all the errors.
Signed-off-by: Axel Rasmussen <axelrasmussen@google.com>
---
man2/ioctl_userfaultfd.2 | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
Comments
Hi Axel, On Tue, Oct 03, 2023 at 12:45:46PM -0700, Axel Rasmussen wrote: > The list of error codes in the man page was out of date with respect to > the current state of the kernel. Some errors were partially / > incorrectly described. > > Update the error code listing, so it matches the current state of the > kernel, and correctly describes all the errors. > > Signed-off-by: Axel Rasmussen <axelrasmussen@google.com> > --- > man2/ioctl_userfaultfd.2 | 37 +++++++++++++++++++++---------------- > 1 file changed, 21 insertions(+), 16 deletions(-) > > diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 > index 2ee6a0532..95d69f773 100644 > --- a/man2/ioctl_userfaultfd.2 > +++ b/man2/ioctl_userfaultfd.2 > @@ -388,12 +388,6 @@ On error, \-1 is returned and > .I errno > is set to indicate the error. > Possible errors include: > -.\" FIXME Is the following error list correct? > -.\" > -.TP > -.B EBUSY > -A mapping in the specified range is registered with another > -userfaultfd object. > .TP > .B EFAULT > .I argp > @@ -408,21 +402,32 @@ field; or the > field was zero. > .TP > .B EINVAL > -There is no mapping in the specified address range. > -.TP > -.B EINVAL > +The specified address range was invalid. > +More specifically, > +no mapping exists in the given range, > +or the mapping that exists there is invalid > +(e.g. unsupported type of memory), > +or the range values ( This produces some unwanted space. Please apply the following fix to your patch. diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 index 6e954e98c..795014794 100644 --- a/man2/ioctl_userfaultfd.2 +++ b/man2/ioctl_userfaultfd.2 @@ -432,11 +432,11 @@ .SS UFFDIO_REGISTER no mapping exists in the given range, or the mapping that exists there is invalid (e.g. unsupported type of memory), -or the range values ( -.I range.start +or the range values +.IR ( range.start or -.I range.len -) are not multiples of the relevant page size, +.IR range.len ) +are not multiples of the relevant page size, or .I range.len is zero. > .I range.start > or > .I range.len > -is not a multiple of the system page size; or, > +) are not multiples of the relevant page size, > +or > .I range.len > -is zero; or these fields are otherwise invalid. > +is zero. > .TP > -.B EINVAL > -There as an incompatible mapping in the specified address range. > -.\" Mike Rapoport: > -.\" ENOMEM if the process is exiting and the > -.\" mm_struct has gone by the time userfault grabs it. > +.B ENOMEM > +The process is exiting, > +and its address space has already been torn down > +when userfaultfd attempts to reference it. > +.TP > +.B EPERM > +The userfaultfd would allow writing to a file backing the mapping, > +but the calling process lacks such write permissions. > +.TP > +.B EBUSY > +A mapping in the specified range is registered with another > +userfaultfd object. Why would you move EBUSY to the end? Do you see any reasons to order it that way? Thanks, Alex > .SS UFFDIO_UNREGISTER > (Since Linux 4.3.) > Unregister a memory address range from userfaultfd. > -- > 2.42.0.609.gbb76f46606-goog >
Hi! On Mon, 2023-10-09 at 00:06:48 +0200, Alejandro Colomar wrote: > This produces some unwanted space. Please apply the following fix to > your patch. > > diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 > index 6e954e98c..795014794 100644 > --- a/man2/ioctl_userfaultfd.2 > +++ b/man2/ioctl_userfaultfd.2 > @@ -432,11 +432,11 @@ .SS UFFDIO_REGISTER > no mapping exists in the given range, > or the mapping that exists there is invalid > (e.g. unsupported type of memory), > -or the range values ( > -.I range.start > +or the range values > +.IR ( range.start I think you meant «.RI» here? > or > -.I range.len > -) are not multiples of the relevant page size, > +.IR range.len ) > +are not multiples of the relevant page size, > or > .I range.len > is zero. > Regards, Guillem
Hi Guillem! On Tue, Oct 17, 2023 at 11:23:10PM +0200, Guillem Jover wrote: > Hi! > > On Mon, 2023-10-09 at 00:06:48 +0200, Alejandro Colomar wrote: > > This produces some unwanted space. Please apply the following fix to > > your patch. > > > > diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 > > index 6e954e98c..795014794 100644 > > --- a/man2/ioctl_userfaultfd.2 > > +++ b/man2/ioctl_userfaultfd.2 > > @@ -432,11 +432,11 @@ .SS UFFDIO_REGISTER > > no mapping exists in the given range, > > or the mapping that exists there is invalid > > (e.g. unsupported type of memory), > > -or the range values ( > > -.I range.start > > +or the range values > > +.IR ( range.start > > I think you meant «.RI» here? Yup! Good catch. Cheers, Alex > > > or > > -.I range.len > > -) are not multiples of the relevant page size, > > +.IR range.len ) > > +are not multiples of the relevant page size, > > or > > .I range.len > > is zero. > > > > Regards, > Guillem
On Tue, Oct 17, 2023 at 2:42 PM Alejandro Colomar <alx@kernel.org> wrote: > > Hi Guillem! > > On Tue, Oct 17, 2023 at 11:23:10PM +0200, Guillem Jover wrote: > > Hi! > > > > On Mon, 2023-10-09 at 00:06:48 +0200, Alejandro Colomar wrote: > > > This produces some unwanted space. Please apply the following fix to > > > your patch. > > > > > > diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 > > > index 6e954e98c..795014794 100644 > > > --- a/man2/ioctl_userfaultfd.2 > > > +++ b/man2/ioctl_userfaultfd.2 > > > @@ -432,11 +432,11 @@ .SS UFFDIO_REGISTER > > > no mapping exists in the given range, > > > or the mapping that exists there is invalid > > > (e.g. unsupported type of memory), > > > -or the range values ( > > > -.I range.start > > > +or the range values > > > +.IR ( range.start > > > > I think you meant «.RI» here? > > Yup! Good catch. Thanks, I'll apply this change in a v3. > > Cheers, > Alex > > > > > > or > > > -.I range.len > > > -) are not multiples of the relevant page size, > > > +.IR range.len ) > > > +are not multiples of the relevant page size, > > > or > > > .I range.len > > > is zero. > > > > > > > Regards, > > Guillem Regarding the -EBUSY ordering, I did it this way because that's the order in which the conditions are checked in the code. But, I agree that isn't very obvious / useful to any reader of the man page :) and alphabetical order is preferred. I'll correct that in v3. > > -- > <https://www.alejandro-colomar.es/>
diff --git a/man2/ioctl_userfaultfd.2 b/man2/ioctl_userfaultfd.2 index 2ee6a0532..95d69f773 100644 --- a/man2/ioctl_userfaultfd.2 +++ b/man2/ioctl_userfaultfd.2 @@ -388,12 +388,6 @@ On error, \-1 is returned and .I errno is set to indicate the error. Possible errors include: -.\" FIXME Is the following error list correct? -.\" -.TP -.B EBUSY -A mapping in the specified range is registered with another -userfaultfd object. .TP .B EFAULT .I argp @@ -408,21 +402,32 @@ field; or the field was zero. .TP .B EINVAL -There is no mapping in the specified address range. -.TP -.B EINVAL +The specified address range was invalid. +More specifically, +no mapping exists in the given range, +or the mapping that exists there is invalid +(e.g. unsupported type of memory), +or the range values ( .I range.start or .I range.len -is not a multiple of the system page size; or, +) are not multiples of the relevant page size, +or .I range.len -is zero; or these fields are otherwise invalid. +is zero. .TP -.B EINVAL -There as an incompatible mapping in the specified address range. -.\" Mike Rapoport: -.\" ENOMEM if the process is exiting and the -.\" mm_struct has gone by the time userfault grabs it. +.B ENOMEM +The process is exiting, +and its address space has already been torn down +when userfaultfd attempts to reference it. +.TP +.B EPERM +The userfaultfd would allow writing to a file backing the mapping, +but the calling process lacks such write permissions. +.TP +.B EBUSY +A mapping in the specified range is registered with another +userfaultfd object. .SS UFFDIO_UNREGISTER (Since Linux 4.3.) Unregister a memory address range from userfaultfd.