]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ARM: 7658/1: mm: fix race updating mm->context.id on ASID rollover
authorWill Deacon <will.deacon@arm.com>
Thu, 28 Feb 2013 16:47:20 +0000 (17:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Mar 2013 18:26:23 +0000 (11:26 -0700)
commit810f63799982d066cdc2781ba366fcee508918a8
tree6663137c46524de61c4bd4b3cf24c8a0a2fbac04
parent2eef33c7acacbbff8e5090f4a584ff1e36b17e41
ARM: 7658/1: mm: fix race updating mm->context.id on ASID rollover

commit 37f47e3d62533c931b04cb409f2eb299e6342331 upstream.

If a thread triggers an ASID rollover, other threads of the same process
must be made to wait until the mm->context.id for the shared mm_struct
has been updated to new generation and associated book-keeping (e.g.
TLB invalidation) has ben performed.

However, there is a *tiny* window where both mm->context.id and the
relevant active_asids entry are updated to the new generation, but the
TLB flush has not been performed, which could allow another thread to
return to userspace with a dirty TLB, potentially leading to data
corruption. In reality this will never occur because one CPU would need
to perform a context-switch in the time it takes another to do a couple
of atomic test/set operations but we should plug the race anyway.

This patch moves the active_asids update until after the potential TLB
flush on context-switch.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/mm/context.c