PERFORCE change 219784 for review
Brooks Davis
brooks at FreeBSD.org
Wed Nov 14 18:58:51 UTC 2012
http://p4web.freebsd.org/@@219784?ac=10
Change 219784 by brooks at 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)
{
More information about the p4-projects
mailing list