From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBoupkxLoE4LRwvQPxyyyfmiHAzddXEnJ2Bo9Ulo/BN8O9wP5xpDo3LIqYB1VlMDlaY6F7hMj ARC-Seal: i=1; a=rsa-sha256; t=1516380504; cv=none; d=google.com; s=arc-20160816; b=cRBvD7t2l07A/gQNNHKb8G3v6Zguxh1CGNLsnp+qlPS2qmOcvA63Pe0H/9LP6ixObV XPjv7qlStNOkD+2pgdWrGaoe6PaB9lRXa/DjFMU/5r0urehKSq0ApeDCdEvEjm4XeHbX Qy9q3o8sgBvuhWna/p7iqrbiKCuoIRZV8pY6QF2X3M7KrG0HLqA8KJii712JneyJT3mo hd75Vo4WI0uZ25OITmZLZS5Gc6ds6Mcq6Bwsmi3wB6+QxQgMEBhZKKhLnh0xihehqo/U 1s4W87rH8GiGPrCT2mEHff8VtfcFSMm2BIXDDi6tCRkeHYnU+y8HgJDdnmi2NoEriwWQ yRxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :arc-authentication-results; bh=Cj47A67Dbc5dfn7Rq8SnZlssYETvY8Nmv6AK6S3Rmuk=; b=m18HU5y4BCtCWSVuDmZh5qCO6TLE8JSS8FnX1OssDMMX1suuHOecwLmJosz6rP1l6t 2H/ok8oQBc3dLZhLultaazi5PNxdZLQzs8T6a50tnug5RgSL/M4Jz0PS5/NZCohfSOS2 v5W4bW47/oGL/3vaUYpXPodpUaTXuxHMc0OUtUsDj9N/m6wl3+C2zy48F97o0LR5sw3u E0C7Laen1o3pf2djrBcDcPIdnk8v8+RxDbG2cO5Ee3yt1gkRQcch1Y1HVE78RD8RXDTc nVQsaDgwjwYfakCFz7XFv1zXyIwaEvi//20EKU2YegZSqbwtouw70JtUi8r6zTX0tKsD Li5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of pbonzini@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=pbonzini@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Authentication-Results: mx.google.com; spf=pass (google.com: domain of pbonzini@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=pbonzini@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Subject: Re: [PATCH 34/35] x86/kvm: Add IBPB support To: David Woodhouse , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf Cc: linux-kernel@vger.kernel.org, Dave Hansen , Ashok Raj , Tim Chen , Andy Lutomirski , Linus Torvalds , Greg KH , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , Dan Williams , Jun Nakajima , Asit Mallick , Jason Baron References: <20180118134800.711245485@infradead.org> <20180118140153.498071980@infradead.org> <1516378093.5087.30.camel@infradead.org> From: Paolo Bonzini Message-ID: <6a1ca44c-1bbc-c3bd-094b-61f6aa873815@redhat.com> Date: Fri, 19 Jan 2018 17:48:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1516378093.5087.30.camel@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcSW1wb3J0YW50Ig==?= X-GMAIL-THRID: =?utf-8?q?1589944833614136394?= X-GMAIL-MSGID: =?utf-8?q?1590040203660570438?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On 19/01/2018 17:08, David Woodhouse wrote: > On Fri, 2018-01-19 at 16:25 +0100, Paolo Bonzini wrote: >> Without retpolines, KVM userspace is not protected from the guest >> poisoning the BTB, because there is no IBRS-barrier on the vmexit >> path. >> So there are two more IBPBs that are needed if retpolines are >> enabled: >> >> 1) in kvm_sched_out >> >> 2) at the end of vcpu_run > > Hm, yes. That does seem reasonable. Can we make it conditional so it > only happens *if* we end up back in userspace, and not for a VM-> > kernel->VM transition? We can/want/must. It's actually kvm_arch_vcpu_ioctl_run, not vcpu_run. Sorry. > And can I have a patch against > http://git.infradead.org/users/dwmw2/linux-retpoline.git/shortlog/refs/heads/ibpb-upstream > please (see the XX in that top commit too). > > I'm still putting that together, and the IBRS bits on top; getting on > an airplane to spend some more quality time with it now... I'm completely lost with all the branches... Paolo