kaiser: kaiser_remove_mapping() move along the pgd
authorHugh Dickins <hughd@google.com>
Mon, 2 Oct 2017 17:57:24 +0000 (10:57 -0700)
committerYves-Alexis Perez <corsac@debian.org>
Thu, 4 Jan 2018 11:12:40 +0000 (11:12 +0000)
commit158fb2dabac4f2d71783570063466c2e3239bea7
tree45b6d6d27a7deae6d6343ab3c1f9165196e4567b
parent04635f67194cbff7ccb2ce74b862e9630bb6f3d8
kaiser: kaiser_remove_mapping() move along the pgd

When removing the bogus comment from kaiser_remove_mapping(),
I really ought to have checked the extent of its bogosity: as
Neel points out, there is nothing to stop unmap_pud_range_nofree()
from continuing beyond the end of a pud (and starting in the wrong
position on the next).

Fix kaiser_remove_mapping() to constrain the extent and advance pgd
pointer correctly: use pgd_addr_end() macro as used throughout base
mm (but don't assume page-rounded start and size in this case).

But this bug was very unlikely to trigger in this backport: since
any buddy allocation is contained within a single pud extent, and
we are not using vmapped stacks (and are only mapping one page of
stack anyway): the only way to hit this bug here would be when
freeing a large modified ldt.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gbp-Pq: Topic features/all/kpti
Gbp-Pq: Name kaiser-kaiser_remove_mapping-move-along-the-pgd.patch
arch/x86/mm/kaiser.c