From: Baoquan He <bhe@redhat.com>
To: Chao Fan <fanc.fnst@cn.fujitsu.com>
Cc: Pingfan Liu <kernelfans@gmail.com>,
x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Will Deacon <will.deacon@arm.com>,
Nicolas Pitre <nico@linaro.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv3] x86/boot/KASLR: skip the specified crashkernel region
Date: Tue, 2 Apr 2019 14:52:45 +0800 [thread overview]
Message-ID: <20190402065245.GN7627@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20190402061926.GA1555@localhost.localdomain>
On 04/02/19 at 02:19pm, Chao Fan wrote:
> On Tue, Apr 02, 2019 at 12:10:46PM +0800, Pingfan Liu wrote:
> >crashkernel=x@y or or =range1:size1[,range2:size2,...]@offset option may
> or or?
> >fail to reserve the required memory region if KASLR puts kernel into the
> >region. To avoid this uncertainty, asking KASLR to skip the required
> >region.
> >
> >Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> >Cc: Thomas Gleixner <tglx@linutronix.de>
> >Cc: Ingo Molnar <mingo@redhat.com>
> >Cc: Borislav Petkov <bp@alien8.de>
> >Cc: "H. Peter Anvin" <hpa@zytor.com>
> >Cc: Baoquan He <bhe@redhat.com>
> >Cc: Will Deacon <will.deacon@arm.com>
> >Cc: Nicolas Pitre <nico@linaro.org>
> >Cc: Pingfan Liu <kernelfans@gmail.com>
> >Cc: Chao Fan <fanc.fnst@cn.fujitsu.com>
> >Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> >Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> >Cc: linux-kernel@vger.kernel.org
> >---
> [...]
> >+
> >+/* handle crashkernel=x@y or =range1:size1[,range2:size2,...]@offset options */
>
> Before review, I want to say more about the background.
> It's very hard to review the code for someone who is not so familiar
> with kdump, so could you please explain more ahout
> the uasge of crashkernel=range1:size1[,range2:size2,...]@offset.
> And also there are so many jobs who are parsing string. So I really
> need your help to understand the PATCH.
The hard part may be handle_crashkernel_mem() itself. However, it's
almost copied from parse_crashkernel_mem() completely. If we can reuse
that function, thing's gonna be perfect.
>
> >+static void mem_avoid_specified_crashkernel_region(char *option)
> >+{
> >+ unsigned long long crash_size, crash_base = 0;
> >+ char *first_colon, *first_space, *cur = option;
> Is there a tab after char?
> >+
> >+ first_colon = strchr(option, ':');
> >+ first_space = strchr(option, ' ');
> >+ /* if contain ":" */
> >+ if (first_colon && (!first_space || first_colon < first_space)) {
> >+ int i;
> >+ u64 total_sz = 0;
> >+ struct boot_e820_entry *entry;
> >+
> >+ for (i = 0; i < boot_params->e820_entries; i++) {
> >+ entry = &boot_params->e820_table[i];
> >+ /* Skip non-RAM entries. */
> >+ if (entry->type != E820_TYPE_RAM)
> >+ continue;
> >+ total_sz += entry->size;
> I wonder whether it's needed to consider the memory ranges here.
> I think it's OK to only record the regions should to be avoid.
> I remeber I ever talked with Baoquan about the similiar problems.
> @Baoquan, I am not sure if I misunderstand something.
Not sure if I get you. Could you be more specific?
next prev parent reply other threads:[~2019-04-02 6:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 4:10 [PATCHv3] x86/boot/KASLR: skip the specified crashkernel region Pingfan Liu
2019-04-02 6:19 ` Chao Fan
2019-04-02 6:52 ` Baoquan He [this message]
2019-04-02 6:58 ` Pingfan Liu
2019-04-02 7:59 ` Chao Fan
2019-04-02 6:46 ` Baoquan He
2019-04-03 2:59 ` Pingfan Liu
2019-04-02 8:08 ` Baoquan He
2019-04-03 2:58 ` Pingfan Liu
2019-04-03 3:10 ` Baoquan He
2019-04-04 9:40 ` Pingfan Liu
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=20190402065245.GN7627@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@alien8.de \
--cc=fanc.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=kernelfans@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nico@linaro.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).