Restore memory used for IP computation
PATCH 1/1 Restore memory used for IP computation
We need to write in some location but no reasons to not trying to restore what we potentially overwrote.
--- xen/arch/x86/boot/head.S | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
xen/arch/x86/boot/head.S +10 -2
@@ -418,13 +418,17 @@ __pvh_start: * absolute stack address as the native path, for lack of a better * alternative. */ - mov $0x1000, %esp + mov $0xffc, %esp + pop %edx /* Calculate the load base address. */ call 1f 1: pop %esi sub $sym_offs(1b), %esi + /* Restore clobbered stack */ + push %edx + /* Set up stack. */ lea STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
@@ -468,13 +472,17 @@ __start: * this page for a temporary stack, being one of the safest locations * to clobber. */ - mov $0x1000, %esp + mov $0xffc, %esp + pop %edx /* Calculate the load base address. */ call 1f 1: pop %esi sub $sym_offs(1b), %esi + /* Restore clobbered stack */ + push %edx + /* Set up stack. */ lea STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
Signature · 1 line
2.46.0
Quoted 4 lines · Frediano Ziglio
We need to write in some location but no reasons to not trying to restore what we potentially overwrote.
Signed-off-by Frediano Ziglio <[email protected]>
Please follow how Linux does this.
e.g.
https://lore.kernel.org/xen-devel/[email protected]/
Specifically, ...
xen/arch/x86/boot/head.S __pvh_start: · line 420
Quoted 12 lines
--- xen/arch/x86/boot/head.S | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)xen/arch/x86/boot/head.S +0
-0@@ -418,13 +418,17 @@ __pvh_start: * absolute stack address as the native path, for lack of a better * alternative. */
... the reasoning in this comment here is incorrect for non-BIOS systems, and causes memory corruption for Coreboot based boot.
I've been meaning to fix it for ages, but seeing as you're changing it... :)
The first field under %ebx in a boot ABI we recognise is a much better choice that an arbitrary location in the first page of memory.
~Andrew