From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3730AC3A5A9 for ; Mon, 4 May 2020 11:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F0382073B for ; Mon, 4 May 2020 11:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728492AbgEDL1M (ORCPT ); Mon, 4 May 2020 07:27:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:59112 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726445AbgEDL1L (ORCPT ); Mon, 4 May 2020 07:27:11 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 00A8CADD3; Mon, 4 May 2020 11:27:10 +0000 (UTC) Date: Mon, 4 May 2020 13:27:06 +0200 From: Joerg Roedel To: Borislav Petkov Cc: Joerg Roedel , x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v3 12/75] x86/boot/compressed/64: Switch to __KERNEL_CS after GDT is loaded Message-ID: <20200504112706.GG8135@suse.de> References: <20200428151725.31091-1-joro@8bytes.org> <20200428151725.31091-13-joro@8bytes.org> <20200504104129.GD15046@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200504104129.GD15046@zn.tnic> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, May 04, 2020 at 12:41:29PM +0200, Borislav Petkov wrote: > On Tue, Apr 28, 2020 at 05:16:22PM +0200, Joerg Roedel wrote: > > + /* Reload CS so IRET returns to a CS actually in the GDT */ > > + pushq $__KERNEL_CS > > + leaq .Lon_kernel_cs(%rip), %rax > > + pushq %rax > > + lretq > > + > > +.Lon_kernel_cs: > > + > > /* > > * paging_prepare() sets up the trampoline and checks if we need to > > * enable 5-level paging. > > -- > > So I'm thinking I should take this one even now on the grounds that > it sanitizes CS to something known-good than what was there before and > who knows what set it and loaded the kernel...? > > And that is a good thing in itself. Right, sure. CS is basically undefined at this point and depends on what loaded the kernel (EFI, legacy boot code, some container runtime...), so setting it to something known is definitly good. Regards, Joerg