[RFC v1 0/2] mm: SLUB Freelist randomization

2016-05-18 Thread Thomas Garnier
This is RFC v1 for the SLUB Freelist randomization. ***Background: This proposal follows the previous SLAB Freelist patch submitted to next. It resuses parts of previous implementation and keep a similar approach. The kernel heap allocators are using a sequential freelist making their allocation

[RFC v1 0/2] mm: SLUB Freelist randomization

2016-05-18 Thread Thomas Garnier
This is RFC v1 for the SLUB Freelist randomization. ***Background: This proposal follows the previous SLAB Freelist patch submitted to next. It resuses parts of previous implementation and keep a similar approach. The kernel heap allocators are using a sequential freelist making their allocation

Re: [PATCH v5 0/4] x86, boot: KASLR memory randomization

2016-05-16 Thread Thomas Garnier
Any feedback on the patch? Ingo? Kees? Kees mentioned he will take care of the build warning on the KASLR refactor (the function is not used right now). Thanks, Thomas On Thu, May 12, 2016 at 12:28 PM, Thomas Garnier <thgar...@google.com> wrote: > This is PATCH v5 for KAS

Re: [PATCH v5 0/4] x86, boot: KASLR memory randomization

2016-05-16 Thread Thomas Garnier
Any feedback on the patch? Ingo? Kees? Kees mentioned he will take care of the build warning on the KASLR refactor (the function is not used right now). Thanks, Thomas On Thu, May 12, 2016 at 12:28 PM, Thomas Garnier wrote: > This is PATCH v5 for KASLR memory implementation for x86

[PATCH v5 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-12 Thread Thomas Garnier
fter 1,0.076,0.069 2,0.072,0.069 3,0.066,0.066 4,0.066,0.068 5,0.066,0.067 6,0.066,0.069 7,0.067,0.066 8,0.063,0.067 9,0.067,0.065 10,0.068,0.071 average,0.0677,0.0677 Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160511 --- Documentation/x86/x86_64/mm.txt |

[PATCH v5 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-12 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160511 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 7 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git

[PATCH v5 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-12 Thread Thomas Garnier
fter 1,0.076,0.069 2,0.072,0.069 3,0.066,0.066 4,0.066,0.068 5,0.066,0.067 6,0.066,0.069 7,0.067,0.066 8,0.063,0.067 9,0.067,0.065 10,0.068,0.071 average,0.0677,0.0677 Signed-off-by: Thomas Garnier --- Based on next-20160511 --- Documentation/x86/x86_64/mm.txt | 4 + arch/x86/Kconfig

[PATCH v5 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-12 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier --- Based on next-20160511 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 7 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch

[PATCH v5 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-12 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160511 --- arch/x86/boot/compressed/kaslr.c | 77 +++--- arch/x86/include/asm/k

[PATCH v5 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-12 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier --- Based on next-20160511 --- arch/x86/boot/compressed/kaslr.c | 77 +++--- arch/x86/include/asm/kaslr.h | 6 +++ arch

[PATCH v5 0/4] x86, boot: KASLR memory randomization

2016-05-12 Thread Thomas Garnier
This is PATCH v5 for KASLR memory implementation for x86_64. Recent changes: Add performance information on commit. Add details on PUD alignment. Add information on testing against the KASLR bypass exploit. Rebase on next-20160511 and merge recent KASLR changes. Integrate

[PATCH v5 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-12 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160511 --- arch/x86/mm/init_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index bce2e5d..f205f39 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/

[PATCH v5 0/4] x86, boot: KASLR memory randomization

2016-05-12 Thread Thomas Garnier
This is PATCH v5 for KASLR memory implementation for x86_64. Recent changes: Add performance information on commit. Add details on PUD alignment. Add information on testing against the KASLR bypass exploit. Rebase on next-20160511 and merge recent KASLR changes. Integrate

[PATCH v5 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-12 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier --- Based on next-20160511 --- arch/x86/mm/init_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index bce2e5d..f205f39 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -454,10

Re: [PATCH v4 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-12 Thread Thomas Garnier
] > [if your patch is applied to the wrong git tree, please drop us a note to > help improving the system] > > url: > https://github.com/0day-ci/linux/commits/Thomas-Garnier/x86-boot-KASLR-memory-randomization/20160513-001319 > config: i386-tinyconfig (attached as .config) >

Re: [PATCH v4 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-12 Thread Thomas Garnier
ed to the wrong git tree, please drop us a note to > help improving the system] > > url: > https://github.com/0day-ci/linux/commits/Thomas-Garnier/x86-boot-KASLR-memory-randomization/20160513-001319 > config: i386-tinyconfig (attached as .config) > compiler: gcc-6 (Debian 6.

[PATCH v4 0/4] x86, boot: KASLR memory randomization

2016-05-12 Thread Thomas Garnier
This is PATCH v4 for KASLR memory implementation for x86_64. Recent changes: Add performance information on commit. Add details on PUD alignment. Add information on testing against the KASLR bypass exploit. Rebase on next-20160511 and merge recent KASLR changes. Integrate

[PATCH v4 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-12 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160511 --- arch/x86/mm/init_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index bce2e5d..f205f39 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/

[PATCH v4 0/4] x86, boot: KASLR memory randomization

2016-05-12 Thread Thomas Garnier
This is PATCH v4 for KASLR memory implementation for x86_64. Recent changes: Add performance information on commit. Add details on PUD alignment. Add information on testing against the KASLR bypass exploit. Rebase on next-20160511 and merge recent KASLR changes. Integrate

[PATCH v4 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-12 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier --- Based on next-20160511 --- arch/x86/mm/init_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index bce2e5d..f205f39 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -454,10

[PATCH v4 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-12 Thread Thomas Garnier
fter 1,0.076,0.069 2,0.072,0.069 3,0.066,0.066 4,0.066,0.068 5,0.066,0.067 6,0.066,0.069 7,0.067,0.066 8,0.063,0.067 9,0.067,0.065 10,0.068,0.071 average,0.0677,0.0677 Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160511 --- Documentation/x86/x86_64/mm.txt |

[PATCH v4 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-12 Thread Thomas Garnier
fter 1,0.076,0.069 2,0.072,0.069 3,0.066,0.066 4,0.066,0.068 5,0.066,0.067 6,0.066,0.069 7,0.067,0.066 8,0.063,0.067 9,0.067,0.065 10,0.068,0.071 average,0.0677,0.0677 Signed-off-by: Thomas Garnier --- Based on next-20160511 --- Documentation/x86/x86_64/mm.txt | 4 + arch/x86/Kconfig

[PATCH v4 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-12 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160511 --- arch/x86/boot/compressed/kaslr.c | 77 +++--- arch/x86/include/asm/k

[PATCH v4 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-12 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier --- Based on next-20160511 --- arch/x86/boot/compressed/kaslr.c | 77 +++--- arch/x86/include/asm/kaslr.h | 6 +++ arch

[PATCH v4 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-12 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160511 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 7 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git

[PATCH v4 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-12 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier --- Based on next-20160511 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 7 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch

Re: [PATCH v3 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-10 Thread Thomas Garnier
On Tue, May 10, 2016 at 11:53 AM, Kees Cook <keesc...@chromium.org> wrote: > On Tue, May 3, 2016 at 12:31 PM, Thomas Garnier <thgar...@google.com> wrote: >> Randomizes the virtual address space of kernel memory sections (physical >> memory mapping, vmalloc & vme

Re: [PATCH v3 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-10 Thread Thomas Garnier
On Tue, May 10, 2016 at 11:53 AM, Kees Cook wrote: > On Tue, May 3, 2016 at 12:31 PM, Thomas Garnier wrote: >> Randomizes the virtual address space of kernel memory sections (physical >> memory mapping, vmalloc & vmemmap) for x86_64. This security feature >> m

Re: [PATCH v3 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-10 Thread Thomas Garnier
On Tue, May 10, 2016 at 12:05 PM, Kees Cook <keesc...@chromium.org> wrote: > On Tue, May 3, 2016 at 12:31 PM, Thomas Garnier <thgar...@google.com> wrote: >> Move the KASLR entropy functions in x86/libray to be used in early >> kernel boot for KASLR memory randomization.

Re: [PATCH v3 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-10 Thread Thomas Garnier
On Tue, May 10, 2016 at 12:05 PM, Kees Cook wrote: > On Tue, May 3, 2016 at 12:31 PM, Thomas Garnier wrote: >> Move the KASLR entropy functions in x86/libray to be used in early >> kernel boot for KASLR memory randomization. >> >> Signed-off-by: Thomas Garnier >&

Re: [PATCH v3 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-10 Thread Thomas Garnier
On Tue, May 10, 2016 at 11:24 AM, Kees Cook <keesc...@chromium.org> wrote: > On Tue, May 3, 2016 at 12:31 PM, Thomas Garnier <thgar...@google.com> wrote: >> Add a new option (CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING) to define >> the padding used for the physical memory

Re: [PATCH v3 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-10 Thread Thomas Garnier
On Tue, May 10, 2016 at 11:24 AM, Kees Cook wrote: > On Tue, May 3, 2016 at 12:31 PM, Thomas Garnier wrote: >> Add a new option (CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING) to define >> the padding used for the physical memory mapping section when KASLR >> memory i

[PATCH v3 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-03 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160502 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 14 -- 2 files changed, 27 insertions(+), 2 deletions(-)

[PATCH v3 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-03 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160502 --- arch/x86/boot/compressed/kaslr.c | 76 +++--- arch/x86/inclu

[PATCH v3 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-03 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier --- Based on next-20160502 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 14 -- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig

[PATCH v3 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-03 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier --- Based on next-20160502 --- arch/x86/boot/compressed/kaslr.c | 76 +++--- arch/x86/include/asm/kaslr.h | 6

[PATCH v3 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-03 Thread Thomas Garnier
s 97681.6 (1031.11) Hackbench shows 0% difference on average (hackbench 90 repeated 10 times): attemp,before,after 1,0.076,0.069 2,0.072,0.069 3,0.066,0.066 4,0.066,0.068 5,0.066,0.067 6,0.066,0.069 7,0.067,0.066 8,0.063,0.067 9,0.067,0.065 10,0.068,0.071 average,0.0677,0.0677 Signed-off-by: Tho

[PATCH v3 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-03 Thread Thomas Garnier
s 97681.6 (1031.11) Hackbench shows 0% difference on average (hackbench 90 repeated 10 times): attemp,before,after 1,0.076,0.069 2,0.072,0.069 3,0.066,0.066 4,0.066,0.068 5,0.066,0.067 6,0.066,0.069 7,0.067,0.066 8,0.063,0.067 9,0.067,0.065 10,0.068,0.071 average,0.0677,0.0677 Signed-off-by: Thomas Garnier

[PATCH v3 0/4] x86, boot: KASLR memory randomization

2016-05-03 Thread Thomas Garnier
This is PATCH v3 for KASLR memory implementation for x86_64. Recent changes: Add performance information on commit. Add details on PUD alignment. Add information on testing against the KASLR bypass exploit. Rebase on next-20160502. ***Background: The current implementation of

[PATCH v3 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-03 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160502 --- arch/x86/mm/init_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 89d9747..6adfbce 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/

[PATCH v3 0/4] x86, boot: KASLR memory randomization

2016-05-03 Thread Thomas Garnier
This is PATCH v3 for KASLR memory implementation for x86_64. Recent changes: Add performance information on commit. Add details on PUD alignment. Add information on testing against the KASLR bypass exploit. Rebase on next-20160502. ***Background: The current implementation of

[PATCH v3 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-03 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier --- Based on next-20160502 --- arch/x86/mm/init_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 89d9747..6adfbce 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -526,10

Re: [PATCH v2 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-03 Thread Thomas Garnier
, May 2, 2016 at 3:00 PM, Dave Hansen <dave.han...@linux.intel.com> wrote: > On 05/02/2016 02:41 PM, Thomas Garnier wrote: >> -#define __PAGE_OFFSET _AC(0x8800, UL) >> +#define __PAGE_OFFSET_BASE _AC(0x8800, UL) >> +#ifdef CONFIG_R

Re: [PATCH v2 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-03 Thread Thomas Garnier
, May 2, 2016 at 3:00 PM, Dave Hansen wrote: > On 05/02/2016 02:41 PM, Thomas Garnier wrote: >> -#define __PAGE_OFFSET _AC(0x8800, UL) >> +#define __PAGE_OFFSET_BASE _AC(0x8800, UL) >> +#ifdef CONFIG_RANDOMIZE_MEMORY >

Re: [PATCH v2 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-03 Thread Thomas Garnier
On Mon, May 2, 2016 at 2:58 PM, Dave Hansen <dave.han...@linux.intel.com> wrote: > On 05/02/2016 02:41 PM, Thomas Garnier wrote: >> Minor change that allows early boot physical mapping of PUD level virtual >> addresses. This change prepares usage of different virtual addresse

Re: [PATCH v2 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-03 Thread Thomas Garnier
On Mon, May 2, 2016 at 2:58 PM, Dave Hansen wrote: > On 05/02/2016 02:41 PM, Thomas Garnier wrote: >> Minor change that allows early boot physical mapping of PUD level virtual >> addresses. This change prepares usage of different virtual addresses for >> KASLR memory

[PATCH v2 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-02 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160502 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 14 -- 2 files changed, 27 insertions(+), 2 deletions(-)

[PATCH v2 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-05-02 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier --- Based on next-20160502 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 14 -- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig

[PATCH v2 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-02 Thread Thomas Garnier
splay each section. Updated documentation on x86_64 memory layout accordingly. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160502 --- Documentation/x86/x86_64/mm.txt | 4 + arch/x86/Kconfig| 15 arch/x86/include/asm/kaslr.h

[PATCH v2 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-05-02 Thread Thomas Garnier
splay each section. Updated documentation on x86_64 memory layout accordingly. Signed-off-by: Thomas Garnier --- Based on next-20160502 --- Documentation/x86/x86_64/mm.txt | 4 + arch/x86/Kconfig| 15 arch/x86/include/asm/kaslr.h| 12 +++ ar

[PATCH v2 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-02 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160502 --- arch/x86/boot/compressed/kaslr.c | 76 +++--- arch/x86/inclu

[PATCH v2 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-02 Thread Thomas Garnier
Minor change that allows early boot physical mapping of PUD level virtual addresses. This change prepares usage of different virtual addresses for KASLR memory randomization. It has no impact on default usage. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20

[PATCH v2 0/4] x86, boot: KASLR memory implementation

2016-05-02 Thread Thomas Garnier
This is PATCH v2 for KASLR memory implementation for x86_64. Edit commit based on recents testing against the KASLR bypass exploits & rebase on next-20160502. ***Background: The current implementation of KASLR randomizes only the base address of the kernel and its modules. Research was published

[PATCH v2 1/4] x86, boot: Refactor KASLR entropy functions

2016-05-02 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier --- Based on next-20160502 --- arch/x86/boot/compressed/kaslr.c | 76 +++--- arch/x86/include/asm/kaslr.h | 6

[PATCH v2 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-05-02 Thread Thomas Garnier
Minor change that allows early boot physical mapping of PUD level virtual addresses. This change prepares usage of different virtual addresses for KASLR memory randomization. It has no impact on default usage. Signed-off-by: Thomas Garnier --- Based on next-20160502 --- arch/x86/mm/init_64.c

[PATCH v2 0/4] x86, boot: KASLR memory implementation

2016-05-02 Thread Thomas Garnier
This is PATCH v2 for KASLR memory implementation for x86_64. Edit commit based on recents testing against the KASLR bypass exploits & rebase on next-20160502. ***Background: The current implementation of KASLR randomizes only the base address of the kernel and its modules. Research was published

Re: [PATCH 0/4] x86, boot: KASLR memory randomization

2016-04-29 Thread Thomas Garnier
Any feedback on this patch proposal? Thanks, Thomas On Mon, Apr 25, 2016 at 9:39 AM, Thomas Garnier <thgar...@google.com> wrote: > This is PATCH v1 for KASLR memory implementation on x86_64. Minor changes > were done based on RFC v1 comments. > > ***Background: > The c

Re: [PATCH 0/4] x86, boot: KASLR memory randomization

2016-04-29 Thread Thomas Garnier
Any feedback on this patch proposal? Thanks, Thomas On Mon, Apr 25, 2016 at 9:39 AM, Thomas Garnier wrote: > This is PATCH v1 for KASLR memory implementation on x86_64. Minor changes > were done based on RFC v1 comments. > > ***Background: > The current implementation of KASLR

Re: [PATCH v5] mm: SLAB freelist randomization

2016-04-27 Thread Thomas Garnier
On Wed, Apr 27, 2016 at 12:16 PM, Andrew Morton <a...@linux-foundation.org> wrote: > On Wed, 27 Apr 2016 10:20:59 -0700 Thomas Garnier <thgar...@google.com> wrote: > >> Provides an optional config (CONFIG_SLAB_FREELIST_RANDOM) to randomize >> the SLAB freelist. >

Re: [PATCH v5] mm: SLAB freelist randomization

2016-04-27 Thread Thomas Garnier
On Wed, Apr 27, 2016 at 12:16 PM, Andrew Morton wrote: > On Wed, 27 Apr 2016 10:20:59 -0700 Thomas Garnier wrote: > >> Provides an optional config (CONFIG_SLAB_FREELIST_RANDOM) to randomize >> the SLAB freelist. > > Forgot this bit? > I thought I would change it w

[PATCH v5] mm: SLAB freelist randomization

2016-04-27 Thread Thomas Garnier
24)/kfree -> 119 cycles 10000 times kmalloc(2048)/kfree -> 119 cycles 1 times kmalloc(4096)/kfree -> 119 cycles 1 times kmalloc(8192)/kfree -> 119 cycles 1 times kmalloc(16384)/kfree -> 119 cycles Signed-off-by: Thomas Garnier <thgar...@google.com> Acked-by: Chr

[PATCH v5] mm: SLAB freelist randomization

2016-04-27 Thread Thomas Garnier
24)/kfree -> 119 cycles 10000 times kmalloc(2048)/kfree -> 119 cycles 1 times kmalloc(4096)/kfree -> 119 cycles 1 times kmalloc(8192)/kfree -> 119 cycles 1 times kmalloc(16384)/kfree -> 119 cycles Signed-off-by: Thomas Garnier Acked-by: Christoph Lameter --- Based on n

Re: [PATCH v4] mm: SLAB freelist randomization

2016-04-26 Thread Thomas Garnier
On Tue, Apr 26, 2016 at 4:17 PM, Andrew Morton <a...@linux-foundation.org> wrote: > On Tue, 26 Apr 2016 09:21:10 -0700 Thomas Garnier <thgar...@google.com> wrote: > >> Provides an optional config (CONFIG_FREELIST_RANDOM) to randomize the >> SLAB freelist.

Re: [PATCH v4] mm: SLAB freelist randomization

2016-04-26 Thread Thomas Garnier
On Tue, Apr 26, 2016 at 4:17 PM, Andrew Morton wrote: > On Tue, 26 Apr 2016 09:21:10 -0700 Thomas Garnier wrote: > >> Provides an optional config (CONFIG_FREELIST_RANDOM) to randomize the >> SLAB freelist. The list is randomized during initialization of a new set >

[PATCH v4] mm: SLAB freelist randomization

2016-04-26 Thread Thomas Garnier
ee -> 119 cycles 10000 times kmalloc(2048)/kfree -> 119 cycles 1 times kmalloc(4096)/kfree -> 119 cycles 1 times kmalloc(8192)/kfree -> 119 cycles 1 times kmalloc(16384)/kfree -> 119 cycles Signed-off-by: Thomas Garnier <thgar...@google.com> Acked-by: Christoph L

[PATCH v4] mm: SLAB freelist randomization

2016-04-26 Thread Thomas Garnier
ee -> 119 cycles 10000 times kmalloc(2048)/kfree -> 119 cycles 1 times kmalloc(4096)/kfree -> 119 cycles 1 times kmalloc(8192)/kfree -> 119 cycles 1 times kmalloc(16384)/kfree -> 119 cycles Signed-off-by: Thomas Garnier Acked-by: Christoph Lameter --- Based on next-20160

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
Make sense. I think it is still valuable to randomize earlier pages. I will adapt the code, test and send patch v4. Thanks for the quick feedback, Thomas On Mon, Apr 25, 2016 at 5:40 PM, Joonsoo Kim <iamjoonsoo@lge.com> wrote: > On Mon, Apr 25, 2016 at 01:39:23PM -0700, Thomas Garn

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
Make sense. I think it is still valuable to randomize earlier pages. I will adapt the code, test and send patch v4. Thanks for the quick feedback, Thomas On Mon, Apr 25, 2016 at 5:40 PM, Joonsoo Kim wrote: > On Mon, Apr 25, 2016 at 01:39:23PM -0700, Thomas Garnier wrote: >> Provides an

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
On Mon, Apr 25, 2016 at 2:38 PM, Andrew Morton <a...@linux-foundation.org> wrote: > On Mon, 25 Apr 2016 14:14:33 -0700 Thomas Garnier <thgar...@google.com> wrote: > >> >>> + /* Get best entropy at this stage */ >> >>> + get_random_byte

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
On Mon, Apr 25, 2016 at 2:38 PM, Andrew Morton wrote: > On Mon, 25 Apr 2016 14:14:33 -0700 Thomas Garnier wrote: > >> >>> + /* Get best entropy at this stage */ >> >>> + get_random_bytes_arch(, sizeof(seed)); >> >> >&g

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
On Mon, Apr 25, 2016 at 2:13 PM, Thomas Garnier <thgar...@google.com> wrote: > On Mon, Apr 25, 2016 at 2:10 PM, Andrew Morton > <a...@linux-foundation.org> wrote: >> On Mon, 25 Apr 2016 13:39:23 -0700 Thomas Garnier <thgar...@google.com> >> wrote

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
On Mon, Apr 25, 2016 at 2:13 PM, Thomas Garnier wrote: > On Mon, Apr 25, 2016 at 2:10 PM, Andrew Morton > wrote: >> On Mon, 25 Apr 2016 13:39:23 -0700 Thomas Garnier >> wrote: >> >>> Provides an optional config (CONFIG_FREELIST_RANDOM) to randomize the >>

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
On Mon, Apr 25, 2016 at 2:10 PM, Andrew Morton <a...@linux-foundation.org> wrote: > On Mon, 25 Apr 2016 13:39:23 -0700 Thomas Garnier <thgar...@google.com> wrote: > >> Provides an optional config (CONFIG_FREELIST_RANDOM) to randomize the >> SLAB freelist.

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
On Mon, Apr 25, 2016 at 2:10 PM, Andrew Morton wrote: > On Mon, 25 Apr 2016 13:39:23 -0700 Thomas Garnier wrote: > >> Provides an optional config (CONFIG_FREELIST_RANDOM) to randomize the >> SLAB freelist. The list is randomized during initialization of a new set >

[PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
142 cycles 1 times kmalloc(128)/kfree -> 121 cycles 1 times kmalloc(256)/kfree -> 119 cycles 1 times kmalloc(512)/kfree -> 119 cycles 1 times kmalloc(1024)/kfree -> 119 cycles 10000 times kmalloc(2048)/kfree -> 119 cycles 1 times kmalloc(4096)/kfree -> 119 cycle

[PATCH v2] mm: SLAB freelist randomization

2016-04-25 Thread Thomas Garnier
142 cycles 1 times kmalloc(128)/kfree -> 121 cycles 1 times kmalloc(256)/kfree -> 119 cycles 1 times kmalloc(512)/kfree -> 119 cycles 1 times kmalloc(1024)/kfree -> 119 cycles 10000 times kmalloc(2048)/kfree -> 119 cycles 1 times kmalloc(4096)/kfree -> 119

[PATCH 1/4] x86, boot: Refactor KASLR entropy functions

2016-04-25 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160422 --- arch/x86/boot/compressed/kaslr.c | 76 +++--- arch/x86/inclu

[PATCH 1/4] x86, boot: Refactor KASLR entropy functions

2016-04-25 Thread Thomas Garnier
Move the KASLR entropy functions in x86/libray to be used in early kernel boot for KASLR memory randomization. Signed-off-by: Thomas Garnier --- Based on next-20160422 --- arch/x86/boot/compressed/kaslr.c | 76 +++--- arch/x86/include/asm/kaslr.h | 6

[PATCH 0/4] x86, boot: KASLR memory randomization

2016-04-25 Thread Thomas Garnier
This is PATCH v1 for KASLR memory implementation on x86_64. Minor changes were done based on RFC v1 comments. ***Background: The current implementation of KASLR randomizes only the base address of the kernel and its modules. Research was published showing that static memory can be overwitten to

[PATCH 0/4] x86, boot: KASLR memory randomization

2016-04-25 Thread Thomas Garnier
This is PATCH v1 for KASLR memory implementation on x86_64. Minor changes were done based on RFC v1 comments. ***Background: The current implementation of KASLR randomizes only the base address of the kernel and its modules. Research was published showing that static memory can be overwitten to

[PATCH 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-25 Thread Thomas Garnier
ses. An additional low memory page is used to ensure each CPU can start with a PGD aligned virtual address (for realmode). x86/dump_pagetable was updated to correctly display each section. Updated documentation on x86_64 memory layout accordingly. Signed-off-by: Thomas Garnier <thgar...@google.c

[PATCH 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-25 Thread Thomas Garnier
ses. An additional low memory page is used to ensure each CPU can start with a PGD aligned virtual address (for realmode). x86/dump_pagetable was updated to correctly display each section. Updated documentation on x86_64 memory layout accordingly. Signed-off-by: Thomas Garnier --- Base

[PATCH 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-04-25 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20160422 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 14 -- 2 files changed, 27 insertions(+), 2 deletions(-)

[PATCH 4/4] x86, boot: Memory hotplug support for KASLR memory randomization

2016-04-25 Thread Thomas Garnier
. If CONFIG_MEMORY_HOTPLUG is not used, no space is reserved increasing the entropy available. Signed-off-by: Thomas Garnier --- Based on next-20160422 --- arch/x86/Kconfig| 15 +++ arch/x86/mm/kaslr.c | 14 -- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig

[PATCH 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-04-25 Thread Thomas Garnier
Minor change that allows early boot physical mapping of PUD level virtual addresses. This change prepares usage of different virtual addresses for KASLR memory randomization. It has no impact on default usage. Signed-off-by: Thomas Garnier <thgar...@google.com> --- Based on next-20

[PATCH 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

2016-04-25 Thread Thomas Garnier
Minor change that allows early boot physical mapping of PUD level virtual addresses. This change prepares usage of different virtual addresses for KASLR memory randomization. It has no impact on default usage. Signed-off-by: Thomas Garnier --- Based on next-20160422 --- arch/x86/mm/init_64.c

[no subject]

2016-04-25 Thread Thomas Garnier
This is PATCH v1 for KASLR memory implementation on x86_64. Minor changes were done based on RFC v1 comments. ***Background: The current implementation of KASLR randomizes only the base address of the kernel and its modules. Research was published showing that static memory can be overwitten to

[no subject]

2016-04-25 Thread Thomas Garnier
This is PATCH v1 for KASLR memory implementation on x86_64. Minor changes were done based on RFC v1 comments. ***Background: The current implementation of KASLR randomizes only the base address of the kernel and its modules. Research was published showing that static memory can be overwitten to

Re: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-21 Thread Thomas Garnier
Make sense, thanks for the details. On Thu, Apr 21, 2016 at 1:15 PM, H. Peter Anvin <h...@zytor.com> wrote: > On April 21, 2016 8:52:01 AM PDT, Thomas Garnier <thgar...@google.com> wrote: >>On Thu, Apr 21, 2016 at 8:46 AM, H. Peter Anvin <h...@zytor.com> wrote: >&

Re: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-21 Thread Thomas Garnier
Make sense, thanks for the details. On Thu, Apr 21, 2016 at 1:15 PM, H. Peter Anvin wrote: > On April 21, 2016 8:52:01 AM PDT, Thomas Garnier wrote: >>On Thu, Apr 21, 2016 at 8:46 AM, H. Peter Anvin wrote: >>> On April 21, 2016 6:30:24 AM PDT, Boris Ostrovsky >> wrote

Re: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-21 Thread Thomas Garnier
On Thu, Apr 21, 2016 at 8:46 AM, H. Peter Anvin <h...@zytor.com> wrote: > On April 21, 2016 6:30:24 AM PDT, Boris Ostrovsky > <boris.ostrov...@oracle.com> wrote: >> >> >>On 04/15/2016 06:03 PM, Thomas Garnier wrote: >>> +void __init kernel_ra

Re: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-21 Thread Thomas Garnier
On Thu, Apr 21, 2016 at 8:46 AM, H. Peter Anvin wrote: > On April 21, 2016 6:30:24 AM PDT, Boris Ostrovsky > wrote: >> >> >>On 04/15/2016 06:03 PM, Thomas Garnier wrote: >>> +void __init kernel_randomize_memory(void) >>> +{ >>> +size_t

Re: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-21 Thread Thomas Garnier
On Thu, Apr 21, 2016 at 6:30 AM, Boris Ostrovsky <boris.ostrov...@oracle.com> wrote: > > > On 04/15/2016 06:03 PM, Thomas Garnier wrote: >> >> +void __init kernel_randomize_memory(void) >> +{ >> + size_t i; >> + unsigned long addr = memory

Re: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-21 Thread Thomas Garnier
On Thu, Apr 21, 2016 at 6:30 AM, Boris Ostrovsky wrote: > > > On 04/15/2016 06:03 PM, Thomas Garnier wrote: >> >> +void __init kernel_randomize_memory(void) >> +{ >> + size_t i; >> + unsigned long addr = memory_rand_start; >>

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-20 Thread Thomas Garnier
On Wed, Apr 20, 2016 at 1:08 AM, Joonsoo Kim <iamjoonsoo@lge.com> wrote: > On Tue, Apr 19, 2016 at 09:44:54AM -0700, Thomas Garnier wrote: >> On Tue, Apr 19, 2016 at 12:15 AM, Joonsoo Kim <iamjoonsoo@lge.com> wrote: >> > On Mon, Apr 18, 2016 at 10:14:39

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-20 Thread Thomas Garnier
On Wed, Apr 20, 2016 at 1:08 AM, Joonsoo Kim wrote: > On Tue, Apr 19, 2016 at 09:44:54AM -0700, Thomas Garnier wrote: >> On Tue, Apr 19, 2016 at 12:15 AM, Joonsoo Kim wrote: >> > On Mon, Apr 18, 2016 at 10:14:39AM -0700, Thomas Garnier wrote: >> >&g

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-19 Thread Thomas Garnier
On Tue, Apr 19, 2016 at 12:15 AM, Joonsoo Kim <iamjoonsoo@lge.com> wrote: > On Mon, Apr 18, 2016 at 10:14:39AM -0700, Thomas Garnier wrote: >> Provides an optional config (CONFIG_FREELIST_RANDOM) to randomize the >> SLAB freelist. The list is randomized during initia

Re: [PATCH v2] mm: SLAB freelist randomization

2016-04-19 Thread Thomas Garnier
On Tue, Apr 19, 2016 at 12:15 AM, Joonsoo Kim wrote: > On Mon, Apr 18, 2016 at 10:14:39AM -0700, Thomas Garnier wrote: >> Provides an optional config (CONFIG_FREELIST_RANDOM) to randomize the >> SLAB freelist. The list is randomized during initialization of a new set >>

Re: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-19 Thread Thomas Garnier
On Tue, Apr 19, 2016 at 7:27 AM, Joerg Roedel <jroe...@suse.de> wrote: > Hi Thomas, > > On Fri, Apr 15, 2016 at 03:03:12PM -0700, Thomas Garnier wrote: >> +/* >> + * Create PGD aligned trampoline table to allow real mode initialization >> + * of additional CPUs. Co

Re: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)

2016-04-19 Thread Thomas Garnier
On Tue, Apr 19, 2016 at 7:27 AM, Joerg Roedel wrote: > Hi Thomas, > > On Fri, Apr 15, 2016 at 03:03:12PM -0700, Thomas Garnier wrote: >> +/* >> + * Create PGD aligned trampoline table to allow real mode initialization >> + * of additional CPUs. Consume only

<    3   4   5   6   7   8   9   >