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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 34322C433E2 for ; Tue, 23 Mar 2021 19:16:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA011619C1 for ; Tue, 23 Mar 2021 19:16:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA011619C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2C65E6B0167; Tue, 23 Mar 2021 15:16:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29D356B016F; Tue, 23 Mar 2021 15:16:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13F9F6B0209; Tue, 23 Mar 2021 15:16:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id EAA9E6B0167 for ; Tue, 23 Mar 2021 15:16:26 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A4411582B for ; Tue, 23 Mar 2021 19:16:26 +0000 (UTC) X-FDA: 77952095172.27.E0CEED9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf21.hostedemail.com (Postfix) with ESMTP id E3DCFE000219 for ; Tue, 23 Mar 2021 19:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616526983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pzzsxO+/RfVNYyJ9yVIRqP2Pb3Z/0Xf0ayACN5hk9Gc=; b=CnaTbtiTTCwuUA+nPr+Xgp1c1qN26onAah7SY/uH4IufiQOBCof5UGYrTzpko1JdCXgdsi kz/ZfGsjGzH5GD1kaz8nofGq6wKoYcUDEc8TT8TLICeiSMdv1haswqk92MKgOO/LEjQ5oC JswHco9k1hVWXdVnJDTQA7ytSW0PxPA= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-537-nuwEDJg0MkKlGpbrHg22bg-1; Tue, 23 Mar 2021 15:16:21 -0400 X-MC-Unique: nuwEDJg0MkKlGpbrHg22bg-1 Received: by mail-qk1-f200.google.com with SMTP id p133so2692138qka.17 for ; Tue, 23 Mar 2021 12:16:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pzzsxO+/RfVNYyJ9yVIRqP2Pb3Z/0Xf0ayACN5hk9Gc=; b=WnQPllCClYNbG5fXg+7bukMiK2sBNvL9z1sOI4GzdFL3ad4szUBe5RH0ebo+gKyWmI UAPy4CpoMo1TikLoqPlNfx9SPA1AYocVe0KMUFGuL6R1euB0F6Y5R+Wn66PKFZmoEqsc 2OZ3r+gcAqxut6VwE0Wav/VqPnSmgQZddDnwowOPpslJbrg1xr2cMi9EFv7+/1r0COXE jwlzcGjSyqBQc1AZFWXHV3+lyS16UjpFcBv7ezsMEyxu8XWfmCqj0PA0UUEzE2kgc4AF QP/DVp1q6Uou8whGRY0pLHqpivcU9nIpExn45+GLd7H6WWLrZcPgzrO8MDJCxyqudh8G 8UlA== X-Gm-Message-State: AOAM530esw7jehzq9Zx6VNJdM683fKGxtiVXQbyEPRjn/qykScw5uBpv dANaF+qkdryobyIGxZ9KKhcQsPaowS33ISaJ80uANgudMy2FQgqeLsmql9VrwTbIZoe5xFkpGoc tKk5LYIu+D5Y= X-Received: by 2002:ac8:5cc4:: with SMTP id s4mr5746086qta.214.1616526981083; Tue, 23 Mar 2021 12:16:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHY7AQpSRZ5sUCEytixnvvAU37W64P8ZvCT5RyjQklc7t6g0fRMp/6jlGC8fQFAZSP3c28BA== X-Received: by 2002:ac8:5cc4:: with SMTP id s4mr5746070qta.214.1616526980827; Tue, 23 Mar 2021 12:16:20 -0700 (PDT) Received: from xz-x1 (bras-base-toroon474qw-grc-82-174-91-135-175.dsl.bell.ca. [174.91.135.175]) by smtp.gmail.com with ESMTPSA id g4sm7523813qtg.86.2021.03.23.12.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 12:16:20 -0700 (PDT) Date: Tue, 23 Mar 2021 15:16:18 -0400 From: Peter Xu To: "Alejandro Colomar (man-pages)" 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 Subject: Re: [PATCH v4 4/4] ioctl_userfaultfd.2: Add write-protect mode docs Message-ID: <20210323191618.GJ6486@xz-x1> References: <20210322220848.52162-1-peterx@redhat.com> <20210322220848.52162-5-peterx@redhat.com> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Stat-Signature: xr1mbzcqpy1hbpfcnsbgk9jfphptdrum X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E3DCFE000219 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616526983-345092 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: On Tue, Mar 23, 2021 at 07:11:04PM +0100, Alejandro Colomar (man-pages) wrote: > Hi Peter, Hi, Alex, [...] > > +.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. [...] > > +.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. > > > +.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. > > > +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? Thanks, -- Peter Xu