svn commit: r223691 - in projects/largeSMP: . contrib/ntp/ntpd contrib/top sbin/fsck_ffs sbin/ipfw share/man/man4 share/mk sys/amd64/amd64 sys/arm/arm sys/arm/mv sys/conf sys/dev/ath sys/dev/e1000 ...

Attilio Rao attilio at FreeBSD.org
Thu Jun 30 10:19:44 UTC 2011


Author: attilio
Date: Thu Jun 30 10:19:43 2011
New Revision: 223691
URL: http://svn.freebsd.org/changeset/base/223691

Log:
  MFC

Modified:
  projects/largeSMP/UPDATING
  projects/largeSMP/contrib/ntp/ntpd/ntp_config.c
  projects/largeSMP/contrib/ntp/ntpd/ntp_intres.c
  projects/largeSMP/sbin/fsck_ffs/suj.c
  projects/largeSMP/sbin/ipfw/ipfw.8
  projects/largeSMP/sbin/ipfw/ipfw2.c
  projects/largeSMP/sbin/ipfw/ipfw2.h
  projects/largeSMP/share/man/man4/jme.4
  projects/largeSMP/sys/amd64/amd64/pmap.c
  projects/largeSMP/sys/amd64/amd64/sys_machdep.c
  projects/largeSMP/sys/arm/arm/pmap.c
  projects/largeSMP/sys/arm/arm/sys_machdep.c
  projects/largeSMP/sys/arm/mv/common.c
  projects/largeSMP/sys/conf/NOTES
  projects/largeSMP/sys/conf/options
  projects/largeSMP/sys/dev/ath/if_ath.c
  projects/largeSMP/sys/dev/e1000/if_em.c
  projects/largeSMP/sys/dev/e1000/if_igb.c
  projects/largeSMP/sys/dev/e1000/if_igb.h
  projects/largeSMP/sys/dev/mii/e1000phy.c
  projects/largeSMP/sys/dev/mii/miidevs
  projects/largeSMP/sys/dev/uart/uart_bus_pci.c
  projects/largeSMP/sys/fs/tmpfs/tmpfs_subr.c
  projects/largeSMP/sys/i386/i386/pmap.c
  projects/largeSMP/sys/i386/i386/sys_machdep.c
  projects/largeSMP/sys/i386/xen/pmap.c
  projects/largeSMP/sys/ia64/ia64/pmap.c
  projects/largeSMP/sys/kern/subr_trap.c
  projects/largeSMP/sys/kern/sys_capability.c
  projects/largeSMP/sys/kern/uipc_shm.c
  projects/largeSMP/sys/kern/vfs_subr.c
  projects/largeSMP/sys/mips/mips/pmap.c
  projects/largeSMP/sys/netinet/ip_fw.h
  projects/largeSMP/sys/netinet/ip_var.h
  projects/largeSMP/sys/netinet/ipfw/ip_fw2.c
  projects/largeSMP/sys/netinet/ipfw/ip_fw_log.c
  projects/largeSMP/sys/netinet/ipfw/ip_fw_sockopt.c
  projects/largeSMP/sys/nfs/bootp_subr.c
  projects/largeSMP/sys/ufs/ffs/ffs_inode.c
  projects/largeSMP/sys/ufs/ffs/ffs_softdep.c
  projects/largeSMP/sys/vm/vm_map.c
  projects/largeSMP/sys/vm/vm_object.c
  projects/largeSMP/sys/vm/vm_object.h
  projects/largeSMP/sys/vm/vnode_pager.c
  projects/largeSMP/usr.bin/quota/quota.c
Directory Properties:
  projects/largeSMP/   (props changed)
  projects/largeSMP/cddl/contrib/opensolaris/   (props changed)
  projects/largeSMP/contrib/bind9/   (props changed)
  projects/largeSMP/contrib/binutils/   (props changed)
  projects/largeSMP/contrib/bzip2/   (props changed)
  projects/largeSMP/contrib/compiler-rt/   (props changed)
  projects/largeSMP/contrib/dialog/   (props changed)
  projects/largeSMP/contrib/ee/   (props changed)
  projects/largeSMP/contrib/expat/   (props changed)
  projects/largeSMP/contrib/file/   (props changed)
  projects/largeSMP/contrib/gcc/   (props changed)
  projects/largeSMP/contrib/gdb/   (props changed)
  projects/largeSMP/contrib/gdtoa/   (props changed)
  projects/largeSMP/contrib/gnu-sort/   (props changed)
  projects/largeSMP/contrib/groff/   (props changed)
  projects/largeSMP/contrib/less/   (props changed)
  projects/largeSMP/contrib/libpcap/   (props changed)
  projects/largeSMP/contrib/libstdc++/   (props changed)
  projects/largeSMP/contrib/llvm/   (props changed)
  projects/largeSMP/contrib/llvm/tools/clang/   (props changed)
  projects/largeSMP/contrib/ncurses/   (props changed)
  projects/largeSMP/contrib/netcat/   (props changed)
  projects/largeSMP/contrib/ntp/   (props changed)
  projects/largeSMP/contrib/one-true-awk/   (props changed)
  projects/largeSMP/contrib/openbsm/   (props changed)
  projects/largeSMP/contrib/openpam/   (props changed)
  projects/largeSMP/contrib/pf/   (props changed)
  projects/largeSMP/contrib/sendmail/   (props changed)
  projects/largeSMP/contrib/tcpdump/   (props changed)
  projects/largeSMP/contrib/tcsh/   (props changed)
  projects/largeSMP/contrib/tnftp/   (props changed)
  projects/largeSMP/contrib/top/   (props changed)
  projects/largeSMP/contrib/top/install-sh   (props changed)
  projects/largeSMP/contrib/tzcode/stdtime/   (props changed)
  projects/largeSMP/contrib/tzcode/zic/   (props changed)
  projects/largeSMP/contrib/tzdata/   (props changed)
  projects/largeSMP/contrib/wpa/   (props changed)
  projects/largeSMP/contrib/xz/   (props changed)
  projects/largeSMP/crypto/openssh/   (props changed)
  projects/largeSMP/crypto/openssl/   (props changed)
  projects/largeSMP/gnu/lib/   (props changed)
  projects/largeSMP/gnu/usr.bin/binutils/   (props changed)
  projects/largeSMP/gnu/usr.bin/cc/cc_tools/   (props changed)
  projects/largeSMP/gnu/usr.bin/gdb/   (props changed)
  projects/largeSMP/lib/libc/   (props changed)
  projects/largeSMP/lib/libc/stdtime/   (props changed)
  projects/largeSMP/lib/libutil/   (props changed)
  projects/largeSMP/lib/libz/   (props changed)
  projects/largeSMP/sbin/   (props changed)
  projects/largeSMP/sbin/ipfw/   (props changed)
  projects/largeSMP/share/mk/bsd.arch.inc.mk   (props changed)
  projects/largeSMP/share/zoneinfo/   (props changed)
  projects/largeSMP/sys/   (props changed)
  projects/largeSMP/sys/amd64/include/xen/   (props changed)
  projects/largeSMP/sys/boot/   (props changed)
  projects/largeSMP/sys/boot/i386/efi/   (props changed)
  projects/largeSMP/sys/boot/ia64/efi/   (props changed)
  projects/largeSMP/sys/boot/ia64/ski/   (props changed)
  projects/largeSMP/sys/boot/powerpc/boot1.chrp/   (props changed)
  projects/largeSMP/sys/boot/powerpc/ofw/   (props changed)
  projects/largeSMP/sys/cddl/contrib/opensolaris/   (props changed)
  projects/largeSMP/sys/conf/   (props changed)
  projects/largeSMP/sys/contrib/dev/acpica/   (props changed)
  projects/largeSMP/sys/contrib/octeon-sdk/   (props changed)
  projects/largeSMP/sys/contrib/pf/   (props changed)
  projects/largeSMP/sys/contrib/x86emu/   (props changed)
  projects/largeSMP/usr.bin/calendar/   (props changed)
  projects/largeSMP/usr.bin/csup/   (props changed)
  projects/largeSMP/usr.bin/procstat/   (props changed)
  projects/largeSMP/usr.sbin/ndiscvt/   (props changed)
  projects/largeSMP/usr.sbin/zic/   (props changed)

Modified: projects/largeSMP/UPDATING
==============================================================================
--- projects/largeSMP/UPDATING	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/UPDATING	Thu Jun 30 10:19:43 2011	(r223691)
@@ -25,6 +25,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.
 20110628:
 	The packet filter (pf) code has been updated to OpenBSD 4.5.
 	You need to update userland tools to be in sync with kernel.
+	This update breaks backward compatibility with earlier pfsync(4)
+	versions.  Care must be taken when updating redundant firewall setups.
 
 20110608:
 	The following sysctls and tunables are retired on x86 platforms:

Modified: projects/largeSMP/contrib/ntp/ntpd/ntp_config.c
==============================================================================
--- projects/largeSMP/contrib/ntp/ntpd/ntp_config.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/contrib/ntp/ntpd/ntp_config.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -414,7 +414,7 @@ enum gnn_type {
 static	int getnetnum P((const char *, struct sockaddr_storage *, int,
 			 enum gnn_type));
 static	void save_resolve P((char *, int, int, int, int, u_int, int,
-    keyid_t, u_char *));
+    keyid_t, u_char *, u_char));
 static	void do_resolve_internal P((void));
 static	void abort_resolve P((void));
 #if !defined(VMS) && !defined(SYS_WINNT)
@@ -870,9 +870,9 @@ getconfig(
 						stoa(&peeraddr));
 			    }
 			} else if (errflg == -1) {
-				save_resolve(tokens[1], hmode, peerversion,
+				save_resolve(tokens[istart - 1], hmode, peerversion,
 				    minpoll, maxpoll, peerflags, ttl,
-				    peerkey, peerkeystr);
+				    peerkey, peerkeystr, peeraddr.ss_family);
 			}
 			break;
 
@@ -2325,7 +2325,8 @@ save_resolve(
 	u_int flags,
 	int ttl,
 	keyid_t keyid,
-	u_char *keystr
+	u_char *keystr,
+	u_char peeraf
 	)
 {
 #ifndef SYS_VXWORKS
@@ -2365,11 +2366,11 @@ save_resolve(
 	}
 #endif
 
-	(void)fprintf(res_fp, "%s %d %d %d %d %d %d %u %s\n", name,
+	(void)fprintf(res_fp, "%s %u %d %d %d %d %d %d %u %s\n", name, peeraf,
 	    mode, version, minpoll, maxpoll, flags, ttl, keyid, keystr);
 #ifdef DEBUG
 	if (debug > 1)
-		printf("config: %s %d %d %d %d %x %d %u %s\n", name, mode,
+		printf("config: %s %u %d %d %d %d %x %d %u %s\n", name, peeraf, mode,
 		    version, minpoll, maxpoll, flags, ttl, keyid, keystr);
 #endif
 

Modified: projects/largeSMP/contrib/ntp/ntpd/ntp_intres.c
==============================================================================
--- projects/largeSMP/contrib/ntp/ntpd/ntp_intres.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/contrib/ntp/ntpd/ntp_intres.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -29,6 +29,7 @@
 
 #include <stdio.h>
 #include <ctype.h>
+#include <resolv.h>
 #include <signal.h>
 
 /**/
@@ -111,15 +112,16 @@ static	int resolve_value;	/* next value 
  * is supposed to consist of entries in the following order
  */
 #define	TOK_HOSTNAME	0
-#define	TOK_HMODE	1
-#define	TOK_VERSION	2
-#define TOK_MINPOLL	3
-#define TOK_MAXPOLL	4
-#define	TOK_FLAGS	5
-#define TOK_TTL		6
-#define	TOK_KEYID	7
-#define TOK_KEYSTR	8
-#define	NUMTOK		9
+#define	TOK_PEERAF	1
+#define	TOK_HMODE	2
+#define	TOK_VERSION	3
+#define TOK_MINPOLL	4
+#define TOK_MAXPOLL	5
+#define	TOK_FLAGS	6
+#define TOK_TTL		7
+#define	TOK_KEYID	8
+#define TOK_KEYSTR	9
+#define	NUMTOK		10
 
 #define	MAXLINESIZE	512
 
@@ -140,7 +142,7 @@ char *req_file;		/* name of the file wit
 static	void	checkparent	P((void));
 static	void	removeentry	P((struct conf_entry *));
 static	void	addentry	P((char *, int, int, int, int, u_int,
-				   int, keyid_t, char *));
+				   int, keyid_t, char *, u_char));
 static	int	findhostaddr	P((struct conf_entry *));
 static	void	openntp		P((void));
 static	int	request		P((struct conf_peer *));
@@ -397,7 +399,8 @@ addentry(
 	u_int flags,
 	int ttl,
 	keyid_t keyid,
-	char *keystr
+	char *keystr,
+	u_char peeraf
 	)
 {
 	register char *cp;
@@ -407,7 +410,7 @@ addentry(
 #ifdef DEBUG
 	if (debug > 1)
 		msyslog(LOG_INFO, 
-		    "intres: <%s> %d %d %d %d %x %d %x %s\n", name,
+		    "intres: <%s> %u %d %d %d %d %x %d %x %s\n", name, peeraf,
 		    mode, version, minpoll, maxpoll, flags, ttl, keyid,
 		    keystr);
 #endif
@@ -422,6 +425,7 @@ addentry(
 	ce->ce_peeraddr6 = in6addr_any;
 #endif
 	ANYSOCK(&ce->peer_store);
+	ce->peer_store.ss_family = peeraf;	/* Save AF for getaddrinfo hints. */
 	ce->ce_hmode = (u_char)mode;
 	ce->ce_version = (u_char)version;
 	ce->ce_minpoll = (u_char)minpoll;
@@ -482,7 +486,8 @@ findhostaddr(
 			entry->ce_name));
 
 		memset(&hints, 0, sizeof(hints));
-		hints.ai_family = AF_UNSPEC;
+		hints.ai_family = entry->peer_store.ss_family;
+		hints.ai_socktype = SOCK_DGRAM;
 		/*
 		 * If the IPv6 stack is not available look only for IPv4 addresses
 		 */
@@ -1051,6 +1056,13 @@ readconf(
 			}
 		}
 
+		if (intval[TOK_PEERAF] != AF_UNSPEC && intval[TOK_PEERAF] !=
+		    AF_INET && intval[TOK_PEERAF] != AF_INET6) {
+			msyslog(LOG_ERR, "invalid peer address family (%u) in "
+			    "file %s", intval[TOK_PEERAF], name);
+			exit(1);
+		}
+
 		if (intval[TOK_HMODE] != MODE_ACTIVE &&
 		    intval[TOK_HMODE] != MODE_CLIENT &&
 		    intval[TOK_HMODE] != MODE_BROADCAST) {
@@ -1107,7 +1119,7 @@ readconf(
 		addentry(token[TOK_HOSTNAME], (int)intval[TOK_HMODE],
 			 (int)intval[TOK_VERSION], (int)intval[TOK_MINPOLL],
 			 (int)intval[TOK_MAXPOLL], flags, (int)intval[TOK_TTL],
-			 intval[TOK_KEYID], token[TOK_KEYSTR]);
+			 intval[TOK_KEYID], token[TOK_KEYSTR], (u_char)intval[TOK_PEERAF]);
 	}
 }
 
@@ -1129,6 +1141,9 @@ doconfigure(
 			    dores ? "with" : "without" );
 #endif
 
+	if (dores)         /* Reload /etc/resolv.conf - bug 1226 */
+		res_init();
+
 	ce = confentries;
 	while (ce != NULL) {
 #ifdef DEBUG

Modified: projects/largeSMP/sbin/fsck_ffs/suj.c
==============================================================================
--- projects/largeSMP/sbin/fsck_ffs/suj.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sbin/fsck_ffs/suj.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -2261,6 +2261,7 @@ suj_build(void)
 				blk_build((struct jblkrec *)rec);
 				break;
 			case JOP_TRUNC:
+			case JOP_SYNC:
 				ino_build_trunc((struct jtrncrec *)rec);
 				break;
 			default:

Modified: projects/largeSMP/sbin/ipfw/ipfw.8
==============================================================================
--- projects/largeSMP/sbin/ipfw/ipfw.8	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sbin/ipfw/ipfw.8	Thu Jun 30 10:19:43 2011	(r223691)
@@ -1,7 +1,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 14, 2011
+.Dd June 29, 2011
 .Dt IPFW 8
 .Os
 .Sh NAME
@@ -822,6 +822,78 @@ skipto, but care should be used, as no d
 is possible in this case so the rules are always walked to find it,
 starting from the 
 .Cm skipto .
+.It Cm call Ar number | tablearg
+The current rule number is saved in the internal stack and
+ruleset processing continues with the first rule numbered
+.Ar number
+or higher.
+If later a rule with the
+.Cm return
+action is encountered, the processing returns to the first rule
+with number of this
+.Cm call
+rule plus one or higher
+(the same behaviour as with packets returning from
+.Xr divert 4
+socket after a
+.Cm divert
+action).
+This could be used to make somewhat like an assembly language
+.Dq subroutine
+calls to rules with common checks for different interfaces, etc.
+.Pp
+Rule with any number could be called, not just forward jumps as with
+.Cm skipto .
+So, to prevent endless loops in case of mistakes, both
+.Cm call
+and
+.Cm return
+actions don't do any jumps and simply go to the next rule if memory
+can't be allocated or stack overflowed/undeflowed.
+.Pp
+Internally stack for rule numbers is implemented using
+.Xr mbuf_tags 9
+facility and currently has size of 16 entries.
+As mbuf tags are lost when packet leaves the kernel,
+.Cm divert
+should not be used in subroutines to avoid endless loops
+and other undesired effects.
+.It Cm return
+Takes rule number saved to internal stack by the last
+.Cm call
+action and returns ruleset processing to the first rule
+with number greater than number of corresponding
+.Cm call
+rule. See description of the
+.Cm call
+action for more details.
+.Pp
+Note that
+.Cm return
+rules usually end a
+.Dq subroutine
+and thus are unconditional, but
+.Nm
+command-line utility currently requires every action except
+.Cm check-state
+to have body.
+While it is sometimes useful to return only on some packets,
+usually you want to print just
+.Dq return
+for readability.
+A workaround for this is to use new syntax and
+.Fl c
+switch:
+.Pp
+.Bd -literal -offset indent
+# Add a rule without actual body
+ipfw add 2999 return via any
+
+# List rules without "from any to any" part
+ipfw -c list
+.Ed
+.Pp
+This cosmetic annoyance may be fixed in future releases.
 .It Cm tee Ar port
 Send a copy of packets matching this rule to the
 .Xr divert 4
@@ -3253,3 +3325,18 @@ for the respective conversations.
 To avoid failures of network error detection and path MTU discovery,
 ICMP error messages may need to be allowed explicitly through static
 rules.
+.Pp
+Rules using
+.Cm call
+and
+.Cm return
+actions may lead to confusing behaviour if ruleset has mistakes,
+and/or interaction with other subsystems (netgraph, dummynet, etc.) is used.
+One possible case for this is packet leaving
+.Nm
+in subroutine on the input pass, while later on output encountering unpaired
+.Cm return
+first.
+As the call stack is kept intact after input pass, packet will suddenly
+return to the rule number used on input pass, not on output one.
+Order of processing should be checked carefully to avoid such mistakes.

Modified: projects/largeSMP/sbin/ipfw/ipfw2.c
==============================================================================
--- projects/largeSMP/sbin/ipfw/ipfw2.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sbin/ipfw/ipfw2.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -214,6 +214,8 @@ static struct _s_x rule_actions[] = {
 	{ "nat",		TOK_NAT },
 	{ "reass",		TOK_REASS },
 	{ "setfib",		TOK_SETFIB },
+	{ "call",		TOK_CALL },
+	{ "return",		TOK_RETURN },
 	{ NULL, 0 }	/* terminator */
 };
 
@@ -1136,6 +1138,13 @@ show_ipfw(struct ip_fw *rule, int pcwidt
 			printf("reass");
 			break;
 
+		case O_CALLRETURN:
+			if (cmd->len & F_NOT)
+				printf("return");
+			else
+				PRINT_UINT_ARG("call ", cmd->arg1);
+			break;
+
 		default:
 			printf("** unrecognized action %d len %d ",
 				cmd->opcode, cmd->len);
@@ -2771,6 +2780,9 @@ ipfw_add(char *av[])
 		goto chkarg;
 	case TOK_TEE:
 		action->opcode = O_TEE;
+		goto chkarg;
+	case TOK_CALL:
+		action->opcode = O_CALLRETURN;
 chkarg:
 		if (!av[0])
 			errx(EX_USAGE, "missing argument for %s", *(av - 1));
@@ -2863,6 +2875,10 @@ chkarg:
 		action->opcode = O_REASS;
 		break;
 
+	case TOK_RETURN:
+		fill_cmd(action, O_CALLRETURN, F_NOT, 0);
+		break;
+
 	default:
 		errx(EX_DATAERR, "invalid action %s\n", av[-1]);
 	}

Modified: projects/largeSMP/sbin/ipfw/ipfw2.h
==============================================================================
--- projects/largeSMP/sbin/ipfw/ipfw2.h	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sbin/ipfw/ipfw2.h	Thu Jun 30 10:19:43 2011	(r223691)
@@ -99,6 +99,8 @@ enum tokens {
 	TOK_CHECKSTATE,
 	TOK_NAT,
 	TOK_REASS,
+	TOK_CALL,
+	TOK_RETURN,
 
 	TOK_ALTQ,
 	TOK_LOG,

Modified: projects/largeSMP/share/man/man4/jme.4
==============================================================================
--- projects/largeSMP/share/man/man4/jme.4	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/share/man/man4/jme.4	Thu Jun 30 10:19:43 2011	(r223691)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 20, 2010
+.Dd June 29, 2011
 .Dt JME 4
 .Os
 .Sh NAME
@@ -178,3 +178,17 @@ address once station address is reprogra
 It is highly recommended not to reprogram station address and
 it is responsibility of administrator to store original station
 address into a safe place when station address should be changed.
+.Pp
+There are two known 1000baseT link establishment issues with JMC25x.
+If the full mask revision number of JMC25x controller is less than
+or equal to 4 and link partner enabled IEEE 802.3az Energy Efficient
+Ethernet feature,  the controller would not be able to establish a
+1000baseT link.
+Also if the length of cable is longer than 120 meters, controller
+can not establish a 1000baseT link.
+The known workaround for the issue is to force manual link
+configuration with 100baseTX instead of relying on auto-negotiation.
+The full mask revision number of controller could be checked with
+verbose kernel boot option.
+Use lower nibble of chip revision number to get full mask revision of
+the controller. 

Modified: projects/largeSMP/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/largeSMP/sys/amd64/amd64/pmap.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/amd64/amd64/pmap.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -2847,8 +2847,8 @@ pmap_remove_all(vm_page_t m)
 	vm_offset_t va;
 	vm_page_t free;
 
-	KASSERT((m->flags & PG_FICTITIOUS) == 0,
-	    ("pmap_remove_all: page %p is fictitious", m));
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_all: page %p is not managed", m));
 	free = NULL;
 	vm_page_lock_queues();
 	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));

Modified: projects/largeSMP/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- projects/largeSMP/sys/amd64/amd64/sys_machdep.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/amd64/amd64/sys_machdep.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -33,7 +33,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_capabilities.h"
+#include "opt_capsicum.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -180,7 +180,7 @@ sysarch(td, uap)
 	uint64_t a64base;
 	struct i386_ioperm_args iargs;
 
-#ifdef CAPABILITIES
+#ifdef CAPABILITY_MODE
 	/*
 	 * Whitelist of operations which are safe enough for capability mode.
 	 */

Modified: projects/largeSMP/sys/arm/arm/pmap.c
==============================================================================
--- projects/largeSMP/sys/arm/arm/pmap.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/arm/arm/pmap.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -3120,8 +3120,8 @@ pmap_remove_all(vm_page_t m)
 	pmap_t curpm;
 	int flags = 0;
 
-	KASSERT((m->flags & PG_FICTITIOUS) == 0,
-	    ("pmap_remove_all: page %p is fictitious", m));
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_all: page %p is not managed", m));
 	if (TAILQ_EMPTY(&m->md.pv_list))
 		return;
 	vm_page_lock_queues();

Modified: projects/largeSMP/sys/arm/arm/sys_machdep.c
==============================================================================
--- projects/largeSMP/sys/arm/arm/sys_machdep.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/arm/arm/sys_machdep.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_capabilities.h"
+#include "opt_capsicum.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -107,7 +107,7 @@ sysarch(td, uap)
 {
 	int error;
 
-#ifdef CAPABILITIES
+#ifdef CAPABILITY_MODE
 	/*
 	 * Whitelist of operations which are safe enough for capability mode.
 	 */

Modified: projects/largeSMP/sys/arm/mv/common.c
==============================================================================
--- projects/largeSMP/sys/arm/mv/common.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/arm/mv/common.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -122,7 +122,7 @@ static struct soc_node_spec soc_nodes[] 
 	{ "mrvl,sata", &decode_win_sata_setup, NULL },
 	{ "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump },
 	{ "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump },
-	{ "mvrl,pcie", &decode_win_pcie_setup, NULL },
+	{ "mrvl,pcie", &decode_win_pcie_setup, NULL },
 	{ NULL, NULL, NULL },
 };
 

Modified: projects/largeSMP/sys/conf/NOTES
==============================================================================
--- projects/largeSMP/sys/conf/NOTES	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/conf/NOTES	Thu Jun 30 10:19:43 2011	(r223691)
@@ -1162,7 +1162,7 @@ options 	MAC_STUB
 options 	MAC_TEST
 
 # Support for Capsicum
-options 	CAPABILITIES
+options 	CAPABILITY_MODE
 
 
 #####################################################################

Modified: projects/largeSMP/sys/conf/options
==============================================================================
--- projects/largeSMP/sys/conf/options	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/conf/options	Thu Jun 30 10:19:43 2011	(r223691)
@@ -63,7 +63,7 @@ SYSCTL_DEBUG	opt_sysctl.h
 ADAPTIVE_LOCKMGRS
 ALQ
 AUDIT		opt_global.h
-CAPABILITIES	opt_capabilities.h
+CAPABILITY_MODE	opt_capsicum.h
 CODA_COMPAT_5	opt_coda.h
 COMPAT_43	opt_compat.h
 COMPAT_43TTY	opt_compat.h

Modified: projects/largeSMP/sys/dev/ath/if_ath.c
==============================================================================
--- projects/largeSMP/sys/dev/ath/if_ath.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/dev/ath/if_ath.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -4693,6 +4693,7 @@ ath_newstate(struct ieee80211vap *vap, e
 	struct ieee80211_node *ni = NULL;
 	int i, error, stamode;
 	u_int32_t rfilt;
+	int csa_run_transition = 0;
 	static const HAL_LED_STATE leds[] = {
 	    HAL_LED_INIT,	/* IEEE80211_S_INIT */
 	    HAL_LED_SCAN,	/* IEEE80211_S_SCAN */
@@ -4708,6 +4709,9 @@ ath_newstate(struct ieee80211vap *vap, e
 		ieee80211_state_name[vap->iv_state],
 		ieee80211_state_name[nstate]);
 
+	if (vap->iv_state == IEEE80211_S_CSA && nstate == IEEE80211_S_RUN)
+		csa_run_transition = 1;
+
 	callout_drain(&sc->sc_cal_ch);
 	ath_hal_setledstate(ah, leds[nstate]);	/* set LED */
 
@@ -4814,8 +4818,14 @@ ath_newstate(struct ieee80211vap *vap, e
 			 * Defer beacon timer configuration to the next
 			 * beacon frame so we have a current TSF to use
 			 * (any TSF collected when scanning is likely old).
+			 * However if it's due to a CSA -> RUN transition,
+			 * force a beacon update so we pick up a lack of
+			 * beacons from an AP in CAC and thus force a
+			 * scan.
 			 */
 			sc->sc_syncbeacon = 1;
+			if (csa_run_transition)
+				ath_beacon_config(sc, vap);
 			break;
 		case IEEE80211_M_MONITOR:
 			/*

Modified: projects/largeSMP/sys/dev/e1000/if_em.c
==============================================================================
--- projects/largeSMP/sys/dev/e1000/if_em.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/dev/e1000/if_em.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -330,42 +330,71 @@ MODULE_DEPEND(em, ether, 1, 1, 1);
 #define CSUM_TSO	0
 #endif
 
+SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters");
+
 static int em_tx_int_delay_dflt = EM_TICKS_TO_USECS(EM_TIDV);
 static int em_rx_int_delay_dflt = EM_TICKS_TO_USECS(EM_RDTR);
 TUNABLE_INT("hw.em.tx_int_delay", &em_tx_int_delay_dflt);
 TUNABLE_INT("hw.em.rx_int_delay", &em_rx_int_delay_dflt);
+SYSCTL_INT(_hw_em, OID_AUTO, tx_int_delay, CTLFLAG_RDTUN, &em_tx_int_delay_dflt,
+    0, "Default transmit interrupt delay in usecs");
+SYSCTL_INT(_hw_em, OID_AUTO, rx_int_delay, CTLFLAG_RDTUN, &em_rx_int_delay_dflt,
+    0, "Default receive interrupt delay in usecs");
 
 static int em_tx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_TADV);
 static int em_rx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_RADV);
 TUNABLE_INT("hw.em.tx_abs_int_delay", &em_tx_abs_int_delay_dflt);
 TUNABLE_INT("hw.em.rx_abs_int_delay", &em_rx_abs_int_delay_dflt);
+SYSCTL_INT(_hw_em, OID_AUTO, tx_abs_int_delay, CTLFLAG_RDTUN,
+    &em_tx_abs_int_delay_dflt, 0,
+    "Default transmit interrupt delay limit in usecs");
+SYSCTL_INT(_hw_em, OID_AUTO, rx_abs_int_delay, CTLFLAG_RDTUN,
+    &em_rx_abs_int_delay_dflt, 0,
+    "Default receive interrupt delay limit in usecs");
 
 static int em_rxd = EM_DEFAULT_RXD;
 static int em_txd = EM_DEFAULT_TXD;
 TUNABLE_INT("hw.em.rxd", &em_rxd);
 TUNABLE_INT("hw.em.txd", &em_txd);
+SYSCTL_INT(_hw_em, OID_AUTO, rxd, CTLFLAG_RDTUN, &em_rxd, 0,
+    "Number of receive descriptors per queue");
+SYSCTL_INT(_hw_em, OID_AUTO, txd, CTLFLAG_RDTUN, &em_txd, 0,
+    "Number of transmit descriptors per queue");
 
 static int em_smart_pwr_down = FALSE;
 TUNABLE_INT("hw.em.smart_pwr_down", &em_smart_pwr_down);
+SYSCTL_INT(_hw_em, OID_AUTO, smart_pwr_down, CTLFLAG_RDTUN, &em_smart_pwr_down,
+    0, "Set to true to leave smart power down enabled on newer adapters");
 
 /* Controls whether promiscuous also shows bad packets */
 static int em_debug_sbp = FALSE;
 TUNABLE_INT("hw.em.sbp", &em_debug_sbp);
+SYSCTL_INT(_hw_em, OID_AUTO, sbp, CTLFLAG_RDTUN, &em_debug_sbp, 0,
+    "Show bad packets in promiscuous mode");
 
 static int em_enable_msix = TRUE;
 TUNABLE_INT("hw.em.enable_msix", &em_enable_msix);
+SYSCTL_INT(_hw_em, OID_AUTO, enable_msix, CTLFLAG_RDTUN, &em_enable_msix, 0,
+    "Enable MSI-X interrupts");
 
 /* How many packets rxeof tries to clean at a time */
 static int em_rx_process_limit = 100;
 TUNABLE_INT("hw.em.rx_process_limit", &em_rx_process_limit);
+SYSCTL_INT(_hw_em, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN,
+    &em_rx_process_limit, 0,
+    "Maximum number of received packets to process at a time, -1 means unlimited");
 
 /* Flow control setting - default to FULL */
 static int em_fc_setting = e1000_fc_full;
 TUNABLE_INT("hw.em.fc_setting", &em_fc_setting);
+SYSCTL_INT(_hw_em, OID_AUTO, fc_setting, CTLFLAG_RDTUN, &em_fc_setting, 0,
+    "Flow control");
 
 /* Energy efficient ethernet - default to OFF */
 static int eee_setting = 0;
 TUNABLE_INT("hw.em.eee_setting", &eee_setting);
+SYSCTL_INT(_hw_em, OID_AUTO, eee_setting, CTLFLAG_RDTUN, &eee_setting, 0,
+    "Enable Energy Efficient Ethernet");
 
 /* Global used in WOL setup with multiport cards */
 static int global_quad_port_a = 0;

Modified: projects/largeSMP/sys/dev/e1000/if_igb.c
==============================================================================
--- projects/largeSMP/sys/dev/e1000/if_igb.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/dev/e1000/if_igb.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -300,11 +300,17 @@ MODULE_DEPEND(igb, ether, 1, 1, 1);
  *  Tunable default values.
  *********************************************************************/
 
+SYSCTL_NODE(_hw, OID_AUTO, igb, CTLFLAG_RD, 0, "IGB driver parameters");
+
 /* Descriptor defaults */
 static int igb_rxd = IGB_DEFAULT_RXD;
 static int igb_txd = IGB_DEFAULT_TXD;
 TUNABLE_INT("hw.igb.rxd", &igb_rxd);
 TUNABLE_INT("hw.igb.txd", &igb_txd);
+SYSCTL_INT(_hw_igb, OID_AUTO, rxd, CTLFLAG_RDTUN, &igb_rxd, 0,
+    "Number of receive descriptors per queue");
+SYSCTL_INT(_hw_igb, OID_AUTO, txd, CTLFLAG_RDTUN, &igb_txd, 0,
+    "Number of transmit descriptors per queue");
 
 /*
 ** AIM: Adaptive Interrupt Moderation
@@ -314,6 +320,8 @@ TUNABLE_INT("hw.igb.txd", &igb_txd);
 */
 static int igb_enable_aim = TRUE;
 TUNABLE_INT("hw.igb.enable_aim", &igb_enable_aim);
+SYSCTL_INT(_hw_igb, OID_AUTO, enable_aim, CTLFLAG_RW, &igb_enable_aim, 0,
+    "Enable adaptive interrupt moderation");
 
 /*
  * MSIX should be the default for best performance,
@@ -321,12 +329,16 @@ TUNABLE_INT("hw.igb.enable_aim", &igb_en
  */         
 static int igb_enable_msix = 1;
 TUNABLE_INT("hw.igb.enable_msix", &igb_enable_msix);
+SYSCTL_INT(_hw_igb, OID_AUTO, enable_msix, CTLFLAG_RDTUN, &igb_enable_msix, 0,
+    "Enable MSI-X interrupts");
 
 /*
 ** Tuneable Interrupt rate
 */
 static int igb_max_interrupt_rate = 8000;
 TUNABLE_INT("hw.igb.max_interrupt_rate", &igb_max_interrupt_rate);
+SYSCTL_INT(_hw_igb, OID_AUTO, max_interrupt_rate, CTLFLAG_RDTUN,
+    &igb_max_interrupt_rate, 0, "Maximum interrupts per second");
 
 /*
 ** Header split causes the packet header to
@@ -338,6 +350,8 @@ TUNABLE_INT("hw.igb.max_interrupt_rate",
 */
 static bool igb_header_split = FALSE;
 TUNABLE_INT("hw.igb.hdr_split", &igb_header_split);
+SYSCTL_INT(_hw_igb, OID_AUTO, header_split, CTLFLAG_RDTUN, &igb_header_split, 0,
+    "Enable receive mbuf header split");
 
 /*
 ** This will autoconfigure based on
@@ -345,10 +359,15 @@ TUNABLE_INT("hw.igb.hdr_split", &igb_hea
 */
 static int igb_num_queues = 0;
 TUNABLE_INT("hw.igb.num_queues", &igb_num_queues);
+SYSCTL_INT(_hw_igb, OID_AUTO, num_queues, CTLFLAG_RDTUN, &igb_num_queues, 0,
+    "Number of queues to configure, 0 indicates autoconfigure");
 
 /* How many packets rxeof tries to clean at a time */
 static int igb_rx_process_limit = 100;
 TUNABLE_INT("hw.igb.rx_process_limit", &igb_rx_process_limit);
+SYSCTL_INT(_hw_igb, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN,
+    &igb_rx_process_limit, 0,
+    "Maximum number of received packets to process at a time, -1 means unlimited");
 
 /*********************************************************************
  *  Device identification routine
@@ -435,10 +454,9 @@ igb_attach(device_t dev)
 	    OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
 	    igb_sysctl_nvm_info, "I", "NVM Information");
 
-	SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
-	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-	    OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW,
-	    &igb_enable_aim, 1, "Interrupt Moderation");
+	igb_set_sysctl_value(adapter, "enable_aim",
+	    "Interrupt Moderation", &adapter->enable_aim,
+	    igb_enable_aim);
 
 	SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
@@ -1498,7 +1516,7 @@ igb_msix_que(void *arg)
 
 	more_rx = igb_rxeof(que, adapter->rx_process_limit, NULL);
 
-	if (igb_enable_aim == FALSE)
+	if (adapter->enable_aim == FALSE)
 		goto no_calc;
 	/*
 	** Do Adaptive Interrupt Moderation:

Modified: projects/largeSMP/sys/dev/e1000/if_igb.h
==============================================================================
--- projects/largeSMP/sys/dev/e1000/if_igb.h	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/dev/e1000/if_igb.h	Thu Jun 30 10:19:43 2011	(r223691)
@@ -402,6 +402,7 @@ struct adapter {
 	u16		link_duplex;
 	u32		smartspeed;
 	u32		dmac;
+	int		enable_aim;
 
 	/* Interface queues */
 	struct igb_queue	*queues;

Modified: projects/largeSMP/sys/dev/mii/e1000phy.c
==============================================================================
--- projects/largeSMP/sys/dev/mii/e1000phy.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/dev/mii/e1000phy.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -107,6 +107,7 @@ static const struct mii_phydesc e1000phy
 	MII_PHY_DESC(xxMARVELL, E1116),
 	MII_PHY_DESC(xxMARVELL, E1116R),
 	MII_PHY_DESC(xxMARVELL, E1118),
+	MII_PHY_DESC(xxMARVELL, E1149R),
 	MII_PHY_DESC(xxMARVELL, E3016),
 	MII_PHY_DESC(xxMARVELL, PHYG65G),
 	MII_PHY_END
@@ -147,6 +148,7 @@ e1000phy_attach(device_t dev)
 			sc->mii_flags |= MIIF_HAVEFIBER;
 		break;
 	case MII_MODEL_xxMARVELL_E1149:
+	case MII_MODEL_xxMARVELL_E1149R:
 		/*
 		 * Some 88E1149 PHY's page select is initialized to
 		 * point to other bank instead of copper/fiber bank
@@ -208,6 +210,7 @@ e1000phy_reset(struct mii_softc *sc)
 		case MII_MODEL_xxMARVELL_E1116:
 		case MII_MODEL_xxMARVELL_E1118:
 		case MII_MODEL_xxMARVELL_E1149:
+		case MII_MODEL_xxMARVELL_E1149R:
 		case MII_MODEL_xxMARVELL_PHYG65G:
 			/* Disable energy detect mode. */
 			reg &= ~E1000_SCR_EN_DETECT_MASK;
@@ -240,7 +243,8 @@ e1000phy_reset(struct mii_softc *sc)
 		PHY_WRITE(sc, E1000_SCR, reg);
 
 		if (sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116 ||
-		    sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1149) {
+		    sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1149 ||
+		    sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1149R) {
 			PHY_WRITE(sc, E1000_EADR, 2);
 			reg = PHY_READ(sc, E1000_SCR);
 			reg |= E1000_SCR_RGMII_POWER_UP;

Modified: projects/largeSMP/sys/dev/mii/miidevs
==============================================================================
--- projects/largeSMP/sys/dev/mii/miidevs	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/dev/mii/miidevs	Thu Jun 30 10:19:43 2011	(r223691)
@@ -248,6 +248,7 @@ model xxMARVELL E1111		0x000c Marvell 88
 model xxMARVELL E1116		0x0021 Marvell 88E1116 Gigabit PHY
 model xxMARVELL E1116R		0x0024 Marvell 88E1116R Gigabit PHY
 model xxMARVELL E1118		0x0022 Marvell 88E1118 Gigabit PHY
+model xxMARVELL E1149R		0x0025 Marvell 88E1149R Quad Gigabit PHY
 model xxMARVELL E3016		0x0026 Marvell 88E3016 10/100 Fast Ethernet PHY
 model xxMARVELL PHYG65G		0x0027 Marvell PHYG65G Gigabit PHY
 model MARVELL E1000		0x0005 Marvell 88E1000 Gigabit PHY

Modified: projects/largeSMP/sys/dev/uart/uart_bus_pci.c
==============================================================================
--- projects/largeSMP/sys/dev/uart/uart_bus_pci.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/dev/uart/uart_bus_pci.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -113,6 +113,8 @@ static struct pci_id pci_ns8250_ids[] = 
 { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 },
 { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 },
 { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 },
+{ 0x9710, 0x9900, 0xa000, 0x1000,
+	"MosChip MCS9900 PCIe to Peripheral Controller", 0x10 },
 { 0x9710, 0x9901, 0xa000, 0x1000,
 	"MosChip MCS9901 PCIe to Peripheral Controller", 0x10 },
 { 0xdeaf, 0x9051, 0xffff, 0, "Middle Digital PC Weasel Serial Port", 0x10 },

Modified: projects/largeSMP/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- projects/largeSMP/sys/fs/tmpfs/tmpfs_subr.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/fs/tmpfs/tmpfs_subr.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -926,7 +926,7 @@ tmpfs_reg_resize(struct vnode *vp, off_t
 		if (newpages < oldpages) {
 			swap_pager_freespace(uobj, newpages, oldpages -
 			    newpages);
-			vm_object_page_remove(uobj, newpages, 0, FALSE);
+			vm_object_page_remove(uobj, newpages, 0, 0);
 		}
 
 		/*

Modified: projects/largeSMP/sys/i386/i386/pmap.c
==============================================================================
--- projects/largeSMP/sys/i386/i386/pmap.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/i386/i386/pmap.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -2927,8 +2927,8 @@ pmap_remove_all(vm_page_t m)
 	vm_offset_t va;
 	vm_page_t free;
 
-	KASSERT((m->flags & PG_FICTITIOUS) == 0,
-	    ("pmap_remove_all: page %p is fictitious", m));
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_all: page %p is not managed", m));
 	free = NULL;
 	vm_page_lock_queues();
 	sched_pin();

Modified: projects/largeSMP/sys/i386/i386/sys_machdep.c
==============================================================================
--- projects/largeSMP/sys/i386/i386/sys_machdep.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/i386/i386/sys_machdep.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -32,7 +32,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_capabilities.h"
+#include "opt_capsicum.h"
 #include "opt_kstack_pages.h"
 
 #include <sys/param.h>
@@ -111,7 +111,7 @@ sysarch(td, uap)
 
 	AUDIT_ARG_CMD(uap->op);
 
-#ifdef CAPABILITIES
+#ifdef CAPABILITY_MODE
 	/*
 	 * Whitelist of operations which are safe enough for capability mode.
 	 */

Modified: projects/largeSMP/sys/i386/xen/pmap.c
==============================================================================
--- projects/largeSMP/sys/i386/xen/pmap.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/i386/xen/pmap.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -2430,8 +2430,8 @@ pmap_remove_all(vm_page_t m)
 	pt_entry_t *pte, tpte;
 	vm_page_t free;
 
-	KASSERT((m->flags & PG_FICTITIOUS) == 0,
-	    ("pmap_remove_all: page %p is fictitious", m));
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_all: page %p is not managed", m));
 	free = NULL;
 	vm_page_lock_queues();
 	sched_pin();

Modified: projects/largeSMP/sys/ia64/ia64/pmap.c
==============================================================================
--- projects/largeSMP/sys/ia64/ia64/pmap.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/ia64/ia64/pmap.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -1424,8 +1424,8 @@ pmap_remove_all(vm_page_t m)
 	pmap_t oldpmap;
 	pv_entry_t pv;
 
-	KASSERT((m->flags & PG_FICTITIOUS) == 0,
-	    ("pmap_remove_all: page %p is fictitious", m));
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_all: page %p is not managed", m));
 	vm_page_lock_queues();
 	while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) {
 		struct ia64_lpte *pte;

Modified: projects/largeSMP/sys/kern/subr_trap.c
==============================================================================
--- projects/largeSMP/sys/kern/subr_trap.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/kern/subr_trap.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -44,7 +44,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_capabilities.h"
+#include "opt_capsicum.h"
 #include "opt_ktrace.h"
 #include "opt_kdtrace.h"
 #include "opt_sched.h"
@@ -313,7 +313,7 @@ syscallenter(struct thread *td, struct s
 				goto retval;
 		}
 
-#ifdef CAPABILITIES
+#ifdef CAPABILITY_MODE
 		/*
 		 * In capability mode, we only allow access to system calls
 		 * flagged with SYF_CAPENABLED.

Modified: projects/largeSMP/sys/kern/sys_capability.c
==============================================================================
--- projects/largeSMP/sys/kern/sys_capability.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/kern/sys_capability.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -36,7 +36,7 @@
  *
  */
 
-#include "opt_capabilities.h"
+#include "opt_capsicum.h"
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
 #include <vm/uma.h>
 #include <vm/vm.h>
 
-#ifdef CAPABILITIES
+#ifdef CAPABILITY_MODE
 
 FEATURE(security_capabilities, "Capsicum Capability Mode");
 
@@ -99,7 +99,7 @@ cap_getmode(struct thread *td, struct ca
 	return (copyout(&i, uap->modep, sizeof(i)));
 }
 
-#else /* !CAPABILITIES */
+#else /* !CAPABILITY_MODE */
 
 int
 cap_enter(struct thread *td, struct cap_enter_args *uap)
@@ -115,4 +115,4 @@ cap_getmode(struct thread *td, struct ca
 	return (ENOSYS);
 }
 
-#endif /* CAPABILITIES */
+#endif /* CAPABILITY_MODE */

Modified: projects/largeSMP/sys/kern/uipc_shm.c
==============================================================================
--- projects/largeSMP/sys/kern/uipc_shm.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/kern/uipc_shm.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -264,7 +264,7 @@ shm_dotruncate(struct shmfd *shmfd, off_
 		/* Toss in memory pages. */
 		if (nobjsize < object->size)
 			vm_object_page_remove(object, nobjsize, object->size,
-			    FALSE);
+			    0);
 
 		/* Toss pages from swap. */
 		if (object->type == OBJT_SWAP)

Modified: projects/largeSMP/sys/kern/vfs_subr.c
==============================================================================
--- projects/largeSMP/sys/kern/vfs_subr.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/kern/vfs_subr.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -1190,8 +1190,8 @@ bufobj_invalbuf(struct bufobj *bo, int f
 	 */
 	if (bo->bo_object != NULL && (flags & (V_ALT | V_NORMAL)) == 0) {
 		VM_OBJECT_LOCK(bo->bo_object);
-		vm_object_page_remove(bo->bo_object, 0, 0,
-			(flags & V_SAVE) ? TRUE : FALSE);
+		vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ?
+		    OBJPR_CLEANONLY : 0);
 		VM_OBJECT_UNLOCK(bo->bo_object);
 	}
 

Modified: projects/largeSMP/sys/mips/mips/pmap.c
==============================================================================
--- projects/largeSMP/sys/mips/mips/pmap.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/mips/mips/pmap.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -1708,8 +1708,8 @@ pmap_remove_all(vm_page_t m)
 	pv_entry_t pv;
 	pt_entry_t *pte, tpte;
 
-	KASSERT((m->flags & PG_FICTITIOUS) == 0,
-	    ("pmap_remove_all: page %p is fictitious", m));
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_all: page %p is not managed", m));
 	vm_page_lock_queues();
 
 	if (m->md.pv_flags & PV_TABLE_REF)

Modified: projects/largeSMP/sys/netinet/ip_fw.h
==============================================================================
--- projects/largeSMP/sys/netinet/ip_fw.h	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/netinet/ip_fw.h	Thu Jun 30 10:19:43 2011	(r223691)
@@ -57,6 +57,12 @@
 #define IP_FW_TABLEARG		65535	/* XXX should use 0 */
 
 /*
+ * Number of entries in the call stack of the call/return commands.
+ * Call stack currently is an uint16_t array with rule numbers.
+ */
+#define	IPFW_CALLSTACK_SIZE	16
+
+/*
  * The kernel representation of ipfw rules is made of a list of
  * 'instructions' (for all practical purposes equivalent to BPF
  * instructions), which specify which fields of the packet
@@ -195,6 +201,8 @@ enum ipfw_opcodes {		/* arguments (4 byt
 	
 	O_SOCKARG,		/* socket argument */
 
+	O_CALLRETURN,		/* arg1=called rule number */
+
 	O_LAST_OPCODE		/* not an opcode!		*/
 };
 

Modified: projects/largeSMP/sys/netinet/ip_var.h
==============================================================================
--- projects/largeSMP/sys/netinet/ip_var.h	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/netinet/ip_var.h	Thu Jun 30 10:19:43 2011	(r223691)
@@ -286,6 +286,7 @@ enum {
 };
 #define MTAG_IPFW	1148380143	/* IPFW-tagged cookie */
 #define MTAG_IPFW_RULE	1262273568	/* rule reference */
+#define	MTAG_IPFW_CALL	1308397630	/* call stack */
 
 struct ip_fw_args;
 typedef int	(*ip_fw_chk_ptr_t)(struct ip_fw_args *args);

Modified: projects/largeSMP/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- projects/largeSMP/sys/netinet/ipfw/ip_fw2.c	Thu Jun 30 09:20:26 2011	(r223690)
+++ projects/largeSMP/sys/netinet/ipfw/ip_fw2.c	Thu Jun 30 10:19:43 2011	(r223691)
@@ -2095,6 +2095,123 @@ do {								\
 			    continue;
 			    break;	/* not reached */
 
+			case O_CALLRETURN: {
+				/*
+				 * Implementation of `subroutine' call/return,
+				 * in the stack carried in an mbuf tag. This
+				 * is different from `skipto' in that any call
+				 * address is possible (`skipto' must prevent
+				 * backward jumps to avoid endless loops).
+				 * We have `return' action when F_NOT flag is
+				 * present. The `m_tag_id' field is used as
+				 * stack pointer.
+				 */
+				struct m_tag *mtag;
+				uint16_t jmpto, *stack;
+
+#define	IS_CALL		((cmd->len & F_NOT) == 0)
+#define	IS_RETURN	((cmd->len & F_NOT) != 0)
+				/*
+				 * Hand-rolled version of m_tag_locate() with
+				 * wildcard `type'.
+				 * If not already tagged, allocate new tag.
+				 */
+				mtag = m_tag_first(m);
+				while (mtag != NULL) {
+					if (mtag->m_tag_cookie ==
+					    MTAG_IPFW_CALL)
+						break;
+					mtag = m_tag_next(m, mtag);
+				}
+				if (mtag == NULL && IS_CALL) {
+					mtag = m_tag_alloc(MTAG_IPFW_CALL, 0,
+					    IPFW_CALLSTACK_SIZE *
+					    sizeof(uint16_t), M_NOWAIT);
+					if (mtag != NULL)
+						m_tag_prepend(m, mtag);
+				}
+
+				/*
+				 * On error both `call' and `return' just
+				 * continue with next rule.
+				 */
+				if (IS_RETURN && (mtag == NULL ||
+				    mtag->m_tag_id == 0)) {
+					l = 0;		/* exit inner loop */
+					break;
+				}
+				if (IS_CALL && (mtag == NULL ||
+				    mtag->m_tag_id >= IPFW_CALLSTACK_SIZE)) {
+					printf("ipfw: call stack error, "
+					    "go to next rule\n");
+					l = 0;		/* exit inner loop */
+					break;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list