xen/arm: mm: Protect Xen page-table update with a spinlock
authorJulien Grall <julien.grall@arm.com>
Mon, 18 Mar 2019 18:06:55 +0000 (18:06 +0000)
committerJulien Grall <julien.grall@arm.com>
Thu, 13 Jun 2019 12:07:58 +0000 (13:07 +0100)
commit36a1c7c213e13eb64d2c2d8aa9c5c805fe19020a
treed4ec43e10a5f589df804323540087cb0baba2972
parent9bd8d268d8b586ad6948feb42f709df39271d7c4
xen/arm: mm: Protect Xen page-table update with a spinlock

The function create_xen_entries() may be called concurrently. For
instance, while the vmap allocation is protected by a spinlock, the
mapping is not.

The implementation create_xen_entries() contains quite a few TOCTOU
races such as when allocating the 3rd-level page-tables.

Thankfully, they are pretty hard to reach as page-tables are allocated
once and never released. Yet it is possible, so we need to protect with
a spinlock to avoid corrupting the page-tables.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andrii Anisov <andrii.anisov@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/mm.c