Received: by 10.223.176.5 with SMTP id f5csp2827683wra; Mon, 5 Feb 2018 10:31:05 -0800 (PST) X-Google-Smtp-Source: AH8x2250EMWUSm2uUSj0zyLpnyasiI2tnygWBIdjS87+Qgb8y3xN4ct8fa/mH4PHLZUP/7E8ZOPi X-Received: by 10.98.190.11 with SMTP id l11mr50120717pff.32.1517855465080; Mon, 05 Feb 2018 10:31:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517855465; cv=none; d=google.com; s=arc-20160816; b=KiaZ608eSKlREoiNAl5Wa3iXY3zOxz/ccC/JjdmWrukWAFr8g3IohTWaBEBO5xEKfs 18TzQKCpPt20AK06QmBp0V2XUAyYF9vDyLD+7S1AiOf7ILdxER74W/zqKHtrXHyCSCSY PsSVJBl5AKZxyCsxEa74MFhcQB0b55vdD75qsyfOgQ++mcewwbL5OI5e7MjUBZva9+go 8s4lEm/5KoxYsOBeiTSHgCRipEpHyX+SVEi3pFHNwL4XoZWq5yJ5mEkan8aC9ytKWhkB +nA+CNv54tEXVj9Ex8mcmd2JYpKnlciR0SRo35aep6tSu4zRBB2aFWgKN+Nyz+zHnFJ4 vyHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9GnOGtwGjy7EW9kobu6Rlaqo63zThck4DNaeraiYp6s=; b=TGG12tpNbgM9CsCAFjH7GMyv8HEZQJHQaMGbKSV9RoaQP27Wrr0H88H5P+fJJUFNuS gNKHJBMOZItayNxoxaIt/GpeKVuTdPI7tr3jkCfPjRoGsopB1ojNqyj4XpgjDocUWr/D PZOJZlWsuSBOKt87NNgIfXdBcfHmxsQE/+dclhMi4LYnrzEl8hz+DsVKMPDgnH0PPqjG uEAVvINPgLK6I5PdbxVZLGKrDHURz+DaRB5lC3QP4LG17J+c0KGoMGncZrVgTfxTKijD E8RdFvplsLQXs7w17Rx3EMDczjFihNfMThx+KpQV9SJ7TMCE6CnYxW7qhh/p8aPX7v1Z KTSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si723032pgn.791.2018.02.05.10.30.50; Mon, 05 Feb 2018 10:31:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754002AbeBES2a (ORCPT + 99 others); Mon, 5 Feb 2018 13:28:30 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51868 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752925AbeBESYs (ORCPT ); Mon, 5 Feb 2018 13:24:48 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A923C10E6; Mon, 5 Feb 2018 18:24:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Thomas Gleixner , David Woodhouse , Andrea Arcangeli , Andi Kleen , Ashok Raj , Jun Nakajima , David Woodhouse , Linus Torvalds , rga@amazon.de, Dave Hansen , Asit Mallick , Andy Lutomirski , Josh Poimboeuf , Jason Baron , Paolo Bonzini , Dan Williams , Arjan Van De Ven , Tim Chen Subject: [PATCH 4.15 01/60] KVM: x86: Make indirect calls in emulator speculation safe Date: Mon, 5 Feb 2018 10:22:34 -0800 Message-Id: <20180205182213.964489652@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182213.902626065@linuxfoundation.org> References: <20180205182213.902626065@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Zijlstra peterz@infradead.org commit 1a29b5b7f347a1a9230c1e0af5b37e3e571588ab Replace the indirect calls with CALL_NOSPEC. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner Reviewed-by: David Woodhouse Cc: Andrea Arcangeli Cc: Andi Kleen Cc: Ashok Raj Cc: Greg KH Cc: Jun Nakajima Cc: David Woodhouse Cc: Linus Torvalds Cc: rga@amazon.de Cc: Dave Hansen Cc: Asit Mallick Cc: Andy Lutomirski Cc: Josh Poimboeuf Cc: Jason Baron Cc: Paolo Bonzini Cc: Dan Williams Cc: Arjan Van De Ven Cc: Tim Chen Link: https://lkml.kernel.org/r/20180125095843.595615683@infradead.org Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/emulate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "x86.h" #include "tss.h" @@ -1021,8 +1022,8 @@ static __always_inline u8 test_cc(unsign void (*fop)(void) = (void *)em_setcc + 4 * (condition & 0xf); flags = (flags & EFLAGS_MASK) | X86_EFLAGS_IF; - asm("push %[flags]; popf; call *%[fastop]" - : "=a"(rc) : [fastop]"r"(fop), [flags]"r"(flags)); + asm("push %[flags]; popf; " CALL_NOSPEC + : "=a"(rc) : [thunk_target]"r"(fop), [flags]"r"(flags)); return rc; } @@ -5335,9 +5336,9 @@ static int fastop(struct x86_emulate_ctx if (!(ctxt->d & ByteOp)) fop += __ffs(ctxt->dst.bytes) * FASTOP_SIZE; - asm("push %[flags]; popf; call *%[fastop]; pushf; pop %[flags]\n" + asm("push %[flags]; popf; " CALL_NOSPEC " ; pushf; pop %[flags]\n" : "+a"(ctxt->dst.val), "+d"(ctxt->src.val), [flags]"+D"(flags), - [fastop]"+S"(fop), ASM_CALL_CONSTRAINT + [thunk_target]"+S"(fop), ASM_CALL_CONSTRAINT : "c"(ctxt->src2.val)); ctxt->eflags = (ctxt->eflags & ~EFLAGS_MASK) | (flags & EFLAGS_MASK);