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

2018-11-06 Thread Baoquan He
On 11/06/18 at 01:10pm, Borislav Petkov wrote: > > I have another idea to solve this issue. Adding a SRAT parsing code > > to arch/x86/mm/kaslr.c. It is useful for both EFI and BIOS and > > also we don't need a new kernel parameter... > > Dose the idea make sense? > > The more automatic stuff we d

Re: [PATCH v9 8/8] x86/boot/KASLR: Limit kaslr to choosing the immovable memory

2018-10-22 Thread Baoquan He
On 10/22/18 at 06:13pm, Chao Fan wrote: > >> +static bool process_mem_region(struct mem_vector *region, > >> + unsigned long long minimum, > >> + unsigned long long image_size) > >> +{ > >> + int i; > >> + /* > >> + * If no immovable memory found,

Re: [PATCH v9 5/8] x86/boot: Add get_acpi_rsdp() to parse RSDP in cmdlien from kexec

2018-10-22 Thread Baoquan He
On 10/22/18 at 03:30pm, Chao Fan wrote: > On Mon, Oct 22, 2018 at 02:06:13PM +0800, Baoquan He wrote: > >On 10/22/18 at 05:30am, Fan, Chao wrote: > >> >> +static void get_acpi_rsdp(acpi_physical_address *rsdp_addr) > >> >> +{ > >> >> +#ifd

Re: [PATCH v9 6/8] x86/boot: Dig out SRAT table from RSDP and find immovable memory

2018-10-21 Thread Baoquan He
On 10/22/18 at 05:29am, Fan, Chao wrote: > On Sun, Oct 21, 2018 at 10:34:58AM +0800, Baoquan He wrote: > >On 10/17/18 at 06:20pm, Chao Fan wrote: > >> + if (!cmdline_find_option_bool("movable_node") || > >> + cmdline_find_option_arg(&quo

Re: [PATCH v9 5/8] x86/boot: Add get_acpi_rsdp() to parse RSDP in cmdlien from kexec

2018-10-21 Thread Baoquan He
On 10/22/18 at 05:30am, Fan, Chao wrote: > >> +static void get_acpi_rsdp(acpi_physical_address *rsdp_addr) > >> +{ > >> +#ifdef CONFIG_KEXEC > >> + unsigned long long res; > >> + int len = 0; > >> + char *val; > >> + > >> + val = malloc(20); > > > >Why is the length 20? Defined a macro? > > >

Re: [PATCH v9 6/8] x86/boot: Dig out SRAT table from RSDP and find immovable memory

2018-10-20 Thread Baoquan He
On 10/17/18 at 06:20pm, Chao Fan wrote: > Dig out SRAT table from RSDP, and then walk all memory to find > the immovable memory regions, and fill in the immovable_mem[]. > So that we can use it to select memory for KASLR. > > Signed-off-by: Chao Fan > --- > arch/x86/boot/compressed/Makefile |

Re: [PATCH v9 5/8] x86/boot: Add get_acpi_rsdp() to parse RSDP in cmdlien from kexec

2018-10-20 Thread Baoquan He
On 10/17/18 at 06:20pm, Chao Fan wrote: > If KEXEC write the RSDP pointer to cmdline, parse the cmdline > and use it. > Imitate from early_param of "acpi_rsdp". > > Signed-off-by: Chao Fan > --- > arch/x86/boot/compressed/acpitb.c | 23 +++ > 1 file changed, 23 insertions(+)

Re: [PATCH v9 2/8] x86/boot: Copy kstrtoull() to compressed period

2018-10-17 Thread Baoquan He
On 10/18/18 at 01:51pm, Chao Fan wrote: > On Thu, Oct 18, 2018 at 12:03:38PM +0800, Baoquan He wrote: > >On 10/17/18 at 06:20pm, Chao Fan wrote: > >> Copy kstrtoull() to 'compressed' directory so that > >> we can use it to change the address in cmdline f

Re: [PATCH v9 3/8] x86/boot: Add efi_get_rsdp_addr() to dig out RSDP from EFI table

2018-10-17 Thread Baoquan He
On 10/18/18 at 01:54pm, Chao Fan wrote: > On Thu, Oct 18, 2018 at 12:35:39PM +0800, Baoquan He wrote: > >On 10/17/18 at 06:20pm, Chao Fan wrote: > >> There is a bug that kaslr may randomly choose some positions > >> which are located in movable memory regions. This wil

Re: [PATCH v9 3/8] x86/boot: Add efi_get_rsdp_addr() to dig out RSDP from EFI table

2018-10-17 Thread Baoquan He
On 10/17/18 at 06:20pm, Chao Fan wrote: > There is a bug that kaslr may randomly choose some positions > which are located in movable memory regions. This will break memory > hotplug feature and make the movable memory chosen by KASLR can't be > removed. So dig SRAT table from ACPI tables to get me

Re: [PATCH v9 7/8] x86/boot/KASLR: Walk srat tables to filter immovable memory

2018-10-17 Thread Baoquan He
On 10/17/18 at 06:20pm, Chao Fan wrote: > If CONFIG_MEMORY_HOTREMOVE enabled, walk through the acpi srat memory > tables and store those immovable memory regions so that kaslr can get > where to choose for randomization. This patch only adds invocation of get_immovable_mem() inside mem_avoid_init(

Re: [PATCH v9 8/8] x86/boot/KASLR: Limit kaslr to choosing the immovable memory

2018-10-17 Thread Baoquan He
On 10/17/18 at 06:20pm, Chao Fan wrote: > If CONFIG_MEMORY_HOTREMOVE enabled and the amount of immovable > memory regions is not zero. Calculate the intersection between memory This if conditional adverbial clauses is not an complete sentence. > regions from e820/efi memory table and immovable me

Re: [PATCH v9 2/8] x86/boot: Copy kstrtoull() to compressed period

2018-10-17 Thread Baoquan He
On 10/17/18 at 06:20pm, Chao Fan wrote: > Copy kstrtoull() to 'compressed' directory so that > we can use it to change the address in cmdline from > string to unsigned long long. So you don't like simple_strtoull() in arch/x86/boot/string.c which has been used in boot/compressed/kaslr.c . Why? Are

Re: [PATCH v9 1/8] x86/boot: Introduce cmdline_find_option_arg()to detect if option=arg in cmdline

2018-10-17 Thread Baoquan He
On 10/17/18 at 06:20pm, Chao Fan wrote: > +bool cmdline_find_option_arg(const char *option, const char *arg, int > argsize) > +{ > + char *buffer = malloc(argsize+1); > + bool find = false; > + int ret; > + > + ret = cmdline_find_option(option, buffer, argsize+1); > + if (ret =

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

2018-10-17 Thread Baoquan He
On 10/17/18 at 06:20pm, Chao Fan wrote: > In the earliest time, I tried to dig ACPI tabls to solve this problem. > But I didn't splite the code in 'compressed/' and ACPI code, so the patch > is hard to follow so refused by community. > Somebody suggest to add a kernel parameter to specify the > imm

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

2018-10-10 Thread Baoquan He
On 10/10/18 at 03:44pm, Masayoshi Mizuma wrote: > On Wed, Oct 10, 2018 at 05:30:57PM +0800, Baoquan He wrote: > > On 10/10/18 at 11:19am, Borislav Petkov wrote: > > > On Wed, Oct 10, 2018 at 11:14:26AM +0200, Thomas Gleixner wrote: > > > > Yes, it's differ

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

2018-10-10 Thread Baoquan He
On 10/10/18 at 11:19am, Borislav Petkov wrote: > On Wed, Oct 10, 2018 at 11:14:26AM +0200, Thomas Gleixner wrote: > > Yes, it's different, but if the SRAT information is available early, then > > the command line parameter can go away because then the required > > information for Masa's problem is

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

2018-10-10 Thread Baoquan He
On 10/10/18 at 05:12pm, Chao Fan wrote: > On Wed, Oct 10, 2018 at 05:06:20PM +0800, Baoquan He wrote: > >Hi Boris, > > > >On 10/10/18 at 10:59am, Borislav Petkov wrote: > >> ... and we just picked up > >> > >> https://lkml.kernel.org/r/20181001140

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

2018-10-10 Thread Baoquan He
Hi Boris, On 10/10/18 at 10:59am, Borislav Petkov wrote: > ... and we just picked up > > https://lkml.kernel.org/r/20181001140843.26137-1-msys.miz...@gmail.com > > and without having looked at the rest of your stuff, if people accept > your solution, we don't need the silly parameter anymore, ri

Re: [PATCH v5 2/4] x86/boot: Add acpitb.c to parse acpi tables

2018-08-27 Thread Baoquan He
Hi Chao, On 08/07/18 at 02:49pm, Chao Fan wrote: I think better add acpi/efi maintainers to CC when you post. > +static acpi_physical_address get_rsdp_addr(void) > +{ > + acpi_physical_address pa = 0; > + bool status = false; Here, I think you should make get_rsdp_addr() consistent wi

Re: [PATCH v9 2/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-18 Thread Baoquan He
On 08/18/17 at 04:10pm, Ard Biesheuvel wrote: > On 17 August 2017 at 14:04, Baoquan He wrote: > > Thanks a lot for helping improving the patch log, Ingo! Will pay more > > attention to the description in words and paragraph partition of log. > > > >> > >

Re: [PATCH v9 2/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-17 Thread Baoquan He
On 08/14/17 at 10:54pm, Baoquan He wrote: > Currently KASLR will parse all e820 entries of RAM type and add all > candidate position into slots array. Then we will choose one slot > randomly as the new position which kernel will be decompressed into > and run at. > > On syste

[PATCH v10 1/2] efi: Introduce efi_early_memdesc_ptr to get pointer to memmap descriptor

2017-08-16 Thread Baoquan He
independent usage and struct efi_info for x86 arch only. Introduce efi_early_memdesc_ptr to get pointer to a map descriptor, and replace several places of open code with it. Signed-off-by: Baoquan He --- v9->v10: Use the 'EFI subsystem' instead of EFI since EFI usually means firm

Re: [PATCH v9 1/2] efi: Introduce efi_early_memdesc_ptr to get pointer to memmap descriptor

2017-08-16 Thread Baoquan He
On 08/16/17 at 12:37pm, Matt Fleming wrote: > On Mon, 14 Aug, at 10:54:23PM, Baoquan He wrote: > > The existing map iteration helper for_each_efi_memory_desc_in_map can > > only be used after OS initializes EFI to fill data of struct efi_memory_map. > > Should this say

[PATCH v9 1/2] efi: Introduce efi_early_memdesc_ptr to get pointer to memmap descriptor

2017-08-14 Thread Baoquan He
usage and struct efi_info for x86 arch only. Introduce efi_early_memdesc_ptr to get pointer to a map descriptor, and replace several places of open code with it. Suggested-by: Ingo Molnar Signed-off-by: Baoquan He --- arch/x86/boot/compressed/eboot.c | 2 +- drivers/firmware/efi

[PATCH v9 2/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-14 Thread Baoquan He
e820 memory map. Signed-off-by: Baoquan He --- arch/x86/boot/compressed/kaslr.c | 68 ++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 99c7194f7ea6..7de23bb279ce 1

[PATCH v9 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-14 Thread Baoquan He
sue fix according to Kees's comment. This is based on tip/x86/boot, patch 1,2,3/4 in v5 post has been put into tip/x86/boot now. Baoquan He (2): efi: Introduce efi_early_memdesc_ptr to get pointer to memmap descriptor x86/boot/KASLR: Restrict kernel to be randomized in mirror re

Re: [PATCH v6 RESEND] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Baoquan He
On 08/04/17 at 12:55pm, Matt Fleming wrote: > On Fri, 04 Aug, at 07:40:05PM, Baoquan He wrote: > > On 08/04/17 at 12:23pm, Matt Fleming wrote: > > > On Fri, 28 Jul, at 07:26:03PM, Baoquan He wrote: > > > > Hi Matt, > > > > > &g

Re: [PATCH v6 RESEND] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Baoquan He
On 08/04/17 at 12:23pm, Matt Fleming wrote: > On Fri, 28 Jul, at 07:26:03PM, Baoquan He wrote: > > Hi Matt, > > > > On 07/28/17 at 11:55am, Ingo Molnar wrote: > > > > > > * Matt Fleming wrote: > > > > > > > On Fri, 21 Jul, at 09:19:

Re: [PATCH v8 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Baoquan He
On 08/04/17 at 05:59pm, Chao Fan wrote: > On Fri, Aug 04, 2017 at 05:22:41PM +0800, Baoquan He wrote: > >On 08/04/17 at 03:52pm, Baoquan He wrote: > >> Sorry, NACK this series, there's error to hang system. Before I just > >> halt system intentionally with error()

Re: [PATCH v8 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Baoquan He
On 08/04/17 at 03:52pm, Baoquan He wrote: > Sorry, NACK this series, there's error to hang system. Before I just > halt system intentionally with error() to check the efi memmap printing, > didn't notice this. Checking the cause. I rebuilt the code or change the one of the rep

Re: [PATCH v8 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Baoquan He
Sorry, NACK this series, there's error to hang system. Before I just halt system intentionally with error() to check the efi memmap printing, didn't notice this. Checking the cause. On 08/04/17 at 03:26pm, Baoquan He wrote: > Patch 1/2 is newly added to add efi_memdesc_ptr helpe

[PATCH v8 1/2] efi: Introduce efi_memdesc_ptr to get pointer to memmap descriptor

2017-08-04 Thread Baoquan He
usage and struct efi_info for x86 ARCH only. Introduce efi_memdesc_ptr to get pointer to a map descriptor, and replace several places of open code with it. Suggested-by: Ingo Molnar Signed-off-by: Baoquan He --- arch/x86/boot/compressed/eboot.c | 2 +- drivers/firmware/efi

[PATCH v8 2/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Baoquan He
e820 memory map. Signed-off-by: Baoquan He --- arch/x86/boot/compressed/kaslr.c | 68 ++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 99c7194f7ea6..3d3ce762dc98 1

[PATCH v8 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Baoquan He
tyle issue fix according to Kees's comment. This is based on tip/x86/boot, patch 1,2,3/4 in v5 post has been put into tip/x86/boot now. Baoquan He (2): efi: Introduce efi_memdesc_ptr to get pointer to memmap descriptor x86/boot/KASLR: Restrict kernel to be randomized in mirror regi

Re: [PATCH v4] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-23 Thread Baoquan He
ay is not easy to understand, so I step back to take the pud entry copy one by one method. Hi Mike and Dave, Could you also help review this patch? If possible, it can still catch the latest version of RHEL GA. Thanks Baoquan On 05/18/17 at 02:39pm, Baoquan He wrote: > For EFI with 

[PATCH v4] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-17 Thread Baoquan He
address X, pud_index(X) != pud_index(__va(X)). We can't only copy pgd entry from direct mapping to build ident mapping, instead need copy pud entry one by one from direct mapping. Fix it. Signed-off-by: Baoquan He Signed-off-by: Dave Young Cc: Matt Fleming Cc: Ard Biesheuvel Cc: Thomas Gle

Re: [PATCH v3] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-16 Thread Baoquan He
On 05/17/17 at 11:35am, Baoquan He wrote: > On 05/17/17 at 10:55am, Dave Young wrote: > > Hi, Baoquan > > > arch/x86/platform/efi/efi_64.c | 69 > > > +- > > > 1 file changed, 61 insertions(+), 8 deletions(-) > > &

Re: [PATCH v3] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-16 Thread Baoquan He
On 05/17/17 at 10:55am, Dave Young wrote: > Hi, Baoquan > > arch/x86/platform/efi/efi_64.c | 69 > > +- > > 1 file changed, 61 insertions(+), 8 deletions(-) > > > > diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c > > index c488

[PATCH v3] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-12 Thread Baoquan He
address X, pud_index(X) != pud_index(__va(X)). We can't only copy pgd entry from direct mapping to build ident mapping, instead need copy pud entry one by one from direct mapping. Fix it. Signed-off-by: Baoquan He Signed-off-by: Dave Young Cc: Matt Fleming Cc: Ard Biesheuvel Cc: Thomas Gle

Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-11 Thread Baoquan He
511.020636] BMC r001i11b: Power OFF via BMC [20170511.020701] BMC r001i11b: Power ON via BMC > > On Thu, 27 Apr, at 08:07:03PM, Baoquan He wrote: > > For EFI with old_map enabled, Kernel will panic when kaslr is enabled. > > > > The root cause is the ident mapping i

Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-09 Thread Baoquan He
On 05/08/17 at 05:25pm, Borislav Petkov wrote: > On Mon, May 08, 2017 at 09:36:49AM +0800, Baoquan He wrote: > > Thanks for explaining, Bhupesh. > > > > BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to > > use efi old map: > > > &

Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-08 Thread Baoquan He
On 05/08/17 at 05:25pm, Borislav Petkov wrote: > On Mon, May 08, 2017 at 09:36:49AM +0800, Baoquan He wrote: > > Thanks for explaining, Bhupesh. > > > > BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to > > use efi old map: > > > &

Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-07 Thread Baoquan He
Thanks for explaining, Bhupesh. BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to use efi old map: void __init efi_apply_memmap_quirks(void) { ... ... /* UV2+ BIOS has a fix for this issue. UV1 still needs the quirk. */ if (dmi_check_system(sgi

[PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-04-27 Thread Baoquan He
34000] Kernel panic - not syncing: Attempted to kill the idle task! [0.234000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! Signed-off-by: Baoquan He Signed-off-by: Dave Young Cc: Matt Fleming Cc: Ard Biesheuvel Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. P

Re: [PATCH 1/2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-04-27 Thread Baoquan He
On 04/27/17 at 06:31pm, Baoquan He wrote: > Hi Thomas, > > Thanks for reviewing! > > On 04/26/17 at 07:49am, Thomas Garnier wrote: > > On Wed, Apr 26, 2017 at 3:43 AM, Baoquan He wrote: > > > > arch/x86/platform/efi/efi_64.c | 35 +++---

Re: [PATCH 1/2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-04-27 Thread Baoquan He
Hi Thomas, Thanks for reviewing! On 04/26/17 at 07:49am, Thomas Garnier wrote: > On Wed, Apr 26, 2017 at 3:43 AM, Baoquan He wrote: > > > arch/x86/platform/efi/efi_64.c | 35 +++ > > > 1 file changed, 27 insertions(+), 8 deletions(-) >

Re: [PATCH 1/2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-04-26 Thread Baoquan He
This bug will cause SGI uv 100 boot failure since SGI uv 100 can only use efi old_map because of hardware. On rhel it failed all SGI uv series since we haven't back ported fix for SGI uv 200/300. On 04/26/17 at 06:39pm, Baoquan He wrote: > For EFI with old_map enabled, Kernel will pa

[PATCH 1/2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-04-26 Thread Baoquan He
34000] Kernel panic - not syncing: Attempted to kill the idle task! [0.234000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! Signed-off-by: Baoquan He Signed-off-by: Dave Young Cc: Matt Fleming Cc: Ard Biesheuvel Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. P

Re: [PATCH v2] x86/mm/KASLR: EFI region is mistakenly included into KASLR VA space for randomization

2017-03-24 Thread Baoquan He
On 03/24/17 at 10:24am, Ingo Molnar wrote: > > * Dave Young wrote: > > > > > So I applied this kexec fix and extended the changelog to clearly show > > > > why > > > > this fix matters in practice. > > > > > > I thought it only impacts kexec, but Dave thought it will impact 1st > > > kenrel

Re: [PATCH v2] x86/efi: Clean up a minor mistake in code comment

2017-03-24 Thread Baoquan He
On 03/24/17 at 09:43am, Ard Biesheuvel wrote: > On 24 March 2017 at 09:17, Baoquan He wrote: > > EFI allocate runtime services regions from EFI_VA_START, -4G, down > > to -68G, EFI_VA_END, 64G altogether. The mechanism was introduced in > > commit d2f7cbe7b26a7 ("x86/efi

[PATCH v2] x86/efi: Clean up a minor mistake in code comment

2017-03-24 Thread Baoquan He
EFI allocate runtime services regions from EFI_VA_START, -4G, down to -68G, EFI_VA_END, 64G altogether. The mechanism was introduced in commit d2f7cbe7b26a7 ("x86/efi: Runtime services virtual mapping"). Clean it up to avoid confusion. Signed-off-by: Baoquan He --- v1->v2: Update

Re: [PATCH v1 RESEND 2/2] x86/efi: Clean up a minor mistake in code comment

2017-03-24 Thread Baoquan He
On 03/24/17 at 08:57am, Ard Biesheuvel wrote: > On 23 March 2017 at 03:27, Baoquan He wrote: > > EFI allocate runtime services regions from EFI_VA_START, -4G, down > > to -64G, EFI_VA_END. > > OK, so is the size of the region 60 GB or 64 GB? This suggests 60 GB, > bu

Re: [PATCH v2] x86/mm/KASLR: EFI region is mistakenly included into KASLR VA space for randomization

2017-03-24 Thread Baoquan He
On 03/24/17 at 09:08am, Ingo Molnar wrote: > > Cc: #4.8+ > > Signed-off-by: Baoquan He > > Acked-by: Dave Young > > Reviewed-by: Bhupesh Sharma > > Acked-by: Thomas Garnier > > Cc: Thomas Gleixner > > Cc: Ingo Molnar > > Cc: "H. Pe

[PATCH v2] x86/mm/KASLR: EFI region is mistakenly included into KASLR VA space for randomization

2017-03-23 Thread Baoquan He
G, and EFI_VA_END = -64G. Changing EFI_VA_START to EFI_VA_END in mm/kaslr.c fixes this problem. Cc: #4.8+ Signed-off-by: Baoquan He Acked-by: Dave Young Reviewed-by: Bhupesh Sharma Acked-by: Thomas Garnier Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.o

[PATCH v1 RESEND 2/2] x86/efi: Clean up a minor mistake in code comment

2017-03-22 Thread Baoquan He
EFI allocate runtime services regions from EFI_VA_START, -4G, down to -64G, EFI_VA_END. The mechanism was introduced in commit d2f7cbe7b26a7 ("x86/efi: Runtime services virtual mapping"). Clean it up to avoid confusion. Signed-off-by: Baoquan He Cc: Matt Fleming Cc: Ard Biesheuvel

Re: [PATCH 2/2] x86/mm/KASLR: Correct the upper boundary of KALSR mm regions if adjacent to EFI

2017-03-14 Thread Baoquan He
On 03/15/17 at 02:13pm, Baoquan He wrote: > PING! > > Is there any suggestion for this code bug fix? > > Boris added comment in patch 1/2 thread that it can also be fixed by > swapping the naming - EFI_VA_START and EFI_VA_END. As he said the > swapping can remove the confu

Re: [PATCH 2/2] x86/mm/KASLR: Correct the upper boundary of KALSR mm regions if adjacent to EFI

2017-03-14 Thread Baoquan He
people who have the current mental picture of the mapping direction. And there's also a well known similar use case, stack, like stack_end naming in arch/x86/boot/main.c which is the low addr boundary of stack region. Any idea? Thanks Baoquan On 03/08/17 at 03:47pm, Baoquan He wrote: > EFI a

[PATCH v2 1/2] x86/efi/64: Clean up code comment about efi region

2017-03-08 Thread Baoquan He
EFI allocates runtime services regions starting from EFI_VA_START, -4G, decrement to EFI_VA_END. So remove the bottom-up term to avoid confusion. Signed-off-by: Baoquan He --- arch/x86/platform/efi/efi_64.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86

Re: [PATCH 1/2] x86/efi: Correct a tiny mistake in code comment

2017-03-08 Thread Baoquan He
On 03/08/17 at 10:35am, Borislav Petkov wrote: > On Wed, Mar 08, 2017 at 05:09:55PM +0800, Baoquan He wrote: > > Yes, it looks better. I can repost with this change. Thanks. > > No it doesn't: All right, I will just update the code comment. Just back ported kaslr to ou

Re: [PATCH 1/2] x86/efi: Correct a tiny mistake in code comment

2017-03-08 Thread Baoquan He
On 03/08/17 at 02:30pm, Bhupesh Sharma wrote: > Hi Dave, > > On Wed, Mar 8, 2017 at 1:48 PM, Dave Young wrote: > > On 03/08/17 at 03:47pm, Baoquan He wrote: > >> - * We allocate runtime services regions bottom-up, starting from -4G, i.e. > >> + * We allocate

Re: [PATCH 1/2] x86/efi: Correct a tiny mistake in code comment

2017-03-08 Thread Baoquan He
On 03/08/17 at 02:30pm, Bhupesh Sharma wrote: > Hi Dave, > > On Wed, Mar 8, 2017 at 1:48 PM, Dave Young wrote: > > On 03/08/17 at 03:47pm, Baoquan He wrote: > >> EFI allocate runtime services regions down from EFI_VA_START, -4G. > >> It should be top-down

Re: [PATCH 1/2] x86/efi: Correct a tiny mistake in code comment

2017-03-08 Thread Baoquan He
On 03/08/17 at 09:54am, Borislav Petkov wrote: > On Wed, Mar 08, 2017 at 04:45:13PM +0800, Baoquan He wrote: > > -4G and -68G just a trick which makes people understand easily, still we > > think kernel text mapping region is in higher addr area then vmalloc. I > > personn

Re: [PATCH 1/2] x86/efi: Correct a tiny mistake in code comment

2017-03-08 Thread Baoquan He
Forgot cc to Boris, add him. On 03/08/17 at 04:18pm, Dave Young wrote: > On 03/08/17 at 03:47pm, Baoquan He wrote: > > EFI allocate runtime services regions down from EFI_VA_START, -4G. > > It should be top-down handling. > > > > Signed-off-by: Baoquan He > &g

[PATCH 2/2] x86/mm/KASLR: Correct the upper boundary of KALSR mm regions if adjacent to EFI

2017-03-07 Thread Baoquan He
START. Correct it in this patch. Signed-off-by: Baoquan He --- arch/x86/mm/kaslr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c index 887e571..aed2064 100644 --- a/arch/x86/mm/kaslr.c +++ b/arch/x86/mm/kaslr.c @@ -48,7 +48,7 @@ s

[PATCH 1/2] x86/efi: Correct a tiny mistake in code comment

2017-03-07 Thread Baoquan He
EFI allocate runtime services regions down from EFI_VA_START, -4G. It should be top-down handling. Signed-off-by: Baoquan He --- arch/x86/platform/efi/efi_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c

Re: [PATCH v5 00/19] x86, boot: kaslr cleanup and 64bit kaslr support

2015-04-04 Thread Baoquan He
mem_avoid handling simple. > > Also put 7 patches from He that support random random, as I already used > his patches to test the ident mapping code, and could save some rebase > work for him. > > also at: > git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai

Re: [PATCH v5 03/19] x86, boot: Simplify run_size calculation

2015-03-22 Thread Baoquan He
On 03/18/15 at 12:28am, Yinghai Lu wrote: > While looking at the boot code to add mem mapping for kasl > with 64bit above 4G support, I found that e6023367d779 ("x86, kaslr: Prevent > .bss from overlaping initrd") and later introduced way to get kernel run_size > and pass it around. First via perl