From nobody Thu Apr 9 17:57:51 2026 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36E2C3ED5AF for ; Fri, 6 Mar 2026 15:57:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772812647; cv=none; b=pnb5LhbXZIybwy0sulC2TKpoFQYPtOXf9eZA6xAmIAdMqhjpKvVKfbKGR9Q7CV9kEzBBDoaGR8n7YnV4ZXZnGJjJhxZO7drgRH1FKXTeG8VyC1X9vPzK+zvppE8xjQ+GvmU3lLs41/1gpbO49lR7jBamSCLENjfLNu2xSLCwa9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772812647; c=relaxed/simple; bh=1307fs8XamZL7Wt4P7DAyoEiTy4wLKbb450ovEmio6c=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JWs+ZyA5BWQ9FM6MgjyhR3Mr2kg6GUj60ktAg4gDpLPtcQXmxQyHYb5T9WV/OuAnD/vlxV63JvDAtT+KAEn3LeUcPhxhjLTVWLq6qjNGQeyU37OLX3APKlkD//FMUbesqsu9o4nA5rXRBdgNBkQTohvgNArdrsIV4v+GCZ31UYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1DUzqCeS; arc=none smtp.client-ip=209.85.208.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1DUzqCeS" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-661420734b7so3206699a12.1 for ; Fri, 06 Mar 2026 07:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772812645; x=1773417445; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ITFaBcrhAJjnw7yibj9RtbA12e7zZ2KLF2hSYHPAq2I=; b=1DUzqCeS8B/IjLVaizt1/eohVHy/KXXvtVMaeUf7dothdA7+IFrm8yQ691KUzFbCWX HitZVc3hssCJPbISnfM9Uxaps7yb4+mBjH5RQcBKZa2m3N6gsfFR6pGuRg6JWAsVBLdq ABvZIvORNFamUMLmQj2ayhqf0IX+8GGSdXs4Qd9mCiLSkhJD0vEIsaMrTV4pefb5eTTQ ymA43iwCzlejfspU0S8F7FuwhcOmulvbNeDOPkPi5lwhlpF2IIobUxSRKm91Xdi69hEP rb8w4PHs+PJvyC8BaMxOwSVXaHLLyBQ7rBH+KmbaUEwM3HYUlSCUUMF/QGU+uwN9vv7t T2AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772812645; x=1773417445; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ITFaBcrhAJjnw7yibj9RtbA12e7zZ2KLF2hSYHPAq2I=; b=QQhRhjX7WpPoCEV16vdHFZMwRewYtqL7LQdmYambqirzKTIA91ujGxprPouC17wPuF V/PAaAnfG7uhEJ13/ASDywD6Wc6GDgP472pZc2He/OJJWQ5oApYaDXmyUN2OI0A/P2Fa 66DusViImsdgH8MVSrB5yJZgdwuUTdtAHO9/M1xG0gFJqkKPmSJ5yzeUf6swnBFnjx4P XTlCDWUeP5juhrJk29qLlpJioLu+tFhxCtu6W3PUqHhMj3ktP8vxYelrNiqa5aLnXkEo UgmUS/xErI2TpMKewDmuQw2R279W8SD1CrZaRKpRMRUP7DsMMwSLdKcTOlIOEfwJP6Zp 7cUg== X-Gm-Message-State: AOJu0YyhDKKAvDSd+iXSNN5QxuCDGTZv82EiojEdeFChH4opdocIcBEC oQYyTxdvZdZRA29432xE4MzQ1BvnV2yztd/wHQSr0yyBJWnGNxfQ/1+XhHCEwZUVmSqlG7f8hn1 vB9T1IqcjOhofLiVnCxILt2bedpR8cA2f9NrTMu3ntnNi+faE+njpK1gk0dbY+wp8/p3m4GvyW5 AY6D93sSzBiKM1CiAIdKovRtQg1cLpKGUE3w== X-Received: from edqi7.prod.google.com ([2002:aa7:c707:0:b0:660:a86d:ee96]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:1d48:b0:65f:9c21:e68e with SMTP id 4fb4d7f45d1cf-6619d45a9f3mr1570773a12.5.1772812644211; Fri, 06 Mar 2026 07:57:24 -0800 (PST) Date: Fri, 6 Mar 2026 16:57:10 +0100 In-Reply-To: <20260306155703.815272-12-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260306155703.815272-12-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1533; i=ardb@kernel.org; h=from:subject; bh=St8MkQamdXukXyHB8ojHbIf0pOg2QO7eOCnOt3Cl8f4=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIXPVz+CVD+fP4+i6r3Wi7v251sMnTjQ8KnHqamUQ8N79e P7/xhV+HaUsDGJcDLJiiiwCs/++23l6olSt8yxZmDmsTCBDGLg4BWAiEz4wMqwUZH/2NTM5e0PP r/ouez3NlUsSd3RdTNy85FtVg3hn+F2Gf/o9l6dODjv/VvipXfPWxfEW+gz/RNc9ZDTJlt/U9/u OJS8A X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260306155703.815272-18-ardb+git@google.com> Subject: [RFC PATCH 5/9] x86/efi: Unmap kernel-reserved boot regions from EFI page tables From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, x86@kernel.org, Ard Biesheuvel , "Mike Rapoport (Microsoft)" , Benjamin Herrenschmidt Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Currently, the logic that unmaps boot services code and data regions that were mapped temporarily to work around firmware bugs disregards regions that have been marked as EFI_MEMORY_RUNTIME. However, such regions only have significance to the OS, and there is no reason the retain the mapping in the EFI page tables, given that the runtime firmware must never touch those regions. So pull the unmap forward. Signed-off-by: Ard Biesheuvel --- arch/x86/platform/efi/quirks.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index 58d00ffb1d59..e72e8b23598e 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c @@ -442,12 +442,6 @@ void __init efi_unmap_boot_services(void) continue; } =20 - /* Do not free, someone else owns it: */ - if (md->attribute & EFI_MEMORY_RUNTIME) { - num_entries++; - continue; - } - /* * Before calling set_virtual_address_map(), EFI boot services * code/data regions were mapped as a quirk for buggy firmware. @@ -455,6 +449,12 @@ void __init efi_unmap_boot_services(void) */ efi_unmap_pages(md); =20 + /* Do not free, someone else owns it: */ + if (md->attribute & EFI_MEMORY_RUNTIME) { + num_entries++; + continue; + } + /* * Nasty quirk: if all sub-1MB memory is used for boot * services, we can get here without having allocated the --=20 2.53.0.473.g4a7958ca14-goog