CVS commit: src/lib/libc/sys

2011-04-03 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Apr  3 06:05:22 UTC 2011

Modified Files:
src/lib/libc/sys: mprotect.2

Log Message:
Offset indent.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/sys/mprotect.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/mprotect.2
diff -u src/lib/libc/sys/mprotect.2:1.22 src/lib/libc/sys/mprotect.2:1.23
--- src/lib/libc/sys/mprotect.2:1.22	Sun Jan 11 02:46:30 2009
+++ src/lib/libc/sys/mprotect.2	Sun Apr  3 06:05:21 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: mprotect.2,v 1.22 2009/01/11 02:46:30 christos Exp $
+.\	$NetBSD: mprotect.2,v 1.23 2011/04/03 06:05:21 jruoho Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	@(#)mprotect.2	8.1 (Berkeley) 6/9/93
 .\
-.Dd January 6, 2009
+.Dd April 3, 2011
 .Dt MPROTECT 2
 .Os
 .Sh NAME
@@ -56,7 +56,7 @@
 .Tn OR Ns 'ing
 the following values:
 .Pp
-.Bl -tag -width MAP_FIXEDX
+.Bl -tag -width MAP_FIXEDX -offset indent
 .It Dv PROT_EXEC
 Pages may be executed.
 .It Dv PROT_READ



CVS commit: [netbsd-5] src/sys

2011-04-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Apr  3 06:08:35 UTC 2011

Modified Files:
src/sys/netinet6 [netbsd-5]: ipcomp_input.c
src/sys/netipsec [netbsd-5]: xform_ipcomp.c

Log Message:
Pull up:
  src/sys/netinet6/ipcomp_input.c  revision 1.37
  src/sys/netipsec/xform_ipcomp.c  revision 1.26

(requested by spz in ticket #1590).

mitigation for CVE-2011-1547


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.10.1 src/sys/netinet6/ipcomp_input.c
cvs rdiff -u -r1.18 -r1.18.12.1 src/sys/netipsec/xform_ipcomp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/ipcomp_input.c
diff -u src/sys/netinet6/ipcomp_input.c:1.36 src/sys/netinet6/ipcomp_input.c:1.36.10.1
--- src/sys/netinet6/ipcomp_input.c:1.36	Mon May  5 13:41:30 2008
+++ src/sys/netinet6/ipcomp_input.c	Sun Apr  3 06:08:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipcomp_input.c,v 1.36 2008/05/05 13:41:30 ad Exp $	*/
+/*	$NetBSD: ipcomp_input.c,v 1.36.10.1 2011/04/03 06:08:35 jdc Exp $	*/
 /*	$KAME: ipcomp_input.c,v 1.29 2001/09/04 08:43:19 itojun Exp $	*/
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.36 2008/05/05 13:41:30 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.36.10.1 2011/04/03 06:08:35 jdc Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -148,6 +148,13 @@
 	ipcomp = mtod(md, struct ipcomp *);
 	ip = mtod(m, struct ip *);
 	nxt = ipcomp-comp_nxt;
+	if (nxt == IPPROTO_IPCOMP || nxt == IPPROTO_AH || nxt == IPPROTO_ESP) {
+		/* nested ipcomp - possible attack, not likely useful */
+		ipseclog((LOG_DEBUG, IPv4 IPComp input: nested ipcomp 
+		(bailing)\n));
+		IPSEC_STATINC(IPSEC_STAT_IN_INVAL);
+		goto fail;
+	}
 	hlen = ip-ip_hl  2;
 
 	cpi = ntohs(ipcomp-comp_cpi);

Index: src/sys/netipsec/xform_ipcomp.c
diff -u src/sys/netipsec/xform_ipcomp.c:1.18 src/sys/netipsec/xform_ipcomp.c:1.18.12.1
--- src/sys/netipsec/xform_ipcomp.c:1.18	Wed Apr 23 06:09:05 2008
+++ src/sys/netipsec/xform_ipcomp.c	Sun Apr  3 06:08:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipcomp.c,v 1.18 2008/04/23 06:09:05 thorpej Exp $	*/
+/*	$NetBSD: xform_ipcomp.c,v 1.18.12.1 2011/04/03 06:08:35 jdc Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.18 2008/04/23 06:09:05 thorpej Exp $);
+__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.18.12.1 2011/04/03 06:08:35 jdc Exp $);
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #include opt_inet.h
@@ -318,6 +318,14 @@
 	/* Keep the next protocol field */
 	addr = (uint8_t*) mtod(m, struct ip *) + skip;
 	nproto = ((struct ipcomp *) addr)-comp_nxt;
+	if (nproto == IPPROTO_IPCOMP || nproto == IPPROTO_AH || nproto == IPPROTO_ESP) {
+		IPCOMP_STATINC(IPCOMP_STAT_HDROPS);
+		DPRINTF((ipcomp_input_cb: nested ipcomp, IPCA %s/%08lx\n,
+			 ipsec_address(sav-sah-saidx.dst),
+			 (u_long) ntohl(sav-spi)));
+		error = EINVAL;
+		goto bad;
+	}
 
 	/* Remove the IPCOMP header */
 	error = m_striphdr(m, skip, hlen);



CVS commit: [netbsd-5-0] src/sys

2011-04-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Apr  3 06:09:06 UTC 2011

Modified Files:
src/sys/netinet6 [netbsd-5-0]: ipcomp_input.c
src/sys/netipsec [netbsd-5-0]: xform_ipcomp.c

Log Message:
Pull up:
  src/sys/netinet6/ipcomp_input.c  revision 1.37
  src/sys/netipsec/xform_ipcomp.c  revision 1.26

(requested by spz in ticket #1590).

mitigation for CVE-2011-1547


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.16.1 src/sys/netinet6/ipcomp_input.c
cvs rdiff -u -r1.18 -r1.18.18.1 src/sys/netipsec/xform_ipcomp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/ipcomp_input.c
diff -u src/sys/netinet6/ipcomp_input.c:1.36 src/sys/netinet6/ipcomp_input.c:1.36.16.1
--- src/sys/netinet6/ipcomp_input.c:1.36	Mon May  5 13:41:30 2008
+++ src/sys/netinet6/ipcomp_input.c	Sun Apr  3 06:09:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipcomp_input.c,v 1.36 2008/05/05 13:41:30 ad Exp $	*/
+/*	$NetBSD: ipcomp_input.c,v 1.36.16.1 2011/04/03 06:09:06 jdc Exp $	*/
 /*	$KAME: ipcomp_input.c,v 1.29 2001/09/04 08:43:19 itojun Exp $	*/
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.36 2008/05/05 13:41:30 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.36.16.1 2011/04/03 06:09:06 jdc Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -148,6 +148,13 @@
 	ipcomp = mtod(md, struct ipcomp *);
 	ip = mtod(m, struct ip *);
 	nxt = ipcomp-comp_nxt;
+	if (nxt == IPPROTO_IPCOMP || nxt == IPPROTO_AH || nxt == IPPROTO_ESP) {
+		/* nested ipcomp - possible attack, not likely useful */
+		ipseclog((LOG_DEBUG, IPv4 IPComp input: nested ipcomp 
+		(bailing)\n));
+		IPSEC_STATINC(IPSEC_STAT_IN_INVAL);
+		goto fail;
+	}
 	hlen = ip-ip_hl  2;
 
 	cpi = ntohs(ipcomp-comp_cpi);

Index: src/sys/netipsec/xform_ipcomp.c
diff -u src/sys/netipsec/xform_ipcomp.c:1.18 src/sys/netipsec/xform_ipcomp.c:1.18.18.1
--- src/sys/netipsec/xform_ipcomp.c:1.18	Wed Apr 23 06:09:05 2008
+++ src/sys/netipsec/xform_ipcomp.c	Sun Apr  3 06:09:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipcomp.c,v 1.18 2008/04/23 06:09:05 thorpej Exp $	*/
+/*	$NetBSD: xform_ipcomp.c,v 1.18.18.1 2011/04/03 06:09:06 jdc Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.18 2008/04/23 06:09:05 thorpej Exp $);
+__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.18.18.1 2011/04/03 06:09:06 jdc Exp $);
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #include opt_inet.h
@@ -318,6 +318,14 @@
 	/* Keep the next protocol field */
 	addr = (uint8_t*) mtod(m, struct ip *) + skip;
 	nproto = ((struct ipcomp *) addr)-comp_nxt;
+	if (nproto == IPPROTO_IPCOMP || nproto == IPPROTO_AH || nproto == IPPROTO_ESP) {
+		IPCOMP_STATINC(IPCOMP_STAT_HDROPS);
+		DPRINTF((ipcomp_input_cb: nested ipcomp, IPCA %s/%08lx\n,
+			 ipsec_address(sav-sah-saidx.dst),
+			 (u_long) ntohl(sav-spi)));
+		error = EINVAL;
+		goto bad;
+	}
 
 	/* Remove the IPCOMP header */
 	error = m_striphdr(m, skip, hlen);



CVS commit: [netbsd-5-1] src/sys

2011-04-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Apr  3 06:09:27 UTC 2011

Modified Files:
src/sys/netinet6 [netbsd-5-1]: ipcomp_input.c
src/sys/netipsec [netbsd-5-1]: xform_ipcomp.c

Log Message:
Pull up:
  src/sys/netinet6/ipcomp_input.c  revision 1.37
  src/sys/netipsec/xform_ipcomp.c  revision 1.26

(requested by spz in ticket #1590).

mitigation for CVE-2011-1547


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.24.1 src/sys/netinet6/ipcomp_input.c
cvs rdiff -u -r1.18 -r1.18.22.1 src/sys/netipsec/xform_ipcomp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/ipcomp_input.c
diff -u src/sys/netinet6/ipcomp_input.c:1.36 src/sys/netinet6/ipcomp_input.c:1.36.24.1
--- src/sys/netinet6/ipcomp_input.c:1.36	Mon May  5 13:41:30 2008
+++ src/sys/netinet6/ipcomp_input.c	Sun Apr  3 06:09:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipcomp_input.c,v 1.36 2008/05/05 13:41:30 ad Exp $	*/
+/*	$NetBSD: ipcomp_input.c,v 1.36.24.1 2011/04/03 06:09:26 jdc Exp $	*/
 /*	$KAME: ipcomp_input.c,v 1.29 2001/09/04 08:43:19 itojun Exp $	*/
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.36 2008/05/05 13:41:30 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.36.24.1 2011/04/03 06:09:26 jdc Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -148,6 +148,13 @@
 	ipcomp = mtod(md, struct ipcomp *);
 	ip = mtod(m, struct ip *);
 	nxt = ipcomp-comp_nxt;
+	if (nxt == IPPROTO_IPCOMP || nxt == IPPROTO_AH || nxt == IPPROTO_ESP) {
+		/* nested ipcomp - possible attack, not likely useful */
+		ipseclog((LOG_DEBUG, IPv4 IPComp input: nested ipcomp 
+		(bailing)\n));
+		IPSEC_STATINC(IPSEC_STAT_IN_INVAL);
+		goto fail;
+	}
 	hlen = ip-ip_hl  2;
 
 	cpi = ntohs(ipcomp-comp_cpi);

Index: src/sys/netipsec/xform_ipcomp.c
diff -u src/sys/netipsec/xform_ipcomp.c:1.18 src/sys/netipsec/xform_ipcomp.c:1.18.22.1
--- src/sys/netipsec/xform_ipcomp.c:1.18	Wed Apr 23 06:09:05 2008
+++ src/sys/netipsec/xform_ipcomp.c	Sun Apr  3 06:09:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipcomp.c,v 1.18 2008/04/23 06:09:05 thorpej Exp $	*/
+/*	$NetBSD: xform_ipcomp.c,v 1.18.22.1 2011/04/03 06:09:26 jdc Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.18 2008/04/23 06:09:05 thorpej Exp $);
+__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.18.22.1 2011/04/03 06:09:26 jdc Exp $);
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #include opt_inet.h
@@ -318,6 +318,14 @@
 	/* Keep the next protocol field */
 	addr = (uint8_t*) mtod(m, struct ip *) + skip;
 	nproto = ((struct ipcomp *) addr)-comp_nxt;
+	if (nproto == IPPROTO_IPCOMP || nproto == IPPROTO_AH || nproto == IPPROTO_ESP) {
+		IPCOMP_STATINC(IPCOMP_STAT_HDROPS);
+		DPRINTF((ipcomp_input_cb: nested ipcomp, IPCA %s/%08lx\n,
+			 ipsec_address(sav-sah-saidx.dst),
+			 (u_long) ntohl(sav-spi)));
+		error = EINVAL;
+		goto bad;
+	}
 
 	/* Remove the IPCOMP header */
 	error = m_striphdr(m, skip, hlen);



CVS commit: [netbsd-5-0] src/doc

2011-04-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Apr  3 06:11:06 UTC 2011

Modified Files:
src/doc [netbsd-5-0]: CHANGES-5.0.3

Log Message:
Ticket #1590.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.33 -r1.1.2.34 src/doc/CHANGES-5.0.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-5.0.3
diff -u src/doc/CHANGES-5.0.3:1.1.2.33 src/doc/CHANGES-5.0.3:1.1.2.34
--- src/doc/CHANGES-5.0.3:1.1.2.33	Tue Mar 29 20:13:51 2011
+++ src/doc/CHANGES-5.0.3	Sun Apr  3 06:11:05 2011
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.0.3,v 1.1.2.33 2011/03/29 20:13:51 riz Exp $
+# $NetBSD: CHANGES-5.0.3,v 1.1.2.34 2011/04/03 06:11:05 jdc Exp $
 
 A complete list of changes from the NetBSD 5.0.2 release to the NetBSD 5.0.3
 release:
@@ -2679,3 +2679,9 @@
   
 	[spz, ticket #1586]
 
+sys/netinet6/ipcomp_input.c			1.37
+sys/netipsec/xform_ipcomp.c			1.26
+
+	mitigation for CVE-2011-1547
+	[spz, ticket #1590]
+



CVS commit: [netbsd-5-1] src/doc

2011-04-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Apr  3 06:11:28 UTC 2011

Modified Files:
src/doc [netbsd-5-1]: CHANGES-5.1.1

Log Message:
Ticket #1590.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/doc/CHANGES-5.1.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-5.1.1
diff -u src/doc/CHANGES-5.1.1:1.1.2.18 src/doc/CHANGES-5.1.1:1.1.2.19
--- src/doc/CHANGES-5.1.1:1.1.2.18	Tue Mar 29 20:13:21 2011
+++ src/doc/CHANGES-5.1.1	Sun Apr  3 06:11:28 2011
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1.1,v 1.1.2.18 2011/03/29 20:13:21 riz Exp $
+# $NetBSD: CHANGES-5.1.1,v 1.1.2.19 2011/04/03 06:11:28 jdc Exp $
 
 A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.1.1
 release:
@@ -2352,3 +2352,9 @@
   
 	[spz, ticket #1586]
 
+sys/netinet6/ipcomp_input.c			1.37
+sys/netipsec/xform_ipcomp.c			1.26
+
+	mitigation for CVE-2011-1547
+	[spz, ticket #1590]
+



CVS commit: src/sys/arch/sparc64/dev

2011-04-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Apr  3 06:22:02 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: pcf8591_envctrl.c

Log Message:
Remove ENVSYS_FMONNOTSUPP, so that we can monitor this sensor.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/dev/pcf8591_envctrl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/dev/pcf8591_envctrl.c
diff -u src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.3 src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.4
--- src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.3	Sun Feb 28 15:30:22 2010
+++ src/sys/arch/sparc64/dev/pcf8591_envctrl.c	Sun Apr  3 06:22:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcf8591_envctrl.c,v 1.3 2010/02/28 15:30:22 martin Exp $	*/
+/*	$NetBSD: pcf8591_envctrl.c,v 1.4 2011/04/03 06:22:02 jdc Exp $	*/
 /*	$OpenBSD: pcf8591_envctrl.c,v 1.6 2007/10/25 21:17:20 kettenis Exp $ */
 
 /*
@@ -136,7 +136,7 @@
 
 		sensor = sc-sc_channels[sc-sc_nchan].chan_sensor;
 		sensor-units = ENVSYS_STEMP;
-		sensor-flags |= ENVSYS_FMONLIMITS | ENVSYS_FMONNOTSUPP;
+		sensor-flags |= ENVSYS_FMONLIMITS;
 		strlcpy(sensor-desc, desc, sizeof(sensor-desc));
 
 		if (strncmp(desc, CPU, 3) == 0)



CVS commit: src/sys/arch/sparc64/dev

2011-04-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Apr  3 06:25:11 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: tda.c

Log Message:
Return early if we are called from indirect attach (i.e., not the normal
case).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/dev/tda.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/dev/tda.c
diff -u src/sys/arch/sparc64/dev/tda.c:1.3 src/sys/arch/sparc64/dev/tda.c:1.4
--- src/sys/arch/sparc64/dev/tda.c:1.3	Thu Mar 11 04:19:56 2010
+++ src/sys/arch/sparc64/dev/tda.c	Sun Apr  3 06:25:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tda.c,v 1.3 2010/03/11 04:19:56 mrg Exp $	*/
+/*	$NetBSD: tda.c,v 1.4 2011/04/03 06:25:11 jdc Exp $	*/
 /*	$OpenBSD: tda.c,v 1.4 2008/02/27 17:25:00 robert Exp $ */
 
 /*
@@ -88,6 +88,8 @@
 	 * No need for compatible matching, we know exactly what
 	 * firmware calls us.
 	 */
+	if (ia-ia_name == NULL)
+		return(0);
 	return strcmp(ia-ia_name, fan-control) == 0;
 }
 



CVS commit: src/lib/libc/sys

2011-04-03 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Apr  3 06:54:31 UTC 2011

Modified Files:
src/lib/libc/sys: mprotect.2

Log Message:
.Xr uvm_map_protect, not .Fn.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/sys/mprotect.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/mprotect.2
diff -u src/lib/libc/sys/mprotect.2:1.23 src/lib/libc/sys/mprotect.2:1.24
--- src/lib/libc/sys/mprotect.2:1.23	Sun Apr  3 06:05:21 2011
+++ src/lib/libc/sys/mprotect.2	Sun Apr  3 06:54:30 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: mprotect.2,v 1.23 2011/04/03 06:05:21 jruoho Exp $
+.\	$NetBSD: mprotect.2,v 1.24 2011/04/03 06:54:30 jruoho Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -84,7 +84,7 @@
 An invalid memory range, or invalid parameters were provided.
 .It Bq Er ENOMEM
 A resource shortage occurred while internally calling
-.Fn uvm_map_protect .
+.Xr uvm_map_protect 9 .
 .El
 .Sh SEE ALSO
 .Xr madvise 2 ,



CVS commit: src/sys/net80211

2011-04-03 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Sun Apr  3 10:04:32 UTC 2011

Modified Files:
src/sys/net80211: ieee80211_crypto_tkip.c

Log Message:
make michael_mic() robust against degenerate mbuf layouts like
odd sizes in the middle of a chain


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/net80211/ieee80211_crypto_tkip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net80211/ieee80211_crypto_tkip.c
diff -u src/sys/net80211/ieee80211_crypto_tkip.c:1.10 src/sys/net80211/ieee80211_crypto_tkip.c:1.11
--- src/sys/net80211/ieee80211_crypto_tkip.c:1.10	Wed Dec 17 20:51:37 2008
+++ src/sys/net80211/ieee80211_crypto_tkip.c	Sun Apr  3 10:04:32 2011
@@ -34,7 +34,7 @@
 __FBSDID($FreeBSD: src/sys/net80211/ieee80211_crypto_tkip.c,v 1.10 2005/08/08 18:46:35 sam Exp $);
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, $NetBSD: ieee80211_crypto_tkip.c,v 1.10 2008/12/17 20:51:37 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: ieee80211_crypto_tkip.c,v 1.11 2011/04/03 10:04:32 drochner Exp $);
 #endif
 
 /*
@@ -802,6 +802,8 @@
 	u32 l, r;
 	const uint8_t *data;
 	u_int space;
+	uint8_t spill[4];
+	int nspill = 0;
 
 	michael_mic_hdr(mtod(m, struct ieee80211_frame *), hdr);
 
@@ -824,6 +826,20 @@
 	for (;;) {
 		if (space  data_len)
 			space = data_len;
+		if (nspill) {
+			int n = min(4 - nspill, space);
+			memcpy(spill + nspill, data, n);
+			nspill += n;
+			data += n;
+			space -= n;
+			data_len -= n;
+			if (nspill == 4) {
+l ^= get_le32(spill);
+michael_block(l, r);
+nspill = 0;
+			} else
+goto next;
+		}
 		/* collect 32-bit blocks from current buffer */
 		while (space = sizeof(uint32_t)) {
 			l ^= get_le32(data);
@@ -832,84 +848,27 @@
 			space -= sizeof(uint32_t);
 			data_len -= sizeof(uint32_t);
 		}
-		/*
-		 * NB: when space is zero we make one more trip around
-		 * the loop to advance to the next mbuf where there is
-		 * data.  This handles the case where there are 4*n
-		 * bytes in an mbuf followed by 4 bytes in a later mbuf.
-		 * By making an extra trip we'll drop out of the loop
-		 * with m pointing at the mbuf with 3 bytes and space
-		 * set as required by the remainder handling below.
-		 */
-		if (!data_len || (data_len  sizeof(uint32_t)  space != 0))
+		if (space) {
+			memcpy(spill, data, space);
+			nspill = space;
+			data_len -= space;
+		}
+next:
+		if (!data_len)
 			break;
 		m = m-m_next;
-		if (m == NULL) {
-			IASSERT(0, (out of data, data_len %zu\n, data_len));
-			break;
-		}
-		if (space != 0) {
-			const uint8_t *data_next;
-			/*
-			 * Block straddles buffers, split references.
-			 */
-			data_next = mtod(m, const uint8_t *);
-			IASSERT(m-m_len = sizeof(uint32_t) - space,
-(not enough data in following buffer, 
-m_len %u need %zu\n, m-m_len,
-sizeof(uint32_t) - space));
-			switch (space) {
-			case 1:
-l ^= get_le32_split(data[0], data_next[0],
-	data_next[1], data_next[2]);
-data = data_next + 3;
-space = m-m_len - 3;
-break;
-			case 2:
-l ^= get_le32_split(data[0], data[1],
-	data_next[0], data_next[1]);
-data = data_next + 2;
-space = m-m_len - 2;
-break;
-			case 3:
-l ^= get_le32_split(data[0], data[1],
-	data[2], data_next[0]);
-data = data_next + 1;
-space = m-m_len - 1;
-break;
-			}
-			michael_block(l, r);
-			data_len -= sizeof(uint32_t);
-		} else {
-			/*
-			 * Setup for next buffer.
-			 */
-			data = mtod(m, const uint8_t *);
-			space = m-m_len;
-		}
+		KASSERT(m);
+		/*
+		 * Setup for next buffer.
+		 */
+		data = mtod(m, const uint8_t *);
+		space = m-m_len;
 	}
-	/*
-	 * Catch degenerate cases like mbuf[4*n+1 bytes] followed by
-	 * mbuf[2 bytes].  I don't believe these should happen; if they
-	 * do then we'll need more involved logic.
-	 */
-	KASSERT(data_len = space);
-
 	/* Last block and padding (0x5a, 4..7 x 0) */
-	switch (data_len) {
-	case 0:
-		l ^= get_le32_split(0x5a, 0, 0, 0);
-		break;
-	case 1:
-		l ^= get_le32_split(data[0], 0x5a, 0, 0);
-		break;
-	case 2:
-		l ^= get_le32_split(data[0], data[1], 0x5a, 0);
-		break;
-	case 3:
-		l ^= get_le32_split(data[0], data[1], data[2], 0x5a);
-		break;
-	}
+	spill[nspill++] = 0x5a;
+	for (; nspill  4; nspill++)
+		spill[nspill] = 0;
+	l ^= get_le32(spill);
 	michael_block(l, r);
 	/* l ^= 0; */
 	michael_block(l, r);



CVS commit: src

2011-04-03 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Apr  3 13:29:45 UTC 2011

Modified Files:
src/distrib/sets/lists/xbase: mi
src/external/mit/xorg/bin/ssh-askpass: Makefile
src/x11/bin/ssh-askpass: Makefile

Log Message:
Build the updates ssh-askpass program and add the man page to the xbase set.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/distrib/sets/lists/xbase/mi
cvs rdiff -u -r1.2 -r1.3 src/external/mit/xorg/bin/ssh-askpass/Makefile
cvs rdiff -u -r1.6 -r1.7 src/x11/bin/ssh-askpass/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/xbase/mi
diff -u src/distrib/sets/lists/xbase/mi:1.107 src/distrib/sets/lists/xbase/mi:1.108
--- src/distrib/sets/lists/xbase/mi:1.107	Sun Mar  6 22:15:29 2011
+++ src/distrib/sets/lists/xbase/mi	Sun Apr  3 13:29:45 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.107 2011/03/06 22:15:29 mrg Exp $
+# $NetBSD: mi,v 1.108 2011/04/03 13:29:45 mbalmer Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -2510,6 +2510,7 @@
 ./usr/X11R7/man/cat1/setxkbmap.0			-unknown-	.cat,xorg
 ./usr/X11R7/man/cat1/showrgb.0-unknown-	.cat,xorg
 ./usr/X11R7/man/cat1/smproxy.0-unknown-	.cat,xorg
+./usr/X11R7/man/cat1/ssh-askpass.0			-unknown-	.cat,xorg
 ./usr/X11R7/man/cat1/startx.0-unknown-	.cat,xorg
 ./usr/X11R7/man/cat1/sxpm.0-unknown-	.cat,xorg
 ./usr/X11R7/man/cat1/twm.0-unknown-	.cat,xorg
@@ -2647,6 +2648,7 @@
 ./usr/X11R7/man/html1/setxkbmap.html			-unknown-	html,xorg
 ./usr/X11R7/man/html1/showrgb.html			-unknown-	html,xorg
 ./usr/X11R7/man/html1/smproxy.html			-unknown-	html,xorg
+./usr/X11R7/man/html1/ssh-askpass.html			-unknown-	html,xorg
 ./usr/X11R7/man/html1/startx.html			-unknown-	html,xorg
 ./usr/X11R7/man/html1/sxpm.html-unknown-	html,xorg
 ./usr/X11R7/man/html1/twm.html-unknown-	html,xorg
@@ -2785,6 +2787,7 @@
 ./usr/X11R7/man/man1/setxkbmap.1			-unknown-	.man,xorg
 ./usr/X11R7/man/man1/showrgb.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/smproxy.1-unknown-	.man,xorg
+./usr/X11R7/man/man1/ssh-askpass.1			-unknown-	.man,xorg
 ./usr/X11R7/man/man1/startx.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/sxpm.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/twm.1-unknown-	.man,xorg

Index: src/external/mit/xorg/bin/ssh-askpass/Makefile
diff -u src/external/mit/xorg/bin/ssh-askpass/Makefile:1.2 src/external/mit/xorg/bin/ssh-askpass/Makefile:1.3
--- src/external/mit/xorg/bin/ssh-askpass/Makefile:1.2	Sat Oct 25 22:27:34 2008
+++ src/external/mit/xorg/bin/ssh-askpass/Makefile	Sun Apr  3 13:29:45 2011
@@ -1,6 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2008/10/25 22:27:34 apb Exp $
-
-NOMAN=		yes
+#	$NetBSD: Makefile,v 1.3 2011/04/03 13:29:45 mbalmer Exp $
 
 .include bsd.own.mk
 
@@ -8,6 +6,7 @@
 SRCS=		drawing.c dynlist.c resources.c x11-ssh-askpass.c
 
 APPDEFS=	SshAskpass.ad
+DATE=		February 14, 2001
 
 BUILDSYMLINKS=	SshAskpass-default.ad SshAskpass.ad
 
@@ -29,13 +28,20 @@
 CPPFLAGS+=	-I.
 DPSRCS+=	SshAskpass_ad.h
 CLEANFILES+=	SshAskpass_ad.h
+
+SRCPATH=${X11SRCDIR.local}/programs/x11-ssh-askpass
+
+ssh-askpass.1:  x11-ssh-askpass.man.in
+	sed -e 's#@NAME@#$(PROG)#g' -e 's#@VERSION@#$(VERSION)#g' \
+	-e 's#@DATE@#$(DATE)#g'  ${SRCPATH}/x11-ssh-askpass.man.in  $@
+
 SshAskpass_ad.h: SshAskpass.ad
 	${_MKTARGET_CREATE}
 	rm -f ${.TARGET}
 	${TOOL_SED} -n '/^[^!]/s/.*/,/p' ${.ALLSRC}  ${.TARGET}
 
-LDADD+=		-lXt -lSM -lICE -lXext -lX11
-DPADD+=		${LIBXT} ${LIBSM} ${LIBICE} ${LIBXEXT} ${LIBX11}
+LDADD+=		-lXt -lSM -lICE -lXinerama -lXext -lX11
+DPADD+=		${LIBXT} ${LIBSM} ${LIBICE} ${LIBXINERAMA} ${LIBXEXT} ${LIBX11}
 
 .PATH:		${X11SRCDIR.local}/programs/x11-ssh-askpass
 

Index: src/x11/bin/ssh-askpass/Makefile
diff -u src/x11/bin/ssh-askpass/Makefile:1.6 src/x11/bin/ssh-askpass/Makefile:1.7
--- src/x11/bin/ssh-askpass/Makefile:1.6	Sat Oct 25 22:27:39 2008
+++ src/x11/bin/ssh-askpass/Makefile	Sun Apr  3 13:29:45 2011
@@ -1,6 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2008/10/25 22:27:39 apb Exp $
-
-NOMAN=		yes
+#	$NetBSD: Makefile,v 1.7 2011/04/03 13:29:45 mbalmer Exp $
 
 .include bsd.own.mk
 
@@ -8,6 +6,7 @@
 SRCS=		drawing.c dynlist.c resources.c x11-ssh-askpass.c
 
 APPDEFS=	SshAskpass.ad
+DATE=		February 14, 2001
 
 BUILDSYMLINKS=	SshAskpass-default.ad SshAskpass.ad
 
@@ -19,15 +18,22 @@
 CPPFLAGS+=	-I.
 DPSRCS+=	SshAskpass_ad.h
 CLEANFILES+=	SshAskpass_ad.h
+
+SRCPATH=	${X11SRCDIR.local}/programs/x11-ssh-askpass
+
+ssh-askpass.1:	x11-ssh-askpass.man.in
+	sed -e 's#@NAME@#$(PROG)#g' -e 's#@VERSION@#$(VERSION)#g' \
+	-e 's#@DATE@#$(DATE)#g'  ${SRCPATH}/x11-ssh-askpass.man.in  $@
+
 SshAskpass_ad.h: SshAskpass.ad
 	${_MKTARGET_CREATE}
 	rm -f ${.TARGET}
 	${TOOL_SED} -n '/^[^!]/s/.*/,/p' ${.ALLSRC}  ${.TARGET}
 
-LDADD+=		-lXt -lSM -lICE -lXext -lX11
-DPADD+=		${LIBXT} ${LIBSM} ${LIBICE} ${LIBXEXT} ${LIBX11}
+LDADD+=		-lXt -lSM -lICE 

CVS commit: src/doc

2011-04-03 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Apr  3 13:30:22 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
ssh-askpass updated.


To generate a diff of this commit:
cvs rdiff -u -r1.1532 -r1.1533 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1532 src/doc/CHANGES:1.1533
--- src/doc/CHANGES:1.1532	Thu Mar 31 17:00:57 2011
+++ src/doc/CHANGES	Sun Apr  3 13:30:22 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1532 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1533 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -975,3 +975,4 @@
 	sparc64: add TLS (thread locale storage) support.  [martin 20110330]
 	alpha: add TLS (thread locale storage) support.  [skrll 20110331]
 	atf(7): Import 0.13.  [jmmv 20110331]
+	ssh-askpass: Updated to 1.2.0. [mbalmer 20110403]



CVS commit: xsrc/local/programs/x11-ssh-askpass

2011-04-03 Thread Thomas Klausner
Module Name:xsrc
Committed By:   wiz
Date:   Sun Apr  3 13:42:33 UTC 2011

Modified Files:
xsrc/local/programs/x11-ssh-askpass: x11-ssh-askpass.man.in

Log Message:
Whitespace stuff; new sentence, new line; fix some xrefs; use Aq more.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
xsrc/local/programs/x11-ssh-askpass/x11-ssh-askpass.man.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/local/programs/x11-ssh-askpass/x11-ssh-askpass.man.in
diff -u xsrc/local/programs/x11-ssh-askpass/x11-ssh-askpass.man.in:1.1 xsrc/local/programs/x11-ssh-askpass/x11-ssh-askpass.man.in:1.2
--- xsrc/local/programs/x11-ssh-askpass/x11-ssh-askpass.man.in:1.1	Sun Apr  3 13:28:47 2011
+++ xsrc/local/programs/x11-ssh-askpass/x11-ssh-askpass.man.in	Sun Apr  3 13:42:33 2011
@@ -1,10 +1,12 @@
+.\ $NetBSD: x11-ssh-askpass.man.in,v 1.2 2011/04/03 13:42:33 wiz Exp $
+.\
 .\ x11-ssh-askpass.man
 .\ Created by Matthieu Herrb matth...@laas.fr for OpenBSD
 .\ Modified by Jim Knoble jmkno...@jmknoble.cx for non-OpenBSD
 .\   distribution
 .\
 .Dd @DATE@
-.Dt @NAME@ 1 
+.Dt @NAME@ 1
 .Os Version @VERSION@
 .Sh NAME
 .Nm @NAME@
@@ -30,7 +32,7 @@
 and
 .Ar -title .
 See
-.Xr X 1 . 
+.Xr X 7 .
 .Pp
 If exactly one non-option argument is provided on the command line, it
 is displayed in the dialog instead of the default label.
@@ -40,16 +42,16 @@
 The features of
 .Nm
 are as follows:
-.Bl -dash -offset indent 
-.It 
+.Bl -dash -offset indent
+.It
 Configurable via the standard X resource mechanisms
-.Pa /usr/X11R6/lib/X11/app-defaults , 
-.Pa ~/.Xdefaults , 
-.Xr xrdb 1 , 
+.Pa /usr/X11R6/lib/X11/app-defaults ,
+.Pa ~/.Xdefaults ,
+.Xr xrdb 1 ,
 etc.
-.It 
+.It
 Requires only stock X11 libraries (\%libXt, \%libX11, \%libSM, \%libICE).
-.It 
+.It
 Can be configured to grab the keyboard and/or pointer (grabs the
 keyboard by default, not the pointer).
 .El
@@ -67,12 +69,12 @@
 entered, but does not provide onlookers with a cue as to the length
 of the pass-phrase.
 .Pp
-Pressing the 
+Pressing the
 .Sq OK
 button accepts the pass-phrase (even if it is empty),
 which is printed on the standard output, and the dialog exits with a
 status of zero (success).
-Pressing the 
+Pressing the
 .Sq Cancel
 button discards the
 pass-phrase, and the dialog exits with non-zero status.
@@ -80,7 +82,7 @@
 The following keystrokes work as expected:
 .Bl -tag -width [Backspace] -offset indent -compact
 .Pp
-.It Bq Backspace 
+.It Bq Backspace
 .It Bq Delete
 Erase previous character
 .Pp
@@ -97,7 +99,7 @@
 Discard pass-phrase (Cancel)
 .El
 .Sh WIDGETS
-The main window of 
+The main window of
 .Nm
 has the widget hierarchy indicated below.
 The widget class name is given first, followed by the instance name.
@@ -109,14 +111,14 @@
 .It Indicator
 indicator
 .It Button
-okButton 
+okButton
 .It Button
 cancelButton
 .El
 .El
 .Sh RESOURCES
 The following resources are used to customize the application
-globally: 
+globally:
 .Bl -tag -width 2n -offset indent
 .It Cm grabKeyboard ( No class Cm GrabKeyboard )
 .Bl -inset -compact
@@ -128,20 +130,21 @@
 .Bl -inset -compact
 .It specifies if the application should grab the pointer.
 .It Default value:
-.Dq False . 
+.Dq False .
 .El
 .It Cm grabServer ( No class Cm GrabServer )
 .Bl -inset -compact
 .It specifies if the application should grab the server.
 .It Default value:
-.Dq False . 
+.Dq False .
 .El
 .It Cm inputTimeout ( No class Cm InputTimeout )
 .Bl -inset -compact
 .It the number of seconds
 .Nm
 should wait for a key or
-button press before it gives up and exits.  A timeout of
+button press before it gives up and exits.
+A timeout of
 .Dq 0
 means wait forever.
 .It Default value:
@@ -150,15 +153,16 @@
 .It Cm defaultXResolution ( No class Cm DefaultXResolution )
 .Bl -inset -compact
 .It the number of pixels per unit length that horizontal
-spacing and width values are intended for.  If the actual
+spacing and width values are intended for.
+If the actual
 horizontal (x) resolution of the X server is significantly
 greater or less than this value, portions of the dialog,
 indicator, and button widgets are stretched or shrunk
-horizontally to take the difference into account. The value
-is a positive integer, followed by a slash
+horizontally to take the difference into account.
+The value is a positive integer, followed by a slash
 .Cm ( / )
-and a one- or two-character unit abbreviation.  Valid units
-are inches
+and a one- or two-character unit abbreviation.
+Valid units are inches
 .Cm ( in
 or
 .Cm i )
@@ -171,12 +175,13 @@
 .It Cm defaultYResolution ( No class Cm DefaultYResolution )
 .Bl -inset -compact
 .It the number of pixels per unit length that vertical
-spacing and height values are intended for.  If the actual
+spacing and height values are intended for.
+If the actual
 vertical (y) resolution of the X server is significantly
 greater or less than this value, 

CVS commit: [netbsd-4] src/sys/netinet

2011-04-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr  3 15:05:13 UTC 2011

Modified Files:
src/sys/netinet [netbsd-4]: tcp_output.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1424):
sys/netinet/tcp_output.c: revision 1.170
Clean up setting ECN bit in TOS.  Fixes PR 44742


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.1 -r1.153.2.2 src/sys/netinet/tcp_output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.153.2.1 src/sys/netinet/tcp_output.c:1.153.2.2
--- src/sys/netinet/tcp_output.c:1.153.2.1	Thu May 24 19:13:14 2007
+++ src/sys/netinet/tcp_output.c	Sun Apr  3 15:05:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.153.2.1 2007/05/24 19:13:14 pavel Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.153.2.2 2011/04/03 15:05:13 riz Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -142,7 +142,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcp_output.c,v 1.153.2.1 2007/05/24 19:13:14 pavel Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcp_output.c,v 1.153.2.2 2011/04/03 15:05:13 riz Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -571,6 +571,7 @@
 	boolean_t alwaysfrag;
 	int sack_rxmit;
 	int sack_bytes_rxmt;
+	int ecn_tos;
 	struct sackhole *p;
 #ifdef TCP_SIGNATURE
 	int sigoff = 0;
@@ -697,6 +698,7 @@
 
 	txsegsize_nosack = txsegsize;
 again:
+	ecn_tos = 0;
 	use_tso = has_tso;
 	if ((tp-t_flags  (TF_ECN_SND_CWR|TF_ECN_SND_ECE)) != 0) {
 		/* don't duplicate CWR/ECE. */
@@ -1294,18 +1296,7 @@
 		 */
 		if (len  0  SEQ_GEQ(tp-snd_nxt, tp-snd_max) 
 		!(tp-t_force  len == 1)) {
-			switch (af) {
-#ifdef INET
-			case AF_INET:
-tp-t_inpcb-inp_ip.ip_tos |= IPTOS_ECN_ECT0;
-break;
-#endif
-#ifdef INET6
-			case AF_INET6:
-ip6-ip6_flow |= htonl(IPTOS_ECN_ECT0  20);
-break;
-#endif
-			}
+			ecn_tos = IPTOS_ECN_ECT0;
 			tcpstat.tcps_ecn_ect++;
 		}
 
@@ -1519,12 +1510,12 @@
 		packetlen = m-m_pkthdr.len;
 		if (tp-t_inpcb) {
 			ip-ip_ttl = tp-t_inpcb-inp_ip.ip_ttl;
-			ip-ip_tos = tp-t_inpcb-inp_ip.ip_tos;
+			ip-ip_tos = tp-t_inpcb-inp_ip.ip_tos | ecn_tos;
 		}
 #ifdef INET6
 		else if (tp-t_in6pcb) {
 			ip-ip_ttl = in6_selecthlim(tp-t_in6pcb, NULL); /*XXX*/
-			ip-ip_tos = 0;	/*XXX*/
+			ip-ip_tos = ecn_tos;	/*XXX*/
 		}
 #endif
 		break;
@@ -1543,7 +1534,8 @@
 			ip6-ip6_hlim = in6_selecthlim(tp-t_in6pcb,
 ro-ro_rt ? ro-ro_rt-rt_ifp : NULL);
 		}
-		/* ip6-ip6_flow = ??? */
+		ip6-ip6_flow |= htonl(ecn_tos  20);
+		/* ip6-ip6_flow = ??? (from template) */
 		/* ip6_plen will be filled in ip6_output(). */
 		break;
 #endif



CVS commit: [netbsd-4-0] src/sys/netinet

2011-04-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr  3 15:06:14 UTC 2011

Modified Files:
src/sys/netinet [netbsd-4-0]: tcp_output.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1424):
sys/netinet/tcp_output.c: revision 1.170
Clean up setting ECN bit in TOS.  Fixes PR 44742


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.1 -r1.153.2.1.4.1 src/sys/netinet/tcp_output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.153.2.1 src/sys/netinet/tcp_output.c:1.153.2.1.4.1
--- src/sys/netinet/tcp_output.c:1.153.2.1	Thu May 24 19:13:14 2007
+++ src/sys/netinet/tcp_output.c	Sun Apr  3 15:06:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.153.2.1 2007/05/24 19:13:14 pavel Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.153.2.1.4.1 2011/04/03 15:06:14 riz Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -142,7 +142,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcp_output.c,v 1.153.2.1 2007/05/24 19:13:14 pavel Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcp_output.c,v 1.153.2.1.4.1 2011/04/03 15:06:14 riz Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -571,6 +571,7 @@
 	boolean_t alwaysfrag;
 	int sack_rxmit;
 	int sack_bytes_rxmt;
+	int ecn_tos;
 	struct sackhole *p;
 #ifdef TCP_SIGNATURE
 	int sigoff = 0;
@@ -697,6 +698,7 @@
 
 	txsegsize_nosack = txsegsize;
 again:
+	ecn_tos = 0;
 	use_tso = has_tso;
 	if ((tp-t_flags  (TF_ECN_SND_CWR|TF_ECN_SND_ECE)) != 0) {
 		/* don't duplicate CWR/ECE. */
@@ -1294,18 +1296,7 @@
 		 */
 		if (len  0  SEQ_GEQ(tp-snd_nxt, tp-snd_max) 
 		!(tp-t_force  len == 1)) {
-			switch (af) {
-#ifdef INET
-			case AF_INET:
-tp-t_inpcb-inp_ip.ip_tos |= IPTOS_ECN_ECT0;
-break;
-#endif
-#ifdef INET6
-			case AF_INET6:
-ip6-ip6_flow |= htonl(IPTOS_ECN_ECT0  20);
-break;
-#endif
-			}
+			ecn_tos = IPTOS_ECN_ECT0;
 			tcpstat.tcps_ecn_ect++;
 		}
 
@@ -1519,12 +1510,12 @@
 		packetlen = m-m_pkthdr.len;
 		if (tp-t_inpcb) {
 			ip-ip_ttl = tp-t_inpcb-inp_ip.ip_ttl;
-			ip-ip_tos = tp-t_inpcb-inp_ip.ip_tos;
+			ip-ip_tos = tp-t_inpcb-inp_ip.ip_tos | ecn_tos;
 		}
 #ifdef INET6
 		else if (tp-t_in6pcb) {
 			ip-ip_ttl = in6_selecthlim(tp-t_in6pcb, NULL); /*XXX*/
-			ip-ip_tos = 0;	/*XXX*/
+			ip-ip_tos = ecn_tos;	/*XXX*/
 		}
 #endif
 		break;
@@ -1543,7 +1534,8 @@
 			ip6-ip6_hlim = in6_selecthlim(tp-t_in6pcb,
 ro-ro_rt ? ro-ro_rt-rt_ifp : NULL);
 		}
-		/* ip6-ip6_flow = ??? */
+		ip6-ip6_flow |= htonl(ecn_tos  20);
+		/* ip6-ip6_flow = ??? (from template) */
 		/* ip6_plen will be filled in ip6_output(). */
 		break;
 #endif



CVS commit: [netbsd-4-0] src/sys

2011-04-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr  3 15:15:09 UTC 2011

Modified Files:
src/sys/netinet6 [netbsd-4-0]: ipcomp_input.c
src/sys/netipsec [netbsd-4-0]: xform_ipcomp.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1425):
sys/netipsec/xform_ipcomp.c: revision 1.26
sys/netinet6/ipcomp_input.c: revision 1.37
mitigation for CVE-2011-1547
this should really be solved by counting nested headers (like in the
inet6 case) instead
mitigation for CVE-2011-1547


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.12.1 src/sys/netinet6/ipcomp_input.c
cvs rdiff -u -r1.8.2.1 -r1.8.2.1.4.1 src/sys/netipsec/xform_ipcomp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/ipcomp_input.c
diff -u src/sys/netinet6/ipcomp_input.c:1.30 src/sys/netinet6/ipcomp_input.c:1.30.12.1
--- src/sys/netinet6/ipcomp_input.c:1.30	Thu Nov 16 01:33:45 2006
+++ src/sys/netinet6/ipcomp_input.c	Sun Apr  3 15:15:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipcomp_input.c,v 1.30 2006/11/16 01:33:45 christos Exp $	*/
+/*	$NetBSD: ipcomp_input.c,v 1.30.12.1 2011/04/03 15:15:09 riz Exp $	*/
 /*	$KAME: ipcomp_input.c,v 1.29 2001/09/04 08:43:19 itojun Exp $	*/
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.30 2006/11/16 01:33:45 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.30.12.1 2011/04/03 15:15:09 riz Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -140,6 +140,14 @@
 	ipcomp = mtod(md, struct ipcomp *);
 	ip = mtod(m, struct ip *);
 	nxt = ipcomp-comp_nxt;
+	if (nxt == IPPROTO_IPCOMP || nxt == IPPROTO_AH || nxt == IPPROTO_ESP) {
+		/* nested ipcomp - possible attack, not likely useful */
+		ipseclog((LOG_DEBUG, IPv4 IPComp input: nested ipcomp 
+		 (bailing)\n));
+		ipsecstat.in_inval++;
+		goto fail;
+	}
+
 #ifdef _IP_VHL
 	hlen = IP_VHL_HL(ip-ip_vhl)  2;
 #else

Index: src/sys/netipsec/xform_ipcomp.c
diff -u src/sys/netipsec/xform_ipcomp.c:1.8.2.1 src/sys/netipsec/xform_ipcomp.c:1.8.2.1.4.1
--- src/sys/netipsec/xform_ipcomp.c:1.8.2.1	Thu May 24 19:13:13 2007
+++ src/sys/netipsec/xform_ipcomp.c	Sun Apr  3 15:15:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipcomp.c,v 1.8.2.1 2007/05/24 19:13:13 pavel Exp $	*/
+/*	$NetBSD: xform_ipcomp.c,v 1.8.2.1.4.1 2011/04/03 15:15:09 riz Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.8.2.1 2007/05/24 19:13:13 pavel Exp $);
+__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.8.2.1.4.1 2011/04/03 15:15:09 riz Exp $);
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #include opt_inet.h
@@ -297,6 +297,14 @@
 	/* Keep the next protocol field */
 	addr = (caddr_t) mtod(m, struct ip *) + skip;
 	nproto = ((struct ipcomp *) addr)-comp_nxt;
+	if (nproto == IPPROTO_IPCOMP || nproto == IPPROTO_AH || nproto == IPPROTO_ESP) {
+		ipcompstat.ipcomps_hdrops++;
+		DPRINTF((ipcomp_input_cb: nested ipcomp, IPCA %s/%08lx\n,
+			 ipsec_address(sav-sah-saidx.dst),
+			 (u_long) ntohl(sav-spi)));
+		error = EINVAL;
+		goto bad;
+	}
 
 	/* Remove the IPCOMP header */
 	error = m_striphdr(m, skip, hlen);



CVS commit: [netbsd-4-0] src/doc

2011-04-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr  3 15:15:57 UTC 2011

Modified Files:
src/doc [netbsd-4-0]: CHANGES-4.0.2

Log Message:
Tickets 1424, 1425.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.82 -r1.1.2.83 src/doc/CHANGES-4.0.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-4.0.2
diff -u src/doc/CHANGES-4.0.2:1.1.2.82 src/doc/CHANGES-4.0.2:1.1.2.83
--- src/doc/CHANGES-4.0.2:1.1.2.82	Sun Mar 20 20:52:33 2011
+++ src/doc/CHANGES-4.0.2	Sun Apr  3 15:15:57 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: CHANGES-4.0.2,v 1.1.2.82 2011/03/20 20:52:33 bouyer Exp $
+#	$NetBSD: CHANGES-4.0.2,v 1.1.2.83 2011/04/03 15:15:57 riz Exp $
 
 A complete list of changes from the NetBSD 4.0.1 release to the NetBSD 4.0.2
 release:
@@ -1189,3 +1189,14 @@
 	Check for number of processes resource violation in execve().
 	[spz, ticket #1421]
 
+sys/netinet/tcp_output.c			1.170 via patch
+
+	Clean up setting ECN bit in TOS.  Fixes PR 44742
+	[spz, ticket #1424]
+
+sys/netinet6/ipcomp_input.c			1.37 via patch
+sys/netipsec/xform_ipcomp.c			1.26 via patch
+
+	Prevent nesting ipcomp.  CVE-2011-1547.
+	[spz, ticket #1425]
+



CVS commit: [netbsd-4] src/sys

2011-04-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr  3 15:16:11 UTC 2011

Modified Files:
src/sys/netinet6 [netbsd-4]: ipcomp_input.c
src/sys/netipsec [netbsd-4]: xform_ipcomp.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1425):
sys/netipsec/xform_ipcomp.c: revision 1.26
sys/netinet6/ipcomp_input.c: revision 1.37
mitigation for CVE-2011-1547
this should really be solved by counting nested headers (like in the
inet6 case) instead
mitigation for CVE-2011-1547


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.2.1 src/sys/netinet6/ipcomp_input.c
cvs rdiff -u -r1.8.2.1 -r1.8.2.2 src/sys/netipsec/xform_ipcomp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/ipcomp_input.c
diff -u src/sys/netinet6/ipcomp_input.c:1.30 src/sys/netinet6/ipcomp_input.c:1.30.2.1
--- src/sys/netinet6/ipcomp_input.c:1.30	Thu Nov 16 01:33:45 2006
+++ src/sys/netinet6/ipcomp_input.c	Sun Apr  3 15:16:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipcomp_input.c,v 1.30 2006/11/16 01:33:45 christos Exp $	*/
+/*	$NetBSD: ipcomp_input.c,v 1.30.2.1 2011/04/03 15:16:11 riz Exp $	*/
 /*	$KAME: ipcomp_input.c,v 1.29 2001/09/04 08:43:19 itojun Exp $	*/
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.30 2006/11/16 01:33:45 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipcomp_input.c,v 1.30.2.1 2011/04/03 15:16:11 riz Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -140,6 +140,14 @@
 	ipcomp = mtod(md, struct ipcomp *);
 	ip = mtod(m, struct ip *);
 	nxt = ipcomp-comp_nxt;
+	if (nxt == IPPROTO_IPCOMP || nxt == IPPROTO_AH || nxt == IPPROTO_ESP) {
+		/* nested ipcomp - possible attack, not likely useful */
+		ipseclog((LOG_DEBUG, IPv4 IPComp input: nested ipcomp 
+		 (bailing)\n));
+		ipsecstat.in_inval++;
+		goto fail;
+	}
+
 #ifdef _IP_VHL
 	hlen = IP_VHL_HL(ip-ip_vhl)  2;
 #else

Index: src/sys/netipsec/xform_ipcomp.c
diff -u src/sys/netipsec/xform_ipcomp.c:1.8.2.1 src/sys/netipsec/xform_ipcomp.c:1.8.2.2
--- src/sys/netipsec/xform_ipcomp.c:1.8.2.1	Thu May 24 19:13:13 2007
+++ src/sys/netipsec/xform_ipcomp.c	Sun Apr  3 15:16:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipcomp.c,v 1.8.2.1 2007/05/24 19:13:13 pavel Exp $	*/
+/*	$NetBSD: xform_ipcomp.c,v 1.8.2.2 2011/04/03 15:16:10 riz Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.8.2.1 2007/05/24 19:13:13 pavel Exp $);
+__KERNEL_RCSID(0, $NetBSD: xform_ipcomp.c,v 1.8.2.2 2011/04/03 15:16:10 riz Exp $);
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #include opt_inet.h
@@ -297,6 +297,14 @@
 	/* Keep the next protocol field */
 	addr = (caddr_t) mtod(m, struct ip *) + skip;
 	nproto = ((struct ipcomp *) addr)-comp_nxt;
+	if (nproto == IPPROTO_IPCOMP || nproto == IPPROTO_AH || nproto == IPPROTO_ESP) {
+		ipcompstat.ipcomps_hdrops++;
+		DPRINTF((ipcomp_input_cb: nested ipcomp, IPCA %s/%08lx\n,
+			 ipsec_address(sav-sah-saidx.dst),
+			 (u_long) ntohl(sav-spi)));
+		error = EINVAL;
+		goto bad;
+	}
 
 	/* Remove the IPCOMP header */
 	error = m_striphdr(m, skip, hlen);



CVS commit: [netbsd-4] src/doc

2011-04-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr  3 15:18:32 UTC 2011

Modified Files:
src/doc [netbsd-4]: CHANGES-4.1

Log Message:
Tickets 1424, 1425.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.219 -r1.1.2.220 src/doc/CHANGES-4.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-4.1
diff -u src/doc/CHANGES-4.1:1.1.2.219 src/doc/CHANGES-4.1:1.1.2.220
--- src/doc/CHANGES-4.1:1.1.2.219	Tue Mar 22 08:02:50 2011
+++ src/doc/CHANGES-4.1	Sun Apr  3 15:18:32 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: CHANGES-4.1,v 1.1.2.219 2011/03/22 08:02:50 snj Exp $
+#	$NetBSD: CHANGES-4.1,v 1.1.2.220 2011/04/03 15:18:32 riz Exp $
 
 A complete list of changes from the NetBSD 4.0 release to the NetBSD 4.1
 release:
@@ -4406,3 +4406,14 @@
 	properly).
 	[bouyer, ticket #1414]
 
+sys/netinet/tcp_output.c			1.170 via patch
+
+	Clean up setting ECN bit in TOS.  Fixes PR 44742
+	[spz, ticket #1424]
+
+sys/netinet6/ipcomp_input.c			1.37 via patch
+sys/netipsec/xform_ipcomp.c			1.26 via patch
+
+	Prevent nesting ipcomp.  CVE-2011-1547.
+	[spz, ticket #1425]
+



CVS commit: src

2011-04-03 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Apr  3 16:12:46 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/syscall: Makefile
Added Files:
src/tests/syscall: t_access.c t_mprotect.c

Log Message:
Add couple of simple tests for access(2) and mprotect(2).


To generate a diff of this commit:
cvs rdiff -u -r1.284 -r1.285 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.12 -r1.13 src/tests/syscall/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/syscall/t_access.c \
src/tests/syscall/t_mprotect.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.284 src/distrib/sets/lists/tests/mi:1.285
--- src/distrib/sets/lists/tests/mi:1.284	Thu Mar 31 23:34:48 2011
+++ src/distrib/sets/lists/tests/mi	Sun Apr  3 16:12:45 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.284 2011/03/31 23:34:48 joerg Exp $
+# $NetBSD: mi,v 1.285 2011/04/03 16:12:45 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -564,10 +564,12 @@
 ./usr/libdata/debug/usr/tests/sbin	tests-sbin-tests
 ./usr/libdata/debug/usr/tests/sbin/resize_ffstests-sbin-tests
 ./usr/libdata/debug/usr/tests/syscall	tests-syscall-debug
+./usr/libdata/debug/usr/tests/syscall/t_access.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_cmsg.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_dup.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_fsync.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_mmap.debug			tests-syscall-debug	debug,atf
+./usr/libdata/debug/usr/tests/syscall/t_mprotect.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_timer.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/usr.bin	tests-sbin-tests
 ./usr/libdata/debug/usr/tests/usr.sbin	tests-sbin-tests
@@ -2104,10 +2106,12 @@
 ./usr/tests/sys/rc/t_rc_d_cli			tests-sys-tests	atf
 ./usr/tests/syscalltests-syscall-tests
 ./usr/tests/syscall/Atffile			tests-syscall-tests	atf
+./usr/tests/syscall/t_access			tests-syscall-tests	atf
 ./usr/tests/syscall/t_cmsg			tests-syscall-tests	atf
 ./usr/tests/syscall/t_dup			tests-syscall-tests	atf
 ./usr/tests/syscall/t_fsync			tests-syscall-tests	atf
 ./usr/tests/syscall/t_mmap			tests-syscall-tests	atf
+./usr/tests/syscall/t_mprotect			tests-syscall-tests	atf
 ./usr/tests/syscall/t_timer			tests-syscall-tests	atf
 ./usr/tests/toolchain	tests-syscall-tests	atf
 ./usr/tests/toolchain/Atffile	tests-syscall-tests	atf

Index: src/tests/syscall/Makefile
diff -u src/tests/syscall/Makefile:1.12 src/tests/syscall/Makefile:1.13
--- src/tests/syscall/Makefile:1.12	Thu Mar 31 15:47:57 2011
+++ src/tests/syscall/Makefile	Sun Apr  3 16:12:45 2011
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.12 2011/03/31 15:47:57 jruoho Exp $
+# $NetBSD: Makefile,v 1.13 2011/04/03 16:12:45 jruoho Exp $
 
 .include bsd.own.mk
 
 TESTSDIR=	${TESTSBASE}/syscall
 
-TESTS_C+=	t_cmsg t_dup t_fsync t_mmap t_timer
+TESTS_C+=	t_access t_cmsg t_dup t_fsync t_mmap t_mprotect t_timer
 
 LDADD.t_cmsg+=	-lrumpnet_local -lrumpnet_net -lrumpnet
 LDADD.t_cmsg+=	-lrumpvfs -lrump -lrumpuser -lpthread

Added files:

Index: src/tests/syscall/t_access.c
diff -u /dev/null src/tests/syscall/t_access.c:1.1
--- /dev/null	Sun Apr  3 16:12:46 2011
+++ src/tests/syscall/t_access.c	Sun Apr  3 16:12:46 2011
@@ -0,0 +1,209 @@
+/* $NetBSD: t_access.c,v 1.1 2011/04/03 16:12:46 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jukka Ruohonen.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * 

CVS commit: src/tests/syscall

2011-04-03 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Apr  3 16:22:16 UTC 2011

Modified Files:
src/tests/syscall: t_dup.c t_mprotect.c

Log Message:
Remove leftover stdio.h include.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/syscall/t_dup.c \
src/tests/syscall/t_mprotect.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/syscall/t_dup.c
diff -u src/tests/syscall/t_dup.c:1.1 src/tests/syscall/t_dup.c:1.2
--- src/tests/syscall/t_dup.c:1.1	Thu Mar 31 15:47:56 2011
+++ src/tests/syscall/t_dup.c	Sun Apr  3 16:22:15 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dup.c,v 1.1 2011/03/31 15:47:56 jruoho Exp $ */
+/* $NetBSD: t_dup.c,v 1.2 2011/04/03 16:22:15 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_dup.c,v 1.1 2011/03/31 15:47:56 jruoho Exp $);
+__RCSID($NetBSD: t_dup.c,v 1.2 2011/04/03 16:22:15 jruoho Exp $);
 
 #include sys/stat.h
 
@@ -39,8 +39,6 @@
 #include string.h
 #include unistd.h
 
-#include stdio.h
-
 #include atf-c.h
 
 static char	 path[] = /tmp/dup;
Index: src/tests/syscall/t_mprotect.c
diff -u src/tests/syscall/t_mprotect.c:1.1 src/tests/syscall/t_mprotect.c:1.2
--- src/tests/syscall/t_mprotect.c:1.1	Sun Apr  3 16:12:46 2011
+++ src/tests/syscall/t_mprotect.c	Sun Apr  3 16:22:15 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mprotect.c,v 1.1 2011/04/03 16:12:46 jruoho Exp $ */
+/* $NetBSD: t_mprotect.c,v 1.2 2011/04/03 16:22:15 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_mprotect.c,v 1.1 2011/04/03 16:12:46 jruoho Exp $);
+__RCSID($NetBSD: t_mprotect.c,v 1.2 2011/04/03 16:22:15 jruoho Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -42,8 +42,6 @@
 #include string.h
 #include unistd.h
 
-#include stdio.h		/* XXX. */
-
 #include atf-c.h
 
 static long	page = 0;



CVS commit: src/usr.bin/units

2011-04-03 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Apr  3 19:25:05 UTC 2011

Modified Files:
src/usr.bin/units: units.1

Log Message:
remove stray extra word


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/units/units.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/units/units.1
diff -u src/usr.bin/units/units.1:1.15 src/usr.bin/units/units.1:1.16
--- src/usr.bin/units/units.1:1.15	Mon Mar 28 16:09:10 2011
+++ src/usr.bin/units/units.1	Sun Apr  3 19:25:05 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: units.1,v 1.15 2011/03/28 16:09:10 fair Exp $
+.\	$NetBSD: units.1,v 1.16 2011/04/03 19:25:05 dholland Exp $
 .Dd March 28, 2011
 .Dt UNITS 1
 .Os
@@ -181,5 +181,5 @@
 it doesn't take so long to load the units list and check
 for duplication.
 .Pp
-The program should warn users when they're trying to do perform a conversion
+The program should warn users when they're trying to perform a conversion
 that doesn't make sense, since there are many such combinations.



CVS commit: src/usr.bin/units

2011-04-03 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Apr  3 19:44:15 UTC 2011

Modified Files:
src/usr.bin/units: units.1

Log Message:
Expand user warning (adding examples) and move to CAVEATS as it's not fixable.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/units/units.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/units/units.1
diff -u src/usr.bin/units/units.1:1.16 src/usr.bin/units/units.1:1.17
--- src/usr.bin/units/units.1:1.16	Sun Apr  3 19:25:05 2011
+++ src/usr.bin/units/units.1	Sun Apr  3 19:44:15 2011
@@ -1,5 +1,5 @@
-.\	$NetBSD: units.1,v 1.16 2011/04/03 19:25:05 dholland Exp $
-.Dd March 28, 2011
+.\	$NetBSD: units.1,v 1.17 2011/04/03 19:44:15 dholland Exp $
+.Dd April 3, 2011
 .Dt UNITS 1
 .Os
 .Sh NAME
@@ -159,6 +159,32 @@
 .An Adrian Mariano Aq adr...@cam.cornell.edu
 or
 .Aq mari...@geom.umn.edu
+.Sh CAVEATS
+While
+.Nm
+can be used as a calculator for many unit-related computations,
+caution is required: many computations require additional constant
+factors deriving from the physics (or chemistry or whatever) of the
+situation.
+As these factors are dimensionless,
+.Nm
+cannot itself either provide them or warn the user when they have been
+forgotten.
+For example, one joule is one kilogram meter squared per second
+squared, by definition; however, the kinetic energy of a one-kilogram
+object moving at one meter per second is half a joule, not one joule,
+because of a dimensionless factor that arises from integration.
+.Pp
+Also, some pairs of units that have the same dimensionality are
+nonetheless used to measure different things and attempting to convert
+between them may require additional fudge factors or be entirely
+meaningless.
+For example, torque and energy have the same dimensionality, but
+attempting to convert torque in newton-meters to energy in joules is
+nonsensical.
+There is no practical way for
+.Nm
+to warn about these issues either.
 .Sh BUGS
 The effect of including a
 .Sq \/
@@ -180,6 +206,3 @@
 The program should use a hash table to store units so that
 it doesn't take so long to load the units list and check
 for duplication.
-.Pp
-The program should warn users when they're trying to perform a conversion
-that doesn't make sense, since there are many such combinations.



CVS commit: src/sys/dev/pci

2011-04-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Apr  3 20:05:30 UTC 2011

Modified Files:
src/sys/dev/pci: ahcisata_pci.c

Log Message:
Deregister in ahci_pci_detach() the PMF hooks registered in
ahci_pci_attach().


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/ahcisata_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.23 src/sys/dev/pci/ahcisata_pci.c:1.24
--- src/sys/dev/pci/ahcisata_pci.c:1.23	Sat Nov 13 13:52:05 2010
+++ src/sys/dev/pci/ahcisata_pci.c	Sun Apr  3 20:05:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.23 2010/11/13 13:52:05 uebayasi Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.24 2011/04/03 20:05:30 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahcisata_pci.c,v 1.23 2010/11/13 13:52:05 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahcisata_pci.c,v 1.24 2011/04/03 20:05:30 dyoung Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -241,6 +241,8 @@
 	if ((rv = ahci_detach(sc, flags)))
 		return rv;
 
+	pmf_device_deregister(dv);
+
 	if (psc-sc_ih != NULL)
 		pci_intr_disestablish(psc-sc_pc, psc-sc_ih);
 



CVS commit: src/lib/libc/net

2011-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  3 22:14:15 UTC 2011

Modified Files:
src/lib/libc/net: getservbyname_r.c getservbyport_r.c

Log Message:
Protect against stack smashes (Maksymilian Arciemowicz)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/net/getservbyname_r.c \
src/lib/libc/net/getservbyport_r.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/net/getservbyname_r.c
diff -u src/lib/libc/net/getservbyname_r.c:1.7 src/lib/libc/net/getservbyname_r.c:1.8
--- src/lib/libc/net/getservbyname_r.c:1.7	Sat Apr 24 20:54:46 2010
+++ src/lib/libc/net/getservbyname_r.c	Sun Apr  3 18:14:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: getservbyname_r.c,v 1.7 2010/04/25 00:54:46 joerg Exp $	*/
+/*	$NetBSD: getservbyname_r.c,v 1.8 2011/04/03 22:14:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)getservbyname.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: getservbyname_r.c,v 1.7 2010/04/25 00:54:46 joerg Exp $);
+__RCSID($NetBSD: getservbyname_r.c,v 1.8 2011/04/03 22:14:15 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -69,12 +69,14 @@
 		namelen = strlen(name);
 		if (namelen == 0 || namelen  255)
 			return NULL;
-		if (proto != NULL  *proto == '\0')
-			return NULL;
-		if (proto != NULL)
+		if (proto != NULL) {
 			protolen = strlen(proto);
-		else
+			if (protolen == 0 || protolen  255)
+return NULL;
+		} else
 			protolen = 0;
+		if (namelen + protolen  255)
+			return NULL;
 
 		buf[0] = namelen;
 		buf[1] = protolen;
Index: src/lib/libc/net/getservbyport_r.c
diff -u src/lib/libc/net/getservbyport_r.c:1.7 src/lib/libc/net/getservbyport_r.c:1.8
--- src/lib/libc/net/getservbyport_r.c:1.7	Sat Apr 24 20:54:46 2010
+++ src/lib/libc/net/getservbyport_r.c	Sun Apr  3 18:14:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: getservbyport_r.c,v 1.7 2010/04/25 00:54:46 joerg Exp $	*/
+/*	$NetBSD: getservbyport_r.c,v 1.8 2011/04/03 22:14:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)getservbyport.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: getservbyport_r.c,v 1.7 2010/04/25 00:54:46 joerg Exp $);
+__RCSID($NetBSD: getservbyport_r.c,v 1.8 2011/04/03 22:14:15 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -67,11 +67,11 @@
 
 		port = be16toh(port);
 
-		if (proto != NULL  *proto == '\0')
-			return NULL;
-		if (proto != NULL)
+		if (proto != NULL) {
 			protolen = strlen(proto);
-		else
+			if (protolen == 0 || protolen  255)
+return NULL;
+		} else
 			protolen = 0;
 		if (port  0 || port  65536)
 			return NULL;



CVS commit: src/sys

2011-04-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Apr  3 22:29:28 UTC 2011

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c kgdb_machdep.c trap.c
src/sys/arch/amd64/conf: files.amd64
src/sys/arch/i386/i386: db_interface.c kgdb_machdep.c trap.c
src/sys/arch/i386/include: mca_machdep.h
src/sys/arch/i386/mca: mca_machdep.c
src/sys/arch/x86/include: intr.h
src/sys/arch/x86/x86: intr.c
src/sys/arch/xen/conf: files.xen
src/sys/kern: kgdb_stub.c
src/sys/sys: kgdb.h
Added Files:
src/sys/arch/x86/x86: x86_stub.c

Log Message:
Clean up excessive #ifdef'age of NMI trap handling for amd64/i386/xen.
Handle NMI in all Xen kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/amd64/kgdb_machdep.c
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/i386/i386/db_interface.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/i386/kgdb_machdep.c
cvs rdiff -u -r1.260 -r1.261 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/include/mca_machdep.h
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/mca/mca_machdep.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/x86_stub.c
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.23 -r1.24 src/sys/kern/kgdb_stub.c
cvs rdiff -u -r1.11 -r1.12 src/sys/sys/kgdb.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.22 src/sys/arch/amd64/amd64/db_interface.c:1.23
--- src/sys/arch/amd64/amd64/db_interface.c:1.22	Mon Dec 20 00:25:24 2010
+++ src/sys/arch/amd64/amd64/db_interface.c	Sun Apr  3 22:29:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.22 2010/12/20 00:25:24 matt Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.23 2011/04/03 22:29:25 dyoung Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.22 2010/12/20 00:25:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.23 2011/04/03 22:29:25 dyoung Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -173,9 +173,11 @@
 	db_regs_t dbreg;
 
 	switch (type) {
+	case T_NMI:	/* NMI */
+		printf(NMI ... going to debugger\n);
+		/*FALLTHROUGH*/
 	case T_BPTFLT:	/* breakpoint */
 	case T_TRCTRAP:	/* single_step */
-	case T_NMI:	/* NMI */
 	case -1:	/* keyboard interrupt */
 		break;
 	default:

Index: src/sys/arch/amd64/amd64/kgdb_machdep.c
diff -u src/sys/arch/amd64/amd64/kgdb_machdep.c:1.7 src/sys/arch/amd64/amd64/kgdb_machdep.c:1.8
--- src/sys/arch/amd64/amd64/kgdb_machdep.c:1.7	Mon Dec 20 00:25:24 2010
+++ src/sys/arch/amd64/amd64/kgdb_machdep.c	Sun Apr  3 22:29:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb_machdep.c,v 1.7 2010/12/20 00:25:24 matt Exp $	*/
+/*	$NetBSD: kgdb_machdep.c,v 1.8 2011/04/03 22:29:25 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kgdb_machdep.c,v 1.7 2010/12/20 00:25:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: kgdb_machdep.c,v 1.8 2011/04/03 22:29:25 dyoung Exp $);
 
 #include opt_ddb.h
 
@@ -99,6 +99,13 @@
 	return (1);
 }
 
+void
+kgdb_entry_notice(int type, db_regs_t *regs)
+{
+	if (type == T_NMI)
+		printf(NMI ... going to debugger\n);
+}
+
 /*
  * Translate a trap number into a unix compatible signal value.
  * (gdb only understands unix signal numbers).

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.65 src/sys/arch/amd64/amd64/trap.c:1.66
--- src/sys/arch/amd64/amd64/trap.c:1.65	Mon Dec 20 00:25:24 2010
+++ src/sys/arch/amd64/amd64/trap.c	Sun Apr  3 22:29:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.65 2010/12/20 00:25:24 matt Exp $	*/
+/*	$NetBSD: trap.c,v 1.66 2011/04/03 22:29:25 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.65 2010/12/20 00:25:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.66 2011/04/03 22:29:25 dyoung Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -98,9 +98,7 @@
 #include machine/reg.h
 #include machine/trap.h
 #include machine/userret.h
-#ifdef DDB
 #include machine/db_machdep.h
-#endif
 
 #include x86/nmi.h
 
@@ -108,9 +106,7 @@
 #include isa.h
 #endif
 
-#ifdef KGDB
 #include sys/kgdb.h
-#endif
 
 #ifdef KDTRACE_HOOKS
 #include sys/dtrace_bsd.h
@@ -283,24 +279,17 @@
 		%lx cpl %x rsp %lx\n,
 		type, frame-tf_err, (u_long)frame-tf_rip, frame-tf_cs,
 		frame-tf_rflags, 

CVS commit: src/sys/arch/alpha

2011-04-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Apr  3 23:07:19 UTC 2011

Modified Files:
src/sys/arch/alpha: Makefile

Log Message:
Fix 'tags' target.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/Makefile
diff -u src/sys/arch/alpha/Makefile:1.13 src/sys/arch/alpha/Makefile:1.14
--- src/sys/arch/alpha/Makefile:1.13	Sat Oct 25 22:27:36 2008
+++ src/sys/arch/alpha/Makefile	Sun Apr  3 23:07:19 2011
@@ -1,19 +1,26 @@
-# $NetBSD: Makefile,v 1.13 2008/10/25 22:27:36 apb Exp $
+# $NetBSD: Makefile,v 1.14 2011/04/03 23:07:19 dyoung Exp $
 
 # Makefile for alpha tags file and boot blocks
 
-TALPHA=	../alpha/tags
-SALPHA=	../alpha/alpha/*.[ch] ../alpha/include/*.h \
-	../alpha/pci/*.[ch] ../alpha/tlsb/*.[ch] ../alpha/tc/*.[ch]
-AALPHA=	../alpha/alpha/*.S
+TALPHA=	${SYSDIR}/arch/alpha/tags
+SALPHA=	${SYSDIR}/arch/alpha/alpha/*.[ch] ${SYSDIR}/arch/alpha/common/*.[ch] \
+	${SYSDIR}/arch/alpha/eisa/*.[ch] ${SYSDIR}/arch/alpha/include/*.h \
+	${SYSDIR}/arch/alpha/isa/*.[ch] \
+	${SYSDIR}/arch/alpha/jensenio/*.[ch] ${SYSDIR}/arch/alpha/mcbus/*.[ch] \
+	${SYSDIR}/arch/alpha/pci/*.[ch] ${SYSDIR}/arch/alpha/sableio/*.[ch] \
+	${SYSDIR}/arch/alpha/tc/*.[ch] \
+	${SYSDIR}/arch/alpha/tlsb/*.[ch]
+AALPHA=	${SYSDIR}/arch/alpha/alpha/*.s ${SYSDIR}/arch/alpha/pci/*.s
 
 # Directories in which to place tags links
-DALPHA=	tc include
+DALPHA=	a12 common eisa include isa jensenio mcbus pci sableio tc tlsb
 
 .include ../../kern/Make.tags.inc
 
 tags:
-	-ctags -wdtf ${TALPHA} ${SALPHA} ${COMM} 
+	-rm -f ${TALPHA}
+	-echo ${SALPHA} | xargs ctags -wadtf ${TALPHA}
+	-${FINDCOMM} | xargs ctags -wadtf ${TALPHA}
 	egrep ^ENTRY(.*)|^ALTENTRY(.*) ${AALPHA} | \
 	${TOOL_SED} s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/; \
 	 ${TALPHA}
@@ -21,7 +28,7 @@
 
 links:
 	-for i in ${DALPHA}; do \
-	cd $$i  rm -f tags; ln -s ../tags tags; done
+	(cd $$i  rm -f tags; ln -s ../tags tags); done
 
 
 SUBDIR=	compile include stand



CVS commit: src/sys/arch/arc

2011-04-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Apr  3 23:14:13 UTC 2011

Modified Files:
src/sys/arch/arc: Makefile

Log Message:
Fix 'tags' target.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arc/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arc/Makefile
diff -u src/sys/arch/arc/Makefile:1.11 src/sys/arch/arc/Makefile:1.12
--- src/sys/arch/arc/Makefile:1.11	Sat Oct 25 22:27:36 2008
+++ src/sys/arch/arc/Makefile	Sun Apr  3 23:14:12 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2008/10/25 22:27:36 apb Exp $
+#	$NetBSD: Makefile,v 1.12 2011/04/03 23:14:12 dyoung Exp $
 #	$OpenBSD: Makefile,v 1.5 1997/05/19 10:34:53 pefo Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/16/93
 
@@ -7,11 +7,12 @@
 # Find where mips source files are for inclusion in tags
 .include ../mips/Makefile.inc
 
-TARC=	../arc/tags
-SARC=	../arc/arc/*.[ch] ../arc/dev/*.[ch] \
-	../arc/dti/*.[ch] ../arc/include/*.h ../arc/isa/*.[ch] \
-	../arc/pci/*.[ch] ../arc/jazz/*.[ch]
-AARC=	../arc/arc/*.S
+TARC=	${SYSDIR}/arch/arc/tags
+SARC=	${SYSDIR}/arch/arc/arc/*.[ch] ${SYSDIR}/arch/arc/dev/*.[ch] \
+	${SYSDIR}/arch/arc/dti/*.[ch] ${SYSDIR}/arch/arc/include/*.h \
+	${SYSDIR}/arch/arc/isa/*.[ch] \
+	${SYSDIR}/arch/arc/pci/*.[ch] ${SYSDIR}/arch/arc/jazz/*.[ch]
+AARC=	${SYSDIR}/arch/arc/arc/*.S
 
 # Directories in which to place tags links
 DARC=	arc dev dti include isa pci jazz
@@ -19,7 +20,9 @@
 .include ../../kern/Make.tags.inc
 
 tags:
-	-ctags -wdtf ${TARC} ${SARC} ${SMIPS} ${COMM}
+	-rm -f ${TARC}
+	-echo ${SARC} ${SMIPS} | xargs ctags -wadtf ${TARC}
+	-${FINDCOMM} | xargs ctags -wadtf ${TARC}
 	egrep ^LEAF(.*)|^[AN]LEAF(.*)|^NON_LEAF(.*) ${AARC} ${AMIPS} | \
 	${TOOL_SED} s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/; \
 	 ${TARC}



CVS commit: src/sys/arch/xen/xen

2011-04-03 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Sun Apr  3 23:21:37 UTC 2011

Modified Files:
src/sys/arch/xen/xen: xennetback_xenbus.c

Log Message:
Now that pkgsrc-2011Q1 has arrived, and before -6 chimes in, change
ifxname for xvif(4) from xvif%d.%d to xvif%d-%d. This is needed
to avoid sysctl(9) EINVAL errors when creating interface nodes.

See http://mail-index.netbsd.org/port-xen/2011/01/11/msg006405.html


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/xen/xen/xennetback_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.38 src/sys/arch/xen/xen/xennetback_xenbus.c:1.39
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.38	Tue Jan 18 21:34:31 2011
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Sun Apr  3 23:21:37 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.38 2011/01/18 21:34:31 jym Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.39 2011/04/03 23:21:37 jym Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -271,7 +271,7 @@
 
 	ifp = xneti-xni_if;
 	ifp-if_softc = xneti;
-	snprintf(ifp-if_xname, IFNAMSIZ, xvif%d.%d,
+	snprintf(ifp-if_xname, IFNAMSIZ, xvif%d-%d,
 	(int)domid, (int)handle);
 
 	/* read mac address */



CVS commit: src/share/man/man4

2011-04-03 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Sun Apr  3 23:44:46 UTC 2011

Modified Files:
src/share/man/man4: xvif.4

Log Message:
Update xvif(4). Interface name changed from xvifX.Y to xvifX-Y.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/xvif.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/xvif.4
diff -u src/share/man/man4/xvif.4:1.2 src/share/man/man4/xvif.4:1.3
--- src/share/man/man4/xvif.4:1.2	Tue Jan 11 10:47:45 2011
+++ src/share/man/man4/xvif.4	Sun Apr  3 23:44:46 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: xvif.4,v 1.2 2011/01/11 10:47:45 wiz Exp $
+.\	$NetBSD: xvif.4,v 1.3 2011/04/03 23:44:46 jym Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd January 8, 2011
+.Dd April 4, 2011
 .Dt XVIF 4 xen
 .Os
 .Sh NAME
@@ -62,7 +62,7 @@
 All
 .Nm
 interfaces follow the
-.Dq xvifX.Y
+.Dq xvifX-Y
 naming convention, where
 .Sq X
 represents the guest domain identifier, and
@@ -80,12 +80,12 @@
 similar to two Ethernet cards connected via a crossover cable.
 .Sh DIAGNOSTICS
 .Bl -diag
-.It xvif%d.%d: can't read %s/mac: %d
+.It xvif%d-%d: can't read %s/mac: %d
 The MAC address for this interface could not be read from XenStore.
-.It xvif%d.%d: %s is not a valid mac address
+.It xvif%d-%d: %s is not a valid mac address
 The MAC address specified in the configuration file of the newly
 created guest domain is invalid.
-.It xvif%d.%d: Ethernet address %s
+.It xvif%d-%d: Ethernet address %s
 MAC address of the
 .Nm
 interface.



CVS commit: src/tests/syscall

2011-04-03 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Mon Apr  4 01:49:45 UTC 2011

Modified Files:
src/tests/syscall: t_access.c

Log Message:
Check for getuid(2) == 0.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/syscall/t_access.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/syscall/t_access.c
diff -u src/tests/syscall/t_access.c:1.1 src/tests/syscall/t_access.c:1.2
--- src/tests/syscall/t_access.c:1.1	Sun Apr  3 16:12:46 2011
+++ src/tests/syscall/t_access.c	Mon Apr  4 01:49:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_access.c,v 1.1 2011/04/03 16:12:46 jruoho Exp $ */
+/* $NetBSD: t_access.c,v 1.2 2011/04/04 01:49:45 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_access.c,v 1.1 2011/04/03 16:12:46 jruoho Exp $);
+__RCSID($NetBSD: t_access.c,v 1.2 2011/04/04 01:49:45 jruoho Exp $);
 
 #include errno.h
 #include fcntl.h
@@ -55,6 +55,9 @@
 	size_t i;
 	int fd;
 
+	if (getuid() == 0)
+		return;
+
 	fd = open(path, O_RDONLY | O_CREAT);
 
 	if (fd  0)



CVS commit: src/sys/kern

2011-04-03 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Apr  4 02:46:58 UTC 2011

Modified Files:
src/sys/kern: vfs_vnode.c

Log Message:
getcleanvnode: make static, add few comments, convert checks to asserts.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/vfs_vnode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.4 src/sys/kern/vfs_vnode.c:1.5
--- src/sys/kern/vfs_vnode.c:1.4	Sat Apr  2 07:33:49 2011
+++ src/sys/kern/vfs_vnode.c	Mon Apr  4 02:46:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.4 2011/04/02 07:33:49 rmind Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.5 2011/04/04 02:46:57 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_vnode.c,v 1.4 2011/04/02 07:33:49 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_vnode.c,v 1.5 2011/04/04 02:46:57 rmind Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -215,8 +215,11 @@
 
 /*
  * getcleanvnode: grab a vnode from freelist and clean it.
+ *
+ * = Releases vnode_free_list_lock.
+ * = Returns referenced vnode on success.
  */
-vnode_t *
+static vnode_t *
 getcleanvnode(void)
 {
 	vnode_t *vp;
@@ -233,16 +236,10 @@
 		 * these vnodes should never appear on the
 		 * lists.
 		 */
-		if (vp-v_usecount != 0) {
-			vpanic(vp, free vnode isn't);
-		}
-		if ((vp-v_iflag  VI_CLEAN) != 0) {
-			vpanic(vp, clean vnode on freelist);
-		}
-		if (vp-v_freelisthd != listhd) {
-			printf(vnode sez %p, listhd %p\n, vp-v_freelisthd, listhd);
-			vpanic(vp, list head mismatch);
-		}
+		KASSERT(vp-v_usecount == 0);
+		KASSERT((vp-v_iflag  VI_CLEAN) == 0);
+		KASSERT(vp-v_freelisthd == listhd);
+
 		if (!mutex_tryenter(vp-v_interlock))
 			continue;
 		if ((vp-v_iflag  VI_XLOCK) == 0)
@@ -294,22 +291,19 @@
 		goto retry;
 	}
 
-	if (vp-v_data != NULL || vp-v_uobj.uo_npages != 0 ||
-	!TAILQ_EMPTY(vp-v_uobj.memq)) {
-		vpanic(vp, cleaned vnode isn't);
-	}
-	if (vp-v_numoutput != 0) {
-		vpanic(vp, clean vnode has pending I/O's);
-	}
-	if ((vp-v_iflag  VI_ONWORKLST) != 0) {
-		vpanic(vp, clean vnode on syncer list);
-	}
+	KASSERT(vp-v_data == NULL);
+	KASSERT(vp-v_uobj.uo_npages == 0);
+	KASSERT(TAILQ_EMPTY(vp-v_uobj.memq));
+	KASSERT(vp-v_numoutput == 0);
+	KASSERT((vp-v_iflag  VI_ONWORKLST) == 0);
 
 	return vp;
 }
 
 /*
  * getnewvnode: return the next vnode from the free list.
+ *
+ * = Returns referenced vnode, moved into the mount queue.
  */
 int
 getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *),
@@ -360,6 +354,7 @@
 	(TAILQ_FIRST(vnode_hold_list) == NULL || toggle));
 
 	if (tryalloc) {
+		/* Allocate a new vnode. */
 		numvnodes++;
 		mutex_exit(vnode_free_list_lock);
 		if ((vp = vnalloc(NULL)) == NULL) {
@@ -370,6 +365,7 @@
 	}
 
 	if (vp == NULL) {
+		/* Recycle and get vnode clean. */
 		vp = getcleanvnode();
 		if (vp == NULL) {
 			if (mp != NULL) {
@@ -396,29 +392,28 @@
 	KASSERT(LIST_EMPTY(vp-v_nclist));
 	KASSERT(LIST_EMPTY(vp-v_dnclist));
 
+	/* Initialize vnode. */
 	vp-v_type = VNON;
 	vp-v_tag = tag;
 	vp-v_op = vops;
-	vfs_insmntque(vp, mp);
-	*vpp = vp;
 	vp-v_data = NULL;
 
-	/*
-	 * Initialize uvm_object within vnode.
-	 */
-
 	uobj = vp-v_uobj;
 	KASSERT(uobj-pgops == uvm_vnodeops);
 	KASSERT(uobj-uo_npages == 0);
 	KASSERT(TAILQ_FIRST(uobj-memq) == NULL);
 	vp-v_size = vp-v_writesize = VSIZENOTSET;
 
+	/* Finally, move vnode into the mount queue. */
+	vfs_insmntque(vp, mp);
+
 	if (mp != NULL) {
 		if ((mp-mnt_iflag  IMNT_MPSAFE) != 0)
 			vp-v_vflag |= VV_MPSAFE;
 		vfs_unbusy(mp, true, NULL);
 	}
 
+	*vpp = vp;
 	return 0;
 }