Re: [PATCH 04/24] x86/mm/kaiser: Unmap kernel mappings from userspace page tables, core patch

Peter Zijlstra
2017-11-28T11:59:49Z

On Mon, Nov 27, 2017 at 11:49:03AM +0100, Ingo Molnar wrote:
> +/*
> + * Given a kernel address, @__start_addr, copy that mapping into
> + * the user (shadow) page tables. This may need to allocate page
> + * table pages.
> + */
> +int kaiser_add_user_map(const void *__start_addr, unsigned long size,
> + unsigned long flags)
> +{
> +}
> +
> +int kaiser_add_user_map_ptrs(const void *__start_addr,
> + const void *__end_addr,
> + unsigned long flags)
> +{
> +}

AFAICT these here can be static..

diff --git a/arch/x86/mm/kaiser.c b/arch/x86/mm/kaiser.c
index 0ff502fa655b..f2bf074b08e5 100644
--- a/arch/x86/mm/kaiser.c
+++ b/arch/x86/mm/kaiser.c
@@ -260,8 +260,8 @@ static pte_t *kaiser_shadow_pagetable_walk(unsigned long address,
* the user (shadow) page tables. This may need to allocate page
* table pages.
*/
-int kaiser_add_user_map(const void *__start_addr, unsigned long size,
- unsigned long flags)
+static int kaiser_add_user_map(const void *__start_addr, unsigned long size,
+ unsigned long flags)
{
unsigned long start_addr = (unsigned long)__start_addr;
unsigned long address = start_addr & PAGE_MASK;
@@ -310,9 +310,9 @@ int kaiser_add_user_map(const void *__start_addr, unsigned long size,
return 0;
}

-int kaiser_add_user_map_ptrs(const void *__start_addr,
- const void *__end_addr,
- unsigned long flags)
+static int kaiser_add_user_map_ptrs(const void *__start_addr,
+ const void *__end_addr,
+ unsigned long flags)
{
return kaiser_add_user_map(__start_addr,
__end_addr - __start_addr,