Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1200022pxb; Wed, 10 Feb 2021 02:37:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVgs41+uppq8MJWQ9C7ABsM9eXfL+aXfS8CA07K46wfWL1fJVR2+Lz2pLJPzZxDPyDEsCv X-Received: by 2002:a17:906:f2ca:: with SMTP id gz10mr2218117ejb.285.1612953448777; Wed, 10 Feb 2021 02:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612953448; cv=none; d=google.com; s=arc-20160816; b=B4ak68YZQGd5EaD2DH0UGEtV2GwOg5FIYWro9IKPNqKfuis8T+CrCa2+Lx9ZDeFrO6 gP54xQuZ8kLAloLwiS4mt3WhlsMCu0GWIXbNYDfh+LThfMxpj47IfHRdlV4zVGWPIjxg s0VnP13NU9QAP93zWeGp2xQDiBbCePP5mtsuwLwOicaJHmmjKVibS4Hg8rvGKxBvctRf Rqjr0yjXeRLJqauLw2oX1JhtL33Y8ijBM8PuomXZQNL8DZNkOwWHI/0FNNk6tLFU+1LU oHE0dx/kp/M69gBM5ZQOC0rEl+sFOirhc/wS3G8K1mxCg29MIVUfazGOlsITWkooZk6G Vkgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WEm5fYqJSb8tOpH4dY6BOc7w+8OCqPadaeVctQSTSE0=; b=Ymo7qsb0Wize3RntZo0R1dFKzt/UnG4aKM4Weag5hhl5nGn8dMKLorON+k80w4lq7B u1zj2gyBQM0iwJJ5X9GDYWuWL2UhmZmB8OFZpC9FdXFGKME3TbmpLVHwlxu4NMTmPyVs o9ttaXrumxZ8ardHsflNbjjpz26t5zq9oeIf4QJUdUc1Ppo3WdrRt+GHhiHmDed1zX7G NuNnzvNzr0z88EKYBwvMLui5XMsaQuyLxoQUJgVrzGz1MpEm4A2Hug9AXq/Vm/THznd8 e10Sd4KBwNYjy/TTxGx0UpXwri7maFvrdwMYJuc8QmL3HwY+GgnGMFkKOiXEkf28aGGw H0hw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kd16si1006584ejc.14.2021.02.10.02.37.03; Wed, 10 Feb 2021 02:37:28 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231195AbhBJKd7 (ORCPT + 99 others); Wed, 10 Feb 2021 05:33:59 -0500 Received: from 8bytes.org ([81.169.241.247]:55104 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbhBJKWj (ORCPT ); Wed, 10 Feb 2021 05:22:39 -0500 Received: from cap.home.8bytes.org (p549adcf6.dip0.t-ipconnect.de [84.154.220.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 021BC3C2; Wed, 10 Feb 2021 11:21:55 +0100 (CET) From: Joerg Roedel To: x86@kernel.org Cc: Joerg Roedel , Joerg Roedel , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , Arvind Sankar , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 2/7] x86/boot/compressed/64: Reload CS in startup_32 Date: Wed, 10 Feb 2021 11:21:30 +0100 Message-Id: <20210210102135.30667-3-joro@8bytes.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210102135.30667-1-joro@8bytes.org> References: <20210210102135.30667-1-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Exception handling in the startup_32 boot path requires the CS selector to be correctly set up. Reload it from the current GDT. Signed-off-by: Joerg Roedel --- arch/x86/boot/compressed/head_64.S | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index e94874f4bbc1..c59c80ca546d 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -107,9 +107,16 @@ SYM_FUNC_START(startup_32) movl %eax, %gs movl %eax, %ss -/* setup a stack and make sure cpu supports long mode. */ + /* Setup a stack and load CS from current GDT */ leal rva(boot_stack_end)(%ebp), %esp + pushl $__KERNEL32_CS + leal rva(1f)(%ebp), %eax + pushl %eax + lretl +1: + + /* Make sure cpu supports long mode. */ call verify_cpu testl %eax, %eax jnz .Lno_longmode -- 2.30.0