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:   Wed, 28 Jun 2023 10:33:17 +0300
From:   Mike Rapoport <rppt@...nel.org>
To:     Song Shuai <songshuaishuai@...ylab.org>
Cc:     akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] memblock: report failures when memblock_can_resize is
 not set

On Sat, Jun 24, 2023 at 11:26:07AM +0800, Song Shuai wrote:
> The callers of memblock_reserve() do not check the return value
> presuming that memblock_reserve() always succeeds, but there are
> cases where it may fail.
> 
> Having numerous memblock reservations at early boot where
> memblock_can_resize is unset may exhaust the INIT_MEMBLOCK_REGIONS sized
> memblock.reserved regions array and an attempt to double this array via
> memblock_double_array() will fail and will return -1 to the caller.
> 
> When this happens the system crashes anyway, but it's hard to identify
> the reason for the crash.
> 
> Add a panic message to memblock_double_array() to aid debugging of the
> cases when too many regions are reserved before memblock can resize
> memblock.reserved array.
> 
> Link: https://lore.kernel.org/linux-kernel/20230614131746.3670303-1-songshuaishuai@tinylab.org/
> Signed-off-by: Song Shuai <songshuaishuai@...ylab.org>

This is queued now, it will appear in memblock/for-next after the merge
window closes.

Thanks!

> ---
>  mm/memblock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 3feafea06ab2..1b8e902490e5 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -419,7 +419,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
>  	 * of memory that aren't suitable for allocation
>  	 */
>  	if (!memblock_can_resize)
> -		return -1;
> +		panic("memblock: cannot resize %s array\n", type->name);
>  
>  	/* Calculate new doubled size */
>  	old_size = type->max * sizeof(struct memblock_region);
> -- 
> 2.20.1
> 
> 

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ