Skip to content

Commit 5692a79

Browse files
committed
Fix a crash of driver_overran_stack_buffer on Windows Insider build.
1 parent 2827487 commit 5692a79

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

ntkrutils.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,17 @@ int smp_call_function_single(int cpu, void(*func)(void *info),
357357
return 0;
358358
}
359359

360-
360+
static_assert(sizeof(KAFFINITYEX) <= 0x200, "KAFFINITYEX is bigger than 0x200");
361361
void smp_send_reschedule(int cpu)
362362
{
363-
KAFFINITYEX target;
364-
365-
pKeInitializeAffinityEx(&target);
366-
pKeAddProcessorAffinityEx(&target, cpu);
367-
pHalRequestIpi(0, &target);
363+
// This is to workaround the size change of KAFFINITY
364+
// between Windows 10 releases
365+
char __kaff[0x200];
366+
PKAFFINITYEX target = (PKAFFINITYEX)&__kaff[0];
367+
368+
pKeInitializeAffinityEx(target);
369+
pKeAddProcessorAffinityEx(target, cpu);
370+
pHalRequestIpi(0, target);
368371
}
369372

370373
enum cpuid_reg {

0 commit comments

Comments
 (0)