[NTOS:KE/x64] On syscalls clear nested task flag

When this flag is not cleared and the system returns with an IRET, this causes a #GP. Randomly hit by the umkm:SystemCall test.
This commit is contained in:
Timo Kreuzer 2024-04-24 19:46:23 +03:00
parent 701b0a3f24
commit b8e50f787d

View file

@ -218,7 +218,7 @@ KiInitializeCpu(PKIPCR Pcr)
((ULONG64)(KGDT64_R3_CMCODE|RPL_MASK) << 48)); ((ULONG64)(KGDT64_R3_CMCODE|RPL_MASK) << 48));
/* Set the flags to be cleared when doing a syscall */ /* Set the flags to be cleared when doing a syscall */
__writemsr(MSR_SYSCALL_MASK, EFLAGS_IF_MASK | EFLAGS_TF | EFLAGS_DF); __writemsr(MSR_SYSCALL_MASK, EFLAGS_IF_MASK | EFLAGS_TF | EFLAGS_DF | EFLAGS_NESTED_TASK);
/* Enable syscall instruction and no-execute support */ /* Enable syscall instruction and no-execute support */
__writemsr(MSR_EFER, __readmsr(MSR_EFER) | MSR_SCE | MSR_NXE); __writemsr(MSR_EFER, __readmsr(MSR_EFER) | MSR_SCE | MSR_NXE);