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=1793217017; b=Tu0YY/dzb3zFzE2PqK5iy6rjh2VgIOuinsj1Tev590JMH9DhfFwjsnWdgFbHQNKqey1C wQ6aU0O/d9/3tY7HiTbE//cYMYtW9eSK3euoisj6ZO4boBDxEqChLjB42lrmnu0Rlv5UA 3I1FoT5XQDrvft6sZaQI0jk9iWeIrB+gIOKy0N9KJlsWaKOgUFXZG/hg13DHI6XmTLX5J 9E8G3i0HwUcAnFylQHDNaUz0s7SfQFzixavpTzGTOLniWCSGdo4UnirfsRw/tKYQWsY/1 74Xj7mmV4hSHD/4cAsii6wy/gJn1rDBhrwkKyRD6n9wTa/EfpGB1N6qh8OWaRXm5GkQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793217017; 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=Feihw7WLUDkdsYPTwl0B48kpN711w1Vdf0EiUEDn3I0=; b=MDXtCEvzxsXwM/q5JAChffS9SU7fqsIK9d6DlRA8gR1OnL+x2SzMcxvFkiOYQY7snqSd PEzLNxKCDSZVQnEhSXm0EORt9Xb4ele5cycqogdNsu5ga+o56n63eLZ3zukqlfNHCNH/C vyxC1SupvEdVbsYcnSZ/46xYfk6HQppGFPH6u3egYoUbdDbTprs01n+UMxlXx2RgGw5kv gxQ8ObWa8aJjgM9yyZ9hPw38RazwoL2ihQNB8FFaNsQjco3GVQiKbLSCfu/PCEbYx0qk+ DozDTS7/mMnj7R8Egnp151/FxD2S1PI9xrT6wtSO++C3X//XuNxQ2IRgAaS4Qg1CSgQ== 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=WnTzKpBM; 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 56909606A330; Wed, 28 Oct 2026 19:50:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WnTzKpBM Received: by smtp.kernel.org (Postfix) with ESMTPSA id A978D1F01825; Wed, 28 Oct 2026 19:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793217017; bh=Feihw7WLUDkdsYPTwl0B48kpN711w1Vdf0EiUEDn3I0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WnTzKpBMfYt14RJeMBpK8dMvyd0riWPFv+7/IebNkYK0fFKGJn1D1nIDemvIboP9f Eh1dl97f3VN0hrbjUQRxhQ/+qhefCZ0X8NugTUs2Gx9/5nelgHrukl8LS7h0B2AI/l WNgED4YQS2Xxev6nIMbapyZTQnwdv3Pg/7FrUvxc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Dr. Thomas Orgis" , Carlos Maiolino , "Darrick J. Wong" , Serge Hallyn , Christoph Hellwig , Carlos Maiolino Subject: [PATCH 6.1 1759/1887] xfs: fix capability check in xfs Date: Wed, 28 Oct 2026 18:04:15 +0100 Message-ID: <20261028170539.484257084@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261028170459.200466217@linuxfoundation.org> References: <20261028170459.200466217@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Carlos Maiolino commit e2f62a9744ebad3bcb6347a648e615026e9efeff upstream. An user reported a bug where he managed to evade group's quota by changing a file's gid to a different group id the same user belonged to, even though quotas were enforced on both gids and the file's size was big enough to exceed the quota's hardlimit. Commit eba0549bc7d1 replaced a capable() call by a has_capability_noaudit() to prevent unnecessary selinux audit messages. Turns out that both calls have slightly different semantics even though their documentation seems similar. Where in a nutshell: capable() - Tests the task's effective credentials has_ns_capability_noaudit() - Tests the task's real credentials This most of the time has no practical difference but in some cases like changing attrs (specifically group id in this case) through a NFS client this will allow the quota code to use XFS_QMOPT_FORCE_RES, effectively bypassing quota accounting checks. Using instead ns_capable_noaudit() should fix this issue and prevent selinux audit messages. This also fix the remaining calls to has_capability_noaudit() Fixes: eba0549bc7d1 ("xfs: don't generate selinux audit messages for capability testing") Cc: stable@vger.kernel.org # v5.18 Reported-by: Dr. Thomas Orgis Signed-off-by: Carlos Maiolino Reviewed-by: Darrick J. Wong Reviewed-by: Serge Hallyn Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_fsmap.c | 2 +- fs/xfs/xfs_ioctl.c | 2 +- fs/xfs/xfs_iops.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -902,7 +902,7 @@ xfs_getfsmap( return -EINVAL; use_rmap = xfs_has_rmapbt(mp) && - has_capability_noaudit(current, CAP_SYS_ADMIN); + ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN); head->fmh_entries = 0; /* Set up our device handlers. */ --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1222,7 +1222,7 @@ xfs_ioctl_setattr_get_trans( goto out_error; error = xfs_trans_alloc_ichange(ip, NULL, NULL, pdqp, - has_capability_noaudit(current, CAP_FOWNER), &tp); + ns_capable_noaudit(&init_user_ns, CAP_FOWNER), &tp); if (error) goto out_error; --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -707,7 +707,7 @@ xfs_setattr_nonsize( } error = xfs_trans_alloc_ichange(ip, udqp, gdqp, NULL, - has_capability_noaudit(current, CAP_FOWNER), &tp); + ns_capable_noaudit(&init_user_ns, CAP_FOWNER), &tp); if (error) goto out_dqrele;