PERFORCE change 16304 for review

Robert Watson rwatson at freebsd.org
Mon Aug 19 22:43:38 GMT 2002


http://people.freebsd.org/~peter/p4db/chv.cgi?CH=16304

Change 16304 by rwatson at rwatson_paprika on 2002/08/19 15:43:14

	Integ more stuff from the main FreeBSD tree: trickled back
	mac_syscall() changes such as change to MSTD.

Affected files ...

.. //depot/projects/trustedbsd/base/lib/libc/locale/wcwidth.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/dev/tx/if_tx.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/tx/if_txvar.h#2 integrate
.. //depot/projects/trustedbsd/base/sys/kern/init_sysent.c#15 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_mac.c#9 integrate
.. //depot/projects/trustedbsd/base/sys/kern/syscalls.c#15 integrate
.. //depot/projects/trustedbsd/base/sys/kern/syscalls.master#15 integrate
.. //depot/projects/trustedbsd/base/sys/net/if_ppp.c#10 integrate
.. //depot/projects/trustedbsd/base/sys/netinet/tcp_input.c#19 integrate
.. //depot/projects/trustedbsd/base/sys/netinet6/udp6_usrreq.c#10 integrate
.. //depot/projects/trustedbsd/base/sys/sys/syscall.h#16 integrate
.. //depot/projects/trustedbsd/base/sys/sys/syscall.mk#16 integrate
.. //depot/projects/trustedbsd/base/sys/sys/sysproto.h#17 integrate

Differences ...

==== //depot/projects/trustedbsd/base/lib/libc/locale/wcwidth.c#2 (text+ko) ====

@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcwidth.c,v 1.2 2002/08/19 09:02:49 ache Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/locale/wcwidth.c,v 1.5 2002/08/19 20:32:27 ache Exp $");
 
 #include <wchar.h>
 #include <wctype.h>
@@ -49,10 +49,14 @@
 #define _CTYPE_SWS 30 		/* Bits to shift to get width */
 
 int
-wcwidth(wc)
-        wchar_t wc;
+wcwidth(wchar_t wc)
 {
-	int width = __maskrune(wc, _CTYPE_SWM);
+	int width;
+
+	if (wc == L'\0')
+		return (0);
+
+	width = __maskrune(wc, _CTYPE_SWM);
 
 	/* 0 is autowidth (default) */
 	return (width ? (int)((unsigned)width >> _CTYPE_SWS)

==== //depot/projects/trustedbsd/base/sys/dev/tx/if_tx.c#4 (text+ko) ====

@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_tx.c,v 1.9.2.1 2000/02/21 22:29:13 niklas Exp $	*/
-/* $FreeBSD: src/sys/dev/tx/if_tx.c,v 1.57 2002/05/01 19:23:04 semenu Exp $ */
+/* $FreeBSD: src/sys/dev/tx/if_tx.c,v 1.59 2002/08/19 20:36:08 semenu Exp $ */
 
 /*-
  * Copyright (c) 1997 Semen Ustimenko (semenu at FreeBSD.org)
@@ -508,20 +508,12 @@
 		goto fail;
 	}
 
-	/* Bring the chip out of low-power mode and reset it. */
-	CSR_WRITE_4( sc, GENCTL, GENCTL_SOFT_RESET );
-	DELAY(500);
-
-	/* Workaround for Application Note 7-15 */
-	for (i=0; i<16; i++) CSR_WRITE_4(sc, TEST1, TEST1_CLOCK_TEST);
-
 	/* Do OS independent part, including chip wakeup and reset */
-	if (epic_common_attach(sc)) {
-		device_printf(dev, "memory distribution error\n");
+	error = epic_common_attach(sc);
+	if (error) {
 		bus_teardown_intr(dev, sc->irq, sc->sc_ih);
 		bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
 		bus_release_resource(dev, EPIC_RES, EPIC_RID, sc->res);
-		error = ENXIO;
 		goto fail;
 	}
 
@@ -589,7 +581,9 @@
 	bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
 	bus_release_resource(dev, EPIC_RES, EPIC_RID, sc->res);
 
-	free(sc->pool, M_DEVBUF);
+	free(sc->tx_flist, M_DEVBUF);
+	free(sc->tx_desc, M_DEVBUF);
+	free(sc->rx_desc, M_DEVBUF);
 
 	splx(s);
 
@@ -763,29 +757,22 @@
 	epic_softc_t *sc;
 {
 	int i;
-	caddr_t pool;
 
-	i = sizeof(struct epic_frag_list)*TX_RING_SIZE +
-	    sizeof(struct epic_rx_desc)*RX_RING_SIZE + 
-	    sizeof(struct epic_tx_desc)*TX_RING_SIZE + PAGE_SIZE,
-	sc->pool = (epic_softc_t *) malloc(i, M_DEVBUF, M_NOWAIT | M_ZERO);
+	sc->tx_flist = malloc(sizeof(struct epic_frag_list)*TX_RING_SIZE,
+	    M_DEVBUF, M_NOWAIT | M_ZERO);
+	sc->tx_desc = malloc(sizeof(struct epic_tx_desc)*TX_RING_SIZE,
+	    M_DEVBUF, M_NOWAIT | M_ZERO);
+	sc->rx_desc = malloc(sizeof(struct epic_rx_desc)*RX_RING_SIZE,
+	    M_DEVBUF, M_NOWAIT | M_ZERO);
 
-	if (sc->pool == NULL) {
-		printf(": can't allocate memory for buffers\n");
-		return -1;
+	if (sc->tx_flist == NULL || sc->tx_desc == NULL || sc->rx_desc == NULL){
+		device_printf(sc->dev, "Failed to malloc memory\n");
+		if (sc->tx_flist) free(sc->tx_flist, M_DEVBUF);
+		if (sc->tx_desc) free(sc->tx_desc, M_DEVBUF);
+		if (sc->rx_desc) free(sc->rx_desc, M_DEVBUF);
+		return (ENOMEM);
 	}
 
-	/* Align pool on PAGE_SIZE */
-	pool = (caddr_t)sc->pool;
-	pool = (caddr_t)((uintptr_t)(pool + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1));
-
-	/* Distribute memory */
-	sc->tx_flist = (void *)pool;
-	pool += sizeof(struct epic_frag_list)*TX_RING_SIZE;
-	sc->rx_desc = (void *)pool;
-	pool += sizeof(struct epic_rx_desc)*RX_RING_SIZE;
-	sc->tx_desc = (void *)pool;
-
 	/* Bring the chip out of low-power mode. */
 	CSR_WRITE_4( sc, GENCTL, GENCTL_SOFT_RESET);
 	DELAY(500);

==== //depot/projects/trustedbsd/base/sys/dev/tx/if_txvar.h#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_txvar.h,v 1.7 1999/11/17 05:21:19 jason Exp $	*/
-/* $FreeBSD: src/sys/dev/tx/if_txvar.h,v 1.11 2002/04/19 22:43:44 semenu Exp $ */
+/* $FreeBSD: src/sys/dev/tx/if_txvar.h,v 1.12 2002/08/19 20:36:08 semenu Exp $ */
 
 /*-
  * Copyright (c) 1997 Semen Ustimenko
@@ -107,7 +107,6 @@
 	struct mii_softc 	*physc;
 	u_int32_t		phyid;
 	int			serinst;
-	void 			*pool;
 } epic_softc_t;
 
 struct epic_type {

==== //depot/projects/trustedbsd/base/sys/kern/init_sysent.c#15 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/init_sysent.c,v 1.130 2002/08/06 15:16:55 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.120 2002/08/06 15:15:53 rwatson Exp 
+ * $FreeBSD: src/sys/kern/init_sysent.c,v 1.131 2002/08/19 20:02:29 rwatson Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp 
  */
 
 #include "opt_compat.h"
@@ -422,5 +422,5 @@
 	{ AS(lchflags_args), (sy_call_t *)lchflags },	/* 391 = lchflags */
 	{ AS(uuidgen_args), (sy_call_t *)uuidgen },	/* 392 = uuidgen */
 	{ SYF_MPSAFE | AS(sendfile_args), (sy_call_t *)sendfile },	/* 393 = sendfile */
-	{ SYF_MPSAFE | AS(mac_syscall_args), (sy_call_t *)nosys },	/* 394 = mac_syscall */
+	{ SYF_MPSAFE | AS(mac_syscall_args), (sy_call_t *)mac_syscall },	/* 394 = mac_syscall */
 };

==== //depot/projects/trustedbsd/base/sys/kern/kern_mac.c#9 (text+ko) ====

@@ -36,7 +36,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/kern/kern_mac.c,v 1.14 2002/08/19 19:04:51 rwatson Exp $
+ * $FreeBSD: src/sys/kern/kern_mac.c,v 1.15 2002/08/19 20:26:32 rwatson Exp $
  */
 /*
  * Developed by the TrustedBSD Project.
@@ -2120,7 +2120,6 @@
 	return (error);
 }
 
-
 /*
  * When relabeling a process, call out to the policies for the maximum
  * permission allowed for each object type we know about in its
@@ -2285,7 +2284,6 @@
 {
 
 	MAC_PERFORM(relabel_cred, cred, newlabel);
-	mac_cred_mmapped_drop_perms(curthread, cred);
 }
 
 void
@@ -3002,8 +3000,6 @@
 
 /*
  * MPSAFE
- *
- * XXX: Needs to be re-written for proc locking.
  */
 int
 __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap)
@@ -3038,12 +3034,19 @@
 
 	setsugid(p);
 	crcopy(newcred, oldcred);
-	PROC_UNLOCK(p);
 	mac_relabel_cred(newcred, &intlabel);
+	p->p_ucred = newcred;
 
-	PROC_LOCK(p);
-	p->p_ucred = newcred;
+	/*
+	 * Grab additional reference for use while revoking mmaps, prior
+	 * to releasing the proc lock and sharing the cred.
+	 */
+	crhold(newcred);
 	PROC_UNLOCK(p);
+
+	mac_cred_mmapped_drop_perms(td, newcred);
+
+	crfree(newcred);	/* Free revocation reference. */
 	crfree(oldcred);
 	mac_destroy_temp(&intlabel);
 	return (0);

==== //depot/projects/trustedbsd/base/sys/kern/syscalls.c#15 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/syscalls.c,v 1.116 2002/08/06 15:16:55 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.120 2002/08/06 15:15:53 rwatson Exp 
+ * $FreeBSD: src/sys/kern/syscalls.c,v 1.117 2002/08/19 20:02:29 rwatson Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp 
  */
 
 char *syscallnames[] = {

==== //depot/projects/trustedbsd/base/sys/kern/syscalls.master#15 (text+ko) ====

@@ -1,4 +1,4 @@
- $FreeBSD: src/sys/kern/syscalls.master,v 1.120 2002/08/06 15:15:53 rwatson Exp $
+ $FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp $
 ;	from: @(#)syscalls.master	8.2 (Berkeley) 1/13/94
 ;
 ; System call name/number master file.
@@ -567,5 +567,5 @@
 392	STD	BSD	{ int uuidgen(struct uuid *store, int count); }
 393	MSTD	BSD	{ int sendfile(int fd, int s, off_t offset, size_t nbytes, \
 				struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
-394	MNOIMPL	BSD	{ int mac_syscall(const char *policy, int call, \
+394	MSTD	BSD	{ int mac_syscall(const char *policy, int call, \
 				void *arg); }

==== //depot/projects/trustedbsd/base/sys/net/if_ppp.c#10 (text+ko) ====

@@ -69,7 +69,7 @@
  * Paul Mackerras (paulus at cs.anu.edu.au).
  */
 
-/* $FreeBSD: src/sys/net/if_ppp.c,v 1.82 2002/08/15 19:02:17 rwatson Exp $ */
+/* $FreeBSD: src/sys/net/if_ppp.c,v 1.83 2002/08/19 19:22:41 brooks Exp $ */
 /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
 /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
 
@@ -220,7 +220,7 @@
 	bpfattach(&sc->sc_if, DLT_PPP, PPP_HDRLEN);
 	LIST_INSERT_HEAD(&ppp_softc_list, sc, sc_list);
 
-	return 1;
+	return (0);
 }
 
 static void
@@ -263,8 +263,7 @@
 		while (!LIST_EMPTY(&ppp_softc_list))
 			ppp_clone_destroy(
 			    &LIST_FIRST(&ppp_softc_list)->sc_if);
-
-		return EINVAL; 
+		break; 
 	} 
 	return 0; 
 } 

==== //depot/projects/trustedbsd/base/sys/netinet/tcp_input.c#19 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)tcp_input.c	8.12 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.171 2002/08/17 18:26:01 dillon Exp $
+ * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.172 2002/08/19 19:47:11 jmallett Exp $
  */
 
 #include "opt_ipfw.h"		/* for ipfw_fwd		*/
@@ -576,14 +576,18 @@
 	if (inp == NULL) {
 		if (log_in_vain) {
 #ifdef INET6
-			char dbuf[INET6_ADDRSTRLEN], sbuf[INET6_ADDRSTRLEN];
+			char dbuf[INET6_ADDRSTRLEN+2], sbuf[INET6_ADDRSTRLEN+2];
 #else
 			char dbuf[4*sizeof "123"], sbuf[4*sizeof "123"];
 #endif
 
 			if (isipv6) {
-				strcpy(dbuf, ip6_sprintf(&ip6->ip6_dst));
-				strcpy(sbuf, ip6_sprintf(&ip6->ip6_src));
+				strcpy(dbuf, "[");
+				strcpy(sbuf, "[");
+				strcat(dbuf, ip6_sprintf(&ip6->ip6_dst));
+				strcat(sbuf, ip6_sprintf(&ip6->ip6_src));
+				strcat(dbuf, "]");
+				strcat(sbuf, "]");
 			} else {
 				strcpy(dbuf, inet_ntoa(ip->ip_dst));
 				strcpy(sbuf, inet_ntoa(ip->ip_src));

==== //depot/projects/trustedbsd/base/sys/netinet6/udp6_usrreq.c#10 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$FreeBSD: src/sys/netinet6/udp6_usrreq.c,v 1.30 2002/07/25 17:40:45 ume Exp $	*/
+/*	$FreeBSD: src/sys/netinet6/udp6_usrreq.c,v 1.31 2002/08/19 19:47:13 jmallett Exp $	*/
 /*	$KAME: udp6_usrreq.c,v 1.27 2001/05/21 05:45:10 jinmei Exp $	*/
 
 /*
@@ -346,7 +346,7 @@
 
 			strcpy(buf, ip6_sprintf(&ip6->ip6_dst));
 			log(LOG_INFO,
-			    "Connection attempt to UDP %s:%d from %s:%d\n",
+			    "Connection attempt to UDP [%s]:%d from [%s]:%d\n",
 			    buf, ntohs(uh->uh_dport),
 			    ip6_sprintf(&ip6->ip6_src), ntohs(uh->uh_sport));
 		}

==== //depot/projects/trustedbsd/base/sys/sys/syscall.h#16 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/sys/syscall.h,v 1.115 2002/08/06 15:16:55 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.120 2002/08/06 15:15:53 rwatson Exp 
+ * $FreeBSD: src/sys/sys/syscall.h,v 1.116 2002/08/19 20:02:29 rwatson Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp 
  */
 
 #define	SYS_syscall	0

==== //depot/projects/trustedbsd/base/sys/sys/syscall.mk#16 (text+ko) ====

@@ -1,7 +1,7 @@
 # FreeBSD system call names.
 # DO NOT EDIT-- this file is automatically generated.
-# $FreeBSD: src/sys/sys/syscall.mk,v 1.70 2002/08/06 15:16:55 rwatson Exp $
-# created from FreeBSD: src/sys/kern/syscalls.master,v 1.120 2002/08/06 15:15:53 rwatson Exp 
+# $FreeBSD: src/sys/sys/syscall.mk,v 1.71 2002/08/19 20:02:29 rwatson Exp $
+# created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp 
 MIASM =  \
 	syscall.o \
 	exit.o \

==== //depot/projects/trustedbsd/base/sys/sys/sysproto.h#17 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/sys/sysproto.h,v 1.107 2002/08/06 15:16:55 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.120 2002/08/06 15:15:53 rwatson Exp 
+ * $FreeBSD: src/sys/sys/sysproto.h,v 1.108 2002/08/19 20:02:29 rwatson Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp 
  */
 
 #ifndef _SYS_SYSPROTO_H_
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list