]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 8299/1: mm: ensure local active ASID is marked as allocated on rollover
authorWill Deacon <will.deacon@arm.com>
Thu, 29 Jan 2015 15:41:46 +0000 (16:41 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 3 Feb 2015 12:57:33 +0000 (12:57 +0000)
commit3201e7aeb6ea4b34cd16d702b52a432c76779dfa
tree2c9f1b94c39aed431e310c8a5d188574a5d5653b
parent1269903a575b5f4bdf5df55d8f7fce616453f934
ARM: 8299/1: mm: ensure local active ASID is marked as allocated on rollover

Commit 731139f6e2f2 ("ARM: 7924/1: mm: don't bother with reserved ttbr0
when running with LPAE") removed the use of the reserved TTBR0 value
for LPAE systems, since the ASID is held in the TTBR and can be updated
atomicly with the pgd of the next mm.

Unfortunately, this patch forgot to update flush_context, which
deliberately avoids marking the local active ASID as allocated, since we
used to switch via ASID zero and didn't need to allocate the ASID of
the previous mm. The side-effect of this is that we can allocate the
same ASID to the next mm and, between flushing the local TLB and updating
TTBR0, we can perform speculative TLB fills for userspace nG mappings
using the page table of the previous mm.

The consequence of this is that the next mm can erroneously hit some
mappings of the previous mm. Note that this was made significantly
harder to hit by 6ac63f7572e3 ("ARM: 8203/1: mm: try to re-use old ASID
assignments following a rollover") but is still theoretically possible.

This patch fixes the problem by removing the code from flush_context
that forces the allocated ASID to zero for the local CPU. Many thanks
to the Broadcom guys for tracking this one down.

Fixes: 731139f6e2f2 ("ARM: 7924/1: mm: don't bother with reserved ttbr0 when running with LPAE")
Cc: <stable@vger.kernel.org> # v3.14+
Reported-by: Raymond Ngun <rngun@broadcom.com>
Tested-by: Raymond Ngun <rngun@broadcom.com>
Reviewed-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/context.c