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: <AANLkTinQMahgVrWLxR0J6Zbh-_SPjxVJ-wuZt8B5TNjc@mail.gmail.com>
Date:	Wed, 5 Jan 2011 20:53:19 +0200
From:	Pekka Enberg <penberg@...nel.org>
To:	Bart Van Assche <bvanassche@....org>
Cc:	Christoph Lameter <cl@...ux.com>,
	David Rientjes <rientjes@...gle.com>,
	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] slub: Fix sysfs circular locking dependency

On Wed, Jan 5, 2011 at 8:50 PM, Bart Van Assche <bvanassche@....org> wrote:
> On Wed, Jan 5, 2011 at 7:26 PM, Pekka Enberg <penberg@...nel.org> wrote:
>>
>> On Wed, Jan 5, 2011 at 7:10 PM, Christoph Lameter <cl@...ux.com> wrote:
>> > How about this solution? In the common case of kernels without hotplug
>> > support there will be no locking at all.
>> >
>> >
>> > Subject: slub: Avoid use of slub_lock in show_slab_objects()
>> >
>> > The purpose of the locking is to prevent removal and additions
>> > of nodes when statistics are gathered for a slab cache. So we
>> > need to avoid racing with memory hotplug functionality.
>> >
>> > It is enough to take the memory hotplug locks there instead
>> > of the slub_lock.
>> >
>> >
>> > Signed-off-by: Christoph Lameter <cl@...ux.com>
>> >
>> > ---
>> >  mm/slub.c |    4 ++--
>> >  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > Index: linux-2.6/mm/slub.c
>> > ===================================================================
>> > --- linux-2.6.orig/mm/slub.c    2011-01-05 09:55:34.000000000 -0600
>> > +++ linux-2.6/mm/slub.c 2011-01-05 09:56:27.000000000 -0600
>> > @@ -3821,7 +3821,7 @@ static ssize_t show_slab_objects(struct
>> >                }
>> >        }
>> >
>> > -       down_read(&slub_lock);
>> > +       lock_memory_hotplug();
>> >  #ifdef CONFIG_SLUB_DEBUG
>> >        if (flags & SO_ALL) {
>> >                for_each_node_state(node, N_NORMAL_MEMORY) {
>> > @@ -3862,7 +3862,7 @@ static ssize_t show_slab_objects(struct
>> >                        x += sprintf(buf + x, " N%d=%lu",
>> >                                        node, nodes[node]);
>> >  #endif
>> > -       up_read(&slub_lock);
>> > +       unlock_memory_hotplug();
>> >        kfree(nodes);
>> >        return x + sprintf(buf + x, "\n");
>> >  }
>>
>> Makes sense. Bart, does this fix the problem for you?
>
> The action sequence that had triggered this sequence (invoke
> kmem_cache_create(); read all files in /sys/kernel/slab; invoke
> kmem_cache_destroy()) does now pass without triggering lock inversion
> complaints.

Thanks for testing. David, does Christoph's patch look OK to you?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ