From d992cf0ba23b866eda473f9458963ccfb9c0b9f8 Mon Sep 17 00:00:00 2001 From: "Carl J. Bialorucki" Date: Tue, 7 Oct 2025 12:17:13 -0500 Subject: [PATCH] [KMTEST] Skip tests that bugcheck on Vista (#8406) - [kmtest_drv] Increase timeout period from 10 seconds to 30 seconds. This was needed on my machine because of log spam in the kmtest:IoDeviceInterface test. I also reduced the log spam in that test, making this not necessary. However, I left it in as I figured if I ran into this issue, others may too in the future with other tests. - [kmtest:ExFastMutex] Skip concurrent fast mutex tests on Vista+. It appears that this was also causing hangs on WS03 x64 so I moved the skip logic there and combined it with the vista+ skip. - [kmtest:IoDeviceInterface] Change some traces to DPRINTs since it was creating excessive log spam that slowed down the test enough to trigger the previous timeout. - [kmtest:KeEvent] Skip concurrent event tests on Vista+. - [kmtest:KeGuardedMutex] Skip on Vista+. - [kmtest:ObType] Disable making custom object types as this is invalid on Vista+. - [kmtest:PoIrp] Skip on Vista+ (already skipped on WS03 x64). - [kmtest:SeInheritance] Skip on Vista+. --- modules/rostests/kmtests/kmtest_drv/kmtest_drv.c | 2 +- modules/rostests/kmtests/ntos_ex/ExFastMutex.c | 15 +++++++-------- .../rostests/kmtests/ntos_io/IoDeviceInterface.c | 14 +++++++------- modules/rostests/kmtests/ntos_io/IoInterrupt.c | 3 +++ modules/rostests/kmtests/ntos_ke/KeEvent.c | 3 +++ modules/rostests/kmtests/ntos_ke/KeGuardedMutex.c | 3 +++ modules/rostests/kmtests/ntos_ob/ObType.c | 13 ++++++++++--- modules/rostests/kmtests/ntos_po/PoIrp_user.c | 11 +++++------ modules/rostests/kmtests/ntos_se/SeInheritance.c | 3 +++ 9 files changed, 42 insertions(+), 25 deletions(-) diff --git a/modules/rostests/kmtests/kmtest_drv/kmtest_drv.c b/modules/rostests/kmtests/kmtest_drv/kmtest_drv.c index ef19a2af8e3..aed71de5e5f 100644 --- a/modules/rostests/kmtests/kmtest_drv/kmtest_drv.c +++ b/modules/rostests/kmtests/kmtest_drv/kmtest_drv.c @@ -58,7 +58,7 @@ static PDEVICE_OBJECT MainDeviceObject; PDRIVER_OBJECT KmtDriverObject = NULL; static KMT_USER_WORK_LIST WorkList; static ULONG RequestId = 0; -static const LONGLONG TimeoutDuration = -10LL * (1000 * 1000 * 10); // 10 seconds +static const LONGLONG TimeoutDuration = -30LL * (1000 * 1000 * 10); // 30 seconds /* Entry */ /** diff --git a/modules/rostests/kmtests/ntos_ex/ExFastMutex.c b/modules/rostests/kmtests/ntos_ex/ExFastMutex.c index 76eaa71f10c..a73c2b7d650 100644 --- a/modules/rostests/kmtests/ntos_ex/ExFastMutex.c +++ b/modules/rostests/kmtests/ntos_ex/ExFastMutex.c @@ -255,6 +255,13 @@ TestFastMutexConcurrent( LARGE_INTEGER Timeout; Timeout.QuadPart = -50 * MILLISECOND; +#ifdef _M_AMD64 + if (skip(FALSE, "ROSTESTS-367: Skipping TestFastMutexConcurrent() because it hangs on Windows Server 2003 x64-Testbot.\n")) +#else + if (skip(GetNTVersion() < _WIN32_WINNT_VISTA, "TestFastMutexConcurrent() doesn't work on Vista+.\n")) +#endif + return; + InitThreadData(&ThreadData, Mutex, ExAcquireFastMutex, NULL, ExReleaseFastMutex); InitThreadData(&ThreadData2, Mutex, ExAcquireFastMutex, NULL, ExReleaseFastMutex); InitThreadData(&ThreadDataUnsafe, Mutex, ExAcquireFastMutexUnsafe, NULL, ExReleaseFastMutexUnsafe); @@ -310,14 +317,6 @@ TestFastMutexConcurrent( START_TEST(ExFastMutex) { -#if defined(_M_AMD64) - if (TRUE) - { - skip(FALSE, "ROSTESTS-367: Skipping kmtest:ExFastMutex because it hangs on Windows Server 2003 x64-Testbot.\n"); - return; - } -#endif - FAST_MUTEX Mutex; KIRQL Irql; diff --git a/modules/rostests/kmtests/ntos_io/IoDeviceInterface.c b/modules/rostests/kmtests/ntos_io/IoDeviceInterface.c index 846c43901c6..2b2b8f2f964 100644 --- a/modules/rostests/kmtests/ntos_io/IoDeviceInterface.c +++ b/modules/rostests/kmtests/ntos_io/IoDeviceInterface.c @@ -72,7 +72,7 @@ Test_IoOpenDeviceInterfaceRegistryKey( if (skip(NT_SUCCESS(Status), "IoOpenDeviceInterfaceRegistryKey() failed: 0x%lx\n", Status)) return; - trace("IoOpenDeviceInterfaceRegistryKey() success: 0x%p\n", DeviceInterfaceKey); + DPRINT("IoOpenDeviceInterfaceRegistryKey() success: 0x%p\n", DeviceInterfaceKey); for (n = 0; n < RTL_NUMBER_OF(Types); ++n) { @@ -96,7 +96,7 @@ Test_IoOpenDeviceInterfaceRegistryKey( if (skip(NT_SUCCESS(Status), "ZwCreateKey() failed to create a subkey: %d 0x%lx\n", n, Status)) continue; - trace("ZwCreateKey(): successfully created subkey: %d 0x%p\n", n, DeviceInterfaceSubKey); + DPRINT("ZwCreateKey(): successfully created subkey: %d 0x%p\n", n, DeviceInterfaceSubKey); ZwDeleteKey(DeviceInterfaceSubKey); ZwClose(DeviceInterfaceSubKey); @@ -123,7 +123,7 @@ Test_IoGetDeviceInterfaceAlias( if (skip(NT_SUCCESS(Status), "IoGetDeviceInterfaceAlias(): fail: %d 0x%x\n", n, Status)) continue; - trace("IoGetDeviceInterfaceAlias(): success: %d %wZ\n", n, &AliasSymbolicLinkName); + DPRINT("IoGetDeviceInterfaceAlias(): success: %d %wZ\n", n, &AliasSymbolicLinkName); /* Test IoOpenDeviceInterfaceRegistryKey with alias symbolic link too */ Test_IoOpenDeviceInterfaceRegistryKey(AliasSymbolicLinkName.Buffer); @@ -149,7 +149,7 @@ Test_IoSetDeviceInterfaceState( if (skip(NT_SUCCESS(Status), "IoSetDeviceInterfaceState(): failed to enable interface: %d 0x%x\n", n, Status)) continue; - trace("IoSetDeviceInterfaceState(): successfully enabled interface: %d %wZ\n", n, &SymbolicLinkName); + DPRINT("IoSetDeviceInterfaceState(): successfully enabled interface: %d %wZ\n", n, &SymbolicLinkName); } } @@ -172,14 +172,14 @@ Test_IoGetDeviceInterfaces( return; } - trace("IoGetDeviceInterfaces '%wZ' results:\n", &GuidString); + DPRINT("IoGetDeviceInterfaces '%wZ' results:\n", &GuidString); RtlFreeUnicodeString(&GuidString); for (SymbolicLink = SymbolicLinkList; SymbolicLink[0] != UNICODE_NULL; SymbolicLink += wcslen(SymbolicLink) + 1) { - trace("Symbolic Link: %S\n", SymbolicLink); + DPRINT("Symbolic Link: %S\n", SymbolicLink); Test_IoGetDeviceInterfaceAlias(SymbolicLink); Test_IoOpenDeviceInterfaceRegistryKey(SymbolicLink); Test_IoSetDeviceInterfaceState(SymbolicLink); @@ -209,7 +209,7 @@ NotificationCallback( ok_eq_uint(Notification->Size, sizeof(*Notification)); /* symbolic link must exist */ - trace("Interface change: %wZ\n", Notification->SymbolicLinkName); + DPRINT("Interface change: %wZ\n", Notification->SymbolicLinkName); InitializeObjectAttributes(&ObjectAttributes, Notification->SymbolicLinkName, OBJ_KERNEL_HANDLE, diff --git a/modules/rostests/kmtests/ntos_io/IoInterrupt.c b/modules/rostests/kmtests/ntos_io/IoInterrupt.c index 9b82b020f1d..347d8abe7d3 100644 --- a/modules/rostests/kmtests/ntos_io/IoInterrupt.c +++ b/modules/rostests/kmtests/ntos_io/IoInterrupt.c @@ -56,6 +56,9 @@ TestSynchronizeExecution(VOID) KSPIN_LOCK ActualLock; BOOLEAN Ret; + if (skip(GetNTVersion() < _WIN32_WINNT_VISTA, "We can't create fake interrupts on Vista+.\n")) + return; + RtlFillMemory(&Interrupt, sizeof Interrupt, 0x55); Interrupt.ActualLock = &ActualLock; KeInitializeSpinLock(Interrupt.ActualLock); diff --git a/modules/rostests/kmtests/ntos_ke/KeEvent.c b/modules/rostests/kmtests/ntos_ke/KeEvent.c index 65e3a0830c2..c2344ea79bb 100644 --- a/modules/rostests/kmtests/ntos_ke/KeEvent.c +++ b/modules/rostests/kmtests/ntos_ke/KeEvent.c @@ -160,6 +160,9 @@ TestEventConcurrent( LongTimeout.QuadPart = -100 * MILLISECOND; ShortTimeout.QuadPart = -1 * MILLISECOND; + if (skip(GetNTVersion() < _WIN32_WINNT_VISTA, "TestEventConcurrent() is broken on Vista+.\n")) + return; + KeInitializeEvent(Event, Type, FALSE); for (i = 0; i < ThreadCount; ++i) diff --git a/modules/rostests/kmtests/ntos_ke/KeGuardedMutex.c b/modules/rostests/kmtests/ntos_ke/KeGuardedMutex.c index 9b2a79e1327..af9e50e2f17 100644 --- a/modules/rostests/kmtests/ntos_ke/KeGuardedMutex.c +++ b/modules/rostests/kmtests/ntos_ke/KeGuardedMutex.c @@ -440,6 +440,9 @@ START_TEST(KeGuardedMutex) return; } + if (skip(GetNTVersion() < _WIN32_WINNT_VISTA, "kmtest:KeGuardedMutex is broken on Vista+.\n")) + return; + for (i = 0; i < sizeof TestIterations / sizeof TestIterations[0]; ++i) { trace("Run %d\n", i); diff --git a/modules/rostests/kmtests/ntos_ob/ObType.c b/modules/rostests/kmtests/ntos_ob/ObType.c index 73f860f961f..f6737d330d9 100644 --- a/modules/rostests/kmtests/ntos_ob/ObType.c +++ b/modules/rostests/kmtests/ntos_ob/ObType.c @@ -169,7 +169,7 @@ QueryNameProc( } static -VOID +NTSTATUS ObtCreateObjectTypes(VOID) { INT i; @@ -183,6 +183,9 @@ ObtCreateObjectTypes(VOID) HANDLE ObjectTypeHandle; UNICODE_STRING ObjectPath; + if (skip(GetNTVersion() < _WIN32_WINNT_VISTA, "Custom object types are not supported on Vista+.\n")) + return STATUS_NOT_SUPPORTED; + RtlCopyMemory(&Name.DirectoryName, L"\\ObjectTypes\\", sizeof Name.DirectoryName); for (i = 0; i < NUM_OBTYPES; ++i) @@ -244,6 +247,8 @@ ObtCreateObjectTypes(VOID) ok_eq_hex(Status, STATUS_SUCCESS); ok(ObTypes[i] != NULL, "ObType = NULL\n"); } + + return STATUS_SUCCESS; } static @@ -415,10 +420,12 @@ VOID TestObjectType( IN BOOLEAN Clean) { + NTSTATUS Status; + RtlZeroMemory(&Counts, sizeof Counts); - ObtCreateObjectTypes(); - DPRINT("ObtCreateObjectTypes() done\n"); + Status = ObtCreateObjectTypes(); + DPRINT("ObtCreateObjectTypes() %s\n", NT_SUCCESS(Status) ? "succeeded" : "failed"); ObtCreateDirectory(); DPRINT("ObtCreateDirectory() done\n"); diff --git a/modules/rostests/kmtests/ntos_po/PoIrp_user.c b/modules/rostests/kmtests/ntos_po/PoIrp_user.c index 951605fb2ad..fd3b556fedf 100644 --- a/modules/rostests/kmtests/ntos_po/PoIrp_user.c +++ b/modules/rostests/kmtests/ntos_po/PoIrp_user.c @@ -12,13 +12,12 @@ START_TEST(PoIrp) { DWORD Error; -#if defined(_M_AMD64) - if (TRUE) - { - skip(FALSE, "ROSTESTS-368: Skipping kmtest:PoIrp because it crashes on Windows Server 2003 x64-Testbot.\n"); - return; - } +#ifdef _M_AMD64 + if (skip(FALSE, "ROSTESTS-368: Skipping kmtest:PoIrp because it crashes on Windows Server 2003 x64-Testbot.\n")) +#else + if (skip(GetNTVersion() < _WIN32_WINNT_VISTA, "kmtest:PoIrp is broken on Vista+.\n")) #endif + return; Error = KmtLoadAndOpenDriver(L"PoIrp", TRUE); ok_eq_int(Error, ERROR_SUCCESS); diff --git a/modules/rostests/kmtests/ntos_se/SeInheritance.c b/modules/rostests/kmtests/ntos_se/SeInheritance.c index 99e24d1114d..7d62ed06317 100644 --- a/modules/rostests/kmtests/ntos_se/SeInheritance.c +++ b/modules/rostests/kmtests/ntos_se/SeInheritance.c @@ -949,6 +949,9 @@ START_TEST(SeInheritance) { PKTHREAD Thread; + if (skip(GetNTVersion() < _WIN32_WINNT_VISTA, "kmtest:SeInheritance is broken on Vista+.\n")) + return; + TestObRootSecurity(); Thread = KmtStartThread(SystemThread, NULL); KmtFinishThread(Thread, NULL);