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=1796460813; b=MJ2Rqc2lBtFkScamhH86Nku4EAh2/Ji5n5wAdwi1mTgyTjy7F7SfZcPrn20pdwBplerv nYvKuRtbAl4JKEio48sI5rF+t7zwwh3uFil0vD8dFgQj2HntklycFfXM1vxZkB8dIIcRz Iz0JyrV+K6gBQKmHrbdgUi7tWZSw5dL5BXP31YU4by8iHiMqFg3WVyctKJ4NH/PqmIl0h I/z80YuQbJ+tdvngS2FuHd40Mr9RSa4Of55tfIiT4X/2E1XRPgTFHlFu7dS70trrRr3/f Jbei5tdRpESQtuoFevKg36+gMSOfSFm2MWLa6UhTfXkj6iWn4Pj6mDKSJTacmdq3X8w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796460813; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=chdOjWL+5PtF7m+EmvT5RLTUhx/8Ur4AV3cCx19kQQg=; b=EpsxI+qBWIvLRS/92wl6EnTFr9IFxQMNE64lYktXvKZELwaHJ8JB3gDsohZPk6/DXj8l jZb0ROORiAipUlzv287SMRSFDB/YC1Un57bTlUV7cmWn9upNX4a0VcysUENkteCejXPr6 GF0wCV16ejZSjqf980Q5kswfSb9lfGtwvQh9IDgYkkMoLhBmOjRm9W7WmFLLqfodAf8Hu zpC32ZPFAVQH+js3XRVd75whduMEExvRdu9SFkVwu4/nIdRZF2iNwpO57d7gnK9lAEoN5 GoGp13HJKmZN+MGUi/p+uX/H7vKvg3VWNupXKxGdxSpcIuXR6A6Or/KxI5F0CLcajgw== 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=bWjCCxl4; 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 5C7FA606A322 for ; Sat, 5 Dec 2026 08:53:32 +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=bWjCCxl4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D3141F0092B for ; Sat, 5 Dec 2026 08:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796460812; bh=chdOjWL+5PtF7m+EmvT5RLTUhx/8Ur4AV3cCx19kQQg=; h=From:Subject:Reply-To:Cc:In-Reply-To:References:Date; b=bWjCCxl4BciwaVDC+bmaDE7aRkUq0hp7uvE48OGmDS1wBiKKxG/F4fCr7ayJWA3hg iAj8wtNbIqdPexAV0ocSajJNepzpyr5+r506HN5UBv/z8J+j4c/A+OfZstn398O+7q amktDt537wQEmszLpSjz2IBBtWaDifs2Ar6IdJRN6aO9FgGnju73wixQ6aJHBPGIe3 sPPP1iWyS95j9faL/s+MwtNXM73XsZglJCg6fqnfaFeZ8BkkVxcoprYrRCjrHh6ka7 kJ9S47IKx3J6Q0v/Kf5e3J7KKnEXZ7Cy19G9uK3OTFWDBMDEYmX26do3G5y3tCEnfM XWu++XXtdRMww== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] selinux: read the inode SID once in selinux_inode_permission() Reply-To: sashiko-reviews@lists.linux.dev Cc: selinux@vger.kernel.org In-Reply-To: <20261205084009.3099383-1-zhangjiayi1014@gmail.com> References: <20261205084009.3099383-1-zhangjiayi1014@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 08:53:32 +0000 X-Mailing-List: selinux@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > selinux_inode_permission() reads isec->sid without isec->lock. On an > AVD cache miss it reads it three times: in task_avdcache_search(), for > avc_has_perm_noaudit(), and in task_avdcache_update(), which stores it > as the key of the new cache entry. If the SID changes between the > second and the third read, the new entry pairs the new SID with the > decision computed for the old SID. >=20 > The SID of an inode in use changes when selinux_task_to_inode() stores > the task's current SID in its /proc/ inodes, which pid_revalidate() > does on every lookup; when a directory is relabeled through setxattr; > and when an invalidated label is reloaded. For example, task A walks > through /proc/ of task B while B executes a program with a domain > transition, and a lookup of /proc/ by another thread stores B's > new SID between A's two reads. A's cache then holds the decision for > B's old SID under B's new SID. /proc/ is a directory, the only > [ ... ] >=20 > Fixes: 5d7ddc59b3d8 ("selinux: reduce path walk overhead") > Reported-by: syzbot+3857e9743aa17a4cd369@syzkaller.appspotmail.com > Closes: https://lore.kernel.org/all/6b118362.8e3793c5.1bab8b.1377.GAE@goo= gle.com/ > Signed-off-by: Jiayi Zhang Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205084009.3099= 383-1-zhangjiayi1014@gmail.com?part=3D1