Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2331171ybz; Thu, 23 Apr 2020 16:10:13 -0700 (PDT) X-Google-Smtp-Source: APiQypKT4xGWVA1SxfHu/aJgFKEC94GDuc9aDQEBiKR8iErV+5V95m63WYwXsKyPqqBmINgv/lwX X-Received: by 2002:a05:6402:319c:: with SMTP id di28mr5118791edb.185.1587683413382; Thu, 23 Apr 2020 16:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587683413; cv=none; d=google.com; s=arc-20160816; b=ebbpLLGhFEcPp35L3h+ALDDcKdOtrRPRSKOBRzTOoYfCqHVzOv9lRSKuX2TkXwXe8u IzKgVo+NzkCNGnGZ6DKLloKfX0h76llZ1pXoT4lKzIqDdy3BV4+eB0mKk7+N9eO+tKja WWtXl+fcEF1ywqXuuplpx/fB1glU+KuREmeNqTOE9v055mPgBwn2p2xfRxsNpn23j5ZH uIDPiuo1WWKYd1zmZhRpwNzpSn8mdCUEOLHCw/fEluGoVoaY67l2yyEl0+JkNTWoYj3r fxv857AqMLq2qZ0kfViaI51GY0DexE3NtVgEKZbzE3mUh5ueNQjuAgc/VljO5lR0wRpY U4Zg== 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:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=ndZ5DaA+dEOJAAtOMb5XOv33Qk3z72GJYVH6h77rzhM=; b=Je4S6CLUMm0bJbz9GdJnBU+A0QEwlmr635w/+jC2oPWln7PsH3AWuYZvcvnnpvVlRJ HnUu4hjjBN87Nh5YPYMfpTvyxL8ep3ZzOcrb9fEdZEbNEBhllDSI8TJwW28eLDpFm37d U81SXhdvYhUBNrhlhg0NDJj2vgG5pELkLqyRBbtLN76XiTXhldTbT/CtK4qMqVgVrxtc U3omZyXkC9DxqTjpbhKi4phTF6NzyHuLiaRmCLDH979Y6AP0SuendjsM5tH0x7g+3Gzp 7q9ZAT73u74mXs1yQCFpenqvmieTuhhUZBZj5vdN9GgHzQpCQcRTxiDT2F9ayykq7Utv 8ZgA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j26si2001392ejt.88.2020.04.23.16.09.50; Thu, 23 Apr 2020 16:10:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728911AbgDWXHg (ORCPT + 99 others); Thu, 23 Apr 2020 19:07:36 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51234 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728709AbgDWXHE (ORCPT ); Thu, 23 Apr 2020 19:07:04 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jRkvU-0004hm-BW; Fri, 24 Apr 2020 00:06:36 +0100 Received: from ben by deadeye with local (Exim 4.93) (envelope-from ) id 1jRkvR-00E6qI-Tl; Fri, 24 Apr 2020 00:06:33 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Arvind Sankar" , "Ingo Molnar" , "Ard Biesheuvel" , "Thomas Gleixner" , "Peter Zijlstra" , "Hans de Goede" , "Linus Torvalds" , linux-efi@vger.kernel.org Date: Fri, 24 Apr 2020 00:06:07 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 140/245] x86/efistub: Disable paging at mixed mode entry In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.83-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Ard Biesheuvel commit 4911ee401b7ceff8f38e0ac597cbf503d71e690c upstream. The EFI mixed mode entry code goes through the ordinary startup_32() routine before jumping into the kernel's EFI boot code in 64-bit mode. The 32-bit startup code must be entered with paging disabled, but this is not documented as a requirement for the EFI handover protocol, and so we should disable paging explicitly when entering the kernel from 32-bit EFI firmware. Signed-off-by: Ard Biesheuvel Cc: Arvind Sankar Cc: Hans de Goede Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Link: https://lkml.kernel.org/r/20191224132909.102540-4-ardb@kernel.org Signed-off-by: Ingo Molnar Signed-off-by: Ben Hutchings --- arch/x86/boot/compressed/head_64.S | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -216,6 +216,11 @@ ENTRY(efi32_stub_entry) leal efi32_config(%ebp), %eax movl %eax, efi_config(%ebp) + /* Disable paging */ + movl %cr0, %eax + btrl $X86_CR0_PG_BIT, %eax + movl %eax, %cr0 + jmp startup_32 ENDPROC(efi32_stub_entry) #endif