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=1796385650; b=v3MAqNa57VGW7uSfaulAYuDTFRpYQF5p0nPDeoBXmKbDSDV+nSb1dLNwBfjE0m2KKhj/ BMpG9t8L0py8tsbBUQkMZ97AENvpcmmSZgZ5xR0o9MZUtxkk+ghCRQFWD9ZrThSemimo1 7J3bCgHOvu8PQsfYBzS+EthjOaYDV7n7Dp7jfl7Zwoy58nUYg58+G3kzPQdd3OvF+wIy8 teAXkdHffuZM6uRyu09sfJdLaNNhY4zrLDCvcG8X8HHhai6syeJLaDX1SyljAmwTQYAEj CO0SZ4TfHkNs3PTs/B7oQGTQfDm2u/TCrp7/Wek7wGoTXbGMAyKTMpde3SOCw5uz07g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385650; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=XMLIcttCsTHrZtlVRx5iYIMVx1+UBbn/4Ws6KhKVk40=; b=pgcwClkOrcCq6Hbdg5zH2531oIe7wdXVnOCMz6ydrqpQaqfGLpbRiwuUOI7XRW5qQOW4 SRr+UwlFT6pETSNFIZpWSRlPVusHaF4+RAduV035oEtEarCI1koOwU1eYLSxoS6xo+Pjh W3ef7olDmnOsGIc5mWZQugA0j7O83fgZkG/hMDJNXT0eB2rQP/uSOvBnYzqnyLsOGpytY nw3yJ2LHuTOV1vR5C6ISZk6+n57+zh0TOqI6XA0dDTL4SqXjMsmjSjWx1WuDaGIwFXPC8 VfZH7oCvoBPTx2AdrPBfZAFVPdFTxN/wlZIqZm9UEIOCQK2JKGTmOMDf/NJMWGHUGsA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=xfvPV8mK; 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 35F7F606A322; Fri, 4 Dec 2026 12:00:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=xfvPV8mK Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3DCF1F000CE; Fri, 4 Dec 2026 12:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385650; bh=XMLIcttCsTHrZtlVRx5iYIMVx1+UBbn/4Ws6KhKVk40=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xfvPV8mKaUrv5INIarH/v4/2fSOuLokBpRsFnIZSTfbSFI92on+pKL8ZcxILQy7rW Y26IlXsZZRcz4hUvHKrOs5Fxu3AJRFLr57Td3q6kcuvwZdLAOIWk2qoZaPMTnHHGiq T4HedDevX36BRVERb0I+cGpLo3l99Y5zCy1tFByg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, liuyong , Namjae Jeon , Paulo Alcantara Subject: [PATCH 6.6 0594/1167] smb: client: compare owner and group SIDs using their encoded lengths Date: Fri, 4 Dec 2026 19:00:21 +0900 Message-ID: <20261204100717.529109149@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: liuyong commit a2dabe73ea05ad3b3f8e1cc08fb2e7c2ddc5564b upstream. populate_new_aces() compares owner and group SIDs over sizeof(struct smb_sid), including storage for all 15 possible subauthorities. Received SIDs contain only their encoded subauthorities. The comparison can read past the security descriptor, as shown by the supplied KASAN report for a 44-byte descriptor during chmod. The input SIDs have already been checked by sid_from_sd(). Require equal subauthority counts, then compare only the fixed SID header and the encoded subauthorities with memcmp(). The count check ensures that both validated SIDs contain the number of bytes being compared. These issues were discovered and fixed by Qihoo 360's Tulongfeng multi-agent system. Fixes: 0f22053e811c ("cifs: Fix unix perm bits to cifsacl conversion for "other" bits.") Cc: stable@vger.kernel.org Signed-off-by: liuyong Reviewed-by: Namjae Jeon Signed-off-by: Paulo Alcantara Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/cifsacl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/smb/client/cifsacl.c +++ b/fs/smb/client/cifsacl.c @@ -1062,7 +1062,10 @@ static void populate_new_aces(char *nacl * updated in the inode. */ - if (!memcmp(pownersid, pgrpsid, sizeof(struct smb_sid))) { + if (pownersid->num_subauth == pgrpsid->num_subauth && + !memcmp(pownersid, pgrpsid, + CIFS_SID_BASE_SIZE + + pownersid->num_subauth * sizeof(__le32))) { /* * Case when owner and group SIDs are the same. * Set the more restrictive of the two modes.