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:	Fri, 15 Apr 2016 18:59:25 +0300
From:	Andrey Ryabinin <aryabinin@...tuozzo.com>
To:	Alexander Potapenko <glider@...gle.com>, <adech.fo@...il.com>,
	<dvyukov@...gle.com>, <cl@...ux.com>, <akpm@...ux-foundation.org>,
	<kcc@...gle.com>
CC:	<kasan-dev@...glegroups.com>, <linux-kernel@...r.kernel.org>,
	<linux-mm@...ck.org>
Subject: Re: [PATCH v2 2/2] mm, kasan: add a ksize() test



On 04/13/2016 02:20 PM, Alexander Potapenko wrote:
> Add a test that makes sure ksize() unpoisons the whole chunk.
> 
> Signed-off-by: Alexander Potapenko <glider@...gle.com>

Acked-by: Andrey Ryabinin <aryabinin@...tuozzo.com>

> ---
> v2: - splitted v1 into two patches
> ---
>  lib/test_kasan.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index 82169fb..48e5a0b 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -344,6 +344,25 @@ static noinline void __init kasan_stack_oob(void)
>  	*(volatile char *)p;
>  }
>  
> +static noinline void __init ksize_unpoisons_memory(void)
> +{
> +	char *ptr;
> +	size_t size = 123, real_size = size;
> +
> +	pr_info("ksize() unpoisons the whole allocated chunk\n");
> +	ptr = kmalloc(size, GFP_KERNEL);
> +	if (!ptr) {
> +		pr_err("Allocation failed\n");
> +		return;
> +	}
> +	real_size = ksize(ptr);
> +	/* This access doesn't trigger an error. */
> +	ptr[size] = 'x';
> +	/* This one does. */
> +	ptr[real_size] = 'y';
> +	kfree(ptr);
> +}
> +
>  static int __init kmalloc_tests_init(void)
>  {
>  	kmalloc_oob_right();
> @@ -367,6 +386,7 @@ static int __init kmalloc_tests_init(void)
>  	kmem_cache_oob();
>  	kasan_stack_oob();
>  	kasan_global_oob();
> +	ksize_unpoisons_memory();
>  	return -EAGAIN;
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ