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

Side by Side Diff: src/trusted/service_runtime/arch/x86_32/springboard.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, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * NaCl Simple/secure ELF loader (NaCl SEL). 8 * NaCl Simple/secure ELF loader (NaCl SEL).
9 */ 9 */
10 #include "native_client/src/trusted/service_runtime/nacl_config.h" 10 #include "native_client/src/trusted/service_runtime/nacl_config.h"
(...skipping 11 matching lines...) Expand all
22 * to do an upcall into NaCl application. 22 * to do an upcall into NaCl application.
23 */ 23 */
24 24
25 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_springboard): 25 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_springboard):
26 hlt /* one byte */ 26 hlt /* one byte */
27 /* Restore state from struct NaClThreadContext. */ 27 /* Restore state from struct NaClThreadContext. */
28 /* syscall return value, if any, from trusted stack */ 28 /* syscall return value, if any, from trusted stack */
29 mov NACL_THREAD_CONTEXT_OFFSET_SYSRET(%ecx), %eax 29 mov NACL_THREAD_CONTEXT_OFFSET_SYSRET(%ecx), %eax
30 lss NACL_THREAD_CONTEXT_OFFSET_STACK_PTR(%ecx), %esp 30 lss NACL_THREAD_CONTEXT_OFFSET_STACK_PTR(%ecx), %esp
31 movw NACL_THREAD_CONTEXT_OFFSET_DS(%ecx), %ds 31 movw NACL_THREAD_CONTEXT_OFFSET_DS(%ecx), %ds
32 /* Set %ecx to zero to avoid leaking the NaClThreadContext address */
33 xorl %ecx, %ecx
32 jmp *%edx 34 jmp *%edx
33 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_springboard_end): 35 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_springboard_end):
34 36
35 37
36 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_springboard_all_regs): 38 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_springboard_all_regs):
37 hlt /* one byte */ 39 hlt /* one byte */
38 /* Restore state from struct NaClSwitchAllRegsState. */ 40 /* Restore state from struct NaClSwitchAllRegsState. */
39 lss 0(%ecx), %esp /* stack_ptr */ 41 lss 0(%ecx), %esp /* stack_ptr */
40 movw 0x10(%ecx), %ds /* ds */ 42 movw 0x10(%ecx), %ds /* ds */
41 movl %gs:0xc, %ecx /* new_ecx from NaClTlsSegment */ 43 movl %gs:0xc, %ecx /* new_ecx from NaClTlsSegment */
42 jmp *%gs:8 /* new_prog_ctr from NaClTlsSegment */ 44 jmp *%gs:8 /* new_prog_ctr from NaClTlsSegment */
43 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_springboard_all_regs_end): 45 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_springboard_all_regs_end):
OLDNEW
« no previous file with comments | « src/trusted/service_runtime/arch/arm/nacl_switch.S ('k') | src/trusted/service_runtime/arch/x86_64/nacl_switch_64.S » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698