Commit da1694ad authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik

s390/mm,ptdump: hold cpa mutex while walking for kernel page table dump

This is currently only preventing that outdated information is
provided to user space. A concurrent split of huge/large pages does
modify the kernel page tables, however either the huge/large mapping
is reported or the split area is being walked.

This "fixes" also only a potential future bug, since split pages could
also be merged again if page permissions are the same for larger
memory areas.
Reviewed-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 36c2733c
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
#ifndef _ASMS390_SET_MEMORY_H #ifndef _ASMS390_SET_MEMORY_H
#define _ASMS390_SET_MEMORY_H #define _ASMS390_SET_MEMORY_H
#include <linux/mutex.h>
extern struct mutex cpa_mutex;
#define SET_MEMORY_RO 1UL #define SET_MEMORY_RO 1UL
#define SET_MEMORY_RW 2UL #define SET_MEMORY_RW 2UL
#define SET_MEMORY_NX 4UL #define SET_MEMORY_NX 4UL
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/set_memory.h>
#include <linux/ptdump.h> #include <linux/ptdump.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
...@@ -130,7 +131,9 @@ static int ptdump_show(struct seq_file *m, void *v) ...@@ -130,7 +131,9 @@ static int ptdump_show(struct seq_file *m, void *v)
}; };
get_online_mems(); get_online_mems();
mutex_lock(&cpa_mutex);
ptdump_walk_pgd(&st.ptdump, &init_mm, NULL); ptdump_walk_pgd(&st.ptdump, &init_mm, NULL);
mutex_unlock(&cpa_mutex);
put_online_mems(); put_online_mems();
return 0; return 0;
} }
......
...@@ -278,7 +278,7 @@ static int walk_p4d_level(pgd_t *pgd, unsigned long addr, unsigned long end, ...@@ -278,7 +278,7 @@ static int walk_p4d_level(pgd_t *pgd, unsigned long addr, unsigned long end,
return rc; return rc;
} }
static DEFINE_MUTEX(cpa_mutex); DEFINE_MUTEX(cpa_mutex);
static int change_page_attr(unsigned long addr, unsigned long end, static int change_page_attr(unsigned long addr, unsigned long end,
unsigned long flags) unsigned long flags)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment