CVS commit: src/tests/lib/libc/sys

2012-03-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 16 06:15:17 UTC 2012

Modified Files:
src/tests/lib/libc/sys: t_msync.c

Log Message:
Don't rely on INT_MAX being unmapped.  Use mmap to get a page and then unmap
it.  Then use that address for msync.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_msync.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/lib/libc/sys/t_msync.c
diff -u src/tests/lib/libc/sys/t_msync.c:1.1 src/tests/lib/libc/sys/t_msync.c:1.2
--- src/tests/lib/libc/sys/t_msync.c:1.1	Thu Jul  7 06:57:54 2011
+++ src/tests/lib/libc/sys/t_msync.c	Fri Mar 16 06:15:17 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msync.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $ */
+/* $NetBSD: t_msync.c,v 1.2 2012/03/16 06:15:17 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_msync.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $);
+__RCSID($NetBSD: t_msync.c,v 1.2 2012/03/16 06:15:17 matt Exp $);
 
 #include sys/mman.h
 
@@ -165,6 +165,8 @@ ATF_TC_HEAD(msync_err, tc)
 ATF_TC_BODY(msync_err, tc)
 {
 
+	char *map = MAP_FAILED;
+
 	/*
 	 * Test that invalid flags error out.
 	 */
@@ -173,7 +175,16 @@ ATF_TC_BODY(msync_err, tc)
 
 	errno = 0;
 
-	ATF_REQUIRE(msync((void *)INT_MAX, page, MS_SYNC) != 0);
+	/*
+	 * Map a page and then unmap to get an unmapped address.
+	 */
+	map = mmap(NULL, page, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE,
+	-1, 0);
+	ATF_REQUIRE(map != MAP_FAILED);
+
+	(void)munmap(map, page);
+
+	ATF_REQUIRE(msync(map, page, MS_SYNC) != 0);
 	ATF_REQUIRE(errno == EFAULT);
 }
 



CVS commit: src/sys/kern

2012-03-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 16 06:47:37 UTC 2012

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

Log Message:
Fix PR/49150.
Make listen(2) match the opengroup specification for what what errno to
return if the socket is connected when a listen(2) is attempted.


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/sys/kern/uipc_socket.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/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.209 src/sys/kern/uipc_socket.c:1.210
--- src/sys/kern/uipc_socket.c:1.209	Wed Feb  1 02:27:23 2012
+++ src/sys/kern/uipc_socket.c	Fri Mar 16 06:47:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.209 2012/02/01 02:27:23 matt Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.210 2012/03/16 06:47:37 matt Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.209 2012/02/01 02:27:23 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.210 2012/03/16 06:47:37 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_sock_counters.h
@@ -622,7 +622,7 @@ solisten(struct socket *so, int backlog,
 	if ((so-so_state  (SS_ISCONNECTED | SS_ISCONNECTING | 
 	SS_ISDISCONNECTING)) != 0) {
 		sounlock(so);
-		return (EOPNOTSUPP);
+		return (EINVAL);
 	}
 	error = (*so-so_proto-pr_usrreq)(so, PRU_LISTEN, NULL,
 	NULL, NULL, l);



CVS commit: src/sys/arch/powerpc/booke

2012-03-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 16 07:23:38 UTC 2012

Modified Files:
src/sys/arch/powerpc/booke: copyin.c

Log Message:
Make sure to have copyinstr return ENAMETOOLONG if the string was too long.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/booke/copyin.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/powerpc/booke/copyin.c
diff -u src/sys/arch/powerpc/booke/copyin.c:1.4 src/sys/arch/powerpc/booke/copyin.c:1.5
--- src/sys/arch/powerpc/booke/copyin.c:1.4	Mon Jun 20 05:20:37 2011
+++ src/sys/arch/powerpc/booke/copyin.c	Fri Mar 16 07:23:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyin.c,v 1.4 2011/06/20 05:20:37 matt Exp $	*/
+/*	$NetBSD: copyin.c,v 1.5 2012/03/16 07:23:38 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: copyin.c,v 1.4 2011/06/20 05:20:37 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: copyin.c,v 1.5 2012/03/16 07:23:38 matt Exp $);
 
 #include sys/param.h
 #include sys/lwp.h
@@ -314,5 +314,8 @@ copyinstr(const void *usaddr, void *kdad
 	pcb-pcb_onfault = NULL;
 	if (done)
 		*done = copylen;
-	return 0;
+	/*
+	 * If the last byte is not NUL (0), then the name is too long.
+	 */
+	return (uint8_t)data ? ENAMETOOLONG : 0;
 }



CVS commit: src/sys/arch/powerpc

2012-03-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 16 07:41:55 UTC 2012

Modified Files:
src/sys/arch/powerpc/include: cpu.h
src/sys/arch/powerpc/powerpc: powerpc_machdep.c

Log Message:
Add CPU_EXECPROT sysctl so that atf can enable exec permission tests for
PPC Booke.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/powerpc/powerpc_machdep.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/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.89 src/sys/arch/powerpc/include/cpu.h:1.90
--- src/sys/arch/powerpc/include/cpu.h:1.89	Tue Dec 13 11:03:52 2011
+++ src/sys/arch/powerpc/include/cpu.h	Fri Mar 16 07:41:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.89 2011/12/13 11:03:52 kiyohara Exp $	*/
+/*	$NetBSD: cpu.h,v 1.90 2012/03/16 07:41:54 matt Exp $	*/
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -444,6 +444,7 @@ void	__syncicache(void *, size_t);
 #define	CPU_POWERSAVE		8	/* int: use CPU powersave mode */
 #define	CPU_BOOTED_DEVICE	9	/* string: device we booted from */
 #define	CPU_BOOTED_KERNEL	10	/* string: kernel we booted */
-#define	CPU_MAXID		11	/* number of valid machdep ids */
+#define	CPU_EXECPROT		11	/* bool: PROT_EXEC works */
+#define	CPU_MAXID		12	/* number of valid machdep ids */
 
 #endif	/* _POWERPC_CPU_H_ */

Index: src/sys/arch/powerpc/powerpc/powerpc_machdep.c
diff -u src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.63 src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.64
--- src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.63	Sun Feb 19 21:06:24 2012
+++ src/sys/arch/powerpc/powerpc/powerpc_machdep.c	Fri Mar 16 07:41:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: powerpc_machdep.c,v 1.63 2012/02/19 21:06:24 rmind Exp $	*/
+/*	$NetBSD: powerpc_machdep.c,v 1.64 2012/03/16 07:41:55 matt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: powerpc_machdep.c,v 1.63 2012/02/19 21:06:24 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: powerpc_machdep.c,v 1.64 2012/03/16 07:41:55 matt Exp $);
 
 #include opt_altivec.h
 #include opt_modular.h
@@ -248,6 +248,13 @@ SYSCTL_SETUP(sysctl_machdep_setup, sysc
 		   NULL, cpu_altivec, NULL, 0,
 		   CTL_MACHDEP, CPU_ALTIVEC, CTL_EOL);
 #endif
+#ifdef PPC_BOOKE
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+		   CTLTYPE_INT, execprot, NULL,
+		   NULL, 1, NULL, 0,
+		   CTL_MACHDEP, CPU_EXECPROT, CTL_EOL);
+#endif
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT,
 		   CTLTYPE_STRING, model, NULL,



CVS commit: src/tests/lib/libc/sys

2012-03-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 16 08:14:12 UTC 2012

Modified Files:
src/tests/lib/libc/sys: t_listen.c

Log Message:
This is no longer expected to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_listen.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/lib/libc/sys/t_listen.c
diff -u src/tests/lib/libc/sys/t_listen.c:1.2 src/tests/lib/libc/sys/t_listen.c:1.3
--- src/tests/lib/libc/sys/t_listen.c:1.2	Wed Mar  7 07:24:05 2012
+++ src/tests/lib/libc/sys/t_listen.c	Fri Mar 16 08:14:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_listen.c,v 1.2 2012/03/07 07:24:05 jruoho Exp $	*/
+/*	$NetBSD: t_listen.c,v 1.3 2012/03/16 08:14:11 matt Exp $	*/
 /*
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -78,8 +78,6 @@ ATF_TC_BODY(listen_err, tc)
 	 * According to IEEE Std 1003.1-2008: if the socket is
 	 * already connected, the call should fail with EINVAL.
 	 */
-	atf_tc_expect_fail(PR standards/46150);
-
 	ATF_REQUIRE(connect(fdb, (struct sockaddr *)sinb, siz) == 0);
 	ATF_REQUIRE_ERRNO(EINVAL, listen(fdb, 1) == -1);
 



CVS commit: src/sys/ufs

2012-03-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar 16 08:39:54 UTC 2012

Modified Files:
src/sys/ufs/ext2fs: ext2fs_lookup.c
src/sys/ufs/ufs: ufs_lookup.c

Log Message:
Fix last commit that broke lookup for dot with op DELETE.

Reviewed by: David Holland dholl...@netbsd.org


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/ufs/ext2fs/ext2fs_lookup.c
cvs rdiff -u -r1.112 -r1.113 src/sys/ufs/ufs/ufs_lookup.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/ufs/ext2fs/ext2fs_lookup.c
diff -u src/sys/ufs/ext2fs/ext2fs_lookup.c:1.68 src/sys/ufs/ext2fs/ext2fs_lookup.c:1.69
--- src/sys/ufs/ext2fs/ext2fs_lookup.c:1.68	Tue Mar 13 18:41:03 2012
+++ src/sys/ufs/ext2fs/ext2fs_lookup.c	Fri Mar 16 08:39:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_lookup.c,v 1.68 2012/03/13 18:41:03 elad Exp $	*/
+/*	$NetBSD: ext2fs_lookup.c,v 1.69 2012/03/16 08:39:54 hannken Exp $	*/
 
 /*
  * Modified for NetBSD 1.2E
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ext2fs_lookup.c,v 1.68 2012/03/13 18:41:03 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: ext2fs_lookup.c,v 1.69 2012/03/16 08:39:54 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -586,18 +586,26 @@ found:
 			results-ulr_count = 0;
 		else
 			results-ulr_count = results-ulr_offset - prevoff;
-		if (flags  ISDOTDOT)
-			VOP_UNLOCK(vdp); /* race to get the inode */
-		error = VFS_VGET(vdp-v_mount, foundino, tdp);
-		if (flags  ISDOTDOT)
-			vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY);
-		if (error)
-			return (error);
+		if (dp-i_number == foundino) {
+			vref(vdp);
+			tdp = vdp;
+		} else {
+			if (flags  ISDOTDOT)
+VOP_UNLOCK(vdp); /* race to get the inode */
+			error = VFS_VGET(vdp-v_mount, foundino, tdp);
+			if (flags  ISDOTDOT)
+vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY);
+			if (error)
+return (error);
+		}
 		/*
 		 * Write access to directory required to delete files.
 		 */
 		if ((error = VOP_ACCESS(vdp, VWRITE, cred)) != 0) {
-			vput(tdp);
+			if (dp-i_number == foundino)
+vrele(tdp);
+			else
+vput(tdp);
 			return (error);
 		}
 		/*
@@ -611,15 +619,13 @@ found:
 			tdp, vdp, genfs_can_sticky(cred, dp-i_uid,
 			VTOI(tdp)-i_uid));
 			if (error) {
-vput(tdp);
+if (dp-i_number == foundino)
+	vrele(tdp);
+else
+	vput(tdp);
 return (EPERM);
 			}
 		}
-		if (dp-i_number == foundino) {
-			vref(vdp);
-			*vpp = vdp;
-			return (0);
-		}
 		*vpp = tdp;
 		return (0);
 	}

Index: src/sys/ufs/ufs/ufs_lookup.c
diff -u src/sys/ufs/ufs/ufs_lookup.c:1.112 src/sys/ufs/ufs/ufs_lookup.c:1.113
--- src/sys/ufs/ufs/ufs_lookup.c:1.112	Tue Mar 13 18:41:14 2012
+++ src/sys/ufs/ufs/ufs_lookup.c	Fri Mar 16 08:39:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_lookup.c,v 1.112 2012/03/13 18:41:14 elad Exp $	*/
+/*	$NetBSD: ufs_lookup.c,v 1.113 2012/03/16 08:39:54 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_lookup.c,v 1.112 2012/03/13 18:41:14 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_lookup.c,v 1.113 2012/03/16 08:39:54 hannken Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_ffs.h
@@ -532,19 +532,27 @@ found:
 			results-ulr_count = 0;
 		else
 			results-ulr_count = results-ulr_offset - prevoff;
-		if (flags  ISDOTDOT)
-			VOP_UNLOCK(vdp); /* race to get the inode */
-		error = VFS_VGET(vdp-v_mount, foundino, tdp);
-		if (flags  ISDOTDOT)
-			vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY);
-		if (error)
-			goto out;
+		if (dp-i_number == foundino) {
+			vref(vdp);
+			tdp = vdp;
+		} else {
+			if (flags  ISDOTDOT)
+VOP_UNLOCK(vdp); /* race to get the inode */
+			error = VFS_VGET(vdp-v_mount, foundino, tdp);
+			if (flags  ISDOTDOT)
+vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY);
+			if (error)
+goto out;
+		}
 		/*
 		 * Write access to directory required to delete files.
 		 */
 		error = VOP_ACCESS(vdp, VWRITE, cred);
 		if (error) {
-			vput(tdp);
+			if (dp-i_number == foundino)
+vrele(tdp);
+			else
+vput(tdp);
 			goto out;
 		}
 		/*
@@ -558,17 +566,14 @@ found:
 			tdp, vdp, genfs_can_sticky(cred, dp-i_uid,
 			VTOI(tdp)-i_uid));
 			if (error) {
-vput(tdp);
+if (dp-i_number == foundino)
+	vrele(tdp);
+else
+	vput(tdp);
 error = EPERM;
 goto out;
 			}
 		}
-		if (dp-i_number == foundino) {
-			vref(vdp);
-			*vpp = vdp;
-			error = 0;
-			goto out;
-		}
 		*vpp = tdp;
 		error = 0;
 		goto out;



CVS commit: src/tests/lib/libc/arch/powerpc

2012-03-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 16 08:51:47 UTC 2012

Modified Files:
src/tests/lib/libc/arch/powerpc: exec_prot_support.c return_one.S

Log Message:
Allow testing of exec pages on PowerPC BookE.
Make return_one actually do the right thing.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/arch/powerpc/exec_prot_support.c \
src/tests/lib/libc/arch/powerpc/return_one.S

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

Modified files:

Index: src/tests/lib/libc/arch/powerpc/exec_prot_support.c
diff -u src/tests/lib/libc/arch/powerpc/exec_prot_support.c:1.1 src/tests/lib/libc/arch/powerpc/exec_prot_support.c:1.2
--- src/tests/lib/libc/arch/powerpc/exec_prot_support.c:1.1	Mon Jul 18 23:16:10 2011
+++ src/tests/lib/libc/arch/powerpc/exec_prot_support.c	Fri Mar 16 08:51:47 2012
@@ -1,11 +1,11 @@
-/*  $NetBSD: exec_prot_support.c,v 1.1 2011/07/18 23:16:10 jym Exp $ */
+/*  $NetBSD: exec_prot_support.c,v 1.2 2012/03/16 08:51:47 matt Exp $ */
 
 /*-
- * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Jean-Yves Migeon.
+ * by Matt Thomas of 3am Software Foundry.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,12 +30,23 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: exec_prot_support.c,v 1.1 2011/07/18 23:16:10 jym Exp $);
+__RCSID($NetBSD: exec_prot_support.c,v 1.2 2012/03/16 08:51:47 matt Exp $);
 
 #include ../../common/exec_prot.h
 
+#include sys/sysctl.h
+
 int
 exec_prot_support(void)
 {
-	return NOTIMPL;
+	int execprot = 0;
+	size_t len = sizeof(execprot);
+
+	if (sysctlbyname(machdep.execprot, execprot, len, NULL, 0)  0)
+		return NOTIMPL;
+
+	if (execprot)
+		return PERPAGE_XP;
+
+	return NO_XP;
 }
Index: src/tests/lib/libc/arch/powerpc/return_one.S
diff -u src/tests/lib/libc/arch/powerpc/return_one.S:1.1 src/tests/lib/libc/arch/powerpc/return_one.S:1.2
--- src/tests/lib/libc/arch/powerpc/return_one.S:1.1	Mon Jul 18 23:16:10 2011
+++ src/tests/lib/libc/arch/powerpc/return_one.S	Fri Mar 16 08:51:47 2012
@@ -1,8 +1,11 @@
-/*	$NetBSD: return_one.S,v 1.1 2011/07/18 23:16:10 jym Exp $ */
+/*	$NetBSD: return_one.S,v 1.2 2012/03/16 08:51:47 matt Exp $ */
 
 #include machine/asm.h
 
-.globl	return_one, return_one_end;
+.globl	return_one, return_one_end
 
-return_one: return_one_end:
-	nop
+_ENTRY(return_one)
+	li	%r3, 1
+	blr
+return_one_end:
+END(return_one)



CVS commit: src/libexec/ld.elf_so

2012-03-16 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Mar 16 11:44:54 UTC 2012

Modified Files:
src/libexec/ld.elf_so: diagassert.c

Log Message:
This version of __diagssert13 is dead.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/libexec/ld.elf_so/diagassert.c

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

Modified files:

Index: src/libexec/ld.elf_so/diagassert.c
diff -u src/libexec/ld.elf_so/diagassert.c:1.1 src/libexec/ld.elf_so/diagassert.c:1.2
--- src/libexec/ld.elf_so/diagassert.c:1.1	Thu Mar 15 00:16:07 2012
+++ src/libexec/ld.elf_so/diagassert.c	Fri Mar 16 11:44:54 2012
@@ -1,7 +1,7 @@
 #include assert.h
 #include stdlib.h
 
-void
+__dead void
 /*ARGSUSED*/
 __diagassert13(const char *fn, int fl, const char *fu, const char *m)
 {



CVS commit: src/sys/fs/puffs

2012-03-16 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Mar 16 23:13:49 UTC 2012

Modified Files:
src/sys/fs/puffs: puffs_vnops.c

Log Message:
Prevent access beyond end of PUFFS file on read,
similar to as is done for NFS.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/fs/puffs/puffs_vnops.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/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.163 src/sys/fs/puffs/puffs_vnops.c:1.164
--- src/sys/fs/puffs/puffs_vnops.c:1.163	Tue Jan 17 09:30:16 2012
+++ src/sys/fs/puffs/puffs_vnops.c	Fri Mar 16 23:13:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.163 2012/01/17 09:30:16 martin Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.164 2012/03/16 23:13:48 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: puffs_vnops.c,v 1.163 2012/01/17 09:30:16 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: puffs_vnops.c,v 1.164 2012/03/16 23:13:48 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -1862,6 +1862,9 @@ puffs_vnop_read(void *v)
 		const int advice = IO_ADV_DECODE(ap-a_ioflag);
 
 		while (uio-uio_resid  0) {
+			if (vp-v_size = uio-uio_offset) {
+break;
+			}
 			bytelen = MIN(uio-uio_resid,
 			vp-v_size - uio-uio_offset);
 			if (bytelen == 0)



CVS commit: src/sbin/route

2012-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 02:13:45 UTC 2012

Modified Files:
src/sbin/route: route.c

Log Message:
PR/42179: Christoph Badura: Be a little friendlier about missing args.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sbin/route/route.c

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

Modified files:

Index: src/sbin/route/route.c
diff -u src/sbin/route/route.c:1.136 src/sbin/route/route.c:1.137
--- src/sbin/route/route.c:1.136	Sun Dec 25 19:20:43 2011
+++ src/sbin/route/route.c	Fri Mar 16 22:13:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.136 2011/12/26 00:20:43 christos Exp $	*/
+/*	$NetBSD: route.c,v 1.137 2012/03/17 02:13:44 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)route.c	8.6 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: route.c,v 1.136 2011/12/26 00:20:43 christos Exp $);
+__RCSID($NetBSD: route.c,v 1.137 2012/03/17 02:13:44 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -1031,6 +1031,10 @@ newroute(int argc, char *const *argv)
 			}
 		}
 	}
+	if ((rtm_addrs  RTA_DST) == 0)
+		errx(EXIT_FAILURE, missing destination specification);
+	if (*cmd == 'a'  (rtm_addrs  RTA_GATEWAY) == 0)
+		errx(EXIT_FAILURE, missing gateway specification);
 	if (forcehost  forcenet)
 		errx(EXIT_FAILURE, -host and -net conflict);
 	else if (forcehost)



CVS commit: src/sbin/ifconfig

2012-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 02:25:08 UTC 2012

Modified Files:
src/sbin/ifconfig: af_inetany.c

Log Message:
PR/43141: Tobias Nygren: Print an error on unknown interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sbin/ifconfig/af_inetany.c

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

Modified files:

Index: src/sbin/ifconfig/af_inetany.c
diff -u src/sbin/ifconfig/af_inetany.c:1.14 src/sbin/ifconfig/af_inetany.c:1.15
--- src/sbin/ifconfig/af_inetany.c:1.14	Tue May 24 07:38:56 2011
+++ src/sbin/ifconfig/af_inetany.c	Fri Mar 16 22:25:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: af_inetany.c,v 1.14 2011/05/24 11:38:56 joerg Exp $	*/
+/*	$NetBSD: af_inetany.c,v 1.15 2012/03/17 02:25:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: af_inetany.c,v 1.14 2011/05/24 11:38:56 joerg Exp $);
+__RCSID($NetBSD: af_inetany.c,v 1.15 2012/03/17 02:25:08 christos Exp $);
 #endif /* not lint */
 
 #include sys/param.h 
@@ -81,7 +81,7 @@ commit_address(prop_dictionary_t env, pr
 		err(EXIT_FAILURE, %s: getsock, __func__);
 
 	if ((ifname = getifinfo(env, oenv, flags)) == NULL)
-		return;
+		err(EXIT_FAILURE, %s: getifinfo, __func__);
 
 	strlcpy(param-name[0].buf, ifname, param-name[0].buflen);
 	strlcpy(param-name[1].buf, ifname, param-name[1].buflen);



CVS commit: src/sys/netinet

2012-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 02:48:51 UTC 2012

Modified Files:
src/sys/netinet: tcp_usrreq.c

Log Message:
PR/46077: M. Nunberg: Stat should not fial on connecting socket.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/netinet/tcp_usrreq.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_usrreq.c
diff -u src/sys/netinet/tcp_usrreq.c:1.162 src/sys/netinet/tcp_usrreq.c:1.163
--- src/sys/netinet/tcp_usrreq.c:1.162	Thu Feb  2 14:43:07 2012
+++ src/sys/netinet/tcp_usrreq.c	Fri Mar 16 22:48:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_usrreq.c,v 1.162 2012/02/02 19:43:07 tls Exp $	*/
+/*	$NetBSD: tcp_usrreq.c,v 1.163 2012/03/17 02:48:51 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -95,7 +95,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcp_usrreq.c,v 1.162 2012/02/02 19:43:07 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcp_usrreq.c,v 1.163 2012/03/17 02:48:51 christos Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -267,11 +267,11 @@ tcp_usrreq(struct socket *so, int req,
 	 * a (struct inpcb) pointed at by the socket, and this
 	 * structure will point at a subsidary (struct tcpcb).
 	 */
-#ifndef INET6
-	if (inp == 0  req != PRU_ATTACH)
-#else
-	if ((inp == 0  in6p == 0)  req != PRU_ATTACH)
+	if ((inp == 0
+#ifdef INET6
+	 in6p == 0
 #endif
+	)  (req != PRU_ATTACH  req != PRU_SENSE))
 	{
 		error = EINVAL;
 		goto release;