From owner-svn-src-stable-7@FreeBSD.ORG Tue Aug 25 11:44:17 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 12:32:16 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 13:01:51 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 13:04:14 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 13:39:15 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 13:40:46 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 15:54:54 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 15:58:07 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 16:56:34 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 17:00:25 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Tue Aug 25 19:04:22 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Wed Aug 26 19:45:20 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Wed Aug 26 21:05:17 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Wed Aug 26 22:50:14 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Thu Aug 27 00:45:01 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Thu Aug 27 07:10:58 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Thu Aug 27 07:11:47 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG Thu Aug 27 12:27:06 2009 Return-Path: Delivered-To: svn-src-stable-7@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-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Thu Aug 27 12:29:24 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Thu Aug 27 15:48:59 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Thu Aug 27 16:15:32 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Thu Aug 27 17:16:43 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Thu Aug 27 17:24:05 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Thu Aug 27 17:26:09 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Thu Aug 27 17:37:00 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Thu Aug 27 18:52:55 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Fri Aug 28 14:22:01 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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-7@FreeBSD.ORG  Sat Aug 29 19:47:39 2009
Return-Path: 
Delivered-To: svn-src-stable-7@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-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable 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