pve-kernel-lowlatency-qoup/patches/kernel/0023-init-Invoke-arch_cpu_finalize_init-earlier.patch
Stoiko Ivanov 9dd7462461 add fixes for downfall
by cherry-picking the relevant commits from launchpad/lunar [0].
(relevant commits are based on k.o/stable commits for this)

minimally tested by booting my (ryzen) machine with this kernel and
skimming through dmesg after boot.

[0] git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/lunar

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2023-08-16 09:56:23 +02:00

65 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Wed, 14 Jun 2023 01:39:39 +0200
Subject: [PATCH] init: Invoke arch_cpu_finalize_init() earlier
X86 is reworking the boot process so that initializations which are not
required during early boot can be moved into the late boot process and out
of the fragile and restricted initial boot phase.
arch_cpu_finalize_init() is the obvious place to do such initializations,
but arch_cpu_finalize_init() is invoked too late in start_kernel() e.g. for
initializing the FPU completely. fork_init() requires that the FPU is
initialized as the size of task_struct on X86 depends on the size of the
required FPU register buffer.
Fortunately none of the init calls between calibrate_delay() and
arch_cpu_finalize_init() is relevant for the functionality of
arch_cpu_finalize_init().
Invoke it right after calibrate_delay() where everything which is relevant
for arch_cpu_finalize_init() has been set up already.
No functional change intended.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://lore.kernel.org/r/20230613224545.612182854@linutronix.de
(backported from commit 9df9d2f0471b4c4702670380b8d8a45b40b23a7d)
[cascardo: fixed conflict due to call to mem_encrypt_init]
CVE-2022-40982
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
(cherry picked from commit 919915fc47211940789c8bde231b2f15d1b8d427)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
init/main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/init/main.c b/init/main.c
index 0370df27746f..967584e8c3af 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1111,6 +1111,9 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
late_time_init();
sched_clock_init();
calibrate_delay();
+
+ arch_cpu_finalize_init();
+
pid_idr_init();
anon_vma_init();
#ifdef CONFIG_X86
@@ -1137,8 +1140,6 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
taskstats_init_early();
delayacct_init();
- arch_cpu_finalize_init();
-
acpi_subsystem_init();
arch_post_acpi_subsys_init();
kcsan_init();