Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] fs: subject overstates setup-only scope; host_entered open-codes
  pseudosuper test
--

commit 7f9d1b2c96b4b01e7ac65283588597610de48bff
Author: Mirian Shilakadze <[email protected]>

fs: give the mount relaxations of a pseudosuper VE only to setup tasks

This commit replaces the plain ve->is_pseudosuper checks in the device mount 
option filter and the VE mount limit with ve_current_is_pseudosuper(). It also 
adds a separate exemption in ve_try_reserve_mount() for host tasks that entered 
the VE after it started.

> diff --git a/fs/namespace.c b/fs/namespace.c
> index d622d9b72d32..20a03419bc0c 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c

[ ... ]

> @@ -3367,8 +3367,16 @@ int ve_devmnt_verify(struct ve_struct *ve, dev_t dev, 
> char *opts, bool new_mount
>  static inline int ve_try_reserve_mount(struct ve_struct *ve)
>  {
> -     int ret = ve_is_super(ve) || ve->is_pseudosuper ||
> -               ve_is_super(get_exec_env());
> +     struct mm_struct *mm = current->mm;
> +     /*
> +      * A host task that joined @ve after it started, such as the CRIU
> +      * helper that mounts proc for a nested pid namespace, is not a setup
> +      * task but still skips the limit while @ve is pseudosuper.
> +      */
> +     bool host_entered = ve->is_pseudosuper && task_ve(current) == ve &&
> +                         mm && mm->vps_dumpable == VD_VE_ENTER_TASK;

[Severity: Low]
This isn't a bug, but the subject says the relaxations go only to setup
tasks, while the mount limit now also exempts VD_VE_ENTER_TASK tasks. The
device mount option filter in ve_devmnt_process() and ve_devmnt_verify()
still uses only ve_current_is_pseudosuper(), so the two relaxations now
differ. Could the subject and opening paragraph say so?

host_entered also repeats the is_pseudosuper, task_ve(current) == ve, mm
and vps_dumpable tests from ve_current_is_pseudosuper() in
kernel/ve/ve.c, changing only the marker value. Would a named helper next
to ve_current_is_pseudosuper() be easier to keep in sync?

> +     int ret = ve_is_super(ve) || ve_current_is_pseudosuper(ve) ||
> +               ve_is_super(get_exec_env()) || host_entered;

-- 
Sashiko AI review ยท 
https://sashiko.vzint.dev/#/patchset/[email protected]?part=5

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to