Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Nov 2012 01:50:08 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 219756 for review
Message-ID:  <201211120150.qAC1o8cQ039438@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@219756?ac=10

Change 219756 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2012/11/12 01:50:06

	Simple implementation of a sandbox invocation target: unpacks
	sandbox invocation arguments, runs some C code a bit
	under-defensively, and returns a value to be picked up by the
	calling code.  Much work to be done here, and depends on a
	CJALR call, returning via CJR, rather than CCALL and CRETURN.
	However, runs in a new segment successfully.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/libexec/cheritest-helper/Makefile#3 edit
.. //depot/projects/ctsrd/cheribsd/src/libexec/cheritest-helper/cheritest-helper.c#2 edit
.. //depot/projects/ctsrd/cheribsd/src/libexec/cheritest-helper/mips64/chsbrt.S#1 add
.. //depot/projects/ctsrd/cheribsd/src/libexec/cheritest-helper/sandbox.ld#2 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/libexec/cheritest-helper/Makefile#3 (text+ko) ====

@@ -2,17 +2,22 @@
 # $FreeBSD$
 #
 PROG=	cheritest-helper
-SRCS=	cheritest-helper.c
-LDFLAGS+=	--script=sandbox.ld -nostdlib
+SRCS=	cheritest-helper.c chsbrt.S
+LDFLAGS+=	-Wl,--script=${.CURDIR}/sandbox.ld -nostdlib
+CFLAGS+=	-G0 -Wa,-G0
 NO_MAN=
-STRIP=
+#STRIP=
+NO_SHARED=	yes
 
 FILESOWN=       ${LIBOWN}
 FILESGRP=       ${LIBGRP}
 FILESMODE=      ${LIBMODE}
-FILESDIR=       ${LIBDIR}
-FILES=		cheritest-helper.bin cheritest-helper.dump
-CLEANFILES=	cheritest-helper.bin cheritest-helper.dump
+FILESDIR=       ${LIBEXECDIR}
+FILES=		cheritest-helper.bin cheritest-helper.dump chsbrt.o
+CLEANFILES=	cheritest-helper.bin cheritest-helper.dump chsbrt.o
+
+chsbrt.o:
+	${AS} -G0 -o ${.TARGET} ${.ALLSRC}
 
 cheritest-helper.bin: cheritest-helper
 	objcopy -S -O binary ${.ALLSRC} ${.TARGET}
@@ -20,4 +25,6 @@
 cheritest-helper.dump: cheritest-helper
 	objdump -xsSD ${.ALLSRC} > ${.TARGET}
 
+.PATH: ${.CURDIR}/${MACHINE_ARCH}
+
 .include <bsd.prog.mk>

==== //depot/projects/ctsrd/cheribsd/src/libexec/cheritest-helper/cheritest-helper.c#2 (text+ko) ====

@@ -30,9 +30,12 @@
 
 #include <sys/types.h>
 
+int	invoke(register_t a0, register_t a1, register_t a2, register_t a3);
+
 int
-main(int argc __unused, char *argv[] __unused)
+invoke(register_t a0 __unused, register_t a1 __unused, register_t a2 __unused,
+    register_t a3 __unused)
 {
 
-	return (0);
+	return (123456);
 }

==== //depot/projects/ctsrd/cheribsd/src/libexec/cheritest-helper/sandbox.ld#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2011 Robert N. M. Watson
+ * Copyright (c) 2011-2012 Robert N. M. Watson
  * All rights reserved.
  *
  * This software was developed by SRI International and the University of
@@ -40,7 +40,10 @@
 SECTIONS
 {
 	. = __code_base__;
+
+	.text ALIGN(0x8): { chsbrt.o }
 	.text ALIGN(0x8): { *(.text) }
+	.MIPS.options ALIGN(0x8): { *(.MIPS.options) }
 	.bss ALIGN(0x8): { *(.bss) }
 	.data ALIGN(0x8): { *(.data) }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211120150.qAC1o8cQ039438>