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] [day] [month] [year] [list]
Date:	Thu, 14 Jul 2016 15:56:21 +0900
From:	Joonsoo Kim <iamjoonsoo.kim@....com>
To:	Alexander Potapenko <glider@...gle.com>
Cc:	Andrey Konovalov <adech.fo@...il.com>,
	Christoph Lameter <cl@...ux.com>,
	Dmitriy Vyukov <dvyukov@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Kostya Serebryany <kcc@...gle.com>,
	Andrey Ryabinin <aryabinin@...tuozzo.com>,
	Kuthonuzo Luruo <kuthonuzo.luruo@....com>,
	kasan-dev <kasan-dev@...glegroups.com>,
	Linux Memory Management List <linux-mm@...ck.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v6] mm, kasan: switch SLUB to stackdepot, enable memory
 quarantine for SLUB

On Tue, Jul 12, 2016 at 03:02:19PM +0200, Alexander Potapenko wrote:
> >> +
> >>       /* Add alloc meta. */
> >>       cache->kasan_info.alloc_meta_offset = *size;
> >>       *size += sizeof(struct kasan_alloc_meta);
> >> @@ -392,17 +385,36 @@ void kasan_cache_create(struct kmem_cache *cache, size_t *size,
> >>           cache->object_size < sizeof(struct kasan_free_meta)) {
> >>               cache->kasan_info.free_meta_offset = *size;
> >>               *size += sizeof(struct kasan_free_meta);
> >> +     } else {
> >> +             cache->kasan_info.free_meta_offset = 0;
> >>       }
> >>       redzone_adjust = optimal_redzone(cache->object_size) -
> >>               (*size - cache->object_size);
> >> +
> >>       if (redzone_adjust > 0)
> >>               *size += redzone_adjust;
> >> -     *size = min(KMALLOC_MAX_CACHE_SIZE,
> >> +
> >> +#ifdef CONFIG_SLAB
> >> +     *size = min(KMALLOC_MAX_SIZE,
> >>                   max(*size,
> >>                       cache->object_size +
> >>                       optimal_redzone(cache->object_size)));
> >> -}
> >> +     /*
> >> +      * If the metadata doesn't fit, don't enable KASAN at all.
> >> +      */
> >> +     if (*size <= cache->kasan_info.alloc_meta_offset ||
> >> +                     *size <= cache->kasan_info.free_meta_offset) {
> >> +             *size = orig_size;
> >> +             return;
> >> +     }
> >> +#else
> >> +     *size = max(*size,
> >> +                     cache->object_size +
> >> +                     optimal_redzone(cache->object_size));
> >> +
> >>  #endif
> >
> > Hmm... could you explain why SLAB needs min(KMALLOC_MAX_SIZE, XX) but
> > not SLUB?
> 
> Because if the size is bigger than KMALLOC_MAX_SIZE then
> __kmem_cache_create() returns -E2BIG for SLAB. This happens right at
> startup in create_boot_cache().
> As far as I understand, SLUB doesn't have the upper limit (or is it
> that we just aren't hitting it?)

Perhaps, SLUB also has the upper limit although it wasn't triggered
easily since there is no such kmem_cache. Unlikely, SLAB has a such
sized kmem_cache in default (kmalloc-XXXXX). I haven't look at
calculate_order() in detail but it would give you some insight.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ