[Devel] [PATCH RHEL9 COMMIT] xfs: Don't show the active balloon to user

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 25 15:49:50 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.16
------>
commit da79a1d5b788eba1179161a234ce9253de4893e5
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon Oct 25 15:49:50 2021 +0300

    xfs: Don't show the active balloon to user
    
    Prohibit a notpriviliged user to reach balloon.
    Prohibit everything to unlink it.
    
    https://jira.sw.ru/browse/PSBM-133811
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/xfs/xfs_inode.c | 4 ++++
 fs/xfs/xfs_iops.c  | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 990b72ae3635..32f99876dc19 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -670,6 +670,10 @@ xfs_lookup(
 	if (error)
 		goto out_unlock;
 
+	error = -EPERM;
+	if (unlikely(inum == READ_ONCE(dp->i_mount->m_balloon_ino)))
+		goto out_free_name;
+
 	error = xfs_iget(dp->i_mount, NULL, inum, 0, 0, ipp);
 	if (error)
 		goto out_free_name;
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 93c082db04b7..09211e1d08ad 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -382,6 +382,10 @@ xfs_vn_unlink(
 	struct xfs_name	name;
 	int		error;
 
+	if (unlikely(d_inode(dentry)->i_ino ==
+			READ_ONCE(XFS_I(dir)->i_mount->m_balloon_ino)))
+		return -EPERM;
+
 	xfs_dentry_to_name(&name, dentry);
 
 	error = xfs_remove(XFS_I(dir), &name, XFS_I(d_inode(dentry)));


More information about the Devel mailing list