Re: [PATCH v9 04/11] x86/entry/64: Adapt assembly for PIE support

2019-08-06 Thread Borislav Petkov
On Tue, Aug 06, 2019 at 09:59:42AM -0400, Steven Rostedt wrote: > As Peter stated later in this thread, we only have the IRQ stack frame saved > here, because we just took an NMI, and this is the logic to determine if it > was a nested NMI or not (where we have to be *very* careful about touching

Re: [PATCH v9 04/11] x86/entry/64: Adapt assembly for PIE support

2019-08-06 Thread Steven Rostedt
On Mon, Aug 05, 2019 at 07:28:54PM +0200, Borislav Petkov wrote: > > 1: > > @@ -1571,7 +1572,8 @@ nested_nmi: > > pushq %rdx > > pushfq > > pushq $__KERNEL_CS > > - pushq $repeat_nmi > > + leaqrepeat_nmi(%rip), %rdx > > + pushq %rdx > > > > /* Put stack back */

Re: [PATCH v9 04/11] x86/entry/64: Adapt assembly for PIE support

2019-08-06 Thread Borislav Petkov
+ rostedt. Steve, pls have a look at the patch at the beginning of this thread as it touches the reentrant NMI magic. :) Thx. On Tue, Aug 06, 2019 at 10:30:32AM +0200, Peter Zijlstra wrote: > On Tue, Aug 06, 2019 at 07:08:51AM +0200, Borislav Petkov wrote: > > On Mon, Aug 05, 2019 at 10:50:30AM

Re: [PATCH v9 04/11] x86/entry/64: Adapt assembly for PIE support

2019-08-06 Thread Peter Zijlstra
On Tue, Aug 06, 2019 at 07:08:51AM +0200, Borislav Petkov wrote: > On Mon, Aug 05, 2019 at 10:50:30AM -0700, Thomas Garnier wrote: > > I saw that %rdx was used for temporary usage and restored before the > > end so I assumed that it was not an option. > > PUSH_AND_CLEAR_REGS saves all regs

Re: [PATCH v9 04/11] x86/entry/64: Adapt assembly for PIE support

2019-08-05 Thread Borislav Petkov
On Mon, Aug 05, 2019 at 10:50:30AM -0700, Thomas Garnier wrote: > I saw that %rdx was used for temporary usage and restored before the > end so I assumed that it was not an option. PUSH_AND_CLEAR_REGS saves all regs earlier so I think you should be able to use others. Like

Re: [PATCH v9 04/11] x86/entry/64: Adapt assembly for PIE support

2019-08-05 Thread Thomas Garnier
On Mon, Aug 5, 2019 at 10:28 AM Borislav Petkov wrote: > > On Tue, Jul 30, 2019 at 12:12:48PM -0700, Thomas Garnier wrote: > > Change the assembly code to use only relative references of symbols for the > > kernel to be PIE compatible. > > > > Position Independent Executable (PIE) support will

Re: [PATCH v9 04/11] x86/entry/64: Adapt assembly for PIE support

2019-08-05 Thread Borislav Petkov
On Tue, Jul 30, 2019 at 12:12:48PM -0700, Thomas Garnier wrote: > 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 below

[PATCH v9 04/11] x86/entry/64: Adapt assembly for PIE support

2019-07-30 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 below 0x8000. Signed-off-by: Thomas Garnier Reviewed-by: Kees Cook ---