Re: [Xen-devel] [PATCH v6 14/27] x86/percpu: Adapt percpu for PIE support

2019-04-08 Thread Thomas Garnier
On Mon, Apr 8, 2019 at 10:56 AM Christopher Lameter wrote: > > On Mon, 8 Apr 2019, Thomas Garnier wrote: > > > > It didn't work originally but I will revisit to see if I missed something. > > > > I revisited and couldn't find a way to prevent relocations to the &

Re: [Xen-devel] [PATCH v6 14/27] x86/percpu: Adapt percpu for PIE support

2019-04-08 Thread Thomas Garnier
On Fri, Feb 1, 2019 at 9:13 AM Thomas Garnier wrote: > > On Thu, Jan 31, 2019 at 6:31 PM Christopher Lameter wrote: > > > > On Thu, 31 Jan 2019, Thomas Garnier wrote: > > > > > The per-cpu symbols are in a section that is zero based to create > > &

Re: [Xen-devel] [PATCH v6 14/27] x86/percpu: Adapt percpu for PIE support

2019-02-01 Thread Thomas Garnier
On Thu, Jan 31, 2019 at 6:31 PM Christopher Lameter wrote: > > On Thu, 31 Jan 2019, Thomas Garnier wrote: > > > The per-cpu symbols are in a section that is zero based to create > > offsets. The compiler doesn't see them as offsets but as relative > > symbol and

Re: [Xen-devel] [PATCH v6 00/27] x86: PIE support and option to extend KASLR randomization

2019-01-31 Thread Thomas Garnier
On Thu, Jan 31, 2019 at 1:41 PM Konrad Rzeszutek Wilk wrote: > > On Thu, Jan 31, 2019 at 11:24:07AM -0800, Thomas Garnier wrote: > > There has been no major concern in the latest iterations. I am interested on > > what would be the best way to slowly integrate this patchset

Re: [Xen-devel] [PATCH v6 14/27] x86/percpu: Adapt percpu for PIE support

2019-01-31 Thread Thomas Garnier
On Thu, Jan 31, 2019 at 12:57 PM Christopher Lameter wrote: > > On Thu, 31 Jan 2019, Thomas Garnier wrote: > > > Perpcu uses a clever design where the .percu ELF section has a virtual > > address of zero and the custom linux relocation code avoid relocating > > specific

[Xen-devel] [PATCH v6 00/27] x86: PIE support and option to extend KASLR randomization

2019-01-31 Thread Thomas Garnier
There has been no major concern in the latest iterations. I am interested on what would be the best way to slowly integrate this patchset upstream. Changes: - patch v6: - Rebase on latest changes in jump tables and crypto. - Fix wording on couple commits. - Revisit checkpatch warnings.

[Xen-devel] [PATCH v6 18/27] xen: Adapt assembly for PIE support

2019-01-31 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier Reviewed-by: Juergen Gross --- arch/x86/platform/pvh/head.S | 14 ++ arch/x86/tools/relocs.c | 16 +++- arch/x86/xen/xen-head.S | 11 ++- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/arch/x86/platform/pvh

[Xen-devel] [PATCH v6 14/27] x86/percpu: Adapt percpu for PIE support

2019-01-31 Thread Thomas Garnier
Independent Executable (PIE) support will allow to extend the KASLR randomization range below 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

[Xen-devel] [PATCH v5 14/27] x86/percpu: Adapt percpu for PIE support

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/entry/calling.h | 2 +- arch/x86/entry/entry_64.S| 4 ++-- arch/x86/include/asm/percpu.h| 25 +++-- arch/x86

[Xen-devel] [PATCH v5 18/27] xen: Adapt assembly for PIE support

2018-06-25 Thread Thomas Garnier
-by: Thomas Garnier Reviewed-by: Juergen Gross --- arch/x86/tools/relocs.c | 16 +++- arch/x86/xen/xen-head.S | 11 ++- arch/x86/xen/xen-pvh.S | 14 ++ 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools

[Xen-devel] [PATCH v5 00/27] x86: PIE support and option to extend KASLR randomization

2018-06-25 Thread Thomas Garnier
Changes: - patch v5: - Adapt new crypto modules for PIE. - Improve per-cpu commit message. - Fix xen 32-bit build error with .quad. - Remove extra code for ftrace. - patch v4: - Simplify early boot by removing global variables. - Modify the mcount location script for

Re: [Xen-devel] [PATCH v4 18/27] xen: Adapt assembly for PIE support

2018-06-01 Thread Thomas Garnier
On Fri, Jun 1, 2018 at 8:40 AM Boris Ostrovsky wrote: > > On 05/29/2018 06:15 PM, Thomas Garnier wrote: > > diff --git a/arch/x86/xen/xen-pvh.S b/arch/x86/xen/xen-pvh.S > > index ca2d3b2bf2af..82ba89ba8bb3 100644 > > --- a/arch/x86/xen/xen-pvh.S > > +++ b/arch/x

[Xen-devel] [PATCH v4 18/27] xen: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
-by: Thomas Garnier Reviewed-by: Juergen Gross --- arch/x86/tools/relocs.c | 16 +++- arch/x86/xen/xen-head.S | 11 ++- arch/x86/xen/xen-pvh.S | 13 + 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c

[Xen-devel] [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

[Xen-devel] [PATCH v4 00/27] x86: PIE support and option to extend KASLR randomization

2018-05-29 Thread Thomas Garnier
Changes: - patch v4: - Simplify early boot by removing global variables. - Modify the mcount location script for __mcount_loc intead of the address read in the ftrace implementation. - Edit commit description to explain better where the kernel can be located. - Streamlined the

Re: [Xen-devel] [PATCH v3 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-05-29 Thread Thomas Garnier
On Thu, May 24, 2018 at 1:41 PM Thomas Garnier wrote: > On Thu, May 24, 2018 at 1:16 PM Steven Rostedt wrote: > > On Thu, 24 May 2018 13:40:24 +0200 > > Petr Mladek wrote: > > > On Wed 2018-05-23 12:54:15, Thomas Garnier wrote: > > > > When u

Re: [Xen-devel] [PATCH v3 09/27] x86/acpi: Adapt assembly for PIE support

2018-05-29 Thread Thomas Garnier
On Tue, May 29, 2018 at 5:31 AM Pavel Machek wrote: > On Fri 2018-05-25 10:00:04, Thomas Garnier wrote: > > On Fri, May 25, 2018 at 2:14 AM Pavel Machek wrote: > > > > > On Thu 2018-05-24 09:35:42, Thomas Garnier wrote: > > > > On Thu, May 24,

Re: [Xen-devel] [PATCH v3 09/27] x86/acpi: Adapt assembly for PIE support

2018-05-25 Thread Thomas Garnier
On Fri, May 25, 2018 at 2:14 AM Pavel Machek <pa...@ucw.cz> wrote: > On Thu 2018-05-24 09:35:42, Thomas Garnier wrote: > > On Thu, May 24, 2018 at 4:03 AM Pavel Machek <pa...@ucw.cz> wrote: > > > > > On Wed 2018-05-23 12:54:03, Thomas Garnier wrote: > >

Re: [Xen-devel] [PATCH v3 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-05-24 Thread Thomas Garnier
On Thu, May 24, 2018 at 1:16 PM Steven Rostedt <rost...@goodmis.org> wrote: > On Thu, 24 May 2018 13:40:24 +0200 > Petr Mladek <pmla...@suse.com> wrote: > > On Wed 2018-05-23 12:54:15, Thomas Garnier wrote: > > > When using -fPIE/PIC with function tracing, th

Re: [Xen-devel] [PATCH v3 11/27] x86/power/64: Adapt assembly for PIE support

2018-05-24 Thread Thomas Garnier
On Thu, May 24, 2018 at 4:04 AM Pavel Machek <pa...@ucw.cz> wrote: > On Wed 2018-05-23 12:54:05, Thomas Garnier wrote: > > Change the assembly code to use only relative references of symbols for the > > kernel to be PIE compatible. > > > > Position Independent Ex

Re: [Xen-devel] [PATCH v3 09/27] x86/acpi: Adapt assembly for PIE support

2018-05-24 Thread Thomas Garnier
On Thu, May 24, 2018 at 4:03 AM Pavel Machek <pa...@ucw.cz> wrote: > On Wed 2018-05-23 12:54:03, Thomas Garnier wrote: > > Change the assembly code to use only relative references of symbols for the > > kernel to be PIE compatible. > > > > Position Independent Ex

Re: [Xen-devel] [PATCH v3 23/27] x86/modules: Adapt module loading for PIE support

2018-05-23 Thread Thomas Garnier
On Wed, May 23, 2018 at 2:27 PM Randy Dunlap <rdun...@infradead.org> wrote: > Hi, > (for several patches in this series:) > The commit message is confusing. See below. Thanks for the edits, I will change the different commit messages. > On 05/23/2018 12:54 PM, Th

[Xen-devel] [PATCH v3 22/27] x86/modules: Add option to start module section after kernel

2018-05-23 Thread Thomas Garnier
randomization range. Signed-off-by: Thomas Garnier <thgar...@google.com> --- 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/

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

2018-05-23 Thread Thomas Garnier
the top 2G and 32-bit integers are not enough. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/tools/relocs.c| 60 +++--- arch/x86/tools/relocs.h| 4 +-- arch/x86/tools/relocs_common.c | 15 ++--- 3 files changed, 60 insertions(

[Xen-devel] [PATCH v3 17/27] x86/relocs: Handle PIE relocations

2018-05-23 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 <thgar...@google.

[Xen-devel] [PATCH v3 25/27] x86/pie: Add option to build the kernel as PIE

2018-05-23 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 <thgar...@google.com> merge pie --- arch/x86/Kconfig | 8 arch/x86/Makefile | 45 - 2 files chang

[Xen-devel] [PATCH v3 15/27] compiler: Option to default to hidden symbols

2018-05-23 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 <thgar...@google.com> --- arch/x86/boot/boot.h | 2 +- arch/x86/include/asm/s

[Xen-devel] [PATCH v3 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-05-23 Thread Thomas Garnier
5-bytes as before. Position Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/include/asm/ftrace.h | 6 +++-- arch/x86/include/asm/sections.h | 4 ar

[Xen-devel] [PATCH v3 18/27] xen: Adapt assembly for PIE support

2018-05-23 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/tools/relocs.c | 16 +++- arch/x86/xen/xen-head.S | 11 ++- arch/x86/xen/xen-pvh.S | 13 + 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/arch/x86/tools/relocs.c b/arch/x86

[Xen-devel] [PATCH v3 23/27] x86/modules: Adapt module loading for PIE support

2018-05-23 Thread Thomas Garnier
Adapt module loading to support PIE relocations. Generate dynamic GOT if a symbol requires it but no entry exist in the kernel GOT. Position Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <th

[Xen-devel] [PATCH v3 27/27] x86/kaslr: Add option to extend KASLR range from 1GB to 3GB

2018-05-23 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 <thgar...@google.com> --- arch/x86/Kconfig | 21 + arch/x86/boot/compressed/Makefile

[Xen-devel] [PATCH v3 20/27] x86: Support global stack cookie

2018-05-23 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 <thgar...@google.com> --- arch/x86/Kconfig

[Xen-devel] [PATCH v3 01/27] x86/crypto: Adapt assembly for PIE support

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v3 24/27] x86/mm: Make the x86 GOT read-only

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier

[Xen-devel] [PATCH v3 16/27] compiler: Option to add PROVIDE_HIDDEN replacement for weak symbols

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

[Xen-devel] [PATCH v3 12/27] x86/paravirt: Adapt assembly for PIE support

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas

[Xen-devel] [PATCH v3 06/27] x86/entry/64: Adapt assembly for PIE support

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v3 09/27] x86/acpi: Adapt assembly for PIE support

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

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

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v3 19/27] kvm: Adapt assembly for PIE support

2018-05-23 Thread Thomas Garnier
randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- 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

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

2018-05-23 Thread Thomas Garnier
Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/kernel/Makefile | 6 ++ arch/x86/kernel/head64.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ar

[Xen-devel] [PATCH v3 08/27] x86/CPU: Adapt assembly for PIE support

2018-05-23 Thread Thomas Garnier
memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- 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 c119d423eacb..81ae6877df29 100644 ---

[Xen-devel] [PATCH v3 02/27] x86: Use symbol name on bug table for PIE support

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier

[Xen-devel] [PATCH v3 11/27] x86/power/64: Adapt assembly for PIE support

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v3 05/27] x86: relocate_kernel - Adapt assembly for PIE support

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v3 10/27] x86/boot/64: Adapt assembly for PIE support

2018-05-23 Thread Thomas Garnier
as expected. Position Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/kernel/head_64.S | 26 -- 1 file changed, 20 insertions

[Xen-devel] [PATCH v3 04/27] x86: Add macro to get symbol address for PIE support

2018-05-23 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 <thgar...@google.com> --- arch/x86/include/asm/asm.h | 1 + 1 file changed, 1 insertion(+) diff

[Xen-devel] [PATCH v3 03/27] x86: Use symbol name in jump table for PIE support

2018-05-23 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier

[Xen-devel] [PATCH v3 00/27] x86: PIE support and option to extend KASLR randomization

2018-05-23 Thread Thomas Garnier
Changes: - patch v3: - Update on message to describe longer term PIE goal. - Minor change on ftrace if condition. - Changed code using xchgq. - patch v2: - Adapt patch to work post KPTI and compiler changes - Redo all performance testing with latest configs and compilers -

Re: [Xen-devel] [PATCH v2 06/27] x86/entry/64: Adapt assembly for PIE support

2018-03-14 Thread Thomas Garnier
On Wed, Mar 14, 2018 at 8:55 AM Christopher Lameter <c...@linux.com> wrote: > On Wed, 14 Mar 2018, Peter Zijlstra wrote: > > On Tue, Mar 13, 2018 at 01:59:24PM -0700, Thomas Garnier wrote: > > > @@ -1576,7 +1578,9 @@ first_nmi: > > > addq

[Xen-devel] [PATCH v2 19/27] kvm: Adapt assembly for PIE support

2018-03-13 Thread Thomas Garnier
randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/include/asm/kvm_host.h | 6 -- arch/x86/kernel/kvm.c | 6 -- arch/x86/kvm/svm.c | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git

[Xen-devel] [PATCH v2 20/27] x86: Support global stack cookie

2018-03-13 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 <thgar...@google.com> --- arch/x86/Kconfig

[Xen-devel] [PATCH v2 24/27] x86/mm: Make the x86 GOT read-only

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier

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

2018-03-13 Thread Thomas Garnier
the top 2G and 32-bit integers are not enough. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/tools/relocs.c| 60 +++--- arch/x86/tools/relocs.h| 4 +-- arch/x86/tools/relocs_common.c | 15 ++--- 3 files changed, 60 insertions(

[Xen-devel] [PATCH v2 18/27] xen: Adapt assembly for PIE support

2018-03-13 Thread Thomas Garnier
. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/tools/relocs.c | 16 +++- arch/x86/xen/xen-head.S | 11 ++- arch/x86/xen/xen-pvh.S | 13 + 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/arch/x86/tools/relocs.c b/arch/x86

[Xen-devel] [PATCH v2 27/27] x86/kaslr: Add option to extend KASLR range from 1GB to 3GB

2018-03-13 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 <thgar...@google.com> --- arch/x86/Kconfig | 21 + arch/x86/boot/compressed/Makefile

[Xen-devel] [PATCH v2 25/27] x86/pie: Add option to build the kernel as PIE

2018-03-13 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 <thgar...@google.com> merge pie --- arch/x86/Kconfig | 8 arch/x86/Makefile | 45 - 2 files chang

[Xen-devel] [PATCH v2 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-03-13 Thread Thomas Garnier
5-bytes as before. Position Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/include/asm/ftrace.h | 6 +++-- arch/x86/include/asm/sections.h | 4 ar

[Xen-devel] [PATCH v2 22/27] x86/modules: Add option to start module section after kernel

2018-03-13 Thread Thomas Garnier
randomization range. Signed-off-by: Thomas Garnier <thgar...@google.com> --- 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/

[Xen-devel] [PATCH v2 11/27] x86/power/64: Adapt assembly for PIE support

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

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

2018-03-13 Thread Thomas Garnier
Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/kernel/Makefile | 6 ++ arch/x86/kernel/head64.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ar

[Xen-devel] [PATCH v2 17/27] x86/relocs: Handle PIE relocations

2018-03-13 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 <thgar...@google.

[Xen-devel] [PATCH v2 10/27] x86/boot/64: Adapt assembly for PIE support

2018-03-13 Thread Thomas Garnier
as expected. Position Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> --- arch/x86/kernel/head_64.S | 26 -- 1 file changed, 20 insertions

[Xen-devel] [PATCH v2 09/27] x86/acpi: Adapt assembly for PIE support

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v2 12/27] x86/paravirt: Adapt assembly for PIE support

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas

[Xen-devel] [PATCH v2 06/27] x86/entry/64: Adapt assembly for PIE support

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v2 03/27] x86: Use symbol name in jump table for PIE support

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier

[Xen-devel] [PATCH v2 16/27] compiler: Option to add PROVIDE_HIDDEN replacement for weak symbols

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

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

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v2 15/27] compiler: Option to default to hidden symbols

2018-03-13 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 <thgar...@google.com> --- arch/x86/boot/boot.h | 2 +- arch/x86/include/asm/s

[Xen-devel] [PATCH v2 05/27] x86: relocate_kernel - Adapt assembly for PIE support

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v2 01/27] x86/crypto: Adapt assembly for PIE support

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier <thgar...@google.com> ---

[Xen-devel] [PATCH v2 00/27] x86: PIE support and option to extend KASLR randomization

2018-03-13 Thread Thomas Garnier
Changes: - patch v2: - Adapt patch to work post KPTI and compiler changes - Redo all performance testing with latest configs and compilers - Simplify mov macro on PIE (MOVABS now) - Reduce GOT footprint - patch v1: - Simplify ftrace implementation. - Use gcc

[Xen-devel] [PATCH v2 04/27] x86: Add macro to get symbol address for PIE support

2018-03-13 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 <thgar...@google.com> --- arch/x86/include/asm/asm.h | 1 + 1 file changed, 1 insertion(+) diff

[Xen-devel] [PATCH v2 02/27] x86: Use symbol name on bug table for PIE support

2018-03-13 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 extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier