[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180930092110.GB6950@dhcp-128-65.nay.redhat.com>
Date: Sun, 30 Sep 2018 17:21:10 +0800
From: Dave Young <dyoung@...hat.com>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: linux-kernel@...r.kernel.org, dan.j.williams@...el.com,
brijesh.singh@....com, Lianbo Jiang <lijiang@...hat.com>,
bhe@...hat.com, thomas.lendacky@....com, tiwai@...e.de,
x86@...nel.org, kexec@...ts.infradead.org, mingo@...hat.com,
baiyaowei@...s.chinamobile.com, hpa@...or.com, tglx@...utronix.de,
bp@...e.de, akpm@...ux-foundation.org,
Vivek Goyal <vgoyal@...hat.com>
Subject: Re: [PATCH 1/3] x86/kexec: Correct KEXEC_BACKUP_SRC_END off-by-one
error
Hi Bjorn,
On 09/27/18 at 09:21am, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@...gle.com>
>
> The only use of KEXEC_BACKUP_SRC_END is as an argument to
> walk_system_ram_res():
>
> int crash_load_segments(struct kimage *image)
> {
> ...
> walk_system_ram_res(KEXEC_BACKUP_SRC_START, KEXEC_BACKUP_SRC_END,
> image, determine_backup_region);
>
> walk_system_ram_res() expects "start, end" arguments that are inclusive,
> i.e., the range to be walked includes both the start and end addresses.
Looking at the function comment of find_next_iomem_res, the res->end
should be exclusive, am I missing something?
/*
* Finds the lowest iomem resource existing within [res->start.res->end).
* The caller must specify res->start, res->end, res->flags, and optionally
* desc. If found, returns 0, res is overwritten, if not found, returns -1.
* This function walks the whole tree and not just first level children until
* and unless first_level_children_only is true.
*/
static int find_next_iomem_res(struct resource *res, unsigned long desc,
bool first_level_children_only)
>
> KEXEC_BACKUP_SRC_END was previously defined as (640 * 1024UL), which is the
> first address *past* the desired 0-640KB range.
>
> Define KEXEC_BACKUP_SRC_END as (640 * 1024UL - 1) so the KEXEC_BACKUP_SRC
> region is [0-0x9ffff], not [0-0xa0000].
>
> Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call")
> Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
> ---
> arch/x86/include/asm/kexec.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
> index f327236f0fa7..5125fca472bb 100644
> --- a/arch/x86/include/asm/kexec.h
> +++ b/arch/x86/include/asm/kexec.h
> @@ -67,7 +67,7 @@ struct kimage;
>
> /* Memory to backup during crash kdump */
> #define KEXEC_BACKUP_SRC_START (0UL)
> -#define KEXEC_BACKUP_SRC_END (640 * 1024UL) /* 640K */
> +#define KEXEC_BACKUP_SRC_END (640 * 1024UL - 1) /* 640K */
>
> /*
> * CPU does not save ss and sp on stack if execution is already
>
>
> _______________________________________________
> kexec mailing list
> kexec@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
Thanks
Dave
Powered by blists - more mailing lists