All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: "chenhaixiang (A)" <chenhaixiang3@huawei.com>
Cc: "kexec@lists.infradead.org" <kexec@lists.infradead.org>,
	Louhongxiang <louhongxiang@huawei.com>,
	"wangbin (A)" <wangbin224@huawei.com>,
	"Fangchuangchuang(Fcc,Euler)" <fangchuangchuang@huawei.com>
Subject: Re: Question about Address Range Validation in Crash Kernel Allocation
Date: Tue, 19 Mar 2024 09:38:12 +0800	[thread overview]
Message-ID: <ZfjshNK7Nbdz1de3@MiWiFi-R3L-srv> (raw)
In-Reply-To: <8606fd02d6de4eb3b7c80e4ce3449458@huawei.com>

Hi,

On 03/18/24 at 12:00pm, chenhaixiang (A) wrote:
> Dear kexec Community Members,
> 
> I encountered an issue while using kexec-tools on my x86_64 machine.
> When there is a segment marked as 'reserved' within the memory range allocated for the crash kernel in /proc/iomem,the output appears as follows:
> 2d4fd058-60efefff : System RAM
>   2d4fd058-58ffffff : System RAM
>     49000000-58ffffff : Crash kernel
>       53cbd000-53ccffff : Reserved

What kernel are you using? the version of kernel, and kexec-tools?

If you are testing on the latest mainline kernel, you could meet the
issue Dave have met and fixed in below patch:

[PATCH] x86/kexec: do not update E820 kexec table for setup_data
https://lore.kernel.org/all/ZeZ2Kos-OOZNSrmO@darkstar.users.ipa.redhat.com/T/#u

Thanks
Baoquan

> 
> The crash_memory_range array will encounter incorrect address ranges:
> CRASH MEMORY RANGES
> 000000002d4fd058-0000000048ffffff (0)
> 0000000053cbd000-0000000048ffffff (1)
> 0000000059000000-0000000053ccffff (0)
> 
> Read the code, I noticed that the get_crash_memory_ranges() function invokes exclude_region() to handle the splitting of memory regions, but it seems unable to properly handle the scenario described above.
> The code logic is as follows:
> ...
> 	if (start < mend && end > mstart) {
> 		if (start != mstart && end != mend) {
> 			/* Split memory region */
> 			crash_memory_range[i].end = start - 1;
> 			temp_region.start = end + 1;
> 			temp_region.end = mend;
> 			temp_region.type = RANGE_RAM;
> 			tidx = i+1;
> 		} else if (start != mstart)
> 			crash_memory_range[i].end = start - 1;
> 		else
> 			crash_memory_range[i].start = end + 1;
> 	}
> ...
> If start < mstart < mend < end, resulting in crash_memory_range[i].end becoming less than crash_memory_range[i].start, leading to incorrect address ranges.
> I would like to know if this behavior is reasonable and whether it is necessary to validate the address ranges for compliance at the end.
> 
> Thank you for your time and assistance.
> 
> Chen Haixiang
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2024-03-19  1:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 12:00 Question about Address Range Validation in Crash Kernel Allocation chenhaixiang (A)
2024-03-19  1:38 ` Baoquan He [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-19  7:24 chenhaixiang (A)
2024-03-19  8:21 ` Baoquan He
2024-03-20 13:12 chenhaixiang (A)
2024-03-20 14:08 ` Baoquan He
     [not found] <45065451d7d343679e150313c1ee2b62@huawei.com>
2024-03-21  7:09 ` Baoquan He
2024-03-21  9:17 chenhaixiang (A)
2024-03-21  9:48 ` Li Huafei
2024-03-21 10:06   ` Dave Young
2024-03-21 12:37     ` Li Huafei
2024-03-22  1:16       ` Baoquan He
2024-03-22  7:26         ` Dave Young
2024-03-22  7:18       ` Dave Young
2024-03-22  7:18         ` Dave Young
2024-03-22  7:58         ` Li Huafei
2024-03-22  7:58           ` Li Huafei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZfjshNK7Nbdz1de3@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=chenhaixiang3@huawei.com \
    --cc=fangchuangchuang@huawei.com \
    --cc=kexec@lists.infradead.org \
    --cc=louhongxiang@huawei.com \
    --cc=wangbin224@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.