Re: [PATCH v8 0/3] x86/boot/KASLR: Parse ACPI table and limit kaslr in immovable memory

Masayoshi Mizuma
2019-02-11T20:11:20Z

Hi Chao,

Thank you for your review.

On Mon, Feb 11, 2019 at 09:46:05AM +0800, Chao Fan wrote:
> On Tue, Feb 05, 2019 at 10:05:16AM -0500, Masayoshi Mizuma wrote:
> [...]
>
> Hi Masa,
>
> Sorry for delay, since last days were Chinese holiday.
>
> >diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
> >index c5a949335..7dd61b943 100644
> >--- a/arch/x86/boot/compressed/acpi.c
> >+++ b/arch/x86/boot/compressed/acpi.c
> >@@ -288,6 +288,7 @@ int count_immovable_mem_regions(void)
> > struct acpi_subtable_header *sub_table;
> > struct acpi_table_header *table_header;
> > char arg[MAX_ACPI_ARG_LENGTH];
> >+ unsigned long long possible_addr, max_possible_addr = 0;
>
> This line is so long that it should be added in first line.

Thanks. I will simplify around the local variables.

>
> > int num = 0;
> >
> > if (cmdline_find_option("acpi", arg, sizeof(arg)) == 3 &&
> >@@ -308,10 +309,19 @@ int count_immovable_mem_regions(void)
> > struct acpi_srat_mem_affinity *ma;
> >
> > ma = (struct acpi_srat_mem_affinity *)sub_table;
> >- if (!(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && ma->length) {
> >- immovable_mem[num].start = ma->base_address;
> >- immovable_mem[num].size = ma->length;
> >- num++;
> >+ if (ma->length) {
> >+ if (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) {
> >+ possible_addr =
> >+ ma->base_address + ma->length;
> >+ if (possible_addr > max_possible_addr)
> >+ max_possible_addr =
> >+ possible_addr;
> >+ } else {
> >+ immovable_mem[num].start =
> >+ ma->base_address;
> >+ immovable_mem[num].size = ma->length;
> >+ num++;
> >+ }
> > }
>
> It looks better in another mail where you add a new function.

Thanks!

- Masa