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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8558DE8FDB0 for ; Tue, 3 Oct 2023 19:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241007AbjJCTqL (ORCPT ); Tue, 3 Oct 2023 15:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241003AbjJCTqH (ORCPT ); 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 89D49C4 for ; Tue, 3 Oct 2023 12:46:03 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d86dac81f8fso1701872276.1 for ; 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=R3oFugyDKGS1plWUFLRFzgamz6GAm0ItQMeRzw56Wfufo1YM8irTXWv3cgqfn7QtJf vPmymFQ+JcJHZvDu+YcZp/SpZw2nXxitSKBp6vUQOm5Lv2DLai7Ls0IzzN0OIVt7SGwn Taka3Qx6h28OxnO8LoA2bs7B1tkyILv06xHDsdg5XJStSsNNJXVwpRVBuA0wpazhd6mZ NS+ctxJpKmAcsaxp/UaxJqou8BHIps4f67TNmirIe0Riaqh34JpGZd38ce6zVdseJ7lJ 13c0HfK/rv9IpJjiPImjDeq7ezkjZXYfrilR+Iq/ynHCDQsL8oJqPyPdO/edPlHpuwU4 2ggA== X-Gm-Message-State: AOJu0YyAoPuCh2ZE7bry76IiDmq09PYCDiYj4ctJA+6vCLQCvEJVCcBh SQcXrMU7Q1uwhhreqrYLTVZuRrfGgXifCpL31ZPg X-Google-Smtp-Source: AGHT+IEqhtFQcshbqUK4gTfwcaeBbR5gxWj6j2J6NdanzQb0K4203DhX5lB+56HhQWq3zs1Ah3+xDDFNYZ8+YYbf0JmL 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 To: Alejandro Colomar , Peter Xu Cc: linux-man@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Axel Rasmussen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org 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 --- 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 ( .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. -- 2.42.0.609.gbb76f46606-goog