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, 2 Feb 2016 18:29:36 +0300
From:	Andrey Ryabinin <ryabinin.a.a@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Alexander Potapenko <glider@...gle.com>
Cc:	adech.fo@...il.com, cl@...ux.com, dvyukov@...gle.com,
	rostedt@...dmis.org, kasan-dev@...glegroups.com,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v1 1/8] kasan: Change the behavior of
 kmalloc_large_oob_right test



On 02/02/2016 08:34 AM, Andrew Morton wrote:
> On Wed, 27 Jan 2016 19:25:06 +0100 Alexander Potapenko <glider@...gle.com> wrote:
> 
>> depending on which allocator (SLAB or SLUB) is being used
>>
>> ...
>>
>> --- a/lib/test_kasan.c
>> +++ b/lib/test_kasan.c
>> @@ -68,7 +68,22 @@ static noinline void __init kmalloc_node_oob_right(void)
>>  static noinline void __init kmalloc_large_oob_right(void)
>>  {
>>  	char *ptr;
>> -	size_t size = KMALLOC_MAX_CACHE_SIZE + 10;
>> +	size_t size;
>> +
>> +	if (KMALLOC_MAX_CACHE_SIZE == KMALLOC_MAX_SIZE) {
>> +		/*
>> +		 * We're using the SLAB allocator. Allocate a chunk that fits
>> +		 * into a slab.
>> +		 */
>> +		size = KMALLOC_MAX_CACHE_SIZE - 256;
>> +	} else {
>> +		/*
>> +		 * KMALLOC_MAX_SIZE > KMALLOC_MAX_CACHE_SIZE.
>> +		 * We're using the SLUB allocator. Allocate a chunk that does
>> +		 * not fit into a slab to trigger the page allocator.
>> +		 */
>> +		size = KMALLOC_MAX_CACHE_SIZE + 10;
>> +	}
> 
> This seems a weird way of working out whether we're using SLAB or SLUB.
> 
> Can't we use, umm, #ifdef CONFIG_SLAB?  If not that then let's cook up
> something standardized rather than a weird just-happens-to-work like
> this.
> 

Actually it would be simpler to not use KMALLOC_MAX_CACHE_SIZE at all.
Simply replace it with 2 or 3 PAGE_SIZEs.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ