Re: [PATCH v3 1/4] x86/membarrier: Get rid of a dubious optimization

From: Andy Lutomirski
Date: Tue Dec 08 2020 - 23:11:32 EST


On Thu, Dec 3, 2020 at 9:07 PM Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>
> sync_core_before_usermode() had an incorrect optimization. If we're
> in an IRQ, we can get to usermode without IRET -- we just have to
> schedule to a different task in the same mm and do SYSRET.
> Fortunately, there were no callers of sync_core_before_usermode()
> that could have had in_irq() or in_nmi() equal to true, because it's
> only ever called from the scheduler.
>
> While we're at it, clarify a related comment.
>

Fixes: ac1ab12a3e6e ("lockin/x86: Implement sync_core_before_usermode()")

> Cc: stable@xxxxxxxxxxxxxxx
> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>