Skip to content

Commit bf2b59f

Browse files
Anshuman Khandualctmarinas
authored andcommitted
arm64/mm: Hold memory hotplug lock while walking for kernel page table dump
The arm64 page table dump code can race with concurrent modification of the kernel page tables. When a leaf entries are modified concurrently, the dump code may log stale or inconsistent information for a VA range, but this is otherwise not harmful. When intermediate levels of table are freed, the dump code will continue to use memory which has been freed and potentially reallocated for another purpose. In such cases, the dump code may dereference bogus addresses, leading to a number of potential problems. Intermediate levels of table may by freed during memory hot-remove, which will be enabled by a subsequent patch. To avoid racing with this, take the memory hotplug lock when walking the kernel page table. Acked-by: David Hildenbrand <[email protected]> Acked-by: Mark Rutland <[email protected]> Acked-by: Catalin Marinas <[email protected]> Reviewed-by: Steven Price <[email protected]> Signed-off-by: Anshuman Khandual <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent f8788d8 commit bf2b59f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm64/mm/ptdump_debugfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/debugfs.h>
3+
#include <linux/memory_hotplug.h>
34
#include <linux/seq_file.h>
45

56
#include <asm/ptdump.h>
67

78
static int ptdump_show(struct seq_file *m, void *v)
89
{
910
struct ptdump_info *info = m->private;
11+
12+
get_online_mems();
1013
ptdump_walk(m, info);
14+
put_online_mems();
1115
return 0;
1216
}
1317
DEFINE_SHOW_ATTRIBUTE(ptdump);

0 commit comments

Comments
 (0)