From: "Eva Kurchatova (Virtuozzo)" <eva.kurchatova@virtuozzo.com>
To: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>,
khorenko@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, 22 Oct 2026 02:03:30 +0300 [thread overview]
Message-ID: <d55e9712-670d-409a-8918-340e6268a0ee@virtuozzo.com> (raw)
In-Reply-To: <29f80a7d-9855-454e-98d3-b7b622433844@virtuozzo.com>
On 10/21/26 23:56, Vladimir Riabchun wrote:
>
>
> On 10/21/26 19:54, Eva Kurchatova wrote:
>> BLKBSZSET and BLKFLSBUF check CAP_SYS_ADMIN in the initial user
>> namespace, so root in a container cannot set the block size of a block
>> device it has been given, nor flush its buffers, and mkfs.xfs on a loop
>> device there stops with "cannot set blocksize 512 on block device
>> /dev/loopN: Permission denied", or with "Flushing the data device
>> failed, err=13" once it gets past the first.
>>
>> Check the capability relative to the container, as the other block
>> code adapted for containers does. The device itself is reachable only
>> through the device cgroup, set_blocksize() still needs the device
>> exclusively, and a flush discards only cached pages of that device, so
>> nothing a container could not already write to is affected.
>>
>> https://virtuozzo.atlassian.net/browse/VSTOR-137668
>> Feature: ve: allow various syscalls in CT root userns
>>
>> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
>> ---
>> block/ioctl.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/ioctl.c b/block/ioctl.c
>> index a3c53b04e1e3..14047cd8e611 100644
>> --- a/block/ioctl.c
>> +++ b/block/ioctl.c
>> @@ -419,7 +419,7 @@ static int blkdev_pr_clear(struct block_device
>> *bdev, blk_mode_t mode,
>> static int blkdev_flushbuf(struct block_device *bdev, unsigned cmd,
>> unsigned long arg)
>> {
>> - if (!capable(CAP_SYS_ADMIN))
>> + if (!ve_capable(CAP_SYS_ADMIN))
>
> Is it possible that some evil CT user can spam flush, keep mutex most
> of the time and prevent some host actions?
> I'm mostly talking about ploop devices passed by vzctl.
>
I would imagine that the mutex fairness would not allow this,
given that the mutex enforces a wait queue. However, this could
lead to undesirable IO latency on the host, which is possible in
many other ways, esp. if the host uses a spinning disk.
Not allowing guests to flush properly can violate ACID consistency.
>> return -EACCES;
>> mutex_lock(&bdev->bd_holder_lock);
>> @@ -531,7 +531,7 @@ static int blkdev_bszset(struct file *file,
>> blk_mode_t mode,
>> struct file *excl_file;
>> int ret, n;
>> - if (!capable(CAP_SYS_ADMIN))
>> + if (!ve_capable(CAP_SYS_ADMIN))
>
> The same question regarding hdd disks from vzctl: can't we break them?
>
I'll look more into it, but generally the same points as above for now.
Best regards.
>> return -EACCES;
>> if (!argp)
>> return -EINVAL;
>
> I'll check tomorrow what nasty thing could be done with them.
>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-10-21 23:04 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) [this message]
2026-10-29 15:44 ` 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=d55e9712-670d-409a-8918-340e6268a0ee@virtuozzo.com \
--to=eva.kurchatova@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@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 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.