]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/membarrier: Get rid of a dubious optimization
authorAndy Lutomirski <luto@kernel.org>
Fri, 4 Dec 2020 05:07:03 +0000 (21:07 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Dec 2020 09:58:38 +0000 (10:58 +0100)
commitf114de3c03bd1406c0c110a5dee589365dc88a68
tree76b5f5b8f7b942d80918bd99d9bc214e33e4d6b6
parentc31a444c48981106aab63ca4297d285e47d260cf
x86/membarrier: Get rid of a dubious optimization

commit a493d1ca1a03b532871f1da27f8dbda2b28b04c4 upstream.

sync_core_before_usermode() had an incorrect optimization.  If the kernel
returns from an interrupt, it can get to usermode without IRET. It just has
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 at it, clarify a related comment.

Fixes: 70216e18e519 ("membarrier: Provide core serializing command, *_SYNC_CORE")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/5afc7632be1422f91eaf7611aaaa1b5b8580a086.1607058304.git.luto@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/sync_core.h
arch/x86/mm/tlb.c