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]
Message-ID: <Y0gF1S4bjjNIE/68@google.com>
Date:   Thu, 13 Oct 2022 21:34:29 +0900
From:   Sergey Senozhatsky <senozhatsky@...omium.org>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        Alexey Romanov <avromanov@...rdevices.ru>
Cc:     minchan@...nel.org, senozhatsky@...omium.org, ngupta@...are.org,
        akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, kernel@...rdevices.ru
Subject: Re: [PATCH v1] zsmalloc: zs_destroy_pool: add size_class NULL check

On (22/10/13 14:28), Alexey Romanov wrote:
> Inside the zs_destroy_pool() function, there can still
> be NULL size_class pointers: if when the next size_class is
> allocated, inside zs_create_pool() function, kzalloc will
> return NULL and handling the error condition, zs_create_pool()
> will call zs_destroy_pool().
> 
> Fixes: f24263a5a076 ("zsmalloc: remove unnecessary size_class NULL check")
> Signed-off-by: Alexey Romanov <avromanov@...rdevices.ru>
> ---
>  mm/zsmalloc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 525758713a55..d03941cace2c 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -2311,6 +2311,9 @@ void zs_destroy_pool(struct zs_pool *pool)
>  		int fg;
>  		struct size_class *class = pool->size_class[i];
>  
> +		if (!class)
> +			continue;
> +
>  		if (class->index != i)
>  			continue;

Yeah, OK... And totally my fault! I think, I, personally, am done
with the "remove if" patches at this point, they are too painful.

Alexey, is there anything else we missed?

FWIW,
Reviewed-by: Sergey Senozhatsky <senozhatsky@...omium.org>

Andrew,
The allocation in question should be of a "too small to fail"
size, below PAGE_ALLOC_COSTLY_ORDER. So unless that unspoken
rule has changed, we should be "fine", since that kmalloc()
simply should not fail. It still makes sense to have that
particular check in place, just in case. Can you please pull
this patch in? And, like I said, I'm going to NAK all future
micro-optimizations.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ