All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
To: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v2 2/4] ve: Introduce override_ve/revert_ve helpers
Date: Mon, 2 Nov 2026 18:29:26 +0100	[thread overview]
Message-ID: <7f772e29-fae7-4cbc-bc0b-e339cd65050e@virtuozzo.com> (raw)
In-Reply-To: <179318868950.3559520.1087763096256737038.b4-review@b4>



On 10/28/26 12:58, Pavel Tikhomirov wrote:
>> These helpers mirror override_creds/revert_creds and are supposed to
>> be used together in cases when VE creds may be stored and later used
>> by the different VE task.
> 
> In multiple places like /proc/<pid>/status task will jump to other VE.
> 
> Also anything using get_task_ve will be tricked to believe in task VE
> change. E.g.:
> 
> Small information leak, drivers/connector/cn_proc.c:209.
> proc_event_connector() sends events about a task to that task's VE's
> listeners.
> 

Agree. I'll instead introduce a separate field in task struct,
which will contain ve override, and will be used by ve_capable only.

>>
>> https://virtuozzo.atlassian.net/browse/VSTOR-142405
>> Signed-off-by: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
>>
>> diff --git a/include/linux/ve.h b/include/linux/ve.h
>> index 717567775f58e..9d633717a7fe2 100644
>> --- a/include/linux/ve.h
>> +++ b/include/linux/ve.h
>> @@ -295,6 +295,23 @@ static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
>>   	return ve->vdso_64;
>>   }
>>   
>> +static inline struct ve_struct *override_ve(struct ve_struct *new_ve)
>> +{
>> +	struct ve_struct *old_ve;
>> +
>> +	guard(task_lock)(current);
> 
> This adds a lock to hot paths such as ovl_permission, ovl_getattr and
> ovl_lookup; AI deems this worth stating, probably not that critical,
> but the save check result approach has no such problem.

Adding a separate field for overrides will solve this problem.
Nobody should race on it.

> 
>> +	old_ve = current->task_ve;
>> +
>> +	current->task_ve = new_ve;
>> +	return old_ve;
>> +}
> 
> What about direction checks? ve0->veX ok and veX->ve0 is probably a
> security breach and should not be allowed.

I'll add a guard against it. If current is a CT process, it shouldn't be
able to override VE, only ve0 -> veX is OK.

> 

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

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-11-02 17:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 14:52 [Devel] [PATCH hci-8.1 v2 0/4] Fix kernel crash in overlayfs Vladimir Riabchun
2026-10-26 14:52 ` [Devel] [PATCH hci-8.1 v2 1/4] ve: Remove STOPPED state Vladimir Riabchun
2026-10-28 11:58   ` Pavel Tikhomirov
2026-10-26 14:52 ` [Devel] [PATCH hci-8.1 v2 2/4] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-10-28 11:58   ` Pavel Tikhomirov
2026-11-02 17:29     ` Vladimir Riabchun [this message]
2026-10-26 14:52 ` [Devel] [PATCH hci-8.1 v2 3/4] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-10-26 14:52 ` [Devel] [PATCH hci-8.1 v2 4/4] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-10-28 11:58   ` Pavel Tikhomirov
2026-11-02 17:35     ` Vladimir Riabchun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f772e29-fae7-4cbc-bc0b-e339cd65050e@virtuozzo.com \
    --to=vladimir.riabchun@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=ptikhomirov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.