From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E84D143F8A6; Thu, 30 Jul 2026 15:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785424155; cv=none; b=fISAT1GmYmneuFVkTaESNfCXW4d4zRirzrRTBxjuYiaFPzXH0iKSm6zzBq0qJp0h1ghFT1EeFuW+vKOdqDKa2Z/qGvr/Di94ZYPXo9svLFNNu3agHbLht+1BxZb1v+O/79FuUSKsr4bDwhbSOd2h71CjDyTuZXv5xd0QdDwjndQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785424155; c=relaxed/simple; bh=2oLSF5C9b0aj2OO/yNs16KZ8EftpV/IevmdrOslHxDY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OzNIHyqj7sDjeTSRkpQ9B2kbWjv1+dRHaVp7DiXV4LU+RQEJGzOC7GUaf90pY4ZFgP2GOHCO3/YIMjcW47V3Iet+MKmGGQup5jygBduVkB+1d9feoMt55IXPBLQSEzoyeYWEajSPitFOgCtzCBPxbne6fvyNymiICiDgf19kZ20= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ys6GXevm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ys6GXevm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7CB51F000E9; Thu, 30 Jul 2026 15:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785424153; bh=k22unhCHyo4cH0qJvVzVxphK2g/UFzxzchAmt6ob9X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ys6GXevm6vxiHo/WaEfmSiPOMeEG7ZlBsD69dhvk/vh6XJ5QinjA3TRFjSXlfJkCT DcS4XWKJLPCEtwzxWazL7Nq56U1dBskpgH513N+5KNhcmbYRNHNwPDlLDrJYugK7KV 8OOURmUE+6+QkcMqPoShydYvklD0JSzu6rZrtCao= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yichong Chen , Amir Goldstein , "Christian Brauner (Amutable)" , Sasha Levin Subject: [PATCH 6.18 267/675] ovl: fix trusted xattr escape prefix matching Date: Thu, 30 Jul 2026 16:09:57 +0200 Message-ID: <20260730141450.806954764@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141445.110192266@linuxfoundation.org> References: <20260730141445.110192266@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yichong Chen [ Upstream commit a8e72879cd0d8422c0b47d6d3c1802274fe73b98 ] In the trusted.* xattr namespace, ovl_is_escaped_xattr() compares one byte less than the escaped overlay xattr prefix length. This makes it match "trusted.overlay.overlay" without requiring the trailing dot. As a result, an xattr such as "trusted.overlay.overlayfoo" is incorrectly treated as an escaped overlay xattr. This can be reproduced by setting "trusted.overlay.overlayfoo" on a lower file and listing xattrs through an overlay mount. listxattr() then exposes it as "trusted.overlay.oo", and a following getxattr() on that listed name fails with ENODATA. Compare the full escaped prefix, including the trailing dot, so similarly-prefixed private xattrs are not misclassified. Fixes: dad02fad84cbc ("ovl: Support escaped overlay.* xattrs") Signed-off-by: Yichong Chen Link: https://patch.msgid.link/20260708082221.633602-1-chenyichong@uniontech.com Reviewed-by: Amir Goldstein Signed-off-by: Christian Brauner (Amutable) Signed-off-by: Sasha Levin --- fs/overlayfs/xattrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/overlayfs/xattrs.c b/fs/overlayfs/xattrs.c index 88055deca9360f..c86f1a6c8b937a 100644 --- a/fs/overlayfs/xattrs.c +++ b/fs/overlayfs/xattrs.c @@ -13,7 +13,7 @@ static bool ovl_is_escaped_xattr(struct super_block *sb, const char *name) OVL_XATTR_ESCAPE_USER_PREFIX_LEN) == 0; else return strncmp(name, OVL_XATTR_ESCAPE_TRUSTED_PREFIX, - OVL_XATTR_ESCAPE_TRUSTED_PREFIX_LEN - 1) == 0; + OVL_XATTR_ESCAPE_TRUSTED_PREFIX_LEN) == 0; } static bool ovl_is_own_xattr(struct super_block *sb, const char *name) -- 2.53.0