Re: [PATCH v10 13/28] x86/fpu/xstate: Use feature disable (XFD) to protect dynamic user state

From: Thomas Gleixner
Date: Mon Oct 04 2021 - 08:35:23 EST


On Sun, Oct 03 2021 at 22:38, Chang Seok Bae wrote:
> On Oct 1, 2021, at 08:10, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> local_irq_enable();
>
> v1 had some similar ones (not the same though) [1]. FWIW, I think Andy’s point
> is worth to be noted here:
>
> First, you can't just enable IRQs here. If IRQs are off, they're off for a
> reason. Secondly, if they're *on*, you just forgot that fact.

The #NM comes from user space where interrupts are always enabled. So we
can enable interrupts _after_ doing the sanity checks.

Also we reenable interrupts in various other trap handlers when the trap
comes from user space as well. That's perfectly fine and required. How
would e.g. fault handling or single stepping ever work otherwise?

I have no idea where you had places the local_irq_enable(), but the code
I outlined is correct.

Thanks,

tglx