HomeFreeBSD

minidump: reduce the amount direct accesses to page tables

Description

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

Details

Provenance
mhorneAuthored on Nov 17 2021, 3:30 PM
Reviewer
kib
Differential Revision
D31990: minidump: reduce the amount direct accesses to page tables
Parents
R10:90d4da622592: amd64: provide PHYS_IN_DMAP() and VIRT_IN_DMAP()
Branches
Unknown
Tags
Unknown