Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-21 Thread Chao Fan
On Mon, Jan 21, 2019 at 10:45:24AM +0100, Borislav Petkov wrote: >On Mon, Jan 21, 2019 at 05:42:14PM +0800, Chao Fan wrote: >> Or I clear this function as: >> static acpi_physical_address get_rsdp_addr(void) >> { >> acpi_physical_address pa; >> >> pa = get_acpi_rsdp(); >> >>

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-21 Thread Borislav Petkov
On Mon, Jan 21, 2019 at 05:42:14PM +0800, Chao Fan wrote: > Or I clear this function as: > static acpi_physical_address get_rsdp_addr(void) > { > acpi_physical_address pa; > > pa = get_acpi_rsdp(); > > if (!pa) > pa = boot_params->acpi_rsdp_addr; > >

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-21 Thread Chao Fan
On Mon, Jan 21, 2019 at 05:33:48PM +0800, Chao Fan wrote: >On Wed, Jan 16, 2019 at 12:01:58PM +0100, Borislav Petkov wrote: >>On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: >[...] >>> + >>> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >>> +static acpi_physical_address

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-21 Thread Chao Fan
On Wed, Jan 16, 2019 at 12:01:58PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: [...] >> + >> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >> +static acpi_physical_address get_rsdp_addr(void) >> +{ >> +acpi_physical_address pa; >> + >>

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-17 Thread Chao Fan
On Thu, Jan 17, 2019 at 04:27:51PM +0100, Borislav Petkov wrote: >On Thu, Jan 17, 2019 at 11:20:27AM +0800, Chao Fan wrote: >> I have changed as you suggested, looks clear without type cast, and >> we need some variable as long to calculate the address, and at same >> time as the struct pointer to

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-17 Thread Borislav Petkov
On Thu, Jan 17, 2019 at 11:20:27AM +0800, Chao Fan wrote: > I have changed as you suggested, looks clear without type cast, and > we need some variable as long to calculate the address, and at same > time as the struct pointer to find it's length, so I change as below, > and get_acpi_srat_table()

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-17 Thread Juergen Gross
On 17/01/2019 09:22, Kairui Song wrote: > On Thu, Jan 17, 2019 at 3:58 PM Chao Fan wrote: >> >> On Wed, Jan 16, 2019 at 03:28:52PM +0800, Kairui Song wrote: >>> On Mon, Jan 7, 2019 at 11:24 AM Chao Fan wrote: + +/* Determine RSDP, based on acpi_os_get_root_pointer(). */

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-17 Thread Kairui Song
On Thu, Jan 17, 2019 at 3:58 PM Chao Fan wrote: > > On Wed, Jan 16, 2019 at 03:28:52PM +0800, Kairui Song wrote: > >On Mon, Jan 7, 2019 at 11:24 AM Chao Fan wrote: > >> > >> + > >> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ > >> +static acpi_physical_address get_rsdp_addr(void)

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 03:28:52PM +0800, Kairui Song wrote: >On Mon, Jan 7, 2019 at 11:24 AM Chao Fan wrote: >> >> + >> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >> +static acpi_physical_address get_rsdp_addr(void) >> +{ >> + acpi_physical_address pa; >> + >> + pa =

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 12:01:58PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: >> +void get_immovable_mem(void) >> +{ >> +struct acpi_table_header *table_header; >> +struct acpi_subtable_header *table; >> +struct acpi_srat_mem_affinity *ma;

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 03:28:52PM +0800, Kairui Song wrote: >On Mon, Jan 7, 2019 at 11:24 AM Chao Fan wrote: >> >> + >> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >> +static acpi_physical_address get_rsdp_addr(void) >> +{ >> + acpi_physical_address pa; >> + >> + pa =

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 12:01:58PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: [...] >> +rsdp = (struct acpi_table_rsdp *)(long)get_rsdp_addr(); >> +if (!rsdp) >> +return NULL; >> + >> +/* Get RSDT or XSDT from RSDP. */ >> +

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Borislav Petkov
On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: > SRAT should be parsed by RSDP to fix the conflict between KASLR and > memory-hotremove, then find the immovable memory regions and store > them in an array called immovable_mem[]. With immovable_mem[], KASLR > can avoid to extract kernel

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-15 Thread Kairui Song
On Mon, Jan 7, 2019 at 11:24 AM Chao Fan wrote: > > + > +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ > +static acpi_physical_address get_rsdp_addr(void) > +{ > + acpi_physical_address pa; > + > + pa = get_acpi_rsdp(); > + > + if (!pa) > + pa =

[PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-06 Thread Chao Fan
SRAT should be parsed by RSDP to fix the conflict between KASLR and memory-hotremove, then find the immovable memory regions and store them in an array called immovable_mem[]. With immovable_mem[], KASLR can avoid to extract kernel to specific regions. Since 'RANDOMIZE_BASE' && 'MEMORY_HOTREMOVE'