summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-01-25 10:17:45 +0100
committerAndreas Kling <kling@serenityos.org>2020-01-25 10:34:32 +0100
commite576c9e952f5ad49ec3a2021d1aacbbb45cb6c36 (patch)
tree094bbb0f565d12d9e2a20653d54817f229d06352
parent3f52cee59559ac1b32e14c513b10dc8ba20b6801 (diff)
downloadserenity-e576c9e952f5ad49ec3a2021d1aacbbb45cb6c36.zip
Kernel: Clear ESI and EDI on syscall entry
Since these are not part of the system call convention, we don't care what userspace had in there. Might as well scrub it before entering the kernel. I would scrub EBP too, but that breaks the comfy kernel-thru-userspace stack traces we currently get. It can be done with some effort.
-rw-r--r--Kernel/Syscall.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index a0d297e96e..1fc0faea38 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -48,6 +48,8 @@ asm(
" mov %ax, %ds\n"
" mov %ax, %es\n"
" cld\n"
+ " xor %esi, %esi\n"
+ " xor %edi, %edi\n"
" call syscall_handler\n"
" add $0x4, %esp\n"
" popl %gs\n"