Re: [PATCH v1 5/8] x86/entry/clearregs: Clear registers for 64bit exceptions/interrupts

From: Andy Lutomirski
Date: Tue Jan 09 2018 - 20:23:12 EST




> On Jan 9, 2018, at 5:03 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
>
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> Clear all registers on entering the 64bit kernel for exceptions and
> interrupts.
>
> Since there are no arguments this is fairly simple.
>
> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> ---
> arch/x86/entry/entry_64.S | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 632081fd7086..6ab4c2aaeabb 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -636,6 +636,7 @@ END(irq_entries_start)
> ALLOC_PT_GPREGS_ON_STACK
> SAVE_C_REGS
> SAVE_EXTRA_REGS
> + CLEAR_ALL_REGS
> ENCODE_FRAME_POINTER
>
> testb $3, CS(%rsp)
> @@ -1192,6 +1193,7 @@ ENTRY(xen_failsafe_callback)
> ALLOC_PT_GPREGS_ON_STACK
> SAVE_C_REGS
> SAVE_EXTRA_REGS
> + CLEAR_ALL_REGS
> ENCODE_FRAME_POINTER

If CLEAR_ALL_REGS does what it sounds like, then its overkill here.

I could get behind this patch in general, though. Interrupts are so slow the the overhead probably doesn't matter.