public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: Chen Ridong <chenridong@huawei.com>, Tejun Heo <tj@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	cgroups@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Xie Maoyi <maoyi.xie@ntu.edu.sg>
Subject: Re: [PATCH] cgroup/cpuset: Creating or adding CPUs to partition not allowed without privilege
Date: Tue, 28 Apr 2026 11:49:55 -0400	[thread overview]
Message-ID: <24bf6d29-f2ee-4285-af27-fb1aa3d0a1c8@redhat.com> (raw)
In-Reply-To: <9df75f61-0cbb-42b4-b64d-8e6fd49d50ca@redhat.com>

On 4/28/26 11:19 AM, Waiman Long wrote:
> On 4/28/26 3:58 AM, Michal Koutný wrote:
>> Hi Waiman.
>>
>> On Mon, Apr 27, 2026 at 11:34:39PM -0400, Waiman Long 
>> <longman@redhat.com> wrote:
>>> Creation of a cpuset partition or adding more CPUs to an existing
>>> partition will take CPUs away from other cpusets outside of the
>>> partition leaving less CPUs for the others. So it is a privileged
>>> operation that non-privileged users shouldn't be allowed to do.
>>>
>>> Currently, remote partition code has check for CAP_SYS_ADMIN capability
>>> before allowing such operations, but not for local partition.
>> Remote partitions need such a check because their CPUs are sourced from
>> the global supply (top level) without
>>
>>> This leaves a security hole in case cpuset.cpus.partition of a cpuset
>>> is chown'ed to a non-root user and its parent cpuset happens to be a
>>> partition root.
>> I wouldn't say this difference between remote and local partitions is a
>> security hole [1].
> OK, I will tone down the description.
>>
>> Consider this -- cgroup a is created by root (admin) and its resources
>> are constrained by root's policy. However, what happens in a subtree is
>> irrelevant from that top level view.
>>
>> # setup            // owner
>> a/cpuset.partition=root    // root
>> a/cpuset.cpus=0-3    // root
>> a/cgroup.procs        // user, they can organize subtree as needed
>>
>> For example the user may want to create a (sub)partition with some of
>> the CPUs they got:
>>
>> user$ mkdir a/b
>>
>> a/b/cpuset.partition=root    // user
>> a/b/cpuset.cpus=0-1        // user
>>
>> This should be a valid configuration and behavior, no?
>
> Thank for the comment. Yes, that can be a valid configuration.
>
> One possible workaround may be to see if the current user has write 
> access to its parent partition root. If so, we can allow it to create 
> a sub-partition, if not, we will forbid it. 

It is not that simple to check if the user can write to its parent. So I 
will put it down as a TODO item, but will still forbid such a 
configuration for now.

Cheers,
Longman


      parent reply	other threads:[~2026-04-28 15:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  3:34 [PATCH] cgroup/cpuset: Creating or adding CPUs to partition not allowed without privilege Waiman Long
2026-04-28  7:58 ` Michal Koutný
2026-04-28 15:19   ` Waiman Long
2026-04-28 15:44     ` Tejun Heo
2026-04-28 18:02       ` Waiman Long
2026-04-28 15:49     ` Waiman Long [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=24bf6d29-f2ee-4285-af27-fb1aa3d0a1c8@redhat.com \
    --to=longman@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huawei.com \
    --cc=corbet@lwn.net \
    --cc=hannes@cmpxchg.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maoyi.xie@ntu.edu.sg \
    --cc=mkoutny@suse.com \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --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