Skip to content
Snippets Groups Projects
Commit ab39ce7d authored by Christian Brauner's avatar Christian Brauner Committed by Frieder Schrempf
Browse files

acct: block access to kernel internal filesystems

commit 890ed45bde808c422c3c27d3285fc45affa0f930 upstream.

There's no point in allowing anything kernel internal nor procfs or
sysfs.

Link: https://lore.kernel.org/r/20250127091811.3183623-1-quzicheng@huawei.com
Link: https://lore.kernel.org/r/20250211-work-acct-v1-2-1c16aecab8b3@kernel.org


Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
Reported-by: default avatarZicheng Qu <quzicheng@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3106d6f6
No related branches found
No related tags found
1 merge request!192🤖 Sync Bot: Update v6.12-ktn to Latest Stable Kernel (v6.12.17)
......@@ -243,6 +243,20 @@ static int acct_on(struct filename *pathname)
return -EACCES;
}
/* Exclude kernel kernel internal filesystems. */
if (file_inode(file)->i_sb->s_flags & (SB_NOUSER | SB_KERNMOUNT)) {
kfree(acct);
filp_close(file, NULL);
return -EINVAL;
}
/* Exclude procfs and sysfs. */
if (file_inode(file)->i_sb->s_iflags & SB_I_USERNS_VISIBLE) {
kfree(acct);
filp_close(file, NULL);
return -EINVAL;
}
if (!(file->f_mode & FMODE_CAN_WRITE)) {
kfree(acct);
filp_close(file, NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment