OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>,
	vasileios.almpanis@virtuozzo.com, ptikhomirov@virtuozzo.com,
	Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v8 6/6] ve/overlayfs: Override VE together with creds
Date: Mon, 16 Nov 2026 19:36:10 +0000	[thread overview]
Message-ID: <010701a1e5dc1e83-34af28a6-7b0a-466a-a250-37c67359906a-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261116-ovl-use-orig-ve-v8-6-dfe427bfd902@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ovl: failed-override state is signalled only by an ERR_PTR
  sentinel
--

commit a0d9d382fd928f27fac00bc80946b595505573d9
Author: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>

ve/overlayfs: Override VE together with creds

This commit changes ovl_override_creds() to switch the VE together with the credentials. It now returns an int and fills a struct ovl_creds_desc, and a new ovl_revert_creds() undoes both. All overlayfs callers are converted.

> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
> index 817563215001..6c244ab2cbf1 100644
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c

[ ... ]

> +/* Accepts desc from a failed ovl_override_creds and does nothing. */
> +void ovl_revert_creds(struct ovl_creds_desc *old_creds)
> +{
> +	if (IS_ERR(old_creds->ve))
> +		return;
> +
> +	revert_creds(old_creds->cred);
> +	if (old_creds->ve_overridden)
> +		revert_ve(old_creds->ve);
> +}

[Severity: Low]
Is the ERR_PTR check on old_creds->ve a safe way to tell a failed override from a valid one?

Callers such as ovl_llseek(), ovl_fsync(), ovl_getattr() and ovl_copyfile() call ovl_revert_creds() unconditionally after a failed ovl_override_creds(). That is only a no-op because override_ve() leaves an ERR_PTR in desc->ve and ovl_override_creds() returns before override_creds() runs. struct ovl_creds_desc does not document this contract. A descriptor that never went through ovl_override_creds() would reach revert_creds() with a NULL cred. A comment on the struct, or an explicit valid flag, would make this robust.

Also, the commit message says ovl_override_creds "returns both old cred and old VE". It now returns an int and fills in a descriptor, so the message is out of date.

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116-ovl-use-orig-ve-v8-0-dfe427bfd902@virtuozzo.com?part=6

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

  reply	other threads:[~2026-11-16 19:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 19:20 [Devel] [PATCH hci-8.1 v8 0/6] Fix kernel crash in overlayfs Vladimir Riabchun
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 1/6] ve: Remove STOPPED state Vladimir Riabchun
2026-11-16 19:25   ` no-reply
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 2/6] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-11-16 19:27   ` no-reply
2026-11-16 20:05     ` Vladimir Riabchun
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 3/6] ve: Defer ve creds drop until ve is completely destroyed Vladimir Riabchun
2026-11-16 19:27   ` no-reply
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 4/6] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-11-16 19:28   ` no-reply
2026-11-17 14:49   ` Konstantin Khorenko
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 5/6] ovl: Fix leaking fd references in ovl_copyfile Vladimir Riabchun
2026-11-16 19:28   ` no-reply
2026-11-16 20:03     ` Vladimir Riabchun
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 6/6] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-11-16 19:36   ` no-reply [this message]
2026-11-16 20:03     ` Vladimir Riabchun
2026-11-17 14:49 ` [Devel] [PATCH hci-8.1 v8 0/6] Fix kernel crash in overlayfs Konstantin Khorenko
2026-11-17 14:49 ` 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=010701a1e5dc1e83-34af28a6-7b0a-466a-a250-37c67359906a-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=ptikhomirov@virtuozzo.com \
    --cc=vasileios.almpanis@virtuozzo.com \
    --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