diff mbox

[kvm-unit-tests,v2,2/4] Specify %cs for exception_handler iret

Message ID 20170629184647.76674-2-jmattson@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jim Mattson June 29, 2017, 6:46 p.m. UTC
The exception handler longjmp should happen in the code segment of the
exception handler rather than in the code segment of the exception
(particularly when the exception occurs in compatibility mode).

Signed-off-by: Jim Mattson <jmattson@google.com>
---
 lib/x86/desc.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index 830c5d127dbc..fc6a67eb0a19 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -388,6 +388,7 @@  static void exception_handler(struct ex_regs *regs)
 	/* longjmp must happen after iret, so do not do it now.  */
 	exception = true;
 	regs->rip = (unsigned long)&exception_handler_longjmp;
+	regs->cs = read_cs();
 }
 
 bool test_for_exception(unsigned int ex, void (*trigger_func)(void *data),