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 056E0C982D2 for ; Thu, 17 Sep 2026 17:25:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3740410E77A; Thu, 17 Sep 2026 17:25:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="DNP1bLwf"; 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 9D62710E77A for ; Thu, 17 Sep 2026 17:25:30 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 22FC7601FF; Thu, 17 Sep 2026 17:25:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0365D1F00898; Thu, 17 Sep 2026 17:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789665929; bh=z67KlTeWdWUfckdrR3+nSagyP8g7QLmUq4qSmxvPpiU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=DNP1bLwfXsSv7FB5Dqn1iXc9cwqzYVpipsMv/WqB+Liau2yasgds0BzoUsIMzpPD+ PlkJTOSTmZzDUTa37vRHRMlPf8fRc2uhyHJUlTXH/VA61WFVEJ2U1mZZr6r+TR7tGx ZpPCB3FLAat7SZ4qz+3PmCsqVOLMc+wQBajrWmHe3C1Jh87ulDaan82s3vn7DCQr1t J0oIAO3HvTUzRNM9czotxmUPVtEbxrUaVt4i3lsAtHf94Qk8SaSorDkxts1xKQ92Ey PQfmYQ143EX/ToZRDC4sdsE1WMgsddVdSDpQehSuKM3w7cR0ziqFtbkEuWlKLgYkBO NY578Lh+qCkxA== From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 12/40] selinux: reject writable opens of policy file, drop mmap shared/write check To: =?utf-8?b?TG9yZW56byBTdG9ha2VzIChBUk0p?= Cc: "Oliver Upton" , linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, selinux@vger.kernel.org, "Vasily Gorbik" , "Christian Borntraeger" , kvm@vger.kernel.org, linux-scsi@vger.kernel.org, kvmarm@lists.linux.dev, linux-rdma@vger.kernel.org, "Marc Zyngier" , "Alexander Gordeev" , dri-devel@lists.freedesktop.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, "Heiko Carstens" In-Reply-To: <20260917-b4-mmap-prepare-vma-flag-sanify-v3-12-4583d8a23bca@kernel.org> References: <20260917-b4-mmap-prepare-vma-flag-sanify-v3-0-4583d8a23bca@kernel.org> <20260917-b4-mmap-prepare-vma-flag-sanify-v3-12-4583d8a23bca@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 17 Sep 2026 17:25:28 +0000 Message-Id: <20260917172529.0365D1F00898@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" > 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 > 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=3D12