Date: Wed, 14 Nov 2012 18:58:50 GMT From: Brooks Davis <brooks@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 219784 for review Message-ID: <201211141858.qAEIwoD1013783@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@219784?ac=10 Change 219784 by brooks@brooks_zenith on 2012/11/14 18:58:46 Include a significatnly more real implementation of abort for sandboxed code. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng-cheri/mips64/chsbrt.S#2 integrate .. //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng-cheri/stub.c#2 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng-cheri/mips64/chsbrt.S#2 (text+ko) ==== @@ -137,6 +137,13 @@ sd $a5, 0($at) # + # If abort() is called, we effectively longjmp back to just after the + # call to invoke(). Save a stack pointer for that unwind. + # + dla $at, abort_stack + sd $sp, 0($at) + + # # Invoke MIPS ABI C "invoke" function. # dla $25, invoke @@ -148,6 +155,7 @@ # # XXXRW: To move to caller context once using CCALL. # +abort_target: ld $t0, 0($sp) ld $t1, 8($sp) daddiu $sp, 16 @@ -195,5 +203,23 @@ # cjr $31($c24) # Jump to return capability register nop # Branch-delay slot? + .end __start + + .global abort + .ent abort +abort: + # + # If abort() is called, unwind the stack and jump into the return + # code. Set $v0 to -2 so that it's somewhat recognisable, even if + # non-ideal. + # + dla $at, abort_stack + ld $sp, 0($at) + dli $v0, -2 + b abort_target + nop + .end abort - .end __start + .data +abort_stack: + .dword 0x0000000000000000 # What to restore sp to on abort ==== //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng-cheri/stub.c#2 (text+ko) ==== @@ -44,12 +44,6 @@ return (&stub_errno); } -void -abort(void) -{ - -} - int close(int d __unused) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211141858.qAEIwoD1013783>