Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp78263ybh; Tue, 14 Jul 2020 18:30:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB5a2sPHWoVcUWXsBjVYI5U+k7IGFrAQJrKyew2waMnKqYQpZxJfB58UL1k35wHQbmdyFR X-Received: by 2002:aa7:da06:: with SMTP id r6mr7404180eds.189.1594776623751; Tue, 14 Jul 2020 18:30:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594776623; cv=none; d=google.com; s=arc-20160816; b=VUH6+U0wOmahwBGHAB9gB7e2ZtC3OrhzrxVPOlf3lVsAdWpNjWitO1hbyh7WWxBVTd WQiZiNcy5vti1IvCKIKWFGQTv8Q4IeLC9FvfQ5eZOUwOA+v5lEQRotiiGobpS8Tx2lVd Uk3b9KBMnDxu+BFSh6MqgyCvOVZxYYBUZGLQUWXXYXdpwzBWWuxssYX4zpJeCGiP10cq lnv5K78tN5d85zdYTrvsObySk61BiNFj0jm7atZ0XCbNX7+jKhMtCdyv5tmMm2dtAVoq rYSJo8uptC0HCFXF5M/461sWYyLCcuvrDu054Gsql8v1O/BI9+zrSptyt6iunSwV+Ezj 4Iyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=AtJMt5D7K9C8ql3zYlKfD8mfXyjKfGo9YIHofl3GNr8=; b=knKmwwpllW7J6vMzuS4xIK9ZI8YQqSAHy77kcKVjfm/3Ekx1IbRmeTk8gk9tkdyhT+ Q3f6B1KcKjfzuaxJQmlOpcwuXYOZFK4Kr1AVFHWIoYvhMlggnVsuPWmAfNdeq8zy9rlp 88PXcLSUL6MRnkBw9CJptHpZszET48foubsgU/EDh3GlI09vMtVf2ZL3K5ynkKCbCZjA 4Z/DNhmFzqNs5uUA2pdH+rT0WzvwlcfKE4UZ0aA5LlwGhO3fCuOu6bqnEPOEO9Xad+uS y2YHiB1dW/IsuSZqh459UuxVzH+z2u/npwjDgsb5Vlf/kBNYdSoiX8OjdOBGsz+xwNCQ KEfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=i6mXzKcI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id re8si265519ejb.627.2020.07.14.18.29.59; Tue, 14 Jul 2020 18:30:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=i6mXzKcI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728097AbgGOBXu (ORCPT + 99 others); Tue, 14 Jul 2020 21:23:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728082AbgGOBXt (ORCPT ); Tue, 14 Jul 2020 21:23:49 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BD33C061794 for ; Tue, 14 Jul 2020 18:23:49 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id d4so866841pgk.4 for ; Tue, 14 Jul 2020 18:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AtJMt5D7K9C8ql3zYlKfD8mfXyjKfGo9YIHofl3GNr8=; b=i6mXzKcIDfBhhNQRvvLg/C5UGIuMlqAh1ph4H7eqkHJDr7PuMbMBuSDLs83TP38yNB bTsbdAYiN8TVCvUTf3i2k44uwugHJxge/2LYPfWuuLuZ5XRPEeLUIzXPA7TaZAK1f0EG p+aeuoS5JQmDj4VQ5zoywN6JsJUFdTahr99K8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AtJMt5D7K9C8ql3zYlKfD8mfXyjKfGo9YIHofl3GNr8=; b=diZLgqMO6BifcYTG3APZPUX6tdTkM1sAgb5bRNGrlUToNNfaImfTiGtXm7GETEba9F zZ0cDLBzGNHtn3yp1oq7HnxFhoBAKXoSpnHObg74BIo0f1/XOt2Goaid1PbzcAIn7wBO BQRDO3V88psB098mFBPZtfz9TxB/VyHEL41emPhi0Y9LImzyC7hDdJXfzz2EYddNB276 CB1yVDhsRZOEysriuJS40B1YucvI8UM8nghqcY/lLgYLbdEcO3jE3ZnztMsi2oUvz1gb Mjm1KFIo6RUOPdPMto+lF5zQUDaLtdlwfqzWWoO49oVpUTHoN2nQ57Z6mB+dbrhzvQj8 3O6A== X-Gm-Message-State: AOAM531EJQ48Yr0R+Q/thOZ2AVRcN+SbCT8RWEvFA896n6CIr3Vp7CwG D+5eh50mwkQPQwLeNlCTFDNOvQ== X-Received: by 2002:a05:6a00:2bc:: with SMTP id q28mr6683696pfs.250.1594776229062; Tue, 14 Jul 2020 18:23:49 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id m3sm325734pfk.171.2020.07.14.18.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 18:23:48 -0700 (PDT) Date: Tue, 14 Jul 2020 18:23:47 -0700 From: Kees Cook To: Joerg Roedel Cc: x86@kernel.org, Joerg Roedel , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v4 15/75] x86/boot/compressed/64: Always switch to own page-table Message-ID: <202007141823.326D9DC102@keescook> References: <20200714120917.11253-1-joro@8bytes.org> <20200714120917.11253-16-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200714120917.11253-16-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 14, 2020 at 02:08:17PM +0200, Joerg Roedel wrote: > From: Joerg Roedel > > When booted through startup_64 the kernel keeps running on the EFI > page-table until the KASLR code sets up its own page-table. Without > KASLR the pre-decompression boot code never switches off the EFI > page-table. Change that by unconditionally switching to a kernel > controlled page-table after relocation. > > This makes sure we can make changes to the mapping when necessary, for > example map pages unencrypted in SEV and SEV-ES guests. > > Also remove the debug_putstr() calls in initialize_identity_maps() > because the function now runs before console_init() is called. > > Signed-off-by: Joerg Roedel Reviewed-by: Kees Cook -- Kees Cook