From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
To: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org, Sashiko <no-reply@sashiko.virtuozzo.com>
Subject: [Devel] [PATCH hci-8.2 v2 2/3] fs/proc, ve: count repeated slashes in a permission path as one
Date: Tue, 01 Dec 2026 13:09:15 +0100 [thread overview]
Message-ID: <20261201-ve-perms-skip-slashes-v2-2-235dbff55ffd@virtuozzo.com> (raw)
In-Reply-To: <20261201-ve-perms-skip-slashes-v2-0-235dbff55ffd@virtuozzo.com>
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@sashiko.virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@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
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-12-01 12:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 12:09 [Devel] [PATCH hci-8.2 v2 0/3] " Pavel Tikhomirov
2026-12-01 12:09 ` [Devel] [PATCH hci-8.2 v2 1/3] ve/kernfs: " Pavel Tikhomirov
2026-12-01 12:09 ` Pavel Tikhomirov [this message]
2026-12-01 12:37 ` [Devel] [PATCH hci-8.2 v2 2/3] fs/proc, ve: " Konstantin Khorenko
2026-12-01 12:09 ` [Devel] [PATCH hci-8.2 v2 3/3] selftests/ve: check repeated slashes in a permission path Pavel Tikhomirov
2026-12-01 12:37 ` Konstantin Khorenko
2026-12-01 12:18 ` [Devel] [PATCH hci-8.2 v2 0/3] ve: count repeated slashes in a permission path as one Vasileios Almpanis
2026-12-01 12:37 ` Konstantin Khorenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201-ve-perms-skip-slashes-v2-2-235dbff55ffd@virtuozzo.com \
--to=ptikhomirov@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=no-reply@sashiko.virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.