Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4398745pxb; Tue, 26 Jan 2021 22:18:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR7xIIfDfTmAl3DkeYjpqm3NGv+CYjqajGzx7AnZj4Hbd5TaE0Zfb4vlhdb+8PVOrfP2RL X-Received: by 2002:a05:6402:220e:: with SMTP id cq14mr7509121edb.240.1611728334915; Tue, 26 Jan 2021 22:18:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611728334; cv=none; d=google.com; s=arc-20160816; b=feGnxQT641YWhFAJuXgyRQ2q5kJvMApzmLpQJvEBkJ2/W3RGuAIy50FI9/FZgM+VV3 NQN6BSBTslH2/7kUhttQ94gzvaguJMu9c60WOBIF2lqeuxFI7e//B7fJmIvGz7r+l+LF 2QBleLAxyjDkfgvg09vqA+Ob84i6G0KGQRsK8YWRFLmYE3jAfp1CiJr93J6qapR76V8x Sx+Yyk0tWCRU3V8mwTslWsn9KZ3JTEIZfm5xVZqs0zmtfLdPGe+vVDXRY59VW5kzsAtp FvJ9+EZrftY3S36HJs/oc8dnZOQrgmezHGC3rfyv3+i3r/eNceSCbctPlztAwIMlbT91 Lwug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YDZ9xoM4vkjgG3VDn83cus2ZyU7tS/ImHr1EbR40OHE=; b=XzjL4duA05NwFlO+O8Z2JeotzwQnst6zNMBDHTCDg8P9V3hTtrOXh75hzTiyFQjkG0 oXvPIrAG0Nzs9UTwOj30GCwRasMsX14P4G19NfszxXT4RHds4YUFQ69PQkc2D8NtWARu 6lwGAyCkq+toelZew2jd5d1b4B3dHPN9ETuwAW2g8yZfahEocwMg0zG7XtVp1gNh0ONs 3F9nBqBKg5k19y5sN332o5hNLO727FYBnYwczy5muhFRsUIssFxo8R+x0sZdYX3sTHLw MhUzq0X6rHUj2wyhOlgAsEqc9E3seMttKrftesw5L/b1F+cgVqgiX4ISRZuFDe42DdLV L8XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iC68VBpa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si396702ejg.670.2021.01.26.22.18.30; Tue, 26 Jan 2021 22:18:54 -0800 (PST) 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=@google.com header.s=20161025 header.b=iC68VBpa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394345AbhAZSPb (ORCPT + 99 others); Tue, 26 Jan 2021 13:15:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391407AbhAZRvC (ORCPT ); Tue, 26 Jan 2021 12:51:02 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CDDCC061574 for ; Tue, 26 Jan 2021 09:50:21 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id d22so20843425edy.1 for ; Tue, 26 Jan 2021 09:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YDZ9xoM4vkjgG3VDn83cus2ZyU7tS/ImHr1EbR40OHE=; b=iC68VBpaq64YNVQ0gyie62K2q0gqKG2wunAeMFJligWQ54mFY6PLhbrOxMmB1Snsrn 0iShrefSXyHlxlN+8Q01JLqZUHgUdC4dPm083RP/P3G/HjqXJvx5QaNoLA+/CSe5uglG oCWZXKNRQA8x+9nVwamn+mDCLqUFyKlzOV+3EpXHa8AaC5IVSJx910YSC18RZPWc81FJ ltKjl4opEIguMtRBiMwBDki887zMS5XWqqiJz+57O7hld88oTYnoGPI1DqSPOACvYHV6 26MiLHaOJpXDLenM4lVZhCqcgeWByzzXB8oi3MdeA4rODu556+k1D2I+NKeM2iME7D/w wH+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YDZ9xoM4vkjgG3VDn83cus2ZyU7tS/ImHr1EbR40OHE=; b=oY82VX5J/F/Cnz/2Az/i9CFolrfWUthKDNbNPtrSbPdXcOENyCN5/bBu1/zgD8YP/g vKluh68cA+SRuYgOvRbxsYShbTMv3qgBq7ZeW/2uxYtWLYyV0G8fHZ3RW7j8alXu6jgX iaeBCqfvE+mrXYTf0Sq4fMq5ytblqu19JDcJRcLUWEvGa3/6mm3C7KaeNps7WUoo+QO9 6T62gHN5WpqezvSJz0MuxiJeae8j5d+PB2w+FkDtA2PEGLza+Rb/ulu2JveXcLXFrAif NXp27jefi71CbmrrH8WW2enB9iPY1UNVOehLs5t2j3rP3pw+jNiauQXwX+IJjX8D/zDo GJBA== X-Gm-Message-State: AOAM530zD2YNMrNbGQ/DKQbKFgql6J5IBX7pvrXUXGabWDhLz42B1cIb IDO5roBvURViMoWlpBox8q/O/2/u9g81hnm85FUYmQ== X-Received: by 2002:aa7:d4c8:: with SMTP id t8mr5784370edr.199.1611683419835; Tue, 26 Jan 2021 09:50:19 -0800 (PST) MIME-Version: 1.0 References: <20210126014450.1901335-1-lokeshgidra@google.com> In-Reply-To: <20210126014450.1901335-1-lokeshgidra@google.com> From: Lokesh Gidra Date: Tue, 26 Jan 2021 09:50:08 -0800 Message-ID: Subject: Re: [PATCH v1] userfaultfd.2: Add UFFD_USER_MODE_ONLY flag To: linux-man@vger.kernel.org Cc: Daniel Colascione , linux-kernel , Kalesh Singh , Calin Juravle , Suren Baghdasaryan , Jeffrey Vander Stoep , "Cc: Android Kernel" , Peter Xu , Andrea Arcangeli , Andrew Morton , "open list:MEMORY MANAGEMENT" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2021 at 5:44 PM Lokesh Gidra wrote: > > Add description of UFFD_USER_MODE_ONLY flag to userfaultfd(2) manual > page, which is required after [1]. Also updated the description of > unprivileged_userfaultfd file in proc(5) as per [2]. > > [1] https://lore.kernel.org/linux-mm/20201215031349.NXimL388W%25akpm@linux-foundation.org/ > [2] https://lore.kernel.org/linux-mm/20201215031354.gUsHJUpKo%25akpm@linux-foundation.org/ > > Signed-off-by: Lokesh Gidra > --- > man2/userfaultfd.2 | 5 +++++ > man5/proc.5 | 12 ++++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2 > index e7dc9f813..792a49d52 100644 > --- a/man2/userfaultfd.2 > +++ b/man2/userfaultfd.2 > @@ -72,6 +72,11 @@ See the description of the > .BR O_NONBLOCK > flag in > .BR open (2). > +.TP > +.BR UFFD_USER_MODE_ONLY " (Since Linux 5.11)" > +Allow handling of user-mode page-faults only. See the description of the > +unprivileged_userfaultfd file in > +.BR proc (5). > .PP > When the last file descriptor referring to a userfaultfd object is closed, > all memory ranges that were registered with the object are unregistered > diff --git a/man5/proc.5 b/man5/proc.5 > index f16a29d6e..cb2350c0c 100644 > --- a/man5/proc.5 > +++ b/man5/proc.5 > @@ -5905,6 +5905,18 @@ If this file has the value 0, then only processes that have the > capability may employ > .BR userfaultfd (2). > The default value in this file is 1. > +.IP > +Starting with Linux 5.11, > +.BR userfaultfd (2) > +can be used by all processes, however, if this file has the value 0, then > +.BR UFFD_USER_MODE_ONLY > +flag must be passed to it, which restricts page-fault handling to only > +user-mode faults. This restriction is not applicable for processes with > +.B CAP_SYS_PTRACE > +capability, or if this file has the value 1. Furthermore, the default > +value in this file is changed to 0. For further details see the > +Linux kernel source file > +.I Documentation/admin\-guide/sysctl/vm.rst. > .TP > .IR /proc/sysrq\-trigger " (since Linux 2.4.21)" > Writing a character to this file triggers the same SysRq function as > -- Adding the right linux-mm mailing list. Mistakenly used linux-mm@kvack.kernel.org earlier. > 2.30.0.280.ga3ce27912f-goog >