lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yi73dKB10LBTGb+S@kroah.com>
Date:   Mon, 14 Mar 2022 09:06:12 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Michal Koutný <mkoutny@...e.com>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Zhao Gongyi <zhaogongyi@...wei.com>,
        Zhang Qiao <zhangqiao22@...wei.com>,
        Waiman Long <longman@...hat.com>, Tejun Heo <tj@...nel.org>,
        Juri Lelli <juri.lelli@...hat.com>
Subject: Re: [PATCH 4.19 01/34] cgroup/cpuset: Fix a race between
 cpuset_attach() and cpu hotplug

On Tue, Mar 08, 2022 at 04:12:32PM +0100, Michal Koutný wrote:
> Hello.
> 
> On Mon, Feb 28, 2022 at 06:24:07PM +0100, Greg Kroah-Hartman <gregkh@...uxfoundation.org> wrote:
> > [...]
> >      cpuset_attach()				cpu hotplug
> >     ---------------------------            ----------------------
> >     down_write(cpuset_rwsem)
> >     guarantee_online_cpus() // (load cpus_attach)
> > 					sched_cpu_deactivate
> > 					  set_cpu_active()
> > 					  // will change cpu_active_mask
> >     set_cpus_allowed_ptr(cpus_attach)
> >       __set_cpus_allowed_ptr_locked()
> >        // (if the intersection of cpus_attach and
> >          cpu_active_mask is empty, will return -EINVAL)
> >     up_write(cpuset_rwsem)
> > [...]
> > --- a/kernel/cgroup/cpuset.c
> > +++ b/kernel/cgroup/cpuset.c
> > @@ -1528,6 +1528,7 @@ static void cpuset_attach(struct cgroup_
> >  	cgroup_taskset_first(tset, &css);
> >  	cs = css_cs(css);
> >  
> > +	cpus_read_lock();
> >  	mutex_lock(&cpuset_mutex);
> 
> This backport (and possible older kernels) looks suspicious since it comes
> before commit d74b27d63a8b ("cgroup/cpuset: Change cpuset_rwsem and
> hotplug lock order") v5.4-rc1~176^2~30 when the locking order was:
> cpuset lock, cpus lock.
> 
> At the same time it also comes before commit 710da3c8ea7d ("sched/core:
> Prevent race condition between cpuset and __sched_setscheduler()")
> v5.4-rc1~176^2~27 when neither __sched_setscheduler() cared and this
> race is similar. (The swapped locking may still conflict with
> rebuild_sched_domains() before d74b27d63a8b.)

Thanks for noticing this.  What do you recommend to do to resolve this?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ