Re: [PATCH 00/23] [v4] KAISER: unmap most of the kernel from userspace page tables
From: Ingo Molnar
Date: Fri Nov 24 2017 - 01:35:22 EST
* Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> wrote:
> I've updated these a bit since yesterday with some minor fixes:
> * Fixed KASLR compile bug
> * Fixed ds.c compile problem
> * Changed ulong to pteval_t to fix 32-bit compile problem
> * Stop mapping cpu_current_top_of_stack (never used until after CR3 switch)
>
> Rather than re-spamming everyone, the resulting branch is here:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/daveh/x86-kaiser.git/log/?h=kaiser-414-tipwip-20171123
>
> If anyone wants to be re-spammed, just say the word.
So the pteval_t changes break the build on most non-x86 architectures (alpha, arm,
arm64, etc.), because most of them don't have an asm/pgtable_types.h file.
pteval_t is an x86-ism.
So I left out the changes below.
Thanks,
Ingo
diff --git a/arch/x86/include/asm/kaiser.h b/arch/x86/include/asm/kaiser.h
index 35f12a8a7071..2198855f7de9 100644
--- a/arch/x86/include/asm/kaiser.h
+++ b/arch/x86/include/asm/kaiser.h
@@ -18,6 +18,8 @@
#ifndef __ASSEMBLY__
#ifdef CONFIG_KAISER
+#include <asm/pgtable_types.h>
+
/**
* kaiser_add_mapping - map a kernel range into the user page tables
* @addr: the start address of the range
@@ -31,7 +33,7 @@
* table.
*/
extern int kaiser_add_mapping(unsigned long addr, unsigned long size,
- unsigned long flags);
+ pteval_t flags);
/**
* kaiser_add_mapping_cpu_entry - map the cpu entry area
diff --git a/arch/x86/mm/kaiser.c b/arch/x86/mm/kaiser.c
index 1eb27b410556..58cae2924724 100644
--- a/arch/x86/mm/kaiser.c
+++ b/arch/x86/mm/kaiser.c
@@ -431,7 +431,7 @@ void __init kaiser_init(void)
}
int kaiser_add_mapping(unsigned long addr, unsigned long size,
- unsigned long flags)
+ pteval_t flags)
{
return kaiser_add_user_map((const void *)addr, size, flags);
}
diff --git a/include/linux/kaiser.h b/include/linux/kaiser.h
index 83d465599646..f662013515a1 100644
--- a/include/linux/kaiser.h
+++ b/include/linux/kaiser.h
@@ -4,7 +4,11 @@
#ifdef CONFIG_KAISER
#include <asm/kaiser.h>
#else
+
#ifndef __ASSEMBLY__
+
+#include <asm/pgtable_types.h>
+
/*
* These stubs are used whenever CONFIG_KAISER is off, which
* includes architectures that support KAISER, but have it
@@ -20,7 +24,7 @@ static inline void kaiser_remove_mapping(unsigned long start, unsigned long size
}
static inline int kaiser_add_mapping(unsigned long addr, unsigned long size,
- unsigned long flags)
+ pteval_t flags)
{
return 0;
}