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]
Date:   Tue, 17 Jan 2017 12:32:58 +0900
From:   kwon <kwon@...nyone.net>
To:     Joonsoo Kim <iamjoonsoo.kim@....com>
Cc:     Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] slab: add a check for the first kmem_cache not to be destroyed


> On Jan 17, 2017, at 10:33 AM, Joonsoo Kim <iamjoonsoo.kim@....com> wrote:
> 
> On Mon, Jan 16, 2017 at 04:04:59PM +0900, Kyunghwan Kwon wrote:
>> The first kmem_cache created at booting up is supposed neither mergeable
>> nor destroyable but was possible to destroy. So prevent it.
>> 
>> Signed-off-by: Kyunghwan Kwon <kwon@...nyone.net>
>> ---
>> mm/slab_common.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/mm/slab_common.c b/mm/slab_common.c
>> index 1dfc209..2d30ace 100644
>> --- a/mm/slab_common.c
>> +++ b/mm/slab_common.c
>> @@ -744,7 +744,7 @@ void kmem_cache_destroy(struct kmem_cache *s)
>> 	bool need_rcu_barrier = false;
>> 	int err;
>> 
>> -	if (unlikely(!s))
>> +	if (unlikely(!s) || s->refcount == -1)
>> 		return;
> 
> Hello, Kyunghwan.
> 
> Few lines below, s->refcount is checked.
> 
> if (s->refcount)
>        goto unlock;
> 
> Am I missing something?
> 
> Thanks.

Hello, Joonsoo.

In case it is called the number of int size times. refcount would finally reach
to 0 since decreased every time the function called.

When refcount is -1, the count will not change in the patch so no lock would be
need to be taken prior, I believe.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ