From nobody Fri Oct 2 06:57:23 2026 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 3ABCF43CE57; Tue, 4 Aug 2026 09:46:11 +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=1785836772; cv=none; b=SxWC634fmTICG44NAyWEEkTKMsZ+o5DA7lPvEApdVaAf8N32dic1VnUbPzszR44emOzui1/9Q1iBs+mKSAek7aFbYYGKErwpRTEoGpCS9ZY30+vSL+9oCnGRmziJmwjKzcy/Zbmfa/tyDwFILyOf79EsOPmo/N8EQjCt56ZJyFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785836772; c=relaxed/simple; bh=YcU7GrGFUaJqL+3aXbZSaVkG/0ztE1GW5kFuqvSxOhw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Iitsw00oVmGcQQ4y8tcXxkwiLQ0/gYiEsB8hk9cRGb/vWTRpkndzUn65pGKelkTH5sBN8JYQYb0hrVPqasjwHNcfXTBb4KwhaVSQIs+3E5k9CU5+Y/JTgsxrytpsVqa52VK0EaTqspdzPHL4EVtAXQsvmoVYE8vkQbmCh3QDl5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d2cNLvU4; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d2cNLvU4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6091B1F00A3E; Tue, 4 Aug 2026 09:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785836770; bh=RJh+bg3/dAMmaBEyL3S0BEiJK+J4XOxu5GyZH+nl4KQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=d2cNLvU42RThjouHPhOs6cOBdFWezzxcpAwQo2dRDv2cpEs7SI0l6PUyZnXu65kXq wFxy5vFFgngPvXPqu9CDis0JXmamoZZ78FcafdO1GaSp7INuz8iVniLf4veA929cZ0 u9CWcVRXHHapYvGH2jv/6uh7Wef8/33wyI8wDmGvp+RgIbXssgLucslVd/GfZn8d6H wdLWzIOHkjOngaqKeni35i8rXwdSWZQZ9oJXdWQQ5AGKM9CzATViffFE11voMw5iLj +cCPDIsn4NKmcxTMcAXxaLc4DHR/QOn/YL+yOTPVbsVV8ruiWN6kGvqFv2Ctge19UH GTzqoTWrjUMxQ== From: cem@kernel.org To: cem@kernel.org Cc: jack@suse.cz, djwong@kernel.org, hch@lst.de, serge@hallyn.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, stable@vger.kernel.org, "Dr. Thomas Orgis" Subject: [PATCH v4 1/5] xfs: fix capability check in xfs Date: Tue, 4 Aug 2026 11:45:51 +0200 Message-ID: <20260804094602.84766-2-cem@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260804094602.84766-1-cem@kernel.org> References: <20260804094602.84766-1-cem@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Carlos Maiolino 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 capabi= lity testing") Cc: # v5.18 Reported-by: Dr. Thomas Orgis Signed-off-by: Carlos Maiolino Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Reviewed-by: Serge Hallyn --- 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(-) diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c index b6a3bc9f143c..7c79fbe0a74c 100644 --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -1175,7 +1175,7 @@ xfs_getfsmap( return -EINVAL; =20 use_rmap =3D xfs_has_rmapbt(mp) && - has_capability_noaudit(current, CAP_SYS_ADMIN); + ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN); head->fmh_entries =3D 0; =20 /* Set up our device handlers. */ diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 1b53701bebea..1a8af827dde1 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -647,7 +647,7 @@ xfs_ioctl_setattr_get_trans( goto out_error; =20 error =3D 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; =20 diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 6339f4956ecb..7a8c77fdcf68 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -835,7 +835,7 @@ xfs_setattr_nonsize( } =20 error =3D 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; =20 --=20 2.55.0 From nobody Fri Oct 2 06:57:23 2026 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 E544243E075; Tue, 4 Aug 2026 09:46: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=1785836775; cv=none; b=FaDz2B0SJLMvNOTKCICoigjLgOX6QILcS9R5n+KWRDSxPzUxxvWqLkeBZmUJeaT0wortTQgbFnNwAr0cypWFFRppxggYPf9pcBFSefCqp2CVsK9Uyk+NbKuhWqBIeBupHyldU61uU+Xr0nkO2KUgBpr8OfF67BYAtjhJKbwhmTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785836775; c=relaxed/simple; bh=puZMXUzMNDejvn1Pt4WdHdwlaLg2yCHSADSCep5H2Lo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RsbcXaYr81+Ud+9uayaREmRJ9Kgb8e17g3G0Z4BTnfJ1uUKw4ky5xJ23NR9a1b678cx/lNHiZeZFZ3Mb1RK6qkITLGKNBb+0ic7U66rv91fgtv8/S8OR8jKHoRhqVQ/3thr6Oh31or0l/8FBLG38cwbIutpMaVa0+d7OwZGG5g4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Xk+K+6oD; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Xk+K+6oD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EA681F000E9; Tue, 4 Aug 2026 09:46:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785836773; bh=gHdx+vPLDmMwBvC3c6ZsFC43tVpxURokFAMVbXNY29k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Xk+K+6oDyQw5AKz0RzhIujmmQWaISw7PohmMYo/1/B18zF221DxbIx+VmIa9Ijeur Us9vL2GuBhge9kuJZAY2/9xR+fXOvgFi3Hedq880GztixT507eeEOIdRSGZDBlYflE ol0NBZisJLd4K131zTdGfvjt7F/QXe82sr1PsA4PohyrL8yK89hu7mDFLc2BzIcBz5 2kGNadalg6hVyD1kYASBKexTd4E+ht5cVBxe2vERucRaAkuiurbcyEeuvNn1MD00nR HmnyAY0Et/tMXtJngLg2Fe7/gUo/J4UQGzHLtmev/E2blL1bSR6MpvmYgTEtgEytbi Aer7OE+pO4bUQ== From: cem@kernel.org To: cem@kernel.org Cc: jack@suse.cz, djwong@kernel.org, hch@lst.de, serge@hallyn.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v4 2/5] capability: Add new capable_noaudit Date: Tue, 4 Aug 2026 11:45:52 +0200 Message-ID: <20260804094602.84766-3-cem@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260804094602.84766-1-cem@kernel.org> References: <20260804094602.84766-1-cem@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Carlos Maiolino In some situations (quota enforcement bypass in this case) we'd like to check for a specific capability without triggering spurious audit messages from security modules like selinux. Add a new helper so we don't need to use ns_capable_noaudit() directly. Signed-off-by: Carlos Maiolino Reviewed-by: Christoph Hellwig Reviewed-by: Serge Hallyn --- V4: Mention capable_noaudit check for process effective capabilities V3: remove the extern declaration include/linux/capability.h | 5 +++++ kernel/capability.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/linux/capability.h b/include/linux/capability.h index 37db92b3d6f8..f8532d92fcad 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -145,6 +145,7 @@ extern bool has_capability_noaudit(struct task_struct *= t, int cap); extern bool has_ns_capability_noaudit(struct task_struct *t, struct user_namespace *ns, int cap); extern bool capable(int cap); +bool capable_noaudit(int cap); extern bool ns_capable(struct user_namespace *ns, int cap); extern bool ns_capable_noaudit(struct user_namespace *ns, int cap); extern bool ns_capable_setid(struct user_namespace *ns, int cap); @@ -167,6 +168,10 @@ static inline bool capable(int cap) { return true; } +static inline bool capable_noaudit(int cap) +{ + return true; +} static inline bool ns_capable(struct user_namespace *ns, int cap) { return true; diff --git a/kernel/capability.c b/kernel/capability.c index 829f49ae07b9..f4a7f1963c9d 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -416,6 +416,24 @@ bool capable(int cap) return ns_capable(&init_user_ns, cap); } EXPORT_SYMBOL(capable); + +/** + * capable_noaudit - Determine if the current task has a superior + * capability in effect by checking the process's effective + * capabilities (unaudited). + * @cap: The capability to be tested for + * + * This is the same as capable(), except it uses CAP_OPT_NOAUDIT as to pre= vent + * issuing spurious audit messages. + * + * This sets PF_SUPERPRIV on the task if the capability is available on the + * assumption that it's about to be used. + */ +bool capable_noaudit(int cap) +{ + return ns_capable_noaudit(&init_user_ns, cap); +} +EXPORT_SYMBOL(capable_noaudit); #endif /* CONFIG_MULTIUSER */ =20 /** --=20 2.55.0 From nobody Fri Oct 2 06:57:23 2026 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 5C4814399C2; Tue, 4 Aug 2026 09:46:16 +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=1785836777; cv=none; b=dS5z5TaG/NQyJ/HCNtQm7/Ju1vwnxsK0Dxq4j5JLPy8bGd8mMA+GbF2bCncF7pqDTIzOFA2hHi+2Qd88XXywa8vjk6JEtSi7pBsDQGMMdjuJi8+sBHVd27tkNRZk10qJPDyoP1HGw0h+/+VFkYhD5WZsNzrfGu326fUpatpU+nU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785836777; c=relaxed/simple; bh=OhW0DxNtB+grJr6h/lSX3eX/QTKGoU6+Emf8/E6bagM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VUQzSxybpPSp2triupJWGDy1fOWG8G+Aj4k4i0aRumj8cAlYjYK7tISg1csu4ZCF9tUbSD0NtZp5rG3uiMziDKhr4+ejOE/AKWh6dPLhDR/4m0ck5t37yFwsJ1pDqIv7TIJnTjeV+6Fti8hYBs94vQdMLb/I8y08C/hdUJNmnhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WjXv4Dsa; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WjXv4Dsa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DE531F00A3D; Tue, 4 Aug 2026 09:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785836776; bh=5CT6vz0QecjAwATibGZwj5uPUwM5BOI6sywpA/E+knw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WjXv4DsalGlOxkzfz+aODPbIPwutByVZ/R2maJFquF8qeghgp5+5bxgYsHK5fbCPq CS+oe6e8p3JYXOA0suprbJUWtJ/YTZ4v0NQo0SWBQwgUVqB/oTwGOzh5xeAsYO41/c NblIQXNsAiChljNVvVXrUTpH3pXJGO88h6MPfEN3uM1gUl1ABhCxOGR96Exl/BewLw +YFj4Fgn56zPeX8uWmWCBSGnrH7URN5jhgyM4c9VYJ2y/rTBoYslbpUgo7WVBzh5FA O1QQfIcvanwBaevHzeXEconX5/Pq2mEZJ2tZfv1iaWZmQmqpgacpI2fS3QSBE2FGKq 8EjEOwINwK4+w== From: cem@kernel.org To: cem@kernel.org Cc: jack@suse.cz, djwong@kernel.org, hch@lst.de, serge@hallyn.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v4 3/5] quota: Don't issue audit messages on quota enforcing Date: Tue, 4 Aug 2026 11:45:53 +0200 Message-ID: <20260804094602.84766-4-cem@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260804094602.84766-1-cem@kernel.org> References: <20260804094602.84766-1-cem@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Carlos Maiolino Calling capable() to determine if we can bypass quota enforcement or not can trigger spurious audit messages. We don't really require it here so just use the capable_noaudit() version. Signed-off-by: Carlos Maiolino Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Acked-by: Jan Kara --- fs/quota/dquot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 9850de3955d3..dab93422a57b 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1308,7 +1308,7 @@ static int ignore_hardlimit(struct dquot *dquot) { struct mem_dqinfo *info =3D &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.ty= pe]; =20 - return capable(CAP_SYS_RESOURCE) && + return capable_noaudit(CAP_SYS_RESOURCE) && (info->dqi_format->qf_fmt_id !=3D QFMT_VFS_OLD || !(info->dqi_flags & DQF_ROOT_SQUASH)); } --=20 2.55.0 From nobody Fri Oct 2 06:57:23 2026 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 27B184432F7; Tue, 4 Aug 2026 09:46:18 +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=1785836780; cv=none; b=BpgG/9tjgDzsiqVXhxqCN+U2lH89VzUG4+YGXIBrbEX0Yom9xSMBdoIAL0F6xNhUMgpEsTYAXeEgKid6bE/p+M5IRRR3bl8l+hYiNDcVDG7gNnQD/Wnm6cb4vQ+sycFdWVAtyep1H+SyNmlrvB5KlDCcy3g1yAvEj4SqfTZq0qY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785836780; c=relaxed/simple; bh=5o4waX4tYcO96lu2V9JCXdXui466KVAfJCxo44iHj6Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RuR60aycwquA6IQ3PeFYvKjWvfNnC6oxpMAobe5byUwHWAmcEt7o9oZUtICT9U8kEv6cZbsjUl1Jh6ZiQeXEo87i9aWGBmQjHp34bx5sPeqFCW8lCP2BHqyD1E9YdCFpKgeSiHR2BM0oaGySB/eGrBfnH3hXhf8TqkAK6n8MlYA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wf7Ax6Nz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Wf7Ax6Nz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA24C1F000E9; Tue, 4 Aug 2026 09:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785836778; bh=gEbA1stGp4temkIwHIMDReZrCcpfXyIaBqXoOwUrzbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Wf7Ax6NztfChmjRWMqiGB/ca7FqVZHpYfxCNUZjdgc/mo+jJFaB8TynV/miUkBXRe O2QJP/XQ3yZG7u4IK/VkQI68OefA9cuDpszAoxB391udt1fWtwJkjFJoKLdbqTYA3x vKi4xW8lnf/agN3VGwrwciu+BtF3vDrkfTnsAH/wtngw3Tc/tM1kzcrjSyxgPVsfwv bdXZjuiO75GG/gcpTbwYJ9oXUoT0FijX70QkaMBUr7ld4ydAYLDXV5eoXY3H6iPBRo fl1kRTs86CO8rbC1Pxfq3FmJ+0v2IG9tFMYT0Opt9CUnVEKio8s8+BalLpWPTO1cNh eSyYbzSdzGHSg== From: cem@kernel.org To: cem@kernel.org Cc: jack@suse.cz, djwong@kernel.org, hch@lst.de, serge@hallyn.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v4 4/5] xfs: replace ns_capable_noaudit Date: Tue, 4 Aug 2026 11:45:54 +0200 Message-ID: <20260804094602.84766-5-cem@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260804094602.84766-1-cem@kernel.org> References: <20260804094602.84766-1-cem@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Carlos Maiolino Now that capable_noaudit() is available, we don't need to keep using ns_capable_noaudit() and specifying the usernaspace every single time. Signed-off-by: Carlos Maiolino Reviewed-by: Christoph Hellwig --- V4: Fix indentation on xfs_ioctl_setattr_get_trans() changes fs/xfs/xfs_fsmap.c | 3 +-- fs/xfs/xfs_ioctl.c | 2 +- fs/xfs/xfs_iops.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c index 7c79fbe0a74c..041bb2105ec6 100644 --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -1174,8 +1174,7 @@ xfs_getfsmap( if (!xfs_getfsmap_check_keys(&head->fmh_keys[0], &head->fmh_keys[1])) return -EINVAL; =20 - use_rmap =3D xfs_has_rmapbt(mp) && - ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN); + use_rmap =3D xfs_has_rmapbt(mp) && capable_noaudit(CAP_SYS_ADMIN); head->fmh_entries =3D 0; =20 /* Set up our device handlers. */ diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 1a8af827dde1..96ca3e480cb9 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -647,7 +647,7 @@ xfs_ioctl_setattr_get_trans( goto out_error; =20 error =3D xfs_trans_alloc_ichange(ip, NULL, NULL, pdqp, - ns_capable_noaudit(&init_user_ns, CAP_FOWNER), &tp); + capable_noaudit(CAP_FOWNER), &tp); if (error) goto out_error; =20 diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 7a8c77fdcf68..3f36d6e7b917 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -835,7 +835,7 @@ xfs_setattr_nonsize( } =20 error =3D xfs_trans_alloc_ichange(ip, udqp, gdqp, NULL, - ns_capable_noaudit(&init_user_ns, CAP_FOWNER), &tp); + capable_noaudit(CAP_FOWNER), &tp); if (error) goto out_dqrele; =20 --=20 2.55.0 From nobody Fri Oct 2 06:57:23 2026 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 D7B48443E4E; Tue, 4 Aug 2026 09:46:21 +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=1785836782; cv=none; b=KdGXtNNA/kPANprSwuQVBkVO6k7bVqroO8RB3o/O4CvvXAE71418uA8fbOl2UWd4GwdlcKVZjP0Sdu9SlJBgLLZSoa1Mv+//+iPOjeVkxgaOmPnLa764rV1c71J6FwHe4oc0pboI3yFXV4A6DGyjbnAEVrIr8ch+HMeOVhu9ofA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785836782; c=relaxed/simple; bh=yA8BgOH6CKTpoVpmwQuEwca7Vt9peEfZ5FZfaUAxHuE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TPkfI2QPe8XiW3g88ilUa7g+inv49I3UGbkZJVeMVS48WlxV/dEcVCGmpvFCx006ETULtAuxjQaBdqIOQP4JAVyB6LeSIW/FGkiir/LEC47vnM1iVEtHz1KjRatrzmuPYQ3WgtFiIxRN6cjeJ/5sOl2GDcmZEUyRKtXG1dEZAFk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=URU7TPax; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="URU7TPax" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 547BF1F00A3D; Tue, 4 Aug 2026 09:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785836781; bh=KD3nQlzzgPQMXfG3TkWBP0YqCUulLthOljSvVABaabw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=URU7TPaxCYuX3zvG2RUYaJB4XVRkC5Dkz8/zAz09dFQxc6oQA5Oudxc8uJYWD5+Kb Psj+QoM8EAQ5LSKGMkoOlYCKr+O0VdQUpFwq6NSLb0DXWK49A1h1ycIREg8b3lWDZG b86yq7AURMP4S98OV6niLAydXWCGZJKXudkkxHTsyNPNGUBIvlJrsIKh5/CNm7PbQW j7J95Ealrh1Qc40xCD1N6CmBrZTVSxvhwCr+qGXnIOfExDixbPn/fDJp+kziNIOmCj ycDsy0d5A3lGxpXRpGqIzsMv1cuU1K00sAaey64XtlozNpirONb0PegCoTxuB2462+ kIoA/5nNMOJUw== From: cem@kernel.org To: cem@kernel.org Cc: jack@suse.cz, djwong@kernel.org, hch@lst.de, serge@hallyn.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v4 5/5] capability: unexport has_capability_noaudit Date: Tue, 4 Aug 2026 11:45:55 +0200 Message-ID: <20260804094602.84766-6-cem@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260804094602.84766-1-cem@kernel.org> References: <20260804094602.84766-1-cem@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Carlos Maiolino This has been originally exported to be used in xfs. Giving we are not using it anymore, unexport for consistency. Signed-off-by: Carlos Maiolino Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Reviewed-by: Serge Hallyn --- kernel/capability.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/capability.c b/kernel/capability.c index f4a7f1963c9d..90e6ab62f6db 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -326,7 +326,6 @@ bool has_capability_noaudit(struct task_struct *t, int = cap) { return has_ns_capability_noaudit(t, &init_user_ns, cap); } -EXPORT_SYMBOL(has_capability_noaudit); =20 static bool ns_capable_common(struct user_namespace *ns, int cap, --=20 2.55.0