[Devel] [PATCH hci-8.2 v3 3/3] selftests/ve: check repeated slashes in a permission path
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Tue Dec 1 16:26:08 MSK 2026
On 12/1/26 14:06, no-reply at sashiko.virtuozzo.com wrote:
> 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>
default_granted() predates this series and enforce_denies uses it the same way. For these two entries a false match is highly unlikely: both are files, so nothing sits below them, and no sysfs/proc path ends in them today. A skip would also be reported by kselftest, not silent. I'll keep the helper as is here; an exact path-field compare can go as a separate cleanup if we want it.
>
--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
More information about the Devel
mailing list