[Devel] [PATCH hci-8.2 v3 3/3] selftests/ve: check repeated slashes in a permission path
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Tue Dec 1 16:06:19 MSK 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/ve: default_granted() uses substring match, can
falsely skip
--
commit 3756d348a3f9b28f1c4ff13f32050647e7b022f1
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
selftests/ve: check repeated slashes in a permission path
The commit adds a repeated_slashes test to ve_perms_test.c. It writes a rule using a path with repeated slashes, such as "kernel//vmcoreinfo", and checks that the rule applies to the single-slash path and that a VE can read the file.
> diff --git a/tools/testing/selftests/ve/ve_perms_test.c b/tools/testing/selftests/ve/ve_perms_test.c
> --- a/tools/testing/selftests/ve/ve_perms_test.c
> +++ b/tools/testing/selftests/ve/ve_perms_test.c
[ ... ]
> + if (!entry_present(variant->dir_prefix, file))
> + SKIP(return, "%s absent under %s", file, variant->dir_prefix);
> + if (default_granted(self->cgv2_fd, variant->fs, file))
> + SKIP(return, "%s granted by default", file);
[Severity: Low]
Can this skip wrongly? default_granted() tests each line of ve.default_<fs>_permissions with strstr(line, entry), which matches anywhere in the line. A default entry that only contains "kernel/vmcoreinfo" or "bus/pci/devices" as a substring, for example a longer path, makes the helper return 1. The test then skips with "granted by default" even though the file isn't granted by default, and the repeated-slash coverage is silently lost.
default_granted() predates this patch, but this new caller adds another dependence on it. Would comparing the path field of each line exactly avoid the false skip?
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261201-ve-perms-skip-slashes-v3-0-aecb89f6d082@virtuozzo.com?part=3
More information about the Devel
mailing list