Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp121541pxf; Wed, 24 Mar 2021 00:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxywuJSRAEvjvhjIwp3+wEto+AKJzbrumITBkyWGLig9og4GSLYn3YzvNtsk61THynvIuFO X-Received: by 2002:a05:6402:30a5:: with SMTP id df5mr1974232edb.24.1616570620551; Wed, 24 Mar 2021 00:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616570620; cv=none; d=google.com; s=arc-20160816; b=D4aRepPt9/9LO9h02JcBeq8O2FvQcnlIA3gC9Af0klLOINZrew6JQsUVK+5TUek7wW +irpdg27aJneJiiVyKc7VmOVkUuu6X7RVi3RWQYaaWm5aszqvYov4ixWED8FPiKwFzH7 pjzE4APolAcopDqVH8aPTdWSksQOolU6/qWak6KIeomA2cB3Pu/lAl0CR0Mxvtvb0Z8s 24ChbIsL8uSsdCFmMK1JTRQdJYi82tZXQijjrqfcIrWu2FOnwoa0Ugp6013W2IPLXIZf oD46QLUFBsZJ2Pv6LL5ryhIsPfAuyW5isec3HW6TuzYBVBPrT1YWm6uvIuc4x7ycCERw 2nPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pzzsxO+/RfVNYyJ9yVIRqP2Pb3Z/0Xf0ayACN5hk9Gc=; b=FkqLCY3T1LdfxdaCWfuQRw1g+XjnLZmQjzlyZ81TVXyHlPiUYQyZjkmPOnqr8SIFQC jVE2zy/mVXzFave+PjPWh3IQTggv5gqZ+4ypJXm4zet3/OAza2mfw6AKYJF0DlaLDXoC VB2f9RRNJqP26V9QBsrQYOhkA1Ka96q+FcTnPVlh28X9zkvZ+8CgUJL1tCIvxB0lpLSG 2IzCUYi62KK4yUk2oL0jrbRjjPYhanUJFsBa0O9Onx8uny9eDw5AQaff/3kU1EuaBqXi XkXOBPF45WeVjIselpWiEVPhQx9SMTxPhnMgJPnBr3+VqLc1yPBpoum7+y2F3Ax8fpWp kv2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CnaTbtiT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb15si1162720ejb.147.2021.03.24.00.23.17; Wed, 24 Mar 2021 00:23:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CnaTbtiT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233304AbhCWTQb (ORCPT + 99 others); Tue, 23 Mar 2021 15:16:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60282 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233336AbhCWTQY (ORCPT ); Tue, 23 Mar 2021 15:16:24 -0400 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-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-ZVVXN3OZPO2VNsJq4QHzqA-1; Tue, 23 Mar 2021 15:16:21 -0400 X-MC-Unique: ZVVXN3OZPO2VNsJq4QHzqA-1 Received: by mail-qt1-f198.google.com with SMTP id t18so1841483qtw.15 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=qhoVu9+td9gw+3ZFcL3yeb9EAzGW8cIf9NZYlX+J8Em8hOaBgslPbca13UTAbWDtVu DmjDPiNO7GEMsPOHeIaYIxZ32nhPRUswclNgUGYLm2ECnQV/UR0Lw+1Z0EkW7cecWEVc 0vhSVWkG1+JADIc99OAYcMFttsgBaHXcokld9IHtuhvvveaNNKsgdHPb5AUCxdMCGLBX u41pRW7vCZdJZd37fMr/7qtRJXiLloLdB2ZHOnpsAoc5FEBr4ztnmGG1luzcEORsdK1n ICDFC5jpYV9VSizwTfy7RWdxhtzP5+zaR3E9eEtIL5KZcvzJ2jFgyDdP5CJI3E+Yjsr8 4XVA== X-Gm-Message-State: AOAM533uCw/uBuK3vpWvhmiZQP3h11xWQwXhtSIkDnRLGREZkcQ2xab5 nDvCVEMhf60N092ABJkR0oSX9+Fiqf1MBPgsryNW2wYRCMOm0u5KBA72bY38v7MsxzH5ysqyRSI VnOMZ2Dq3UHlCQE83GETon3Wc X-Received: by 2002:ac8:5cc4:: with SMTP id s4mr5746087qta.214.1616526981083; Tue, 23 Mar 2021 12:16:21 -0700 (PDT) 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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