Re: [PATCH v2] ovl: drop CAP_SYS_RESOURCE from saved mounter's credentials

Miklos Szeredi
2017-07-24T08:19:08Z

On Tue, Jan 10, 2017 at 8:17 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> On Tue, Jan 10, 2017 at 09:30:21PM +0300, Konstantin Khlebnikov wrote:
>> If overlay was mounted by root then quota set for upper layer does not work
>> because overlay now always use mounter's credentials for operations.
>> Also overlay might deplete reserved space and inodes in ext4.
>>
>> This patch drops capability SYS_RESOURCE from saved credentials.
>> This affects creation new files, whiteouts, and copy-up operations.
>>
>
> I am not an expert in this area, but I thought previous patch was
> better. I am not sure why overlay internal operations should be
> done without CAP_SYS_RESOURCES when caller has CAP_SYS_RESOURCES. That
> might be counter-intuitive.
>
> If some task is allowed to bypass quota limitations on a file system
> then same should be true when task is working on overlay.
>
> Similary if a task is allowed to use reserved space on filesystem, then same
> task should be allowed to use reserved space on underlying filesystem
> when doing overlay. It should not be overlay's job to prevent that?
>
> May be it is just me....

Well, depends how you look at at it. Overlayfs just uses the
underlying filesystem as storage. So this patch basically asserts
that overlayfs can only use non-reserved space for its storage. I
don't see a problem with and it's the simpler fix, but if real use
cases turn up then this can be revisited.

Thanks,
Miklos