[Devel] [PATCH hci-8.1 v5 2/5] ve: Introduce override_ve/revert_ve helpers

Vladimir Riabchun vladimir.riabchun at virtuozzo.com
Thu Nov 12 23:41:12 MSK 2026



On 11/12/26 14:17, Konstantin Khorenko wrote:
> I won't apply this version, please send v6 with the changes below.
> 
> On Tue, 10 Nov 2026 18:26:49 +0100, Vladimir Riabchun <vladimir.riabchun at virtuozzo.com> wrote:
>> This field is not supposed to be inherited via fork, so report
>> a check for this was added as well.
> 
> - Item 6 of the cover letter reply: rewrite this sentence, and say in
>    the message that ve_capable() now uses overrided_ve and which VE
>    switches are allowed, refused, or skipped.
> 
> The sentence does not parse. The message also never says that
> ve_capable() and ve_capable_noaudit() change, or what override_ve()
> does for a CT caller. That is the part a reader of this patch needs.
> 
>> +	/* CT tasks are not supposed to switch VE context, this is a breach */
>> +	if (new_ve != get_exec_env() && !ve_is_super(get_exec_env())) {
>> +		if (ve_is_super(new_ve)) {
>> +			/* Don't cry about it, this event we may allow. */
>> +			return ERR_PTR(-EPERM);
>> +		}
> 
> - Item 1 of the cover letter reply: return the current override
>    (old_ve) here, and ERR_PTR(-EPERM) for the cross-CT case below.
> 
> ERR_PTR(-EPERM) here means "go on, just do not switch the VE", so the
> caller has to tell this error from a real one, and patch 5 does that
> twice with PTR_ERR() != -EPERM. Returning old_ve gives the same
> ve_capable() result: overrided_ve stays as it was, and revert_ve()
> writes back the same value. Then any error pointer is a real refusal,
> and the "this is a breach" comment no longer covers an allowed case.

I disagree. CT -> Host VE switch is not a normal case. We know it is
fine for overlayfs, but for other cases we should review it separately,
if this is a correct usage or CT is doing something nasty.

> 
>> +		pr_err_ratelimited("Invalid VE override: %s -> %s\n",
>> +					ve_name(get_exec_env()),
>> +					ve_name(new_ve));
> 
> - Item 2 of the cover letter reply: do not print ve_name(new_ve).
> 
> new_ve is the creator VE of the overlay. It is pinned only by
> get_ve(), and the CT may already be stopped and its cgroup removed.
> ve_offline() frees ve->ve_name with plain kfree() and no RCU, so this
> can read freed memory, or print "(null)".
> 
>> +	WARN_ON(orig->overrided_ve);
> 
> - Item 3 of the cover letter reply: WARN_ON_ONCE.
> 
> If this ever fires, it fires on every fork in the window. One trace
> is enough.
> 

-- 
Best regards, Riabchun Vladimir
Linux Kernel Developer, Virtuozzo



More information about the Devel mailing list