From: Jim Mattson Subject: [kvm-unit-tests PATCH v2 2/4] Specify %cs for exception_handler iret Date: Thu, 29 Jun 2017 11:46:45 -0700 Message-ID: <20170629184647.76674-2-jmattson@google.com> References: <20170629175211.66170-1-jmattson@google.com> <20170629184647.76674-1-jmattson@google.com> Cc: Jim Mattson To: Paolo Bonzini , David Hildenbrand , kvm list , David Matlack Return-path: Received: from mail-pf0-f181.google.com ([209.85.192.181]:35239 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbdF2StW (ORCPT ); Thu, 29 Jun 2017 14:49:22 -0400 Received: by mail-pf0-f181.google.com with SMTP id c73so54776435pfk.2 for ; Thu, 29 Jun 2017 11:49:16 -0700 (PDT) In-Reply-To: <20170629184647.76674-1-jmattson@google.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 --- lib/x86/desc.c | 1 + 1 file changed, 1 insertion(+) 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), -- 2.13.2.725.g09c95d1e9-goog