Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp996270ybj; Thu, 7 May 2020 12:17:14 -0700 (PDT) X-Google-Smtp-Source: APiQypLc92PMfJqD4pyC9O5dWikKM7Orsp04aEqp86bul+u1pBvDzSS0potQD/rKWTokdXnMoTSe X-Received: by 2002:a17:906:78c:: with SMTP id l12mr12670051ejc.189.1588879034718; Thu, 07 May 2020 12:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588879034; cv=none; d=google.com; s=arc-20160816; b=JRymJr+X24dRgPEh4S9TSLWzFgGNNvRsUgi81/q9irsBKmZ1WA6gFohp7JHrdJpGT/ UT/YrEgO0NqA7FFGyUzTIkFEI3CCtsaojQJMWC7q4IIq405tsqRu5NPVKY4nE/+rdtP5 y/KF4sTUmcywhx7ZX9ZTNgqZ1WQaHP8HGmQGOgSFgXLSN3nFGodApIPO+HCNoCP3crsE /QlTn7aC9eTOrhOoVFN/Z3DdCuOuqzoai0ip+9wsAqxSIbYHSHbpB08gwqiMlWMGWfch mbW0E+X/CpSuYHK8y3tDNlnFll9X1ZsBaqxsWWfjk2UbvIzghX7TMxDVdLQJg+ZD0PsV zbTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=vMHMcCZVsTpMomR/jqnhEIXTxP3694m8IjGSNXZBOEY=; b=ooJrvaCxWWjdsmOekGvyqqAGN2RImdH38C2qGZFM3D56Z45uJJRgrF29IKGHwEIdeE oYepUTpW/LMgXNd4e0ZQ0w7hlij3d2T3pkvmem+oQP0dMSb7gkB+k4uwOtIbYHnRAknY 3gwsvTYMr4Q/VixfbqrwEsRjuDo2IWIScm3CrUAFE0LWmtn80zu619sQDwBhPfkfO+KQ W4kjfIOu+gXa+Vqk+/Q5S5uh8mBVm3spq5GXO1ZgeMHABAUHhDeNIoHokFi5GprZima2 jJp6dtnDVb/wWt45pnlqvalihR2x795NOmrEhC1bcNzeHU6SZaIT3cx7QvG2VRBowkan uzXw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si3631680ejh.337.2020.05.07.12.16.50; Thu, 07 May 2020 12:17:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728524AbgEGTPH (ORCPT + 99 others); Thu, 7 May 2020 15:15:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728328AbgEGTPG (ORCPT ); Thu, 7 May 2020 15:15:06 -0400 Received: from ms.lwn.net (ms.lwn.net [IPv6:2600:3c01:e000:3a1::42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81663C05BD43; Thu, 7 May 2020 12:15:06 -0700 (PDT) Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id CFFE6453; Thu, 7 May 2020 19:15:04 +0000 (UTC) Date: Thu, 7 May 2020 13:15:03 -0600 From: Jonathan Corbet To: Peter Xu Cc: Daniel Colascione , Alexander Viro , Luis Chamberlain , Kees Cook , Iurii Zaikin , Mauro Carvalho Chehab , Andrew Morton , Andy Shevchenko , Vlastimil Babka , Mel Gorman , Sebastian Andrzej Siewior , Andrea Arcangeli , Mike Rapoport , Jerome Glisse , Shaohua Li , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, timmurray@google.com, minchan@google.com, sspatil@google.com, lokeshgidra@google.com Subject: Re: [PATCH 2/2] Add a new sysctl knob: unprivileged_userfaultfd_user_mode_only Message-ID: <20200507131503.02aba5a6@lwn.net> In-Reply-To: <20200506193816.GB228260@xz-x1> References: <20200423002632.224776-1-dancol@google.com> <20200423002632.224776-3-dancol@google.com> <20200506193816.GB228260@xz-x1> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 6 May 2020 15:38:16 -0400 Peter Xu wrote: > If this is going to be added... I am thinking whether it should be easier to > add another value for unprivileged_userfaultfd, rather than a new sysctl. E.g.: > > "0": unprivileged userfaultfd forbidden > "1": unprivileged userfaultfd allowed (both user/kernel faults) > "2": unprivileged userfaultfd allowed (only user faults) > > Because after all unprivileged_userfaultfd_user_mode_only will be meaningless > (iiuc) if unprivileged_userfaultfd=0. The default value will also be the same > as before ("1") then. It occurs to me to wonder whether this interface should also let an admin block *privileged* user from handling kernel-space faults? In a secure-boot/lockdown setting, this could be a hardening measure that keeps a (somewhat) restricted root user from expanding their privilege...? jon