PERFORCE change 76483 for review

Robert Watson rwatson at FreeBSD.org
Wed May 4 03:56:31 PDT 2005


http://perforce.freebsd.org/chv.cgi?CH=76483

Change 76483 by rwatson at rwatson_tislabs on 2005/05/04 10:55:24

	Integrate TrustedBSD MAC branch, primarily to loop back the merge
	of POSIX semaphore labeling and access control from FreeBSD CVS.    

Affected files ...

.. //depot/projects/trustedbsd/mac/lib/libc/stdio/fopen.3#7 integrate
.. //depot/projects/trustedbsd/mac/sys/conf/files#115 integrate
.. //depot/projects/trustedbsd/mac/sys/dev/usb/uvisor.c#16 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/uipc_sem.c#27 integrate
.. //depot/projects/trustedbsd/mac/sys/modules/sem/Makefile#2 integrate
.. //depot/projects/trustedbsd/mac/sys/net/bpf.c#37 integrate
.. //depot/projects/trustedbsd/mac/sys/posix4/ksem.h#10 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.c#253 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_mls/mac_mls.c#206 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_stub/mac_stub.c#33 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_test/mac_test.c#146 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/mac.h#272 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/mac_policy.h#229 integrate
.. //depot/projects/trustedbsd/mac/usr.sbin/authpf/Makefile#3 integrate

Differences ...

==== //depot/projects/trustedbsd/mac/lib/libc/stdio/fopen.3#7 (text+ko) ====

@@ -34,7 +34,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)fopen.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/fopen.3,v 1.18 2003/01/26 10:01:59 tjr Exp $
+.\" $FreeBSD: src/lib/libc/stdio/fopen.3,v 1.19 2005/05/04 08:12:44 des Exp $
 .\"
 .Dd January 26, 2003
 .Dt FOPEN 3
@@ -74,7 +74,7 @@
 Open for reading and writing.
 The stream is positioned at the beginning of the file.
 .It Dq Li w
-Truncate file to zero length or create text file for writing.
+Truncate to zero length or create text file for writing.
 The stream is positioned at the beginning of the file.
 .It Dq Li w+
 Open for reading and writing.

==== //depot/projects/trustedbsd/mac/sys/conf/files#115 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1019 2005/04/29 02:40:15 scottl Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1020 2005/05/04 10:39:13 rwatson Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and

==== //depot/projects/trustedbsd/mac/sys/dev/usb/uvisor.c#16 (text+ko) ====

@@ -1,5 +1,5 @@
 /*	$NetBSD: uvisor.c,v 1.9 2001/01/23 14:04:14 augustss Exp $	*/
-/*      $FreeBSD: src/sys/dev/usb/uvisor.c,v 1.23 2005/01/06 01:43:29 imp Exp $	*/
+/*      $FreeBSD: src/sys/dev/usb/uvisor.c,v 1.24 2005/05/04 00:46:24 julian Exp $	*/
 
 /* Also already merged from NetBSD:
  *	$NetBSD: uvisor.c,v 1.12 2001/11/13 06:24:57 lukem Exp $
@@ -142,7 +142,19 @@
  * Unknown PalmOS stuff.
  */
 #define UVISOR_GET_PALM_INFORMATION		0x04
-#define UVISOR_GET_PALM_INFORMATION_LEN		0x14
+#define UVISOR_GET_PALM_INFORMATION_LEN		0x44
+
+struct uvisor_palm_connection_info {
+        uByte   num_ports;
+        uByte   endpoint_numbers_different;
+        uWord   reserved1;
+  struct {
+                uDWord  port_function_id;
+                uByte   port;
+                uByte   end_point_info;
+                uWord   reserved;
+  } connections[UVISOR_MAX_CONN];
+};
 
 
 /*
@@ -165,7 +177,7 @@
 
 Static usbd_status uvisor_init(struct uvisor_softc *);
 
-Static usbd_status clie_3_5_init(struct uvisor_softc *);
+/*Static usbd_status clie_3_5_init(struct uvisor_softc *);*/
 
 Static void uvisor_close(void *, int);
 
@@ -207,9 +219,11 @@
 	struct usb_devno	uv_dev;
 	u_int16_t		uv_flags;
 #define PALM4	0x0001
+#define VISOR   0x0002
+#define PALM35  0x0004
 };
 static const struct uvisor_type uvisor_devs[] = {
-	{{ USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_VISOR }, 0 },
+	{{ USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_VISOR }, VISOR },
 	{{ USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_TREO }, PALM4 },
 	{{ USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_TREO600 }, PALM4 },
 	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_M500 }, PALM4 },
@@ -226,7 +240,7 @@
 	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_41 }, PALM4 },
 	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_S360 }, PALM4 },
 	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_NX60 }, PALM4 },
-	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_35 }, 0 },
+	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_35 }, PALM35 },
 /*	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_25 }, PALM4 },*/
 };
 #define uvisor_lookup(v, p) ((const struct uvisor_type *)usb_lookup(uvisor_devs, v, p))
@@ -342,10 +356,12 @@
 	ucom->sc_opkthdrlen = 0;
 	ucom->sc_callback = &uvisor_callback;
 
+#if 0
 	if (uaa->vendor == USB_VENDOR_SONY &&
 	    uaa->product == USB_PRODUCT_SONY_CLIE_35)
 		err = clie_3_5_init(sc);
 	else
+#endif
 		err = uvisor_init(sc);
 
 	if (err) {
@@ -413,22 +429,24 @@
 	usbd_status err;
 	usb_device_request_t req;
 	struct uvisor_connection_info coninfo;
+	struct uvisor_palm_connection_info pconinfo;
 	int actlen;
 	uWord avail;
 	char buffer[256];
 
-	DPRINTF(("uvisor_init: getting connection info\n"));
-	req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
-	req.bRequest = UVISOR_GET_CONNECTION_INFORMATION;
-	USETW(req.wValue, 0);
-	USETW(req.wIndex, 0);
-	USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
-	err = usbd_do_request_flags(sc->sc_ucom.sc_udev, &req, &coninfo,
-				    USBD_SHORT_XFER_OK, &actlen,
-				    USBD_DEFAULT_TIMEOUT);
-	if (err)
-		return (err);
-
+	if (sc->sc_flags & VISOR) {
+	  DPRINTF(("uvisor_init: getting connection info\n"));
+	  req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
+	  req.bRequest = UVISOR_GET_CONNECTION_INFORMATION;
+	  USETW(req.wValue, 0);
+	  USETW(req.wIndex, 0);
+	  USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
+	  err = usbd_do_request_flags(sc->sc_ucom.sc_udev, &req, &coninfo,
+				      USBD_SHORT_XFER_OK, &actlen,
+				      USBD_DEFAULT_TIMEOUT);
+	  if (err)
+	    return (err);
+	}
 #ifdef USB_DEBUG
 	{
 		int i, np;
@@ -462,15 +480,29 @@
 #endif
 
 	if (sc->sc_flags & PALM4) {
+	        int port;
 		/* Palm OS 4.0 Hack */
 		req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
 		req.bRequest = UVISOR_GET_PALM_INFORMATION;
 		USETW(req.wValue, 0);
 		USETW(req.wIndex, 0);
 		USETW(req.wLength, UVISOR_GET_PALM_INFORMATION_LEN);
-		err = usbd_do_request(sc->sc_ucom.sc_udev, &req, buffer);
+		err = usbd_do_request_flags(sc->sc_ucom.sc_udev, &req, &pconinfo,
+					    USBD_SHORT_XFER_OK, &actlen,
+					    USBD_DEFAULT_TIMEOUT);
 		if (err)
 			return (err);
+
+		if (pconinfo.endpoint_numbers_different) {
+			port = pconinfo.connections[0].end_point_info;
+			sc->sc_ucom.sc_bulkin_no = (port >> 4) | UE_DIR_IN;
+			sc->sc_ucom.sc_bulkout_no = (port & 0xf) | UE_DIR_OUT;
+		} else {
+			port = pconinfo.connections[0].port;
+			sc->sc_ucom.sc_bulkin_no = port | UE_DIR_IN;
+			sc->sc_ucom.sc_bulkout_no = port | UE_DIR_OUT;
+		}
+#if 0
 		req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
 		req.bRequest = UVISOR_GET_PALM_INFORMATION;
 		USETW(req.wValue, 0);
@@ -479,8 +511,33 @@
 		err = usbd_do_request(sc->sc_ucom.sc_udev, &req, buffer);
 		if (err)
 			return (err);
+#endif
 	}
 
+	if (sc->sc_flags & PALM35) {
+	  /* get the config number */
+	  DPRINTF(("clie_3_5_init: getting config info\n"));
+	  req.bmRequestType = UT_READ;
+	  req.bRequest = UR_GET_CONFIG;
+	  USETW(req.wValue, 0);
+	  USETW(req.wIndex, 0);
+	  USETW(req.wLength, 1);
+	  err = usbd_do_request(sc->sc_ucom.sc_udev, &req, buffer);
+	  if (err)
+	    return (err);
+  
+	  /* get the interface number */
+	  DPRINTF(("clie_3_5_init: get the interface number\n"));
+	  req.bmRequestType = UT_READ_DEVICE;
+	  req.bRequest = UR_GET_INTERFACE;
+	  USETW(req.wValue, 0);
+	  USETW(req.wIndex, 0);
+	  USETW(req.wLength, 1);
+	  err = usbd_do_request(sc->sc_ucom.sc_udev, &req, buffer);
+	  if (err)
+	    return (err);
+	}
+
 	DPRINTF(("uvisor_init: getting available bytes\n"));
 	req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
 	req.bRequest = UVISOR_REQUEST_BYTES_AVAILABLE;
@@ -496,6 +553,7 @@
 	return (err);
 }
 
+#if 0
 usbd_status
 clie_3_5_init(struct uvisor_softc *sc)
 {
@@ -565,6 +623,7 @@
 	DPRINTF(("clie_3_5_init: done\n"));
 	return (err);
 }
+#endif
 
 void
 uvisor_close(void *addr, int portno)

==== //depot/projects/trustedbsd/mac/sys/kern/uipc_sem.c#27 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/uipc_sem.c,v 1.18 2005/05/03 20:21:24 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/uipc_sem.c,v 1.19 2005/05/04 10:39:13 rwatson Exp $");
 
 #include "opt_mac.h"
 #include "opt_posix.h"

==== //depot/projects/trustedbsd/mac/sys/modules/sem/Makefile#2 (text+ko) ====

@@ -1,8 +1,8 @@
-# $FreeBSD: src/sys/modules/sem/Makefile,v 1.1 2002/09/19 00:43:32 alfred Exp $
+# $FreeBSD: src/sys/modules/sem/Makefile,v 1.2 2005/05/04 10:39:14 rwatson Exp $
 
 .PATH: ${.CURDIR}/../../kern
 
 KMOD=	sem
-SRCS=	uipc_sem.c opt_posix.h
+SRCS=	uipc_sem.c opt_mac.h opt_posix.h
 
 .include <bsd.kmod.mk>

==== //depot/projects/trustedbsd/mac/sys/net/bpf.c#37 (text+ko) ====

@@ -33,7 +33,7 @@
  *
  *      @(#)bpf.c	8.4 (Berkeley) 1/9/95
  *
- * $FreeBSD: src/sys/net/bpf.c,v 1.148 2005/03/31 12:19:43 phk Exp $
+ * $FreeBSD: src/sys/net/bpf.c,v 1.149 2005/05/04 03:09:28 csjp Exp $
  */
 
 #include "opt_bpf.h"
@@ -81,12 +81,13 @@
 /*
  * The default read buffer size is patchable.
  */
+SYSCTL_NODE(_net, OID_AUTO, bpf, CTLFLAG_RW, 0, "bpf sysctl");
 static int bpf_bufsize = 4096;
-SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW,
-	&bpf_bufsize, 0, "");
+SYSCTL_INT(_net_bpf, OID_AUTO, bufsize, CTLFLAG_RW,
+    &bpf_bufsize, 0, "");
 static int bpf_maxbufsize = BPF_MAXBUFSIZE;
-SYSCTL_INT(_debug, OID_AUTO, bpf_maxbufsize, CTLFLAG_RW,
-	&bpf_maxbufsize, 0, "");
+SYSCTL_INT(_net_bpf, OID_AUTO, maxbufsize, CTLFLAG_RW,
+    &bpf_maxbufsize, 0, "");
 
 /*
  * bpf_iflist is a list of BPF interface structures, each corresponding to a
@@ -116,6 +117,8 @@
 static int	bpf_setdlt(struct bpf_d *, u_int);
 static void	filt_bpfdetach(struct knote *);
 static int	filt_bpfread(struct knote *, long);
+static void	bpf_drvinit(void *);
+static void	bpf_clone(void *, char *, int, struct cdev **);
 
 static	d_open_t	bpfopen;
 static	d_close_t	bpfclose;
@@ -523,6 +526,8 @@
 bpf_wakeup(d)
 	struct bpf_d *d;
 {
+
+	BPFD_LOCK_ASSERT(d);
 	if (d->bd_state == BPF_WAITING) {
 		callout_stop(&d->bd_callout);
 		d->bd_state = BPF_IDLE;
@@ -1313,6 +1318,7 @@
 	int hdrlen = d->bd_bif->bif_hdrlen;
 	int do_wakeup = 0;
 
+	BPFD_LOCK_ASSERT(d);
 	/*
 	 * Figure out how many bytes to move.  If the packet is
 	 * greater or equal to the snapshot length, transfer that
@@ -1586,10 +1592,6 @@
 	return (bp == NULL ? EINVAL : 0);
 }
 
-static void bpf_drvinit(void *unused);
-
-static void bpf_clone(void *arg, char *name, int namelen, struct cdev **dev);
-
 static void
 bpf_clone(arg, name, namelen, dev)
 	void *arg;

==== //depot/projects/trustedbsd/mac/sys/posix4/ksem.h#10 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/posix4/ksem.h,v 1.1 2005/05/03 20:21:24 rwatson Exp $
+ * $FreeBSD: src/sys/posix4/ksem.h,v 1.2 2005/05/04 10:39:14 rwatson Exp $
  */
 
 #ifndef _POSIX4_KSEM_H_
@@ -33,6 +33,9 @@
 #error "no user-servicable parts inside"
 #endif
 
+#include <sys/condvar.h>
+#include <sys/queue.h>
+
 struct kuser {
 	pid_t ku_pid;
 	LIST_ENTRY(kuser) ku_next;

==== //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.c#253 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/security/mac_biba/mac_biba.c,v 1.84 2005/04/14 16:03:29 csjp Exp $
+ * $FreeBSD: src/sys/security/mac_biba/mac_biba.c,v 1.85 2005/05/04 10:39:14 rwatson Exp $
  */
 
 /*

==== //depot/projects/trustedbsd/mac/sys/security/mac_mls/mac_mls.c#206 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/security/mac_mls/mac_mls.c,v 1.69 2005/04/14 16:03:29 csjp Exp $
+ * $FreeBSD: src/sys/security/mac_mls/mac_mls.c,v 1.70 2005/05/04 10:39:15 rwatson Exp $
  */
 
 /*

==== //depot/projects/trustedbsd/mac/sys/security/mac_stub/mac_stub.c#33 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/security/mac_stub/mac_stub.c,v 1.48 2005/04/18 13:36:57 rwatson Exp $
+ * $FreeBSD: src/sys/security/mac_stub/mac_stub.c,v 1.49 2005/05/04 10:39:15 rwatson Exp $
  */
 
 /*

==== //depot/projects/trustedbsd/mac/sys/security/mac_test/mac_test.c#146 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/security/mac_test/mac_test.c,v 1.57 2005/04/18 13:36:57 rwatson Exp $
+ * $FreeBSD: src/sys/security/mac_test/mac_test.c,v 1.58 2005/05/04 10:39:15 rwatson Exp $
  */
 
 /*

==== //depot/projects/trustedbsd/mac/sys/sys/mac.h#272 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/mac.h,v 1.63 2005/04/18 13:36:57 rwatson Exp $
+ * $FreeBSD: src/sys/sys/mac.h,v 1.64 2005/05/04 10:39:14 rwatson Exp $
  */
 /*
  * Userland/kernel interface for Mandatory Access Control.

==== //depot/projects/trustedbsd/mac/sys/sys/mac_policy.h#229 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/mac_policy.h,v 1.62 2005/04/18 13:36:57 rwatson Exp $
+ * $FreeBSD: src/sys/sys/mac_policy.h,v 1.63 2005/05/04 10:39:14 rwatson Exp $
  */
 /*
  * Kernel interface for MAC policy modules.

==== //depot/projects/trustedbsd/mac/usr.sbin/authpf/Makefile#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/usr.sbin/authpf/Makefile,v 1.2 2005/05/03 16:57:38 mlaier Exp $
+# $FreeBSD: src/usr.sbin/authpf/Makefile,v 1.3 2005/05/04 08:57:12 mlaier Exp $
 
 .PATH:	${.CURDIR}/../../contrib/pf/authpf
 .PATH:	${.CURDIR}/../../contrib/pf/pfctl
@@ -17,6 +17,6 @@
 CFLAGS+= -DENABLE_ALTQ
 
 LDADD+= -lm -lmd -lutil
-DPADD+= ${LIBM} ${LIBMD}
+DPADD+= ${LIBM} ${LIBMD} ${LIBUTIL}
 
 .include <bsd.prog.mk>


More information about the p4-projects mailing list