From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E15E3ACEF1 for ; Tue, 28 Apr 2026 15:19:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777389568; cv=none; b=E5BAka2vhQgVw+oBuLqj8AOaLbDmz0DjLSmCcoZcbSO8ZbSYeqcgO460aP5CdcdV4xdJGlOGC8aN2NXbDQteJDo1V+znQ9SIDvM1ut8anGE91R6wDxXJXMKYLuhcsUkK0KmTUZnX6EeDOlVH4RXd82uWI7BYPEJ5C/IGS921PSA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777389568; c=relaxed/simple; bh=NZXdk1yBRDOEB3BWO+BVvaayxPjaKo978RfNNBO65Ro=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VqfBQSv45sGaCtbW7tfTjfSfzJkEBZqA2iz6tRHyD2ALwpNbR1CX/Fq5WU1kmxhe1oGXlggMEbZbuVdD0RAbEdR7sADzEweex9h4lc5Q8gFnaX/zuGxA4MJBurh9enr9VEfRwGamlmnullDNZ2+s+IoZjZRSYVy4YK5O+QX7j0o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hx8uMSjs; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hx8uMSjs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777389564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HDcbwl6sFTXgDrI+UlBZckd1iaxQQF55if0ty09TCYY=; b=hx8uMSjsq1+0TZL+muFV2wxaaeWH17h2d3yqSWeQpQ2u1orUGXEH1jsh96IEytUhW5UQeG bFcgHpYF0jyz2geOg4+Zg/8fo6MhRSXLL2aBw14dKBkA4rOyR2+ETUOhPflwkrJOMuHYsb j4Wje+1xUiUVTaZlzundZS2ouV3cqCs= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657-vMuwL-NMN4yZc68m8CBAFA-1; Tue, 28 Apr 2026 11:19:21 -0400 X-MC-Unique: vMuwL-NMN4yZc68m8CBAFA-1 X-Mimecast-MFC-AGG-ID: vMuwL-NMN4yZc68m8CBAFA_1777389559 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EA75419560AA; Tue, 28 Apr 2026 15:19:18 +0000 (UTC) Received: from [10.22.65.177] (unknown [10.22.65.177]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0B629300756E; Tue, 28 Apr 2026 15:19:16 +0000 (UTC) Message-ID: <9df75f61-0cbb-42b4-b64d-8e6fd49d50ca@redhat.com> Date: Tue, 28 Apr 2026 11:19:16 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] cgroup/cpuset: Creating or adding CPUs to partition not allowed without privilege To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: Chen Ridong , Tejun Heo , Johannes Weiner , Jonathan Corbet , Shuah Khan , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Xie Maoyi References: <20260428033439.783246-1-longman@redhat.com> <7so4b76wg2apwwk3yh76q42jgwnpvlv7sursmsmzeyefhp4pbt@thybpp4litm6> Content-Language: en-US From: Waiman Long In-Reply-To: <7so4b76wg2apwwk3yh76q42jgwnpvlv7sursmsmzeyefhp4pbt@thybpp4litm6> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On 4/28/26 3:58 AM, Michal Koutný wrote: > Hi Waiman. > > On Mon, Apr 27, 2026 at 11:34:39PM -0400, Waiman Long 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. Cheers, Longman