Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: src/trusted/service_runtime/arch/x86_64/nacl_syscall_64.S

Issue 10829110: Fix two register leaks in the trusted->untrusted context switch (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Fix comment Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/service_runtime/arch/x86_64/nacl_switch_64.S ('k') | tests/common/register_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/arch/x86_64/nacl_syscall_64.S
diff --git a/src/trusted/service_runtime/arch/x86_64/nacl_syscall_64.S b/src/trusted/service_runtime/arch/x86_64/nacl_syscall_64.S
index 52121614a2b4edeb22a724f8a2b7043f09f2f710..2f181e92c343cced9548c4482b9f3b13d78593ee 100644
--- a/src/trusted/service_runtime/arch/x86_64/nacl_syscall_64.S
+++ b/src/trusted/service_runtime/arch/x86_64/nacl_syscall_64.S
@@ -214,11 +214,17 @@ DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClGetTlsFastPath):
leaq IDENTIFIER(nacl_tls)(%rip), %rdx
leaq (%rdx,%rax,4), %rdx
movl 0x0(%rdx), %eax
- xorl %edx, %edx /* do not leak nacl_tls[thread_id] address */
/* sandbox the return, straight off the untrusted stack */
movq 0x8(%rsp), %rcx
addq $0x10, %rsp
addl $31, %ecx
andl $0xffffffe0, %ecx
addq %r15, %rcx
+ /*
+ * Set %rdx to zero so that we do not leak nacl_tls[thread_id]
+ * address. This also resets flags. Resetting flags to fixed
+ * values by doing this last simplifies testing that we do not
+ * leak any information via flags.
+ */
+ xorl %edx, %edx
jmp *%rcx
« no previous file with comments | « src/trusted/service_runtime/arch/x86_64/nacl_switch_64.S ('k') | tests/common/register_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698