Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8533882rwb; Thu, 24 Nov 2022 00:25:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Ryip1P7Gbr6Aik369th18pP4FOt9wSI67I8pyhWLo+NnlRor9UNc3rhKjkca2+tYcYINq X-Received: by 2002:a17:902:ab8d:b0:17f:8232:257a with SMTP id f13-20020a170902ab8d00b0017f8232257amr13575945plr.138.1669278302965; Thu, 24 Nov 2022 00:25:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669278302; cv=none; d=google.com; s=arc-20160816; b=cMXW38f/RuvSlpkokinNWzDpXrzbS1lqEXCf3ejto9qSXMoZpW7EvUfd38nci7/IEL aTV9y0q5dys/IpxXufYf4p5eHNS6iqpSGnOcBU3Mzo4D30rawa46C69XxGHusEcJkBUt KIv5LU2O4BK9rH4sBP5hkjcajIEkbMOk0FjFOwyUSlHZSqVXdte0SCNi/ZMmr+N/Wm2R pDnubgCXhQfPoznBzXlZUesLwseEFOggEokW1Jl+HExjd5dzD0+fXbY8bKhto4pcK/m7 xvGi7r3zOFoXbfe2T50O5/B2hkXXGSQfzdabYRTcozCKzpZfafBlyZC4mrOE16mhKmom NIaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=8Hctjbwsd0uBSMqUV8yljvfkYsL5QCM1MfC9VCsHYa8=; b=upl2rikMCuPSG+BXit5gny5QqZCkxuao5E+whbxf3vISpAvdGXyR4AXh9g9vOVqijI nyugHKD8EeXTEfARUaMfPfKlpddTElx3Nw3ZKWak6GvsdCz7ODBfepERxT4QJzBA8b0w BGZgIrU3BZIV0FBElzzbs9C87rVCCqNRYmdTYnDEGyitVY0mlgUteLQMpi4Jgi4DZr/x SjKECtJd36rndUsxtHRPdym7njQGorwwWf/Up2bMOiRLwjXLDRyk2F8GsftiQebvwe6Q bi89PyFEq9JA2YuKSNW0tNZL6A4qoBrW+45Cu4m25SAjzDt9RQMlOqjPs7x/ZK/hchqm K0rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=x620PPjq; dkim=neutral (no key) header.i=@linutronix.de header.b=tTDucwqd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a170903410b00b00176939b5cd9si361196pld.578.2022.11.24.00.24.51; Thu, 24 Nov 2022 00:25:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=x620PPjq; dkim=neutral (no key) header.i=@linutronix.de header.b=tTDucwqd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229934AbiKXINZ (ORCPT + 87 others); Thu, 24 Nov 2022 03:13:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbiKXIMh (ORCPT ); Thu, 24 Nov 2022 03:12:37 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89208ED738; Thu, 24 Nov 2022 00:12:08 -0800 (PST) Date: Thu, 24 Nov 2022 08:12:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669277527; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Hctjbwsd0uBSMqUV8yljvfkYsL5QCM1MfC9VCsHYa8=; b=x620PPjqof6ZOEWpPmGKXwl5XRfzK2nFOCJ2/rKvj7kJSx3TougSLeIUO4plDl2pd1O5g6 eaQVism2RV0hHrES5hR5RYenqxZL3S7IUghOAwe/GQ9dDp2pX0f0UqH04pUeZEj7CMWYT3 zPP2A3bEm1QbEAJ8UV1p8yp7GrCaUBJi5slI9NKU4HkfQ/D+fPzb39dF2MHouIVxz6TcOo nnPsU/1eIgeRjAGNbm5Htpr7QpWGpwQAuSGXrWRuF5npYYDqLr9DHe/JNbBuSz5rt3owfU WRjWLob4FCrupuVgFKjqYv43WMIWA4c/VxCciNAaOI77cdMjmziWPKQiRcfa1w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669277527; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Hctjbwsd0uBSMqUV8yljvfkYsL5QCM1MfC9VCsHYa8=; b=tTDucwqd530QlJ6Rqfi/1VMxqy6u0urXXasU49ZxMk4ZGW+shLbqEJ0QcZG1K7z8oVY2xG lC9l8unxWnL38xCQ== From: "tip-bot2 for Ard Biesheuvel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/boot/compressed: Pull global variable reference into startup32_load_idt() Cc: Ard Biesheuvel , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221122161017.2426828-11-ardb@kernel.org> References: <20221122161017.2426828-11-ardb@kernel.org> MIME-Version: 1.0 Message-ID: <166927752601.4906.14123818251261144320.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/boot branch of tip: Commit-ID: d73a257f7f86871c3aac24dc20538e3983096647 Gitweb: https://git.kernel.org/tip/d73a257f7f86871c3aac24dc20538e3983096647 Author: Ard Biesheuvel AuthorDate: Tue, 22 Nov 2022 17:10:10 +01:00 Committer: Borislav Petkov CommitterDate: Thu, 24 Nov 2022 08:57:41 +01:00 x86/boot/compressed: Pull global variable reference into startup32_load_idt() In preparation for moving startup32_load_idt() out of head_64.S and turning it into an ordinary function using the ordinary 32-bit calling convention, pull the global variable reference to boot32_idt up into startup32_load_idt() so that startup32_set_idt_entry() does not need to discover its own runtime physical address, which will no longer be correlated with startup_32 once this code is moved into .text. While at it, give startup32_set_idt_entry() static linkage. Signed-off-by: Ard Biesheuvel Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20221122161017.2426828-11-ardb@kernel.org --- arch/x86/boot/compressed/head_64.S | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index a2d1c03..f9926b3 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -728,16 +728,11 @@ SYM_DATA_END_LABEL(boot32_idt, SYM_L_GLOBAL, boot32_idt_end) * * %eax: Handler address * %edx: Vector number - * - * Physical offset is expected in %ebp + * %ecx: IDT address */ -SYM_FUNC_START(startup32_set_idt_entry) - push %ebx - - /* IDT entry address to %ebx */ - leal rva(boot32_idt)(%ebp), %ebx - shl $3, %edx - addl %edx, %ebx +SYM_FUNC_START_LOCAL(startup32_set_idt_entry) + /* IDT entry address to %ecx */ + leal (%ecx, %edx, 8), %ecx /* Build IDT entry, lower 4 bytes */ movl %eax, %edx @@ -745,7 +740,7 @@ SYM_FUNC_START(startup32_set_idt_entry) orl $(__KERNEL32_CS << 16), %edx # Target code segment selector /* Store lower 4 bytes to IDT */ - movl %edx, (%ebx) + movl %edx, (%ecx) /* Build IDT entry, upper 4 bytes */ movl %eax, %edx @@ -753,15 +748,16 @@ SYM_FUNC_START(startup32_set_idt_entry) orl $0x00008e00, %edx # Present, Type 32-bit Interrupt Gate /* Store upper 4 bytes to IDT */ - movl %edx, 4(%ebx) + movl %edx, 4(%ecx) - pop %ebx RET SYM_FUNC_END(startup32_set_idt_entry) #endif SYM_FUNC_START(startup32_load_idt) #ifdef CONFIG_AMD_MEM_ENCRYPT + leal rva(boot32_idt)(%ebp), %ecx + /* #VC handler */ leal rva(startup32_vc_handler)(%ebp), %eax movl $X86_TRAP_VC, %edx