Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2010 00:49:14 GMT
From:      Jonathan Anderson <jona@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 173714 for review
Message-ID:  <201001260049.o0Q0nEGd056463@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=173714

Change 173714 by jona@jona-belle-freebsd8 on 2010/01/26 00:48:21

	open(2) is now properly constrained (it always fails with EOPNOTSUPP), so we can allow the syscall for auditing / debugging purposes

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/lib/libcapability/Makefile#17 edit
.. //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#26 edit
.. //depot/projects/trustedbsd/capabilities/src/sys/kern/capabilities.conf#26 edit
.. //depot/projects/trustedbsd/capabilities/src/sys/kern/init_sysent.c#46 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/lib/libcapability/Makefile#17 (text+ko) ====

@@ -9,7 +9,8 @@
 	libcapability_sandbox.c		\
 	libcapability_sandbox_io.c	\
 	libcapability_host.c		\
-	libcapability_host_io.c
+	libcapability_host_io.c		\
+	libcapability_registry.c
 
 INCS=	libcapability.h
 

==== //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#26 (text+ko) ====

@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#25 $
+ * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#26 $
  */
 
 #ifndef _LIBCAPABILITY_H_
@@ -53,6 +53,30 @@
 };
 
 /*
+ * A file descriptor "registry"
+ */
+struct lc_fdregistry_entry;
+struct lc_fdregistry {
+	struct lc_fdregistry_entry *entries;	/* registry entries */
+
+	unsigned int count;			/* number of entries */
+	unsigned int capacity;			/* entries that we can hold */
+};
+
+/*
+ * Registry operations
+ */
+struct lc_fdregistry*	lc_fdregistry_new(void);
+struct lc_fdregistry*	lc_fdregistry_dup(const struct lc_fdregistry *orig);
+void			lc_fdregistry_free(struct lc_fdregistry *registry);
+
+int	lc_fdregistry_add(const struct lc_fdregistry *reg,
+	                  const char *id, const char *name, int fd);
+
+int	lc_fdregistry_lookup(const struct lc_fdregistry *reg,
+	                     const char *id, char **name, int *fdp);
+
+/*
  * Capability interfaces.
  */
 int	lc_limitfd(int fd, cap_rights_t rights);

==== //depot/projects/trustedbsd/capabilities/src/sys/kern/capabilities.conf#26 (text+ko) ====

@@ -38,7 +38,7 @@
 ## - sys_exit(2), abort2(2) and close(2) are very important.
 ## - Sorted alphabetically, please keep it that way.
 ##
-## $P4: //depot/projects/trustedbsd/capabilities/src/sys/kern/capabilities.conf#25 $
+## $P4: //depot/projects/trustedbsd/capabilities/src/sys/kern/capabilities.conf#26 $
 ##
 
 ##
@@ -467,6 +467,13 @@
 renameat
 
 ##
+## Allow entry into open(2). This system call will fail, since access to the global
+## file namespace has been disallowed, but allowing entry into the syscall means
+## that an audit trail will be generated (which is also very useful for debugging),
+##
+open
+
+##
 ## Allow poll(2), which will be scoped by capability rights.
 ##
 ## XXXRW: Perhaps we don't need the OpenBSD version?

==== //depot/projects/trustedbsd/capabilities/src/sys/kern/init_sysent.c#46 (text+ko) ====

@@ -39,7 +39,7 @@
 	{ 0, (sy_call_t *)fork, AUE_FORK, NULL, 0, 0, SYF_CAPENABLED },	/* 2 = fork */
 	{ AS(read_args), (sy_call_t *)read, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED },	/* 3 = read */
 	{ AS(write_args), (sy_call_t *)write, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED },	/* 4 = write */
-	{ AS(open_args), (sy_call_t *)open, AUE_OPEN_RWTC, NULL, 0, 0, 0 },	/* 5 = open */
+	{ AS(open_args), (sy_call_t *)open, AUE_OPEN_RWTC, NULL, 0, 0, SYF_CAPENABLED },	/* 5 = open */
 	{ AS(close_args), (sy_call_t *)close, AUE_CLOSE, NULL, 0, 0, SYF_CAPENABLED },	/* 6 = close */
 	{ AS(wait_args), (sy_call_t *)wait4, AUE_WAIT4, NULL, 0, 0, 0 },	/* 7 = wait4 */
 	{ compat(AS(ocreat_args),creat), AUE_CREAT, NULL, 0, 0, 0 },	/* 8 = old creat */



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