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 95E21CA601E for ; Fri, 9 Oct 2026 18:26:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08DF710EAD0; Fri, 9 Oct 2026 18:26:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="eAQlCbpA"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 497BB10EAD0 for ; Fri, 9 Oct 2026 18:26:51 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 2E852436F7; Fri, 9 Oct 2026 18:26:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E4421F000FF; Fri, 9 Oct 2026 18:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1791570411; bh=hCYG4mb6Y3+WHTuTX+96FEwLU/wi/dMPvdqqRXrtajA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=eAQlCbpAS96MLx70Tc9gifLpJ5iahGMxgYJh0/bJ0pS63IADsDEnPq08vLVgceN7Q o9yN87ptROgczUv2QkI5s4xXnMLel6q3WkGRlF4nOflAQvE1YxUzixs5Y657eC53km Tg/sapcML71/94YFP3oYNnbU8cuCD0rflyPoxGcNdbcN9QJWYNTl7kVG4gvkHdIOJ3 QV8tfjm2kH/Id98OADQPdImQSdpjAKFj20c6ppcmWjlHynqdK00ix1ERAu6MeyZPLU V9vAG6OOJoBUd/iq6r3SOLKCZbD+E1zb+9b1gCvKqRwVANvSJqF1yo1nlZscL2V70A 58qv+8XpuYRiw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 11/38] selinux: reject writable opens of policy file, drop mmap shared/write check To: =?utf-8?b?TG9yZW56byBTdG9ha2VzIChBUk0p?= Cc: "Alexander Gordeev" , linux-scsi@vger.kernel.org, "Marc Zyngier" , linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, "Christian Borntraeger" , linux-s390@vger.kernel.org, linux-usb@vger.kernel.org, "Heiko Carstens" , "Vasily Gorbik" , kvmarm@lists.linux.dev, selinux@vger.kernel.org, "Oliver Upton" , linux-rdma@vger.kernel.org, dri-devel@lists.freedesktop.org, kvm@vger.kernel.org, bpf@vger.kernel.org In-Reply-To: <20261009-b4-mmap-prepare-vma-flag-sanify-v5-11-923b70125b1e@kernel.org> References: <20261009-b4-mmap-prepare-vma-flag-sanify-v5-0-923b70125b1e@kernel.org> <20261009-b4-mmap-prepare-vma-flag-sanify-v5-11-923b70125b1e@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 09 Oct 2026 18:26:50 +0000 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" > The policy file has no write method and is exposed read-only (S_IRUGO in > selinux_files[]), yet sel_open_policy() performs no open mode check, so a > CAP_DAC_OVERRIDE caller can open it O_RDWR. Reject FMODE_WRITE at open, as > kernfs does. >=20 > The file can then never be mapped with FMODE_WRITE, so do_mmap() always > clears VM_MAYWRITE and VM_SHARED for MAP_SHARED mappings and the VM_SHARED > check in sel_mmap_policy() cannot be reached. Remove it. >=20 > This also stops sel_mmap_policy() clearing VM_MAYWRITE on a mapping that = is > neither a PFN map nor a mixed map, ahead of the core enforcing that only > such mappings may do so. >=20 > Acked-by: Stephen Smalley > Reviewed-by: Jann Horn > Acked-by: Paul Moore > Reviewed-by: Suren Baghdasaryan > 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/20261009-b4-mmap-pr= epare-vma-flag-sanify-v5-0-923b70125b1e@kernel.org?part=3D11