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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29AB8ECAAA3 for ; Fri, 26 Aug 2022 08:44:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3E17940007; Fri, 26 Aug 2022 04:44:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C67A6B0075; Fri, 26 Aug 2022 04:44:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 866E9940007; Fri, 26 Aug 2022 04:44:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 70CE36B0074 for ; Fri, 26 Aug 2022 04:44:06 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 48B6912030F for ; Fri, 26 Aug 2022 08:44:06 +0000 (UTC) X-FDA: 79841106492.13.CEA16A8 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf23.hostedemail.com (Postfix) with ESMTP id CF74014001A for ; Fri, 26 Aug 2022 08:44:05 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DCB50B82FC6; Fri, 26 Aug 2022 08:44:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BF97C433C1; Fri, 26 Aug 2022 08:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661503442; bh=z7osIVMCZGHnhKyN58oHu67Y/RB1Ot0NWuUJ6fLjt8Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d6LT/tQXSx5w904Rk9hYPigO3ibTXKSgYmW2U/NOrHFeb/uZHu7eaqZt7b7NumMzf 79eygsMrVXNLuQoCKXZJ4rKOS1EK4BfL9qE6eBbPDhW24vOu5A/CEfgH2MYykbw2++ ZXCY5knoUOsuq/g7B6KSxfZmpDRtmOCdbELaaUtEbKRN4Fs5AQdm++7Rg56vxp8ZBn psYw+UZJhupV0Cg5CxwGEANvBATJ1EPjmX35xCpzwq2aL+KklGIJP+k27sfW+Jya2O iOBrLNsQmoJ2RqvQT0BN5LJE+V04fDqt3WCE7keP3+aLvxBD+ktVSb8GAUYsa+MWDo 6GIJGqqz4UUmQ== Date: Fri, 26 Aug 2022 10:43:54 +0200 From: Christian Brauner To: Paul Moore Cc: Ondrej Mosnacek , Alexander Viro , linux-fsdevel@vger.kernel.org, Andrew Morton , Andrea Arcangeli , Peter Xu , David Hildenbrand , Lokesh Gidra , linux-mm@kvack.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kernel@vger.kernel.org, Robert O'Callahan Subject: Re: [RFC PATCH RESEND] userfaultfd: open userfaultfds with O_RDONLY Message-ID: <20220826084354.a2jrrvni6mf7zzyw@wittgenstein> References: <20220708093451.472870-1-omosnace@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="d6LT/tQX"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of brauner@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661503446; a=rsa-sha256; cv=none; b=MTTzQutVh0C8Ykhl5v1Qpzbt9WI6NTP6G9yPYTrzkQNBrwyL9C2bTE+0x78A/AoJMIx3KF 6wj/p9Iq+GSpFHzOBDWigMa3n8gpJWrHIrCQSxd/PCusnvSschqIFjck6tbBNU2mDRo3QC aAgeykEf14zrQNS6e/o/mGm3f1+2ELk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661503446; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tcXNM7sTgs17qs9JrtH91TSut8PURvANWHLOL3jOIwk=; b=ny9HrCQhQPpB3F7er5tv14QH3PAueE/h/nc1f4A91SZQvfDcaB7zH4M8PX7eq7CgJdTu0I Lfit6ToLA7Kc75nh111jlm+yvzQuK6vuNZPUH8h4DcKCA3Lr+AOLjEuz86oOAxpclwdBeo PXb5ufXMcTyn6n/u6RynnB1PtLL8SF8= X-Stat-Signature: jc4twxskgkcfdhsgwk8osq3h93ei8dtj Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="d6LT/tQX"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of brauner@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=brauner@kernel.org X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CF74014001A X-Rspam-User: X-HE-Tag: 1661503445-271656 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 Fri, Aug 19, 2022 at 02:50:57PM -0400, Paul Moore wrote: > On Tue, Aug 16, 2022 at 6:12 PM Paul Moore wrote: > > On Fri, Jul 8, 2022 at 5:35 AM Ondrej Mosnacek wrote: > > > > > > Since userfaultfd doesn't implement a write operation, it is more > > > appropriate to open it read-only. > > > > > > When userfaultfds are opened read-write like it is now, and such fd is > > > passed from one process to another, SELinux will check both read and > > > write permissions for the target process, even though it can't actually > > > do any write operation on the fd later. > > > > > > Inspired by the following bug report, which has hit the SELinux scenario > > > described above: > > > https://bugzilla.redhat.com/show_bug.cgi?id=1974559 > > > > > > Reported-by: Robert O'Callahan > > > Fixes: 86039bd3b4e6 ("userfaultfd: add new syscall to provide memory externalization") > > > Signed-off-by: Ondrej Mosnacek > > > --- > > > > > > Resending as the last submission was ignored for over a year... > > > > > > https://lore.kernel.org/lkml/20210624152515.1844133-1-omosnace@redhat.com/T/ > > > > > > I marked this as RFC, because I'm not sure if this has any unwanted side > > > effects. I only ran this patch through selinux-testsuite, which has a > > > simple userfaultfd subtest, and a reproducer from the Bugzilla report. > > > > > > Please tell me whether this makes sense and/or if it passes any > > > userfaultfd tests you guys might have. > > > > > > fs/userfaultfd.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > VFS folks, any objection to this patch? It seems reasonable to me and > > I'd really prefer this to go in via the vfs tree, but I'm not above > > merging this via the lsm/next tree to get someone in vfs land to pay > > attention to this ... > > Okay, final warning, if I don't see any objections to this when I make > my patch sweep next week I'm going to go ahead and merge this via the > LSM tree. Makes sense, Acked-by: Christian Brauner (Microsoft)