[PATCH v5 24/27] x86/mm: Make the x86 GOT read-only

2018-06-25 Thread Thomas Garnier
The GOT is changed during early boot when relocations are applied. Make it read-only directly. This table exists only for PIE binary. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- include

[PATCH v5 24/27] x86/mm: Make the x86 GOT read-only

2018-06-25 Thread Thomas Garnier
The GOT is changed during early boot when relocations are applied. Make it read-only directly. This table exists only for PIE binary. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- include

[PATCH v5 27/27] x86/kaslr: Add option to extend KASLR range from 1GB to 3GB

2018-06-25 Thread Thomas Garnier
three PUD pages. The relocation table uses 64-bit integers generated with the updated relocation tool with the large-reloc option. Signed-off-by: Thomas Garnier --- arch/x86/Kconfig | 21 + arch/x86/boot/compressed/Makefile| 5 + arch/x86/boot

[PATCH v5 27/27] x86/kaslr: Add option to extend KASLR range from 1GB to 3GB

2018-06-25 Thread Thomas Garnier
three PUD pages. The relocation table uses 64-bit integers generated with the updated relocation tool with the large-reloc option. Signed-off-by: Thomas Garnier --- arch/x86/Kconfig | 21 + arch/x86/boot/compressed/Makefile| 5 + arch/x86/boot

[PATCH v5 25/27] x86/pie: Add option to build the kernel as PIE

2018-06-25 Thread Thomas Garnier
-0.1%) - PIE enabled: average -0.4% to +0.4%. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82303 Signed-off-by: Thomas Garnier merge pie --- arch/x86/Kconfig | 8 arch/x86/Makefile | 45 - 2 files changed, 52 insertions(+), 1 deletion

[PATCH v5 26/27] x86/relocs: Add option to generate 64-bit relocations

2018-06-25 Thread Thomas Garnier
the top 2G and 32-bit integers are not enough. Signed-off-by: Thomas Garnier --- arch/x86/tools/relocs.c| 60 +++--- arch/x86/tools/relocs.h| 4 +-- arch/x86/tools/relocs_common.c | 15 ++--- 3 files changed, 60 insertions(+), 19 deletions(-) diff

[PATCH v5 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-06-25 Thread Thomas Garnier
-bytes as before. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/ftrace.c | 51 +- scripts/recordmcount.c | 79 +++- 2

[PATCH v5 25/27] x86/pie: Add option to build the kernel as PIE

2018-06-25 Thread Thomas Garnier
-0.1%) - PIE enabled: average -0.4% to +0.4%. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82303 Signed-off-by: Thomas Garnier merge pie --- arch/x86/Kconfig | 8 arch/x86/Makefile | 45 - 2 files changed, 52 insertions(+), 1 deletion

[PATCH v5 26/27] x86/relocs: Add option to generate 64-bit relocations

2018-06-25 Thread Thomas Garnier
the top 2G and 32-bit integers are not enough. Signed-off-by: Thomas Garnier --- arch/x86/tools/relocs.c| 60 +++--- arch/x86/tools/relocs.h| 4 +-- arch/x86/tools/relocs_common.c | 15 ++--- 3 files changed, 60 insertions(+), 19 deletions(-) diff

[PATCH v5 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-06-25 Thread Thomas Garnier
-bytes as before. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/ftrace.c | 51 +- scripts/recordmcount.c | 79 +++- 2

[PATCH v5 20/27] x86: Support global stack cookie

2018-06-25 Thread Thomas Garnier
and the global variable stack cookie is used. If a specific stack mode was selected (regular or strong) and the compiler does not support selecting the segment register, an error is emitted. Signed-off-by: Thomas Garnier --- arch/x86/Kconfig | 12 arch/x86

[PATCH v5 20/27] x86: Support global stack cookie

2018-06-25 Thread Thomas Garnier
and the global variable stack cookie is used. If a specific stack mode was selected (regular or strong) and the compiler does not support selecting the segment register, an error is emitted. Signed-off-by: Thomas Garnier --- arch/x86/Kconfig | 12 arch/x86

[PATCH v5 16/27] compiler: Option to add PROVIDE_HIDDEN replacement for weak symbols

2018-06-25 Thread Thomas Garnier
Provide an option to have a PROVIDE_HIDDEN (linker script) entry for each weak symbol. This option solves an error in x86_64 where the linker optimizes PIE generated code to be non-PIE because --emit-relocs was used instead of -pie (to reduce dynamic relocations). Signed-off-by: Thomas Garnier

[PATCH v5 16/27] compiler: Option to add PROVIDE_HIDDEN replacement for weak symbols

2018-06-25 Thread Thomas Garnier
Provide an option to have a PROVIDE_HIDDEN (linker script) entry for each weak symbol. This option solves an error in x86_64 where the linker optimizes PIE generated code to be non-PIE because --emit-relocs was used instead of -pie (to reduce dynamic relocations). Signed-off-by: Thomas Garnier

[PATCH v5 19/27] kvm: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/kvm_host.h | 8 ++-- arch/x86/kernel/kvm.c | 6 -- arch/x86/kvm/svm.c | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b

[PATCH v5 19/27] kvm: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/kvm_host.h | 8 ++-- arch/x86/kernel/kvm.c | 6 -- arch/x86/kvm/svm.c | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b

[PATCH v5 15/27] compiler: Option to default to hidden symbols

2018-06-25 Thread Thomas Garnier
/end of sections). In this case, older versions of GCC will remove the comparison if the symbols are hidden. This issue exists at least on gcc 4.9 and before. Signed-off-by: Thomas Garnier --- arch/x86/boot/boot.h | 2 +- arch/x86/include/asm/setup.h | 2 +- arch/x86

[PATCH v5 15/27] compiler: Option to default to hidden symbols

2018-06-25 Thread Thomas Garnier
/end of sections). In this case, older versions of GCC will remove the comparison if the symbols are hidden. This issue exists at least on gcc 4.9 and before. Signed-off-by: Thomas Garnier --- arch/x86/boot/boot.h | 2 +- arch/x86/include/asm/setup.h | 2 +- arch/x86

[PATCH v5 13/27] x86/boot/64: Build head64.c as mcmodel large when PIE is enabled

2018-06-25 Thread Thomas Garnier
Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/Makefile | 6 ++ arch/x86/kernel/head64.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel

[PATCH v5 13/27] x86/boot/64: Build head64.c as mcmodel large when PIE is enabled

2018-06-25 Thread Thomas Garnier
Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/Makefile | 6 ++ arch/x86/kernel/head64.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel

[PATCH v5 06/27] x86/entry/64: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/entry/entry_64.S

[PATCH v5 12/27] x86/paravirt: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
if PIE is enabled, switch the paravirt assembly constraints to be compatible. The %c/i constrains generate smaller code so is kept by default. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier

[PATCH v5 06/27] x86/entry/64: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/entry/entry_64.S

[PATCH v5 12/27] x86/paravirt: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
if PIE is enabled, switch the paravirt assembly constraints to be compatible. The %c/i constrains generate smaller code so is kept by default. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier

[PATCH v5 10/27] x86/boot/64: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/head_64.S | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/head_64.S b/arch

[PATCH v5 09/27] x86/acpi: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier Acked-by: Pavel Machek Acked-by: Rafael J

[PATCH v5 10/27] x86/boot/64: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/head_64.S | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/head_64.S b/arch

[PATCH v5 09/27] x86/acpi: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier Acked-by: Pavel Machek Acked-by: Rafael J

[PATCH v5 04/27] x86: Add macro to get symbol address for PIE support

2018-06-25 Thread Thomas Garnier
Add a new _ASM_MOVABS macro to fetch a symbol address. It will be used to replace "_ASM_MOV $, %dst" code construct that are not compatible with PIE. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/asm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/a

[PATCH v5 04/27] x86: Add macro to get symbol address for PIE support

2018-06-25 Thread Thomas Garnier
Add a new _ASM_MOVABS macro to fetch a symbol address. It will be used to replace "_ASM_MOV $, %dst" code construct that are not compatible with PIE. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/asm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/a

Re: [PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-06-05 Thread Thomas Garnier
On Tue, Jun 5, 2018 at 9:56 AM Thomas Garnier wrote: > > On Mon, Jun 4, 2018 at 2:44 PM Steven Rostedt wrote: > > > > On Mon, 4 Jun 2018 14:06:03 -0700 > > Thomas Garnier wrote: > > > > > On Mon, Jun 4, 2018 at 1:16 PM Steven Rostedt wrote: > > &

Re: [PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-06-05 Thread Thomas Garnier
On Tue, Jun 5, 2018 at 9:56 AM Thomas Garnier wrote: > > On Mon, Jun 4, 2018 at 2:44 PM Steven Rostedt wrote: > > > > On Mon, 4 Jun 2018 14:06:03 -0700 > > Thomas Garnier wrote: > > > > > On Mon, Jun 4, 2018 at 1:16 PM Steven Rostedt wrote: > > &

Re: [PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-06-05 Thread Thomas Garnier
On Mon, Jun 4, 2018 at 2:44 PM Steven Rostedt wrote: > > On Mon, 4 Jun 2018 14:06:03 -0700 > Thomas Garnier wrote: > > > On Mon, Jun 4, 2018 at 1:16 PM Steven Rostedt wrote: > > > > > > On Tue, 29 May 2018 15:15:22 -0700 > > > Thomas Garni

Re: [PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-06-05 Thread Thomas Garnier
On Mon, Jun 4, 2018 at 2:44 PM Steven Rostedt wrote: > > On Mon, 4 Jun 2018 14:06:03 -0700 > Thomas Garnier wrote: > > > On Mon, Jun 4, 2018 at 1:16 PM Steven Rostedt wrote: > > > > > > On Tue, 29 May 2018 15:15:22 -0700 > > > Thomas Garni

Re: [PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-06-04 Thread Thomas Garnier
On Mon, Jun 4, 2018 at 1:16 PM Steven Rostedt wrote: > > On Tue, 29 May 2018 15:15:22 -0700 > Thomas Garnier wrote: > > > When using -fPIE/PIC with function tracing, the compiler generates a > > call through the GOT (call *__fentry__@GOTPCREL). This instruction > &

Re: [PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-06-04 Thread Thomas Garnier
On Mon, Jun 4, 2018 at 1:16 PM Steven Rostedt wrote: > > On Tue, 29 May 2018 15:15:22 -0700 > Thomas Garnier wrote: > > > When using -fPIE/PIC with function tracing, the compiler generates a > > call through the GOT (call *__fentry__@GOTPCREL). This instruction > &

[PATCH v4 04/27] x86: Add macro to get symbol address for PIE support

2018-05-29 Thread Thomas Garnier
Add a new _ASM_MOVABS macro to fetch a symbol address. It will be used to replace "_ASM_MOV $, %dst" code construct that are not compatible with PIE. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/asm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/a

[PATCH v4 04/27] x86: Add macro to get symbol address for PIE support

2018-05-29 Thread Thomas Garnier
Add a new _ASM_MOVABS macro to fetch a symbol address. It will be used to replace "_ASM_MOV $, %dst" code construct that are not compatible with PIE. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/asm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/a

[PATCH v4 01/27] x86/crypto: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/crypto/aes-x86_64-asm_64.S

[PATCH v4 01/27] x86/crypto: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/crypto/aes-x86_64-asm_64.S

[PATCH v4 05/27] x86: relocate_kernel - Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/relocate_kernel_64.S

[PATCH v4 05/27] x86: relocate_kernel - Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/relocate_kernel_64.S

[PATCH v4 03/27] x86: Use symbol name in jump table for PIE support

2018-05-29 Thread Thomas Garnier
Replace the %c constraint with %P. The %c is incompatible with PIE because it implies an immediate value whereas %P reference a symbol. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch

[PATCH v4 02/27] x86: Use symbol name on bug table for PIE support

2018-05-29 Thread Thomas Garnier
Replace the %c constraint with %P. The %c is incompatible with PIE because it implies an immediate value whereas %P reference a symbol. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch

[PATCH v4 03/27] x86: Use symbol name in jump table for PIE support

2018-05-29 Thread Thomas Garnier
Replace the %c constraint with %P. The %c is incompatible with PIE because it implies an immediate value whereas %P reference a symbol. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch

[PATCH v4 02/27] x86: Use symbol name on bug table for PIE support

2018-05-29 Thread Thomas Garnier
Replace the %c constraint with %P. The %c is incompatible with PIE because it implies an immediate value whereas %P reference a symbol. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch

[PATCH v4 10/27] x86/boot/64: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/head_64.S | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/head_64.S b/arch

[PATCH v4 10/27] x86/boot/64: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/head_64.S | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/head_64.S b/arch

[PATCH v4 07/27] x86: pm-trace - Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change assembly to use the new _ASM_MOVABS macro instead of _ASM_MOV for the assembly to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/pm-trace.h | 2

[PATCH v4 07/27] x86: pm-trace - Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change assembly to use the new _ASM_MOVABS macro instead of _ASM_MOV for the assembly to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/pm-trace.h | 2

[PATCH v4 13/27] x86/boot/64: Build head64.c as mcmodel large when PIE is enabled

2018-05-29 Thread Thomas Garnier
Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/Makefile | 6 ++ arch/x86/kernel/head64.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel

[PATCH v4 08/27] x86/CPU: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/processor.h | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index e28add6b791f..7ae9fb91f7b5 100644 --- a/arch/x86/include/asm/processor.h +++ b

[PATCH v4 08/27] x86/CPU: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/processor.h | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index e28add6b791f..7ae9fb91f7b5 100644 --- a/arch/x86/include/asm/processor.h +++ b

[PATCH v4 13/27] x86/boot/64: Build head64.c as mcmodel large when PIE is enabled

2018-05-29 Thread Thomas Garnier
Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/kernel/Makefile | 6 ++ arch/x86/kernel/head64.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel

[PATCH v4 11/27] x86/power/64: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier Acked-by: Pavel Machek --- arch/x86/power

[PATCH v4 11/27] x86/power/64: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier Acked-by: Pavel Machek --- arch/x86/power

[PATCH v4 17/27] x86/relocs: Handle PIE relocations

2018-05-29 Thread Thomas Garnier
Change the relocation tool to correctly handle relocations generated by -fPIE option: - Add relocation for each entry of the .got section given the linker does not generate R_X86_64_GLOB_DAT on a simple link. - Ignore R_X86_64_GOTPCREL. Signed-off-by: Thomas Garnier --- arch/x86/tools

[PATCH v4 17/27] x86/relocs: Handle PIE relocations

2018-05-29 Thread Thomas Garnier
Change the relocation tool to correctly handle relocations generated by -fPIE option: - Add relocation for each entry of the .got section given the linker does not generate R_X86_64_GLOB_DAT on a simple link. - Ignore R_X86_64_GOTPCREL. Signed-off-by: Thomas Garnier --- arch/x86/tools

[PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-05-29 Thread Thomas Garnier
5-bytes as before. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/ftrace.h | 4 -- arch/x86/include/asm/sections.h | 4 ++ arch/x86/kernel/ftrace.c| 42

[PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-05-29 Thread Thomas Garnier
5-bytes as before. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/ftrace.h | 4 -- arch/x86/include/asm/sections.h | 4 ++ arch/x86/kernel/ftrace.c| 42

[PATCH v4 23/27] x86/modules: Adapt module loading for PIE support

2018-05-29 Thread Thomas Garnier
Adapt module loading to support PIE relocations. Generate dynamic GOT if a symbol requires it but no entry exists in the kernel GOT. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86

[PATCH v4 22/27] x86/modules: Add option to start module section after kernel

2018-05-29 Thread Thomas Garnier
randomization range. Signed-off-by: Thomas Garnier --- Documentation/x86/x86_64/mm.txt | 3 +++ arch/x86/Kconfig| 4 arch/x86/include/asm/pgtable_64_types.h | 6 ++ arch/x86/kernel/head64.c| 5 - arch/x86/mm/dump_pagetables.c | 3

[PATCH v4 23/27] x86/modules: Adapt module loading for PIE support

2018-05-29 Thread Thomas Garnier
Adapt module loading to support PIE relocations. Generate dynamic GOT if a symbol requires it but no entry exists in the kernel GOT. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86

[PATCH v4 22/27] x86/modules: Add option to start module section after kernel

2018-05-29 Thread Thomas Garnier
randomization range. Signed-off-by: Thomas Garnier --- Documentation/x86/x86_64/mm.txt | 3 +++ arch/x86/Kconfig| 4 arch/x86/include/asm/pgtable_64_types.h | 6 ++ arch/x86/kernel/head64.c| 5 - arch/x86/mm/dump_pagetables.c | 3

[PATCH v4 20/27] x86: Support global stack cookie

2018-05-29 Thread Thomas Garnier
and the global variable stack cookie is used. If a specific stack mode was selected (regular or strong) and the compiler does not support selecting the segment register, an error is emitted. Signed-off-by: Thomas Garnier --- arch/x86/Kconfig | 12 arch/x86

[PATCH v4 20/27] x86: Support global stack cookie

2018-05-29 Thread Thomas Garnier
and the global variable stack cookie is used. If a specific stack mode was selected (regular or strong) and the compiler does not support selecting the segment register, an error is emitted. Signed-off-by: Thomas Garnier --- arch/x86/Kconfig | 12 arch/x86

[PATCH v4 26/27] x86/relocs: Add option to generate 64-bit relocations

2018-05-29 Thread Thomas Garnier
the top 2G and 32-bit integers are not enough. Signed-off-by: Thomas Garnier --- arch/x86/tools/relocs.c| 60 +++--- arch/x86/tools/relocs.h| 4 +-- arch/x86/tools/relocs_common.c | 15 ++--- 3 files changed, 60 insertions(+), 19 deletions(-) diff

[PATCH v4 24/27] x86/mm: Make the x86 GOT read-only

2018-05-29 Thread Thomas Garnier
The GOT is changed during early boot when relocations are applied. Make it read-only directly. This table exists only for PIE binary. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- include

[PATCH v4 26/27] x86/relocs: Add option to generate 64-bit relocations

2018-05-29 Thread Thomas Garnier
the top 2G and 32-bit integers are not enough. Signed-off-by: Thomas Garnier --- arch/x86/tools/relocs.c| 60 +++--- arch/x86/tools/relocs.h| 4 +-- arch/x86/tools/relocs_common.c | 15 ++--- 3 files changed, 60 insertions(+), 19 deletions(-) diff

[PATCH v4 24/27] x86/mm: Make the x86 GOT read-only

2018-05-29 Thread Thomas Garnier
The GOT is changed during early boot when relocations are applied. Make it read-only directly. This table exists only for PIE binary. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- include

[PATCH v4 25/27] x86/pie: Add option to build the kernel as PIE

2018-05-29 Thread Thomas Garnier
-0.1%) - PIE enabled: average -0.4% to +0.4%. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82303 Signed-off-by: Thomas Garnier merge pie --- arch/x86/Kconfig | 8 arch/x86/Makefile | 45 - 2 files changed, 52 insertions(+), 1 deletion

[PATCH v4 27/27] x86/kaslr: Add option to extend KASLR range from 1GB to 3GB

2018-05-29 Thread Thomas Garnier
three PUD pages. The relocation table uses 64-bit integers generated with the updated relocation tool with the large-reloc option. Signed-off-by: Thomas Garnier --- arch/x86/Kconfig | 21 + arch/x86/boot/compressed/Makefile| 5 + arch/x86/boot

[PATCH v4 19/27] kvm: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/kvm_host.h | 8 ++-- arch/x86/kernel/kvm.c | 6 -- arch/x86/kvm/svm.c | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b

[PATCH v4 25/27] x86/pie: Add option to build the kernel as PIE

2018-05-29 Thread Thomas Garnier
-0.1%) - PIE enabled: average -0.4% to +0.4%. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82303 Signed-off-by: Thomas Garnier merge pie --- arch/x86/Kconfig | 8 arch/x86/Makefile | 45 - 2 files changed, 52 insertions(+), 1 deletion

[PATCH v4 27/27] x86/kaslr: Add option to extend KASLR range from 1GB to 3GB

2018-05-29 Thread Thomas Garnier
three PUD pages. The relocation table uses 64-bit integers generated with the updated relocation tool with the large-reloc option. Signed-off-by: Thomas Garnier --- arch/x86/Kconfig | 21 + arch/x86/boot/compressed/Makefile| 5 + arch/x86/boot

[PATCH v4 19/27] kvm: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/kvm_host.h | 8 ++-- arch/x86/kernel/kvm.c | 6 -- arch/x86/kvm/svm.c | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b

[PATCH v4 16/27] compiler: Option to add PROVIDE_HIDDEN replacement for weak symbols

2018-05-29 Thread Thomas Garnier
Provide an option to have a PROVIDE_HIDDEN (linker script) entry for each weak symbol. This option solves an error in x86_64 where the linker optimizes PIE generated code to be non-PIE because --emit-relocs was used instead of -pie (to reduce dynamic relocations). Signed-off-by: Thomas Garnier

[PATCH v4 15/27] compiler: Option to default to hidden symbols

2018-05-29 Thread Thomas Garnier
/end of sections). In this case, older versions of GCC will remove the comparison if the symbols are hidden. This issue exists at least on gcc 4.9 and before. Signed-off-by: Thomas Garnier --- arch/x86/boot/boot.h | 2 +- arch/x86/include/asm/setup.h | 2 +- arch/x86

[PATCH v4 14/27] x86/percpu: Adapt percpu for PIE support

2018-05-29 Thread Thomas Garnier
Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/entry/calling.h | 2 +- arch/x86/entry/entry_64.S| 4 ++-- arch/x86/include/asm/percpu.h| 25 +++-- arch/x86/include/asm

[PATCH v4 16/27] compiler: Option to add PROVIDE_HIDDEN replacement for weak symbols

2018-05-29 Thread Thomas Garnier
Provide an option to have a PROVIDE_HIDDEN (linker script) entry for each weak symbol. This option solves an error in x86_64 where the linker optimizes PIE generated code to be non-PIE because --emit-relocs was used instead of -pie (to reduce dynamic relocations). Signed-off-by: Thomas Garnier

[PATCH v4 15/27] compiler: Option to default to hidden symbols

2018-05-29 Thread Thomas Garnier
/end of sections). In this case, older versions of GCC will remove the comparison if the symbols are hidden. This issue exists at least on gcc 4.9 and before. Signed-off-by: Thomas Garnier --- arch/x86/boot/boot.h | 2 +- arch/x86/include/asm/setup.h | 2 +- arch/x86

[PATCH v4 14/27] x86/percpu: Adapt percpu for PIE support

2018-05-29 Thread Thomas Garnier
Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/entry/calling.h | 2 +- arch/x86/entry/entry_64.S| 4 ++-- arch/x86/include/asm/percpu.h| 25 +++-- arch/x86/include/asm

[PATCH v4 09/27] x86/acpi: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier Acked-by: Pavel Machek --- arch/x86

[PATCH v4 06/27] x86/entry/64: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/entry/entry_64.S

[PATCH v4 09/27] x86/acpi: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier Acked-by: Pavel Machek --- arch/x86

[PATCH v4 06/27] x86/entry/64: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range 0x8000. Signed-off-by: Thomas Garnier --- arch/x86/entry/entry_64.S

Re: repeatable boot randomness inside KVM guest

2018-04-16 Thread Thomas Garnier
using prandom_* > > functions in slab.c and slubct and slab_common.c, and just use a > > really random number generator, if the goal is real security as > > opposed to security for show The state is seeded with get_random_long() which will use RDRAND and any available entro

Re: repeatable boot randomness inside KVM guest

2018-04-16 Thread Thomas Garnier
slubct and slab_common.c, and just use a > > really random number generator, if the goal is real security as > > opposed to security for show The state is seeded with get_random_long() which will use RDRAND and any available entropy at this point. I am not sure the value of call

Re: [PATCH] ARM: uaccess: Add missing include for set_thread_flag

2017-09-20 Thread Thomas Garnier
r of a different approach on linux-next (see commit 2404269bc4e77a67875c8db6667be34c9913c96e). Let me know if this commit resolve the issue and thanks for reaching out. > > Regards, > Jonathan > > On 20 September 2017 at 00:32, Thomas Garnier <thgar...@google.com> wrote: > > On T

Re: [PATCH] ARM: uaccess: Add missing include for set_thread_flag

2017-09-20 Thread Thomas Garnier
different approach on linux-next (see commit 2404269bc4e77a67875c8db6667be34c9913c96e). Let me know if this commit resolve the issue and thanks for reaching out. > > Regards, > Jonathan > > On 20 September 2017 at 00:32, Thomas Garnier wrote: > > On Tue, Sep 19, 2017 at 4:50 AM, Jonathan Liu wrote: &

Re: [PATCH] ARM: uaccess: Add missing include for set_thread_flag

2017-09-19 Thread Thomas Garnier
On Tue, Sep 19, 2017 at 4:50 AM, Jonathan Liu wrote: > Fixes "implicit declaration of function" compile error for out-of-tree > kernel modules including asm/uaccess.h. I failed to reproduce this issue by creating an out of tree module with a separate file (with only uaccess.h).

Re: [PATCH] ARM: uaccess: Add missing include for set_thread_flag

2017-09-19 Thread Thomas Garnier
On Tue, Sep 19, 2017 at 4:50 AM, Jonathan Liu wrote: > Fixes "implicit declaration of function" compile error for out-of-tree > kernel modules including asm/uaccess.h. I failed to reproduce this issue by creating an out of tree module with a separate file (with only uaccess.h). Are you using a

[tip:core/urgent] arm64/syscalls: Move address limit check in loop

2017-09-17 Thread tip-bot for Thomas Garnier
Commit-ID: a2048e34d4655c06d31400646ae495bbfeb16b27 Gitweb: http://git.kernel.org/tip/a2048e34d4655c06d31400646ae495bbfeb16b27 Author: Thomas Garnier <thgar...@google.com> AuthorDate: Thu, 7 Sep 2017 08:30:47 -0700 Committer: Thomas Gleixner <t...@linutronix.de> CommitDate:

[tip:core/urgent] arm64/syscalls: Move address limit check in loop

2017-09-17 Thread tip-bot for Thomas Garnier
Commit-ID: a2048e34d4655c06d31400646ae495bbfeb16b27 Gitweb: http://git.kernel.org/tip/a2048e34d4655c06d31400646ae495bbfeb16b27 Author: Thomas Garnier AuthorDate: Thu, 7 Sep 2017 08:30:47 -0700 Committer: Thomas Gleixner CommitDate: Sun, 17 Sep 2017 19:45:33 +0200 arm64/syscalls: Move

[tip:core/urgent] arm/syscalls: Optimize address limit check

2017-09-17 Thread tip-bot for Thomas Garnier
Commit-ID: e33f8d32677fa4f4f8996ef46748f86aac81ccff Gitweb: http://git.kernel.org/tip/e33f8d32677fa4f4f8996ef46748f86aac81ccff Author: Thomas Garnier <thgar...@google.com> AuthorDate: Thu, 7 Sep 2017 08:30:46 -0700 Committer: Thomas Gleixner <t...@linutronix.de> CommitDate:

[tip:core/urgent] arm/syscalls: Optimize address limit check

2017-09-17 Thread tip-bot for Thomas Garnier
Commit-ID: e33f8d32677fa4f4f8996ef46748f86aac81ccff Gitweb: http://git.kernel.org/tip/e33f8d32677fa4f4f8996ef46748f86aac81ccff Author: Thomas Garnier AuthorDate: Thu, 7 Sep 2017 08:30:46 -0700 Committer: Thomas Gleixner CommitDate: Sun, 17 Sep 2017 19:45:33 +0200 arm/syscalls

[tip:core/urgent] Revert "arm/syscalls: Check address limit on user-mode return"

2017-09-17 Thread tip-bot for Thomas Garnier
Commit-ID: 2404269bc4e77a67875c8db6667be34c9913c96e Gitweb: http://git.kernel.org/tip/2404269bc4e77a67875c8db6667be34c9913c96e Author: Thomas Garnier <thgar...@google.com> AuthorDate: Thu, 7 Sep 2017 08:30:45 -0700 Committer: Thomas Gleixner <t...@linutronix.de> CommitDate:

[tip:core/urgent] Revert "arm/syscalls: Check address limit on user-mode return"

2017-09-17 Thread tip-bot for Thomas Garnier
Commit-ID: 2404269bc4e77a67875c8db6667be34c9913c96e Gitweb: http://git.kernel.org/tip/2404269bc4e77a67875c8db6667be34c9913c96e Author: Thomas Garnier AuthorDate: Thu, 7 Sep 2017 08:30:45 -0700 Committer: Thomas Gleixner CommitDate: Sun, 17 Sep 2017 19:45:33 +0200 Revert "arm/sys

[tip:core/urgent] syscalls: Use CHECK_DATA_CORRUPTION for addr_limit_user_check

2017-09-17 Thread tip-bot for Thomas Garnier
Commit-ID: bf29ed1567b67854dc13504f685c45a2ea9b2081 Gitweb: http://git.kernel.org/tip/bf29ed1567b67854dc13504f685c45a2ea9b2081 Author: Thomas Garnier <thgar...@google.com> AuthorDate: Thu, 7 Sep 2017 08:30:44 -0700 Committer: Thomas Gleixner <t...@linutronix.de> CommitDate:

[tip:core/urgent] syscalls: Use CHECK_DATA_CORRUPTION for addr_limit_user_check

2017-09-17 Thread tip-bot for Thomas Garnier
Commit-ID: bf29ed1567b67854dc13504f685c45a2ea9b2081 Gitweb: http://git.kernel.org/tip/bf29ed1567b67854dc13504f685c45a2ea9b2081 Author: Thomas Garnier AuthorDate: Thu, 7 Sep 2017 08:30:44 -0700 Committer: Thomas Gleixner CommitDate: Sun, 17 Sep 2017 19:45:32 +0200 syscalls: Use

<    1   2   3   4   5   6   7   8   9   >