mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chenridong <chenridong@huawei.com>
To: "Tejun Heo" <tj@kernel.org>, "Michal Koutný" <mkoutny@suse.com>
Cc: <lizefan.x@bytedance.com>, <hannes@cmpxchg.org>,
	<longman@redhat.com>, <cgroups@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next 2/2] cgroup: Disallow delegatee to write all interfaces outsize of cgroup ns
Date: Wed, 14 Aug 2024 16:09:59 +0800	[thread overview]
Message-ID: <e3bc3535-39af-4993-af29-bd4bd688d984@huawei.com> (raw)
In-Reply-To: <ZrutqDox2rrr7dlA@slm.duckdns.org>



On 2024/8/14 3:02, Tejun Heo wrote:
> Hello,
> 
> On Mon, Aug 12, 2024 at 06:57:06PM +0200, Michal Koutný wrote:
> ...
>> You could also have increased the ancestral limit (if there was any)
>> echo max > dlgt_grp_ns/pids.max // similarly allowed
>>
>> If you're a root (or otherwise have sufficient permissions) and you can
>> _see_ an ancestral cgroup, you can write to its attributes according to
>> permissions. Thus the delegation works via cgroup ns (in)visibility but
>> cgroup ns root is visible on both sides of the boundary hence the extra
>> check.
> 
> Yeah, the intended usage scenario w/ NS delegation is that the delegatee
> won't be able to see the ancetral cgroups beyond the delegation point. Chen,
> is this from an actual usecase? If so, can you describe what's going on?
> 
> Thanks.
> 
Hi,TJ, We plan to use delegation in cgroup-v2, so I am conducting some 
tests.
As doc mentions 'Because the resource control interface files in a given 
directory control the distribution of the parent's resources, the 
delegatee shouldn't be allowed to write to them.' However I found a root 
can write parent's file(cgroup.subtree_control) to change the resource 
limits(a fraudulent method). I believe this could pose a risk in some 
scenarios where a root enters a new cgroup ns without unmounting 
original cgroup system, and it can break limitations. For instance, 
running a docker with --privileged, could this be a risk?

So I sent this patch to discuss whether this case should be addressed?

Thanks,
Ridong

  reply	other threads:[~2024-08-14  8:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  7:37 [PATCH -next 0/2] Fixes about delegation Chen Ridong
2024-08-12  7:37 ` [PATCH -next 1/2] cgroup: update comment " Chen Ridong
2024-08-12 16:57   ` Michal Koutný
2024-08-12  7:37 ` [PATCH -next 2/2] cgroup: Disallow delegatee to write all interfaces outsize of cgroup ns Chen Ridong
2024-08-12 16:57   ` Michal Koutný
2024-08-13  3:48     ` chenridong
2024-08-13 19:02     ` Tejun Heo
2024-08-14  8:09       ` chenridong [this message]
2024-08-14 16:52         ` Tejun Heo
2024-08-15  0:50           ` chenridong
2024-08-13  1:35   ` Xiu Jianfeng

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=e3bc3535-39af-4993-af29-bd4bd688d984@huawei.com \
    --to=chenridong@huawei.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=longman@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=tj@kernel.org \
    /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

all inboxes | Powered by JetHome®