[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bcf4df59-3915-6df3-027b-8cb35b310650@schaufler-ca.com>
Date: Wed, 17 May 2023 17:01:51 -0700
From: Casey Schaufler <casey@...aufler-ca.com>
To: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>,
Serge Hallyn <serge@...lyn.com>,
Paul Moore <paul@...l-moore.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Eric Paris <eparis@...isplace.org>,
Frederick Lawler <fred@...udflare.com>,
Jens Axboe <axboe@...nel.dk>,
Joseph Qi <joseph.qi@...ux.alibaba.com>,
linux-security-module@...r.kernel.org, selinux@...r.kernel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
louxiao.lx@...baba-inc.com,
Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [PATCH 0/2] capability: Introduce CAP_BLOCK_ADMIN
On 5/16/2023 5:05 AM, Tianjia Zhang wrote:
> Hi Casey,
>
> On 5/12/23 12:17 AM, Casey Schaufler wrote:
>> On 5/11/2023 12:05 AM, Tianjia Zhang wrote:
>>> Separated fine-grained capability CAP_BLOCK_ADMIN from CAP_SYS_ADMIN.
>>> For backward compatibility, the CAP_BLOCK_ADMIN capability is included
>>> within CAP_SYS_ADMIN.
>>>
>>> Some database products rely on shared storage to complete the
>>> write-once-read-multiple and write-multiple-read-multiple functions.
>>> When HA occurs, they rely on the PR (Persistent Reservations) protocol
>>> provided by the storage layer to manage block device permissions to
>>> ensure data correctness.
>>>
>>> CAP_SYS_ADMIN is required in the PR protocol implementation of existing
>>> block devices in the Linux kernel, which has too many sensitive
>>> permissions, which may lead to risks such as container escape. The
>>> kernel needs to provide more fine-grained permission management like
>>> CAP_NET_ADMIN to avoid online products directly relying on root to run.
>>>
>>> CAP_BLOCK_ADMIN can also provide support for other block device
>>> operations that require CAP_SYS_ADMIN capabilities in the future,
>>> ensuring that applications run with least privilege.
>>
>> Can you demonstrate that there are cases where a program that needs
>> CAP_BLOCK_ADMIN does not also require CAP_SYS_ADMIN for other
>> operations?
>> How much of what's allowed by CAP_SYS_ADMIN would be allowed by
>> CAP_BLOCK_ADMIN? If use of a new capability is rare it's difficult to
>> justify.
>>
>
> For the previous non-container scenarios, the block device is a shared
> device, because the business-system generally operates the file system
> on the block. Therefore, directly operating the block device has a high
> probability of affecting other processes on the same host, and it is a
> reasonable requirement to need the CAP_SYS_ADMIN capability.
>
> But for a database running in a container scenario, especially a
> container scenario on the cloud, it is likely that a container
> exclusively occupies a block device. That is to say, for a container,
> its access to the block device will not affect other process, there is
> no need to obtain a higher CAP_SYS_ADMIN capability.
If I understand correctly, you're saying that the process that requires
CAP_BLOCK_ADMIN in the container won't also require CAP_SYS_ADMIN for
other operations.
That's good, but it isn't clear how a process on bare metal would
require CAP_SYS_ADMIN while the same process in a container wouldn't.
>
> For a file system similar to distributed write-once-read-many, it is
> necessary to ensure the correctness of recovery, then when recovery
> occurs, it is necessary to ensure that no inflighting-io is completed
> after recovery.
>
> This can be guaranteed by performing operations such as SCSI/NVME
> Persistent Reservations on block devices on the distributed file system.
Does your cloud based system always run "real" devices? My
understanding is that cloud based deployment usually uses
virtual machines and virtio or other simulated devices.
A container deployment in the cloud seems unlikely to be able
to take advantage of block administration. But I can't say
I know the specifics of your environment.
> Therefore, at present, it is only necessary to have the relevant
> permission support of the control command of such container-exclusive
> block devices.
This looks like an extremely special case in which breaking out
block management would make sense.
>
> Kind regards,
> Tianjia
Powered by blists - more mailing lists