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 X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EE22C433C1 for ; Thu, 25 Mar 2021 21:32:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2E8261A25 for ; Thu, 25 Mar 2021 21:32:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2E8261A25 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4C93D6B006C; Thu, 25 Mar 2021 17:32:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 478AC6B006E; Thu, 25 Mar 2021 17:32:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27D786B0070; Thu, 25 Mar 2021 17:32:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0251.hostedemail.com [216.40.44.251]) by kanga.kvack.org (Postfix) with ESMTP id 055936B006C for ; Thu, 25 Mar 2021 17:32:24 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id ABD06180882A9 for ; Thu, 25 Mar 2021 21:32:24 +0000 (UTC) X-FDA: 77959695408.09.299CAC1 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by imf07.hostedemail.com (Postfix) with ESMTP id CA24CA00024C for ; Thu, 25 Mar 2021 21:32:23 +0000 (UTC) Received: by mail-wr1-f50.google.com with SMTP id z2so3723669wrl.5 for ; Thu, 25 Mar 2021 14:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=nbNivWiWgaBMZuyO4MpN+8EYAa/41jtzT5v1aG+/fJw=; b=Q2UpVjLeH9lnudNPvjqKIwJPfOC6tqAcXg1q/QxTB5RWQ721mgUIQFzRGc3Ln6q0rw ycXPsWhmmhRPTgWTzpKj5FH5M5+QE5pxzQxnB4dOzzNSg8ucOm340vhce7Pun0LmAIPj +5yJYXOru/sWeBKGS/yojEtJsmN10lzXrrPj6h/q7M9zl0w/nvdM/VtAzRRdN5uDF7aX h8eWI6zYFtWS/Ql0mIcW2FrIpJ3Pw/Vo4gNfptnZT0Gfa7HKjG0x6rVL4dUJgvR5PmAz eEGsg2mBdTogaI1NLHwkga45nKBp3NXTs3/ABFbB/RvBBVtJH1w9aCLt+/l04lAlt3kQ wOxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nbNivWiWgaBMZuyO4MpN+8EYAa/41jtzT5v1aG+/fJw=; b=VVnKXG86899pzydun/OPR4ftno0ZrsFXaAUKD272WZlwBfcq9vU70o3LwluOA9oZCg +/mODgJnOa2mxnhqIjPcX5iS4yZAMqaufxyt3igMB2lYiskx4mYtEGOZ49G53xQR7n30 FROSJHhk7J9imztU3Q1IDNhxFVA9quNaaUMqLAqi8dhXbX1bEaDl/kDEtDAnO8w05jPB SdA22NGs9F34XHSvTjq35B3eXajmYngKYttNATBp2S0kJYHJ5MZnfp7N9UcaGjbbmNDS cFNvopS08i16iEZJLcvNxZzDa+mkOWVCJxSZ+9kLl7e4M1Ul9WBfyJkA6w95B2OC6C+3 mkHg== X-Gm-Message-State: AOAM531XIOcyiI0UiwMupJ/4l42YXqY4NX1O8Ppp9WJacYMbQidZssbJ 7GDN1Nb4wNSLmlBPfO6/iDEKeUstzQg= X-Google-Smtp-Source: ABdhPJz3FG0ilHrC2E5KSJQMQ8xEG4quMfDb50CMmWsBKp6l/vc9HCS8k5p5NWXIiNj3wcASIaputg== X-Received: by 2002:adf:a1d8:: with SMTP id v24mr10805038wrv.378.1616707942884; Thu, 25 Mar 2021 14:32:22 -0700 (PDT) Received: from [192.168.1.143] ([170.253.51.130]) by smtp.gmail.com with ESMTPSA id 91sm9329621wrl.20.2021.03.25.14.32.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Mar 2021 14:32:22 -0700 (PDT) Subject: Re: [PATCH v4 4/4] ioctl_userfaultfd.2: Add write-protect mode docs To: Peter Xu Cc: linux-man@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , Andrea Arcangeli , Axel Rasmussen , Michael Kerrisk , Nadav Amit , Andrew Morton References: <20210322220848.52162-1-peterx@redhat.com> <20210322220848.52162-5-peterx@redhat.com> <20210323191618.GJ6486@xz-x1> From: "Alejandro Colomar (man-pages)" Message-ID: Date: Thu, 25 Mar 2021 22:32:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210323191618.GJ6486@xz-x1> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: duumqtc4myirxkw3y8xfxwrepcuncuqu X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CA24CA00024C Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf07; identity=mailfrom; envelope-from=""; helo=mail-wr1-f50.google.com; client-ip=209.85.221.50 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616707943-866414 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: Hi Peter, On 3/23/21 8:16 PM, Peter Xu wrote: > On Tue, Mar 23, 2021 at 07:11:04PM +0100, Alejandro Colomar (man-pages) wrote: >>> +.TP >>> +.B UFFDIO_COPY_MODE_WP >>> +Copy the page with read-only permission. >>> +This allows the user to trap the next write to the page, >>> +which will block and generate another write-protect userfault message. >> >> s/write-protect/write-protected/ >> ? > > I think here "write-protect" is the wording I wanted to use, it is the name of > the type of the message in plain text. Okay. > > [...] > >>> +.B EAGAIN >>> +The process was interrupted and need to retry. >> >> Maybe: "The process was interrupted; retry this call."? >> I don't know what other pager say about this kind of error. > > Frankly I see no difference between the two.. If you prefer the latter, I can > switch. I understand yours, but technically it's a bit incorrect: The subject of the sentence changes: in "The process was interrupted" it's the process, and in "need to retry" it's [you]. By separating the sentence into two, it's more natural. :) > >> >>> +.TP >>> +.B ENOENT >>> +The range specified in >>> +.I range >>> +is not valid. >> >> I'm not sure how this is different from the wording above in EINVAL. An >> "otherwise invalid range" was already giving EINVAL? > > This can be returned when vma is not found (mwriteprotect_range()): > > err = -ENOENT; > dst_vma = find_dst_vma(dst_mm, start, len); > > if (!dst_vma) > goto out_unlock; > > I think maybe I could simply remove this entry, because from an user app > developer pov I'd only be interested in specific error that I'd be able to > detect and (even better) recover from. For such error I'd say there's not much > to do besides failing the app. If there's any possibility that the error can happen, it should be documented, even if it's to say "Fatal error; abort!". Just try to explain the causes and how to avoid causing them and/or possibly what to do when they happen (abort?). > >> >>> +For example, the virtual address does not exist, >>> +or not registered with userfaultfd write-protect mode. >>> +.TP >>> +.B EFAULT >>> +Encountered a generic fault during processing. >> >> What is a "generic fault"? > > For example when the user copy failed due to some reason. See > userfaultfd_writeprotect(): > > if (copy_from_user(&uffdio_wp, user_uffdio_wp, > sizeof(struct uffdio_writeprotect))) > return -EFAULT; > > But I didn't check other places, generally I'd return -EFAULT if I can't find a > proper other replacement which has a clearer meaning. > > I don't think this is really helpful to user app too because no user app would > start to read this -EFAULT to do anything useful.. how about I drop it too if > you think the description is confusing? Same as above. Thanks, Alex -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/