From patchwork Thu Jun 29 18:46:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Mattson X-Patchwork-Id: 9817735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B32E06035F for ; Thu, 29 Jun 2017 18:49:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7A6228786 for ; Thu, 29 Jun 2017 18:49:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C6E528787; Thu, 29 Jun 2017 18:49:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3314A28760 for ; Thu, 29 Jun 2017 18:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753202AbdF2StZ (ORCPT ); Thu, 29 Jun 2017 14:49:25 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a3pATM+oye84WK2ap3gd4oPXwLPVuCbqENBdgM3V1yA=; b=M7CJFQr6RBpCzSYPwf8MzNwJscdo14AqxBclSPxAEjSMVnLTNhB2amAgx4pGQ0ew1C mqGlrvdCOB/Z3ty74M5vC1xinYJPKw3MpksMSIC3CGKw2enQ//yFacACT4pstuS14Zkq KzhFMe8Jj4/Zzj30JNf+DHE2w5Dk7avJRbAVuZ1AozPM/TK0O5hWTPSwD2Boba/DIJFD h1bFv0/oLeDK+NafLo1GPQOYor3mTmgRNRUDY/59/U1t4euUEccc8Zaas7hyVnEEpm58 DSc9x+pz9PYvkxfdCWP2RT6t4/GDqN1OuE8MXWvofDUG0usnXJ5iI6PwrZEXdEZgQF1b gMug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a3pATM+oye84WK2ap3gd4oPXwLPVuCbqENBdgM3V1yA=; b=S5652wChULC9cRfYAXIvdIA/yvgBUKckoE4B4q0WvunJTjX8rQSSeQTkNLC6juBYsJ r+xKUIISiSbcM+FJJ02zeY/ymG7QVvTEaxxA09ZoTo/d5WReEmKBrtZtsBzY1T1DmXoH oYyafQydnTRMzn48WQGOoEaXRZtMayGEfKFtNCiq/H8TT7ClLg02JxcZw6IuAY7si9MN l8g5SdSkE0jbk6WKw0WTbWulkhKgGp53aZiJXtSq2JAMhtqxAfd3KpO7KhASWcdlrZSj 9n/Eh3FRYV3b2gpyrzwp5neZ9rPyj24OMvoEuOLE7eu1QmmbWcB3sJucn8y1xWi+8jO5 UipA== X-Gm-Message-State: AKS2vOynNvFMKR0NvApopiQaPs1NhqgjvKyzZYuZ4neOGKyV7H1Tgk1A pNvHghiwaGzPNCsH X-Received: by 10.84.216.28 with SMTP id m28mr19422525pli.275.1498762156130; Thu, 29 Jun 2017 11:49:16 -0700 (PDT) Received: from turtle.sea.corp.google.com ([172.31.88.24]) by smtp.gmail.com with ESMTPSA id r63sm10912312pgr.65.2017.06.29.11.49.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 11:49:15 -0700 (PDT) From: Jim Mattson To: Paolo Bonzini , David Hildenbrand , kvm list , David Matlack Cc: 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> X-Mailer: git-send-email 2.13.2.725.g09c95d1e9-goog In-Reply-To: <20170629184647.76674-1-jmattson@google.com> References: <20170629175211.66170-1-jmattson@google.com> <20170629184647.76674-1-jmattson@google.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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),