From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796300623; b=WsUhpxl/CMMMrL8BssLMXGwsoDcMpYiX45N1T5pMW/2/vi5COXHHIhg6TCjcG91ocku1 m8YHwhgq4M8jYjFVu9Fmo6vNRbVf3W0gISNhWeo3YM37h1OMhfk3g3L0FCLZrADxU7Mpe +4bMVZIPq6cG9VuCBxlc01nAv9EHTDbbNfZzMVyzu6MQs5d4VAXCDfOijcthkl1vZMmkH dZ1HPkxjIPrBFtkupXM9R+wfU2WPED/eO/JEVAsFOoPnuN5COyrP3J1vetGvqqHkX8Bj8 u70QniU1/LUDqwPSDL4Y7iIJlXE7sJeSJByBqZPFbtUnCvIKYekeBcYOXl86VLXBGKw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796300623; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=8z8dG22gGDjEdu9qo/72GF4zJNKmoljQ3Bry+M0cVXw=; b=nQ0h8i1iCl0DgCNAa/zGHhtxZ5pV9FrrGPxy+Ig1KRNrNt+DOttTezsvFS++qjnFLnIG bnVxj57OZhfVXq0jd1m1Bl798RmTYCc2XHPqNmewLG85laHFaMcM0eKMStNLPP+zLYrqv 4DNm9GIIYnBPN8avBWW1lfdLDvzrCdgxEQ/4t/+BuQcPGpxVWYBXSn2OZR0EJaYULu/Eq aSaCqvCgXeTNZwiz3i750/qHlptL53opSf4nYfN82GAorybRh8+1h4ESzvPq1QDse8Upx E/9KRpRaROWb845rtiybenS+odzYoIIc9YMA6idZRMv6kW4OlmyKZhyvVXCUPFvzEFA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Hq8TxZrY; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63B3F606A322 for ; Thu, 3 Dec 2026 12:23:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Hq8TxZrY Received: by smtp.kernel.org (Postfix) with ESMTPSA id E78781F00893 for ; Thu, 3 Dec 2026 12:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796300623; bh=8z8dG22gGDjEdu9qo/72GF4zJNKmoljQ3Bry+M0cVXw=; h=From:Subject:Reply-To:Cc:In-Reply-To:References:Date; b=Hq8TxZrYR3jU+mY7sEY6hcNNMRCey4FFYVjYoo24q1Mgw7a1BbOnrw3j23dw+26Gn y+cO6StWRiCUHn/38MwWvJKK6W/7tHbQCa0eKcAM1aJwK+oPBIJt6Koqz6YPr7CApZ navm93SRwq6CkQGYwFQn9yuRKHyIzerKM7ynNK84Cz6JeTtYBCd/ffzvK1KnhFpgTi ZPwgT+QHc/ctvk14xJKqT4FsHXcoLF6RAosJAertj23pwpXwyBOYEC49NHSX4VVkEE E7hGV1Ufhb09yA+O1EfI5SkQAJUSkBHNSEgjmAa4cgotXAfcCpi77lhE0TLJKqaM8y n/7tJFgmfbruQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] cachefiles: Use the cache's credentials for reads and writes Reply-To: sashiko-reviews@lists.linux.dev Cc: selinux@vger.kernel.org In-Reply-To: <20261203120210.2-1-kim@sondrup.io> References: <20261203120210.2-1-kim@sondrup.io> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 12:23:42 +0000 X-Mailing-List: selinux@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > When a confined task (such as a container or VM running under > container_t) reads from a network filesystem with fscache under SELinux > enforcing, every cache read fails and data is refetched from the server. > Furthermore, since commit e2d46f2ec332 ("netfs: Change the read result > collector to only use one work item"), in-task copy-to-cache writes > (such as through memory mappings) are denied as well. Each failure logs > an SELinux denial: >=20 > avc: denied { read } for pid=3D... comm=3D... > scontext=3Dsystem_u:system_r:container_t:s0:c355,c657 > tcontext=3Dsystem_u:object_r:cachefiles_var_t:s0 tclass=3Dfile >=20 > Cachefiles opens backing cache files with the cache's credentials, and > Documentation/filesystems/caching/cachefiles.rst ("Security Model and > SELinux") specifies that it should switch to those credentials when > accessing the cache. However, cachefiles_read() and __cachefiles_write() > do not switch, so vfs_iocb_iter_read() and vfs_iocb_iter_write() > revalidate access against the calling task's SID via > security_file_permission(), which gets denied. >=20 > Switch to the cache's credentials around the read and write operations, > matching cachefiles_prepare_write() and cachefiles_issue_write(). Primary > access checks remain enforced on the network filesystem inode, so the > task gains no unauthorized access. With this change, cache reads and > writes succeed under SELinux enforcing with zero denials. >=20 > Fixes: 047487c947e8 ("cachefiles: Implement the I/O routines") > Cc: stable@vger.kernel.org > Signed-off-by: Kim Sondrup Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203120210.2-1-= kim@sondrup.io?part=3D1