Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ve: init_cred now outlives VE stop, changing
  NULL-means-not-running checks undocumented
--

commit fb3c64a0ae176947a1145ebda4ba570e97c3e935
Author: Vladimir Riabchun <[email protected]>

ve: Defer ve creds drop until ve is completely destroyed

This moves the put of ve->init_cred out of ve_drop_context() into a new
ve_drop_cred(), which ve_destroy() calls. That way the creds stay valid
while users of a dead VE, such as an overlayfs superblock, still need them.

> diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
> --- a/kernel/ve/ve.c
> +++ b/kernel/ve/ve.c
> @@ -378,7 +378,10 @@ static void ve_drop_context(struct ve_struct *ve)
>       rcu_assign_pointer(ve->ve_nsproxy, NULL);
>       synchronize_rcu();
>       put_nsproxy(ve_nsproxy);
> +}
>  
> +static void ve_drop_cred(struct ve_struct *ve)
> +{
>       put_cred(ve->init_cred);
>       ve->init_cred = NULL;
>  }

[Severity: Low]
As reported by Konstantin Khorenko on v5 [1], init_cred now stays non-NULL
after a VE stops or fails to start. Is this behavioral change intended to be
left undocumented?

Several users treat init_cred == NULL as "VE not running". These are
ve_capable(), ve_capable_noaudit(), netlink_ve_capable(), ve_init_user_ns()
and sget_fc(). For a dead VE they now take the container branch. For
example, ve_init_user_ns() returns the container user_ns instead of
init_user_ns, which changes the early return in mount_too_revealing(). The
ve0 fallback in ve_capable() is likewise no longer taken.

The patch only renames the comments from "ve isn't running" to "ve isn't
started". The commit message does not say that these checks change for a
dead VE, and it is unclear whether these users were audited. Could the
message describe the new semantics, with NULL meaning only "never
started"?

[1] 
https://lore.kernel.org/r/179448942112.4060562.14182200426614413151.b4-review@b4

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

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

Reply via email to