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

Unified Diff: newlib/libc/machine/x86_64/setjmp.S

Issue 917463003: Avoid writing the sandbox base address to memory in setjmp and memcpy (Closed) Base URL: https://chromium.googlesource.com/native_client/nacl-newlib.git@master
Patch Set: Created 5 years, 10 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
« newlib/libc/machine/x86_64/memcpy.S ('K') | « newlib/libc/machine/x86_64/memcpy.S ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: newlib/libc/machine/x86_64/setjmp.S
diff --git a/newlib/libc/machine/x86_64/setjmp.S b/newlib/libc/machine/x86_64/setjmp.S
index b1d26adba38b905d3b269ded44f305b06de6b240..5f03c3e66bc4cb7c3f15370aa2129887551e4b2e 100644
--- a/newlib/libc/machine/x86_64/setjmp.S
+++ b/newlib/libc/machine/x86_64/setjmp.S
@@ -26,9 +26,10 @@ SYM (setjmp):
movq r12, %nacl: 8 (r15,rdi)
movq r13, %nacl: 16 (r15,rdi)
movq r14, %nacl: 24 (r15,rdi)
- movq (rsp), rax
- movq rax, %nacl: 32 (r15,rdi)
- leaq 8 (rsp), rax
+ /* Avoid writing the top 32 bits of rip, rbp, and rsp into memory. */
+ movl (rsp), eax
Mark Seaborn 2015/02/11 02:23:45 Note: shorter as: popq %rax movl eax, %nacl: 3
Derek Schuff 2015/02/11 23:16:06 Done.
+ movl eax, %nacl: 32 (r15,rdi)
+ leal 8 (rsp), eax
movl ebp, %nacl: 40 (r15,rdi)
movl eax, %nacl: 44 (r15,rdi)
movq $0, rax
@@ -36,7 +37,11 @@ SYM (setjmp):
nacljmp r11d, r15
SYM (longjmp):
- movq rsi, rax /* Return value */
+ movl esi, eax /* Return value */
Mark Seaborn 2015/02/11 02:23:45 I'm not sure why you're changing this. It looks l
Derek Schuff 2015/02/11 18:19:11 Yes, I noticed that it didn't conform and decided
+ /* if val is zero, we must return 1 -- otherwise return val */
+ movl $1, ebx
+ testl eax, eax
+ cmovz ebx, eax
naclrestbp %nacl: 40 (r15,rdi), r15
« newlib/libc/machine/x86_64/memcpy.S ('K') | « newlib/libc/machine/x86_64/memcpy.S ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698