[Devel] [PATCH hci-8.2 v2 2/3] fs/proc, ve: count repeated slashes in a permission path as one
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Tue Dec 1 15:09:15 MSK 2026
proc_perms_set() walks the path the same way as kernfs_perms_set() and
stops at the first empty component: a rule for "sys//kernel" sets sys,
and one with a leading slash ends at the proc root and is rejected with
EINVAL.
Skip empty components as a path lookup does. procfs has no helper that
walks a path this way.
https://virtuozzo.atlassian.net/browse/VSTOR-158149
Fixes: 39c029dcf7fa ("fs/proc, ve: add per-VE ve.proc_permissions")
Feature: kernfs: per-CT entries visibility and permissions configuration
Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
fs/proc/ve.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/proc/ve.c b/fs/proc/ve.c
index d957510c353a8..f6784a7024c93 100644
--- a/fs/proc/ve.c
+++ b/fs/proc/ve.c
@@ -143,8 +143,9 @@ static int proc_perms_set(char *path, struct ve_struct *ve, int mask)
if (sep)
*sep++ = 0;
+ /* Repeated slashes count as one, as in a path lookup */
if (!*dname)
- break;
+ continue;
nde = pde_subdir_find(de, dname, strlen(dname));
if (!nde) {
@@ -158,7 +159,7 @@ static int proc_perms_set(char *path, struct ve_struct *ve, int mask)
} while (sep);
read_unlock(&proc_subdir_lock);
- /* empty or leading-slash path walks to nothing, reject it */
+ /* empty or all-slash path walks to nothing, reject it */
if (de == &proc_root) {
ret = -EINVAL;
goto out;
--
2.56.0
More information about the Devel
mailing list