[NTOS:KE] Save ExceptionList in the assembly version of KiEnterTrap. CORE-15723 2836/head
authorThomas Faber <thomas.faber@reactos.org>
Fri, 22 May 2020 20:34:56 +0000 (22:34 +0200)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 6 Jun 2020 06:44:30 +0000 (08:44 +0200)
commit4f49a9c792b8334a5ad8d6daaecd26dde6870f3c
tree1d242d1b5d7b6022a1cd19311991e1ca183e7d0a
parentd40ff3ca985daf8ea9927d9902282f6aa813824b
[NTOS:KE] Save ExceptionList in the assembly version of KiEnterTrap. CORE-15723

If SEH is used in a C trap handler, the exception frame will be
registered before the call to KiEnterTrap, which means we save
the wrong trap handler. We'll therefore also restore this wrong
frame for the excepting code, resulting in a stale SEH chain.

We avoid this problem by saving the handler in the assembly
trap entry code instead of from C. While SEH in a C trap handler
should now theoretically be safe, we still forbid it through
asserts in the C KiEnterTrap variants to make any potential
future problems more obvious. Should this functionality be
needed at some point and deemed safe, these asserts can then be
removed.
ntoskrnl/include/internal/i386/asmmacro.S
ntoskrnl/include/internal/i386/trap_x.h