This is generally good practice, and necessary for livepatch binary diffing to
work.

With this, livepatching of the SVM entry path works.  The only complication is
with svm_stgi_label which is only used by oprofile to guestimate (not
completely correctly) when an NMI hit guest context.

Livepatching of VMX is still an open question, because the logic doesn't form
anything remotely resembling functions.  Both code fragments jump into each
other so need to be updated in tandem.  Also, both code fragment entries need
trampolines in the case that patching actually occurs.  For now, just treat it
as a single function.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
CC: Jan Beulich <jbeul...@suse.com>
CC: Roger Pau Monné <roger....@citrix.com>
CC: Wei Liu <w...@xen.org>
CC: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
CC: Ross Lagerwall <ross.lagerw...@citrix.com>
---
 xen/arch/x86/clear_page.S    | 3 +++
 xen/arch/x86/copy_page.S     | 3 +++
 xen/arch/x86/hvm/svm/entry.S | 3 +++
 xen/arch/x86/hvm/vmx/entry.S | 3 +++
 4 files changed, 12 insertions(+)

diff --git a/xen/arch/x86/clear_page.S b/xen/arch/x86/clear_page.S
index d9d524c79ecd..5b5622cc526f 100644
--- a/xen/arch/x86/clear_page.S
+++ b/xen/arch/x86/clear_page.S
@@ -16,3 +16,6 @@ ENTRY(clear_page_sse2)
 
         sfence
         ret
+
+        .type clear_page_sse2, @function
+        .size clear_page_sse2, . - clear_page_sse2
diff --git a/xen/arch/x86/copy_page.S b/xen/arch/x86/copy_page.S
index 2da81126c5fa..ddb6e0ebbb6e 100644
--- a/xen/arch/x86/copy_page.S
+++ b/xen/arch/x86/copy_page.S
@@ -41,3 +41,6 @@ ENTRY(copy_page_sse2)
 
         sfence
         ret
+
+        .type copy_page_sse2, @function
+        .size copy_page_sse2, . - copy_page_sse2
diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 981cd82e7c0b..9e3dab768027 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -142,3 +142,6 @@ GLOBAL(svm_stgi_label)
         sti
         call do_softirq
         jmp  .Lsvm_do_resume
+
+        .type svm_asm_do_resume, @function
+        .size svm_asm_do_resume, . - svm_asm_do_resume
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 5f5de45a1309..e3f60d5a82f7 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -150,3 +150,6 @@ ENTRY(vmx_asm_do_vmentry)
         sti
         call do_softirq
         jmp  .Lvmx_do_vmentry
+
+        .type vmx_asm_vmexit_handler, @function
+        .size vmx_asm_vmexit_handler, . - vmx_asm_vmexit_handler
-- 
2.30.2


Reply via email to