https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1bfacf06f7c215f2ada4c…
commit 1bfacf06f7c215f2ada4c7870519aceee1e90768
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Tue May 15 14:07:12 2018 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Oct 31 14:23:16 2020 +0100
[NTOS:KE:X64] Zero out volatiles when returning from a system call
---
ntoskrnl/ke/amd64/trap.S | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/ntoskrnl/ke/amd64/trap.S b/ntoskrnl/ke/amd64/trap.S
index 8efcd81d9d8..9c3c085d2e7 100644
--- a/ntoskrnl/ke/amd64/trap.S
+++ b/ntoskrnl/ke/amd64/trap.S
@@ -824,6 +824,16 @@ IntsEnabled:
/* Swap gs back to user */
swapgs
+ ; Zero out volatiles
+ pxor xmm0, xmm0
+ pxor xmm1, xmm1
+ pxor xmm2, xmm2
+ pxor xmm3, xmm3
+ pxor xmm4, xmm4
+ pxor xmm5, xmm5
+ xor rdx, rdx
+ xor r10, r10
+
/* return to user mode */
.byte HEX(48) // REX prefix to return to long mode
sysret