[NTOSKRNL]

Modify the ret8 interrupt return path in KiTrapExitStub, so that nested interrupts (e.g. as a result of an interrupt storm from a broken driver) will work more "like on Windows", i.e., now the broken driver will not cause stack exhaustion anymore, but a proper system hang! And it will be an even more efficient system hang than Windows has! This is not the '90s. You can't just walk up and crash the system, you have to do something cool first and do it properly "like Windows does", even if you're not using the same assembly instructions.

svn path=/trunk/; revision=71174
This commit is contained in:
Timo Kreuzer 2016-04-16 22:38:11 +00:00
parent a976f17441
commit b5478dccca

View file

@ -264,6 +264,8 @@ ENDM
#define KI_RESTORE_VOLATILES (KI_RESTORE_EAX OR KI_RESTORE_ECX_EDX)
MACRO(KiTrapExitStub, Name, Flags)
LOCAL ret8_instruction
LOCAL not_nested_int
PUBLIC @&Name&@4
@&Name&@4:
@ -357,6 +359,18 @@ PUBLIC @&Name&@4
if (Flags AND KI_EXIT_RET8)
/* Check if we return from a nested interrupt, i.e. an interrupt
that occurred in the ret8 return path between restoring
EFLAGS and returning with the ret instruction. */
cmp dword ptr [esp], offset ret8_instruction
jne not_nested_int
/* This is a nested interrupt, so we have 2 IRET frames.
Skip the first, and go directly to the previous return address.
Do not pass Go. Do not collect $200 */
add esp, 12
not_nested_int:
/* We are at the IRET frame, so push EFLAGS first */
push dword ptr [esp + 8]
@ -387,6 +401,7 @@ PUBLIC @&Name&@4
elseif (Flags AND KI_EXIT_RET8)
/* Return to kernel mode with a ret 8 */
ret8_instruction:
ret 8
elseif (Flags AND KI_EXIT_RET)