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=1795618611; b=AQEn8s8lVZ/XzsoyCF/+89blvtUyh9oD03Gi3M5dtVgq5qW2WB9HwTWogfLFvv165qqO nM4exDvTKUKJCWQt0Kt4tMHrDfTzQUUrJAM201tb1r70ZWz9TiWTT8IYstx0Tlyagi/4j 2xk+s8SbSnDq9/pjjYUjwzlu4At03Ba7Uo+KzVbdkS+gIYwsaIkiMouvjr/NEcXJjCjR1 va8J8s1+zo/lXrHwSkvHALzfK/LNuUa6WCBWxc0TxPYO1DrWq1Ob0Y4flhuuh3gGM6cmG 0aYNdxPhqlwgr9wrJyraLL98E6wpg27DoNbCrle5quynKiQrPzjTtt12sDM8ZMGRdeg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795618611; 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=77opuGQ/t4sZ0IdJGtmWkJ/B76C5ZOOSrlwPAwGR53o=; b=tPBohhVY6ry7vV1epuHI1dzqAKNqj+qGOAnSXPAqsUIAtf3rvcP+AFy33g0pRR5HhJoy jEvSMwDtP1zzwFTIlYSmxZeSBWeXoaPP6CNXy/zeFR63DMEU8bGz5pcJbRB3RPsAfUzT5 WdI7Kiy/r3gg0z1CpcArXgunSZC+knD3lNMBrrr5XO4A8Z5lADtv2Fpb7t4m4DFA6Qvbg 28ZFFxnR26xe3vWulJM9jylnPhDL9+BxjPwxTr3FfzJ2pRj+UwNG22UtgGlq+HCf/B2cE VjXgulukqKgsw7BI2bt0yWG1KUywx0ZF09jiyIxy7k38wdDlJE47TKFBtiA1pRAnDsQ== 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=Ojxn1Iq6; 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 DD3EE606A323; Wed, 25 Nov 2026 14:56:51 +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=Ojxn1Iq6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B8191F000D2; Wed, 25 Nov 2026 14:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795618611; bh=77opuGQ/t4sZ0IdJGtmWkJ/B76C5ZOOSrlwPAwGR53o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ojxn1Iq64qEhPP3Xk7qNXENra1tR6qc/wK66LLiHDM1O7OG3dHBNVL0nx7DlRD8Yi 4aClM2tidF4tEWc8nSJr8BBKMJWTvKPdgaSPA2a5nQUcRcRybMlenH1bep8w7nbzAf 6eV2aTHJ5iqE1kdU/NWpY2pOV64i8HLlDwtwIMjw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jan Kara , Jeff Layton , Christoph Hellwig , "Christian Brauner (Amutable)" , Sasha Levin Subject: [PATCH 7.3 0334/1005] statx: dont leak STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask Date: Wed, 25 Nov 2026 15:27:52 +0100 Message-ID: <20261125143829.557641960@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125143821.729802100@linuxfoundation.org> References: <20261125143821.729802100@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeff Layton [ Upstream commit 925d238324c79bcb75ad0add1d1b9d31d5f48115 ] STATX_ATTR_CHANGE_MONOTONIC is kernel-internal. cp_statx() strips it from stx_attributes but copies attributes_mask verbatim, so it leaks to userland on filesystems that advertise it (nfs, ceph), e.g. stx_attributes_mask = 0x8000000000303000 on NFS. Add a new mask constant and apply it to both fields. Fixes: a1175d6b1bda ("vfs: plumb i_version handling into struct kstat") Reviewed-by: Jan Kara Signed-off-by: Jeff Layton Link: https://patch.msgid.link/20261103-statx-v2-1-8b09aa8118ab@kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Christian Brauner (Amutable) Signed-off-by: Sasha Levin --- fs/stat.c | 6 +++--- include/linux/stat.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index e03954c36b33e..689c610f36769 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -710,8 +710,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer) /* STATX_CHANGE_COOKIE is kernel-only for now */ tmp.stx_mask = stat->result_mask & ~STATX_CHANGE_COOKIE; tmp.stx_blksize = stat->blksize; - /* STATX_ATTR_CHANGE_MONOTONIC is kernel-only for now */ - tmp.stx_attributes = stat->attributes & ~STATX_ATTR_CHANGE_MONOTONIC; + tmp.stx_attributes = stat->attributes & ~STATX_ATTR_INTERNAL_MASK; tmp.stx_nlink = stat->nlink; tmp.stx_uid = from_kuid_munged(current_user_ns(), stat->uid); tmp.stx_gid = from_kgid_munged(current_user_ns(), stat->gid); @@ -719,7 +718,8 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer) tmp.stx_ino = stat->ino; tmp.stx_size = stat->size; tmp.stx_blocks = stat->blocks; - tmp.stx_attributes_mask = stat->attributes_mask; + tmp.stx_attributes_mask = stat->attributes_mask & + ~STATX_ATTR_INTERNAL_MASK; tmp.stx_atime.tv_sec = stat->atime.tv_sec; tmp.stx_atime.tv_nsec = stat->atime.tv_nsec; tmp.stx_btime.tv_sec = stat->btime.tv_sec; diff --git a/include/linux/stat.h b/include/linux/stat.h index 9c57091328622..4f0a4af7a0671 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -69,4 +69,7 @@ struct kstat { /* file attribute values */ #define STATX_ATTR_CHANGE_MONOTONIC 0x8000000000000000ULL /* version monotonically increases */ +/* mask of STATX_ATTR_* bits that is private to the kernel */ +#define STATX_ATTR_INTERNAL_MASK (STATX_ATTR_CHANGE_MONOTONIC) + #endif -- 2.53.0