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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19F39C88E72 for ; Thu, 17 Sep 2026 17:28:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57BD510E76F; Thu, 17 Sep 2026 17:28:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="cNoC0wXF"; dkim-atps=neutral Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 161C310E76F for ; Thu, 17 Sep 2026 17:28:11 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 8EC9B6020A; Thu, 17 Sep 2026 17:28:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74D311F00893; Thu, 17 Sep 2026 17:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789666090; bh=vDU87ipAS5UAxV5m8p4D391an8rHhmbZDcohTZwCtlQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=cNoC0wXFRE2kaPEMouFuZbfJN84B328Hab508HJ8d8Gg230OqkTWxLCWo4aPVqEDq FsoQNjDNPX2/YldNel6eh91Uytq2nG5A3jk/aCkqONVuAVXilU9kMB5Dty3RKPrtem 4AwantuY2/x+BAcPgHY4Z9rIhpk9ofteT3m+0+Q16oBsULLPFP9l0J5PUWe4zQ0iSp Ktq/u8AYahY6D7aGBanfrZMwuXXVPVRmhwBixRw4qlurh8b9Jomcam5FHnln/ldcb8 mBES0hrpXu6PGOl2zy1J+m/rXPbDKoDP64aTuEE4J7W9mko6FnivoFBrdMeDELdsaS fQg/Lxa9ibm/A== From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 16/40] mm/vma: only allow mmap to clear VMA_MAYWRITE_BIT if kernel-owned To: =?utf-8?b?TG9yZW56byBTdG9ha2VzIChBUk0p?= Cc: linux-perf-users@vger.kernel.org, dri-devel@lists.freedesktop.org, "Marc Zyngier" , selinux@vger.kernel.org, "Alexander Gordeev" , "Christian Borntraeger" , bpf@vger.kernel.org, "Oliver Upton" , kvmarm@lists.linux.dev, "Vasily Gorbik" , linux-s390@vger.kernel.org, "Heiko Carstens" , kvm@vger.kernel.org, linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org, linux-trace-kernel@vger.kernel.org In-Reply-To: <20260917-b4-mmap-prepare-vma-flag-sanify-v3-16-4583d8a23bca@kernel.org> References: <20260917-b4-mmap-prepare-vma-flag-sanify-v3-0-4583d8a23bca@kernel.org> <20260917-b4-mmap-prepare-vma-flag-sanify-v3-16-4583d8a23bca@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 17 Sep 2026 17:28:09 +0000 Message-Id: <20260917172809.74D311F00893@smtp.kernel.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" > For ordinary files the only way the VMA_MAYWRITE_BIT flag is cleared is if > the underlying file is itself read-only. >=20 > This means that mprotect() cannot mark a shared mapping of a read-only fi= le > as read/write, as doing so would violate the read only attribute, and > permit writes. >=20 > In general, we do not want file systems to be able to do this for > read/write files. >=20 > Doing so would violate fundamental user expectation of file attributes and > likely break userspace. >=20 > However, drivers pose a tricky problem here - the /dev/xxx file may be > read/write but provide access to a resource which is fundamentally > [ ... ] >=20 > As all drivers which clear VMA_MAYWRITE_BIT establish kernel-owned > mappings, no functional change is intended. >=20 > Signed-off-by: Lorenzo Stoakes (ARM) Sashiko has reviewed this patch and found no issues. It looks great! --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260917-b4-mmap-pr= epare-vma-flag-sanify-v3-0-4583d8a23bca@kernel.org?part=3D16