From e9ef091f0ec463b9d84fc8ed70eb0c7180e4520c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 6 Mar 2024 19:08:13 +0200 Subject: [PATCH] [NTOS:IO] Fix affinity of PsInitialSystemProcess Add a hack to work around SMP-incompatible drivers --- ntoskrnl/ex/init.c | 3 +++ ntoskrnl/io/iomgr/iomgr.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/ntoskrnl/ex/init.c b/ntoskrnl/ex/init.c index 6393a1083f9..59bddded47c 100644 --- a/ntoskrnl/ex/init.c +++ b/ntoskrnl/ex/init.c @@ -1561,6 +1561,9 @@ Phase1InitializationDiscard(IN PVOID Context) #ifdef CONFIG_SMP /* Start Application Processors */ KeStartAllProcessors(); + + /* Set new affinity for system process */ + KeSetAffinityProcess(&PsInitialSystemProcess->Pcb, KeActiveProcessors); #endif /* Initialize all processors */ diff --git a/ntoskrnl/io/iomgr/iomgr.c b/ntoskrnl/io/iomgr/iomgr.c index 249d93b6cae..3b82254eb28 100644 --- a/ntoskrnl/io/iomgr/iomgr.c +++ b/ntoskrnl/io/iomgr/iomgr.c @@ -554,9 +554,13 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Make loader block available for the whole kernel */ IopLoaderBlock = LoaderBlock; + KeSetAffinityProcess(&PsInitialSystemProcess->Pcb, 1); + /* Load boot start drivers */ IopInitializeBootDrivers(); + KeSetAffinityProcess(&PsInitialSystemProcess->Pcb, KeActiveProcessors); + /* Call back drivers that asked for */ IopReinitializeBootDrivers();