x86/xen: some xen_hypercall_hvm() fixes
Subsystems (2)
Juergen Gross
maintainerv2 cover x86/xen: some xen_hypercall_hvm() fixes
3 fixes of the xen_hypercall_hvm() function, with the last one being probably more a cleanup.
Juergen Gross (3):
x86/xen: fix xen_hypercall_hvm() to not clobber %rbx x86/xen: add FRAME_END to xen_hypercall_hvm() x86/xen: remove unneeded dummy push from xen_hypercall_hvm()
arch/x86/xen/xen-head.S | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.0
Juergen Gross
maintainerPATCH v2 1/3 x86/xen: fix xen_hypercall_hvm() to not clobber %rbx
xen_hypercall_hvm(), which is used when running as a Xen PVH guest at most only once during early boot, is clobbering %rbx. Depending on whether the caller relies on %rbx to be preserved across the call or not, this clobbering might result in an early crash of the system.
This can be avoided by using an already saved register instead of %rbx.
---
V2:
- use %rcx instead of %rbx, keeping the lea instruction (Jan Beulich)
--- arch/x86/xen/xen-head.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/xen/xen-head.S +2 -2
@@ -117,8 +117,8 @@ SYM_FUNC_START(xen_hypercall_hvm) pop %ebx pop %eax #else - lea xen_hypercall_amd(%rip), %rbx - cmp %rax, %rbx + lea xen_hypercall_amd(%rip), %rcx + cmp %rax, %rcx #ifdef CONFIG_FRAME_POINTER pop %rax /* Dummy pop. */ #endif
Signature · 1 line
2.43.0
Juergen Gross
maintainerPATCH v2 2/3 x86/xen: add FRAME_END to xen_hypercall_hvm()
In reply to Juergen Grossxen_hypercall_hvm() is missing a FRAME_END at the end, add it.
--- arch/x86/xen/xen-head.S | 1 + 1 file changed, 1 insertion(+)
arch/x86/xen/xen-head.S +1 -0
@@ -132,6 +132,7 @@ SYM_FUNC_START(xen_hypercall_hvm) pop %rcx pop %rax #endif + FRAME_END /* Use correct hypercall function. */ jz xen_hypercall_amd jmp xen_hypercall_intel
Signature · 1 line
2.43.0
Juergen Gross
maintainerPATCH v2 3/3 x86/xen: remove unneeded dummy push from xen_hypercall_hvm()
In reply to Juergen GrossStack alignment of the kernel in 64-bit mode is 8, not 16, so the dummy push in xen_hypercall_hvm() for aligning the stack to 16 bytes can be removed.
--- arch/x86/xen/xen-head.S | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/xen/xen-head.S +0 -6
@@ -100,9 +100,6 @@ SYM_FUNC_START(xen_hypercall_hvm) push %r10 push %r9 push %r8 -#ifdef CONFIG_FRAME_POINTER - pushq $0 /* Dummy push for stack alignment. */ -#endif #endif /* Set the vendor specific function. */ call __xen_hypercall_setfunc
@@ -119,9 +116,6 @@ SYM_FUNC_START(xen_hypercall_hvm) #else lea xen_hypercall_amd(%rip), %rcx cmp %rax, %rcx -#ifdef CONFIG_FRAME_POINTER - pop %rax /* Dummy pop. */ -#endif pop %r8 pop %r9 pop %r10
Signature · 1 line
2.43.0
Quoted 7 lines · Juergen Gross
3 fixes of the
xen_hypercall_hvm()function, with the last one being probably more a cleanup.Juergen Gross (3):
x86/xen: fixxen_hypercall_hvm()to not clobber %rbx x86/xen: addFRAME_ENDtoxen_hypercall_hvm()x86/xen: remove unneeded dummy push fromxen_hypercall_hvm()
Quoted 11 lines · Juergen Gross
3 fixes of the
xen_hypercall_hvm()function, with the last one being probably more a cleanup.Juergen Gross (3):
x86/xen: fixxen_hypercall_hvm()to not clobber %rbx x86/xen: addFRAME_ENDtoxen_hypercall_hvm()x86/xen: remove unneeded dummy push fromxen_hypercall_hvm()arch/x86/xen/xen-head.S | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)