* [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes
@ 2025-02-05 11:06 Juergen Gross
2025-02-05 11:06 ` [PATCH v2 1/3] x86/xen: fix xen_hypercall_hvm() to not clobber %rbx Juergen Gross
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Juergen Gross @ 2025-02-05 11:06 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Juergen Gross, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, xen-devel
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(-)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] x86/xen: fix xen_hypercall_hvm() to not clobber %rbx
2025-02-05 11:06 [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Juergen Gross
@ 2025-02-05 11:06 ` Juergen Gross
2025-02-05 11:06 ` [PATCH v2 2/3] x86/xen: add FRAME_END to xen_hypercall_hvm() Juergen Gross
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Juergen Gross @ 2025-02-05 11:06 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Juergen Gross, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, xen-devel
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.
Fixes: b4845bb63838 ("x86/xen: add central hypercall functions")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
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(-)
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 9252652afe59..72f28d66e0e5 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] x86/xen: add FRAME_END to xen_hypercall_hvm()
2025-02-05 11:06 [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Juergen Gross
2025-02-05 11:06 ` [PATCH v2 1/3] x86/xen: fix xen_hypercall_hvm() to not clobber %rbx Juergen Gross
@ 2025-02-05 11:06 ` Juergen Gross
2025-02-05 11:06 ` [PATCH v2 3/3] x86/xen: remove unneeded dummy push from xen_hypercall_hvm() Juergen Gross
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Juergen Gross @ 2025-02-05 11:06 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Juergen Gross, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, xen-devel,
kernel test robot
xen_hypercall_hvm() is missing a FRAME_END at the end, add it.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502030848.HTNTTuo9-lkp@intel.com/
Fixes: b4845bb63838 ("x86/xen: add central hypercall functions")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
arch/x86/xen/xen-head.S | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 72f28d66e0e5..4e481b0eefc9 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] x86/xen: remove unneeded dummy push from xen_hypercall_hvm()
2025-02-05 11:06 [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Juergen Gross
2025-02-05 11:06 ` [PATCH v2 1/3] x86/xen: fix xen_hypercall_hvm() to not clobber %rbx Juergen Gross
2025-02-05 11:06 ` [PATCH v2 2/3] x86/xen: add FRAME_END to xen_hypercall_hvm() Juergen Gross
@ 2025-02-05 11:06 ` Juergen Gross
2025-02-05 11:39 ` [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Jan Beulich
2025-02-05 11:41 ` Andrew Cooper
4 siblings, 0 replies; 6+ messages in thread
From: Juergen Gross @ 2025-02-05 11:06 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Juergen Gross, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, xen-devel
Stack 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.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
arch/x86/xen/xen-head.S | 6 ------
1 file changed, 6 deletions(-)
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 4e481b0eefc9..894edf8d6d62 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes
2025-02-05 11:06 [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Juergen Gross
` (2 preceding siblings ...)
2025-02-05 11:06 ` [PATCH v2 3/3] x86/xen: remove unneeded dummy push from xen_hypercall_hvm() Juergen Gross
@ 2025-02-05 11:39 ` Jan Beulich
2025-02-05 11:41 ` Andrew Cooper
4 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2025-02-05 11:39 UTC (permalink / raw)
To: Juergen Gross
Cc: Boris Ostrovsky, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin, xen-devel, linux-kernel, x86
On 05.02.2025 12:06, Juergen Gross wrote:
> 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()
Reviewed-by: Jan Beulich <jbeulich@suse.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes
2025-02-05 11:06 [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Juergen Gross
` (3 preceding siblings ...)
2025-02-05 11:39 ` [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Jan Beulich
@ 2025-02-05 11:41 ` Andrew Cooper
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Cooper @ 2025-02-05 11:41 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, x86
Cc: Boris Ostrovsky, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin, xen-devel
On 05/02/2025 11:06 am, Juergen Gross wrote:
> 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(-)
>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-05 11:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-05 11:06 [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Juergen Gross
2025-02-05 11:06 ` [PATCH v2 1/3] x86/xen: fix xen_hypercall_hvm() to not clobber %rbx Juergen Gross
2025-02-05 11:06 ` [PATCH v2 2/3] x86/xen: add FRAME_END to xen_hypercall_hvm() Juergen Gross
2025-02-05 11:06 ` [PATCH v2 3/3] x86/xen: remove unneeded dummy push from xen_hypercall_hvm() Juergen Gross
2025-02-05 11:39 ` [PATCH v2 0/3] x86/xen: some xen_hypercall_hvm() fixes Jan Beulich
2025-02-05 11:41 ` Andrew Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®