[PATCH v2] x86/xen/pvh: Enable PAE mode for 32-bit guest only when CONFIG_X86_PAE is set

2024-04-23 Thread Hou Wenlong
result in a boot failure during CR3 loading. Signed-off-by: Hou Wenlong Reviewed-by: Juergen Gross --- v1 -> v2: Add the "Reviewed-by" tag from Juergen v1: https://lore.kernel.org/lkml/8c5448eeebbba998a7fff9ed9b2f7e7f3e437967.1697792461.git.houwenlong@antgroup.com --- arch/x86

Re: [PATCH 1/2] x86/xen/pvh: Set up percpu for stack canary in 32-bit kernel entry

2023-10-23 Thread Hou Wenlong
On Mon, Oct 23, 2023 at 08:02:02PM +0800, Andy Shevchenko wrote: > On Mon, Oct 23, 2023 at 12:10 PM Hou Wenlong > wrote: > > > > In a 32-bit SMP kernel, the stack canary is a percpu variable accessed > > as %fs:__stack_chk_guard. However, the ABI for PVH entry does

[PATCH 2/2] x86/xen/pvh: Use fixed_percpu_data to set up GS base

2023-10-23 Thread Hou Wenlong
startup_64() and startup_xen() both use "fixed_percpu_data" to set up GS base. So for consitency, use it too in PVH entry and remove the temporary variable "canary". Signed-off-by: Hou Wenlong --- arch/x86/platform/pvh/head.S | 4 +--- 1 file changed, 1 insertion(+), 3 dele

[PATCH 1/2] x86/xen/pvh: Set up percpu for stack canary in 32-bit kernel entry

2023-10-23 Thread Hou Wenlong
safety, the percpu should be set up explicitly %before calling xen_prepare_pvh(), which accesses the stack canary. Signed-off-by: Hou Wenlong --- arch/x86/platform/pvh/head.S | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S index

[PATCH 0/2] x86/xen/pvh: Clean up stack canary setup in PVH entry

2023-10-23 Thread Hou Wenlong
Clean up the stack canary setup in the PVH entry. For a 64-bit kernel, use fixed_percpu_data to set up GSBASE. For a 32-bit kernel, set up the %fs register explicitly. Hou Wenlong (2): x86/xen/pvh: Set up percpu for stack canary in 32-bit kernel entry x86/xen/pvh: Use fixed_percpu_data to set

[PATCH] x86/xen/pvh: Enable PAE mode for 32-bit guest only when CONFIG_X86_PAE is set

2023-10-20 Thread Hou Wenlong
result in a boot failure during CR3 loading. Signed-off-by: Hou Wenlong --- arch/x86/platform/pvh/head.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S index c4365a05ab83..085adb1b2313 100644 --- a/arch/x86/platform/pvh/head.S +++ b

Re: [PATCH RFC 0/4] x86/fixmap: Unify FIXADDR_TOP

2023-06-08 Thread Hou Wenlong
On Wed, Jun 07, 2023 at 08:49:15PM +0800, Dave Hansen wrote: > On 5/15/23 01:19, Hou Wenlong wrote: > > This patchset unifies FIXADDR_TOP as a variable for x86, allowing the > > fixmap area to be movable and relocated with the kernel image in the > > x86/PIE patchset [0]. Th

Re: [PATCH RFC 0/4] x86/fixmap: Unify FIXADDR_TOP

2023-06-07 Thread Hou Wenlong
On Mon, May 15, 2023 at 04:19:31PM +0800, Hou Wenlong wrote: > This patchset unifies FIXADDR_TOP as a variable for x86, allowing the > fixmap area to be movable and relocated with the kernel image in the > x86/PIE patchset [0]. This enables the kernel image to be relocated in >

[PATCH RFC 2/4] x86/xen: Pin up to VSYSCALL_ADDR when vsyscall page is out of fixmap area

2023-05-15 Thread Hou Wenlong
If the vsyscall page is moved out of the fixmap area, then FIXADDR_TOP would be below the vsyscall page. Therefore, it should be pinned up to VSYSCALL_ADDR if vsyscall is enabled. Suggested-by: Lai Jiangshan Signed-off-by: Hou Wenlong --- arch/x86/xen/mmu_pv.c | 12 +--- 1 file changed

[PATCH RFC 1/4] x86/vsyscall: Don't use set_fixmap() to map vsyscall page

2023-05-15 Thread Hou Wenlong
the vsyscall page. Suggested-by: Lai Jiangshan Signed-off-by: Hou Wenlong --- arch/x86/entry/vsyscall/vsyscall_64.c | 3 +-- arch/x86/include/asm/paravirt.h | 7 +++ arch/x86/include/asm/paravirt_types.h | 4 arch/x86/include/asm/vsyscall.h | 13 + arch/x86/kernel

[PATCH RFC 0/4] x86/fixmap: Unify FIXADDR_TOP

2023-05-15 Thread Hou Wenlong
.git.houwenlong@antgroup.com Hou Wenlong (4): x86/vsyscall: Don't use set_fixmap() to map vsyscall page x86/xen: Pin up to VSYSCALL_ADDR when vsyscall page is out of fixmap area x86/fixmap: Move vsyscall page out of fixmap area x86/fixmap: Unify FIXADDR_TOP arch/x86/entry/vsyscall

Re: [PATCH RFC 16/43] x86-64: Use per-cpu stack canary if supported by compiler

2023-05-04 Thread Hou Wenlong
On Thu, May 04, 2023 at 12:31:59PM +0200, Juergen Gross wrote: > On 28.04.23 11:50, Hou Wenlong wrote: > >From: Brian Gerst > > > >From: Brian Gerst > > > >If the compiler supports it, use a standard per-cpu variable for the > >stack protector instead of

[PATCH RFC 29/43] x86/PVH: Adapt PVH booting for PIE support

2023-04-28 Thread Hou Wenlong
. PVH booting assumes that no relocation happened. Since the kernel compile address is still in top 2G, so it is allowed to use R_X86_64_32S for symbol references in pvh_start_xen(). Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Lai Jiangshan Cc: Kees Cook --- arch/x86/platform/pvh/head.S

[PATCH RFC 36/43] x86/vsyscall: Don't use set_fixmap() to map vsyscall page

2023-04-28 Thread Hou Wenlong
Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Kees Cook --- arch/x86/entry/vsyscall/vsyscall_64.c | 3 +-- arch/x86/include/asm/paravirt.h | 7 +++ arch/x86/include/asm/paravirt_types.h | 4 arch/x86/include/asm/vsyscall.h | 13 + arch/x86/kernel/paravirt.c

[PATCH RFC 15/43] x86/PVH: Use fixed_percpu_data to set up GS base

2023-04-28 Thread Hou Wenlong
startup_64() and startup_xen() both use fixed_percpu_data to set up GS base. So for consitency, use it too in PVH entry. Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Lai Jiangshan Cc: Kees Cook --- arch/x86/platform/pvh/head.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions

[PATCH RFC 18/43] x86/percpu: Use PC-relative addressing for percpu variable references

2023-04-28 Thread Hou Wenlong
-by: Lai Jiangshan Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Kees Cook --- arch/x86/entry/calling.h | 17 arch/x86/include/asm/nospec-branch.h | 10 +- arch/x86/include/asm/percpu.h| 29 +--- arch/x86/kernel/head_64.S

[PATCH RFC 37/43] x86/xen: Pin up to VSYSCALL_ADDR when vsyscall page is out of fixmap area

2023-04-28 Thread Hou Wenlong
If vsyscall page is moved out of fixmap area, then FIXADDR_TOP would be below vsyscall page. So it should pin up to VSYSCALL_ADDR if vsyscall is enabled. Suggested-by: Lai Jiangshan Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Kees Cook --- arch/x86/xen/mmu_pv.c | 12 +--- 1

[PATCH RFC 16/43] x86-64: Use per-cpu stack canary if supported by compiler

2023-04-28 Thread Hou Wenlong
From: Brian Gerst From: Brian Gerst If the compiler supports it, use a standard per-cpu variable for the stack protector instead of the old fixed location. Keep the fixed location code for compatibility with older compilers. [Hou Wenlong: Disable it on Clang, adapt new code change and adapt