Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2180370rdb; Tue, 3 Oct 2023 12:46:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZQ++jHSyt9xxlba5lx7uH6rQHPzzSSRyYIwdeq43UyCpPS82kziiOFpEPglAzw4wBVm7G X-Received: by 2002:a9d:62cf:0:b0:6b9:cba6:b246 with SMTP id z15-20020a9d62cf000000b006b9cba6b246mr236631otk.9.1696362392888; Tue, 03 Oct 2023 12:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696362392; cv=none; d=google.com; s=arc-20160816; b=ZX0PCMCDCGsoV2gYNNn/ZplK27CKA9E9eLm87mtyXcz2SN4G6HjYXnzaWQ0H60PshK wD0wm1u/kMCdVKJ+cS+0l4wC6MekjWPmtIxfN3oOy1efm5ZXGQJSNswiXimYXdN1IUHy W7LWUVDwO5izDqaxURcLzpnCa4of8imlrtOf8Ocu9cHJHjZkM22zQGXibWw8EcXx8/oG smTaXlXE+IOPmzf/fCE8XZb5ylMu4K6W0t24TKpeviJx62PLSEeGfsY65R2cMNckZwI5 rIuDnIbMrIktXpqFo3Bh7wWYtpIpcQLnqGs6AOw3p1KBMKyZPpH7MZ4gUP7YhWXtPRJz S8zA== 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:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k63-20020a638442000000b0057748a05fcfsi2084566pgd.27.2023.10.03.12.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 12:46:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; 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:3 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 lipwig.vger.email (Postfix) with ESMTP id BD59881A5AE1; Tue, 3 Oct 2023 12:46:29 -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 S241009AbjJCTqM (ORCPT + 99 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 ); 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 ; Tue, 3 Oct 2023 12:46:03 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d865f1447a2so1687926276.2 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=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 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" 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 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]); Tue, 03 Oct 2023 12:46:30 -0700 (PDT) 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