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: <20200210151008.1c1d74c1876e363b729f5b1c@linux-foundation.org>
Date:   Mon, 10 Feb 2020 15:10:08 -0800
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Waiman Long <longman@...hat.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 3/3] mm/slub: Fix potential deadlock problem in
 slab_attr_store()

On Mon, 10 Feb 2020 17:14:31 -0500 Waiman Long <longman@...hat.com> wrote:

> >> --- a/mm/slub.c
> >> +++ b/mm/slub.c
> >> @@ -5536,7 +5536,12 @@ static ssize_t slab_attr_store(struct kobject *kobj,
> >>  	if (slab_state >= FULL && err >= 0 && is_root_cache(s)) {
> >>  		struct kmem_cache *c;
> >>  
> >> -		mutex_lock(&slab_mutex);
> >> +		/*
> >> +		 * Timeout after 100ms
> >> +		 */
> >> +		if (mutex_timed_lock(&slab_mutex, 100) < 0)
> >> +			return -EBUSY;
> >> +
> > Oh dear.  Surely there's a better fix here.  Does slab really need to
> > hold slab_mutex while creating that sysfs file?  Why?
> >
> > If the issue is two threads trying to create the same sysfs file
> > (unlikely, given that both will need to have created the same cache)
> > then can we add a new mutex specifically for this purpose?
> >
> > Or something else.
> >
> Well, the current code iterates all the memory cgroups to set the same
> value in all of them. I believe the reason for holding the slab mutex is
> to make sure that memcg hierarchy is stable during this iteration
> process.

But that is unrelated to creation of the sysfs file?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ