OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v5 2/5] ve: Introduce override_ve/revert_ve helpers
Date: Fri, 13 Nov 2026 21:21:18 +0100	[thread overview]
Message-ID: <b6af266a-2fb1-43cd-b63b-4bb980aaac0d@virtuozzo.com> (raw)
In-Reply-To: <2a1b23bf-1383-4581-b0a2-fcc4bc75b1f0@virtuozzo.com>

On 11/12/26 21:41, Vladimir Riabchun wrote:
> 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.

Agreed, a silent no-op would hide the request: the next user of
override_ve() would run with the host creds and the CT VE without
knowing it.

On the other hand, an API that returns an error the caller has to go
on after is a bad API too. Then let us change item 1 so that both hold.

override_ve() reports only "switched" or "refused": a CT task asking
for any other VE, VE0 included, gets ERR_PTR(-EPERM) and the
ratelimited message. Any error pointer is then a real refusal.

overlayfs handles its own case before the call: a host overlayfs used
from a CT keeps the CT VE and overrides only the creds, without calling
override_ve(). Something like:

        if (ve_is_super(ofs->creator_ve) && !ve_is_super(get_exec_env())) {
                /* Host overlayfs used from a CT: host creds work there. */
                desc->ve = NULL;
                desc->ve_overridden = false;
        } else {
                desc->ve = override_ve(ofs->creator_ve);
                if (IS_ERR(desc->ve))
                        return PTR_ERR(desc->ve);
                desc->ve_overridden = true;
        }
        desc->cred = override_creds(ofs->creator_cred);

ovl_revert_creds() returns at once on IS_ERR(desc->ve), a failed
override (ovl_copy_up_flags() still calls it after one), reverts the
creds otherwise, and the VE only when ve_overridden is set. A flag and
not a NULL desc->ve, since NULL is a valid previous override.

overlayfs then never gets the message for its allowed case, and no
PTR_ERR() != -EPERM is left. Items 2 and 3 stay as they are.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team


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

  reply	other threads:[~2026-11-13 20:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 17:26 [Devel] [PATCH hci-8.1 v5 0/5] Fix kernel crash in overlayfs Vladimir Riabchun
2026-11-10 17:26 ` [Devel] [PATCH hci-8.1 v5 1/5] ve: Remove STOPPED state Vladimir Riabchun
2026-11-10 17:32   ` no-reply
2026-11-12 13:17   ` Konstantin Khorenko
2026-11-10 17:26 ` [Devel] [PATCH hci-8.1 v5 2/5] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-11-10 17:35   ` no-reply
2026-11-12 13:17   ` Konstantin Khorenko
2026-11-12 20:41     ` Vladimir Riabchun
2026-11-13 20:21       ` Konstantin Khorenko [this message]
2026-11-10 17:26 ` [Devel] [PATCH hci-8.1 v5 3/5] ve: Defer ve creds drop until ve is completely destroyed Vladimir Riabchun
2026-11-10 17:32   ` no-reply
2026-11-12 13:17   ` Konstantin Khorenko
2026-11-16 11:43     ` Vladimir Riabchun
2026-11-10 17:26 ` [Devel] [PATCH hci-8.1 v5 4/5] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-11-10 17:32   ` no-reply
2026-11-12 13:17   ` Konstantin Khorenko
2026-11-10 17:26 ` [Devel] [PATCH hci-8.1 v5 5/5] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-11-10 17:37   ` no-reply
2026-11-10 17:54     ` Vladimir Riabchun
2026-11-12 13:17   ` Konstantin Khorenko
2026-11-16 11:48     ` Vladimir Riabchun
2026-11-11 12:51 ` [Devel] [PATCH hci-8.1 v5 0/5] Fix kernel crash in overlayfs Vasileios Almpanis
2026-11-12 13:17 ` Konstantin Khorenko

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=b6af266a-2fb1-43cd-b63b-4bb980aaac0d@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=vladimir.riabchun@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox