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:   Wed, 31 May 2023 08:33:34 +0800
From:   Baoquan He <bhe@...hat.com>
To:     Zhen Lei <thunder.leizhen@...wei.com>
Cc:     Eric Biederman <ebiederm@...ssion.com>, kexec@...ts.infradead.org,
        linux-kernel@...r.kernel.org,
        Michael Holzheu <holzheu@...ux.vnet.ibm.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 3/6] kexec: clear crashk_res if all its memory has been
 released

On 05/27/23 at 08:34pm, Zhen Lei wrote:
> If the resource of crashk_res has been released, it is better to clear
> crashk_res.start and crashk_res.end. Because 'end = start - 1' is not
> reasonable, and in some places the test is based on crashk_res.end, not
> resource_size(&crashk_res).

This looks reasonable, at least I haven't think of any risk it could
bring. Thanks.

Acked-by: Baoquan He <bhe@...hat.com>

> 
> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
> ---
>  kernel/kexec_core.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index d1ab139dd49035e..bcc86a250ab3bf9 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -1137,15 +1137,18 @@ int crash_shrink_memory(unsigned long new_size)
>  	end = start + new_size;
>  	crash_free_reserved_phys_range(end, crashk_res.end);
>  
> -	if (start == end)
> -		release_resource(&crashk_res);
> -
>  	ram_res->start = end;
>  	ram_res->end = crashk_res.end;
>  	ram_res->flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM;
>  	ram_res->name = "System RAM";
>  
> -	crashk_res.end = end - 1;
> +	if (start == end) {
> +		release_resource(&crashk_res);
> +		crashk_res.start = 0;
> +		crashk_res.end = 0;
> +	} else {
> +		crashk_res.end = end - 1;
> +	}
>  
>  	insert_resource(&iomem_resource, ram_res);
>  
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ