From owner-svn-src-stable@FreeBSD.ORG Sun Aug 23 06:33:42 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8529D106568D; Sun, 23 Aug 2009 06:33:42 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 741AF8FC12; Sun, 23 Aug 2009 06:33:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N6XgXW049222; Sun, 23 Aug 2009 06:33:42 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N6Xg4a049220; Sun, 23 Aug 2009 06:33:42 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200908230633.n7N6Xg4a049220@svn.freebsd.org> From: Ken Smith Date: Sun, 23 Aug 2009 06:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196443 - stable/8/share/examples/cvsup X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 06:33:42 -0000 Author: kensmith Date: Sun Aug 23 06:33:42 2009 New Revision: 196443 URL: http://svn.freebsd.org/changeset/base/196443 Log: Update for RELENG_8. Reminded by: dougb Approved by: re (implicit) Modified: stable/8/share/examples/cvsup/stable-supfile Modified: stable/8/share/examples/cvsup/stable-supfile ============================================================================== --- stable/8/share/examples/cvsup/stable-supfile Sun Aug 23 06:30:14 2009 (r196442) +++ stable/8/share/examples/cvsup/stable-supfile Sun Aug 23 06:33:42 2009 (r196443) @@ -69,7 +69,7 @@ # The following line is for 7-stable. If you want 6-stable, 5-stable, # 4-stable, 3-stable, or 2.2-stable, change to "RELENG_6", "RELENG_5", # "RELENG_4", "RELENG_3", or "RELENG_2_2" respectively. -*default release=cvs tag=RELENG_7 +*default release=cvs tag=RELENG_8 *default delete use-rel-suffix # If you seem to be limited by CPU rather than network or disk bandwidth, try From owner-svn-src-stable@FreeBSD.ORG Sun Aug 23 09:45:48 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13530106568C; Sun, 23 Aug 2009 09:45:48 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id 79A138FC12; Sun, 23 Aug 2009 09:45:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.3/8.14.3) with ESMTP id n7N9SBvw032919; Sun, 23 Aug 2009 13:28:11 +0400 (MSD) (envelope-from marck@rinet.ru) Date: Sun, 23 Aug 2009 13:28:11 +0400 (MSD) From: Dmitry Morozovsky To: Ken Smith In-Reply-To: <200908230633.n7N6Xg4a049220@svn.freebsd.org> Message-ID: References: <200908230633.n7N6Xg4a049220@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (woozle.rinet.ru [0.0.0.0]); Sun, 23 Aug 2009 13:28:11 +0400 (MSD) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r196443 - stable/8/share/examples/cvsup X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 09:45:48 -0000 Ken, another small glitch: On Sun, 23 Aug 2009, Ken Smith wrote: KS> Modified: stable/8/share/examples/cvsup/stable-supfile KS> ============================================================================== KS> --- stable/8/share/examples/cvsup/stable-supfile Sun Aug 23 06:30:14 2009 (r196442) KS> +++ stable/8/share/examples/cvsup/stable-supfile Sun Aug 23 06:33:42 2009 (r196443) KS> @@ -69,7 +69,7 @@ KS> # The following line is for 7-stable. If you want 6-stable, 5-stable, ~~~~~~~~~~~~ KS> # 4-stable, 3-stable, or 2.2-stable, change to "RELENG_6", "RELENG_5", KS> # "RELENG_4", "RELENG_3", or "RELENG_2_2" respectively. KS> -*default release=cvs tag=RELENG_7 KS> +*default release=cvs tag=RELENG_8 KS> *default delete use-rel-suffix KS> KS> # If you seem to be limited by CPU rather than network or disk bandwidth, try -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-stable@FreeBSD.ORG Sun Aug 23 16:21:50 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EBFC106568B; Sun, 23 Aug 2009 16:21:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D00E8FC26; Sun, 23 Aug 2009 16:21:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NGLo0g065987; Sun, 23 Aug 2009 16:21:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NGLoKw065985; Sun, 23 Aug 2009 16:21:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200908231621.n7NGLoKw065985@svn.freebsd.org> From: Sam Leffler Date: Sun, 23 Aug 2009 16:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196473 - in stable/8/usr.sbin/wpa: . wpa_cli X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 16:21:50 -0000 Author: sam Date: Sun Aug 23 16:21:49 2009 New Revision: 196473 URL: http://svn.freebsd.org/changeset/base/196473 Log: MFC r196472: Enable _DIRENT_HAVE_D_TYPE so wpa_cli scans directories properly for it's unix domain socket. Before this change wpa_cli would take the first file in the directory that was not "." or "..". Approved by: re (rwatson) Modified: stable/8/usr.sbin/wpa/ (props changed) stable/8/usr.sbin/wpa/wpa_cli/Makefile Modified: stable/8/usr.sbin/wpa/wpa_cli/Makefile ============================================================================== --- stable/8/usr.sbin/wpa/wpa_cli/Makefile Sun Aug 23 16:04:10 2009 (r196472) +++ stable/8/usr.sbin/wpa/wpa_cli/Makefile Sun Aug 23 16:21:49 2009 (r196473) @@ -11,6 +11,8 @@ MAN= wpa_cli.8 CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX +# enable use of d_type to identify unix domain sockets +CFLAGS+= -D_DIRENT_HAVE_D_TYPE #CFLAGS+= -DCONFIG_READLINE #LDADD+= -ledit -ltermcap From owner-svn-src-stable@FreeBSD.ORG Mon Aug 24 03:49:38 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76811106568C; Mon, 24 Aug 2009 03:49:38 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6446C8FC08; Mon, 24 Aug 2009 03:49:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O3ncdQ080858; Mon, 24 Aug 2009 03:49:38 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O3ncfi080857; Mon, 24 Aug 2009 03:49:38 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200908240349.n7O3ncfi080857@svn.freebsd.org> From: Ken Smith Date: Mon, 24 Aug 2009 03:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196486 - stable/8/share/examples/cvsup X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 03:49:38 -0000 Author: kensmith Date: Mon Aug 24 03:49:37 2009 New Revision: 196486 URL: http://svn.freebsd.org/changeset/base/196486 Log: Update the comment for RELENG_8 too. Submitted by: Dmitry Morozovsky Approved by: re (implicit) Modified: stable/8/share/examples/cvsup/stable-supfile Modified: stable/8/share/examples/cvsup/stable-supfile ============================================================================== --- stable/8/share/examples/cvsup/stable-supfile Mon Aug 24 03:04:13 2009 (r196485) +++ stable/8/share/examples/cvsup/stable-supfile Mon Aug 24 03:49:37 2009 (r196486) @@ -66,9 +66,10 @@ *default host=CHANGE_THIS.FreeBSD.org *default base=/var/db *default prefix=/usr -# The following line is for 7-stable. If you want 6-stable, 5-stable, -# 4-stable, 3-stable, or 2.2-stable, change to "RELENG_6", "RELENG_5", -# "RELENG_4", "RELENG_3", or "RELENG_2_2" respectively. +# The following line is for 8-stable. If you want 7-stable, 6-stable, +# 5-stable, 4-stable, 3-stable, or 2.2-stable, change to "RELENG_7", +# "RELENG_6", "RELENG_5", "RELENG_4", "RELENG_3", or "RELENG_2_2" +# respectively. *default release=cvs tag=RELENG_8 *default delete use-rel-suffix From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 11:44:17 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97AA61065757; Tue, 25 Aug 2009 11:44:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 854AD8FC15; Tue, 25 Aug 2009 11:44:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PBiHEE026686; Tue, 25 Aug 2009 11:44:17 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PBiH8m026684; Tue, 25 Aug 2009 11:44:17 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251144.n7PBiH8m026684@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 11:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196537 - in stable/7/sys: . contrib/pf netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 11:44:17 -0000 Author: bz Date: Tue Aug 25 11:44:17 2009 New Revision: 196537 URL: http://svn.freebsd.org/changeset/base/196537 Log: MFC r182841: Add a second KASSERT checking for len >= 0 in the tcp output path. This is different to the first one (as len gets updated between those two) and would have caught various edge cases (read bugs) at a well defined place I had been debugging the last months instead of triggering (random) panics further down the call graph. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet/tcp_output.c Modified: stable/7/sys/netinet/tcp_output.c ============================================================================== --- stable/7/sys/netinet/tcp_output.c Tue Aug 25 10:09:25 2009 (r196536) +++ stable/7/sys/netinet/tcp_output.c Tue Aug 25 11:44:17 2009 (r196537) @@ -391,7 +391,7 @@ after_sack_rexmit: } /* len will be >= 0 after this point. */ - KASSERT(len >= 0, ("%s: len < 0", __func__)); + KASSERT(len >= 0, ("[%s:%d]: len < 0", __func__, __LINE__)); /* * Automatic sizing of send socket buffer. Often the send buffer @@ -741,6 +741,12 @@ send: /*#endif*/ /* + * This KASSERT is here to catch edge cases at a well defined place. + * Before, those had triggered (random) panic conditions further down. + */ + KASSERT(len >= 0, ("[%s:%d]: len < 0", __func__, __LINE__)); + + /* * Grab a header mbuf, attaching a copy of data to * be transmitted, and initialize the header from * the template for sends on this connection. From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 12:32:16 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81029106568C; Tue, 25 Aug 2009 12:32:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E6E98FC1A; Tue, 25 Aug 2009 12:32:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PCWGON027750; Tue, 25 Aug 2009 12:32:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PCWGt1027748; Tue, 25 Aug 2009 12:32:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251232.n7PCWGt1027748@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 12:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196538 - in stable/7/sys: . contrib/pf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 12:32:16 -0000 Author: bz Date: Tue Aug 25 12:32:16 2009 New Revision: 196538 URL: http://svn.freebsd.org/changeset/base/196538 Log: MFC r182842: Catch a possible NULL pointer deref in case the offsets got mangled somehow. As a consequence we may now get an unexpected result(*). Catch that error cases with a well defined panic giving appropriate pointers to ease debugging. (*) While the concensus was that the case should never happen unless there was a bug, noone was definitively sure. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/uipc_sockbuf.c Modified: stable/7/sys/kern/uipc_sockbuf.c ============================================================================== --- stable/7/sys/kern/uipc_sockbuf.c Tue Aug 25 11:44:17 2009 (r196537) +++ stable/7/sys/kern/uipc_sockbuf.c Tue Aug 25 12:32:16 2009 (r196538) @@ -930,11 +930,13 @@ sbsndptr(struct sockbuf *sb, u_int off, /* Advance by len to be as close as possible for the next transmit. */ for (off = off - sb->sb_sndptroff + len - 1; - off > 0 && off >= m->m_len; + off > 0 && m != NULL && off >= m->m_len; m = m->m_next) { sb->sb_sndptroff += m->m_len; off -= m->m_len; } + if (off > 0 && m == NULL) + panic("%s: sockbuf %p and mbuf %p clashing", __func__, sb, ret); sb->sb_sndptr = m; return (ret); From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 13:01:51 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD673106568E; Tue, 25 Aug 2009 13:01:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB0058FC15; Tue, 25 Aug 2009 13:01:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PD1pXb028684; Tue, 25 Aug 2009 13:01:51 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PD1paj028682; Tue, 25 Aug 2009 13:01:51 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251301.n7PD1paj028682@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 13:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196539 - in stable/7/sys: . contrib/pf netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:01:51 -0000 Author: bz Date: Tue Aug 25 13:01:51 2009 New Revision: 196539 URL: http://svn.freebsd.org/changeset/base/196539 Log: MFC r191433: Compare protosw pointer with NULL. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet6/ip6_input.c Modified: stable/7/sys/netinet6/ip6_input.c ============================================================================== --- stable/7/sys/netinet6/ip6_input.c Tue Aug 25 12:32:16 2009 (r196538) +++ stable/7/sys/netinet6/ip6_input.c Tue Aug 25 13:01:51 2009 (r196539) @@ -152,7 +152,7 @@ ip6_init(void) panic("sizeof(protosw) != sizeof(ip6protosw)"); #endif pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); - if (pr == 0) + if (pr == NULL) panic("ip6_init"); /* Initialize the entire ip6_protox[] array to IPPROTO_RAW. */ From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 13:04:14 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F7A3106568C; Tue, 25 Aug 2009 13:04:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F168B8FC12; Tue, 25 Aug 2009 13:04:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PD4DvJ028774; Tue, 25 Aug 2009 13:04:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PD4DES028772; Tue, 25 Aug 2009 13:04:13 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251304.n7PD4DES028772@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 13:04:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196540 - in stable/7/sys: . contrib/pf sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:04:14 -0000 Author: bz Date: Tue Aug 25 13:04:13 2009 New Revision: 196540 URL: http://svn.freebsd.org/changeset/base/196540 Log: MFC r191529: Whitespace (use tabs like for all other lines). Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/sys/mbuf.h Modified: stable/7/sys/sys/mbuf.h ============================================================================== --- stable/7/sys/sys/mbuf.h Tue Aug 25 13:01:51 2009 (r196539) +++ stable/7/sys/sys/mbuf.h Tue Aug 25 13:04:13 2009 (r196540) @@ -853,7 +853,7 @@ struct mbuf *m_unshare(struct mbuf *, in #define PACKET_TAG_PF 21 /* PF + ALTQ information */ #define PACKET_TAG_RTSOCKFAM 25 /* rtsock sa family */ #define PACKET_TAG_IPOPTIONS 27 /* Saved IP options */ -#define PACKET_TAG_CARP 28 /* CARP info */ +#define PACKET_TAG_CARP 28 /* CARP info */ /* Specific cookies and tags. */ From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 13:39:15 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDDC1106568B; Tue, 25 Aug 2009 13:39:14 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C255E8FC24; Tue, 25 Aug 2009 13:39:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PDdEe8029564; Tue, 25 Aug 2009 13:39:14 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PDdEcD029562; Tue, 25 Aug 2009 13:39:14 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200908251339.n7PDdEcD029562@svn.freebsd.org> From: Bruce M Simpson Date: Tue, 25 Aug 2009 13:39:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196541 - stable/7/etc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:39:15 -0000 Author: bms Date: Tue Aug 25 13:39:14 2009 New Revision: 196541 URL: http://svn.freebsd.org/changeset/base/196541 Log: MFC r179014: Add support for /conf/T/M/remount_optional. The rc.initdiskless functionality is used by NanoBSD to allow configuration files to live on a separate configuration slice, which acts as NVRAM, whilst the system image is mounted read-only. Normally, if the remount command fails during boot, this is regarded as a fatal error. If /conf/T/M/remount_optional is present, this error is non-fatal. If the file is not present, the default behaviour is unchanged. This is very useful for people building live CD images using FreeBSD, where the NVRAM lives somewhere completely differently from the system image, and may be present on removable media which is not present during the initial boot. Modified: stable/7/etc/ (props changed) stable/7/etc/rc.initdiskless stable/7/etc/termcap.small (props changed) Modified: stable/7/etc/rc.initdiskless ============================================================================== --- stable/7/etc/rc.initdiskless Tue Aug 25 13:04:13 2009 (r196540) +++ stable/7/etc/rc.initdiskless Tue Aug 25 13:39:14 2009 (r196541) @@ -69,6 +69,10 @@ # /conf/1.2.3.4/foo/remount contains "mount -o ro /dev/ad0s3", # then /dev/ad0s3 will be be mounted on /conf/1.2.3.4/foo/ # +# /conf/T/M/remount_optional +# If this file exists, then failure to execute the mount +# command contained in /conf/T/M/remount is non-fatal. +# # /conf/T/M/diskless_remount # The contents of the file points to an NFS filesystem, # possibly followed by mount_nfs options. If the server name @@ -147,8 +151,12 @@ log() { # # checks error code and drops into shell on failure. # if shell exits, terminates script as well as /etc/rc. +# if remount_optional exists under the mountpoint, skip this check. # chkerr() { + lastitem () ( n=$(($# - 1)) ; shift $n ; echo $1 ) + mountpoint="$(lastitem $2)" + [ -r $mountpoint/remount_optional ] && ( echo "$2 failed: ignoring due to remount_optional" ; return ) case $1 in 0) ;; From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 13:40:46 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97B3E1065690; Tue, 25 Aug 2009 13:40:46 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C6738FC12; Tue, 25 Aug 2009 13:40:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PDek4O029647; Tue, 25 Aug 2009 13:40:46 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PDekQn029645; Tue, 25 Aug 2009 13:40:46 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200908251340.n7PDekQn029645@svn.freebsd.org> From: Bruce M Simpson Date: Tue, 25 Aug 2009 13:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196542 - stable/7/etc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:40:46 -0000 Author: bms Date: Tue Aug 25 13:40:46 2009 New Revision: 196542 URL: http://svn.freebsd.org/changeset/base/196542 Log: MFC r182895: Add support to rc.initdiskless for /conf/T/M/remount_subdir. This allows the location of the configuration data to be relocated within the filesystem containing it. A nullfs mount is used in order to achieve this. Obtained from: XORP, Inc. Modified: stable/7/etc/ (props changed) stable/7/etc/rc.initdiskless stable/7/etc/termcap.small (props changed) Modified: stable/7/etc/rc.initdiskless ============================================================================== --- stable/7/etc/rc.initdiskless Tue Aug 25 13:39:14 2009 (r196541) +++ stable/7/etc/rc.initdiskless Tue Aug 25 13:40:46 2009 (r196542) @@ -73,6 +73,16 @@ # If this file exists, then failure to execute the mount # command contained in /conf/T/M/remount is non-fatal. # +# /conf/T/M/remount_subdir +# If this file exists, then the behaviour of /conf/T/M/remount +# changes as follows: +# 1. /conf/T/M/remount is invoked to mount the root of the +# filesystem where the configuration data exists on a +# temporary mountpoint. +# 2. /conf/T/M/remount_subdir is then invoked to mount a +# *subdirectory* of the filesystem mounted by +# /conf/T/M/remount on /conf/T/M/. +# # /conf/T/M/diskless_remount # The contents of the file points to an NFS filesystem, # possibly followed by mount_nfs options. If the server name @@ -296,10 +306,33 @@ for i in ${templates} ; do # remount. Beware, the command is in the file itself! if [ -f $j/remount ]; then - nfspt=`/bin/cat $j/remount` - $nfspt $j - chkerr $? "$nfspt $j" - to_umount="$j ${to_umount}" # XXX hope it is really a mount! + if [ -f $j/remount_subdir ]; then + k="/conf.tmp/$i/$subdir" + [ -d $k ] || continue + + # Mount the filesystem root where the config data is + # on the temporary mount point. + nfspt=`/bin/cat $j/remount` + $nfspt $k + chkerr $? "$nfspt $k" + + # Now use a nullfs mount to get the data where we + # really want to see it. + remount_subdir=`/bin/cat $j/remount_subdir` + remount_subdir_cmd="mount -t nullfs $k/$remount_subdir" + + $remount_subdir_cmd $j + chkerr $? "$remount_subdir_cmd $j" + + # XXX check order -- we must force $k to be unmounted + # after j, as j depends on k. + to_umount="$j $k ${to_umount}" + else + nfspt=`/bin/cat $j/remount` + $nfspt $j + chkerr $? "$nfspt $j" + to_umount="$j ${to_umount}" # XXX hope it is really a mount! + fi fi # NFS remount From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 15:54:54 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F37C610656C3; Tue, 25 Aug 2009 15:54:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E12B78FC20; Tue, 25 Aug 2009 15:54:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PFsrZJ032505; Tue, 25 Aug 2009 15:54:53 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PFsrRQ032504; Tue, 25 Aug 2009 15:54:53 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251554.n7PFsrRQ032504@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 15:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196544 - in stable/7: sys sys/contrib/pf sys/kern usr.bin/cpuset usr.sbin/jail X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 15:54:54 -0000 Author: bz Date: Tue Aug 25 15:54:52 2009 New Revision: 196544 URL: http://svn.freebsd.org/changeset/base/196544 Log: Backout r191596: Document an issue of jail(8) in conjunction with cpuset(1). MFC r191639: Prevent a superuser inside a jail from modifying the dedicated root cpuset of that jail. Processes inside the jail will still be able to change child sets. A superuser outside of a jail will still be able to change the jail cpuset and thus limit the number of cpus available to the jail. Problem reported by: 000.fbsd@quip.cz (Miroslav Lachman) PR: kern/134050 Reviewed by: jeff Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_cpuset.c stable/7/usr.bin/cpuset/cpuset.1 stable/7/usr.sbin/jail/jail.8 Modified: stable/7/sys/kern/kern_cpuset.c ============================================================================== --- stable/7/sys/kern/kern_cpuset.c Tue Aug 25 14:08:33 2009 (r196543) +++ stable/7/sys/kern/kern_cpuset.c Tue Aug 25 15:54:52 2009 (r196544) @@ -357,6 +357,15 @@ cpuset_modify(struct cpuset *set, cpuset if (error) return (error); /* + * In case we are called from within the jail + * we do not allow modifying the dedicated root + * cpuset of the jail but may still allow to + * change child sets. + */ + if (jailed(curthread->td_ucred) && + set->cs_flags & CPU_SET_ROOT) + return (EPERM); + /* * Verify that we have access to this set of * cpus. */ Modified: stable/7/usr.bin/cpuset/cpuset.1 ============================================================================== --- stable/7/usr.bin/cpuset/cpuset.1 Tue Aug 25 14:08:33 2009 (r196543) +++ stable/7/usr.bin/cpuset/cpuset.1 Tue Aug 25 15:54:52 2009 (r196544) @@ -177,9 +177,3 @@ command first appeared in .Fx 7.1 . .Sh AUTHORS .An Jeffrey Roberson Aq jeff@FreeBSD.org -.Sh BUGS -At the moment it is possible for a superuser inside a -.Xr jail 8 -to modify the root -.Xr cpuset 2 -of that jail. Modified: stable/7/usr.sbin/jail/jail.8 ============================================================================== --- stable/7/usr.sbin/jail/jail.8 Tue Aug 25 14:08:33 2009 (r196543) +++ stable/7/usr.sbin/jail/jail.8 Tue Aug 25 15:54:52 2009 (r196544) @@ -699,9 +699,3 @@ Currently, the simplest answer is to min offered on the host, possibly limiting it to services offered from .Xr inetd 8 which is easily configurable. -.Pp -At the moment it is possible for a superuser inside a -.Nm -to modify the root -.Xr cpuset 2 -of that jail. From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 15:58:07 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D793B106564A; Tue, 25 Aug 2009 15:58:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5D7F8FC15; Tue, 25 Aug 2009 15:58:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PFw7uH032634; Tue, 25 Aug 2009 15:58:07 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PFw7qn032632; Tue, 25 Aug 2009 15:58:07 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251558.n7PFw7qn032632@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 15:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196545 - in stable/7/sys: . contrib/pf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 15:58:08 -0000 Author: bz Date: Tue Aug 25 15:58:07 2009 New Revision: 196545 URL: http://svn.freebsd.org/changeset/base/196545 Log: MFC r191403: Correct a comment: the function name given had never existed in any (relevant) version of this file orany of my patches. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_cpuset.c Modified: stable/7/sys/kern/kern_cpuset.c ============================================================================== --- stable/7/sys/kern/kern_cpuset.c Tue Aug 25 15:54:52 2009 (r196544) +++ stable/7/sys/kern/kern_cpuset.c Tue Aug 25 15:58:07 2009 (r196545) @@ -731,7 +731,8 @@ cpuset_thread0(void) * Create a cpuset, which would be cpuset_create() but * mark the new 'set' as root. * - * We are not going to reparent the td to it. Use cpuset_reparentproc() for that. + * We are not going to reparent the td to it. Use cpuset_setproc_update_set() + * for that. * * In case of no error, returns the set in *setp locked with a reference. */ From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 16:56:34 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BF2B1065690; Tue, 25 Aug 2009 16:56:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00DAA8FC27; Tue, 25 Aug 2009 16:56:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PGuXnl033984; Tue, 25 Aug 2009 16:56:33 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PGuXOs033981; Tue, 25 Aug 2009 16:56:33 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251656.n7PGuXOs033981@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 16:56:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196546 - in stable/7/sys: . contrib/pf netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 16:56:34 -0000 Author: bz Date: Tue Aug 25 16:56:33 2009 New Revision: 196546 URL: http://svn.freebsd.org/changeset/base/196546 Log: MFC r187939: Remove 4 entirely unsued ip6 variables. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet6/ip6_input.c stable/7/sys/netinet6/ip6_var.h Modified: stable/7/sys/netinet6/ip6_input.c ============================================================================== --- stable/7/sys/netinet6/ip6_input.c Tue Aug 25 15:58:07 2009 (r196545) +++ stable/7/sys/netinet6/ip6_input.c Tue Aug 25 16:56:33 2009 (r196546) @@ -120,12 +120,6 @@ struct in6_ifaddr *in6_ifaddr; extern struct callout in6_tmpaddrtimer_ch; -int ip6_forward_srcrt; /* XXX */ -int ip6_sourcecheck; /* XXX */ -int ip6_sourcecheck_interval; /* XXX */ - -int ip6_ours_check_algorithm; - struct pfil_head inet6_pfil_hook; struct ip6stat ip6stat; Modified: stable/7/sys/netinet6/ip6_var.h ============================================================================== --- stable/7/sys/netinet6/ip6_var.h Tue Aug 25 15:58:07 2009 (r196545) +++ stable/7/sys/netinet6/ip6_var.h Tue Aug 25 16:56:33 2009 (r196546) @@ -282,7 +282,6 @@ extern struct ip6stat ip6stat; /* statis extern int ip6_defhlim; /* default hop limit */ extern int ip6_defmcasthlim; /* default multicast hop limit */ extern int ip6_forwarding; /* act as router? */ -extern int ip6_forward_srcrt; /* forward src-routed? */ extern int ip6_gif_hlim; /* Hop limit for gif encap packet */ extern int ip6_use_deprecated; /* allow deprecated addr as source */ extern int ip6_rr_prune; /* router renumbering prefix @@ -294,8 +293,6 @@ extern struct socket *ip6_mrouter; /* mu extern int ip6_sendredirects; /* send IP redirects when forwarding? */ extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */ extern int ip6_maxfrags; /* Maximum fragments in reassembly queue */ -extern int ip6_sourcecheck; /* Verify source interface */ -extern int ip6_sourcecheck_interval; /* Interval between log messages */ extern int ip6_accept_rtadv; /* Acts as a host not a router */ extern int ip6_keepfaith; /* Firewall Aided Internet Translator */ extern int ip6_log_interval; From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 17:00:25 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 271661065698; Tue, 25 Aug 2009 17:00:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 154A68FC74; Tue, 25 Aug 2009 17:00:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PH0OmQ034161; Tue, 25 Aug 2009 17:00:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PH0ON0034159; Tue, 25 Aug 2009 17:00:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251700.n7PH0ON0034159@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 17:00:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196548 - in stable/7/sys: . contrib/pf netipsec X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 17:00:25 -0000 Author: bz Date: Tue Aug 25 17:00:24 2009 New Revision: 196548 URL: http://svn.freebsd.org/changeset/base/196548 Log: MFC r187936: Use NULL rather than 0 when comparing pointers. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netipsec/ipsec_output.c Modified: stable/7/sys/netipsec/ipsec_output.c ============================================================================== --- stable/7/sys/netipsec/ipsec_output.c Tue Aug 25 16:59:55 2009 (r196547) +++ stable/7/sys/netipsec/ipsec_output.c Tue Aug 25 17:00:24 2009 (r196548) @@ -782,14 +782,14 @@ ipsec6_output_tunnel(struct ipsec_output RTFREE(state->ro->ro_rt); state->ro->ro_rt = NULL; } - if (state->ro->ro_rt == 0) { + if (state->ro->ro_rt == NULL) { bzero(dst6, sizeof(*dst6)); dst6->sin6_family = AF_INET6; dst6->sin6_len = sizeof(*dst6); dst6->sin6_addr = ip6->ip6_dst; rtalloc(state->ro); } - if (state->ro->ro_rt == 0) { + if (state->ro->ro_rt == NULL) { ip6stat.ip6s_noroute++; ipsec6stat.ips_out_noroute++; error = EHOSTUNREACH; From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 19:04:22 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C75281065692; Tue, 25 Aug 2009 19:04:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BFF98FC1C; Tue, 25 Aug 2009 19:04:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PJ4MgP036764; Tue, 25 Aug 2009 19:04:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PJ4MHP036760; Tue, 25 Aug 2009 19:04:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251904.n7PJ4MHP036760@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 19:04:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196549 - in stable/7/sys: . contrib/pf netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 19:04:22 -0000 Author: bz Date: Tue Aug 25 19:04:22 2009 New Revision: 196549 URL: http://svn.freebsd.org/changeset/base/196549 Log: MFC r187946: Like with r185713 make sure to not leak a lock as rtalloc1(9) returns a locked route. Thus we have to use RTFREE_LOCKED(9) to get it unlocked and rtfree(9)d rather than just rtfree(9)d. PR: kern/129793 Submitted by: Dheeraj Reddy Originally committed from: Bugathon #6 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet6/in6_gif.c stable/7/sys/netinet6/in6_ifattach.c stable/7/sys/netinet6/nd6_nbr.c Modified: stable/7/sys/netinet6/in6_gif.c ============================================================================== --- stable/7/sys/netinet6/in6_gif.c Tue Aug 25 17:00:24 2009 (r196548) +++ stable/7/sys/netinet6/in6_gif.c Tue Aug 25 19:04:22 2009 (r196549) @@ -389,10 +389,10 @@ gif_validate6(const struct ip6_hdr *ip6, ip6_sprintf(ip6buf, &sin6.sin6_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 128 * 2; Modified: stable/7/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/7/sys/netinet6/in6_ifattach.c Tue Aug 25 17:00:24 2009 (r196548) +++ stable/7/sys/netinet6/in6_ifattach.c Tue Aug 25 19:04:22 2009 (r196549) @@ -767,7 +767,7 @@ in6_ifdetach(struct ifnet *ifp) if ((ia->ia_flags & IFA_ROUTE) && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0, 0UL))) { rtflags = rt->rt_flags; - rtfree(rt); + RTFREE_LOCKED(rt); rtrequest(RTM_DELETE, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_prefixmask, Modified: stable/7/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/7/sys/netinet6/nd6_nbr.c Tue Aug 25 17:00:24 2009 (r196548) +++ stable/7/sys/netinet6/nd6_nbr.c Tue Aug 25 19:04:22 2009 (r196549) @@ -236,7 +236,7 @@ nd6_ns_input(struct mbuf *m, int off, in need_proxy = (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 && rt->rt_gateway->sa_family == AF_LINK); if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); if (need_proxy) { /* * proxy NDP for single entry From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 21:51:48 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 457FA106568C; Tue, 25 Aug 2009 21:51:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3298C8FC19; Tue, 25 Aug 2009 21:51:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PLpl8g040746; Tue, 25 Aug 2009 21:51:47 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PLpl3n040737; Tue, 25 Aug 2009 21:51:47 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908252151.n7PLpl3n040737@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 21:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196557 - in stable/6/sys: . contrib/pf dev/cxgb net netinet netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 21:51:48 -0000 Author: bz Date: Tue Aug 25 21:51:47 2009 New Revision: 196557 URL: http://svn.freebsd.org/changeset/base/196557 Log: MFC r185713 (from csjp): in_rtalloc1(9) returns a locked route, so make sure that we use RTFREE_LOCKED() here. This macro makes sure the reference count on the route is being managed properly. MFC r187946: Like with r185713 make sure to not leak a lock as rtalloc1(9) returns a locked route. Thus we have to use RTFREE_LOCKED(9) to get it either rtfree(9)d or the reference count decremented and unlocked depending on the reference count. [Note: the original commit message was bogus here]. RELENG_6 had a few more places that either had changed or were already fixed in HEAD/7 at the time above revisions were done so just fixed them along with the MFCs. Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/net/if_stf.c stable/6/sys/netinet/if_ether.c stable/6/sys/netinet/in_gif.c stable/6/sys/netinet6/in6.c stable/6/sys/netinet6/in6_gif.c stable/6/sys/netinet6/in6_ifattach.c stable/6/sys/netinet6/nd6.c stable/6/sys/netinet6/nd6_nbr.c Modified: stable/6/sys/net/if_stf.c ============================================================================== --- stable/6/sys/net/if_stf.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/net/if_stf.c Tue Aug 25 21:51:47 2009 (r196557) @@ -646,10 +646,10 @@ stf_checkaddr4(sc, in, inifp) (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return -1; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 0; Modified: stable/6/sys/netinet/if_ether.c ============================================================================== --- stable/6/sys/netinet/if_ether.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet/if_ether.c Tue Aug 25 21:51:47 2009 (r196557) @@ -854,12 +854,12 @@ reply: * over who claims what Ether address. */ if (rt->rt_ifp == ifp) { - rtfree(rt); + RTFREE_LOCKED(rt); goto drop; } (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); (void)memcpy(ar_sha(ah), enaddr, ah->ar_hln); - rtfree(rt); + RTFREE_LOCKED(rt); /* * Also check that the node which sent the ARP packet @@ -877,10 +877,10 @@ reply: " from %s via %s, expecting %s\n", inet_ntoa(isaddr), ifp->if_xname, rt->rt_ifp->if_xname); - rtfree(rt); + RTFREE_LOCKED(rt); goto drop; } - rtfree(rt); + RTFREE_LOCKED(rt); #ifdef DEBUG_PROXY printf("arp: proxying for %s\n", Modified: stable/6/sys/netinet/in_gif.c ============================================================================== --- stable/6/sys/netinet/in_gif.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet/in_gif.c Tue Aug 25 21:51:47 2009 (r196557) @@ -398,10 +398,10 @@ gif_validate4(ip, sc, ifp) (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 32 * 2; Modified: stable/6/sys/netinet6/in6.c ============================================================================== --- stable/6/sys/netinet6/in6.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/in6.c Tue Aug 25 21:51:47 2009 (r196557) @@ -190,7 +190,7 @@ in6_ifloop_request(int cmd, struct ifadd rt_newaddrmsg(cmd, ifa, e, nrt); if (cmd == RTM_DELETE) { - rtfree(nrt); + RTFREE_LOCKED(nrt); } else { /* the cmd must be RTM_ADD here */ RT_REMREF(nrt); @@ -217,7 +217,7 @@ in6_ifaddloop(struct ifaddr *ifa) need_loop = (rt == NULL || (rt->rt_flags & RTF_HOST) == 0 || (rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0); if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); if (need_loop) in6_ifloop_request(RTM_ADD, ifa); } @@ -269,7 +269,7 @@ in6_ifremloop(struct ifaddr *ifa) if (rt != NULL) { if ((rt->rt_flags & RTF_HOST) != 0 && (rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) { - rtfree(rt); + RTFREE_LOCKED(rt); in6_ifloop_request(RTM_DELETE, ifa); } else RT_UNLOCK(rt); Modified: stable/6/sys/netinet6/in6_gif.c ============================================================================== --- stable/6/sys/netinet6/in6_gif.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/in6_gif.c Tue Aug 25 21:51:47 2009 (r196557) @@ -392,10 +392,10 @@ gif_validate6(ip6, sc, ifp) ip6_sprintf(&sin6.sin6_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 128 * 2; Modified: stable/6/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/6/sys/netinet6/in6_ifattach.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/in6_ifattach.c Tue Aug 25 21:51:47 2009 (r196557) @@ -772,7 +772,7 @@ in6_ifdetach(ifp) if ((ia->ia_flags & IFA_ROUTE) && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0, 0UL))) { rtflags = rt->rt_flags; - rtfree(rt); + RTFREE_LOCKED(rt); rtrequest(RTM_DELETE, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_prefixmask, Modified: stable/6/sys/netinet6/nd6.c ============================================================================== --- stable/6/sys/netinet6/nd6.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/nd6.c Tue Aug 25 21:51:47 2009 (r196557) @@ -2009,7 +2009,7 @@ again: rt = rt->rt_gwroute; RT_LOCK(rt); /* NB: gwroute */ if ((rt->rt_flags & RTF_UP) == 0) { - rtfree(rt); /* unlock gwroute */ + RTFREE_LOCKED(rt); /* unlock gwroute */ rt = rt0; rt0->rt_gwroute = NULL; lookup: Modified: stable/6/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/6/sys/netinet6/nd6_nbr.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/nd6_nbr.c Tue Aug 25 21:51:47 2009 (r196557) @@ -239,7 +239,7 @@ nd6_ns_input(m, off, icmp6len) need_proxy = (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 && rt->rt_gateway->sa_family == AF_LINK); if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); if (need_proxy) { /* * proxy NDP for single entry From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 19:45:20 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1346B106568B; Wed, 26 Aug 2009 19:45:20 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 019A78FC2C; Wed, 26 Aug 2009 19:45:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QJjJj3071946; Wed, 26 Aug 2009 19:45:19 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QJjJnR071944; Wed, 26 Aug 2009 19:45:19 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200908261945.n7QJjJnR071944@svn.freebsd.org> From: Peter Wemm Date: Wed, 26 Aug 2009 19:45:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196561 - stable/7/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:45:20 -0000 Author: peter Date: Wed Aug 26 19:45:17 2009 New Revision: 196561 URL: http://svn.freebsd.org/changeset/base/196561 Log: MFC r194304: Fix ticks overflow in the handling of t_badtrxtwin. Modified: stable/7/sys/netinet/tcp_input.c Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Wed Aug 26 14:32:37 2009 (r196560) +++ stable/7/sys/netinet/tcp_input.c Wed Aug 26 19:45:17 2009 (r196561) @@ -1030,7 +1030,7 @@ tcp_do_segment(struct mbuf *m, struct tc * "bad retransmit" recovery. */ if (tp->t_rxtshift == 1 && - ticks < tp->t_badrxtwin) { + (int)(ticks - tp->t_badrxtwin) < 0) { ++tcpstat.tcps_sndrexmitbad; tp->snd_cwnd = tp->snd_cwnd_prev; tp->snd_ssthresh = @@ -1961,7 +1961,7 @@ process_ACK: * original cwnd and ssthresh, and proceed to transmit where * we left off. */ - if (tp->t_rxtshift == 1 && ticks < tp->t_badrxtwin) { + if (tp->t_rxtshift == 1 && (int)(ticks - tp->t_badrxtwin) < 0) { ++tcpstat.tcps_sndrexmitbad; tp->snd_cwnd = tp->snd_cwnd_prev; tp->snd_ssthresh = tp->snd_ssthresh_prev; From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 19:50:28 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C811106568C; Wed, 26 Aug 2009 19:50:28 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A2718FC24; Wed, 26 Aug 2009 19:50:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QJoRV4072095; Wed, 26 Aug 2009 19:50:27 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QJoRta072093; Wed, 26 Aug 2009 19:50:27 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200908261950.n7QJoRta072093@svn.freebsd.org> From: Peter Wemm Date: Wed, 26 Aug 2009 19:50:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196562 - stable/6/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:50:28 -0000 Author: peter Date: Wed Aug 26 19:50:27 2009 New Revision: 196562 URL: http://svn.freebsd.org/changeset/base/196562 Log: MFC: r196410: fix timewait expiration code when ticks goes negative after 24 days of uptime. Modified: stable/6/sys/netinet/tcp_timer.c Modified: stable/6/sys/netinet/tcp_timer.c ============================================================================== --- stable/6/sys/netinet/tcp_timer.c Wed Aug 26 19:45:17 2009 (r196561) +++ stable/6/sys/netinet/tcp_timer.c Wed Aug 26 19:50:27 2009 (r196562) @@ -247,7 +247,7 @@ tcp_timer_2msl_tw(int reuse) INP_INFO_WLOCK_ASSERT(&tcbinfo); for (;;) { tw = TAILQ_FIRST(&twq_2msl); - if (tw == NULL || (!reuse && tw->tw_time > ticks)) + if (tw == NULL || (!reuse && (int)(tw->tw_time - ticks) > 0)) break; INP_LOCK(tw->tw_inpcb); tcp_twclose(tw, reuse); From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 19:51:55 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B4E01065672; Wed, 26 Aug 2009 19:51:55 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09C3D8FC21; Wed, 26 Aug 2009 19:51:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QJpsAe072188; Wed, 26 Aug 2009 19:51:54 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QJpsQo072186; Wed, 26 Aug 2009 19:51:54 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200908261951.n7QJpsQo072186@svn.freebsd.org> From: Peter Wemm Date: Wed, 26 Aug 2009 19:51:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196563 - stable/6/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:51:55 -0000 Author: peter Date: Wed Aug 26 19:51:54 2009 New Revision: 196563 URL: http://svn.freebsd.org/changeset/base/196563 Log: MFC r194304: Fix ticks overflow in the handling of t_badtrxtwin. Modified: stable/6/sys/netinet/tcp_input.c Modified: stable/6/sys/netinet/tcp_input.c ============================================================================== --- stable/6/sys/netinet/tcp_input.c Wed Aug 26 19:50:27 2009 (r196562) +++ stable/6/sys/netinet/tcp_input.c Wed Aug 26 19:51:54 2009 (r196563) @@ -1182,7 +1182,7 @@ after_listen: * "bad retransmit" recovery */ if (tp->t_rxtshift == 1 && - ticks < tp->t_badrxtwin) { + (int)(ticks - tp->t_badrxtwin) < 0) { ++tcpstat.tcps_sndrexmitbad; tp->snd_cwnd = tp->snd_cwnd_prev; tp->snd_ssthresh = @@ -2070,7 +2070,7 @@ process_ACK: * original cwnd and ssthresh, and proceed to transmit where * we left off. */ - if (tp->t_rxtshift == 1 && ticks < tp->t_badrxtwin) { + if (tp->t_rxtshift == 1 && (int)(ticks - tp->t_badrxtwin) < 0) { ++tcpstat.tcps_sndrexmitbad; tp->snd_cwnd = tp->snd_cwnd_prev; tp->snd_ssthresh = tp->snd_ssthresh_prev; From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 20:57:21 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC491065691; Wed, 26 Aug 2009 20:57:21 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB3018FC2C; Wed, 26 Aug 2009 20:57:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QKvLun073740; Wed, 26 Aug 2009 20:57:21 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QKvLKP073739; Wed, 26 Aug 2009 20:57:21 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262057.n7QKvLKP073739@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 20:57:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196564 - in stable/8/release: . doc scripts X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 20:57:22 -0000 Author: dougb Date: Wed Aug 26 20:57:21 2009 New Revision: 196564 URL: http://svn.freebsd.org/changeset/base/196564 Log: MFC 196434: Add a script to create the /var/db/mergemaster.mtree file for new releases so that when users subsequently update their source trees they can make use of mergemaster's -U option. Approved by: re (kib) Added: stable/8/release/scripts/mm-mtree.sh - copied unchanged from r196434, head/release/scripts/mm-mtree.sh Modified: stable/8/release/ (props changed) stable/8/release/doc/ (props changed) Copied: stable/8/release/scripts/mm-mtree.sh (from r196434, head/release/scripts/mm-mtree.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/release/scripts/mm-mtree.sh Wed Aug 26 20:57:21 2009 (r196564, copy of r196434, head/release/scripts/mm-mtree.sh) @@ -0,0 +1,155 @@ +#!/bin/sh + +# mergemaster mtree database generator + +# This script is intended to be used as part of the release building +# process to generate the /var/db/mergemaster.mtree file relevant to +# the source tree used to create the release so that users can make +# use of mergemaster's -U option to update their files after csup'ing +# to -stable. + +# Copyright 2009 Douglas Barton +# dougb@FreeBSD.org + +# $FreeBSD$ + +PATH=/bin:/usr/bin:/usr/sbin + +display_usage () { + VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` + echo "${0##*/} version ${VERSION_NUMBER}" + echo "Usage: ${0##*/} [-m /path] [-t /path] [-A arch] [-F ] [-D /path]" + echo "Options:" + echo " -m /path/directory Specify location of source to do the make in" + echo " -t /path/directory Specify temp root directory" + echo " -A architecture Alternative architecture name to pass to make" + echo " -F Specify what to put on the make command line" + echo ' -D /path/directory Specify the destination directory to install files to' + echo '' +} + +# Set the default path for the temporary root environment +# +TEMPROOT='/var/tmp/temproot' + +# Assign the location of the mtree database +# +MTREEDB=${MTREEDB:-/var/db} +MTREEFILE="${MTREEDB}/mergemaster.mtree" + +# Check the command line options +# +while getopts "m:t:A:F:D:h" COMMAND_LINE_ARGUMENT ; do + case "${COMMAND_LINE_ARGUMENT}" in + m) + SOURCEDIR=${OPTARG} + ;; + t) + TEMPROOT=${OPTARG} + ;; + A) + ARCHSTRING='TARGET_ARCH='${OPTARG} + ;; + F) + MM_MAKE_ARGS="${OPTARG}" + ;; + D) + DESTDIR=${OPTARG} + ;; + h) + display_usage + exit 0 + ;; + *) + echo '' + display_usage + exit 1 + ;; + esac +done + +# Assign the source directory +# +SOURCEDIR=${SOURCEDIR:-/usr/src} +if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \ + -f ${SOURCEDIR}/../Makefile.inc1 ]; then + echo " *** The source directory you specified (${SOURCEDIR})" + echo " will be reset to ${SOURCEDIR}/.." + echo '' + sleep 3 + SOURCEDIR=${SOURCEDIR}/.. +fi + +# Setup make to use system files from SOURCEDIR +MM_MAKE="make ${ARCHSTRING} ${MM_MAKE_ARGS} -m ${SOURCEDIR}/share/mk" + +delete_temproot () { + rm -rf "${TEMPROOT}" 2>/dev/null + chflags -R 0 "${TEMPROOT}" 2>/dev/null + rm -rf "${TEMPROOT}" || exit 1 +} + +[ -d "${TEMPROOT}" ] && delete_temproot + +echo "*** Creating the temporary root environment in ${TEMPROOT}" + +if mkdir -p "${TEMPROOT}"; then + echo " *** ${TEMPROOT} ready for use" +fi + +if [ ! -d "${TEMPROOT}" ]; then + echo '' + echo " *** FATAL ERROR: Cannot create ${TEMPROOT}" + echo '' + exit 1 +fi + +echo " *** Creating and populating directory structure in ${TEMPROOT}" +echo '' + +{ cd ${SOURCEDIR} || { echo "*** Cannot cd to ${SOURCEDIR}" ; exit 1;} + case "${DESTDIR}" in + '') ;; + *) + ${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs + ;; + esac + od=${TEMPROOT}/usr/obj + ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution;} || + { echo ''; + echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; + echo " the temproot environment"; + echo ''; + exit 1;} + +# We really don't want to have to deal with files like login.conf.db, pwd.db, +# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. +# Prompt the user to do so below, as needed. +# +rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd + +# We only need to compare things like freebsd.cf once +find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null + +# Delete stuff we do not need to keep the mtree database small, +# and to make the actual comparison faster. +find ${TEMPROOT}/usr -type l -delete 2>/dev/null +find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null +find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null + +# Build the mtree database in a temporary location. +MTREENEW=`mktemp -t mergemaster.mtree` +mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + +if [ -s "${MTREENEW}" ]; then + echo "*** Saving mtree database for future upgrades" + test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} + mv ${MTREENEW} ${DESTDIR}${MTREEFILE} +fi + +delete_temproot + +exit 0 From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 21:05:17 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B7CB106568E; Wed, 26 Aug 2009 21:05:17 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4903D8FC20; Wed, 26 Aug 2009 21:05:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QL5HVA074092; Wed, 26 Aug 2009 21:05:17 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QL5Ho7074091; Wed, 26 Aug 2009 21:05:17 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262105.n7QL5Ho7074091@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 21:05:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196565 - in stable/7/release: . scripts X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 21:05:17 -0000 Author: dougb Date: Wed Aug 26 21:05:17 2009 New Revision: 196565 URL: http://svn.freebsd.org/changeset/base/196565 Log: MFC 196434: Add a script to create the /var/db/mergemaster.mtree file for new releases so that when users subsequently update their source trees they can make use of mergemaster's -U option. Added: stable/7/release/scripts/mm-mtree.sh - copied unchanged from r196434, head/release/scripts/mm-mtree.sh Modified: stable/7/release/ (props changed) stable/7/release/scripts/src-install.sh (props changed) Copied: stable/7/release/scripts/mm-mtree.sh (from r196434, head/release/scripts/mm-mtree.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/release/scripts/mm-mtree.sh Wed Aug 26 21:05:17 2009 (r196565, copy of r196434, head/release/scripts/mm-mtree.sh) @@ -0,0 +1,155 @@ +#!/bin/sh + +# mergemaster mtree database generator + +# This script is intended to be used as part of the release building +# process to generate the /var/db/mergemaster.mtree file relevant to +# the source tree used to create the release so that users can make +# use of mergemaster's -U option to update their files after csup'ing +# to -stable. + +# Copyright 2009 Douglas Barton +# dougb@FreeBSD.org + +# $FreeBSD$ + +PATH=/bin:/usr/bin:/usr/sbin + +display_usage () { + VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` + echo "${0##*/} version ${VERSION_NUMBER}" + echo "Usage: ${0##*/} [-m /path] [-t /path] [-A arch] [-F ] [-D /path]" + echo "Options:" + echo " -m /path/directory Specify location of source to do the make in" + echo " -t /path/directory Specify temp root directory" + echo " -A architecture Alternative architecture name to pass to make" + echo " -F Specify what to put on the make command line" + echo ' -D /path/directory Specify the destination directory to install files to' + echo '' +} + +# Set the default path for the temporary root environment +# +TEMPROOT='/var/tmp/temproot' + +# Assign the location of the mtree database +# +MTREEDB=${MTREEDB:-/var/db} +MTREEFILE="${MTREEDB}/mergemaster.mtree" + +# Check the command line options +# +while getopts "m:t:A:F:D:h" COMMAND_LINE_ARGUMENT ; do + case "${COMMAND_LINE_ARGUMENT}" in + m) + SOURCEDIR=${OPTARG} + ;; + t) + TEMPROOT=${OPTARG} + ;; + A) + ARCHSTRING='TARGET_ARCH='${OPTARG} + ;; + F) + MM_MAKE_ARGS="${OPTARG}" + ;; + D) + DESTDIR=${OPTARG} + ;; + h) + display_usage + exit 0 + ;; + *) + echo '' + display_usage + exit 1 + ;; + esac +done + +# Assign the source directory +# +SOURCEDIR=${SOURCEDIR:-/usr/src} +if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \ + -f ${SOURCEDIR}/../Makefile.inc1 ]; then + echo " *** The source directory you specified (${SOURCEDIR})" + echo " will be reset to ${SOURCEDIR}/.." + echo '' + sleep 3 + SOURCEDIR=${SOURCEDIR}/.. +fi + +# Setup make to use system files from SOURCEDIR +MM_MAKE="make ${ARCHSTRING} ${MM_MAKE_ARGS} -m ${SOURCEDIR}/share/mk" + +delete_temproot () { + rm -rf "${TEMPROOT}" 2>/dev/null + chflags -R 0 "${TEMPROOT}" 2>/dev/null + rm -rf "${TEMPROOT}" || exit 1 +} + +[ -d "${TEMPROOT}" ] && delete_temproot + +echo "*** Creating the temporary root environment in ${TEMPROOT}" + +if mkdir -p "${TEMPROOT}"; then + echo " *** ${TEMPROOT} ready for use" +fi + +if [ ! -d "${TEMPROOT}" ]; then + echo '' + echo " *** FATAL ERROR: Cannot create ${TEMPROOT}" + echo '' + exit 1 +fi + +echo " *** Creating and populating directory structure in ${TEMPROOT}" +echo '' + +{ cd ${SOURCEDIR} || { echo "*** Cannot cd to ${SOURCEDIR}" ; exit 1;} + case "${DESTDIR}" in + '') ;; + *) + ${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs + ;; + esac + od=${TEMPROOT}/usr/obj + ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution;} || + { echo ''; + echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; + echo " the temproot environment"; + echo ''; + exit 1;} + +# We really don't want to have to deal with files like login.conf.db, pwd.db, +# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. +# Prompt the user to do so below, as needed. +# +rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd + +# We only need to compare things like freebsd.cf once +find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null + +# Delete stuff we do not need to keep the mtree database small, +# and to make the actual comparison faster. +find ${TEMPROOT}/usr -type l -delete 2>/dev/null +find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null +find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null + +# Build the mtree database in a temporary location. +MTREENEW=`mktemp -t mergemaster.mtree` +mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + +if [ -s "${MTREENEW}" ]; then + echo "*** Saving mtree database for future upgrades" + test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} + mv ${MTREENEW} ${DESTDIR}${MTREEFILE} +fi + +delete_temproot + +exit 0 From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 21:08:41 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA861106568B; Wed, 26 Aug 2009 21:08:41 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EC918FC19; Wed, 26 Aug 2009 21:08:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QL8fZ3074317; Wed, 26 Aug 2009 21:08:41 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QL8fF7074314; Wed, 26 Aug 2009 21:08:41 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262108.n7QL8fF7074314@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 21:08:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196566 - in stable/8/etc: . rc.d X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 21:08:41 -0000 Author: dougb Date: Wed Aug 26 21:08:41 2009 New Revision: 196566 URL: http://svn.freebsd.org/changeset/base/196566 Log: MFC 196436; Move is_wired_interface() from rc.d/wpa_supplicant into network.subr, simplify it a bit, and make use of that method to determine if an interface is a candidate for IPv6 rtsol rather than listing all of the possible wireless interfaces that should _not_ get rtsol'ed. This change is only relevant for 8.0+ unless the "wlan mandatory" code gets ported back to RELENG_7. Approved by: re (kib) Modified: stable/8/etc/ (props changed) stable/8/etc/network.subr stable/8/etc/rc.d/wpa_supplicant Modified: stable/8/etc/network.subr ============================================================================== --- stable/8/etc/network.subr Wed Aug 26 21:05:17 2009 (r196565) +++ stable/8/etc/network.subr Wed Aug 26 21:08:41 2009 (r196566) @@ -816,6 +816,17 @@ hexprint() echo ${str} } +is_wired_interface() +{ + local media + + case `ifconfig $1 2>/dev/null` in + *media:?Ethernet*) media=Ethernet ;; + esac + + test "$media" = "Ethernet" +} + # Setup the interfaces for IPv6 network6_interface_setup() { @@ -858,14 +869,19 @@ network6_interface_setup() ifconfig $i inet6 ${ipv6_ifconfig} alias fi + # Wireless NIC cards are virtualized through the wlan interface + if ! is_wired_interface ${i}; then + case "${i}" in + wlan*) rtsol_available=yes ;; + *) rtsol_available=no ;; + esac + fi + if [ ${rtsol_available} = yes -a ${rtsol_interface} = yes ] then case ${i} in lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*|pflog[0-9]*|pfsync[0-9]*) ;; - # Wireless NIC cards are virtualized through the wlan interface - an[0-9]*|ath[0-9]*|ipw[0-9]*|iwi[0-9]*|iwn[0-9]*|ral[0-9]*|wi[0-9]*|wl[0-9]*|wpi[0-9]*) - ;; *) rtsol_interfaces="${rtsol_interfaces} ${i}" ;; Modified: stable/8/etc/rc.d/wpa_supplicant ============================================================================== --- stable/8/etc/rc.d/wpa_supplicant Wed Aug 26 21:05:17 2009 (r196565) +++ stable/8/etc/rc.d/wpa_supplicant Wed Aug 26 21:08:41 2009 (r196566) @@ -18,18 +18,6 @@ if [ -z "$ifn" ]; then return 1 fi -is_wired_interface() -{ - media=`ifconfig $1 2>/dev/null | while read line; do - case "$line" in - *media:?Ethernet*) - echo Ethernet - ;; - esac - done` - test "$media" = "Ethernet" -} - is_ndis_interface() { case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 22:32:15 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09916106568C; Wed, 26 Aug 2009 22:32:15 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D05AC8FC22; Wed, 26 Aug 2009 22:32:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QMWEei076782; Wed, 26 Aug 2009 22:32:14 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QMWEEI076780; Wed, 26 Aug 2009 22:32:14 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262232.n7QMWEEI076780@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 22:32:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196571 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris conf contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 22:32:15 -0000 Author: dougb Date: Wed Aug 26 22:32:14 2009 New Revision: 196571 URL: http://svn.freebsd.org/changeset/base/196571 Log: MFC r196435: The svnversion string is only relevant when newvers.sh is called during the kernel build process, the other places that call the script do not make use of that information. So restrict execution of the svnversion-related code to the kernel build context. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/newvers.sh stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/newvers.sh ============================================================================== --- stable/8/sys/conf/newvers.sh Wed Aug 26 21:42:16 2009 (r196570) +++ stable/8/sys/conf/newvers.sh Wed Aug 26 22:32:14 2009 (r196571) @@ -87,29 +87,25 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -for dir in /bin /usr/bin /usr/local/bin; do - if [ -x "${dir}/svnversion" ]; then - svnversion=${dir}/svnversion - SRCDIR=${d##*obj} - if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE} +case "$d" in +*/sys/*) + for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + if [ -n "$MACHINE" ]; then + SRCDIR=${SRCDIR##/$MACHINE} + fi + SRCDIR=${SRCDIR%%/sys/*} + break fi - SRCDIR=${SRCDIR%%/sys/*} - break - fi -done + done -if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then - # If we are called from the kernel build, limit - # the scope of svnversion to sys/ . - if [ -e "${SRCDIR}/sys/conf/newvers.sh" ] ; then - svn=" r`cd $SRCDIR/sys && $svnversion`" - else - svn=" r`cd $SRCDIR && $svnversion`" + if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then + svn=" r`cd ${SRCDIR}/sys && $svnversion`" fi -else - svn="" -fi + ;; +esac cat << EOF > vers.c $COPYRIGHT From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 22:50:14 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91689106568D; Wed, 26 Aug 2009 22:50:14 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F6708FC3A; Wed, 26 Aug 2009 22:50:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QMoEaM077331; Wed, 26 Aug 2009 22:50:14 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QMoERq077329; Wed, 26 Aug 2009 22:50:14 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262250.n7QMoERq077329@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 22:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196572 - in stable/7/sys: . conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 22:50:14 -0000 Author: dougb Date: Wed Aug 26 22:50:14 2009 New Revision: 196572 URL: http://svn.freebsd.org/changeset/base/196572 Log: MFC r196435: The svnversion string is only relevant when newvers.sh is called during the kernel build process, the other places that call the script do not make use of that information. So restrict execution of the svnversion-related code to the kernel build context. Modified: stable/7/sys/ (props changed) stable/7/sys/conf/ (props changed) stable/7/sys/conf/newvers.sh Modified: stable/7/sys/conf/newvers.sh ============================================================================== --- stable/7/sys/conf/newvers.sh Wed Aug 26 22:32:14 2009 (r196571) +++ stable/7/sys/conf/newvers.sh Wed Aug 26 22:50:14 2009 (r196572) @@ -87,29 +87,25 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -for dir in /bin /usr/bin /usr/local/bin; do - if [ -x "${dir}/svnversion" ]; then - svnversion=${dir}/svnversion - SRCDIR=${d##*obj} - if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE} +case "$d" in +*/sys/*) + for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + if [ -n "$MACHINE" ]; then + SRCDIR=${SRCDIR##/$MACHINE} + fi + SRCDIR=${SRCDIR%%/sys/*} + break fi - SRCDIR=${SRCDIR%%/sys/*} - break - fi -done + done -if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then - # If we are called from the kernel build, limit - # the scope of svnversion to sys/ . - if [ -e "${SRCDIR}/sys/conf/newvers.sh" ] ; then - svn=" r`cd $SRCDIR/sys && $svnversion`" - else - svn=" r`cd $SRCDIR && $svnversion`" + if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then + svn=" r`cd ${SRCDIR}/sys && $svnversion`" fi -else - svn="" -fi + ;; +esac cat << EOF > vers.c $COPYRIGHT From owner-svn-src-stable@FreeBSD.ORG Wed Aug 26 22:51:14 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C804F1065698; Wed, 26 Aug 2009 22:51:14 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5F9D8FC49; Wed, 26 Aug 2009 22:51:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QMpE2r077390; Wed, 26 Aug 2009 22:51:14 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QMpEGK077388; Wed, 26 Aug 2009 22:51:14 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262251.n7QMpEGK077388@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 22:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196573 - in stable/6/sys: . conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 22:51:14 -0000 Author: dougb Date: Wed Aug 26 22:51:14 2009 New Revision: 196573 URL: http://svn.freebsd.org/changeset/base/196573 Log: MFC r196435: The svnversion string is only relevant when newvers.sh is called during the kernel build process, the other places that call the script do not make use of that information. So restrict execution of the svnversion-related code to the kernel build context. Modified: stable/6/sys/ (props changed) stable/6/sys/conf/ (props changed) stable/6/sys/conf/newvers.sh Modified: stable/6/sys/conf/newvers.sh ============================================================================== --- stable/6/sys/conf/newvers.sh Wed Aug 26 22:50:14 2009 (r196572) +++ stable/6/sys/conf/newvers.sh Wed Aug 26 22:51:14 2009 (r196573) @@ -87,20 +87,22 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -for dir in /bin /usr/bin /usr/local/bin; do - if [ -x "${dir}/svnversion" ]; then - svnversion=${dir}/svnversion - SRCDIR=${d##*obj} - SRCDIR=${SRCDIR%%/sys/*} - break - fi -done +case "$d" in +*/sys/*) + for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + SRCDIR=${SRCDIR%%/sys/*} + break + fi + done -if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then - svn=" r`cd $SRCDIR && $svnversion`" -else - svn="" -fi + if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then + svn=" r`cd ${SRCDIR}/sys && $svnversion`" + fi + ;; +esac cat << EOF > vers.c $COPYRIGHT From owner-svn-src-stable@FreeBSD.ORG Thu Aug 27 00:45:01 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3D1F106568C; Thu, 27 Aug 2009 00:45:01 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BE0A8FC20; Thu, 27 Aug 2009 00:45:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R0j1UV079839; Thu, 27 Aug 2009 00:45:01 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R0j1xs079837; Thu, 27 Aug 2009 00:45:01 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200908270045.n7R0j1xs079837@svn.freebsd.org> From: Attilio Rao Date: Thu, 27 Aug 2009 00:45:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196574 - stable/7/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 00:45:01 -0000 Author: attilio Date: Thu Aug 27 00:45:00 2009 New Revision: 196574 URL: http://svn.freebsd.org/changeset/base/196574 Log: Fix a problem introduced when MFCing the rw_try_wlock() operation from HEAD: __rw_wunlock() relies on the cookie state to not be cleanly 'tid' when some conditions needing of special care happens, and lock recursion is among those. Dirty the cookie by adding the RW_LOCK_RECURSE flag in the case of a successfull try lock operation. This is not a problem on -CURRENT and STABLE_8 where the unlocking algorithm works differently. Submitted by: Andrew Brampton Modified: stable/7/sys/kern/kern_rwlock.c Modified: stable/7/sys/kern/kern_rwlock.c ============================================================================== --- stable/7/sys/kern/kern_rwlock.c Wed Aug 26 22:51:14 2009 (r196573) +++ stable/7/sys/kern/kern_rwlock.c Thu Aug 27 00:45:00 2009 (r196574) @@ -204,6 +204,7 @@ _rw_try_wlock(struct rwlock *rw, const c if (rw_wlocked(rw) && (rw->lock_object.lo_flags & RW_RECURSE) != 0) { rw->rw_recurse++; + atomic_set_ptr(&rw->rw_lock, RW_LOCK_RECURSED); rval = 1; } else rval = atomic_cmpset_acq_ptr(&rw->rw_lock, RW_UNLOCKED, From owner-svn-src-stable@FreeBSD.ORG Thu Aug 27 07:05:46 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6945106568C; Thu, 27 Aug 2009 07:05:46 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A488F8FC21; Thu, 27 Aug 2009 07:05:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R75kwm087543; Thu, 27 Aug 2009 07:05:46 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R75kd9087542; Thu, 27 Aug 2009 07:05:46 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908270705.n7R75kd9087542@svn.freebsd.org> From: Brian Somers Date: Thu, 27 Aug 2009 07:05:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196575 - stable/8/usr.sbin/ppp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 07:05:46 -0000 Author: brian Date: Thu Aug 27 07:05:46 2009 New Revision: 196575 URL: http://svn.freebsd.org/changeset/base/196575 Log: MFC: When realloc()ing device memory for transfer to another ppp process, don't continue to use the realloc()d pointer - it might have changed! Remove some stray diagnostics while I'm here. Approved by: re (kib) Modified: stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/ppp/ether.c stable/8/usr.sbin/ppp/netgraph.c stable/8/usr.sbin/ppp/tty.c Modified: stable/8/usr.sbin/ppp/ether.c ============================================================================== --- stable/8/usr.sbin/ppp/ether.c Thu Aug 27 00:45:00 2009 (r196574) +++ stable/8/usr.sbin/ppp/ether.c Thu Aug 27 07:05:46 2009 (r196575) @@ -193,17 +193,18 @@ static void ether_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct etherdevice *dev = device2ether(d); + struct etherdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ether(d); if (dev->cs >= 0) { *auxfd = dev->cs; (*nauxfd)++; Modified: stable/8/usr.sbin/ppp/netgraph.c ============================================================================== --- stable/8/usr.sbin/ppp/netgraph.c Thu Aug 27 00:45:00 2009 (r196574) +++ stable/8/usr.sbin/ppp/netgraph.c Thu Aug 27 07:05:46 2009 (r196575) @@ -235,7 +235,6 @@ ng_Read(struct physical *p, void *v, siz { char hook[NG_HOOKSIZ]; -log_Printf(LogDEBUG, "ng_Read\n"); switch (p->dl->state) { case DATALINK_DIAL: case DATALINK_LOGIN: @@ -282,17 +281,18 @@ static void ng_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct ngdevice *dev = device2ng(d); + struct ngdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ng(d); *auxfd = dev->cs; (*nauxfd)++; } Modified: stable/8/usr.sbin/ppp/tty.c ============================================================================== --- stable/8/usr.sbin/ppp/tty.c Thu Aug 27 00:45:00 2009 (r196574) +++ stable/8/usr.sbin/ppp/tty.c Thu Aug 27 07:05:46 2009 (r196575) @@ -384,7 +384,6 @@ UnloadLineDiscipline(struct physical *p) struct ttydevice *dev = device2tty(p->handler); if (isngtty(dev)) { -log_Printf(LogPHASE, "back to speed %d\n", dev->real.speed); if (!physical_SetSpeed(p, dev->real.speed)) log_Printf(LogWARN, "Couldn't reset tty speed to %d\n", dev->real.speed); dev->real.speed = 0; @@ -582,17 +581,19 @@ tty_device2iov(struct device *d, struct #endif ) { - struct ttydevice *dev = device2tty(d); + struct ttydevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2tty(d); + #ifndef NONETGRAPH if (dev->cs >= 0) { *auxfd = dev->cs; From owner-svn-src-stable@FreeBSD.ORG Thu Aug 27 07:07:39 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35E73106568E; Thu, 27 Aug 2009 07:07:39 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22FA28FC2D; Thu, 27 Aug 2009 07:07:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R77dL6087627; Thu, 27 Aug 2009 07:07:39 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R77drZ087622; Thu, 27 Aug 2009 07:07:39 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908270707.n7R77drZ087622@svn.freebsd.org> From: Brian Somers Date: Thu, 27 Aug 2009 07:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196576 - stable/8/usr.sbin/ppp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 07:07:39 -0000 Author: brian Date: Thu Aug 27 07:07:38 2009 New Revision: 196576 URL: http://svn.freebsd.org/changeset/base/196576 Log: MFC: When ``ppp -direct'' is invoked by a program that uses pipe(2) to create stdin and stdout, don't blindly try to use stdin as a bi-directional channel. Instead, detect the pipe and set up a special exec handler that indirects write() calls through stdout. This fixes the problem where ``set device "!ssh -e none host ppp -direct label"'' no longer works with an openssh-5.2 server side as that version of openssh ignores the USE_PIPES config setting and *always* uses pipes (rather than socketpair) for stdin/stdout channels. Approved by: re (kib) Modified: stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/ppp/exec.c stable/8/usr.sbin/ppp/exec.h stable/8/usr.sbin/ppp/main.c stable/8/usr.sbin/ppp/physical.c Modified: stable/8/usr.sbin/ppp/exec.c ============================================================================== --- stable/8/usr.sbin/ppp/exec.c Thu Aug 27 07:05:46 2009 (r196575) +++ stable/8/usr.sbin/ppp/exec.c Thu Aug 27 07:07:38 2009 (r196576) @@ -35,7 +35,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -63,24 +65,106 @@ #include "cbcp.h" #include "datalink.h" #include "id.h" +#include "main.h" #include "exec.h" -static struct device execdevice = { + +struct execdevice { + struct device dev; /* What struct physical knows about */ + int fd_out; /* output descriptor */ +}; + +#define device2exec(d) ((d)->type == EXEC_DEVICE ? (struct execdevice *)d : NULL) + +unsigned +exec_DeviceSize(void) +{ + return sizeof(struct execdevice); +} + +static void +exec_Free(struct physical *p) +{ + struct execdevice *dev = device2exec(p->handler); + + if (dev->fd_out != -1) + close(dev->fd_out); + free(dev); +} + +static void +exec_device2iov(struct device *d, struct iovec *iov, int *niov, + int maxiov __unused, int *auxfd, int *nauxfd) +{ + struct execdevice *dev; + int sz = physical_MaxDeviceSize(); + + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); + AbortProgram(EX_OSERR); + } + iov[*niov].iov_len = sz; + (*niov)++; + + dev = device2exec(d); + if (dev->fd_out >= 0) { + *auxfd = dev->fd_out; + (*nauxfd)++; + } +} + +static int +exec_RemoveFromSet(struct physical *p, fd_set *r, fd_set *w, fd_set *e) +{ + struct execdevice *dev = device2exec(p->handler); + int sets; + + p->handler->removefromset = NULL; + sets = physical_RemoveFromSet(p, r, w, e); + p->handler->removefromset = exec_RemoveFromSet; + + if (dev->fd_out >= 0) { + if (w && FD_ISSET(dev->fd_out, w)) { + FD_CLR(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdunset(w) %d\n", p->link.name, dev->fd_out); + sets++; + } + if (e && FD_ISSET(dev->fd_out, e)) { + FD_CLR(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdunset(e) %d\n", p->link.name, dev->fd_out); + sets++; + } + } + + return sets; +} + +static ssize_t +exec_Write(struct physical *p, const void *v, size_t n) +{ + struct execdevice *dev = device2exec(p->handler); + int fd = dev->fd_out == -1 ? p->fd : dev->fd_out; + + return write(fd, v, n); +} + +static struct device baseexecdevice = { EXEC_DEVICE, "exec", 0, { CD_NOTREQUIRED, 0 }, NULL, + exec_RemoveFromSet, NULL, NULL, NULL, NULL, NULL, + exec_Free, NULL, - NULL, - NULL, - NULL, - NULL, + exec_Write, + exec_device2iov, NULL, NULL, NULL @@ -88,146 +172,238 @@ static struct device execdevice = { struct device * exec_iov2device(int type, struct physical *p, struct iovec *iov, - int *niov, int maxiov __unused, int *auxfd __unused, - int *nauxfd __unused) + int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { if (type == EXEC_DEVICE) { - free(iov[(*niov)++].iov_base); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - return &execdevice; + struct execdevice *dev = (struct execdevice *)iov[(*niov)++].iov_base; + + dev = realloc(dev, sizeof *dev); /* Reduce to the correct size */ + if (dev == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", + (int)(sizeof *dev)); + AbortProgram(EX_OSERR); + } + + if (*nauxfd) { + dev->fd_out = *auxfd; + (*nauxfd)--; + } else + dev->fd_out = -1; + + /* Refresh function pointers etc */ + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + return &dev->dev; } return NULL; } +static int +exec_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = 0; + + if (w && dev->fd_out >= 0) { + FD_SET(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdset(w) %d\n", p->link.name, dev->fd_out); + result++; + w = NULL; + } + + if (e && dev->fd_out >= 0) { + FD_SET(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdset(e) %d\n", p->link.name, dev->fd_out); + result++; + } + + if (result && *n <= dev->fd_out) + *n = dev->fd_out + 1; + + return result + physical_doUpdateSet(d, r, w, e, n, 0); +} + +static int +exec_IsSet(struct fdescriptor *d, const fd_set *fdset) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = dev->fd_out >= 0 && FD_ISSET(dev->fd_out, fdset); + result += physical_IsSet(d, fdset); + + return result; +} + struct device * exec_Create(struct physical *p) { - if (p->fd < 0 && *p->name.full == '!') { - int fids[2], type; - - p->fd--; /* We own the device but maybe can't use it - change fd */ - type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + struct execdevice *dev; - if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) - log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", - strerror(errno)); - else { - static int child_status; /* This variable is abused ! */ - int stat, argc, i, ret, wret, pidpipe[2]; - pid_t pid, realpid; - char *argv[MAXARGS]; - - stat = fcntl(fids[0], F_GETFL, 0); - if (stat > 0) { - stat |= O_NONBLOCK; - fcntl(fids[0], F_SETFL, stat); + dev = NULL; + if (p->fd < 0) { + if (*p->name.full == '!') { + int fids[2], type; + + if ((dev = malloc(sizeof *dev)) == NULL) { + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + return NULL; } - realpid = getpid(); - if (pipe(pidpipe) == -1) { - log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", + dev->fd_out = -1; + + p->fd--; /* We own the device but maybe can't use it - change fd */ + type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + + if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) { + log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", strerror(errno)); - close(fids[1]); - } else switch ((pid = fork())) { - case -1: - log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", + free(dev); + dev = NULL; + } else { + static int child_status; /* This variable is abused ! */ + int stat, argc, i, ret, wret, pidpipe[2]; + pid_t pid, realpid; + char *argv[MAXARGS]; + + stat = fcntl(fids[0], F_GETFL, 0); + if (stat > 0) { + stat |= O_NONBLOCK; + fcntl(fids[0], F_SETFL, stat); + } + realpid = getpid(); + if (pipe(pidpipe) == -1) { + log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", strerror(errno)); - close(pidpipe[0]); - close(pidpipe[1]); close(fids[1]); - break; - - case 0: - close(pidpipe[0]); close(fids[0]); - timer_TermService(); -#ifndef NOSUID - setuid(ID0realuid()); -#endif - - child_status = 0; - switch ((pid = vfork())) { - case 0: - close(pidpipe[1]); - break; - - case -1: - ret = errno; - log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", - strerror(errno)); - close(pidpipe[1]); - _exit(ret); - - default: - write(pidpipe[1], &pid, sizeof pid); - close(pidpipe[1]); - _exit(child_status); /* The error from exec() ! */ - } - - log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); - - if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), - PARSE_REDUCE|PARSE_NOHASH)) < 0) { - log_Printf(LogWARN, "Syntax error in exec command\n"); - _exit(ESRCH); - } - - command_Expand(argv, argc, (char const *const *)argv, - p->dl->bundle, 0, realpid); - - dup2(fids[1], STDIN_FILENO); - dup2(fids[1], STDOUT_FILENO); - dup2(fids[1], STDERR_FILENO); - for (i = getdtablesize(); i > STDERR_FILENO; i--) - fcntl(i, F_SETFD, 1); - - execvp(*argv, argv); - child_status = errno; /* Only works for vfork() */ - printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); - _exit(child_status); - break; - - default: - close(pidpipe[1]); - close(fids[1]); - if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != - sizeof p->session_owner) - p->session_owner = (pid_t)-1; - close(pidpipe[0]); - while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) - ; - if (wret == -1) { - log_Printf(LogWARN, "Waiting for child process: %s\n", + free(dev); + dev = NULL; + } else switch ((pid = fork())) { + case -1: + log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", strerror(errno)); + close(pidpipe[0]); + close(pidpipe[1]); + close(fids[1]); close(fids[0]); - p->session_owner = (pid_t)-1; - break; - } else if (WIFSIGNALED(stat)) { - log_Printf(LogWARN, "Child process received sig %d !\n", - WTERMSIG(stat)); - close(fids[0]); - p->session_owner = (pid_t)-1; break; - } else if (WIFSTOPPED(stat)) { - log_Printf(LogWARN, "Child process received stop sig %d !\n", - WSTOPSIG(stat)); - /* I guess that's ok.... */ - } else if ((ret = WEXITSTATUS(stat))) { - log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, - strerror(ret)); + + case 0: + close(pidpipe[0]); close(fids[0]); - p->session_owner = (pid_t)-1; + timer_TermService(); + #ifndef NOSUID + setuid(ID0realuid()); + #endif + + child_status = 0; + switch ((pid = vfork())) { + case 0: + close(pidpipe[1]); + break; + + case -1: + ret = errno; + log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", + strerror(errno)); + close(pidpipe[1]); + _exit(ret); + + default: + write(pidpipe[1], &pid, sizeof pid); + close(pidpipe[1]); + _exit(child_status); /* The error from exec() ! */ + } + + log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); + + if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), + PARSE_REDUCE|PARSE_NOHASH)) < 0) { + log_Printf(LogWARN, "Syntax error in exec command\n"); + _exit(ESRCH); + } + + command_Expand(argv, argc, (char const *const *)argv, + p->dl->bundle, 0, realpid); + + dup2(fids[1], STDIN_FILENO); + dup2(fids[1], STDOUT_FILENO); + dup2(fids[1], STDERR_FILENO); + for (i = getdtablesize(); i > STDERR_FILENO; i--) + fcntl(i, F_SETFD, 1); + + execvp(*argv, argv); + child_status = errno; /* Only works for vfork() */ + printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); + _exit(child_status); break; - } - p->fd = fids[0]; - log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - if (p->cfg.cd.necessity != CD_DEFAULT) - log_Printf(LogWARN, "Carrier settings ignored\n"); - return &execdevice; + + default: + close(pidpipe[1]); + close(fids[1]); + if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != + sizeof p->session_owner) + p->session_owner = (pid_t)-1; + close(pidpipe[0]); + while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) + ; + if (wret == -1) { + log_Printf(LogWARN, "Waiting for child process: %s\n", + strerror(errno)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSIGNALED(stat)) { + log_Printf(LogWARN, "Child process received sig %d !\n", + WTERMSIG(stat)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSTOPPED(stat)) { + log_Printf(LogWARN, "Child process received stop sig %d !\n", + WSTOPSIG(stat)); + /* I guess that's ok.... */ + } else if ((ret = WEXITSTATUS(stat))) { + log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, + strerror(ret)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } + p->fd = fids[0]; + log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); + } } - close(fids[0]); } + } else { + struct stat st; + + if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFIFO)) { + if ((dev = malloc(sizeof *dev)) == NULL) + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + else if (p->fd == STDIN_FILENO) { + log_Printf(LogPHASE, "%s: Using stdin/stdout to communicate with " + "parent (pipe mode)\n", p->link.name); + dev->fd_out = dup(STDOUT_FILENO); + + /* Hook things up so that we monitor dev->fd_out */ + p->desc.UpdateSet = exec_UpdateSet; + p->desc.IsSet = exec_IsSet; + } else + dev->fd_out = -1; + } + } + + if (dev) { + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + if (p->cfg.cd.necessity != CD_DEFAULT) + log_Printf(LogWARN, "Carrier settings ignored\n"); + return &dev->dev; } return NULL; Modified: stable/8/usr.sbin/ppp/exec.h ============================================================================== --- stable/8/usr.sbin/ppp/exec.h Thu Aug 27 07:05:46 2009 (r196575) +++ stable/8/usr.sbin/ppp/exec.h Thu Aug 27 07:07:38 2009 (r196576) @@ -32,4 +32,4 @@ struct device; extern struct device *exec_Create(struct physical *); extern struct device *exec_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -#define exec_DeviceSize physical_DeviceSize +extern unsigned exec_DeviceSize(void); Modified: stable/8/usr.sbin/ppp/main.c ============================================================================== --- stable/8/usr.sbin/ppp/main.c Thu Aug 27 07:05:46 2009 (r196575) +++ stable/8/usr.sbin/ppp/main.c Thu Aug 27 07:07:38 2009 (r196576) @@ -509,9 +509,11 @@ main(int argc, char **argv) if (!sw.fg) setsid(); } else { - /* -direct - STDIN_FILENO gets used by physical_Open */ + /* + * -direct - STDIN_FILENO gets used by physical_Open. STDOUT_FILENO + * *may* get used in exec/pipe mode. + */ prompt_TtyInit(NULL); - close(STDOUT_FILENO); close(STDERR_FILENO); } } else { Modified: stable/8/usr.sbin/ppp/physical.c ============================================================================== --- stable/8/usr.sbin/ppp/physical.c Thu Aug 27 07:05:46 2009 (r196575) +++ stable/8/usr.sbin/ppp/physical.c Thu Aug 27 07:07:38 2009 (r196576) @@ -1017,6 +1017,7 @@ physical_Open(struct physical *p) p->fd = STDIN_FILENO; for (h = 0; h < NDEVICES && p->handler == NULL && p->fd >= 0; h++) p->handler = (*devices[h].create)(p); + close(STDOUT_FILENO); if (p->fd >= 0) { if (p->handler == NULL) { physical_SetupStack(p, "unknown", PHYSICAL_NOFORCE); From owner-svn-src-stable@FreeBSD.ORG Thu Aug 27 07:10:58 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDB171065690; Thu, 27 Aug 2009 07:10:57 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBD4D8FC2E; Thu, 27 Aug 2009 07:10:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R7AvUH087751; Thu, 27 Aug 2009 07:10:57 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R7Av56087747; Thu, 27 Aug 2009 07:10:57 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908270710.n7R7Av56087747@svn.freebsd.org> From: Brian Somers Date: Thu, 27 Aug 2009 07:10:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196577 - stable/7/usr.sbin/ppp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 07:10:58 -0000 Author: brian Date: Thu Aug 27 07:10:57 2009 New Revision: 196577 URL: http://svn.freebsd.org/changeset/base/196577 Log: MFC: When realloc()ing device memory for transfer to another ppp process, don't continue to use the realloc()d pointer - it might have changed! Remove some stray diagnostics while I'm here. Modified: stable/7/usr.sbin/ppp/ (props changed) stable/7/usr.sbin/ppp/ether.c stable/7/usr.sbin/ppp/netgraph.c stable/7/usr.sbin/ppp/tty.c Modified: stable/7/usr.sbin/ppp/ether.c ============================================================================== --- stable/7/usr.sbin/ppp/ether.c Thu Aug 27 07:07:38 2009 (r196576) +++ stable/7/usr.sbin/ppp/ether.c Thu Aug 27 07:10:57 2009 (r196577) @@ -193,17 +193,18 @@ static void ether_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct etherdevice *dev = device2ether(d); + struct etherdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ether(d); if (dev->cs >= 0) { *auxfd = dev->cs; (*nauxfd)++; Modified: stable/7/usr.sbin/ppp/netgraph.c ============================================================================== --- stable/7/usr.sbin/ppp/netgraph.c Thu Aug 27 07:07:38 2009 (r196576) +++ stable/7/usr.sbin/ppp/netgraph.c Thu Aug 27 07:10:57 2009 (r196577) @@ -235,7 +235,6 @@ ng_Read(struct physical *p, void *v, siz { char hook[NG_HOOKSIZ]; -log_Printf(LogDEBUG, "ng_Read\n"); switch (p->dl->state) { case DATALINK_DIAL: case DATALINK_LOGIN: @@ -282,17 +281,18 @@ static void ng_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct ngdevice *dev = device2ng(d); + struct ngdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ng(d); *auxfd = dev->cs; (*nauxfd)++; } Modified: stable/7/usr.sbin/ppp/tty.c ============================================================================== --- stable/7/usr.sbin/ppp/tty.c Thu Aug 27 07:07:38 2009 (r196576) +++ stable/7/usr.sbin/ppp/tty.c Thu Aug 27 07:10:57 2009 (r196577) @@ -384,7 +384,6 @@ UnloadLineDiscipline(struct physical *p) struct ttydevice *dev = device2tty(p->handler); if (isngtty(dev)) { -log_Printf(LogPHASE, "back to speed %d\n", dev->real.speed); if (!physical_SetSpeed(p, dev->real.speed)) log_Printf(LogWARN, "Couldn't reset tty speed to %d\n", dev->real.speed); dev->real.speed = 0; @@ -582,17 +581,19 @@ tty_device2iov(struct device *d, struct #endif ) { - struct ttydevice *dev = device2tty(d); + struct ttydevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2tty(d); + #ifndef NONETGRAPH if (dev->cs >= 0) { *auxfd = dev->cs; From owner-svn-src-stable@FreeBSD.ORG Thu Aug 27 07:11:47 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7883D106568E; Thu, 27 Aug 2009 07:11:47 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65A4F8FC3F; Thu, 27 Aug 2009 07:11:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R7BlX1087830; Thu, 27 Aug 2009 07:11:47 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R7BlR6087825; Thu, 27 Aug 2009 07:11:47 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908270711.n7R7BlR6087825@svn.freebsd.org> From: Brian Somers Date: Thu, 27 Aug 2009 07:11:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196578 - stable/7/usr.sbin/ppp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 07:11:47 -0000 Author: brian Date: Thu Aug 27 07:11:47 2009 New Revision: 196578 URL: http://svn.freebsd.org/changeset/base/196578 Log: MFC: When ``ppp -direct'' is invoked by a program that uses pipe(2) to create stdin and stdout, don't blindly try to use stdin as a bi-directional channel. Instead, detect the pipe and set up a special exec handler that indirects write() calls through stdout. This fixes the problem where ``set device "!ssh -e none host ppp -direct label"'' no longer works with an openssh-5.2 server side as that version of openssh ignores the USE_PIPES config setting and *always* uses pipes (rather than socketpair) for stdin/stdout channels. Modified: stable/7/usr.sbin/ppp/ (props changed) stable/7/usr.sbin/ppp/exec.c stable/7/usr.sbin/ppp/exec.h stable/7/usr.sbin/ppp/main.c stable/7/usr.sbin/ppp/physical.c Modified: stable/7/usr.sbin/ppp/exec.c ============================================================================== --- stable/7/usr.sbin/ppp/exec.c Thu Aug 27 07:10:57 2009 (r196577) +++ stable/7/usr.sbin/ppp/exec.c Thu Aug 27 07:11:47 2009 (r196578) @@ -35,7 +35,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -63,24 +65,106 @@ #include "cbcp.h" #include "datalink.h" #include "id.h" +#include "main.h" #include "exec.h" -static struct device execdevice = { + +struct execdevice { + struct device dev; /* What struct physical knows about */ + int fd_out; /* output descriptor */ +}; + +#define device2exec(d) ((d)->type == EXEC_DEVICE ? (struct execdevice *)d : NULL) + +unsigned +exec_DeviceSize(void) +{ + return sizeof(struct execdevice); +} + +static void +exec_Free(struct physical *p) +{ + struct execdevice *dev = device2exec(p->handler); + + if (dev->fd_out != -1) + close(dev->fd_out); + free(dev); +} + +static void +exec_device2iov(struct device *d, struct iovec *iov, int *niov, + int maxiov __unused, int *auxfd, int *nauxfd) +{ + struct execdevice *dev; + int sz = physical_MaxDeviceSize(); + + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); + AbortProgram(EX_OSERR); + } + iov[*niov].iov_len = sz; + (*niov)++; + + dev = device2exec(d); + if (dev->fd_out >= 0) { + *auxfd = dev->fd_out; + (*nauxfd)++; + } +} + +static int +exec_RemoveFromSet(struct physical *p, fd_set *r, fd_set *w, fd_set *e) +{ + struct execdevice *dev = device2exec(p->handler); + int sets; + + p->handler->removefromset = NULL; + sets = physical_RemoveFromSet(p, r, w, e); + p->handler->removefromset = exec_RemoveFromSet; + + if (dev->fd_out >= 0) { + if (w && FD_ISSET(dev->fd_out, w)) { + FD_CLR(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdunset(w) %d\n", p->link.name, dev->fd_out); + sets++; + } + if (e && FD_ISSET(dev->fd_out, e)) { + FD_CLR(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdunset(e) %d\n", p->link.name, dev->fd_out); + sets++; + } + } + + return sets; +} + +static ssize_t +exec_Write(struct physical *p, const void *v, size_t n) +{ + struct execdevice *dev = device2exec(p->handler); + int fd = dev->fd_out == -1 ? p->fd : dev->fd_out; + + return write(fd, v, n); +} + +static struct device baseexecdevice = { EXEC_DEVICE, "exec", 0, { CD_NOTREQUIRED, 0 }, NULL, + exec_RemoveFromSet, NULL, NULL, NULL, NULL, NULL, + exec_Free, NULL, - NULL, - NULL, - NULL, - NULL, + exec_Write, + exec_device2iov, NULL, NULL, NULL @@ -88,146 +172,238 @@ static struct device execdevice = { struct device * exec_iov2device(int type, struct physical *p, struct iovec *iov, - int *niov, int maxiov __unused, int *auxfd __unused, - int *nauxfd __unused) + int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { if (type == EXEC_DEVICE) { - free(iov[(*niov)++].iov_base); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - return &execdevice; + struct execdevice *dev = (struct execdevice *)iov[(*niov)++].iov_base; + + dev = realloc(dev, sizeof *dev); /* Reduce to the correct size */ + if (dev == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", + (int)(sizeof *dev)); + AbortProgram(EX_OSERR); + } + + if (*nauxfd) { + dev->fd_out = *auxfd; + (*nauxfd)--; + } else + dev->fd_out = -1; + + /* Refresh function pointers etc */ + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + return &dev->dev; } return NULL; } +static int +exec_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = 0; + + if (w && dev->fd_out >= 0) { + FD_SET(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdset(w) %d\n", p->link.name, dev->fd_out); + result++; + w = NULL; + } + + if (e && dev->fd_out >= 0) { + FD_SET(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdset(e) %d\n", p->link.name, dev->fd_out); + result++; + } + + if (result && *n <= dev->fd_out) + *n = dev->fd_out + 1; + + return result + physical_doUpdateSet(d, r, w, e, n, 0); +} + +static int +exec_IsSet(struct fdescriptor *d, const fd_set *fdset) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = dev->fd_out >= 0 && FD_ISSET(dev->fd_out, fdset); + result += physical_IsSet(d, fdset); + + return result; +} + struct device * exec_Create(struct physical *p) { - if (p->fd < 0 && *p->name.full == '!') { - int fids[2], type; - - p->fd--; /* We own the device but maybe can't use it - change fd */ - type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + struct execdevice *dev; - if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) - log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", - strerror(errno)); - else { - static int child_status; /* This variable is abused ! */ - int stat, argc, i, ret, wret, pidpipe[2]; - pid_t pid, realpid; - char *argv[MAXARGS]; - - stat = fcntl(fids[0], F_GETFL, 0); - if (stat > 0) { - stat |= O_NONBLOCK; - fcntl(fids[0], F_SETFL, stat); + dev = NULL; + if (p->fd < 0) { + if (*p->name.full == '!') { + int fids[2], type; + + if ((dev = malloc(sizeof *dev)) == NULL) { + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + return NULL; } - realpid = getpid(); - if (pipe(pidpipe) == -1) { - log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", + dev->fd_out = -1; + + p->fd--; /* We own the device but maybe can't use it - change fd */ + type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + + if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) { + log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", strerror(errno)); - close(fids[1]); - } else switch ((pid = fork())) { - case -1: - log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", + free(dev); + dev = NULL; + } else { + static int child_status; /* This variable is abused ! */ + int stat, argc, i, ret, wret, pidpipe[2]; + pid_t pid, realpid; + char *argv[MAXARGS]; + + stat = fcntl(fids[0], F_GETFL, 0); + if (stat > 0) { + stat |= O_NONBLOCK; + fcntl(fids[0], F_SETFL, stat); + } + realpid = getpid(); + if (pipe(pidpipe) == -1) { + log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", strerror(errno)); - close(pidpipe[0]); - close(pidpipe[1]); close(fids[1]); - break; - - case 0: - close(pidpipe[0]); close(fids[0]); - timer_TermService(); -#ifndef NOSUID - setuid(ID0realuid()); -#endif - - child_status = 0; - switch ((pid = vfork())) { - case 0: - close(pidpipe[1]); - break; - - case -1: - ret = errno; - log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", - strerror(errno)); - close(pidpipe[1]); - _exit(ret); - - default: - write(pidpipe[1], &pid, sizeof pid); - close(pidpipe[1]); - _exit(child_status); /* The error from exec() ! */ - } - - log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); - - if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), - PARSE_REDUCE|PARSE_NOHASH)) < 0) { - log_Printf(LogWARN, "Syntax error in exec command\n"); - _exit(ESRCH); - } - - command_Expand(argv, argc, (char const *const *)argv, - p->dl->bundle, 0, realpid); - - dup2(fids[1], STDIN_FILENO); - dup2(fids[1], STDOUT_FILENO); - dup2(fids[1], STDERR_FILENO); - for (i = getdtablesize(); i > STDERR_FILENO; i--) - fcntl(i, F_SETFD, 1); - - execvp(*argv, argv); - child_status = errno; /* Only works for vfork() */ - printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); - _exit(child_status); - break; - - default: - close(pidpipe[1]); - close(fids[1]); - if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != - sizeof p->session_owner) - p->session_owner = (pid_t)-1; - close(pidpipe[0]); - while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) - ; - if (wret == -1) { - log_Printf(LogWARN, "Waiting for child process: %s\n", + free(dev); + dev = NULL; + } else switch ((pid = fork())) { + case -1: + log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", strerror(errno)); + close(pidpipe[0]); + close(pidpipe[1]); + close(fids[1]); close(fids[0]); - p->session_owner = (pid_t)-1; - break; - } else if (WIFSIGNALED(stat)) { - log_Printf(LogWARN, "Child process received sig %d !\n", - WTERMSIG(stat)); - close(fids[0]); - p->session_owner = (pid_t)-1; break; - } else if (WIFSTOPPED(stat)) { - log_Printf(LogWARN, "Child process received stop sig %d !\n", - WSTOPSIG(stat)); - /* I guess that's ok.... */ - } else if ((ret = WEXITSTATUS(stat))) { - log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, - strerror(ret)); + + case 0: + close(pidpipe[0]); close(fids[0]); - p->session_owner = (pid_t)-1; + timer_TermService(); + #ifndef NOSUID + setuid(ID0realuid()); + #endif + + child_status = 0; + switch ((pid = vfork())) { + case 0: + close(pidpipe[1]); + break; + + case -1: + ret = errno; + log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", + strerror(errno)); + close(pidpipe[1]); + _exit(ret); + + default: + write(pidpipe[1], &pid, sizeof pid); + close(pidpipe[1]); + _exit(child_status); /* The error from exec() ! */ + } + + log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); + + if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), + PARSE_REDUCE|PARSE_NOHASH)) < 0) { + log_Printf(LogWARN, "Syntax error in exec command\n"); + _exit(ESRCH); + } + + command_Expand(argv, argc, (char const *const *)argv, + p->dl->bundle, 0, realpid); + + dup2(fids[1], STDIN_FILENO); + dup2(fids[1], STDOUT_FILENO); + dup2(fids[1], STDERR_FILENO); + for (i = getdtablesize(); i > STDERR_FILENO; i--) + fcntl(i, F_SETFD, 1); + + execvp(*argv, argv); + child_status = errno; /* Only works for vfork() */ + printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); + _exit(child_status); break; - } - p->fd = fids[0]; - log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - if (p->cfg.cd.necessity != CD_DEFAULT) - log_Printf(LogWARN, "Carrier settings ignored\n"); - return &execdevice; + + default: + close(pidpipe[1]); + close(fids[1]); + if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != + sizeof p->session_owner) + p->session_owner = (pid_t)-1; + close(pidpipe[0]); + while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) + ; + if (wret == -1) { + log_Printf(LogWARN, "Waiting for child process: %s\n", + strerror(errno)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSIGNALED(stat)) { + log_Printf(LogWARN, "Child process received sig %d !\n", + WTERMSIG(stat)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSTOPPED(stat)) { + log_Printf(LogWARN, "Child process received stop sig %d !\n", + WSTOPSIG(stat)); + /* I guess that's ok.... */ + } else if ((ret = WEXITSTATUS(stat))) { + log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, + strerror(ret)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } + p->fd = fids[0]; + log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); + } } - close(fids[0]); } + } else { + struct stat st; + + if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFIFO)) { + if ((dev = malloc(sizeof *dev)) == NULL) + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + else if (p->fd == STDIN_FILENO) { + log_Printf(LogPHASE, "%s: Using stdin/stdout to communicate with " + "parent (pipe mode)\n", p->link.name); + dev->fd_out = dup(STDOUT_FILENO); + + /* Hook things up so that we monitor dev->fd_out */ + p->desc.UpdateSet = exec_UpdateSet; + p->desc.IsSet = exec_IsSet; + } else + dev->fd_out = -1; + } + } + + if (dev) { + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + if (p->cfg.cd.necessity != CD_DEFAULT) + log_Printf(LogWARN, "Carrier settings ignored\n"); + return &dev->dev; } return NULL; Modified: stable/7/usr.sbin/ppp/exec.h ============================================================================== --- stable/7/usr.sbin/ppp/exec.h Thu Aug 27 07:10:57 2009 (r196577) +++ stable/7/usr.sbin/ppp/exec.h Thu Aug 27 07:11:47 2009 (r196578) @@ -32,4 +32,4 @@ struct device; extern struct device *exec_Create(struct physical *); extern struct device *exec_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -#define exec_DeviceSize physical_DeviceSize +extern unsigned exec_DeviceSize(void); Modified: stable/7/usr.sbin/ppp/main.c ============================================================================== --- stable/7/usr.sbin/ppp/main.c Thu Aug 27 07:10:57 2009 (r196577) +++ stable/7/usr.sbin/ppp/main.c Thu Aug 27 07:11:47 2009 (r196578) @@ -508,9 +508,11 @@ main(int argc, char **argv) if (!sw.fg) setsid(); } else { - /* -direct - STDIN_FILENO gets used by physical_Open */ + /* + * -direct - STDIN_FILENO gets used by physical_Open. STDOUT_FILENO + * *may* get used in exec/pipe mode. + */ prompt_TtyInit(NULL); - close(STDOUT_FILENO); close(STDERR_FILENO); } } else { Modified: stable/7/usr.sbin/ppp/physical.c ============================================================================== --- stable/7/usr.sbin/ppp/physical.c Thu Aug 27 07:10:57 2009 (r196577) +++ stable/7/usr.sbin/ppp/physical.c Thu Aug 27 07:11:47 2009 (r196578) @@ -1027,6 +1027,7 @@ physical_Open(struct physical *p) p->fd = STDIN_FILENO; for (h = 0; h < NDEVICES && p->handler == NULL && p->fd >= 0; h++) p->handler = (*devices[h].create)(p); + close(STDOUT_FILENO); if (p->fd >= 0) { if (p->handler == NULL) { physical_SetupStack(p, "unknown", PHYSICAL_NOFORCE); From owner-svn-src-stable@FreeBSD.ORG Thu Aug 27 12:27:06 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74C51106568B; Thu, 27 Aug 2009 12:27:06 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 625A18FC3C; Thu, 27 Aug 2009 12:27:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCR66a095862; Thu, 27 Aug 2009 12:27:06 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCR6FB095857; Thu, 27 Aug 2009 12:27:06 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200908271227.n7RCR6FB095857@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 27 Aug 2009 12:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196583 - stable/7/share/zoneinfo X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 12:27:06 -0000 Author: edwin Date: Thu Aug 27 12:27:06 2009 New Revision: 196583 URL: http://svn.freebsd.org/changeset/base/196583 Log: MFC of r196581: Import of tzdata2009k - Changes in Mauritius and Bangladesh - No leapsecond at the end of December 2009 Modified: stable/7/share/zoneinfo/ (props changed) stable/7/share/zoneinfo/africa stable/7/share/zoneinfo/asia stable/7/share/zoneinfo/europe stable/7/share/zoneinfo/leapseconds Modified: stable/7/share/zoneinfo/africa ============================================================================== --- stable/7/share/zoneinfo/africa Thu Aug 27 12:24:21 2009 (r196582) +++ stable/7/share/zoneinfo/africa Thu Aug 27 12:27:06 2009 (r196583) @@ -1,5 +1,5 @@ #
-# @(#)africa	8.21
+# @(#)africa	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -502,11 +502,33 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
 # 
 
+# From Steffen Thorsen (2009-06-05):
+# According to several sources, Mauritius will not continue to observe
+# DST the coming summer...
+#
+# Some sources, in French:
+# 
+# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
+# 
+# 
+# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
+# 
+#
+# Our wrap-up:
+# 
+# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
+# 
+
+# From Arthur David Olson (2009-07-11):
+# The "mauritius-dst-will-not-repeat" wrapup includes this: 
+# "The trial ended on March 29, 2009, when the clocks moved back by one hour
+# at 2am (or 02:00) local time..."
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Mauritius	1982	only	-	Oct	10	0:00	1:00	S
 Rule Mauritius	1983	only	-	Mar	21	0:00	0	-
-Rule Mauritius	2008	max	-	Oct	lastSun	2:00s	1:00	S
-Rule Mauritius	2009	max	-	Mar	lastSun	2:00s	0	-
+Rule Mauritius	2008	only	-	Oct	lastSun	2:00	1:00	S
+Rule Mauritius	2009	only	-	Mar	lastSun	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Mauritius	3:50:00 -	LMT	1907		# Port Louis
 			4:00 Mauritius	MU%sT	# Mauritius Time

Modified: stable/7/share/zoneinfo/asia
==============================================================================
--- stable/7/share/zoneinfo/asia	Thu Aug 27 12:24:21 2009	(r196582)
+++ stable/7/share/zoneinfo/asia	Thu Aug 27 12:27:06 2009	(r196583)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.35
+# @(#)asia	8.36
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,6 +172,12 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
+# From Arthur David Olson (2009-07-11):
+# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
+# can appear in the Dhaka binary file and for the benefit of old glibc
+# reimplementations of the time zone software that mishandle permanent DST.
+# A change will be required once the end date is known.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
@@ -180,7 +186,8 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST
+			6:00	1:00	BDST	2010
+			6:00	-	BDT
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]

Modified: stable/7/share/zoneinfo/europe
==============================================================================
--- stable/7/share/zoneinfo/europe	Thu Aug 27 12:24:21 2009	(r196582)
+++ stable/7/share/zoneinfo/europe	Thu Aug 27 12:27:06 2009	(r196583)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.21
+# @(#)europe	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -459,7 +459,7 @@ Rule	EU	1979	1995	-	Sep	lastSun	 1:00u	0
 Rule	EU	1981	max	-	Mar	lastSun	 1:00u	1:00	S
 Rule	EU	1996	max	-	Oct	lastSun	 1:00u	0	-
 # The most recent directive covers the years starting in 2002.  See:
-# 
+# 
 # Directive 2000/84/EC of the European Parliament and of the Council
 # of 19 January 2001 on summer-time arrangements.
 # 

Modified: stable/7/share/zoneinfo/leapseconds
==============================================================================
--- stable/7/share/zoneinfo/leapseconds	Thu Aug 27 12:24:21 2009	(r196582)
+++ stable/7/share/zoneinfo/leapseconds	Thu Aug 27 12:27:06 2009	(r196583)
@@ -1,5 +1,5 @@
 # 
-# @(#)leapseconds	8.8
+# @(#)leapseconds	8.9
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -58,29 +58,30 @@ Leap	2008	Dec	31	23:59:60	+	S
 # 61, Av. de l'Observatoire 75014 PARIS (France)
 # Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
-# e-mail    : services.iers@obspm.fr
-# http://hpiers.obspm.fr/eop-pc
+# Internet  : services.iers@obspm.fr
 #
-# Paris, 15 January 2009
+# Paris, 4 July 2009
 #
-# Bulletin C 37
+# Bulletin C 38
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# NO positive leap second will be introduced at the end of June 2009.
-# The difference between Coordinated Universal Time UTC and the 
-# International Atomic Time TAI is :             
-#                
-#     from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
+# INFORMATION ON UTC - TAI
+#
+# NO positive leap second will be introduced at the end of December 2009.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is :		
+#
+# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
+# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC, or to confirm that there
 # will be no time step at the next possible date.
 #
 # Daniel GAMBIS
-# Head		
+# Director			
 # Earth Orientation Center of IERS
 # Observatoire de Paris, France

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 12:27:20 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 49D5F106568E;
	Thu, 27 Aug 2009 12:27:20 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ED93A8FC48;
	Thu, 27 Aug 2009 12:27:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCRJPO095908;
	Thu, 27 Aug 2009 12:27:19 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCRJaK095903;
	Thu, 27 Aug 2009 12:27:19 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271227.n7RCRJaK095903@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:27:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196584 - stable/6/share/zoneinfo
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:27:20 -0000

Author: edwin
Date: Thu Aug 27 12:27:19 2009
New Revision: 196584
URL: http://svn.freebsd.org/changeset/base/196584

Log:
  MFC of r196581: Import of tzdata2009k
  
  - Changes in Mauritius and Bangladesh
  - No leapsecond at the end of December 2009

Modified:
  stable/6/share/zoneinfo/   (props changed)
  stable/6/share/zoneinfo/africa
  stable/6/share/zoneinfo/asia
  stable/6/share/zoneinfo/europe
  stable/6/share/zoneinfo/leapseconds

Modified: stable/6/share/zoneinfo/africa
==============================================================================
--- stable/6/share/zoneinfo/africa	Thu Aug 27 12:27:06 2009	(r196583)
+++ stable/6/share/zoneinfo/africa	Thu Aug 27 12:27:19 2009	(r196584)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.21
+# @(#)africa	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -502,11 +502,33 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
 # 
 
+# From Steffen Thorsen (2009-06-05):
+# According to several sources, Mauritius will not continue to observe
+# DST the coming summer...
+#
+# Some sources, in French:
+# 
+# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
+# 
+# 
+# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
+# 
+#
+# Our wrap-up:
+# 
+# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
+# 
+
+# From Arthur David Olson (2009-07-11):
+# The "mauritius-dst-will-not-repeat" wrapup includes this: 
+# "The trial ended on March 29, 2009, when the clocks moved back by one hour
+# at 2am (or 02:00) local time..."
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Mauritius	1982	only	-	Oct	10	0:00	1:00	S
 Rule Mauritius	1983	only	-	Mar	21	0:00	0	-
-Rule Mauritius	2008	max	-	Oct	lastSun	2:00s	1:00	S
-Rule Mauritius	2009	max	-	Mar	lastSun	2:00s	0	-
+Rule Mauritius	2008	only	-	Oct	lastSun	2:00	1:00	S
+Rule Mauritius	2009	only	-	Mar	lastSun	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Mauritius	3:50:00 -	LMT	1907		# Port Louis
 			4:00 Mauritius	MU%sT	# Mauritius Time

Modified: stable/6/share/zoneinfo/asia
==============================================================================
--- stable/6/share/zoneinfo/asia	Thu Aug 27 12:27:06 2009	(r196583)
+++ stable/6/share/zoneinfo/asia	Thu Aug 27 12:27:19 2009	(r196584)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.35
+# @(#)asia	8.36
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,6 +172,12 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
+# From Arthur David Olson (2009-07-11):
+# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
+# can appear in the Dhaka binary file and for the benefit of old glibc
+# reimplementations of the time zone software that mishandle permanent DST.
+# A change will be required once the end date is known.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
@@ -180,7 +186,8 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST
+			6:00	1:00	BDST	2010
+			6:00	-	BDT
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]

Modified: stable/6/share/zoneinfo/europe
==============================================================================
--- stable/6/share/zoneinfo/europe	Thu Aug 27 12:27:06 2009	(r196583)
+++ stable/6/share/zoneinfo/europe	Thu Aug 27 12:27:19 2009	(r196584)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.21
+# @(#)europe	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -459,7 +459,7 @@ Rule	EU	1979	1995	-	Sep	lastSun	 1:00u	0
 Rule	EU	1981	max	-	Mar	lastSun	 1:00u	1:00	S
 Rule	EU	1996	max	-	Oct	lastSun	 1:00u	0	-
 # The most recent directive covers the years starting in 2002.  See:
-# 
+# 
 # Directive 2000/84/EC of the European Parliament and of the Council
 # of 19 January 2001 on summer-time arrangements.
 # 

Modified: stable/6/share/zoneinfo/leapseconds
==============================================================================
--- stable/6/share/zoneinfo/leapseconds	Thu Aug 27 12:27:06 2009	(r196583)
+++ stable/6/share/zoneinfo/leapseconds	Thu Aug 27 12:27:19 2009	(r196584)
@@ -1,5 +1,5 @@
 # 
-# @(#)leapseconds	8.8
+# @(#)leapseconds	8.9
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -58,29 +58,30 @@ Leap	2008	Dec	31	23:59:60	+	S
 # 61, Av. de l'Observatoire 75014 PARIS (France)
 # Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
-# e-mail    : services.iers@obspm.fr
-# http://hpiers.obspm.fr/eop-pc
+# Internet  : services.iers@obspm.fr
 #
-# Paris, 15 January 2009
+# Paris, 4 July 2009
 #
-# Bulletin C 37
+# Bulletin C 38
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# NO positive leap second will be introduced at the end of June 2009.
-# The difference between Coordinated Universal Time UTC and the 
-# International Atomic Time TAI is :             
-#                
-#     from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
+# INFORMATION ON UTC - TAI
+#
+# NO positive leap second will be introduced at the end of December 2009.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is :		
+#
+# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
+# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC, or to confirm that there
 # will be no time step at the next possible date.
 #
 # Daniel GAMBIS
-# Head		
+# Director			
 # Earth Orientation Center of IERS
 # Observatoire de Paris, France

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 12:29:23 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 63640106568C;
	Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 47FBC8FC46;
	Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCTNHJ096042;
	Thu, 27 Aug 2009 12:29:23 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCTNGV096036;
	Thu, 27 Aug 2009 12:29:23 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271229.n7RCTNGV096036@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196585 - stable/6/share/zoneinfo
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:29:23 -0000

Author: edwin
Date: Thu Aug 27 12:29:22 2009
New Revision: 196585
URL: http://svn.freebsd.org/changeset/base/196585

Log:
  MFC of r196582: Import of tzdata2009l
  
  - Egypt will go to Wintertime on 21 August 2009
  - Heads up for a possible DST in Samoa

Modified:
  stable/6/share/zoneinfo/   (props changed)
  stable/6/share/zoneinfo/africa
  stable/6/share/zoneinfo/australasia

Modified: stable/6/share/zoneinfo/africa
==============================================================================
--- stable/6/share/zoneinfo/africa	Thu Aug 27 12:27:19 2009	(r196584)
+++ stable/6/share/zoneinfo/africa	Thu Aug 27 12:29:22 2009	(r196585)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.22
+# @(#)africa	8.23
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -276,8 +276,27 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # In 2009 (and for the next several years), Ramadan ends before the fourth
 # Thursday in September; Egypt is expected to revert to the last Thursday
 # in September.
+
+# From Steffen Thorsen (2009-08-11):
+# We have been able to confirm the August change with the Egyptian Cabinet 
+# Information and Decision Support Center:
+# 
+# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# 
+# 
+# The Middle East News Agency
+# 
+# http://www.mena.org.eg/index.aspx
+# 
+# also reports "Egypt starts winter time on August 21"
+# today in article numbered "71, 11/08/2009 12:25 GMT." 
+# Only the title above is available without a subscription to their service,
+# and can be found by searching for "winter" in their search engine
+# (at least today).
+
 Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
-Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
+Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct

Modified: stable/6/share/zoneinfo/australasia
==============================================================================
--- stable/6/share/zoneinfo/australasia	Thu Aug 27 12:27:19 2009	(r196584)
+++ stable/6/share/zoneinfo/australasia	Thu Aug 27 12:29:22 2009	(r196585)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.11
+# @(#)australasia	8.12
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -427,6 +427,22 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 			-11:00	-	SST			# S=Samoa
 
 # Samoa
+
+# From Alexander Krivenyshev (2008-12-06):
+# The Samoa government (Western Samoa) may implement DST on the first Sunday of 
+# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28, 
+# 2010). 
+# 
+# "Selected Committee reports to Cabinet on Daylight Saving Time",
+# Government of Samoa:
+# 
+# http://www.govt.ws/pr_article.cfm?pr_id=560
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 12:29:24 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 167D41065698;
	Thu, 27 Aug 2009 12:29:24 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F04A68FC41;
	Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCTNuq096073;
	Thu, 27 Aug 2009 12:29:23 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCTNOv096070;
	Thu, 27 Aug 2009 12:29:23 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271229.n7RCTNOv096070@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196586 - stable/7/share/zoneinfo
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:29:24 -0000

Author: edwin
Date: Thu Aug 27 12:29:23 2009
New Revision: 196586
URL: http://svn.freebsd.org/changeset/base/196586

Log:
  MFC of r196582: Import of tzdata2009l
  
  - Egypt will go to Wintertime on 21 August 2009
  - Heads up for a possible DST in Samoa

Modified:
  stable/7/share/zoneinfo/   (props changed)
  stable/7/share/zoneinfo/africa
  stable/7/share/zoneinfo/australasia

Modified: stable/7/share/zoneinfo/africa
==============================================================================
--- stable/7/share/zoneinfo/africa	Thu Aug 27 12:29:22 2009	(r196585)
+++ stable/7/share/zoneinfo/africa	Thu Aug 27 12:29:23 2009	(r196586)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.22
+# @(#)africa	8.23
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -276,8 +276,27 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # In 2009 (and for the next several years), Ramadan ends before the fourth
 # Thursday in September; Egypt is expected to revert to the last Thursday
 # in September.
+
+# From Steffen Thorsen (2009-08-11):
+# We have been able to confirm the August change with the Egyptian Cabinet 
+# Information and Decision Support Center:
+# 
+# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# 
+# 
+# The Middle East News Agency
+# 
+# http://www.mena.org.eg/index.aspx
+# 
+# also reports "Egypt starts winter time on August 21"
+# today in article numbered "71, 11/08/2009 12:25 GMT." 
+# Only the title above is available without a subscription to their service,
+# and can be found by searching for "winter" in their search engine
+# (at least today).
+
 Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
-Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
+Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct

Modified: stable/7/share/zoneinfo/australasia
==============================================================================
--- stable/7/share/zoneinfo/australasia	Thu Aug 27 12:29:22 2009	(r196585)
+++ stable/7/share/zoneinfo/australasia	Thu Aug 27 12:29:23 2009	(r196586)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.11
+# @(#)australasia	8.12
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -427,6 +427,22 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 			-11:00	-	SST			# S=Samoa
 
 # Samoa
+
+# From Alexander Krivenyshev (2008-12-06):
+# The Samoa government (Western Samoa) may implement DST on the first Sunday of 
+# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28, 
+# 2010). 
+# 
+# "Selected Committee reports to Cabinet on Daylight Saving Time",
+# Government of Samoa:
+# 
+# http://www.govt.ws/pr_article.cfm?pr_id=560
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 15:48:59 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51878106564A;
	Thu, 27 Aug 2009 15:48:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 39AFC8FC2E;
	Thu, 27 Aug 2009 15:48:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RFmxud000461;
	Thu, 27 Aug 2009 15:48:59 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RFmxVj000457;
	Thu, 27 Aug 2009 15:48:59 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271548.n7RFmxVj000457@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 15:48:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196590 - in stable/7/sys: . contrib/pf vm
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 15:48:59 -0000

Author: jhb
Date: Thu Aug 27 15:48:58 2009
New Revision: 196590
URL: http://svn.freebsd.org/changeset/base/196590

Log:
  MFC 181019, 183474, 191277, and 191626:
  - Move the code for doing out-of-memory grass from vm_pageout_scan()
    into the separate function vm_pageout_oom(). Supply a parameter for
    vm_pageout_oom() describing a reason for the call.
  - Call vm_pageout_oom() from the swp_pager_meta_build() when swap zone
    is exhausted.
  - In both pageout oom handler and vm_daemon, acquire the reference to
    the vmspace of the examined process instead of directly accessing its
    vmspace, that may change. Also, as an optimization, check for P_INEXEC
    flag before examining the process.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/vm/swap_pager.c
  stable/7/sys/vm/vm_pageout.c
  stable/7/sys/vm/vm_pageout.h

Modified: stable/7/sys/vm/swap_pager.c
==============================================================================
--- stable/7/sys/vm/swap_pager.c	Thu Aug 27 15:24:26 2009	(r196589)
+++ stable/7/sys/vm/swap_pager.c	Thu Aug 27 15:48:58 2009	(r196590)
@@ -1711,9 +1711,12 @@ retry:
 		if (swap == NULL) {
 			mtx_unlock(&swhash_mtx);
 			VM_OBJECT_UNLOCK(object);
-			if (uma_zone_exhausted(swap_zone))
+			if (uma_zone_exhausted(swap_zone)) {
 				printf("swap zone exhausted, increase kern.maxswzone\n");
-			VM_WAIT;
+				vm_pageout_oom(VM_OOM_SWAPZ);
+				pause("swzonex", 10);
+			} else
+				VM_WAIT;
 			VM_OBJECT_LOCK(object);
 			goto retry;
 		}

Modified: stable/7/sys/vm/vm_pageout.c
==============================================================================
--- stable/7/sys/vm/vm_pageout.c	Thu Aug 27 15:24:26 2009	(r196589)
+++ stable/7/sys/vm/vm_pageout.c	Thu Aug 27 15:48:58 2009	(r196590)
@@ -681,9 +681,6 @@ vm_pageout_scan(int pass)
 	struct vm_page marker;
 	int page_shortage, maxscan, pcount;
 	int addl_page_shortage, addl_page_shortage_init;
-	struct proc *p, *bigproc;
-	struct thread *td;
-	vm_offset_t size, bigsize;
 	vm_object_t object;
 	int actcount;
 	int vnodes_skipped = 0;
@@ -1173,7 +1170,23 @@ unlock_and_continue:
 	 * doing this on the first pass in order to give ourselves a
 	 * chance to flush out dirty vnode-backed pages and to allow
 	 * active pages to be moved to the inactive queue and reclaimed.
-	 *
+	 */
+	if (pass != 0 &&
+	    ((swap_pager_avail < 64 && vm_page_count_min()) ||
+	     (swap_pager_full && vm_paging_target() > 0)))
+		vm_pageout_oom(VM_OOM_MEM);
+}
+
+
+void
+vm_pageout_oom(int shortage)
+{
+	struct proc *p, *bigproc;
+	vm_offset_t size, bigsize;
+	struct thread *td;
+	struct vmspace *vm;
+
+	/*
 	 * We keep the process bigproc locked once we find it to keep anyone
 	 * from messing with it; however, there is a possibility of
 	 * deadlock if process B is bigproc and one of it's child processes
@@ -1181,79 +1194,83 @@ unlock_and_continue:
 	 * lock while walking this list.  To avoid this, we don't block on
 	 * the process lock but just skip a process if it is already locked.
 	 */
-	if (pass != 0 &&
-	    ((swap_pager_avail < 64 && vm_page_count_min()) ||
-	     (swap_pager_full && vm_paging_target() > 0))) {
-		bigproc = NULL;
-		bigsize = 0;
-		sx_slock(&allproc_lock);
-		FOREACH_PROC_IN_SYSTEM(p) {
-			int breakout;
+	bigproc = NULL;
+	bigsize = 0;
+	sx_slock(&allproc_lock);
+	FOREACH_PROC_IN_SYSTEM(p) {
+		int breakout;
 
-			if (PROC_TRYLOCK(p) == 0)
-				continue;
-			/*
-			 * If this is a system or protected process, skip it.
-			 */
-			if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) ||
-			    (p->p_flag & P_PROTECTED) ||
-			    ((p->p_pid < 48) && (swap_pager_avail != 0))) {
-				PROC_UNLOCK(p);
-				continue;
-			}
-			/*
-			 * If the process is in a non-running type state,
-			 * don't touch it.  Check all the threads individually.
-			 */
-			PROC_SLOCK(p);
-			breakout = 0;
-			FOREACH_THREAD_IN_PROC(p, td) {
-				thread_lock(td);
-				if (!TD_ON_RUNQ(td) &&
-				    !TD_IS_RUNNING(td) &&
-				    !TD_IS_SLEEPING(td)) {
-					thread_unlock(td);
-					breakout = 1;
-					break;
-				}
+		if (PROC_TRYLOCK(p) == 0)
+			continue;
+		/*
+		 * If this is a system or protected process, skip it.
+		 */
+		if ((p->p_flag & (P_INEXEC | P_PROTECTED | P_SYSTEM)) ||
+		    (p->p_pid == 1) ||
+		    ((p->p_pid < 48) && (swap_pager_avail != 0))) {
+			PROC_UNLOCK(p);
+			continue;
+		}
+		/*
+		 * If the process is in a non-running type state,
+		 * don't touch it.  Check all the threads individually.
+		 */
+		PROC_SLOCK(p);
+		breakout = 0;
+		FOREACH_THREAD_IN_PROC(p, td) {
+			thread_lock(td);
+			if (!TD_ON_RUNQ(td) &&
+			    !TD_IS_RUNNING(td) &&
+			    !TD_IS_SLEEPING(td)) {
 				thread_unlock(td);
+				breakout = 1;
+				break;
 			}
-			PROC_SUNLOCK(p);
-			if (breakout) {
-				PROC_UNLOCK(p);
-				continue;
-			}
-			/*
-			 * get the process size
-			 */
-			if (!vm_map_trylock_read(&p->p_vmspace->vm_map)) {
-				PROC_UNLOCK(p);
-				continue;
-			}
-			size = vmspace_swap_count(p->p_vmspace);
-			vm_map_unlock_read(&p->p_vmspace->vm_map);
-			size += vmspace_resident_count(p->p_vmspace);
-			/*
-			 * if the this process is bigger than the biggest one
-			 * remember it.
-			 */
-			if (size > bigsize) {
-				if (bigproc != NULL)
-					PROC_UNLOCK(bigproc);
-				bigproc = p;
-				bigsize = size;
-			} else
-				PROC_UNLOCK(p);
+			thread_unlock(td);
 		}
-		sx_sunlock(&allproc_lock);
-		if (bigproc != NULL) {
-			killproc(bigproc, "out of swap space");
-			PROC_SLOCK(bigproc);
-			sched_nice(bigproc, PRIO_MIN);
-			PROC_SUNLOCK(bigproc);
-			PROC_UNLOCK(bigproc);
-			wakeup(&cnt.v_free_count);
+		PROC_SUNLOCK(p);
+		if (breakout) {
+			PROC_UNLOCK(p);
+			continue;
+		}
+		/*
+		 * get the process size
+		 */
+		vm = vmspace_acquire_ref(p);
+		if (vm == NULL) {
+			PROC_UNLOCK(p);
+			continue;
 		}
+		if (!vm_map_trylock_read(&vm->vm_map)) {
+			vmspace_free(vm);
+			PROC_UNLOCK(p);
+			continue;
+		}
+		size = vmspace_swap_count(vm);
+		vm_map_unlock_read(&vm->vm_map);
+		if (shortage == VM_OOM_MEM)
+			size += vmspace_resident_count(vm);
+		vmspace_free(vm);
+		/*
+		 * if the this process is bigger than the biggest one
+		 * remember it.
+		 */
+		if (size > bigsize) {
+			if (bigproc != NULL)
+				PROC_UNLOCK(bigproc);
+			bigproc = p;
+			bigsize = size;
+		} else
+			PROC_UNLOCK(p);
+	}
+	sx_sunlock(&allproc_lock);
+	if (bigproc != NULL) {
+		killproc(bigproc, "out of swap space");
+		PROC_SLOCK(bigproc);
+		sched_nice(bigproc, PRIO_MIN);
+		PROC_SUNLOCK(bigproc);
+		PROC_UNLOCK(bigproc);
+		wakeup(&cnt.v_free_count);
 	}
 }
 
@@ -1528,6 +1545,7 @@ vm_daemon()
 	struct rlimit rsslim;
 	struct proc *p;
 	struct thread *td;
+	struct vmspace *vm;
 	int breakout, swapout_flags;
 
 	while (TRUE) {
@@ -1552,7 +1570,7 @@ vm_daemon()
 			 * looked at this process, skip it.
 			 */
 			PROC_LOCK(p);
-			if (p->p_flag & (P_SYSTEM | P_WEXIT)) {
+			if (p->p_flag & (P_INEXEC | P_SYSTEM | P_WEXIT)) {
 				PROC_UNLOCK(p);
 				continue;
 			}
@@ -1592,13 +1610,17 @@ vm_daemon()
 			 */
 			if ((p->p_flag & P_INMEM) == 0)
 				limit = 0;	/* XXX */
+			vm = vmspace_acquire_ref(p);
 			PROC_UNLOCK(p);
+			if (vm == NULL)
+				continue;
 
-			size = vmspace_resident_count(p->p_vmspace);
+			size = vmspace_resident_count(vm);
 			if (limit >= 0 && size >= limit) {
 				vm_pageout_map_deactivate_pages(
-				    &p->p_vmspace->vm_map, limit);
+				    &vm->vm_map, limit);
 			}
+			vmspace_free(vm);
 		}
 		sx_sunlock(&allproc_lock);
 	}

Modified: stable/7/sys/vm/vm_pageout.h
==============================================================================
--- stable/7/sys/vm/vm_pageout.h	Thu Aug 27 15:24:26 2009	(r196589)
+++ stable/7/sys/vm/vm_pageout.h	Thu Aug 27 15:48:58 2009	(r196590)
@@ -83,6 +83,9 @@ extern int vm_pageout_page_count;
 #define VM_SWAP_NORMAL 1
 #define VM_SWAP_IDLE 2
 
+#define	VM_OOM_MEM	1
+#define	VM_OOM_SWAPZ	2
+
 /*
  *	Exported routines.
  */
@@ -100,5 +103,6 @@ extern void vm_waitpfault(void);
 #ifdef _KERNEL
 boolean_t vm_pageout_fallback_object_lock(vm_page_t, vm_page_t *);
 int vm_pageout_flush(vm_page_t *, int, int);
+void vm_pageout_oom(int shortage);
 #endif
 #endif	/* _VM_VM_PAGEOUT_H_ */

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 16:15:32 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BDCF5106568D;
	Thu, 27 Aug 2009 16:15:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ACA0B8FC36;
	Thu, 27 Aug 2009 16:15:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RGFW7C001121;
	Thu, 27 Aug 2009 16:15:32 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RGFW8g001119;
	Thu, 27 Aug 2009 16:15:32 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271615.n7RGFW8g001119@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 16:15:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196591 - stable/7/contrib/top
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 16:15:32 -0000

Author: jhb
Date: Thu Aug 27 16:15:32 2009
New Revision: 196591
URL: http://svn.freebsd.org/changeset/base/196591

Log:
  MFC 196382:
  Explicitly line up the CPU state labels with the calculated starting column
  that takes into account the width of the largest CPU ID.

Modified:
  stable/7/contrib/top/   (props changed)
  stable/7/contrib/top/display.c

Modified: stable/7/contrib/top/display.c
==============================================================================
--- stable/7/contrib/top/display.c	Thu Aug 27 15:48:58 2009	(r196590)
+++ stable/7/contrib/top/display.c	Thu Aug 27 16:15:32 2009	(r196591)
@@ -452,6 +452,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
     lastline++;
 
     /* now walk thru the names and print the line */
+    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')
@@ -543,6 +544,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
 	printf("\nCPU %d: ", cpu);
     lastline++;
 
+    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 16:34:04 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB74F106568C;
	Thu, 27 Aug 2009 16:34:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D820A8FC3A;
	Thu, 27 Aug 2009 16:34:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RGY4Rn001532;
	Thu, 27 Aug 2009 16:34:04 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RGY4FV001529;
	Thu, 27 Aug 2009 16:34:04 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271634.n7RGY4FV001529@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 16:34:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196593 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/acpica dev/xen/xenpci isa
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 16:34:05 -0000

Author: jhb
Date: Thu Aug 27 16:34:04 2009
New Revision: 196593
URL: http://svn.freebsd.org/changeset/base/196593

Log:
  MFC 196520:
  Tweak the way that the ACPI and ISA bus drivers match hint devices to
  BIOS-enumerated devices:
  - Assume a device is a match if the memory and I/O ports match even if the
    IRQ or DRQ is wrong or missing.  Some BIOSes don't include an IRQ for
    the atrtc device for example.
  - Add a hack to better match floppy controller devices.  Many BIOSes do not
    include the starting port of the floppy controller listed in the hints
    (0x3f0) in the resources for the device.  So far, however, all the BIOS
    variations encountered do include the 'port + 2' resource (0x3f2), so
    adjust the matching for "fdc" devices to look for 'port + 2'.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/acpica/acpi.c
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/isa/isahint.c

Modified: stable/8/sys/dev/acpica/acpi.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi.c	Thu Aug 27 16:15:51 2009	(r196592)
+++ stable/8/sys/dev/acpica/acpi.c	Thu Aug 27 16:34:04 2009	(r196593)
@@ -1014,14 +1014,27 @@ acpi_hint_device_unit(device_t acdev, de
 	    continue;
 
 	/*
-	 * Check for matching resources.  We must have at least one,
-	 * and all resources specified have to match.
+	 * Check for matching resources.  We must have at least one match.
+	 * Since I/O and memory resources cannot be shared, if we get a
+	 * match on either of those, ignore any mismatches in IRQs or DRQs.
 	 *
 	 * XXX: We may want to revisit this to be more lenient and wire
 	 * as long as it gets one match.
 	 */
 	matches = 0;
 	if (resource_long_value(name, unit, "port", &value) == 0) {
+	    /*
+	     * Floppy drive controllers are notorious for having a
+	     * wide variety of resources not all of which include the
+	     * first port that is specified by the hint (typically
+	     * 0x3f0) (see the comment above fdc_isa_alloc_resources()
+	     * in fdc_isa.c).  However, they do all seem to include
+	     * port + 2 (e.g. 0x3f2) so for a floppy device, look for
+	     * 'value + 2' in the port resources instead of the hint
+	     * value.
+	     */
+	    if (strcmp(name, "fdc") == 0)
+		value += 2;
 	    if (acpi_match_resource_hint(child, SYS_RES_IOPORT, value))
 		matches++;
 	    else
@@ -1033,6 +1046,8 @@ acpi_hint_device_unit(device_t acdev, de
 	    else
 		continue;
 	}
+	if (matches > 0)
+	    goto matched;
 	if (resource_long_value(name, unit, "irq", &value) == 0) {
 	    if (acpi_match_resource_hint(child, SYS_RES_IRQ, value))
 		matches++;
@@ -1046,6 +1061,7 @@ acpi_hint_device_unit(device_t acdev, de
 		continue;
 	}
 
+    matched:
 	if (matches > 0) {
 	    /* We have a winner! */
 	    *unitp = unit;

Modified: stable/8/sys/isa/isahint.c
==============================================================================
--- stable/8/sys/isa/isahint.c	Thu Aug 27 16:15:51 2009	(r196592)
+++ stable/8/sys/isa/isahint.c	Thu Aug 27 16:34:04 2009	(r196593)
@@ -118,14 +118,30 @@ isa_hint_device_unit(device_t bus, devic
 			continue;
 
 		/*
-		 * Check for matching resources.  We must have at least one,
-		 * and all resources specified have to match.
+		 * Check for matching resources.  We must have at
+		 * least one match.  Since I/O and memory resources
+		 * cannot be shared, if we get a match on either of
+		 * those, ignore any mismatches in IRQs or DRQs.
 		 *
-		 * XXX: We may want to revisit this to be more lenient and wire
-		 * as long as it gets one match.
+		 * XXX: We may want to revisit this to be more lenient
+		 * and wire as long as it gets one match.
 		 */
 		matches = 0;
 		if (resource_long_value(name, unit, "port", &value) == 0) {
+			/*
+			 * Floppy drive controllers are notorious for
+			 * having a wide variety of resources not all
+			 * of which include the first port that is
+			 * specified by the hint (typically 0x3f0)
+			 * (see the comment above
+			 * fdc_isa_alloc_resources() in fdc_isa.c).
+			 * However, they do all seem to include port +
+			 * 2 (e.g. 0x3f2) so for a floppy device, look
+			 * for 'value + 2' in the port resources
+			 * instead of the hint value.
+			 */
+			if (strcmp(name, "fdc") == 0)
+				value += 2;
 			if (isa_match_resource_hint(child, SYS_RES_IOPORT,
 			    value))
 				matches++;
@@ -139,6 +155,8 @@ isa_hint_device_unit(device_t bus, devic
 			else
 				continue;
 		}
+		if (matches > 0)
+			goto matched;
 		if (resource_long_value(name, unit, "irq", &value) == 0) {
 			if (isa_match_resource_hint(child, SYS_RES_IRQ, value))
 				matches++;
@@ -152,6 +170,7 @@ isa_hint_device_unit(device_t bus, devic
 				continue;
 		}
 
+	matched:
 		if (matches > 0) {
 			/* We have a winner! */
 			*unitp = unit;

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 17:16:24 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51D87106568D;
	Thu, 27 Aug 2009 17:16:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 36E798FC4D;
	Thu, 27 Aug 2009 17:16:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHGOS7002503;
	Thu, 27 Aug 2009 17:16:24 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHGOXm002500;
	Thu, 27 Aug 2009 17:16:24 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271716.n7RHGOXm002500@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:16:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196594 - in stable/8/release: . doc scripts
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:16:24 -0000

Author: jhb
Date: Thu Aug 27 17:16:23 2009
New Revision: 196594
URL: http://svn.freebsd.org/changeset/base/196594

Log:
  MFC 196521:
  Fix a few issues with the lib32 dist so that it includes ldd32.
  - Use a better find invocation to purge empty directories from all the dist
    trees during a release build.  The previous version did not purge
    directories whose contents were all empty directories.
  - Explicitly blacklist a few files from the lib32 dist instead of using a
    whitelist.  A better longterm solution is to fix the few offenders to not
    install data files during a lib32 install.
  
  Approved by:	re (kib)

Modified:
  stable/8/release/   (props changed)
  stable/8/release/Makefile
  stable/8/release/doc/   (props changed)
  stable/8/release/scripts/lib32-make.sh

Modified: stable/8/release/Makefile
==============================================================================
--- stable/8/release/Makefile	Thu Aug 27 16:34:04 2009	(r196593)
+++ stable/8/release/Makefile	Thu Aug 27 17:16:23 2009	(r196594)
@@ -696,7 +696,7 @@ release.5:
 	# Remove all the directories we don't need.
 	-cd ${RD}/trees && \
 		(find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \
-		find ${OTHER_DISTS} -depth -type d -empty -print | xargs rmdir)
+		find ${OTHER_DISTS} -depth -type d -empty -delete)
 	touch ${.TARGET}
 
 #

Modified: stable/8/release/scripts/lib32-make.sh
==============================================================================
--- stable/8/release/scripts/lib32-make.sh	Thu Aug 27 16:34:04 2009	(r196593)
+++ stable/8/release/scripts/lib32-make.sh	Thu Aug 27 17:16:23 2009	(r196594)
@@ -5,4 +5,4 @@
 
 # Clean the dust.
 cd ${RD}/trees/lib32 && \
-    find . ! -path '*/libexec/*' ! -path '*/usr/lib32/*' -delete
+    find . '(' -path '*/usr/share/*' -or -path '*/usr/lib/*' ')' -delete

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 17:16:43 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4052B1065691;
	Thu, 27 Aug 2009 17:16:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2EECA8FC2F;
	Thu, 27 Aug 2009 17:16:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHGheu002544;
	Thu, 27 Aug 2009 17:16:43 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHGhme002541;
	Thu, 27 Aug 2009 17:16:43 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271716.n7RHGhme002541@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:16:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196595 - in stable/7/release: . scripts
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:16:43 -0000

Author: jhb
Date: Thu Aug 27 17:16:42 2009
New Revision: 196595
URL: http://svn.freebsd.org/changeset/base/196595

Log:
  MFC 196521:
  Fix a few issues with the lib32 dist so that it includes ldd32.
  - Use a better find invocation to purge empty directories from all the dist
    trees during a release build.  The previous version did not purge
    directories whose contents were all empty directories.
  - Explicitly blacklist a few files from the lib32 dist instead of using a
    whitelist.  A better longterm solution is to fix the few offenders to not
    install data files during a lib32 install.

Modified:
  stable/7/release/   (props changed)
  stable/7/release/Makefile
  stable/7/release/scripts/lib32-make.sh
  stable/7/release/scripts/src-install.sh   (props changed)

Modified: stable/7/release/Makefile
==============================================================================
--- stable/7/release/Makefile	Thu Aug 27 17:16:23 2009	(r196594)
+++ stable/7/release/Makefile	Thu Aug 27 17:16:42 2009	(r196595)
@@ -653,7 +653,7 @@ release.5:
 	# Remove all the directories we don't need.
 	-cd ${RD}/trees && \
 		(find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \
-		find ${OTHER_DISTS} -depth -type d -empty -print | xargs rmdir)
+		find ${OTHER_DISTS} -depth -type d -empty -delete)
 	touch ${.TARGET}
 
 #

Modified: stable/7/release/scripts/lib32-make.sh
==============================================================================
--- stable/7/release/scripts/lib32-make.sh	Thu Aug 27 17:16:23 2009	(r196594)
+++ stable/7/release/scripts/lib32-make.sh	Thu Aug 27 17:16:42 2009	(r196595)
@@ -5,4 +5,4 @@
 
 # Clean the dust.
 cd ${RD}/trees/lib32 && \
-    find . ! -path '*/libexec/*' ! -path '*/usr/lib32/*' -delete
+    find . '(' -path '*/usr/share/*' -or -path '*/usr/lib/*' ')' -delete

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 17:24:05 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D8001065691;
	Thu, 27 Aug 2009 17:24:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4363D8FC3E;
	Thu, 27 Aug 2009 17:24:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHO5gA002764;
	Thu, 27 Aug 2009 17:24:05 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHO56p002763;
	Thu, 27 Aug 2009 17:24:05 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271724.n7RHO56p002763@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:24:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196596 - in stable/7/release: . scripts
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:24:05 -0000

Author: jhb
Date: Thu Aug 27 17:24:05 2009
New Revision: 196596
URL: http://svn.freebsd.org/changeset/base/196596

Log:
  Move mergeinfo for 180008 up to src/release.

Modified:
  stable/7/release/   (props changed)
  stable/7/release/scripts/src-install.sh   (props changed)

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 17:25:59 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 28B1710656A4;
	Thu, 27 Aug 2009 17:25:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 179DA8FC42;
	Thu, 27 Aug 2009 17:25:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHPwTA002889;
	Thu, 27 Aug 2009 17:25:58 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHPwdM002887;
	Thu, 27 Aug 2009 17:25:58 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271725.n7RHPwdM002887@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:25:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196597 - in stable/8/release: . doc
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:25:59 -0000

Author: jhb
Date: Thu Aug 27 17:25:58 2009
New Revision: 196597
URL: http://svn.freebsd.org/changeset/base/196597

Log:
  MFC 196522:
  Invoke the recently added mm-mtree.sh release script to store a pre-built
  mergemaster mtree database in the 'base' dist.
  
  Approved by:	re (kib)

Modified:
  stable/8/release/   (props changed)
  stable/8/release/Makefile
  stable/8/release/doc/   (props changed)

Modified: stable/8/release/Makefile
==============================================================================
--- stable/8/release/Makefile	Thu Aug 27 17:24:05 2009	(r196596)
+++ stable/8/release/Makefile	Thu Aug 27 17:25:58 2009	(r196597)
@@ -646,6 +646,7 @@ release.2:
 	cd ${.CURDIR}/.. && ${CROSSMAKE} distrib-dirs DESTDIR=${RD}/trees/base
 	cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \
 	    DISTDIR=${RD}/trees
+	sh ${.CURDIR}/scripts/mm-mtree.sh -F "${CROSSENV}" -D "${RD}/trees/base"
 	touch ${.TARGET}
 
 # Make and install the generic kernel(s).

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 17:26:09 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C9A081065741;
	Thu, 27 Aug 2009 17:26:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B8D8C8FC2F;
	Thu, 27 Aug 2009 17:26:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHQ9lV002937;
	Thu, 27 Aug 2009 17:26:09 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHQ9Ol002935;
	Thu, 27 Aug 2009 17:26:09 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271726.n7RHQ9Ol002935@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:26:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196598 - stable/7/release
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:26:09 -0000

Author: jhb
Date: Thu Aug 27 17:26:09 2009
New Revision: 196598
URL: http://svn.freebsd.org/changeset/base/196598

Log:
  MFC 196522:
  Invoke the recently added mm-mtree.sh release script to store a pre-built
  mergemaster mtree database in the 'base' dist.

Modified:
  stable/7/release/   (props changed)
  stable/7/release/Makefile

Modified: stable/7/release/Makefile
==============================================================================
--- stable/7/release/Makefile	Thu Aug 27 17:25:58 2009	(r196597)
+++ stable/7/release/Makefile	Thu Aug 27 17:26:09 2009	(r196598)
@@ -603,6 +603,7 @@ release.2:
 	cd ${.CURDIR}/.. && ${CROSSMAKE} distrib-dirs DESTDIR=${RD}/trees/base
 	cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \
 	    DISTDIR=${RD}/trees
+	sh ${.CURDIR}/scripts/mm-mtree.sh -F "${CROSSENV}" -D "${RD}/trees/base"
 	touch ${.TARGET}
 
 # Make and install the generic kernel(s).

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 17:34:14 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05C9D106568D;
	Thu, 27 Aug 2009 17:34:14 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E4FAA8FC3F;
	Thu, 27 Aug 2009 17:34:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHYDoO003228;
	Thu, 27 Aug 2009 17:34:13 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHYDRe003218;
	Thu, 27 Aug 2009 17:34:13 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200908271734.n7RHYDRe003218@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Thu, 27 Aug 2009 17:34:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196601 - in stable/8/sys: . amd64/amd64
	amd64/include/xen amd64/linux32 cddl/contrib/opensolaris
	compat/ia32 contrib/dev/acpica contrib/pf dev/xen/xenpci
	i386/i386 i386/linux kern sys
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:34:14 -0000

Author: bz
Date: Thu Aug 27 17:34:13 2009
New Revision: 196601
URL: http://svn.freebsd.org/changeset/base/196601

Log:
  MFC r196512:
  
    Fix handling of .note.ABI-tag section for GNU systems [1].
    Handle GNU/Linux according to LSB Core Specification 4.0,
    Chapter 11. Object Format, 11.8. ABI note tag.
  
    Also check the first word of desc, not only name, according to
    glibc abi-tags specification to distinguish between Linux and
    kFreeBSD.
  
    Add explicit handling for Debian GNU/kFreeBSD, which runs
    on our kernels as well [2].
  
    In {amd64,i386}/trap.c, when checking osrel of the current process,
    also check the ABI to not change the signal behaviour for Linux
    binary processes, now that we save an osrel version for all three
    from the lists above in struct proc [2].
  
    These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
    and Linux binaries on the same machine again for at least i386 and
    amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).
  
  PR:		kern/135468
  Submitted by:	dchagin [1] (initial patch)
  Suggested by:	kib [2]
  Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
  Reviewed by:	kib
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/amd64/elf_machdep.c
  stable/8/sys/amd64/amd64/trap.c
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/amd64/linux32/linux32_sysvec.c
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/compat/ia32/ia32_sysvec.c
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/i386/i386/elf_machdep.c
  stable/8/sys/i386/i386/trap.c
  stable/8/sys/i386/linux/linux_sysvec.c
  stable/8/sys/kern/imgact_elf.c
  stable/8/sys/sys/imgact_elf.h

Modified: stable/8/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/elf_machdep.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/amd64/amd64/elf_machdep.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -108,6 +109,22 @@ SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_AN
 	(sysinit_cfunc_t) elf64_insert_brand_entry,
 	&freebsd_brand_oinfo);
 
+static Elf64_Brandinfo kfreebsd_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_X86_64,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld-kfreebsd-x86-64.so.1",
+	.sysvec		= &elf64_freebsd_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &elf64_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf64_insert_brand_entry,
+	&kfreebsd_brand_info);
+
 
 void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/8/sys/amd64/amd64/trap.c
==============================================================================
--- stable/8/sys/amd64/amd64/trap.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/amd64/amd64/trap.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -409,7 +409,9 @@ trap(struct trapframe *frame)
 					 * This check also covers the images
 					 * without the ABI-tag ELF note.
 					 */
-					if (p->p_osrel >= 700004) {
+					if (SV_CURPROC_ABI() ==
+					    SV_ABI_FREEBSD &&
+					    p->p_osrel >= 700004) {
 						i = SIGSEGV;
 						ucode = SEGV_ACCERR;
 					} else {

Modified: stable/8/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/8/sys/amd64/linux32/linux32_sysvec.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/amd64/linux32/linux32_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -127,6 +127,7 @@ static void     linux_sendsig(sig_t catc
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 static void	linux32_fixlimit(struct rlimit *rl, int which);
+static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
@@ -1066,14 +1067,38 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_flags	= SV_ABI_LINUX | SV_ILP32 | SV_IA32
 };
 
-static char GNULINUX_ABI_VENDOR[] = "GNU";
+static char GNU_ABI_VENDOR[] = "GNU";
+static int GNULINUX_ABI_DESC = 0;
+
+static boolean_t
+linux32_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNULINUX_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * For linux we encode osrel as follows (see linux_mib.c):
+	 * VVVMMMIII (version, major, minor), see linux_mib.c.
+	 */
+	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
 
 static Elf_Brandnote linux32_brandnote = {
-	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
-	.hdr.n_descsz	= 16,
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
 	.hdr.n_type	= 1,
-	.vendor		= GNULINUX_ABI_VENDOR,
-	.flags		= 0
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= linux32_trans_osrel
 };
 
 static Elf32_Brandinfo linux_brand = {

Modified: stable/8/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- stable/8/sys/compat/ia32/ia32_sysvec.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/compat/ia32/ia32_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -172,6 +172,21 @@ SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY
 	(sysinit_cfunc_t) elf32_insert_brand_entry,
 	&ia32_brand_oinfo);
 
+static Elf32_Brandinfo kia32_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_386,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld.so.1",
+	.sysvec		= &ia32_freebsd_sysvec,
+	.brand_note	= &elf32_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf32_insert_brand_entry,
+	&kia32_brand_info);
+
 
 void
 elf32_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/8/sys/i386/i386/elf_machdep.c
==============================================================================
--- stable/8/sys/i386/i386/elf_machdep.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/i386/i386/elf_machdep.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -108,6 +108,22 @@ SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_AN
 	(sysinit_cfunc_t) elf32_insert_brand_entry,
 	&freebsd_brand_oinfo);
 
+static Elf32_Brandinfo kfreebsd_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_386,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld.so.1",
+	.sysvec		= &elf32_freebsd_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &elf32_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf32_insert_brand_entry,
+	&kfreebsd_brand_info);
+
 
 void
 elf32_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/8/sys/i386/i386/trap.c
==============================================================================
--- stable/8/sys/i386/i386/trap.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/i386/i386/trap.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -423,7 +423,9 @@ trap(struct trapframe *frame)
 					 * This check also covers the images
 					 * without the ABI-tag ELF note.
 					 */
-					if (p->p_osrel >= 700004) {
+					if (SV_CURPROC_ABI() ==
+					    SV_ABI_FREEBSD &&
+					    p->p_osrel >= 700004) {
 						i = SIGSEGV;
 						ucode = SEGV_ACCERR;
 					} else {

Modified: stable/8/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/8/sys/i386/linux/linux_sysvec.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/i386/linux/linux_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -108,6 +108,7 @@ static void     linux_sendsig(sig_t catc
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 static register_t *linux_copyout_strings(struct image_params *imgp);
+static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static int linux_szplatform;
 const char *linux_platform;
@@ -1027,14 +1028,38 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_flags	= SV_ABI_LINUX | SV_IA32 | SV_ILP32
 };
 
-static char GNULINUX_ABI_VENDOR[] = "GNU";
+static char GNU_ABI_VENDOR[] = "GNU";
+static int GNULINUX_ABI_DESC = 0;
+
+static boolean_t
+linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNULINUX_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * For linux we encode osrel as follows (see linux_mib.c):
+	 * VVVMMMIII (version, major, minor), see linux_mib.c.
+	 */
+	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
 
 static Elf_Brandnote linux_brandnote = {
-	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
-	.hdr.n_descsz	= 16,
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
 	.hdr.n_type	= 1,
-	.vendor		= GNULINUX_ABI_VENDOR,
-	.flags		= 0
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= linux_trans_osrel
 };
 
 static Elf32_Brandinfo linux_brand = {

Modified: stable/8/sys/kern/imgact_elf.c
==============================================================================
--- stable/8/sys/kern/imgact_elf.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/kern/imgact_elf.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -86,6 +86,9 @@ static int __elfN(load_section)(struct v
     vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
     vm_prot_t prot, size_t pagesize);
 static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
+static boolean_t __elfN(freebsd_trans_osrel)(const Elf_Note *note,
+    int32_t *osrel);
+static boolean_t kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static boolean_t __elfN(check_note)(struct image_params *imgp,
     Elf_Brandnote *checknote, int32_t *osrel);
 
@@ -116,9 +119,56 @@ Elf_Brandnote __elfN(freebsd_brandnote) 
 	.hdr.n_descsz	= sizeof(int32_t),
 	.hdr.n_type	= 1,
 	.vendor		= FREEBSD_ABI_VENDOR,
-	.flags		= BN_CAN_FETCH_OSREL
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= __elfN(freebsd_trans_osrel)
 };
 
+static boolean_t
+__elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel)
+{
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+	*osrel = *(const int32_t *)(p);
+
+	return (TRUE);
+}
+
+static const char GNU_ABI_VENDOR[] = "GNU";
+static int GNU_KFREEBSD_ABI_DESC = 3;
+
+Elf_Brandnote __elfN(kfreebsd_brandnote) = {
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
+	.hdr.n_type	= 1,
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= kfreebsd_trans_osrel
+};
+
+static boolean_t
+kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNU_KFREEBSD_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * Debian GNU/kFreeBSD embed the earliest compatible kernel version
+	 * (__FreeBSD_version: Rxx) in the LSB way.
+	 */
+	*osrel = desc[1] * 100000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
+
 int
 __elfN(insert_brand_entry)(Elf_Brandinfo *entry)
 {
@@ -1371,11 +1421,9 @@ __elfN(check_note)(struct image_params *
 		 * Fetch the osreldate for binary
 		 * from the ELF OSABI-note if necessary.
 		 */
-		if ((checknote->flags & BN_CAN_FETCH_OSREL) != 0 &&
-		    osrel != NULL)
-			*osrel = *(const int32_t *) (note_name +
-			    roundup2(checknote->hdr.n_namesz,
-			    sizeof(Elf32_Addr)));
+		if ((checknote->flags & BN_TRANSLATE_OSREL) != 0 &&
+		    checknote->trans_osrel != NULL)
+			return (checknote->trans_osrel(note, osrel));
 		return (TRUE);
 
 nextnote:

Modified: stable/8/sys/sys/imgact_elf.h
==============================================================================
--- stable/8/sys/sys/imgact_elf.h	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/sys/imgact_elf.h	Thu Aug 27 17:34:13 2009	(r196601)
@@ -58,7 +58,10 @@ typedef struct {
 	Elf_Note	hdr;
 	const char *	vendor;
 	int		flags;
-#define	BN_CAN_FETCH_OSREL	0x0001
+	boolean_t	(*trans_osrel)(const Elf_Note *, int32_t *);
+#define	BN_CAN_FETCH_OSREL	0x0001	/* Deprecated. */
+#define	BN_TRANSLATE_OSREL	0x0002	/* Use trans_osrel fetch osrel after */
+					/* checking ABI contraint if needed. */
 } Elf_Brandnote;
 
 typedef struct {
@@ -91,6 +94,7 @@ void	__elfN(dump_thread)(struct thread *
 
 extern int __elfN(fallback_brand);
 extern Elf_Brandnote __elfN(freebsd_brandnote);
+extern Elf_Brandnote __elfN(kfreebsd_brandnote);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_IMGACT_ELF_H_ */

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 17:37:00 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51CD3106564A;
	Thu, 27 Aug 2009 17:37:00 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E18E8FC3A;
	Thu, 27 Aug 2009 17:37:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHb0PA003323;
	Thu, 27 Aug 2009 17:37:00 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHb0KM003313;
	Thu, 27 Aug 2009 17:37:00 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200908271737.n7RHb0KM003313@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Thu, 27 Aug 2009 17:37:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196602 - in stable/7/sys: . amd64/amd64 amd64/linux32
	compat/ia32 conf contrib/pf i386/i386 i386/linux kern sys
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:37:00 -0000

Author: bz
Date: Thu Aug 27 17:36:59 2009
New Revision: 196602
URL: http://svn.freebsd.org/changeset/base/196602

Log:
  MFC r196512:
  
    Fix handling of .note.ABI-tag section for GNU systems [1].
    Handle GNU/Linux according to LSB Core Specification 4.0,
    Chapter 11. Object Format, 11.8. ABI note tag.
  
    Also check the first word of desc, not only name, according to
    glibc abi-tags specification to distinguish between Linux and
    kFreeBSD.
  
    Add explicit handling for Debian GNU/kFreeBSD, which runs
    on our kernels as well [2].
  
    In {amd64,i386}/trap.c, when checking osrel of the current process,
    also check the ABI to not change the signal behaviour for Linux
    binary processes, now that we save an osrel version for all three
    from the lists above in struct proc [2] (slightly different to HEAD).
  
    These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
    and Linux binaries on the same machine again for at least i386 and
    amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).
  
  PR:		kern/135468
  Submitted by:	dchagin [1] (initial patch)
  Suggested by:	kib [2]
  Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
  Reviewed by:	kib

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/amd64/elf_machdep.c
  stable/7/sys/amd64/amd64/trap.c
  stable/7/sys/amd64/linux32/linux32_sysvec.c
  stable/7/sys/compat/ia32/ia32_sysvec.c
  stable/7/sys/conf/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/i386/i386/elf_machdep.c
  stable/7/sys/i386/i386/trap.c
  stable/7/sys/i386/linux/linux_sysvec.c
  stable/7/sys/kern/imgact_elf.c
  stable/7/sys/sys/imgact_elf.h

Modified: stable/7/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/elf_machdep.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/amd64/amd64/elf_machdep.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -107,6 +108,22 @@ SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_AN
 	(sysinit_cfunc_t) elf64_insert_brand_entry,
 	&freebsd_brand_oinfo);
 
+static Elf64_Brandinfo kfreebsd_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_X86_64,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld-kfreebsd-x86-64.so.1",
+	.sysvec		= &elf64_freebsd_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &elf64_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf64_insert_brand_entry,
+	&kfreebsd_brand_info);
+
 
 void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/7/sys/amd64/amd64/trap.c
==============================================================================
--- stable/7/sys/amd64/amd64/trap.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/amd64/amd64/trap.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_clock.h"
+#include "opt_compat.h"
 #include "opt_cpu.h"
 #include "opt_hwpmc_hooks.h"
 #include "opt_isa.h"
@@ -115,6 +116,13 @@ dtrace_doubletrap_func_t	dtrace_doubletr
 systrace_probe_func_t	systrace_probe_func;
 #endif
 
+/* Defined in amd64/amd64/elf_machdep.c. */
+extern struct sysentvec elf64_freebsd_sysvec;
+#ifdef COMPAT_IA32
+/* Defined in compat/ia32/ia32_sysvec.c. */
+extern struct sysentvec ia32_freebsd_sysvec;
+#endif
+
 extern void trap(struct trapframe *frame);
 extern void syscall(struct trapframe *frame);
 void dblfault_handler(struct trapframe *frame);
@@ -359,7 +367,13 @@ trap(struct trapframe *frame)
 					 * This check also covers the images
 					 * without the ABI-tag ELF note.
 					 */
-					if (p->p_osrel >= 700004) {
+					if ((curproc->p_sysent ==
+					    &elf64_freebsd_sysvec
+#ifdef COMPAT_IA32
+					    || curproc->p_sysent ==
+					    &ia32_freebsd_sysvec
+#endif
+					    ) && p->p_osrel >= 700004) {
 						i = SIGSEGV;
 						ucode = SEGV_ACCERR;
 					} else {

Modified: stable/7/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/amd64/linux32/linux32_sysvec.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -126,6 +126,7 @@ static void     linux_sendsig(sig_t catc
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 static void	linux32_fixlimit(struct rlimit *rl, int which);
+static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
@@ -1055,14 +1056,38 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_maxssiz	= &linux32_maxssiz,
 };
 
-static char GNULINUX_ABI_VENDOR[] = "GNU";
+static char GNU_ABI_VENDOR[] = "GNU";
+static int GNULINUX_ABI_DESC = 0;
+
+static boolean_t
+linux32_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNULINUX_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * For linux we encode osrel as follows (see linux_mib.c):
+	 * VVVMMMIII (version, major, minor), see linux_mib.c.
+	 */
+	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
 
 static Elf_Brandnote linux32_brandnote = {
-	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
-	.hdr.n_descsz	= 16,
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
 	.hdr.n_type	= 1,
-	.vendor		= GNULINUX_ABI_VENDOR,
-	.flags		= 0
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= linux32_trans_osrel
 };
 
 static Elf32_Brandinfo linux_brand = {

Modified: stable/7/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- stable/7/sys/compat/ia32/ia32_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/compat/ia32/ia32_sysvec.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -171,6 +171,21 @@ SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY
 	(sysinit_cfunc_t) elf32_insert_brand_entry,
 	&ia32_brand_oinfo);
 
+static Elf32_Brandinfo kia32_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_386,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld.so.1",
+	.sysvec		= &ia32_freebsd_sysvec,
+	.brand_note	= &elf32_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf32_insert_brand_entry,
+	&kia32_brand_info);
+
 
 void
 elf32_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/7/sys/i386/i386/elf_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/elf_machdep.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/i386/i386/elf_machdep.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -107,6 +107,22 @@ SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_AN
 	(sysinit_cfunc_t) elf32_insert_brand_entry,
 	&freebsd_brand_oinfo);
 
+static Elf32_Brandinfo kfreebsd_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_386,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld.so.1",
+	.sysvec		= &elf32_freebsd_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &elf32_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf32_insert_brand_entry,
+	&kfreebsd_brand_info);
+
 
 void
 elf32_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/7/sys/i386/i386/trap.c
==============================================================================
--- stable/7/sys/i386/i386/trap.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/i386/i386/trap.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -123,6 +123,9 @@ dtrace_doubletrap_func_t	dtrace_doubletr
 systrace_probe_func_t	systrace_probe_func;
 #endif
 
+/* Defined in i386/i386/elf_machdep.c. */
+extern struct sysentvec elf32_freebsd_sysvec;
+
 extern void trap(struct trapframe *frame);
 extern void syscall(struct trapframe *frame);
 
@@ -423,7 +426,9 @@ trap(struct trapframe *frame)
 					 * This check also covers the images
 					 * without the ABI-tag ELF note.
 					 */
-					if (p->p_osrel >= 700004) {
+					if (curproc->p_sysent ==
+					    &elf32_freebsd_sysvec &&
+					    p->p_osrel >= 700004) {
 						i = SIGSEGV;
 						ucode = SEGV_ACCERR;
 					} else {

Modified: stable/7/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/7/sys/i386/linux/linux_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/i386/linux/linux_sysvec.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -107,6 +107,7 @@ static void     linux_sendsig(sig_t catc
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 static register_t *linux_copyout_strings(struct image_params *imgp);
+static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static int linux_szplatform;
 const char *linux_platform;
@@ -1025,14 +1026,38 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_maxssiz	= NULL
 };
 
-static char GNULINUX_ABI_VENDOR[] = "GNU";
+static char GNU_ABI_VENDOR[] = "GNU";
+static int GNULINUX_ABI_DESC = 0;
+
+static boolean_t
+linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNULINUX_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * For linux we encode osrel as follows (see linux_mib.c):
+	 * VVVMMMIII (version, major, minor), see linux_mib.c.
+	 */
+	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
 
 static Elf_Brandnote linux_brandnote = {
-	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
-	.hdr.n_descsz	= 16,
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
 	.hdr.n_type	= 1,
-	.vendor		= GNULINUX_ABI_VENDOR,
-	.flags		= 0
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= linux_trans_osrel
 };
 
 static Elf32_Brandinfo linux_brand = {

Modified: stable/7/sys/kern/imgact_elf.c
==============================================================================
--- stable/7/sys/kern/imgact_elf.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/kern/imgact_elf.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -86,6 +86,9 @@ static int __elfN(load_section)(struct v
     vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
     vm_prot_t prot, size_t pagesize);
 static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
+static boolean_t __elfN(freebsd_trans_osrel)(const Elf_Note *note,
+    int32_t *osrel);
+static boolean_t kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static boolean_t __elfN(check_note)(struct image_params *imgp,
     Elf_Brandnote *checknote, int32_t *osrel);
 
@@ -119,9 +122,56 @@ Elf_Brandnote __elfN(freebsd_brandnote) 
 	.hdr.n_descsz	= sizeof(int32_t),
 	.hdr.n_type	= 1,
 	.vendor		= FREEBSD_ABI_VENDOR,
-	.flags		= BN_CAN_FETCH_OSREL
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= __elfN(freebsd_trans_osrel)
 };
 
+static boolean_t
+__elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel)
+{
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+	*osrel = *(const int32_t *)(p);
+
+	return (TRUE);
+}
+
+static const char GNU_ABI_VENDOR[] = "GNU";
+static int GNU_KFREEBSD_ABI_DESC = 3;
+
+Elf_Brandnote __elfN(kfreebsd_brandnote) = {
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
+	.hdr.n_type	= 1,
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= kfreebsd_trans_osrel
+};
+
+static boolean_t
+kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNU_KFREEBSD_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * Debian GNU/kFreeBSD embed the earliest compatible kernel version
+	 * (__FreeBSD_version: Rxx) in the LSB way.
+	 */
+	*osrel = desc[1] * 100000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
+
 int
 __elfN(insert_brand_entry)(Elf_Brandinfo *entry)
 {
@@ -1382,11 +1432,9 @@ __elfN(check_note)(struct image_params *
 		 * Fetch the osreldate for binary
 		 * from the ELF OSABI-note if necessary.
 		 */
-		if ((checknote->flags & BN_CAN_FETCH_OSREL) != 0 &&
-		    osrel != NULL)
-			*osrel = *(const int32_t *) (note_name +
-			    roundup2(checknote->hdr.n_namesz,
-			    sizeof(Elf32_Addr)));
+		if ((checknote->flags & BN_TRANSLATE_OSREL) != 0 &&
+		    checknote->trans_osrel != NULL)
+			return (checknote->trans_osrel(note, osrel));
 		return (TRUE);
 
 nextnote:

Modified: stable/7/sys/sys/imgact_elf.h
==============================================================================
--- stable/7/sys/sys/imgact_elf.h	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/sys/imgact_elf.h	Thu Aug 27 17:36:59 2009	(r196602)
@@ -59,7 +59,10 @@ typedef struct {
 	Elf_Note	hdr;
 	const char *	vendor;
 	int		flags;
-#define	BN_CAN_FETCH_OSREL	0x0001
+	boolean_t	(*trans_osrel)(const Elf_Note *, int32_t *);
+#define	BN_CAN_FETCH_OSREL	0x0001	/* Deprecated. */
+#define	BN_TRANSLATE_OSREL	0x0002	/* Use trans_osrel fetch osrel after */
+					/* checking ABI contraint if needed. */
 } Elf_Brandnote;
 
 typedef struct {
@@ -92,6 +95,7 @@ void	__elfN(dump_thread)(struct thread *
 
 extern	int __elfN(fallback_brand);
 extern Elf_Brandnote __elfN(freebsd_brandnote);
+extern Elf_Brandnote __elfN(kfreebsd_brandnote);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_IMGACT_ELF_H_ */

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 17:53:26 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0AC2E106568D;
	Thu, 27 Aug 2009 17:53:26 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ED8988FC1C;
	Thu, 27 Aug 2009 17:53:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHrPRa003721;
	Thu, 27 Aug 2009 17:53:25 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHrPaK003719;
	Thu, 27 Aug 2009 17:53:25 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908271753.n7RHrPaK003719@svn.freebsd.org>
From: Doug Barton 
Date: Thu, 27 Aug 2009 17:53:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196604 - stable/8/etc
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:53:26 -0000

Author: dougb
Date: Thu Aug 27 17:53:25 2009
New Revision: 196604
URL: http://svn.freebsd.org/changeset/base/196604

Log:
  MFC 196589:
  
  In the loop through the list of interfaces in network6_interface_setup()
  rtsol_interface gets reset to "yes" each time through the loop, but
  rtsol_available does not. If a user has lo0 first in their list of
  interfaces rtsol_available will get set to "no" the first time through
  the loop and subsequent interfaces will not get rtsol'ed when they should.
  
  Therefore change the conditional for the is_wired() test to _interface.
  
  Approved by:	re (kib)

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/network.subr

Modified: stable/8/etc/network.subr
==============================================================================
--- stable/8/etc/network.subr	Thu Aug 27 17:42:37 2009	(r196603)
+++ stable/8/etc/network.subr	Thu Aug 27 17:53:25 2009	(r196604)
@@ -872,8 +872,8 @@ network6_interface_setup()
 		# Wireless NIC cards are virtualized through the wlan interface
 		if ! is_wired_interface ${i}; then
 			case "${i}" in
-			wlan*)	rtsol_available=yes ;;
-			*)	rtsol_available=no ;;
+			wlan*)	rtsol_interface=yes ;;
+			*)	rtsol_interface=no ;;
 			esac
 		fi
 

From owner-svn-src-stable@FreeBSD.ORG  Thu Aug 27 18:52:55 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A99EA106568E;
	Thu, 27 Aug 2009 18:52:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7EB9E8FC36;
	Thu, 27 Aug 2009 18:52:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RIqtHX005106;
	Thu, 27 Aug 2009 18:52:55 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RIqtdX005105;
	Thu, 27 Aug 2009 18:52:55 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271852.n7RIqtdX005105@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 18:52:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196606 - in stable/7/sys: . conf contrib/pf
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 18:52:55 -0000

Author: jhb
Date: Thu Aug 27 18:52:55 2009
New Revision: 196606
URL: http://svn.freebsd.org/changeset/base/196606

Log:
  Tidy up some confused mergeinfo in sys/.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/conf/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 10:25:26 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9B984106567D;
	Fri, 28 Aug 2009 10:25:26 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6FC8F8FC22;
	Fri, 28 Aug 2009 10:25:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SAPQgb022473;
	Fri, 28 Aug 2009 10:25:26 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SAPQXD022471;
	Fri, 28 Aug 2009 10:25:26 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200908281025.n7SAPQXD022471@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 28 Aug 2009 10:25:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196614 - in stable/8/lib/libc: . stdio stdlib stdtime
	string
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 10:25:26 -0000

Author: ed
Date: Fri Aug 28 10:25:26 2009
New Revision: 196614
URL: http://svn.freebsd.org/changeset/base/196614

Log:
  MFC r196508:
    Our implementation of granpt(3) could be valid in the future.
  
    When I wrote the pseudo-terminal driver for the MPSAFE TTY code, Robert
    Watson and I agreed the best way to implement this, would be to let
    posix_openpt() create a pseudo-terminal with proper permissions in place
    and let grantpt() and unlockpt() be no-ops.
  
    This isn't valid behaviour when looking at the spec. Because I thought
    it was an elegant solution, I filed a bug report at the Austin Group
    about this. In their last teleconference, they agreed on this subject.
    This means that future revisions of POSIX may allow grantpt() and
    unlockpt() to be no-ops if an open() on /dev/ptmx (if the implementation
    has such a device) and posix_openpt() already do the right thing.
  
    I'd rather put this in the manpage, because simply mentioning we don't
    comply to any standard makes it look worse than it is. Right now we
    don't, but at least we took care of it.
  
    Approved by:  re (kib)

Modified:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdio/asprintf.c   (props changed)
  stable/8/lib/libc/stdlib/ptsname.3
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/string/ffsll.c   (props changed)
  stable/8/lib/libc/string/flsll.c   (props changed)
  stable/8/lib/libc/string/wcpcpy.c   (props changed)
  stable/8/lib/libc/string/wcpncpy.c   (props changed)

Modified: stable/8/lib/libc/stdlib/ptsname.3
==============================================================================
--- stable/8/lib/libc/stdlib/ptsname.3	Fri Aug 28 10:25:01 2009	(r196613)
+++ stable/8/lib/libc/stdlib/ptsname.3	Fri Aug 28 10:25:26 2009	(r196614)
@@ -134,14 +134,22 @@ The slave pseudo-terminal device could n
 The
 .Fn ptsname
 function conforms to
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
 .Pp
 This implementation of
 .Fn grantpt
 and
 .Fn unlockpt
-does not comply with any standard, because these functions assume the
-pseudo-terminal has the correct attributes upon creation.
+does not conform to
+.St -p1003.1-2008 ,
+because it depends on
+.Xr posix_openpt 2
+to create the pseudo-terminal device with proper permissions in place.
+It only validates whether
+.Fa fildes
+is a valid pseudo-terminal master device.
+Future revisions of the specification will likely allow this behaviour,
+as stated by the Austin Group.
 .Sh HISTORY
 The
 .Fn grantpt ,
@@ -150,15 +158,3 @@ and
 .Fn unlockpt
 functions appeared in
 .Fx 5.0 .
-.Sh NOTES
-The purpose of the
-.Fn grantpt
-and
-.Fn unlockpt
-functions has no meaning in
-.Fx ,
-because pseudo-terminals obtained by
-.Xr posix_openpt 2
-are created on demand.
-Because these devices are created with proper permissions in place, they
-are guaranteed to be unused by unprivileged processes.

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 14:22:01 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6902B1065670;
	Fri, 28 Aug 2009 14:22:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 54C8C8FC0A;
	Fri, 28 Aug 2009 14:22:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SEM1KE027225;
	Fri, 28 Aug 2009 14:22:01 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SEM13j027214;
	Fri, 28 Aug 2009 14:22:01 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908281422.n7SEM13j027214@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 28 Aug 2009 14:22:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196616 - in stable/7/sys: . amd64/amd64 amd64/include
	contrib/pf dev/hwpmc i386/i386 i386/include
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 14:22:01 -0000

Author: jhb
Date: Fri Aug 28 14:22:01 2009
New Revision: 196616
URL: http://svn.freebsd.org/changeset/base/196616

Log:
  MFC 196224:
  Adjust the handling of the local APIC PMC interrupt vector:
  - Provide lapic_disable_pmc(), lapic_enable_pmc(), and lapic_reenable_pmc()
    routines in the local APIC code that the hwpmc(4) driver can use to
    manage the local APIC PMC interrupt vector.
  - Do not enable the local APIC PMC interrupt vector by default when
    HWPMC_HOOKS is enabled.  Instead, the hwpmc(4) driver explicitly
    enables the interrupt when it is succesfully initialized and disables
    the interrupt when it is unloaded.  This avoids enabling the interrupt
    on unsupported CPUs which may result in spurious NMIs.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/amd64/local_apic.c
  stable/7/sys/amd64/include/apicvar.h
  stable/7/sys/amd64/include/pmc_mdep.h
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/hwpmc/hwpmc_core.c
  stable/7/sys/dev/hwpmc/hwpmc_piv.c
  stable/7/sys/dev/hwpmc/hwpmc_ppro.c
  stable/7/sys/dev/hwpmc/hwpmc_x86.c
  stable/7/sys/i386/i386/local_apic.c
  stable/7/sys/i386/include/apicvar.h
  stable/7/sys/i386/include/pmc_mdep.h

Modified: stable/7/sys/amd64/amd64/local_apic.c
==============================================================================
--- stable/7/sys/amd64/amd64/local_apic.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/amd64/amd64/local_apic.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -119,7 +119,7 @@ static struct lvt lvts[LVT_MAX + 1] = {
 	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* LINT1: NMI */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT },	/* Timer */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT },	/* Error */
-	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
+	{ 1, 1, 1, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT },	/* Thermal */
 };
 
@@ -299,11 +299,9 @@ lapic_setup(int boot)
 	/* Program LINT[01] LVT entries. */
 	lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
 	lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
-#ifdef	HWPMC_HOOKS
 	/* Program the PMC LVT entry if present. */
 	if (maxlvt >= LVT_PMC)
 		lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
-#endif
 
 	/* Program timer LVT and setup handler. */
 	lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
@@ -349,6 +347,88 @@ lapic_setup(int boot)
 	intr_restore(eflags);
 }
 
+void
+lapic_reenable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	uint32_t value;
+
+	value =  lapic->lvt_pcint;
+	value &= ~APIC_LVT_M;
+	lapic->lvt_pcint = value;
+#endif
+}
+
+#ifdef HWPMC_HOOKS
+static void
+lapic_update_pmc(void *dummy)
+{
+	struct lapic *la;
+
+	la = &lapics[lapic_id()];
+	lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
+}
+#endif
+
+int
+lapic_enable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return (0);
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return (0);
+
+	lvts[LVT_PMC].lvt_masked = 0;
+
+#ifdef SMP
+	/*
+	 * If hwpmc was loaded at boot time then the APs may not be
+	 * started yet.  In that case, don't forward the request to
+	 * them as they will program the lvt when they start.
+	 */
+	if (smp_started)
+		smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+	else
+#endif
+		lapic_update_pmc(NULL);
+	return (1);
+#else
+	return (0);
+#endif
+}
+
+void
+lapic_disable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return;
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return;
+
+	lvts[LVT_PMC].lvt_masked = 1;
+
+#ifdef SMP
+	/* The APs should always be started when hwpmc is unloaded. */
+	KASSERT(mp_ncpus == 1 || smp_started, ("hwpmc unloaded too early"));
+#endif
+	smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+#endif
+}
+
 /*
  * Called by cpu_initclocks() on the BSP to setup the local APIC timer so
  * that it can drive hardclock, statclock, and profclock.  This function

Modified: stable/7/sys/amd64/include/apicvar.h
==============================================================================
--- stable/7/sys/amd64/include/apicvar.h	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/amd64/include/apicvar.h	Fri Aug 28 14:22:01 2009	(r196616)
@@ -198,7 +198,9 @@ int	ioapic_set_triggermode(void *cookie,
 int	ioapic_set_smi(void *cookie, u_int pin);
 void	lapic_create(u_int apic_id, int boot_cpu);
 void	lapic_disable(void);
+void	lapic_disable_pmc(void);
 void	lapic_dump(const char *str);
+int	lapic_enable_pmc(void);
 void	lapic_eoi(void);
 int	lapic_id(void);
 void	lapic_init(vm_paddr_t addr);
@@ -208,6 +210,7 @@ void	lapic_ipi_vectored(u_int vector, in
 int	lapic_ipi_wait(int delay);
 void	lapic_handle_intr(int vector, struct trapframe *frame);
 void	lapic_handle_timer(struct trapframe *frame);
+void	lapic_reenable_pmc(void);
 void	lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
 int	lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
 int	lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);

Modified: stable/7/sys/amd64/include/pmc_mdep.h
==============================================================================
--- stable/7/sys/amd64/include/pmc_mdep.h	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/amd64/include/pmc_mdep.h	Fri Aug 28 14:22:01 2009	(r196616)
@@ -115,7 +115,6 @@ union pmc_md_pmc {
  */
 
 void	start_exceptions(void), end_exceptions(void);
-void	pmc_x86_lapic_enable_pmc_interrupt(void);
 
 struct pmc_mdep *pmc_amd_initialize(void);
 void	pmc_amd_finalize(struct pmc_mdep *_md);

Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_core.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/dev/hwpmc/hwpmc_core.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -32,10 +32,13 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1771,7 +1774,7 @@ core_intr(int cpu, struct trapframe *tf)
 	}
 
 	if (found_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);
@@ -1895,7 +1898,7 @@ core2_intr(int cpu, struct trapframe *tf
 	    (uintmax_t) rdmsr(IA_GLOBAL_OVF_CTRL));
 
 	if (found_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

Modified: stable/7/sys/dev/hwpmc/hwpmc_piv.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_piv.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/dev/hwpmc/hwpmc_piv.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -32,6 +32,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1537,7 +1540,7 @@ p4_intr(int cpu, struct trapframe *tf)
 	 */
 
 	if (did_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(did_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

Modified: stable/7/sys/dev/hwpmc/hwpmc_ppro.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_ppro.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/dev/hwpmc/hwpmc_ppro.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -32,6 +32,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -718,7 +721,7 @@ p6_intr(int cpu, struct trapframe *tf)
 	 * unmasked after a PMC interrupt.
 	 */
 	if (retval)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(retval ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

Modified: stable/7/sys/dev/hwpmc/hwpmc_x86.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_x86.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/dev/hwpmc/hwpmc_x86.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -39,7 +39,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -47,18 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-extern volatile lapic_t *lapic;
-
-void
-pmc_x86_lapic_enable_pmc_interrupt(void)
-{
-	uint32_t value;
-
-	value =  lapic->lvt_pcint;
-	value &= ~APIC_LVT_M;
-	lapic->lvt_pcint = value;
-}
-
 /*
  * Attempt to walk a user call stack using a too-simple algorithm.
  * In the general case we need unwind information associated with
@@ -252,16 +241,15 @@ pmc_md_initialize()
 	struct pmc_mdep *md;
 
 	/* determine the CPU kind */
-	md = NULL;
 	if (cpu_vendor_id == CPU_VENDOR_AMD)
 		md = pmc_amd_initialize();
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL)
 		md = pmc_intel_initialize();
 	else
-		KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__));
+		return (NULL);
 
 	/* disallow sampling if we do not have an LAPIC */
-	if (md != NULL && lapic == NULL)
+	if (!lapic_enable_pmc())
 		for (i = 1; i < md->pmd_nclass; i++)
 			md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT;
 
@@ -271,6 +259,8 @@ pmc_md_initialize()
 void
 pmc_md_finalize(struct pmc_mdep *md)
 {
+
+	lapic_disable_pmc();
 	if (cpu_vendor_id == CPU_VENDOR_AMD)
 		pmc_amd_finalize(md);
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL)

Modified: stable/7/sys/i386/i386/local_apic.c
==============================================================================
--- stable/7/sys/i386/i386/local_apic.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/i386/i386/local_apic.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -119,7 +119,7 @@ static struct lvt lvts[LVT_MAX + 1] = {
 	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* LINT1: NMI */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT },	/* Timer */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT },	/* Error */
-	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
+	{ 1, 1, 1, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT },	/* Thermal */
 };
 
@@ -301,11 +301,9 @@ lapic_setup(int boot)
 	/* Program LINT[01] LVT entries. */
 	lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
 	lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
-#ifdef	HWPMC_HOOKS
 	/* Program the PMC LVT entry if present. */
 	if (maxlvt >= LVT_PMC)
 		lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
-#endif
 
 	/* Program timer LVT and setup handler. */
 	lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
@@ -351,6 +349,88 @@ lapic_setup(int boot)
 	intr_restore(eflags);
 }
 
+void
+lapic_reenable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	uint32_t value;
+
+	value =  lapic->lvt_pcint;
+	value &= ~APIC_LVT_M;
+	lapic->lvt_pcint = value;
+#endif
+}
+
+#ifdef HWPMC_HOOKS
+static void
+lapic_update_pmc(void *dummy)
+{
+	struct lapic *la;
+
+	la = &lapics[lapic_id()];
+	lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
+}
+#endif
+
+int
+lapic_enable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return (0);
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return (0);
+
+	lvts[LVT_PMC].lvt_masked = 0;
+
+#ifdef SMP
+	/*
+	 * If hwpmc was loaded at boot time then the APs may not be
+	 * started yet.  In that case, don't forward the request to
+	 * them as they will program the lvt when they start.
+	 */
+	if (smp_started)
+		smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+	else
+#endif
+		lapic_update_pmc(NULL);
+	return (1);
+#else
+	return (0);
+#endif
+}
+
+void
+lapic_disable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return;
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return;
+
+	lvts[LVT_PMC].lvt_masked = 1;
+
+#ifdef SMP
+	/* The APs should always be started when hwpmc is unloaded. */
+	KASSERT(mp_ncpus == 1 || smp_started, ("hwpmc unloaded too early"));
+#endif
+	smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+#endif
+}
+
 /*
  * Called by cpu_initclocks() on the BSP to setup the local APIC timer so
  * that it can drive hardclock, statclock, and profclock.  This function

Modified: stable/7/sys/i386/include/apicvar.h
==============================================================================
--- stable/7/sys/i386/include/apicvar.h	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/i386/include/apicvar.h	Fri Aug 28 14:22:01 2009	(r196616)
@@ -197,7 +197,9 @@ int	ioapic_set_triggermode(void *cookie,
 int	ioapic_set_smi(void *cookie, u_int pin);
 void	lapic_create(u_int apic_id, int boot_cpu);
 void	lapic_disable(void);
+void	lapic_disable_pmc(void);
 void	lapic_dump(const char *str);
+int	lapic_enable_pmc(void);
 void	lapic_eoi(void);
 int	lapic_id(void);
 void	lapic_init(vm_paddr_t addr);
@@ -207,6 +209,7 @@ void	lapic_ipi_vectored(u_int vector, in
 int	lapic_ipi_wait(int delay);
 void	lapic_handle_intr(int vector, struct trapframe *frame);
 void	lapic_handle_timer(struct trapframe *frame);
+void	lapic_reenable_pmc(void);
 void	lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
 int	lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
 int	lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);

Modified: stable/7/sys/i386/include/pmc_mdep.h
==============================================================================
--- stable/7/sys/i386/include/pmc_mdep.h	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/i386/include/pmc_mdep.h	Fri Aug 28 14:22:01 2009	(r196616)
@@ -150,7 +150,6 @@ struct pmc_mdep;
  */
 
 void	start_exceptions(void), end_exceptions(void);
-void	pmc_x86_lapic_enable_pmc_interrupt(void);
 
 struct pmc_mdep *pmc_amd_initialize(void);
 void	pmc_amd_finalize(struct pmc_mdep *_md);

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 17:34:22 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C6830106564A;
	Fri, 28 Aug 2009 17:34:22 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 99EB08FC16;
	Fri, 28 Aug 2009 17:34:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SHYMq2031276;
	Fri, 28 Aug 2009 17:34:22 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SHYMNg031273;
	Fri, 28 Aug 2009 17:34:22 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200908281734.n7SHYMNg031273@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 28 Aug 2009 17:34:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196618 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/re
	dev/xen/xenpci pci
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 17:34:22 -0000

Author: yongari
Date: Fri Aug 28 17:34:22 2009
New Revision: 196618
URL: http://svn.freebsd.org/changeset/base/196618

Log:
  MFC r196516:
    Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" to
    the description of RTL8168D as RL_HWREV_8168D can be either
    RTL8168D or RTL8111D.
  
    PR:	kern/137672
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/re/if_re.c
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/pci/if_rlreg.h

Modified: stable/8/sys/dev/re/if_re.c
==============================================================================
--- stable/8/sys/dev/re/if_re.c	Fri Aug 28 16:45:34 2009	(r196617)
+++ stable/8/sys/dev/re/if_re.c	Fri Aug 28 17:34:22 2009	(r196618)
@@ -174,8 +174,8 @@ static struct rl_type re_devs[] = {
 	{ RT_VENDORID, RT_DEVICEID_8101E, 0,
 	    "RealTek 8101E/8102E/8102EL PCIe 10/100baseTX" },
 	{ RT_VENDORID, RT_DEVICEID_8168, 0,
-	    "RealTek 8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP PCIe "
-	    "Gigabit Ethernet" },
+	    "RealTek 8168/8168B/8168C/8168CP/8168D/8168DP/"
+	    "8111B/8111C/8111CP/8111DP PCIe Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169, 0,
 	    "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169SC, 0,
@@ -217,7 +217,8 @@ static struct rl_hwrev re_hwrevs[] = {
 	{ RL_HWREV_8168C, RL_8169, "8168C/8111C"},
 	{ RL_HWREV_8168C_SPIN2, RL_8169, "8168C/8111C"},
 	{ RL_HWREV_8168CP, RL_8169, "8168CP/8111CP"},
-	{ RL_HWREV_8168D, RL_8169, "8168D"},
+	{ RL_HWREV_8168D, RL_8169, "8168D/8111D"},
+	{ RL_HWREV_8168DP, RL_8169, "8168DP/8111DP"},
 	{ 0, 0, NULL }
 };
 
@@ -1282,6 +1283,7 @@ re_attach(device_t dev)
 		/* FALLTHROUGH */
 	case RL_HWREV_8168CP:
 	case RL_HWREV_8168D:
+	case RL_HWREV_8168DP:
 		sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR |
 		    RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP |
 		    RL_FLAG_AUTOPAD;

Modified: stable/8/sys/pci/if_rlreg.h
==============================================================================
--- stable/8/sys/pci/if_rlreg.h	Fri Aug 28 16:45:34 2009	(r196617)
+++ stable/8/sys/pci/if_rlreg.h	Fri Aug 28 17:34:22 2009	(r196618)
@@ -161,6 +161,7 @@
 #define RL_HWREV_8102EL		0x24800000
 #define RL_HWREV_8102EL_SPIN1	0x24c00000
 #define RL_HWREV_8168D		0x28000000
+#define RL_HWREV_8168DP		0x28800000
 #define RL_HWREV_8168_SPIN1	0x30000000
 #define RL_HWREV_8100E		0x30800000
 #define RL_HWREV_8101E		0x34000000

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 18:01:37 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 99D73106564A;
	Fri, 28 Aug 2009 18:01:37 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 874948FC18;
	Fri, 28 Aug 2009 18:01:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SI1bRQ031848;
	Fri, 28 Aug 2009 18:01:37 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SI1bpp031846;
	Fri, 28 Aug 2009 18:01:37 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200908281801.n7SI1bpp031846@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 28 Aug 2009 18:01:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196619 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/alc dev/xen/xenpci
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 18:01:37 -0000

Author: yongari
Date: Fri Aug 28 18:01:37 2009
New Revision: 196619
URL: http://svn.freebsd.org/changeset/base/196619

Log:
  MFC r196517:
    Don't try to power down PHY when alc(4) failed to map the device.
    This fixes system crash when mapping alc(4) device failed in device
    attach.
  
    Reported by:	Jim < stapleton.41 <> gmail DOT com >
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/alc/if_alc.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/alc/if_alc.c
==============================================================================
--- stable/8/sys/dev/alc/if_alc.c	Fri Aug 28 17:34:22 2009	(r196618)
+++ stable/8/sys/dev/alc/if_alc.c	Fri Aug 28 18:01:37 2009	(r196619)
@@ -858,7 +858,8 @@ alc_detach(device_t dev)
 			sc->alc_intrhand[i] = NULL;
 		}
 	}
-	alc_phy_down(sc);
+	if (sc->alc_res[0] != NULL)
+		alc_phy_down(sc);
 	bus_release_resources(dev, sc->alc_irq_spec, sc->alc_irq);
 	if ((sc->alc_flags & (ALC_FLAG_MSI | ALC_FLAG_MSIX)) != 0)
 		pci_release_msi(dev);

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 19:08:57 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50D731065670;
	Fri, 28 Aug 2009 19:08:57 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E2E38FC14;
	Fri, 28 Aug 2009 19:08:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJ8vZ2033494;
	Fri, 28 Aug 2009 19:08:57 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJ8uW7033493;
	Fri, 28 Aug 2009 19:08:56 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281908.n7SJ8uW7033493@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:08:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196620 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:08:57 -0000

Author: zec
Date: Fri Aug 28 19:08:56 2009
New Revision: 196620
URL: http://svn.freebsd.org/changeset/base/196620

Log:
  MFC r196501:
  
    When registering a protocol to an existing protocol domain via
    pf_proto_register(), iterate over all existing vnets to call protosw_init()
    and thus the appropriate .pr_init() handler in the context of each vnet.
    NB in the future we probably want to separate pr_init() handlers into
    two, i.e. per-vnet and global, functions.
  
    This change has no impact on nooptions VIMAGE builds.
  
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/uipc_domain.c

Modified: stable/8/sys/kern/uipc_domain.c
==============================================================================
--- stable/8/sys/kern/uipc_domain.c	Fri Aug 28 18:01:37 2009	(r196619)
+++ stable/8/sys/kern/uipc_domain.c	Fri Aug 28 19:08:56 2009	(r196620)
@@ -336,6 +336,7 @@ found:
 int
 pf_proto_register(int family, struct protosw *npr)
 {
+	VNET_ITERATOR_DECL(vnet_iter);
 	struct domain *dp;
 	struct protosw *pr, *fpr;
 
@@ -391,7 +392,13 @@ found:
 	mtx_unlock(&dom_mtx);
 
 	/* Initialize and activate the protocol. */
-	protosw_init(fpr);
+	VNET_LIST_RLOCK();
+	VNET_FOREACH(vnet_iter) {
+		CURVNET_SET_QUIET(vnet_iter);
+		protosw_init(fpr);
+		CURVNET_RESTORE();
+	}
+	VNET_LIST_RUNLOCK();
 
 	return (0);
 }

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 19:10:58 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5DBB2106566B;
	Fri, 28 Aug 2009 19:10:58 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4AAFC8FC1B;
	Fri, 28 Aug 2009 19:10:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJAwJp033610;
	Fri, 28 Aug 2009 19:10:58 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJAwV4033607;
	Fri, 28 Aug 2009 19:10:58 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281910.n7SJAwV4033607@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:10:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196621 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:10:58 -0000

Author: zec
Date: Fri Aug 28 19:10:58 2009
New Revision: 196621
URL: http://svn.freebsd.org/changeset/base/196621

Log:
  MFC r196502:
  
    Introduce a div_destroy() function which takes over per-vnet cleanup tasks
    from the existing modevent / MOD_UNLOAD handler, and register div_destroy()
    in protosw as per-vnet .pr_destroy() handler for options VIMAGE builds.  In
    nooptions VIMAGE builds, div_destroy() will be invoked from the modevent
    handler, resulting in effectively identical operation as it was prior this
    change.  div_destroy() also tears down hashtables used by ipdivert, which
    were previously left behind on ipdivert kldunloads.
  
    For options VIMAGE builds only, temporarily disable kldunloading of ipdivert,
    because without introducing additional locking logic it is impossible to
    atomically check whether all ipdivert instances in all vnets are idle, and
    proceed with cleanup without opening a race window for a vnet to open an
    ipdivert socket while ipdivert tear-down is in progress.
  
    While here, staticize div_init(), because it is not used outside of
    ip_divert.c.
  
    In cooperation with:  julian
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/ip_divert.c
  stable/8/sys/netinet/ip_divert.h

Modified: stable/8/sys/netinet/ip_divert.c
==============================================================================
--- stable/8/sys/netinet/ip_divert.c	Fri Aug 28 19:08:56 2009	(r196620)
+++ stable/8/sys/netinet/ip_divert.c	Fri Aug 28 19:10:58 2009	(r196621)
@@ -125,6 +125,8 @@ static VNET_DEFINE(struct inpcbinfo, div
 static u_long	div_sendspace = DIVSNDQ;	/* XXX sysctl ? */
 static u_long	div_recvspace = DIVRCVQ;	/* XXX sysctl ? */
 
+static eventhandler_tag ip_divert_event_tag;
+
 /*
  * Initialize divert connection block queue.
  */
@@ -152,7 +154,7 @@ div_inpcb_fini(void *mem, int size)
 	INP_LOCK_DESTROY(inp);
 }
 
-void
+static void
 div_init(void)
 {
 
@@ -174,8 +176,17 @@ div_init(void)
 	    NULL, NULL, div_inpcb_init, div_inpcb_fini, UMA_ALIGN_PTR,
 	    UMA_ZONE_NOFREE);
 	uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets);
-	EVENTHANDLER_REGISTER(maxsockets_change, div_zone_change,
-		NULL, EVENTHANDLER_PRI_ANY);
+}
+
+static void
+div_destroy(void)
+{
+
+	INP_INFO_LOCK_DESTROY(&V_divcbinfo);
+	uma_zdestroy(V_divcbinfo.ipi_zone);
+	hashdestroy(V_divcbinfo.ipi_hashbase, M_PCB, V_divcbinfo.ipi_hashmask);
+	hashdestroy(V_divcbinfo.ipi_porthashbase, M_PCB,
+	    V_divcbinfo.ipi_porthashmask);
 }
 
 /*
@@ -709,6 +720,9 @@ struct protosw div_protosw = {
 	.pr_ctlinput =		div_ctlinput,
 	.pr_ctloutput =		ip_ctloutput,
 	.pr_init =		div_init,
+#ifdef VIMAGE
+	.pr_destroy =		div_destroy,
+#endif
 	.pr_usrreqs =		&div_usrreqs
 };
 
@@ -716,7 +730,9 @@ static int
 div_modevent(module_t mod, int type, void *unused)
 {
 	int err = 0;
+#ifndef VIMAGE
 	int n;
+#endif
 
 	switch (type) {
 	case MOD_LOAD:
@@ -726,7 +742,11 @@ div_modevent(module_t mod, int type, voi
 		 * a true IP protocol that goes over the wire.
 		 */
 		err = pf_proto_register(PF_INET, &div_protosw);
+		if (err != 0)
+			return (err);
 		ip_divert_ptr = divert_packet;
+		ip_divert_event_tag = EVENTHANDLER_REGISTER(maxsockets_change,
+		    div_zone_change, NULL, EVENTHANDLER_PRI_ANY);
 		break;
 	case MOD_QUIESCE:
 		/*
@@ -737,6 +757,10 @@ div_modevent(module_t mod, int type, voi
 		err = EPERM;
 		break;
 	case MOD_UNLOAD:
+#ifdef VIMAGE
+		err = EPERM;
+		break;
+#else
 		/*
 		 * Forced unload.
 		 *
@@ -758,9 +782,10 @@ div_modevent(module_t mod, int type, voi
 		ip_divert_ptr = NULL;
 		err = pf_proto_unregister(PF_INET, IPPROTO_DIVERT, SOCK_RAW);
 		INP_INFO_WUNLOCK(&V_divcbinfo);
-		INP_INFO_LOCK_DESTROY(&V_divcbinfo);
-		uma_zdestroy(V_divcbinfo.ipi_zone);
+		div_destroy();
+		EVENTHANDLER_DEREGISTER(maxsockets_change, ip_divert_event_tag);
 		break;
+#endif /* !VIMAGE */
 	default:
 		err = EOPNOTSUPP;
 		break;

Modified: stable/8/sys/netinet/ip_divert.h
==============================================================================
--- stable/8/sys/netinet/ip_divert.h	Fri Aug 28 19:08:56 2009	(r196620)
+++ stable/8/sys/netinet/ip_divert.h	Fri Aug 28 19:10:58 2009	(r196621)
@@ -83,7 +83,6 @@ divert_find_info(struct mbuf *m)
 typedef	void ip_divert_packet_t(struct mbuf *m, int incoming);
 extern	ip_divert_packet_t *ip_divert_ptr;
 
-extern	void div_init(void);
 extern	void div_input(struct mbuf *, int);
 extern	void div_ctlinput(int, struct sockaddr *, void *);
 #endif /* _NETINET_IP_DIVERT_H_ */

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 19:12:45 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EFD2A106564A;
	Fri, 28 Aug 2009 19:12:44 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DC3148FC28;
	Fri, 28 Aug 2009 19:12:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJCifP033736;
	Fri, 28 Aug 2009 19:12:44 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJCiv0033726;
	Fri, 28 Aug 2009 19:12:44 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281912.n7SJCiv0033726@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:12:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196622 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci fs/nfsclient nfsclient rpc
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:12:45 -0000

Author: zec
Date: Fri Aug 28 19:12:44 2009
New Revision: 196622
URL: http://svn.freebsd.org/changeset/base/196622

Log:
  MFC r196503:
  
    Fix NFS panics with options VIMAGE kernels by apropriately setting curvnet
    context inside the RPC code.
  
    Temporarily set td's cred to mount's cred before calling socreate() via
    __rpc_nconf2socket().
  
    Submitted by: rmacklem (in part)
    Reviewed by:  rmacklem, rwatson
    Discussed with:       dfr, bz
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/fs/nfsclient/nfs_clvnops.c
  stable/8/sys/nfsclient/nfs_vnops.c
  stable/8/sys/rpc/clnt_dg.c
  stable/8/sys/rpc/clnt_rc.c
  stable/8/sys/rpc/clnt_vc.c
  stable/8/sys/rpc/rpc_generic.c
  stable/8/sys/rpc/svc_dg.c
  stable/8/sys/rpc/svc_generic.c
  stable/8/sys/rpc/svc_vc.c

Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvnops.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/fs/nfsclient/nfs_clvnops.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -1405,8 +1405,8 @@ again:
 	}
 	mtx_unlock(&dnp->n_mtx);
 
-	CURVNET_SET(P_TO_VNET(&proc0));
 #ifdef INET
+	CURVNET_SET(CRED_TO_VNET(cnp->cn_cred));
 	IN_IFADDR_RLOCK();
 	if (!TAILQ_EMPTY(&V_in_ifaddrhead))
 		cverf.lval[0] = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr;
@@ -1415,9 +1415,9 @@ again:
 		cverf.lval[0] = create_verf;
 #ifdef INET
 	IN_IFADDR_RUNLOCK();
+	CURVNET_RESTORE();
 #endif
 	cverf.lval[1] = ++create_verf;
-	CURVNET_RESTORE();
 	error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 	    vap, cverf, fmode, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva,
 	    &nfhp, &attrflag, &dattrflag, NULL);

Modified: stable/8/sys/nfsclient/nfs_vnops.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_vnops.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/nfsclient/nfs_vnops.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1552,6 +1553,7 @@ again:
 			*tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE);
 			tl = nfsm_build(u_int32_t *, NFSX_V3CREATEVERF);
 #ifdef INET
+			CURVNET_SET(CRED_TO_VNET(cnp->cn_cred));
 			IN_IFADDR_RLOCK();
 			if (!TAILQ_EMPTY(&V_in_ifaddrhead))
 				*tl++ = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr;
@@ -1560,6 +1562,7 @@ again:
 				*tl++ = create_verf;
 #ifdef INET
 			IN_IFADDR_RUNLOCK();
+			CURVNET_RESTORE();
 #endif
 			*tl = ++create_verf;
 		} else {

Modified: stable/8/sys/rpc/clnt_dg.c
==============================================================================
--- stable/8/sys/rpc/clnt_dg.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/clnt_dg.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -197,11 +199,14 @@ clnt_dg_create(
 		return (NULL);
 	}
 
+	CURVNET_SET(so->so_vnet);
 	if (!__rpc_socket2sockinfo(so, &si)) {
 		rpc_createerr.cf_stat = RPC_TLIERROR;
 		rpc_createerr.cf_error.re_errno = 0;
+		CURVNET_RESTORE();
 		return (NULL);
 	}
+	CURVNET_RESTORE();
 
 	/*
 	 * Find the receive and the send size

Modified: stable/8/sys/rpc/clnt_rc.c
==============================================================================
--- stable/8/sys/rpc/clnt_rc.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/clnt_rc.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -175,15 +175,16 @@ clnt_reconnect_connect(CLIENT *cl)
 	rc->rc_connecting = TRUE;
 	mtx_unlock(&rc->rc_lock);
 
+	oldcred = td->td_ucred;
+	td->td_ucred = rc->rc_ucred;
 	so = __rpc_nconf2socket(rc->rc_nconf);
 	if (!so) {
 		stat = rpc_createerr.cf_stat = RPC_TLIERROR;
 		rpc_createerr.cf_error.re_errno = 0;
+		td->td_ucred = oldcred;
 		goto out;
 	}
 
-	oldcred = td->td_ucred;
-	td->td_ucred = rc->rc_ucred;
 	if (rc->rc_privport)
 		bindresvport(so, NULL);
 

Modified: stable/8/sys/rpc/clnt_vc.c
==============================================================================
--- stable/8/sys/rpc/clnt_vc.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/clnt_vc.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -70,6 +70,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+
+#include 
+
 #include 
 
 #include 
@@ -217,8 +220,11 @@ clnt_vc_create(
 		}
 	}
 
-	if (!__rpc_socket2sockinfo(so, &si))
+	CURVNET_SET(so->so_vnet);
+	if (!__rpc_socket2sockinfo(so, &si)) {
+		CURVNET_RESTORE();
 		goto err;
+	}
 
 	if (so->so_proto->pr_flags & PR_CONNREQUIRED) {
 		bzero(&sopt, sizeof(sopt));
@@ -239,6 +245,7 @@ clnt_vc_create(
 		sopt.sopt_valsize = sizeof(one);
 		sosetopt(so, &sopt);
 	}
+	CURVNET_RESTORE();
 
 	ct->ct_closeit = FALSE;
 

Modified: stable/8/sys/rpc/rpc_generic.c
==============================================================================
--- stable/8/sys/rpc/rpc_generic.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/rpc_generic.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -822,6 +824,7 @@ bindresvport(struct socket *so, struct s
 	sa->sa_len = salen;
 
 	if (*portp == 0) {
+		CURVNET_SET(so->so_vnet);
 		bzero(&opt, sizeof(opt));
 		opt.sopt_dir = SOPT_GET;
 		opt.sopt_level = proto;
@@ -829,12 +832,15 @@ bindresvport(struct socket *so, struct s
 		opt.sopt_val = &old;
 		opt.sopt_valsize = sizeof(old);
 		error = sogetopt(so, &opt);
-		if (error)
+		if (error) {
+			CURVNET_RESTORE();
 			goto out;
+		}
 
 		opt.sopt_dir = SOPT_SET;
 		opt.sopt_val = &portlow;
 		error = sosetopt(so, &opt);
+		CURVNET_RESTORE();
 		if (error)
 			goto out;
 	}
@@ -845,7 +851,9 @@ bindresvport(struct socket *so, struct s
 		if (error) {
 			opt.sopt_dir = SOPT_SET;
 			opt.sopt_val = &old;
+			CURVNET_SET(so->so_vnet);
 			sosetopt(so, &opt);
+			CURVNET_RESTORE();
 		}
 	}
 out:

Modified: stable/8/sys/rpc/svc_dg.c
==============================================================================
--- stable/8/sys/rpc/svc_dg.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/svc_dg.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -101,8 +103,10 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	struct sockaddr* sa;
 	int error;
 
+	CURVNET_SET(so->so_vnet);
 	if (!__rpc_socket2sockinfo(so, &si)) {
 		printf(svc_dg_str, svc_dg_err1);
+		CURVNET_RESTORE();
 		return (NULL);
 	}
 	/*
@@ -112,6 +116,7 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
 	if ((sendsize == 0) || (recvsize == 0)) {
 		printf(svc_dg_str, svc_dg_err2);
+		CURVNET_RESTORE();
 		return (NULL);
 	}
 
@@ -124,6 +129,7 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	xprt->xp_ops = &svc_dg_ops;
 
 	error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
+	CURVNET_RESTORE();
 	if (error)
 		goto freedata;
 

Modified: stable/8/sys/rpc/svc_generic.c
==============================================================================
--- stable/8/sys/rpc/svc_generic.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/svc_generic.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -228,11 +230,14 @@ svc_tli_create(
 		/*
 		 * It is an open socket. Get the transport info.
 		 */
+		CURVNET_SET(so->so_vnet);
 		if (!__rpc_socket2sockinfo(so, &si)) {
 			printf(
 		"svc_tli_create: could not get transport information\n");
+			CURVNET_RESTORE();
 			return (NULL);
 		}
+		CURVNET_RESTORE();
 	}
 
 	/*
@@ -259,7 +264,9 @@ svc_tli_create(
 		"svc_tli_create: could not bind to requested address\n");
 				goto freedata;
 			}
+			CURVNET_SET(so->so_vnet);
 			solisten(so, (int)bindaddr->qlen, curthread);
+			CURVNET_RESTORE();
 		}
 			
 	}

Modified: stable/8/sys/rpc/svc_vc.c
==============================================================================
--- stable/8/sys/rpc/svc_vc.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/svc_vc.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -58,6 +58,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+
+#include 
+
 #include 
 
 #include 
@@ -151,9 +154,12 @@ svc_vc_create(SVCPOOL *pool, struct sock
 	xprt->xp_p2 = NULL;
 	xprt->xp_ops = &svc_vc_rendezvous_ops;
 
+	CURVNET_SET(so->so_vnet);
 	error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
-	if (error)
+	if (error) {
+		CURVNET_RESTORE();
 		goto cleanup_svc_vc_create;
+	}
 
 	memcpy(&xprt->xp_ltaddr, sa, sa->sa_len);
 	free(sa, M_SONAME);
@@ -161,6 +167,7 @@ svc_vc_create(SVCPOOL *pool, struct sock
 	xprt_register(xprt);
 
 	solisten(so, SOMAXCONN, curthread);
+	CURVNET_RESTORE();
 
 	SOCKBUF_LOCK(&so->so_rcv);
 	xprt->xp_upcallset = 1;
@@ -193,9 +200,12 @@ svc_vc_create_conn(SVCPOOL *pool, struct
 	opt.sopt_name = SO_KEEPALIVE;
 	opt.sopt_val = &one;
 	opt.sopt_valsize = sizeof(one);
+	CURVNET_SET(so->so_vnet);
 	error = sosetopt(so, &opt);
-	if (error)
+	if (error) {
+		CURVNET_RESTORE();
 		return (NULL);
+	}
 
 	if (so->so_proto->pr_protocol == IPPROTO_TCP) {
 		bzero(&opt, sizeof(struct sockopt));
@@ -205,9 +215,12 @@ svc_vc_create_conn(SVCPOOL *pool, struct
 		opt.sopt_val = &one;
 		opt.sopt_valsize = sizeof(one);
 		error = sosetopt(so, &opt);
-		if (error)
+		if (error) {
+			CURVNET_RESTORE();
 			return (NULL);
+		}
 	}
+	CURVNET_RESTORE();
 
 	cd = mem_alloc(sizeof(*cd));
 	cd->strm_stat = XPRT_IDLE;
@@ -625,8 +638,10 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
 		uio.uio_td = curthread;
 		m = NULL;
 		rcvflag = MSG_DONTWAIT;
+		CURVNET_SET(xprt->xp_socket->so_vnet);
 		error = soreceive(xprt->xp_socket, NULL, &uio, &m, NULL,
 		    &rcvflag);
+		CURVNET_RESTORE();
 
 		if (error == EWOULDBLOCK) {
 			/*

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 19:15:17 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D199F1065675;
	Fri, 28 Aug 2009 19:15:17 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BF6DC8FC14;
	Fri, 28 Aug 2009 19:15:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJFH1o033858;
	Fri, 28 Aug 2009 19:15:17 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJFHe6033856;
	Fri, 28 Aug 2009 19:15:17 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281915.n7SJFHe6033856@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:15:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196623 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:15:17 -0000

Author: zec
Date: Fri Aug 28 19:15:17 2009
New Revision: 196623
URL: http://svn.freebsd.org/changeset/base/196623

Log:
  MFC r196505:
  
    When "jail -c vnet" request fails, the current code actually creates and
    leaves behind an orphaned vnet.  This change ensures that such vnets get
    released.
  
    This change affects only options VIMAGE builds.
  
    Submitted by: jamie
    Discussed with:       bz
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_jail.c

Modified: stable/8/sys/kern/kern_jail.c
==============================================================================
--- stable/8/sys/kern/kern_jail.c	Fri Aug 28 19:12:44 2009	(r196622)
+++ stable/8/sys/kern/kern_jail.c	Fri Aug 28 19:15:17 2009	(r196623)
@@ -2456,7 +2456,7 @@ prison_deref(struct prison *pr, int flag
 		sx_downgrade(&allprison_lock);
 
 #ifdef VIMAGE
-		if (pr->pr_flags & PR_VNET)
+		if (pr->pr_vnet != ppr->pr_vnet)
 			vnet_destroy(pr->pr_vnet);
 #endif
 		if (pr->pr_root != NULL) {

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 19:18:21 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 67C0B106566C;
	Fri, 28 Aug 2009 19:18:21 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5597C8FC18;
	Fri, 28 Aug 2009 19:18:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJILls033982;
	Fri, 28 Aug 2009 19:18:21 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJIL9I033980;
	Fri, 28 Aug 2009 19:18:21 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281918.n7SJIL9I033980@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:18:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196624 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:18:21 -0000

Author: zec
Date: Fri Aug 28 19:18:20 2009
New Revision: 196624
URL: http://svn.freebsd.org/changeset/base/196624

Log:
  MFC r196504:
  
    When moving ifnets from one vnet to another, and the ifnet
    has ifaddresses of AF_LINK type which thus have an embedded
    if_index "backpointer", we must update that if_index backpointer
    to reflect the new if_index that our ifnet just got assigned.
  
    This change affects only options VIMAGE builds.
  
    Submitted by: bz
    Reviewed by:  bz
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 19:15:17 2009	(r196623)
+++ stable/8/sys/net/if.c	Fri Aug 28 19:18:20 2009	(r196624)
@@ -570,6 +570,21 @@ if_attach_internal(struct ifnet *ifp, in
 		/* Reliably crash if used uninitialized. */
 		ifp->if_broadcastaddr = NULL;
 	}
+#ifdef VIMAGE
+	else {
+		/*
+		 * Update the interface index in the link layer address
+		 * of the interface.
+		 */
+		for (ifa = ifp->if_addr; ifa != NULL;
+		    ifa = TAILQ_NEXT(ifa, ifa_link)) {
+			if (ifa->ifa_addr->sa_family == AF_LINK) {
+				sdl = (struct sockaddr_dl *)ifa->ifa_addr;
+				sdl->sdl_index = ifp->if_index;
+			}
+		}
+	}
+#endif
 
 	IFNET_WLOCK();
 	TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link);

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 19:48:07 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CE82106564A;
	Fri, 28 Aug 2009 19:48:07 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2B2878FC15;
	Fri, 28 Aug 2009 19:48:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJm6uR034606;
	Fri, 28 Aug 2009 19:48:06 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJm6PZ034604;
	Fri, 28 Aug 2009 19:48:06 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200908281948.n7SJm6PZ034604@svn.freebsd.org>
From: Xin LI 
Date: Fri, 28 Aug 2009 19:48:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196625 - in stable/8/lib/libc: . db/hash
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:48:07 -0000

Author: delphij
Date: Fri Aug 28 19:48:06 2009
New Revision: 196625
URL: http://svn.freebsd.org/changeset/base/196625

Log:
  MFC r196525:
  
  Consider flag == 0 as the same of flag == R_NEXT.  This change will restore
  a historical behavior that has been changed by revision 190491, and has seen
  to break exim.
  
  Approved by:	re (kib)

Modified:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/db/hash/hash.c

Modified: stable/8/lib/libc/db/hash/hash.c
==============================================================================
--- stable/8/lib/libc/db/hash/hash.c	Fri Aug 28 19:18:20 2009	(r196624)
+++ stable/8/lib/libc/db/hash/hash.c	Fri Aug 28 19:48:06 2009	(r196625)
@@ -711,7 +711,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *d
 		hashp->cndx = 1;
 		hashp->cpage = NULL;
 	}
- next_bucket:
+next_bucket:
 	for (bp = NULL; !bp || !bp[0]; ) {
 		if (!(bufp = hashp->cpage)) {
 			for (bucket = hashp->cbucket;
@@ -732,7 +732,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *d
 			}
 		} else {
 			bp = (u_int16_t *)hashp->cpage->page;
-			if (flag == R_NEXT) {
+			if (flag == R_NEXT || flag == 0) {
 				hashp->cndx += 2;
 				if (hashp->cndx > bp[0]) {
 					hashp->cpage = NULL;

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 20:06:02 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE61C1065670;
	Fri, 28 Aug 2009 20:06:02 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B90BE8FC15;
	Fri, 28 Aug 2009 20:06:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SK62ZD035098;
	Fri, 28 Aug 2009 20:06:02 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SK62cq035081;
	Fri, 28 Aug 2009 20:06:02 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282006.n7SK62cq035081@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 20:06:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196626 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris compat/linux contrib/altq/altq
	contrib/dev/acpica contrib/pf dev/xen/xenpci kern net
	netgraph netinet netinet6 ne...
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 20:06:02 -0000

Author: rwatson
Date: Fri Aug 28 20:06:02 2009
New Revision: 196626
URL: http://svn.freebsd.org/changeset/base/196626

Log:
  Merge r196481 from head to stable/8:
  
    Rework global locks for interface list and index management, correcting
    several critical bugs, including race conditions and lock order issues:
  
    Replace the single rwlock, ifnet_lock, with two locks, an rwlock and an
    sxlock.  Either can be held to stablize the lists and indexes, but both
    are required to write.  This allows the list to be held stable in both
    network interrupt contexts and sleepable user threads across sleeping
    memory allocations or device driver interactions.  As before, writes to
    the interface list must occur from sleepable contexts.
  
    Reviewed by:  bz, julian
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/compat/linux/linux_ioctl.c
  stable/8/sys/contrib/altq/altq/altq_subr.c
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_uuid.c
  stable/8/sys/net/bridgestp.c
  stable/8/sys/net/if.c
  stable/8/sys/net/if_llatbl.c
  stable/8/sys/net/if_var.h
  stable/8/sys/net/if_vlan.c
  stable/8/sys/netgraph/ng_gif.c
  stable/8/sys/netinet/in.c
  stable/8/sys/netinet6/icmp6.c
  stable/8/sys/netinet6/in6.c
  stable/8/sys/netinet6/in6_ifattach.c
  stable/8/sys/netinet6/nd6.c
  stable/8/sys/netipsec/xform_ipip.c
  stable/8/sys/nfsclient/bootp_subr.c

Modified: stable/8/sys/compat/linux/linux_ioctl.c
==============================================================================
--- stable/8/sys/compat/linux/linux_ioctl.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/compat/linux/linux_ioctl.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -2061,22 +2061,20 @@ linux_ifname(struct ifnet *ifp, char *bu
 	struct ifnet *ifscan;
 	int ethno;
 
+	IFNET_RLOCK_ASSERT();
+
 	/* Short-circuit non ethernet interfaces */
 	if (!IFP_IS_ETH(ifp))
 		return (strlcpy(buffer, ifp->if_xname, buflen));
 
 	/* Determine the (relative) unit number for ethernet interfaces */
 	ethno = 0;
-	IFNET_RLOCK();
 	TAILQ_FOREACH(ifscan, &V_ifnet, if_link) {
-		if (ifscan == ifp) {
-			IFNET_RUNLOCK();
+		if (ifscan == ifp)
 			return (snprintf(buffer, buflen, "eth%d", ethno));
-		}
 		if (IFP_IS_ETH(ifscan))
 			ethno++;
 	}
-	IFNET_RUNLOCK();
 
 	return (0);
 }
@@ -2177,7 +2175,7 @@ again:
 	valid_len = 0;
 
 	/* Return all AF_INET addresses of all interfaces */
-	IFNET_RLOCK();		/* could sleep XXX */
+	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		int addrs = 0;
 

Modified: stable/8/sys/contrib/altq/altq/altq_subr.c
==============================================================================
--- stable/8/sys/contrib/altq/altq/altq_subr.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/contrib/altq/altq/altq_subr.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -462,8 +462,8 @@ tbr_timeout(arg)
 	s = splimp();
 #endif
 #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
-	IFNET_RLOCK();
-	VNET_LIST_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
+	VNET_LIST_RLOCK_NOSLEEP();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
 #endif
@@ -480,8 +480,8 @@ tbr_timeout(arg)
 #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
 		CURVNET_RESTORE();
 	}
-	VNET_LIST_RUNLOCK();
-	IFNET_RUNLOCK();
+	VNET_LIST_RUNLOCK_NOSLEEP();
+	IFNET_RUNLOCK_NOSLEEP();
 #endif
 	splx(s);
 	if (active > 0)

Modified: stable/8/sys/kern/kern_uuid.c
==============================================================================
--- stable/8/sys/kern/kern_uuid.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/kern/kern_uuid.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -95,7 +95,7 @@ uuid_node(uint16_t *node)
 	int i;
 
 	CURVNET_SET(TD_TO_VNET(curthread));
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		/* Walk the address list */
 		IF_ADDR_LOCK(ifp);
@@ -106,14 +106,14 @@ uuid_node(uint16_t *node)
 				/* Got a MAC address. */
 				bcopy(LLADDR(sdl), node, UUID_NODE_LEN);
 				IF_ADDR_UNLOCK(ifp);
-				IFNET_RUNLOCK();
+				IFNET_RUNLOCK_NOSLEEP();
 				CURVNET_RESTORE();
 				return;
 			}
 		}
 		IF_ADDR_UNLOCK(ifp);
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	for (i = 0; i < (UUID_NODE_LEN>>1); i++)
 		node[i] = (uint16_t)arc4random();

Modified: stable/8/sys/net/bridgestp.c
==============================================================================
--- stable/8/sys/net/bridgestp.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/bridgestp.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -2019,7 +2019,7 @@ bstp_reinit(struct bstp_state *bs)
 	 * not need to be part of the bridge, it just needs to be a unique
 	 * value.
 	 */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (ifp->if_type != IFT_ETHER)
 			continue;
@@ -2036,7 +2036,7 @@ bstp_reinit(struct bstp_state *bs)
 			continue;
 		}
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	if (LIST_EMPTY(&bs->bs_bplist) || mif == NULL) {
 		/* Set the bridge and root id (lower bits) to zero */

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/if.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -154,14 +154,26 @@ VNET_DEFINE(struct ifgrouphead, ifg_head
 VNET_DEFINE(int, if_index);
 static VNET_DEFINE(int, if_indexlim) = 8;
 
-/* Table of ifnet by index.  Locked with ifnet_lock. */
+/* Table of ifnet by index. */
 static VNET_DEFINE(struct ifindex_entry *, ifindex_table);
 
 #define	V_if_indexlim		VNET(if_indexlim)
 #define	V_ifindex_table		VNET(ifindex_table)
 
 int	ifqmaxlen = IFQ_MAXLEN;
-struct rwlock ifnet_lock;
+
+/*
+ * The global network interface list (V_ifnet) and related state (such as
+ * if_index, if_indexlim, and ifindex_table) are protected by an sxlock and
+ * an rwlock.  Either may be acquired shared to stablize the list, but both
+ * must be acquired writable to modify the list.  This model allows us to
+ * both stablize the interface list during interrupt thread processing, but
+ * also to stablize it over long-running ioctls, without introducing priority
+ * inversions and deadlocks.
+ */
+struct rwlock ifnet_rwlock;
+struct sx ifnet_sxlock;
+
 static	if_com_alloc_t *if_com_alloc[256];
 static	if_com_free_t *if_com_free[256];
 
@@ -188,9 +200,9 @@ ifnet_byindex(u_short idx)
 {
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	ifp = ifnet_byindex_locked(idx);
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifp);
 }
 
@@ -199,19 +211,19 @@ ifnet_byindex_ref(u_short idx)
 {
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	ifp = ifnet_byindex_locked(idx);
 	if (ifp == NULL || (ifp->if_flags & IFF_DYING)) {
-		IFNET_RUNLOCK();
+		IFNET_RUNLOCK_NOSLEEP();
 		return (NULL);
 	}
 	if_ref(ifp);
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifp);
 }
 
 static void
-ifnet_setbyindex(u_short idx, struct ifnet *ifp)
+ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp)
 {
 
 	IFNET_WLOCK_ASSERT();
@@ -219,16 +231,25 @@ ifnet_setbyindex(u_short idx, struct ifn
 	V_ifindex_table[idx].ife_ifnet = ifp;
 }
 
+static void
+ifnet_setbyindex(u_short idx, struct ifnet *ifp)
+{
+
+	IFNET_WLOCK();
+	ifnet_setbyindex_locked(idx, ifp);
+	IFNET_WUNLOCK();
+}
+
 struct ifaddr *
 ifaddr_byindex(u_short idx)
 {
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	ifa = ifnet_byindex_locked(idx)->if_addr;
 	if (ifa != NULL)
 		ifa_ref(ifa);
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifa);
 }
 
@@ -361,9 +382,7 @@ if_alloc(u_char type)
 	ifq_init(&ifp->if_snd, ifp);
 
 	refcount_init(&ifp->if_refcount, 1);	/* Index reference. */
-	IFNET_WLOCK();
 	ifnet_setbyindex(ifp->if_index, ifp);
-	IFNET_WUNLOCK();
 	return (ifp);
 }
 
@@ -383,7 +402,7 @@ if_free_internal(struct ifnet *ifp)
 	KASSERT(ifp == ifnet_byindex_locked(ifp->if_index),
 	    ("%s: freeing unallocated ifnet", ifp->if_xname));
 
-	ifnet_setbyindex(ifp->if_index, NULL);
+	ifnet_setbyindex_locked(ifp->if_index, NULL);
 	while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL)
 		V_if_index--;
 	IFNET_WUNLOCK();
@@ -870,11 +889,14 @@ if_vmove(struct ifnet *ifp, struct vnet 
 	if_detach_internal(ifp, 1);
 
 	/*
-	 * Unlink the ifnet from ifindex_table[] in current vnet,
-	 * and shrink the if_index for that vnet if possible.
+	 * Unlink the ifnet from ifindex_table[] in current vnet, and shrink
+	 * the if_index for that vnet if possible.
+	 *
+	 * NOTE: IFNET_WLOCK/IFNET_WUNLOCK() are assumed to be unvirtualized,
+	 * or we'd lock on one vnet and unlock on another.
 	 */
 	IFNET_WLOCK();
-	ifnet_setbyindex(ifp->if_index, NULL);
+	ifnet_setbyindex_locked(ifp->if_index, NULL);
 	while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL)
 		V_if_index--;
 	IFNET_WUNLOCK();
@@ -901,7 +923,7 @@ if_vmove(struct ifnet *ifp, struct vnet 
 		V_if_index = ifp->if_index;
 	if (V_if_index >= V_if_indexlim)
 		if_grow();
-	ifnet_setbyindex(ifp->if_index, ifp);
+	ifnet_setbyindex_locked(ifp->if_index, ifp);
 	IFNET_WUNLOCK();
 
 	if_attach_internal(ifp, 1);
@@ -1383,7 +1405,7 @@ ifa_ifwithaddr_internal(struct sockaddr 
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -1410,7 +1432,7 @@ ifa_ifwithaddr_internal(struct sockaddr 
 	}
 	ifa = NULL;
 done:
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifa);
 }
 
@@ -1438,7 +1460,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -1457,7 +1479,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add
 	}
 	ifa = NULL;
 done:
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifa);
 }
 
@@ -1471,7 +1493,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr)
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
 			continue;
@@ -1490,7 +1512,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr)
 	}
 	ifa = NULL;
 done:
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifa);
 }
 
@@ -1523,7 +1545,7 @@ ifa_ifwithnet(struct sockaddr *addr)
 	 * we find one, as we release the IF_ADDR_LOCK() that kept it stable
 	 * when we move onto the next interface.
 	 */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -1599,7 +1621,7 @@ next:				continue;
 	ifa = ifa_maybe;
 	ifa_maybe = NULL;
 done:
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	if (ifa_maybe != NULL)
 		ifa_free(ifa_maybe);
 	return (ifa);
@@ -1878,7 +1900,7 @@ if_slowtimo(void *arg)
 	int s = splimp();
 
 	VNET_LIST_RLOCK_NOSLEEP();
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
 		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
@@ -1889,7 +1911,7 @@ if_slowtimo(void *arg)
 		}
 		CURVNET_RESTORE();
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	VNET_LIST_RUNLOCK_NOSLEEP();
 	splx(s);
 	timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ);
@@ -1904,7 +1926,7 @@ ifunit_ref(const char *name)
 {
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0 &&
 		    !(ifp->if_flags & IFF_DYING))
@@ -1912,7 +1934,7 @@ ifunit_ref(const char *name)
 	}
 	if (ifp != NULL)
 		if_ref(ifp);
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifp);
 }
 
@@ -1921,12 +1943,12 @@ ifunit(const char *name)
 {
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0)
 			break;
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifp);
 }
 
@@ -2536,7 +2558,7 @@ again:
 	max_len = 0;
 	valid_len = 0;
 
-	IFNET_RLOCK();		/* could sleep XXX */
+	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		int addrs;
 
@@ -2861,13 +2883,13 @@ if_delmulti(struct ifnet *ifp, struct so
 #ifdef INVARIANTS
 	struct ifnet *oifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(oifp, &V_ifnet, if_link)
 		if (ifp == oifp)
 			break;
 	if (ifp != oifp)
 		ifp = NULL;
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	KASSERT(ifp != NULL, ("%s: ifnet went away", __func__));
 #endif
@@ -2910,7 +2932,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm
 	} else {
 		struct ifnet *oifp;
 
-		IFNET_RLOCK();
+		IFNET_RLOCK_NOSLEEP();
 		TAILQ_FOREACH(oifp, &V_ifnet, if_link)
 			if (ifp == oifp)
 				break;
@@ -2918,7 +2940,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm
 			printf("%s: ifnet %p disappeared\n", __func__, ifp);
 			ifp = NULL;
 		}
-		IFNET_RUNLOCK();
+		IFNET_RUNLOCK_NOSLEEP();
 	}
 #endif
 	/*

Modified: stable/8/sys/net/if_llatbl.c
==============================================================================
--- stable/8/sys/net/if_llatbl.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/if_llatbl.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -200,14 +200,14 @@ lltable_prefix_free(int af, struct socka
 {
 	struct lltable *llt;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af != af)
 			continue;
 
 		llt->llt_prefix_free(llt, prefix, mask);
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 }
 
 
@@ -300,13 +300,13 @@ lla_rt_output(struct rt_msghdr *rtm, str
 	}
 
 	/* XXX linked list may be too expensive */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af == dst->sa_family &&
 		    llt->llt_ifp == ifp)
 			break;
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n"));
 
 	if (flags && LLE_CREATE)

Modified: stable/8/sys/net/if_var.h
==============================================================================
--- stable/8/sys/net/if_var.h	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/if_var.h	Fri Aug 28 20:06:02 2009	(r196626)
@@ -85,6 +85,7 @@ struct	vnet;
 #include 		/* XXX */
 #include 		/* XXX */
 #include 		/* XXX */
+#include 		/* XXX */
 #include 		/* XXX */
 #include 
 
@@ -754,14 +755,39 @@ struct ifmultiaddr {
 
 #ifdef _KERNEL
 
-extern	struct rwlock ifnet_lock;
-#define	IFNET_LOCK_INIT() \
-   rw_init_flags(&ifnet_lock, "ifnet",  RW_RECURSE)
-#define	IFNET_WLOCK()		rw_wlock(&ifnet_lock)
-#define	IFNET_WUNLOCK()		rw_wunlock(&ifnet_lock)
-#define	IFNET_WLOCK_ASSERT()	rw_assert(&ifnet_lock, RA_LOCKED)
-#define	IFNET_RLOCK()		rw_rlock(&ifnet_lock)
-#define	IFNET_RUNLOCK()		rw_runlock(&ifnet_lock)	
+extern	struct rwlock ifnet_rwlock;
+extern	struct sx ifnet_sxlock;
+
+#define	IFNET_LOCK_INIT() do {						\
+	rw_init_flags(&ifnet_rwlock, "ifnet_rw",  RW_RECURSE);		\
+	sx_init_flags(&ifnet_sxlock, "ifnet_sx",  SX_RECURSE);		\
+} while(0)
+
+#define	IFNET_WLOCK() do {						\
+	sx_xlock(&ifnet_sxlock);					\
+	rw_wlock(&ifnet_rwlock);					\
+} while (0)
+
+#define	IFNET_WUNLOCK() do {						\
+	rw_wunlock(&ifnet_rwlock);					\
+	sx_xunlock(&ifnet_sxlock);					\
+} while (0)
+
+/*
+ * To assert the ifnet lock, you must know not only whether it's for read or
+ * write, but also whether it was acquired with sleep support or not.
+ */
+#define	IFNET_RLOCK_ASSERT()		sx_assert(&ifnet_sxlock, SA_SLOCKED)
+#define	IFNET_RLOCK_NOSLEEP_ASSERT()	rw_assert(&ifnet_rwlock, RA_RLOCKED)
+#define	IFNET_WLOCK_ASSERT() do {					\
+	sx_assert(&ifnet_sxlock, SA_XLOCKED);				\
+	rw_assert(&ifnet_rwlock, RA_WLOCKED);				\
+} while (0)
+
+#define	IFNET_RLOCK()		sx_slock(&ifnet_sxlock)
+#define	IFNET_RLOCK_NOSLEEP()	rw_rlock(&ifnet_rwlock)
+#define	IFNET_RUNLOCK()		sx_sunlock(&ifnet_sxlock)
+#define	IFNET_RUNLOCK_NOSLEEP()	rw_runlock(&ifnet_rwlock)
 
 /*
  * Look up an ifnet given its index; the _ref variant also acquires a

Modified: stable/8/sys/net/if_vlan.c
==============================================================================
--- stable/8/sys/net/if_vlan.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/if_vlan.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -580,7 +580,7 @@ vlan_clone_match_ethertag(struct if_clon
 	int t = 0;
 
 	/* Check for . style interface names. */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (ifp->if_type != IFT_ETHER)
 			continue;
@@ -598,7 +598,7 @@ vlan_clone_match_ethertag(struct if_clon
 			*tag = t;
 		break;
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	return (ifp);
 }

Modified: stable/8/sys/netgraph/ng_gif.c
==============================================================================
--- stable/8/sys/netgraph/ng_gif.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netgraph/ng_gif.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -560,7 +560,7 @@ ng_gif_mod_event(module_t mod, int event
 		ng_gif_input_orphan_p = ng_gif_input_orphan;
 
 		/* Create nodes for any already-existing gif interfaces */
-		VNET_LIST_RLOCK_NOSLEEP();
+		VNET_LIST_RLOCK();
 		IFNET_RLOCK();
 		VNET_FOREACH(vnet_iter) {
 			CURVNET_SET_QUIET(vnet_iter); /* XXX revisit quiet */
@@ -571,7 +571,7 @@ ng_gif_mod_event(module_t mod, int event
 			CURVNET_RESTORE();
 		}
 		IFNET_RUNLOCK();
-		VNET_LIST_RUNLOCK_NOSLEEP();
+		VNET_LIST_RUNLOCK();
 		break;
 
 	case MOD_UNLOAD:

Modified: stable/8/sys/netinet/in.c
==============================================================================
--- stable/8/sys/netinet/in.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet/in.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -1407,12 +1407,7 @@ in_lltable_dump(struct lltable *llt, str
 	} arpc;
 	int error, i;
 
-	/* XXXXX
-	 * current IFNET_RLOCK() is mapped to IFNET_WLOCK()
-	 * so it is okay to use this ASSERT, change it when
-	 * IFNET lock is finalized
-	 */
-	IFNET_WLOCK_ASSERT();
+	IFNET_RLOCK_ASSERT();
 
 	error = 0;
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {

Modified: stable/8/sys/netinet6/icmp6.c
==============================================================================
--- stable/8/sys/netinet6/icmp6.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet6/icmp6.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -1705,7 +1705,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
 		}
 	}
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
 		addrsofif = 0;
 		IF_ADDR_LOCK(ifp);
@@ -1762,13 +1762,13 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
 		IF_ADDR_UNLOCK(ifp);
 		if (iffound) {
 			*ifpp = ifp;
-			IFNET_RUNLOCK();
+			IFNET_RUNLOCK_NOSLEEP();
 			return (addrsofif);
 		}
 
 		addrs += addrsofif;
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	return (addrs);
 }
@@ -1789,7 +1789,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 	if (ifp0 == NULL && !(niflags & NI_NODEADDR_FLAG_ALL))
 		return (0);	/* needless to copy */
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
   again:
 
 	for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
@@ -1854,7 +1854,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 				 * Set the truncate flag and return.
 				 */
 				nni6->ni_flags |= NI_NODEADDR_FLAG_TRUNCATE;
-				IFNET_RUNLOCK();
+				IFNET_RUNLOCK_NOSLEEP();
 				return (copied);
 			}
 
@@ -1907,7 +1907,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 		goto again;
 	}
 
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	return (copied);
 }

Modified: stable/8/sys/netinet6/in6.c
==============================================================================
--- stable/8/sys/netinet6/in6.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet6/in6.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -2234,7 +2234,7 @@ in6_setmaxmtu(void)
 	unsigned long maxmtu = 0;
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
 	    ifp = TAILQ_NEXT(ifp, if_list)) {
 		/* this function can be called during ifnet initialization */
@@ -2244,7 +2244,7 @@ in6_setmaxmtu(void)
 		    IN6_LINKMTU(ifp) > maxmtu)
 			maxmtu = IN6_LINKMTU(ifp);
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	if (maxmtu)	     /* update only when maxmtu is positive */
 		V_in6_maxmtu = maxmtu;
 }
@@ -2495,12 +2495,7 @@ in6_lltable_dump(struct lltable *llt, st
 	} ndpc;
 	int i, error;
 
-	/* XXXXX
-	 * current IFNET_RLOCK() is mapped to IFNET_WLOCK()
-	 * so it is okay to use this ASSERT, change it when
-	 * IFNET lock is finalized
-	 */
-	IFNET_WLOCK_ASSERT();
+	IFNET_RLOCK_ASSERT();
 
 	error = 0;
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {

Modified: stable/8/sys/netinet6/in6_ifattach.c
==============================================================================
--- stable/8/sys/netinet6/in6_ifattach.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet6/in6_ifattach.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -398,7 +398,7 @@ get_ifid(struct ifnet *ifp0, struct ifne
 	}
 
 	/* next, try to get it from some other hardware interface */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	for (ifp = V_ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) {
 		if (ifp == ifp0)
 			continue;
@@ -413,11 +413,11 @@ get_ifid(struct ifnet *ifp0, struct ifne
 			nd6log((LOG_DEBUG,
 			    "%s: borrow interface identifier from %s\n",
 			    if_name(ifp0), if_name(ifp)));
-			IFNET_RUNLOCK();
+			IFNET_RUNLOCK_NOSLEEP();
 			goto success;
 		}
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	/* last resort: get from random number source */
 	if (get_rand_ifid(ifp, in6) == 0) {

Modified: stable/8/sys/netinet6/nd6.c
==============================================================================
--- stable/8/sys/netinet6/nd6.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet6/nd6.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -1662,7 +1662,7 @@ nd6_slowtimo(void *arg)
 
 	callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
 	    nd6_slowtimo, curvnet);
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
 	    ifp = TAILQ_NEXT(ifp, if_list)) {
 		nd6if = ND_IFINFO(ifp);
@@ -1678,7 +1678,7 @@ nd6_slowtimo(void *arg)
 			nd6if->reachable = ND_COMPUTE_RTIME(nd6if->basereachable);
 		}
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	CURVNET_RESTORE();
 }
 

Modified: stable/8/sys/netipsec/xform_ipip.c
==============================================================================
--- stable/8/sys/netipsec/xform_ipip.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netipsec/xform_ipip.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -303,7 +303,7 @@ _ipip_input(struct mbuf *m, int iphlen, 
 	if ((m->m_pkthdr.rcvif == NULL ||
 	    !(m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK)) &&
 	    V_ipip_allow != 2) {
-	    	IFNET_RLOCK();
+	    	IFNET_RLOCK_NOSLEEP();
 		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
 #ifdef INET
@@ -318,7 +318,7 @@ _ipip_input(struct mbuf *m, int iphlen, 
 					    ipo->ip_src.s_addr)	{
 						V_ipipstat.ipips_spoof++;
 						m_freem(m);
-						IFNET_RUNLOCK();
+						IFNET_RUNLOCK_NOSLEEP();
 						return;
 					}
 				}
@@ -335,7 +335,7 @@ _ipip_input(struct mbuf *m, int iphlen, 
 					if (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &ip6->ip6_src)) {
 						V_ipipstat.ipips_spoof++;
 						m_freem(m);
-						IFNET_RUNLOCK();
+						IFNET_RUNLOCK_NOSLEEP();
 						return;
 					}
 
@@ -343,7 +343,7 @@ _ipip_input(struct mbuf *m, int iphlen, 
 #endif /* INET6 */
 			}
 		}
-		IFNET_RUNLOCK();
+		IFNET_RUNLOCK_NOSLEEP();
 	}
 
 	/* Statistics */

Modified: stable/8/sys/nfsclient/bootp_subr.c
==============================================================================
--- stable/8/sys/nfsclient/bootp_subr.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/nfsclient/bootp_subr.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -389,7 +389,7 @@ bootpboot_p_iflist(void)
 	struct ifaddr *ifa;
 
 	printf("Interface list:\n");
-	IFNET_RLOCK(); /* could sleep, but okay for debugging XXX */
+	IFNET_RLOCK();
 	for (ifp = TAILQ_FIRST(&V_ifnet);
 	     ifp != NULL;
 	     ifp = TAILQ_NEXT(ifp, if_link)) {

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 20:07:39 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 060B41065670;
	Fri, 28 Aug 2009 20:07:39 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD6D68FC16;
	Fri, 28 Aug 2009 20:07:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SK7cgW035168;
	Fri, 28 Aug 2009 20:07:38 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SK7cxk035166;
	Fri, 28 Aug 2009 20:07:38 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282007.n7SK7cxk035166@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 20:07:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196627 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 20:07:39 -0000

Author: rwatson
Date: Fri Aug 28 20:07:38 2009
New Revision: 196627
URL: http://svn.freebsd.org/changeset/base/196627

Log:
  Merge r196482 from head to stable/8:
  
    Rather than using IFNET_RLOCK() when iterating over (and modifying) the
    ifnet list during if_ef load, directly acquire the ifnet_sxlock
    exclusively.  That way when if_alloc() recurses the lock, it's a write
    recursion rather than a read->write recursion.
  
    This code structure is arguably a bug, so add a comment indicating that
    this is the case.  Post-8.0, we should fix this, but this commit
    resolves panic-on-load for if_ef.
  
    Discussed with:       bz, julian
    Reported by:  phk
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if_ef.c

Modified: stable/8/sys/net/if_ef.c
==============================================================================
--- stable/8/sys/net/if_ef.c	Fri Aug 28 20:06:02 2009	(r196626)
+++ stable/8/sys/net/if_ef.c	Fri Aug 28 20:07:38 2009	(r196627)
@@ -492,7 +492,20 @@ ef_load(void)
 	VNET_LIST_RLOCK();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
-		IFNET_RLOCK();
+
+		/*
+		 * XXXRW: The following loop walks the ifnet list while
+		 * modifying it, something not well-supported by ifnet
+		 * locking.  To avoid lock upgrade/recursion issues, manually
+		 * acquire a write lock of ifnet_sxlock here, rather than a
+		 * read lock, so that when if_alloc() recurses the lock, we
+		 * don't panic.  This structure, in which if_ef automatically
+		 * attaches to all ethernet interfaces, should be replaced
+		 * with a model like that found in if_vlan, in which
+		 * interfaces are explicitly configured, which would avoid
+		 * this (and other) problems.
+		 */
+		sx_xlock(&ifnet_sxlock);
 		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 			if (ifp->if_type != IFT_ETHER) continue;
 			EFDEBUG("Found interface %s\n", ifp->if_xname);
@@ -523,7 +536,7 @@ ef_load(void)
 			efcount++;
 			SLIST_INSERT_HEAD(&efdev, efl, el_next);
 		}
-		IFNET_RUNLOCK();
+		sx_xunlock(&ifnet_sxlock);
 		CURVNET_RESTORE();
 	}
 	VNET_LIST_RUNLOCK();

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 20:26:00 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B212F106564A;
	Fri, 28 Aug 2009 20:26:00 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9EA8B8FC0A;
	Fri, 28 Aug 2009 20:26:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SKQ0lq035575;
	Fri, 28 Aug 2009 20:26:00 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SKQ0Oc035573;
	Fri, 28 Aug 2009 20:26:00 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908282026.n7SKQ0Oc035573@svn.freebsd.org>
From: Max Laier 
Date: Fri, 28 Aug 2009 20:26:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196628 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	contrib/pf/net dev/xen/xenpci
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 20:26:00 -0000

Author: mlaier
Date: Fri Aug 28 20:26:00 2009
New Revision: 196628
URL: http://svn.freebsd.org/changeset/base/196628

Log:
  MFC r196551:
    Fix argument ordering to memcpy as well as the size of the copy in the
    (theoretical) case that pfi_buffer_cnt should be greater than ~_max.
  
    Submitted by:	pjd
    Reviewed by:	{krw,sthen,markus}@openbsd.org
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/contrib/pf/net/pf_if.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/contrib/pf/net/pf_if.c
==============================================================================
--- stable/8/sys/contrib/pf/net/pf_if.c	Fri Aug 28 20:07:38 2009	(r196627)
+++ stable/8/sys/contrib/pf/net/pf_if.c	Fri Aug 28 20:26:00 2009	(r196628)
@@ -663,7 +663,7 @@ pfi_address_add(struct sockaddr *sa, int
 			    "(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX);
 			return;
 		}
-		memcpy(pfi_buffer, p, pfi_buffer_cnt * sizeof(*pfi_buffer));
+		memcpy(p, pfi_buffer, pfi_buffer_max * sizeof(*pfi_buffer));
 		/* no need to zero buffer */
 		free(pfi_buffer, PFI_MTYPE);
 		pfi_buffer = p;

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 21:07:47 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 01D731065672;
	Fri, 28 Aug 2009 21:07:47 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C8C7E8FC17;
	Fri, 28 Aug 2009 21:07:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SL7kBU036514;
	Fri, 28 Aug 2009 21:07:46 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SL7j7b036513;
	Fri, 28 Aug 2009 21:07:45 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282107.n7SL7j7b036513@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 21:07:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196629 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 21:07:47 -0000

Author: rwatson
Date: Fri Aug 28 21:07:43 2009
New Revision: 196629
URL: http://svn.freebsd.org/changeset/base/196629

Log:
  Merge r196510 from head to stable/8:
  
    Make if_grow static -- it's not used outside of if.c, and with the
    internals destined to change, it's better if it remains that way.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c
  stable/8/sys/net/if_var.h

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 20:26:00 2009	(r196628)
+++ stable/8/sys/net/if.c	Fri Aug 28 21:07:43 2009	(r196629)
@@ -124,6 +124,7 @@ static void	if_attachdomain1(struct ifne
 static int	ifconf(u_long, caddr_t);
 static void	if_freemulti(struct ifmultiaddr *);
 static void	if_init(void *);
+static void	if_grow(void);
 static void	if_check(void *);
 static void	if_route(struct ifnet *, int flag, int fam);
 static int	if_setflag(struct ifnet *, int, int, int *, int);
@@ -297,7 +298,7 @@ VNET_SYSUNINIT(vnet_if_uninit, SI_SUB_IN
     vnet_if_uninit, NULL);
 #endif
 
-void
+static void
 if_grow(void)
 {
 	u_int n;

Modified: stable/8/sys/net/if_var.h
==============================================================================
--- stable/8/sys/net/if_var.h	Fri Aug 28 20:26:00 2009	(r196628)
+++ stable/8/sys/net/if_var.h	Fri Aug 28 21:07:43 2009	(r196629)
@@ -826,7 +826,6 @@ int	if_allmulti(struct ifnet *, int);
 struct	ifnet* if_alloc(u_char);
 void	if_attach(struct ifnet *);
 void	if_dead(struct ifnet *);
-void	if_grow(void);
 int	if_delmulti(struct ifnet *, struct sockaddr *);
 void	if_delmulti_ifma(struct ifmultiaddr *);
 void	if_detach(struct ifnet *);

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 21:10:27 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CBE61065670;
	Fri, 28 Aug 2009 21:10:27 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 288E98FC08;
	Fri, 28 Aug 2009 21:10:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SLAR7g036623;
	Fri, 28 Aug 2009 21:10:27 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SLAQpi036619;
	Fri, 28 Aug 2009 21:10:26 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282110.n7SLAQpi036619@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 21:10:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196630 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net netinet netinet6
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 21:10:27 -0000

Author: rwatson
Date: Fri Aug 28 21:10:26 2009
New Revision: 196630
URL: http://svn.freebsd.org/changeset/base/196630

Log:
  Merge r196535 from head to stable/8:
  
    Use locks specific to the lltable code, rather than borrow the ifnet
    list/index locks, to protect link layer address tables.  This avoids
    lock order issues during interface teardown, but maintains the bug that
    sysctl copy routines may be called while a non-sleepable lock is held.
  
    Reviewed by:  bz, kmacy, qingli
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if_llatbl.c
  stable/8/sys/net/if_llatbl.h
  stable/8/sys/netinet/in.c
  stable/8/sys/netinet6/in6.c

Modified: stable/8/sys/net/if_llatbl.c
==============================================================================
--- stable/8/sys/net/if_llatbl.c	Fri Aug 28 21:07:43 2009	(r196629)
+++ stable/8/sys/net/if_llatbl.c	Fri Aug 28 21:10:26 2009	(r196630)
@@ -62,6 +62,9 @@ static	SLIST_HEAD(, lltable) lltables = 
 extern void arprequest(struct ifnet *, struct in_addr *, struct in_addr *,
 	u_char *);
 
+struct rwlock lltable_rwlock;
+RW_SYSINIT(lltable_rwlock, &lltable_rwlock, "lltable_rwlock");
+
 /*
  * Dump arp state for a specific address family.
  */
@@ -71,7 +74,7 @@ lltable_sysctl_dumparp(int af, struct sy
 	struct lltable *llt;
 	int error = 0;
 
-	IFNET_RLOCK();
+	LLTABLE_RLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af == af) {
 			error = llt->llt_dump(llt, wr);
@@ -80,7 +83,7 @@ lltable_sysctl_dumparp(int af, struct sy
 		}
 	}
 done:
-	IFNET_RUNLOCK();
+	LLTABLE_RUNLOCK();
 	return (error);
 }
 
@@ -144,8 +147,6 @@ llentry_update(struct llentry **llep, st
 
 /*
  * Free all entries from given table and free itself.
- * Since lltables collects from all of the intefaces,
- * the caller of this function must acquire IFNET_WLOCK().
  */
 void
 lltable_free(struct lltable *llt)
@@ -155,9 +156,9 @@ lltable_free(struct lltable *llt)
 
 	KASSERT(llt != NULL, ("%s: llt is NULL", __func__));
 
-	IFNET_WLOCK();
+	LLTABLE_WLOCK();
 	SLIST_REMOVE(&lltables, llt, lltable, llt_link);
-	IFNET_WUNLOCK();
+	LLTABLE_WUNLOCK();
 
 	for (i=0; i < LLTBL_HASHTBL_SIZE; i++) {
 		LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) {
@@ -178,7 +179,7 @@ lltable_drain(int af)
 	struct llentry	*lle;
 	register int i;
 
-	IFNET_RLOCK();
+	LLTABLE_RLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af != af)
 			continue;
@@ -192,7 +193,7 @@ lltable_drain(int af)
 			}
 		}
 	}
-	IFNET_RUNLOCK();
+	LLTABLE_RUNLOCK();
 }
 
 void
@@ -200,14 +201,14 @@ lltable_prefix_free(int af, struct socka
 {
 	struct lltable *llt;
 
-	IFNET_RLOCK_NOSLEEP();
+	LLTABLE_RLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af != af)
 			continue;
 
 		llt->llt_prefix_free(llt, prefix, mask);
 	}
-	IFNET_RUNLOCK_NOSLEEP();
+	LLTABLE_RUNLOCK();
 }
 
 
@@ -230,9 +231,9 @@ lltable_init(struct ifnet *ifp, int af)
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++)
 		LIST_INIT(&llt->lle_head[i]);
 
-	IFNET_WLOCK();
+	LLTABLE_WLOCK();
 	SLIST_INSERT_HEAD(&lltables, llt, llt_link);
-	IFNET_WUNLOCK();
+	LLTABLE_WUNLOCK();
 
 	return (llt);
 }
@@ -300,13 +301,13 @@ lla_rt_output(struct rt_msghdr *rtm, str
 	}
 
 	/* XXX linked list may be too expensive */
-	IFNET_RLOCK_NOSLEEP();
+	LLTABLE_RLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af == dst->sa_family &&
 		    llt->llt_ifp == ifp)
 			break;
 	}
-	IFNET_RUNLOCK_NOSLEEP();
+	LLTABLE_RUNLOCK();
 	KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n"));
 
 	if (flags && LLE_CREATE)

Modified: stable/8/sys/net/if_llatbl.h
==============================================================================
--- stable/8/sys/net/if_llatbl.h	Fri Aug 28 21:07:43 2009	(r196629)
+++ stable/8/sys/net/if_llatbl.h	Fri Aug 28 21:10:26 2009	(r196630)
@@ -41,6 +41,13 @@ struct rt_addrinfo;
 struct llentry;
 LIST_HEAD(llentries, llentry);
 
+extern struct rwlock lltable_rwlock;
+#define	LLTABLE_RLOCK()		rw_rlock(&lltable_rwlock)
+#define	LLTABLE_RUNLOCK()	rw_runlock(&lltable_rwlock)
+#define	LLTABLE_WLOCK()		rw_wlock(&lltable_rwlock)
+#define	LLTABLE_WUNLOCK()	rw_wunlock(&lltable_rwlock)
+#define	LLTABLE_LOCK_ASSERT()	rw_assert(&lltable_rwlock, RA_LOCKED)
+
 /*
  * Code referencing llentry must at least hold
  * a shared lock

Modified: stable/8/sys/netinet/in.c
==============================================================================
--- stable/8/sys/netinet/in.c	Fri Aug 28 21:07:43 2009	(r196629)
+++ stable/8/sys/netinet/in.c	Fri Aug 28 21:10:26 2009	(r196630)
@@ -1407,7 +1407,7 @@ in_lltable_dump(struct lltable *llt, str
 	} arpc;
 	int error, i;
 
-	IFNET_RLOCK_ASSERT();
+	LLTABLE_LOCK_ASSERT();
 
 	error = 0;
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {

Modified: stable/8/sys/netinet6/in6.c
==============================================================================
--- stable/8/sys/netinet6/in6.c	Fri Aug 28 21:07:43 2009	(r196629)
+++ stable/8/sys/netinet6/in6.c	Fri Aug 28 21:10:26 2009	(r196630)
@@ -2495,7 +2495,7 @@ in6_lltable_dump(struct lltable *llt, st
 	} ndpc;
 	int i, error;
 
-	IFNET_RLOCK_ASSERT();
+	LLTABLE_LOCK_ASSERT();
 
 	error = 0;
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 21:12:39 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51C0F106566B;
	Fri, 28 Aug 2009 21:12:39 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3987E8FC1E;
	Fri, 28 Aug 2009 21:12:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SLCdiJ036720;
	Fri, 28 Aug 2009 21:12:39 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SLCdeP036718;
	Fri, 28 Aug 2009 21:12:39 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282112.n7SLCdeP036718@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 21:12:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196631 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 21:12:39 -0000

Author: rwatson
Date: Fri Aug 28 21:12:38 2009
New Revision: 196631
URL: http://svn.freebsd.org/changeset/base/196631

Log:
  Merge r196553 from head to stable/8:
  
    Break out allocation of new ifindex values from if_alloc() and if_vmove(),
    and centralize in a single function ifindex_alloc().  Assert the
    IFNET_WLOCK, and add missing IFNET_WLOCK in if_alloc().  This does not
    close all known races in this code.
  
    Reviewed by:  bz
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 21:10:26 2009	(r196630)
+++ stable/8/sys/net/if.c	Fri Aug 28 21:12:38 2009	(r196631)
@@ -223,6 +223,37 @@ ifnet_byindex_ref(u_short idx)
 	return (ifp);
 }
 
+/*
+ * Allocate an ifindex array entry; return 0 on success or an error on
+ * failure.
+ */
+static int
+ifindex_alloc(u_short *idxp)
+{
+	u_short idx;
+
+	IFNET_WLOCK_ASSERT();
+
+	/*
+	 * Try to find an empty slot below if_index.  If we fail, take the
+	 * next slot.
+	 */
+	for (idx = 1; idx <= V_if_index; idx++) {
+		if (ifnet_byindex_locked(idx) == NULL)
+			break;
+	}
+
+	/* Catch if_index overflow. */
+	if (idx < 1)
+		return (ENOSPC);
+	if (idx > V_if_index)
+		V_if_index = idx;
+	if (V_if_index >= V_if_indexlim)
+		if_grow();
+	*idxp = idx;
+	return (0);
+}
+
 static void
 ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp)
 {
@@ -335,32 +366,19 @@ struct ifnet *
 if_alloc(u_char type)
 {
 	struct ifnet *ifp;
+	u_short idx;
 
 	ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO);
-
-	/*
-	 * Try to find an empty slot below if_index.  If we fail, take
-	 * the next slot.
-	 *
-	 * XXX: should be locked!
-	 */
-	for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) {
-		if (ifnet_byindex(ifp->if_index) == NULL)
-			break;
-	}
-	/* Catch if_index overflow. */
-	if (ifp->if_index < 1) {
+	IFNET_WLOCK();
+	if (ifindex_alloc(&idx) != 0) {
+		IFNET_WUNLOCK();
 		free(ifp, M_IFNET);
 		return (NULL);
 	}
-	if (ifp->if_index > V_if_index)
-		V_if_index = ifp->if_index;
-	if (V_if_index >= V_if_indexlim)
-		if_grow();
-
+	IFNET_WUNLOCK();
+	ifp->if_index = idx;
 	ifp->if_type = type;
 	ifp->if_alloctype = type;
-
 	if (if_com_alloc[type] != NULL) {
 		ifp->if_l2com = if_com_alloc[type](type, ifp);
 		if (ifp->if_l2com == NULL) {
@@ -882,6 +900,7 @@ if_detach_internal(struct ifnet *ifp, in
 void
 if_vmove(struct ifnet *ifp, struct vnet *new_vnet)
 {
+	u_short idx;
 
 	/*
 	 * Detach from current vnet, but preserve LLADDR info, do not
@@ -907,23 +926,12 @@ if_vmove(struct ifnet *ifp, struct vnet 
 	 */
 	CURVNET_SET_QUIET(new_vnet);
 
-	/*
-	 * Try to find an empty slot below if_index.  If we fail, take 
-	 * the next slot.
-	 */
 	IFNET_WLOCK();
-	for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) {
-		if (ifnet_byindex_locked(ifp->if_index) == NULL)
-			break;
-	}
-	/* Catch if_index overflow. */
-	if (ifp->if_index < 1)
+	if (ifindex_alloc(&idx) != 0) {
+		IFNET_WUNLOCK();
 		panic("if_index overflow");
-
-	if (ifp->if_index > V_if_index)
-		V_if_index = ifp->if_index;
-	if (V_if_index >= V_if_indexlim)
-		if_grow();
+	}
+	ifp->if_index = idx;
 	ifnet_setbyindex_locked(ifp->if_index, ifp);
 	IFNET_WUNLOCK();
 

From owner-svn-src-stable@FreeBSD.ORG  Fri Aug 28 21:14:05 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 437F11065672;
	Fri, 28 Aug 2009 21:14:05 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2FF668FC1C;
	Fri, 28 Aug 2009 21:14:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SLE5d6036793;
	Fri, 28 Aug 2009 21:14:05 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SLE5m6036791;
	Fri, 28 Aug 2009 21:14:05 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282114.n7SLE5m6036791@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 21:14:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196632 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 21:14:05 -0000

Author: rwatson
Date: Fri Aug 28 21:14:04 2009
New Revision: 196632
URL: http://svn.freebsd.org/changeset/base/196632

Log:
  Merge r196559 from head to stable/8:
  
    Add IFNET_HOLD reserved pointer value for the ifindex ifnet array,
    which allows an index to be reserved for an ifnet without making
    the ifnet available for management operations.  Use this in if_alloc()
    while the ifnet lock is released between initial index allocation and
    completion of ifnet initialization.
  
    Add ifindex_free() to centralize the implementation of releasing an
    ifindex value.  Use in if_free() and if_vmove(), as well as when
    releasing a held index in if_alloc().
  
    Reviewed by:  bz
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 21:12:38 2009	(r196631)
+++ stable/8/sys/net/if.c	Fri Aug 28 21:14:04 2009	(r196632)
@@ -175,6 +175,13 @@ int	ifqmaxlen = IFQ_MAXLEN;
 struct rwlock ifnet_rwlock;
 struct sx ifnet_sxlock;
 
+/*
+ * The allocation of network interfaces is a rather non-atomic affair; we
+ * need to select an index before we are ready to expose the interface for
+ * use, so will use this pointer value to indicate reservation.
+ */
+#define	IFNET_HOLD	(void *)(uintptr_t)(-1)
+
 static	if_com_alloc_t *if_com_alloc[256];
 static	if_com_free_t *if_com_free[256];
 
@@ -193,6 +200,8 @@ ifnet_byindex_locked(u_short idx)
 
 	if (idx > V_if_index)
 		return (NULL);
+	if (V_ifindex_table[idx].ife_ifnet == IFNET_HOLD)
+		return (NULL);
 	return (V_ifindex_table[idx].ife_ifnet);
 }
 
@@ -228,18 +237,18 @@ ifnet_byindex_ref(u_short idx)
  * failure.
  */
 static int
-ifindex_alloc(u_short *idxp)
+ifindex_alloc_locked(u_short *idxp)
 {
 	u_short idx;
 
 	IFNET_WLOCK_ASSERT();
 
 	/*
-	 * Try to find an empty slot below if_index.  If we fail, take the
+	 * Try to find an empty slot below V_if_index.  If we fail, take the
 	 * next slot.
 	 */
 	for (idx = 1; idx <= V_if_index; idx++) {
-		if (ifnet_byindex_locked(idx) == NULL)
+		if (V_ifindex_table[idx].ife_ifnet == NULL)
 			break;
 	}
 
@@ -255,6 +264,27 @@ ifindex_alloc(u_short *idxp)
 }
 
 static void
+ifindex_free_locked(u_short idx)
+{
+
+	IFNET_WLOCK_ASSERT();
+
+	V_ifindex_table[idx].ife_ifnet = NULL;
+	while (V_if_index > 0 &&
+	    V_ifindex_table[V_if_index].ife_ifnet == NULL)
+		V_if_index--;
+}
+
+static void
+ifindex_free(u_short idx)
+{
+
+	IFNET_WLOCK();
+	ifindex_free_locked(idx);
+	IFNET_WUNLOCK();
+}
+
+static void
 ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp)
 {
 
@@ -370,11 +400,12 @@ if_alloc(u_char type)
 
 	ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO);
 	IFNET_WLOCK();
-	if (ifindex_alloc(&idx) != 0) {
+	if (ifindex_alloc_locked(&idx) != 0) {
 		IFNET_WUNLOCK();
 		free(ifp, M_IFNET);
 		return (NULL);
 	}
+	ifnet_setbyindex_locked(idx, IFNET_HOLD);
 	IFNET_WUNLOCK();
 	ifp->if_index = idx;
 	ifp->if_type = type;
@@ -383,6 +414,7 @@ if_alloc(u_char type)
 		ifp->if_l2com = if_com_alloc[type](type, ifp);
 		if (ifp->if_l2com == NULL) {
 			free(ifp, M_IFNET);
+			ifindex_free(idx);
 			return (NULL);
 		}
 	}
@@ -421,9 +453,7 @@ if_free_internal(struct ifnet *ifp)
 	KASSERT(ifp == ifnet_byindex_locked(ifp->if_index),
 	    ("%s: freeing unallocated ifnet", ifp->if_xname));
 
-	ifnet_setbyindex_locked(ifp->if_index, NULL);
-	while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL)
-		V_if_index--;
+	ifindex_free_locked(ifp->if_index);
 	IFNET_WUNLOCK();
 
 	if (if_com_free[ifp->if_alloctype] != NULL)
@@ -916,18 +946,14 @@ if_vmove(struct ifnet *ifp, struct vnet 
 	 * or we'd lock on one vnet and unlock on another.
 	 */
 	IFNET_WLOCK();
-	ifnet_setbyindex_locked(ifp->if_index, NULL);
-	while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL)
-		V_if_index--;
-	IFNET_WUNLOCK();
+	ifindex_free_locked(ifp->if_index);
 
 	/*
 	 * Switch to the context of the target vnet.
 	 */
 	CURVNET_SET_QUIET(new_vnet);
 
-	IFNET_WLOCK();
-	if (ifindex_alloc(&idx) != 0) {
+	if (ifindex_alloc_locked(&idx) != 0) {
 		IFNET_WUNLOCK();
 		panic("if_index overflow");
 	}

From owner-svn-src-stable@FreeBSD.ORG  Sat Aug 29 04:15:37 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 755E7106564A;
	Sat, 29 Aug 2009 04:15:37 +0000 (UTC)
	(envelope-from brian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 62B148FC17;
	Sat, 29 Aug 2009 04:15:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7T4FbJv045534;
	Sat, 29 Aug 2009 04:15:37 GMT (envelope-from brian@svn.freebsd.org)
Received: (from brian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7T4FbQK045532;
	Sat, 29 Aug 2009 04:15:37 GMT (envelope-from brian@svn.freebsd.org)
Message-Id: <200908290415.n7T4FbQK045532@svn.freebsd.org>
From: Brian Somers 
Date: Sat, 29 Aug 2009 04:15:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196639 - stable/8/usr.sbin/ppp
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 04:15:37 -0000

Author: brian
Date: Sat Aug 29 04:15:37 2009
New Revision: 196639
URL: http://svn.freebsd.org/changeset/base/196639

Log:
  MFC r196530: Document that ppp handles pipe(2) descriptors specially in
               -direct mode.
  
  Approved by:	re (kib)

Modified:
  stable/8/usr.sbin/ppp/   (props changed)
  stable/8/usr.sbin/ppp/ppp.8.m4

Modified: stable/8/usr.sbin/ppp/ppp.8.m4
==============================================================================
--- stable/8/usr.sbin/ppp/ppp.8.m4	Sat Aug 29 03:17:24 2009	(r196638)
+++ stable/8/usr.sbin/ppp/ppp.8.m4	Sat Aug 29 04:15:37 2009	(r196639)
@@ -27,7 +27,7 @@ changecom(,)dnl
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 24, 2007
+.Dd August 25, 2009
 .Dt PPP 8
 .Os
 .Sh NAME
@@ -171,6 +171,17 @@ If callback is configured,
 will use the
 .Dq set device
 information when dialing back.
+.Pp
+When run in
+.Fl direct
+mode,
+.Nm
+will behave slightly differently if descriptor 0 was created by
+.Xr pipe 2 .
+As pipes are not bi-directional, ppp will redirect all writes to descriptor
+1 (standard output), leaving only reads acting on descriptor 0.
+No special action is taken if descriptor 0 was created by
+.Xr socketpair 2 .
 .It Fl dedicated
 This option is designed for machines connected with a dedicated
 wire.
@@ -6055,6 +6066,8 @@ This socket is used to pass links betwee
 .Xr tcpdump 1 ,
 .Xr telnet 1 ,
 .Xr kldload 2 ,
+.Xr pipe 2 ,
+.Xr socketpair 2 ,
 ifdef({LOCALNAT},{},{.Xr libalias 3 ,
 })dnl
 ifdef({LOCALRAD},{},{.Xr libradius 3 ,

From owner-svn-src-stable@FreeBSD.ORG  Sat Aug 29 15:21:50 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C2097106566C;
	Sat, 29 Aug 2009 15:21:50 +0000 (UTC)
	(envelope-from simon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A63038FC0A;
	Sat, 29 Aug 2009 15:21:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TFLo7v067796;
	Sat, 29 Aug 2009 15:21:50 GMT (envelope-from simon@svn.freebsd.org)
Received: (from simon@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TFLo0D067791;
	Sat, 29 Aug 2009 15:21:50 GMT (envelope-from simon@svn.freebsd.org)
Message-Id: <200908291521.n7TFLo0D067791@svn.freebsd.org>
From: "Simon L. Nielsen" 
Date: Sat, 29 Aug 2009 15:21:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196641 - in stable/8/crypto/openssl: . crypto/pqueue
	ssl
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 15:21:50 -0000

Author: simon
Date: Sat Aug 29 15:21:50 2009
New Revision: 196641
URL: http://svn.freebsd.org/changeset/base/196641

Log:
  MFC r196474:
  
    Merge DTLS fixes from vendor-crypto/openssl/dist:
  
    - Fix memory consumption bug with "future epoch" DTLS records.
    - Fix fragment handling memory leak.
    - Do not access freed data structure.
    - Fix DTLS fragment bug - out-of-sequence message handling which could
      result in NULL pointer dereference in
      dtls1_process_out_of_seq_message().
  
    Note that this will not get FreeBSD Security Advisory as DTLS is
    experimental in OpenSSL.
  
    Security:	CVE-2009-1377 CVE-2009-1378 CVE-2009-1379 CVE-2009-1387
  
  Approved by:	re (kib)

Modified:
  stable/8/crypto/openssl/   (props changed)
  stable/8/crypto/openssl/crypto/pqueue/pqueue.c
  stable/8/crypto/openssl/crypto/pqueue/pqueue.h
  stable/8/crypto/openssl/ssl/d1_both.c
  stable/8/crypto/openssl/ssl/d1_pkt.c

Modified: stable/8/crypto/openssl/crypto/pqueue/pqueue.c
==============================================================================
--- stable/8/crypto/openssl/crypto/pqueue/pqueue.c	Sat Aug 29 13:28:02 2009	(r196640)
+++ stable/8/crypto/openssl/crypto/pqueue/pqueue.c	Sat Aug 29 15:21:50 2009	(r196641)
@@ -234,3 +234,17 @@ pqueue_next(pitem **item)
 
 	return ret;
 	}
+
+int
+pqueue_size(pqueue_s *pq)
+{
+	pitem *item = pq->items;
+	int count = 0;
+	
+	while(item != NULL)
+	{
+		count++;
+		item = item->next;
+	}
+	return count;
+}

Modified: stable/8/crypto/openssl/crypto/pqueue/pqueue.h
==============================================================================
--- stable/8/crypto/openssl/crypto/pqueue/pqueue.h	Sat Aug 29 13:28:02 2009	(r196640)
+++ stable/8/crypto/openssl/crypto/pqueue/pqueue.h	Sat Aug 29 15:21:50 2009	(r196641)
@@ -91,5 +91,6 @@ pitem *pqueue_iterator(pqueue pq);
 pitem *pqueue_next(piterator *iter);
 
 void   pqueue_print(pqueue pq);
+int    pqueue_size(pqueue pq);
 
 #endif /* ! HEADER_PQUEUE_H */

Modified: stable/8/crypto/openssl/ssl/d1_both.c
==============================================================================
--- stable/8/crypto/openssl/ssl/d1_both.c	Sat Aug 29 13:28:02 2009	(r196640)
+++ stable/8/crypto/openssl/ssl/d1_both.c	Sat Aug 29 15:21:50 2009	(r196641)
@@ -519,6 +519,7 @@ dtls1_retrieve_buffered_fragment(SSL *s,
 
 	if ( s->d1->handshake_read_seq == frag->msg_header.seq)
 		{
+		unsigned long frag_len = frag->msg_header.frag_len;
 		pqueue_pop(s->d1->buffered_messages);
 
 		al=dtls1_preprocess_fragment(s,&frag->msg_header,max);
@@ -536,7 +537,7 @@ dtls1_retrieve_buffered_fragment(SSL *s,
 		if (al==0)
 			{
 			*ok = 1;
-			return frag->msg_header.frag_len;
+			return frag_len;
 			}
 
 		ssl3_send_alert(s,SSL3_AL_FATAL,al);
@@ -561,7 +562,16 @@ dtls1_process_out_of_seq_message(SSL *s,
 	if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len)
 		goto err;
 
-	if (msg_hdr->seq <= s->d1->handshake_read_seq)
+	/* Try to find item in queue, to prevent duplicate entries */
+	pq_64bit_init(&seq64);
+	pq_64bit_assign_word(&seq64, msg_hdr->seq);
+	item = pqueue_find(s->d1->buffered_messages, seq64);
+	pq_64bit_free(&seq64);
+	
+	/* Discard the message if sequence number was already there, is
+	 * too far in the future or the fragment is already in the queue */
+	if (msg_hdr->seq <= s->d1->handshake_read_seq ||
+		msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL)
 		{
 		unsigned char devnull [256];
 
@@ -575,30 +585,31 @@ dtls1_process_out_of_seq_message(SSL *s,
 			}
 		}
 
-	frag = dtls1_hm_fragment_new(frag_len);
-	if ( frag == NULL)
-		goto err;
+	if (frag_len)
+	{
+		frag = dtls1_hm_fragment_new(frag_len);
+		if ( frag == NULL)
+			goto err;
 
-	memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));
+		memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));
 
-	if (frag_len)
-		{
-		/* read the body of the fragment (header has already been read */
+		/* read the body of the fragment (header has already been read) */
 		i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,
 			frag->fragment,frag_len,0);
 		if (i<=0 || (unsigned long)i!=frag_len)
 			goto err;
-		}
 
-	pq_64bit_init(&seq64);
-	pq_64bit_assign_word(&seq64, msg_hdr->seq);
+		pq_64bit_init(&seq64);
+		pq_64bit_assign_word(&seq64, msg_hdr->seq);
 
-	item = pitem_new(seq64, frag);
-	pq_64bit_free(&seq64);
-	if ( item == NULL)
-		goto err;
+		item = pitem_new(seq64, frag);
+		pq_64bit_free(&seq64);
+		if ( item == NULL)
+			goto err;
+
+		pqueue_insert(s->d1->buffered_messages, item);
+	}
 
-	pqueue_insert(s->d1->buffered_messages, item);
 	return DTLS1_HM_FRAGMENT_RETRY;
 
 err:

Modified: stable/8/crypto/openssl/ssl/d1_pkt.c
==============================================================================
--- stable/8/crypto/openssl/ssl/d1_pkt.c	Sat Aug 29 13:28:02 2009	(r196640)
+++ stable/8/crypto/openssl/ssl/d1_pkt.c	Sat Aug 29 15:21:50 2009	(r196641)
@@ -167,6 +167,10 @@ dtls1_buffer_record(SSL *s, record_pqueu
     DTLS1_RECORD_DATA *rdata;
 	pitem *item;
 
+	/* Limit the size of the queue to prevent DOS attacks */
+	if (pqueue_size(queue->q) >= 100)
+		return 0;
+		
 	rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA));
 	item = pitem_new(priority, rdata);
 	if (rdata == NULL || item == NULL)

From owner-svn-src-stable@FreeBSD.ORG  Sat Aug 29 15:42:06 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7E69106564A;
	Sat, 29 Aug 2009 15:42:06 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B4B738FC22;
	Sat, 29 Aug 2009 15:42:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TFg69i068240;
	Sat, 29 Aug 2009 15:42:06 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TFg6On068238;
	Sat, 29 Aug 2009 15:42:06 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200908291542.n7TFg6On068238@svn.freebsd.org>
From: Andrew Thompson 
Date: Sat, 29 Aug 2009 15:42:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196642 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 15:42:06 -0000

Author: thompsa
Date: Sat Aug 29 15:42:06 2009
New Revision: 196642
URL: http://svn.freebsd.org/changeset/base/196642

Log:
  MFC r196547
  
   It is possible for all the kthreads to exit (hci modules unloaded) which in
   turn ends our usb process. This means the proc pointer becomes invalid and will
   panic if a new kthread is added. Count the number of threads and clear the proc
   pointer on the last one.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/usb_process.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_process.c
==============================================================================
--- stable/8/sys/dev/usb/usb_process.c	Sat Aug 29 15:21:50 2009	(r196641)
+++ stable/8/sys/dev/usb/usb_process.c	Sat Aug 29 15:42:06 2009	(r196642)
@@ -64,6 +64,7 @@
 
 #if (__FreeBSD_version >= 800000)
 static struct proc *usbproc;
+static int usb_pcount;
 #define	USB_THREAD_CREATE(f, s, p, ...) \
 		kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \
 		    0, "usb", __VA_ARGS__)
@@ -183,6 +184,11 @@ usb_process(void *arg)
 	up->up_ptr = NULL;
 	cv_signal(&up->up_cv);
 	mtx_unlock(up->up_mtx);
+#if (__FreeBSD_version >= 800000)
+	/* Clear the proc pointer if this is the last thread. */
+	if (--usb_pcount == 0)
+		usbproc = NULL;
+#endif
 
 	USB_THREAD_EXIT(0);
 }
@@ -218,6 +224,9 @@ usb_proc_create(struct usb_process *up, 
 		up->up_ptr = NULL;
 		goto error;
 	}
+#if (__FreeBSD_version >= 800000)
+	usb_pcount++;
+#endif
 	return (0);
 
 error:

From owner-svn-src-stable@FreeBSD.ORG  Sat Aug 29 19:45:04 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 07F46106564A;
	Sat, 29 Aug 2009 19:45:04 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EABF68FC0C;
	Sat, 29 Aug 2009 19:45:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TJj31k073009;
	Sat, 29 Aug 2009 19:45:03 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TJj3vT073007;
	Sat, 29 Aug 2009 19:45:03 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908291945.n7TJj3vT073007@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 29 Aug 2009 19:45:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196645 - stable/8/etc
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 19:45:04 -0000

Author: dougb
Date: Sat Aug 29 19:45:03 2009
New Revision: 196645
URL: http://svn.freebsd.org/changeset/base/196645

Log:
  MFC 196478:
  
  Prior to the dire warning about values of network_interfaces other than
  AUTO the biggest mistake users made was leaving lo0 off the list. Since
  lo0 is effectively mandatory, check for it and add it to the list if
  it's not there.
  
  MFC 196523:
  Improve the case test to detect the presence of lo0 in the list of
  network_interfaces.
  Submitted by:	Christoph Mallon 
  
  Approved by:	re (kib)

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/network.subr

Modified: stable/8/etc/network.subr
==============================================================================
--- stable/8/etc/network.subr	Sat Aug 29 18:01:02 2009	(r196644)
+++ stable/8/etc/network.subr	Sat Aug 29 19:45:03 2009	(r196645)
@@ -727,6 +727,13 @@ list_net_interfaces()
 		;;
 	*)
 		_tmplist="${network_interfaces} ${cloned_interfaces}"
+
+		# lo0 is effectively mandatory, so help prevent foot-shooting
+		#
+		case "$_tmplist" in
+		lo0|'lo0 '*|*' lo0'|*' lo0 '*) ;; # This is fine, do nothing
+		*)	_tmplist="lo0 ${_tmplist}" ;;
+		esac
 		;;
 	esac
 

From owner-svn-src-stable@FreeBSD.ORG  Sat Aug 29 19:47:39 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BDAE61065674;
	Sat, 29 Aug 2009 19:47:39 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AC8408FC14;
	Sat, 29 Aug 2009 19:47:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TJldHD073103;
	Sat, 29 Aug 2009 19:47:39 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TJldIb073101;
	Sat, 29 Aug 2009 19:47:39 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908291947.n7TJldIb073101@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 29 Aug 2009 19:47:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196646 - stable/7/etc
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 19:47:39 -0000

Author: dougb
Date: Sat Aug 29 19:47:39 2009
New Revision: 196646
URL: http://svn.freebsd.org/changeset/base/196646

Log:
  MFC 196478:
  Prior to the dire warning about values of network_interfaces other than
  AUTO the biggest mistake users made was leaving lo0 off the list. Since
  lo0 is effectively mandatory, check for it and add it to the list if
  it's not there.
  
  MFC 196523:
  Improve the case test to detect the presence of lo0 in the list of
  network_interfaces.
  Submitted by:	Christoph Mallon 

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/network.subr
  stable/7/etc/termcap.small   (props changed)

Modified: stable/7/etc/network.subr
==============================================================================
--- stable/7/etc/network.subr	Sat Aug 29 19:45:03 2009	(r196645)
+++ stable/7/etc/network.subr	Sat Aug 29 19:47:39 2009	(r196646)
@@ -643,6 +643,13 @@ list_net_interfaces()
 			    "AUTO are deprecated"
 		fi
 		_tmplist="${network_interfaces} ${cloned_interfaces}"
+
+		# lo0 is effectively mandatory, so help prevent foot-shooting
+		#
+		case "$_tmplist" in
+		lo0|'lo0 '*|*' lo0'|*' lo0 '*) ;; # This is fine, do nothing
+		*)	_tmplist="lo0 ${_tmplist}" ;;
+		esac
 		;;
 	esac
 

From owner-svn-src-stable@FreeBSD.ORG  Sat Aug 29 19:49:17 2009
Return-Path: 
Delivered-To: svn-src-stable@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DC600106564A;
	Sat, 29 Aug 2009 19:49:17 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C84E78FC1A;
	Sat, 29 Aug 2009 19:49:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TJnHdG073178;
	Sat, 29 Aug 2009 19:49:17 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TJnHHV073176;
	Sat, 29 Aug 2009 19:49:17 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908291949.n7TJnHHV073176@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 29 Aug 2009 19:49:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196647 - in stable/6/etc: . bluetooth defaults
	etc.alpha etc.amd64 etc.arm etc.i386 etc.ia64 etc.powerpc
	etc.sparc64 isdn mail mtree namedb pam.d periodic ppp rc.d
	root sendmail
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 19:49:18 -0000

Author: dougb
Date: Sat Aug 29 19:49:17 2009
New Revision: 196647
URL: http://svn.freebsd.org/changeset/base/196647

Log:
  MFC 196478:
  Prior to the dire warning about values of network_interfaces other than
  AUTO the biggest mistake users made was leaving lo0 off the list. Since
  lo0 is effectively mandatory, check for it and add it to the list if
  it's not there.
  
  MFC 196523:
  Improve the case test to detect the presence of lo0 in the list of
  network_interfaces.
  Submitted by:	Christoph Mallon 

Modified:
  stable/6/etc/   (props changed)
  stable/6/etc/Makefile   (props changed)
  stable/6/etc/amd.map   (props changed)
  stable/6/etc/apmd.conf   (props changed)
  stable/6/etc/auth.conf   (props changed)
  stable/6/etc/bluetooth/   (props changed)
  stable/6/etc/crontab   (props changed)
  stable/6/etc/csh.cshrc   (props changed)
  stable/6/etc/csh.login   (props changed)
  stable/6/etc/csh.logout   (props changed)
  stable/6/etc/defaults/   (props changed)
  stable/6/etc/devd.conf   (props changed)
  stable/6/etc/devfs.conf   (props changed)
  stable/6/etc/dhclient.conf   (props changed)
  stable/6/etc/disktab   (props changed)
  stable/6/etc/etc.alpha/   (props changed)
  stable/6/etc/etc.amd64/   (props changed)
  stable/6/etc/etc.arm/   (props changed)
  stable/6/etc/etc.i386/   (props changed)
  stable/6/etc/etc.ia64/   (props changed)
  stable/6/etc/etc.powerpc/   (props changed)
  stable/6/etc/etc.sparc64/   (props changed)
  stable/6/etc/fbtab   (props changed)
  stable/6/etc/freebsd-update.conf   (props changed)
  stable/6/etc/ftpusers   (props changed)
  stable/6/etc/gettytab   (props changed)
  stable/6/etc/group   (props changed)
  stable/6/etc/hosts   (props changed)
  stable/6/etc/hosts.allow   (props changed)
  stable/6/etc/hosts.equiv   (props changed)
  stable/6/etc/hosts.lpd   (props changed)
  stable/6/etc/inetd.conf   (props changed)
  stable/6/etc/isdn/   (props changed)
  stable/6/etc/login.access   (props changed)
  stable/6/etc/login.conf   (props changed)
  stable/6/etc/mac.conf   (props changed)
  stable/6/etc/mail/   (props changed)
  stable/6/etc/man.alias   (props changed)
  stable/6/etc/master.passwd   (props changed)
  stable/6/etc/minfree   (props changed)
  stable/6/etc/motd   (props changed)
  stable/6/etc/mtree/   (props changed)
  stable/6/etc/namedb/   (props changed)
  stable/6/etc/netconfig   (props changed)
  stable/6/etc/netstart   (props changed)
  stable/6/etc/network.subr   (contents, props changed)
  stable/6/etc/networks   (props changed)
  stable/6/etc/newsyslog.conf   (props changed)
  stable/6/etc/nls.alias   (props changed)
  stable/6/etc/nsmb.conf   (props changed)
  stable/6/etc/opieaccess   (props changed)
  stable/6/etc/pam.d/   (props changed)
  stable/6/etc/pccard_ether   (props changed)
  stable/6/etc/periodic/   (props changed)
  stable/6/etc/pf.conf   (props changed)
  stable/6/etc/pf.os   (props changed)
  stable/6/etc/phones   (props changed)
  stable/6/etc/portsnap.conf   (props changed)
  stable/6/etc/ppp/   (props changed)
  stable/6/etc/printcap   (props changed)
  stable/6/etc/profile   (props changed)
  stable/6/etc/protocols   (props changed)
  stable/6/etc/rc   (props changed)
  stable/6/etc/rc.bsdextended   (props changed)
  stable/6/etc/rc.d/   (props changed)
  stable/6/etc/rc.firewall   (props changed)
  stable/6/etc/rc.firewall6   (props changed)
  stable/6/etc/rc.initdiskless   (props changed)
  stable/6/etc/rc.resume   (props changed)
  stable/6/etc/rc.sendmail   (props changed)
  stable/6/etc/rc.shutdown   (props changed)
  stable/6/etc/rc.subr   (props changed)
  stable/6/etc/rc.suspend   (props changed)
  stable/6/etc/remote   (props changed)
  stable/6/etc/root/   (props changed)
  stable/6/etc/rpc   (props changed)
  stable/6/etc/sendmail/   (props changed)
  stable/6/etc/services   (props changed)
  stable/6/etc/shells   (props changed)
  stable/6/etc/snmpd.config   (props changed)
  stable/6/etc/sysctl.conf   (props changed)
  stable/6/etc/syslog.conf   (props changed)
  stable/6/etc/termcap.small   (props changed)
  stable/6/etc/usbd.conf   (props changed)

Modified: stable/6/etc/network.subr
==============================================================================
--- stable/6/etc/network.subr	Sat Aug 29 19:47:39 2009	(r196646)
+++ stable/6/etc/network.subr	Sat Aug 29 19:49:17 2009	(r196647)
@@ -583,6 +583,13 @@ list_net_interfaces()
 			    "AUTO are deprecated"
 		fi
 		_tmplist="${network_interfaces} ${cloned_interfaces}"
+
+		# lo0 is effectively mandatory, so help prevent foot-shooting
+		#
+		case "$_tmplist" in
+		lo0|'lo0 '*|*' lo0'|*' lo0 '*) ;; # This is fine, do nothing
+		*)	_tmplist="lo0 ${_tmplist}" ;;
+		esac
 		;;
 	esac