]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
minidump: reduce the amount direct accesses to page tables
authorMitchell Horne <mhorne@FreeBSD.org>
Wed, 17 Nov 2021 15:30:43 +0000 (11:30 -0400)
committerMitchell Horne <mhorne@FreeBSD.org>
Fri, 19 Nov 2021 19:05:52 +0000 (15:05 -0400)
commit681bd71047f184282d10d5ec9c1770882d525eb8
tree30bb2d0c24ebc484ac794342e24742b10dce5964
parent90d4da62259299a8d91fed1121be97ac5b7b6b3c
minidump: reduce the amount direct accesses to page tables

During a live dump, we may race with updates to the kernel page tables.
This is generally okay; we accept that the state of the system while
dumping may be somewhat inconsistent with its state when the dump was
invoked. However, when walking the kernel page tables, it is important
that we load each PDE/PTE only once while operating on it. Otherwise, it
is possible to have the relevant PTE change underneath us. For example,
after checking the valid bit, but before reading the physical address.

Convert the loads to atomics, and add some validation around the
physical addresses, to ensure that we do not try to dump a non-existent
or non-canonical physical address.

Similarly, don't read kernel_vm_end more than once, on the off chance
that pmap_growkernel() is called between the two page table walks.

Reviewed by: kib, markj
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31990
sys/amd64/amd64/minidump_machdep.c
sys/arm/arm/minidump_machdep.c
sys/arm64/arm64/minidump_machdep.c
sys/i386/i386/minidump_machdep_base.c
sys/riscv/riscv/minidump_machdep.c