From patchwork Tue Sep 19 19:02:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Rasmussen X-Patchwork-Id: 142069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3637019vqi; Tue, 19 Sep 2023 12:41:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoGbnERmxr+4oc899Aws0Dy2/adGzCd5Gn5yObgg4f5fsW5G47gE44NN2Lweee8SYtzVxi X-Received: by 2002:a17:902:f68b:b0:1bf:13a7:d3ef with SMTP id l11-20020a170902f68b00b001bf13a7d3efmr333120plg.66.1695152473811; Tue, 19 Sep 2023 12:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695152473; cv=none; d=google.com; s=arc-20160816; b=USOaqwDZlUaQv/XmyZpnFi95DhUiAE1Q7Btozrz/qfs7S4PYLPsp5T3lZcwNgmNAxK wjvkHBXSwmZKWWC8blYfwco1kW/es6YKzXAIVaXD32AqLQRjKFrLJnkaeOSBY1fA7gzV TrIXWWTBf/H7IgfVeSuaIuF4AlQoy5HuaphEDdykNrD7VxSx8jiODTygShxlkL6GPcWe exQY9xtyGN9djC/oaGuf34PQvjgpoW2sCqTQrC7+5e84204eNKBZGLO/JWYFxl23WG77 KXB+8vlH3QWtTbGoZhX1s44s2y2LHjZBraJYVGQBpdnwPWpfnZeNO1HyveGjPopZVRVO Z14g== 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=B/mBNxS046NndSUiuzLhVh8+as48kp1msWTNOB3shRo=; fh=SqwPTGdhTS3wVH9FltNQ4n/lDM1p3ApEDnroT8zra0U=; b=q7PkxAzWxTYQ7tKLVTCDzGSH9D/jB2AfNgBpXzLK9Q3IZ9gt8ZQmFOqjhNueXJtTnN l+VZk3T4LD+Er7DhOM2wvNx4VjDYoe7SueqmzdJhh0lN7RnujirqUddFaV0cQVxN8LRd YPYw6/9ElCO5x8vh4eB0XCB+n0toylAgxDh8r8lIa0bPGRCW8iIZxHSDco3SQfhriuZ8 rrF9Ti0mwj0tcjB4JVF4D/XBlHrh9VJmbZ4V7zgg8PwTpGW8m6UTHKPoq8/dgOJcR4R9 gSPGNmdsNVfVPbSsC+7NSMfRh4Nz6gnV7YB+oIu5nWzwk//wNCsltkZH4wrW75ut9Vi0 bW5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Ua8QGL2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q15-20020a17090311cf00b001b02e044c87si10552769plh.320.2023.09.19.12.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 12:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Ua8QGL2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 15C8E820C361; Tue, 19 Sep 2023 12:03:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233165AbjISTDC (ORCPT + 26 others); Tue, 19 Sep 2023 15:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232706AbjISTCt (ORCPT ); Tue, 19 Sep 2023 15:02:49 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F34221A6 for ; Tue, 19 Sep 2023 12:02:32 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-59e758d6236so36987027b3.1 for ; Tue, 19 Sep 2023 12:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695150151; x=1695754951; 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=B/mBNxS046NndSUiuzLhVh8+as48kp1msWTNOB3shRo=; b=Ua8QGL2++mD9dEdg+sAx/FcJHqAsM5UhJQ3xLWs1T3+FEAbdPlQBBbZiTzJZPtRJcj zEo2awLPU7Rl3GJYMA/0fCdInO64l3hdcByzrVvS9DfW/6sZ41Ny/1Z2A2KCr5xGXn26 sPcH9s9TSoeqDyh6IrLOhngvAGHRM9dC3yZ9VbblH0ueTgc4oUxhkNvOYZdwfBPUSaKL wqG3vLEVq+rqRbN+jo1/6jTBdkNAGXOr8XidYggPftdGrLmDdCXpTgn3G2GHZ+p7bSxW 8mvRjrXS9Na7HQdrpOlKEyskvUrCScfa0mscy4cxzVDEcv3tsD0FfD/7b/ZNiUm6xKKY X6hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695150151; x=1695754951; 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=B/mBNxS046NndSUiuzLhVh8+as48kp1msWTNOB3shRo=; b=gHiQwUwatWM8vANfFjCnulNze7UIeiRsMj8VlDbQkOBAF5sgAPJ0DmscQf8S1KAsk4 J5tdH8xMvsKUUIpbv1PD4k/WYQvsx0qOusF0r9qtOehy8zL5h4THx6XM+MRzUltH220+ bKYF/dFLeugaShNjBJkNGx1ROUs2LZSmdiBor6TTKa9bmwhIJyaWPmfMbD2HgfVzUEvH wFPHus2bRBdYEtaoJZG5WfOhQEXi5PcSwW8U8sBTApFN7u5rjonsvtgH+fkpL436wMKr 6ZUwl199v1JCARexlYXcTQ6ZcrvF6/M/8jXs5JyIGj1Ct5QIbUS8rpTIi0ke7pXubqf2 2wGg== X-Gm-Message-State: AOJu0YwGwvgfBvH39+jpKrzLiySY7gpfswEe/DzSKUMF/PSlhcGp/K8h w/akMUWAl/oFc5We4OLDvH71lwqtkz7kercP4vU/ X-Received: from axel.svl.corp.google.com ([2620:15c:2a3:200:8f5a:6a6a:cafc:a3ad]) (user=axelrasmussen job=sendgmr) by 2002:a81:ae07:0:b0:59b:ba8a:97d0 with SMTP id m7-20020a81ae07000000b0059bba8a97d0mr6086ywh.3.1695150151389; Tue, 19 Sep 2023 12:02:31 -0700 (PDT) Date: Tue, 19 Sep 2023 12:02:05 -0700 In-Reply-To: <20230919190206.388896-1-axelrasmussen@google.com> Mime-Version: 1.0 References: <20230919190206.388896-1-axelrasmussen@google.com> X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Message-ID: <20230919190206.388896-10-axelrasmussen@google.com> Subject: [PATCH 09/10] 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 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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 19 Sep 2023 12:03:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777496200391526655 X-GMAIL-MSGID: 1777496200391526655 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 29dca1f6b..afe3caffc 100644 --- a/man2/ioctl_userfaultfd.2 +++ b/man2/ioctl_userfaultfd.2 @@ -413,12 +413,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 @@ -433,21 +427,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.