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>,
	Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1] block: let container root set the block size of and flush its device
Date: Thu, 29 Oct 2026 16:44:43 +0100	[thread overview]
Message-ID: <7b4d8be2-5992-4393-a049-29f1f6c34d91@virtuozzo.com> (raw)
In-Reply-To: <29f80a7d-9855-454e-98d3-b7b622433844@virtuozzo.com>

> Is it possible that some evil CT user can spam flush, keep mutex most
> of the time and prevent some host actions?

No. bd_holder_lock is held only across the holder pointer test. The
->sync branch goes through bdev_super_lock(), which drops it before
taking s_umount and running sync_filesystem(). The other branch unlocks
before sync_blockdev(). Nothing heavy runs under it, so mount, umount,
freeze and mark_dead on the host are not affected.

> I'm mostly talking about ploop devices passed by vzctl.

In v2 those never reach the ioctl body. libvzctl configure_disk_perm()
grants CT disks (root ploop, secondary ploop, physical hdd via
use_device) r + W, plus M for non-root. W is "write only for mount": the
BPF program in bpf/cgroup_dev.c passes WRITE only when the request also
carries MOUNT. bdev_permission(BLK_OPEN_WRITE) has no MOUNT bit, so
blkdev_admin_capable() fails and the CT gets -EACCES, same as today.

> The same question regarding hdd disks from vzctl: can't we break them?

Even with a plain write grant, no. They are mounted by the host.
BLKFLSBUF hits the fs holder and v2 returns -EBUSY there. BLKBSZSET
cannot get the exclusive claim the mount holds and returns -EBUSY by the
unchanged upstream logic.

What v1 actually allowed on the CT's own ploop was sync plus
invalidate_bdev of the device under its own filesystem, i.e. what
syncfs() on its root already gives it. v2 closes even that at the
device cgroup level.
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

      parent reply	other threads:[~2026-10-29 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 17:54 Eva Kurchatova
2026-10-21 17:57 ` no-reply
2026-10-21 20:56 ` Vladimir Riabchun
2026-10-21 23:03   ` Eva Kurchatova (Virtuozzo)
2026-10-29 15:44   ` Konstantin Khorenko [this message]

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=7b4d8be2-5992-4393-a049-29f1f6c34d91@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=eva.kurchatova@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