Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6235655ybv; Wed, 12 Feb 2020 08:25:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxLMyZoMVmsLrFvQYqdpVX4YLAhonRbeWFsFbKksMEqOzfrDrcxTrx7Lw8cVU24EiJo0AXX X-Received: by 2002:a54:4117:: with SMTP id l23mr6489330oic.140.1581524722726; Wed, 12 Feb 2020 08:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581524722; cv=none; d=google.com; s=arc-20160816; b=PH55/KVj4Vj/Teri4xxJH1z9KCBi6sxh6rOeqVqJ8wiBl7V9KfjycjmaPwPoUCAphw GhFGQSC+3Vlm+Egl98HiKmDRojUMBZLAVqMP0dmB7REos7NLNxeJEEppj/eMdzwZ41Z0 AqeCNghG76I8JvjRtz4OHzmwYoJ47OTXdbkCHuenYYga/Num/8qOt4MXUJMpWGJMczTy 20gZ8Yhix8H5kpE9WXNK21qwILHRHML+0SXSVZx9WIcoFe1W6y+fYOlagu0IVX4ztLku CAeIfmVkRNnSGWvcfMT1s9clWStp9KEMFREYq/FdJ1MvORtOipFFnPpJXZ1TDYqQIbsL Yh7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=RPf0qd07XC0OOgOapJr/kDhbr+rGuzMt9BHSs7VK5/M=; b=ThvV99tstjTJRRzqECpqFWhcKQ037Ba1qHPnnFx0QPnf8qF2BfDg2+vlrtV6Ber8zG SSu/ouS6i1vFoafxOtfsBinYKqPDx7qGpamf4enDsnSZXuHBdkf3IIzEN/P0nxpffXb3 2mM2Squbg3hUXPaN2sy5eCvvsxm6UM2CPee0v6KLB4reyQW7WVZ5z76jMPgtzPp4akTU I+5mnAW6cE2s4VWr5Ccl0r2HRyh3BtGCLfcf7RzH4kqETr4MyvN3f7+kMudws3qH/yFN G9J/aVZSCAvkLC6rSYoTq5v4S9jFmDr2Xb9Xd09R98KgNO7ss+bqklgsnGSLAREADkd6 598A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=dUeaWcB7; 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 p5si444807oto.116.2020.02.12.08.25.09; Wed, 12 Feb 2020 08:25:22 -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; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=dUeaWcB7; 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 S1728624AbgBLQX7 (ORCPT + 99 others); Wed, 12 Feb 2020 11:23:59 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43209 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbgBLQX6 (ORCPT ); Wed, 12 Feb 2020 11:23:58 -0500 Received: by mail-pg1-f194.google.com with SMTP id u12so1110149pgb.10 for ; Wed, 12 Feb 2020 08:23:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=RPf0qd07XC0OOgOapJr/kDhbr+rGuzMt9BHSs7VK5/M=; b=dUeaWcB7fuWIvEKzmYm9b+dMATUK5ExPoVF5uz+XbZrV986c/7ZUKxiELMZyxipwMD 1RUk/X2dZklh2rOUgrGjHNF1qDI1tftagxZSLDZeZzgJnXon8nHd/5ivrOWxJ2z/Quol 0fLkLJT9qUyJSI09E6JgFMkBBxxoUuFR2ZoBYCe9KrD28/tVFDRp7HJ80deMqTvy4jc2 sPljRpie80sjXVDaKmHDRm2v2lVgyQPfm43BcZ9NhdT+n3hvcOemxeUTZvQMiBPEjNiB QezheQ9VMb9FKQ0p5qNL3hcNgcu5RQovzjPUuEvlPjHBaCjFoDM0Pa5MHOxqyDTLZACA xONg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=RPf0qd07XC0OOgOapJr/kDhbr+rGuzMt9BHSs7VK5/M=; b=nHeQQZK/lMLA3qw64I3WBZUj5nXWpSbXpGOjJSxKlSs7xLETstTpRhFJmIiGHpKOT5 E8e12X6j9WSjNZZu9CzuVAg2uostGb+qKhhgguF5quZAdqtWbXR3Y3kEgt7dmMCSlli9 Bjn5rXUTMiAtRZrou/M7mBMISn9asrDoe9bVfKNscjr+8/UTBeQFJ146LS5pHKNY6RAO 4th91ukOepbk/1nomYGCTLpDFtdvgJGL95vA5qT23RlFHZgktyXiu9VrcsSJcmVPGz3l QBU9TBqOU4hxslhLu7JKjnEuk5uwgWr1lMDhq3qvNV24Sjg/ncCvdLDsKDhtYTppm+3U zksQ== X-Gm-Message-State: APjAAAVWq3SPPfPmt0GeHy38Gox0jg8pXgUm6QUac++/FrZmf4vQ8Efa aYYM0Rfp+k6LRiABZ3cBcbXF3A== X-Received: by 2002:a65:4305:: with SMTP id j5mr13799109pgq.315.1581524636923; Wed, 12 Feb 2020 08:23:56 -0800 (PST) Received: from ?IPv6:2601:646:c200:1ef2:6918:d286:95c1:bba2? ([2601:646:c200:1ef2:6918:d286:95c1:bba2]) by smtp.gmail.com with ESMTPSA id s130sm1652186pfc.62.2020.02.12.08.23.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Feb 2020 08:23:56 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 23/62] x86/idt: Move IDT to data segment Date: Wed, 12 Feb 2020 08:23:54 -0800 Message-Id: References: <20200212115516.GE20066@8bytes.org> Cc: Andy Lutomirski , X86 ML , "H. Peter Anvin" , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , LKML , kvm list , Linux Virtualization , Joerg Roedel In-Reply-To: <20200212115516.GE20066@8bytes.org> To: Joerg Roedel X-Mailer: iPhone Mail (17D50) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Feb 12, 2020, at 3:55 AM, Joerg Roedel wrote: >=20 > =EF=BB=BFOn Tue, Feb 11, 2020 at 02:41:25PM -0800, Andy Lutomirski wrote: >>> On Tue, Feb 11, 2020 at 5:53 AM Joerg Roedel wrote: >>>=20 >>> From: Joerg Roedel >>>=20 >>> With SEV-ES, exception handling is needed very early, even before the >>> kernel has cleared the bss segment. In order to prevent clearing the >>> currently used IDT, move the IDT to the data segment. >>=20 >> Ugh. At the very least this needs a comment in the code. >=20 > Yes, right, added a comment for that. >=20 >> I had a patch to fix the kernel ELF loader to clear BSS, which would >> fix this problem once and for all, but it didn't work due to the messy >> way that the decompressor handles memory. I never got around to >> fixing this, sadly. >=20 > Aren't there other ways of booting (Xen-PV?) which don't use the kernel > ELF loader? Dunno. I would hope the any sane loader would clear BSS before executing any= thing. This isn=E2=80=99t currently the case, though. Oh well. >=20 > Regards, >=20 > Joerg