From owner-svn-src-stable-7@FreeBSD.ORG Sun Feb 1 10:13:18 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 62910106566B; Sun, 1 Feb 2009 10:13:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F5E48FC1C; Sun, 1 Feb 2009 10:13:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n11ADI15050835; Sun, 1 Feb 2009 10:13:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n11ADIVU050834; Sun, 1 Feb 2009 10:13:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200902011013.n11ADIVU050834@svn.freebsd.org> From: Alexander Motin Date: Sun, 1 Feb 2009 10:13:18 +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: r187982 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netgraph 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: Sun, 01 Feb 2009 10:13:19 -0000 Author: mav Date: Sun Feb 1 10:13:18 2009 New Revision: 187982 URL: http://svn.freebsd.org/changeset/base/187982 Log: MFC rev. 187387 Remove strict limitation on minimal multilink MRRU. RFC claims that MRRU of 1500 must be supported, but allows smaller values to be negotiated. Enforce specified MRRU for outgoing frames. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netgraph/ng_ppp.c Modified: stable/7/sys/netgraph/ng_ppp.c ============================================================================== --- stable/7/sys/netgraph/ng_ppp.c Sun Feb 1 09:59:10 2009 (r187981) +++ stable/7/sys/netgraph/ng_ppp.c Sun Feb 1 10:13:18 2009 (r187982) @@ -128,7 +128,6 @@ MALLOC_DEFINE(M_NETGRAPH_PPP, "netgraph_ #define PROT_VJUNCOMP 0x002f /* Multilink PPP definitions */ -#define MP_MIN_MRRU 1500 /* per RFC 1990 */ #define MP_INITIAL_SEQ 0 /* per RFC 1990 */ #define MP_MIN_LINK_MRU 32 @@ -1985,6 +1984,12 @@ ng_ppp_mp_xmit(node_p node, item_p item, priv->activeLinks[0], plen)); } + /* Check peer's MRRU for this bundle. */ + if (plen > priv->conf.mrru) { + NG_FREE_ITEM(item); + return (EMSGSIZE); + } + /* Extract mbuf. */ NGI_GET_M(item, m); @@ -2540,10 +2545,6 @@ ng_ppp_config_valid(node_p node, const s return (0); } - /* Check bundle parameters */ - if (newConf->bund.enableMultilink && newConf->bund.mrru < MP_MIN_MRRU) - return (0); - /* Disallow changes to multi-link configuration while MP is active */ if (priv->numActiveLinks > 0 && newNumLinksActive > 0) { if (!priv->conf.enableMultilink From owner-svn-src-stable-7@FreeBSD.ORG Sun Feb 1 19:20:45 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 5F11C106566B; Sun, 1 Feb 2009 19:20:45 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B7E68FC1E; Sun, 1 Feb 2009 19:20:45 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n11JKjXw064398; Sun, 1 Feb 2009 19:20:45 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n11JKj0J064397; Sun, 1 Feb 2009 19:20:45 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902011920.n11JKj0J064397@svn.freebsd.org> From: Robert Watson Date: Sun, 1 Feb 2009 19:20:45 +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: r187987 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Sun, 01 Feb 2009 19:20:46 -0000 Author: rwatson Date: Sun Feb 1 19:20:45 2009 New Revision: 187987 URL: http://svn.freebsd.org/changeset/base/187987 Log: Merge r186717 from head to stable/7: Allow the IP_MINTTL socket option to be set to 0 so that it can be disabled entirely, which is its default state before set to a non-zero value. PR: 128790 Submitted by: Nick Hilliard Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/ip_output.c Modified: stable/7/sys/netinet/ip_output.c ============================================================================== --- stable/7/sys/netinet/ip_output.c Sun Feb 1 18:10:06 2009 (r187986) +++ stable/7/sys/netinet/ip_output.c Sun Feb 1 19:20:45 2009 (r187987) @@ -875,7 +875,7 @@ ip_ctloutput(struct socket *so, struct s break; case IP_MINTTL: - if (optval > 0 && optval <= MAXTTL) + if (optval >= 0 && optval <= MAXTTL) inp->inp_ip_minttl = optval; else error = EINVAL; From owner-svn-src-stable-7@FreeBSD.ORG Mon Feb 2 04:48: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 D19EE1065670; Mon, 2 Feb 2009 04:48:32 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE78C8FC14; Mon, 2 Feb 2009 04:48:32 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n124mWNw081230; Mon, 2 Feb 2009 04:48:32 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n124mWwn081229; Mon, 2 Feb 2009 04:48:32 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200902020448.n124mWwn081229@svn.freebsd.org> From: Giorgos Keramidas Date: Mon, 2 Feb 2009 04:48: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: r187997 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/sound/pci 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: Mon, 02 Feb 2009 04:48:33 -0000 Author: keramida (doc committer) Date: Mon Feb 2 04:48:32 2009 New Revision: 187997 URL: http://svn.freebsd.org/changeset/base/187997 Log: MFC 187375 from /head Add support for CMedia CMI120. PR: kern/123640 Approved by: ariff Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/sound/pci/cmi.c Modified: stable/7/sys/dev/sound/pci/cmi.c ============================================================================== --- stable/7/sys/dev/sound/pci/cmi.c Mon Feb 2 03:34:40 2009 (r187996) +++ stable/7/sys/dev/sound/pci/cmi.c Mon Feb 2 04:48:32 2009 (r187997) @@ -60,6 +60,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define CMI8338B_PCI_ID 0x010113f6 #define CMI8738_PCI_ID 0x011113f6 #define CMI8738B_PCI_ID 0x011213f6 +#define CMI120_USB_ID 0x01030d8c /* Buffer size max is 64k for permitted DMA boundaries */ #define CMI_DEFAULT_BUFSZ 16384 @@ -916,6 +917,9 @@ cmi_probe(device_t dev) case CMI8738B_PCI_ID: device_set_desc(dev, "CMedia CMI8738B"); return BUS_PROBE_DEFAULT; + case CMI120_USB_ID: + device_set_desc(dev, "CMedia CMI120"); + return BUS_PROBE_DEFAULT; default: return ENXIO; } From owner-svn-src-stable-7@FreeBSD.ORG Mon Feb 2 04:57:38 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 05319106566C; Mon, 2 Feb 2009 04:57:38 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC7448FC0A; Mon, 2 Feb 2009 04:57:37 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n124va56081557; Mon, 2 Feb 2009 04:57:36 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n124vaUK081556; Mon, 2 Feb 2009 04:57:36 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200902020457.n124vaUK081556@svn.freebsd.org> From: Giorgos Keramidas Date: Mon, 2 Feb 2009 04:57:36 +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: r187999 - stable/7/share/man/man4 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: Mon, 02 Feb 2009 04:57:38 -0000 Author: keramida (doc committer) Date: Mon Feb 2 04:57:36 2009 New Revision: 187999 URL: http://svn.freebsd.org/changeset/base/187999 Log: MFC 187935 from /head Sometimes, depending on the bpf filter rules used in $PATTERN, the example script of the manpage feeds awk(1) with values larger than UINT32_MAX. Then awk prints a negative value, and this messes up $BPFPROG. Trying to load the resulting bpf byte codes with ngctl then fails. For example, the output for PATTERN="udp and dst net 255.255.0.0/16" should be (all in one line): bpf_prog_len=10 bpf_prog=[ { code=40 jt=0 jf=0 k=12 } { code=21 jt=7 jf=0 k=34525 } { code=21 jt=0 jf=6 k=2048 } { code=48 jt=0 jf=0 k=23 } { code=21 jt=0 jf=4 k=17 } { code=32 jt=0 jf=0 k=30 } { code=84 jt=0 jf=0 k=4294901760 } { code=21 jt=0 jf=1 k=4294901760 } { code=6 jt=0 jf=0 k=8192 } { code=6 jt=0 jf=0 k=0 } ] The two k=4294901760 values are displayed as k=-2147483648 by awk. Replace the awk script of the manpage example with a slower but safer version, that doesn't really attempt to convert the byte code printed by tcpdump from string to number and back. PR: docs/123255 Submitted by: Eugenio Maffione, eugenio.maffione at telecomitalia.it Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/igb.4 (props changed) stable/7/share/man/man4/ng_bpf.4 Modified: stable/7/share/man/man4/ng_bpf.4 ============================================================================== --- stable/7/share/man/man4/ng_bpf.4 Mon Feb 2 04:53:39 2009 (r187998) +++ stable/7/share/man/man4/ng_bpf.4 Mon Feb 2 04:57:36 2009 (r187999) @@ -156,21 +156,14 @@ INHOOK="hook1" MATCHHOOK="hook2" NOTMATCHHOOK="hook3" -cat > /tmp/bpf.awk << xxENDxx -{ - if (!init) { - printf "bpf_prog_len=%d bpf_prog=[", \\$1; - init=1; - } else { - printf " { code=%d jt=%d jf=%d k=%d }", \\$1, \\$2, \\$3, \\$4; - } -} -END { - print " ]" -} -xxENDxx - -BPFPROG=`tcpdump -s 8192 -ddd ${PATTERN} | awk -f /tmp/bpf.awk` +BPFPROG=$( tcpdump -s 8192 -ddd ${PATTERN} | \\ + ( read len ; \\ + echo -n "bpf_prog_len=$len" ; \\ + echo -n "bpf_prog=[" ; \\ + while read code jt jf k ; do \\ + echo -n " { code=$code jt=$jt jf=$jf k=$k }" ; \\ + done ; \\ + echo " ]" ) ) ngctl msg ${NODEPATH} setprogram { thisHook=\\"${INHOOK}\\" \\ ifMatch=\\"${MATCHHOOK}\\" \\ From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 12:56: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 1F2751065675; Tue, 3 Feb 2009 12:56:06 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C0698FC13; Tue, 3 Feb 2009 12:56:06 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13Cu5pL030740; Tue, 3 Feb 2009 12:56:05 GMT (envelope-from dds@svn.freebsd.org) Received: (from dds@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13Cu5q1030739; Tue, 3 Feb 2009 12:56:05 GMT (envelope-from dds@svn.freebsd.org) Message-Id: <200902031256.n13Cu5q1030739@svn.freebsd.org> From: Diomidis Spinellis Date: Tue, 3 Feb 2009 12:56: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: r188068 - stable/7/usr.bin/sed 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, 03 Feb 2009 12:56:07 -0000 Author: dds Date: Tue Feb 3 12:56:05 2009 New Revision: 188068 URL: http://svn.freebsd.org/changeset/base/188068 Log: MFC 184854 from head to stable/7 Fix the code to conform to the "or more" part of the following POSIX specification and regression test regress:25. "A function can be preceded by one or more '!' characters, in which case the function shall be applied if the addresses do not select the pattern space." _M 7/usr.bin/sed M 7/usr.bin/sed/compile.c Modified: stable/7/usr.bin/sed/ (props changed) stable/7/usr.bin/sed/compile.c Modified: stable/7/usr.bin/sed/compile.c ============================================================================== --- stable/7/usr.bin/sed/compile.c Tue Feb 3 11:04:03 2009 (r188067) +++ stable/7/usr.bin/sed/compile.c Tue Feb 3 12:56:05 2009 (r188068) @@ -224,7 +224,7 @@ nonsel: /* Now parse the command */ case NONSEL: /* ! */ p++; EATSPACE(); - cmd->nonsel = ! cmd->nonsel; + cmd->nonsel = 1; goto nonsel; case GROUP: /* { */ p++; From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 13:07:35 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 F31F81065673; Tue, 3 Feb 2009 13:07:34 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C60B88FC16; Tue, 3 Feb 2009 13:07:34 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13D7Y7n030993; Tue, 3 Feb 2009 13:07:34 GMT (envelope-from dds@svn.freebsd.org) Received: (from dds@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13D7Y8l030992; Tue, 3 Feb 2009 13:07:34 GMT (envelope-from dds@svn.freebsd.org) Message-Id: <200902031307.n13D7Y8l030992@svn.freebsd.org> From: Diomidis Spinellis Date: Tue, 3 Feb 2009 13:07:34 +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: r188069 - stable/7/bin/cp 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, 03 Feb 2009 13:07:35 -0000 Author: dds Date: Tue Feb 3 13:07:34 2009 New Revision: 188069 URL: http://svn.freebsd.org/changeset/base/188069 Log: MFC r184342 from head to stable/7 Add fallback when mmap fails on regular files. Some filesystems, like smbnetfs, do not support mmap. Reported by: Harti Brandt _M cp M cp/utils.c Modified: stable/7/bin/cp/ (props changed) stable/7/bin/cp/utils.c Modified: stable/7/bin/cp/utils.c ============================================================================== --- stable/7/bin/cp/utils.c Tue Feb 3 12:56:05 2009 (r188068) +++ stable/7/bin/cp/utils.c Tue Feb 3 13:07:34 2009 (r188069) @@ -137,41 +137,39 @@ copy_file(const FTSENT *entp, int dne) * Mmap and write if less than 8M (the limit is so we don't totally * trash memory on big files. This is really a minor hack, but it * wins some CPU back. + * Some filesystems, such as smbnetfs, don't support mmap, + * so this is a best-effort attempt. */ #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED if (S_ISREG(fs->st_mode) && fs->st_size > 0 && - fs->st_size <= 8 * 1048576) { - if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ, - MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) { + fs->st_size <= 8 * 1024 * 1024 && + (p = mmap(NULL, (size_t)fs->st_size, PROT_READ, + MAP_SHARED, from_fd, (off_t)0)) != MAP_FAILED) { + wtotal = 0; + for (bufp = p, wresid = fs->st_size; ; + bufp += wcount, wresid -= (size_t)wcount) { + wcount = write(to_fd, bufp, wresid); + if (wcount <= 0) + break; + wtotal += wcount; + if (info) { + info = 0; + (void)fprintf(stderr, + "%s -> %s %3d%%\n", + entp->fts_path, to.p_path, + cp_pct(wtotal, fs->st_size)); + } + if (wcount >= (ssize_t)wresid) + break; + } + if (wcount != (ssize_t)wresid) { + warn("%s", to.p_path); + rval = 1; + } + /* Some systems don't unmap on close(2). */ + if (munmap(p, fs->st_size) < 0) { warn("%s", entp->fts_path); rval = 1; - } else { - wtotal = 0; - for (bufp = p, wresid = fs->st_size; ; - bufp += wcount, wresid -= (size_t)wcount) { - wcount = write(to_fd, bufp, wresid); - if (wcount <= 0) - break; - wtotal += wcount; - if (info) { - info = 0; - (void)fprintf(stderr, - "%s -> %s %3d%%\n", - entp->fts_path, to.p_path, - cp_pct(wtotal, fs->st_size)); - } - if (wcount >= (ssize_t)wresid) - break; - } - if (wcount != (ssize_t)wresid) { - warn("%s", to.p_path); - rval = 1; - } - /* Some systems don't unmap on close(2). */ - if (munmap(p, fs->st_size) < 0) { - warn("%s", entp->fts_path); - rval = 1; - } } } else #endif From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 13:45:56 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 B8CFA106570E; Tue, 3 Feb 2009 13:45:56 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 92C468FC1D; Tue, 3 Feb 2009 13:45:56 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 3925B46B06; Tue, 3 Feb 2009 08:45:56 -0500 (EST) Date: Tue, 3 Feb 2009 13:45:56 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Diomidis Spinellis In-Reply-To: <200902031307.n13D7Y8l030992@svn.freebsd.org> Message-ID: References: <200902031307.n13D7Y8l030992@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r188069 - stable/7/bin/cp 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, 03 Feb 2009 13:45:58 -0000 On Tue, 3 Feb 2009, Diomidis Spinellis wrote: > Author: dds > Date: Tue Feb 3 13:07:34 2009 > New Revision: 188069 > URL: http://svn.freebsd.org/changeset/base/188069 > > Log: > MFC r184342 from head to stable/7 > > Add fallback when mmap fails on regular files. Some filesystems, > like smbnetfs, do not support mmap. You mean smbfs? Robert N M Watson Computer Laboratory University of Cambridge > > Reported by: Harti Brandt > > _M cp > M cp/utils.c > > Modified: > stable/7/bin/cp/ (props changed) > stable/7/bin/cp/utils.c > > Modified: stable/7/bin/cp/utils.c > ============================================================================== > --- stable/7/bin/cp/utils.c Tue Feb 3 12:56:05 2009 (r188068) > +++ stable/7/bin/cp/utils.c Tue Feb 3 13:07:34 2009 (r188069) > @@ -137,41 +137,39 @@ copy_file(const FTSENT *entp, int dne) > * Mmap and write if less than 8M (the limit is so we don't totally > * trash memory on big files. This is really a minor hack, but it > * wins some CPU back. > + * Some filesystems, such as smbnetfs, don't support mmap, > + * so this is a best-effort attempt. > */ > #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED > if (S_ISREG(fs->st_mode) && fs->st_size > 0 && > - fs->st_size <= 8 * 1048576) { > - if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ, > - MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) { > + fs->st_size <= 8 * 1024 * 1024 && > + (p = mmap(NULL, (size_t)fs->st_size, PROT_READ, > + MAP_SHARED, from_fd, (off_t)0)) != MAP_FAILED) { > + wtotal = 0; > + for (bufp = p, wresid = fs->st_size; ; > + bufp += wcount, wresid -= (size_t)wcount) { > + wcount = write(to_fd, bufp, wresid); > + if (wcount <= 0) > + break; > + wtotal += wcount; > + if (info) { > + info = 0; > + (void)fprintf(stderr, > + "%s -> %s %3d%%\n", > + entp->fts_path, to.p_path, > + cp_pct(wtotal, fs->st_size)); > + } > + if (wcount >= (ssize_t)wresid) > + break; > + } > + if (wcount != (ssize_t)wresid) { > + warn("%s", to.p_path); > + rval = 1; > + } > + /* Some systems don't unmap on close(2). */ > + if (munmap(p, fs->st_size) < 0) { > warn("%s", entp->fts_path); > rval = 1; > - } else { > - wtotal = 0; > - for (bufp = p, wresid = fs->st_size; ; > - bufp += wcount, wresid -= (size_t)wcount) { > - wcount = write(to_fd, bufp, wresid); > - if (wcount <= 0) > - break; > - wtotal += wcount; > - if (info) { > - info = 0; > - (void)fprintf(stderr, > - "%s -> %s %3d%%\n", > - entp->fts_path, to.p_path, > - cp_pct(wtotal, fs->st_size)); > - } > - if (wcount >= (ssize_t)wresid) > - break; > - } > - if (wcount != (ssize_t)wresid) { > - warn("%s", to.p_path); > - rval = 1; > - } > - /* Some systems don't unmap on close(2). */ > - if (munmap(p, fs->st_size) < 0) { > - warn("%s", entp->fts_path); > - rval = 1; > - } > } > } else > #endif > From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 14:25: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 73F30106566C; Tue, 3 Feb 2009 14:25:58 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 617208FC14; Tue, 3 Feb 2009 14:25:58 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13EPw9w032577; Tue, 3 Feb 2009 14:25:58 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13EPwtR032576; Tue, 3 Feb 2009 14:25:58 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200902031425.n13EPwtR032576@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 3 Feb 2009 14:25:58 +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: r188070 - stable/7/contrib/opie 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, 03 Feb 2009 14:26:00 -0000 Author: gabor (doc,ports committer) Date: Tue Feb 3 14:25:58 2009 New Revision: 188070 URL: http://svn.freebsd.org/changeset/base/188070 Log: MFC: r187920 - Remove non-existing reference - Fix trailing comma PR: docs/85118 Submitted by: vs Modified: stable/7/contrib/opie/opiekey.1 Modified: stable/7/contrib/opie/opiekey.1 ============================================================================== --- stable/7/contrib/opie/opiekey.1 Tue Feb 3 13:07:34 2009 (r188069) +++ stable/7/contrib/opie/opiekey.1 Tue Feb 3 14:25:58 2009 (r188070) @@ -157,8 +157,7 @@ this mistake. Better checks are needed. .BR opieinfo (1), .BR opiekeys (5), .BR opieaccess (5), -.BR opiegen (1) -.BR su (1), +.BR su (1) .SH AUTHOR Bellcore's S/Key was written by Phil Karn, Neil M. Haller, and John S. Walden From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 14:30: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 A55C1106566B; Tue, 3 Feb 2009 14:30:59 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77CC08FC0A; Tue, 3 Feb 2009 14:30:59 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13EUx1w032788; Tue, 3 Feb 2009 14:30:59 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13EUx4e032785; Tue, 3 Feb 2009 14:30:59 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200902031430.n13EUx4e032785@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 3 Feb 2009 14:30: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: r188072 - in stable/7/share/man: man7 man8 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, 03 Feb 2009 14:31:00 -0000 Author: gabor (doc,ports committer) Date: Tue Feb 3 14:30:59 2009 New Revision: 188072 URL: http://svn.freebsd.org/changeset/base/188072 Log: MFC: r187916 - Rename adding_user(8) to adding_user(7). There's no adding_user utility, but the man page describes conceptual information about the process of adding a user, thus it should belong to section 7. - Remove HISTORY and BUGS sections because of the aforementioned reason. PR: docs/130151 Submitted by: Marian Cerny Added: stable/7/share/man/man7/adding_user.7 - copied, changed from r188071, stable/7/share/man/man8/adding_user.8 Deleted: stable/7/share/man/man8/adding_user.8 Modified: stable/7/share/man/man7/Makefile stable/7/share/man/man8/Makefile Modified: stable/7/share/man/man7/Makefile ============================================================================== --- stable/7/share/man/man7/Makefile Tue Feb 3 14:26:55 2009 (r188071) +++ stable/7/share/man/man7/Makefile Tue Feb 3 14:30:59 2009 (r188072) @@ -2,7 +2,8 @@ # $FreeBSD$ #MISSING: eqnchar.7 ms.7 term.7 -MAN= ascii.7 \ +MAN= adding_user.7 \ + ascii.7 \ bsd.snmpmod.mk.7 \ build.7 \ clocks.7 \ Copied and modified: stable/7/share/man/man7/adding_user.7 (from r188071, stable/7/share/man/man8/adding_user.8) ============================================================================== --- stable/7/share/man/man8/adding_user.8 Tue Feb 3 14:26:55 2009 (r188071, copy source) +++ stable/7/share/man/man7/adding_user.7 Tue Feb 3 14:30:59 2009 (r188072) @@ -32,7 +32,7 @@ .\" @(#)adduser.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 5, 1993 +.Dd Jan 30, 2009 .Dt ADDING_USER 8 .Os .Sh NAME @@ -108,10 +108,3 @@ skeletal login directory .Xr adduser 8 , .Xr pwd_mkdb 8 , .Xr vipw 8 -.Sh HISTORY -The -.Nm -utility appeared in -.Bx 3.0 . -.Sh BUGS -User information should (and eventually will) be stored elsewhere. Modified: stable/7/share/man/man8/Makefile ============================================================================== --- stable/7/share/man/man8/Makefile Tue Feb 3 14:26:55 2009 (r188071) +++ stable/7/share/man/man8/Makefile Tue Feb 3 14:30:59 2009 (r188072) @@ -1,8 +1,7 @@ # @(#)Makefile 8.1 (Berkeley) 6/5/93 # $FreeBSD$ -MAN= adding_user.8 \ - crash.8 \ +MAN= crash.8 \ diskless.8 \ intro.8 \ MAKEDEV.8 \ From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 14:33:19 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 F02DE106564A; Tue, 3 Feb 2009 14:33:19 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-out.forthnet.gr (mx-out.forthnet.gr [193.92.150.103]) by mx1.freebsd.org (Postfix) with ESMTP id 62BE08FC19; Tue, 3 Feb 2009 14:33:19 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-av-06.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-06.forthnet.gr (8.14.3/8.14.3) with ESMTP id n13EAJF9028844; Tue, 3 Feb 2009 16:10:19 +0200 Received: from MX-IN-02.forthnet.gr (mx-in-02.forthnet.gr [193.92.150.185]) by mx-av-06.forthnet.gr (8.14.3/8.14.3) with ESMTP id n13EAJnW002447; Tue, 3 Feb 2009 16:10:19 +0200 Received: from [192.168.136.22] (adsl160-43.kln.forthnet.gr [62.1.63.43]) by MX-IN-02.forthnet.gr (8.14.3/8.14.3) with ESMTP id n13EAIE5031583; Tue, 3 Feb 2009 16:10:18 +0200 Authentication-Results: MX-IN-02.forthnet.gr smtp.mail=dds@aueb.gr; spf=neutral Authentication-Results: MX-IN-02.forthnet.gr header.from=dds@aueb.gr; sender-id=neutral Message-ID: <49885049.8040505@aueb.gr> Date: Tue, 03 Feb 2009 16:10:17 +0200 From: Diomidis Spinellis User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Robert Watson References: <200902031307.n13D7Y8l030992@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable-7@FreeBSD.ORG, svn-src-stable@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Diomidis Spinellis Subject: Re: svn commit: r188069 - stable/7/bin/cp 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, 03 Feb 2009 14:33:20 -0000 Robert Watson wrote: > On Tue, 3 Feb 2009, Diomidis Spinellis wrote: > >> Author: dds >> Date: Tue Feb 3 13:07:34 2009 >> New Revision: 188069 >> URL: http://svn.freebsd.org/changeset/base/188069 >> >> Log: >> MFC r184342 from head to stable/7 >> >> Add fallback when mmap fails on regular files. Some filesystems, >> like smbnetfs, do not support mmap. > > You mean smbfs? The original report of the problem concerned SMBNetFS - a user-space implementation of SMB . Diomidis Spinellis - http://www.dmst.aueb.gr/dds From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 15:33:35 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 07AB0106566C; Tue, 3 Feb 2009 15:33:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 9B7F28FC1D; Tue, 3 Feb 2009 15:33:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LUMRl-0009jZ-0E; Tue, 03 Feb 2009 16:40:17 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n13EeDHY037550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 3 Feb 2009 16:40:13 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n13EeDvq092470; Tue, 3 Feb 2009 16:40:13 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n13EeDeq092469; Tue, 3 Feb 2009 16:40:13 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 3 Feb 2009 16:40:13 +0200 From: Kostik Belousov To: Gabor Kovesdan Message-ID: <20090203144013.GM52415@deviant.kiev.zoral.com.ua> References: <200902031430.n13EUx4e032785@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iUV/lbBrmPtUT9dM" Content-Disposition: inline In-Reply-To: <200902031430.n13EUx4e032785@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LUMRl-0009jZ-0E 1ae2dffce4a6314144b8c19f30589d6b X-Terabit: YES Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r188072 - in stable/7/share/man: man7 man8 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, 03 Feb 2009 15:33:35 -0000 --iUV/lbBrmPtUT9dM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 03, 2009 at 02:30:59PM +0000, Gabor Kovesdan wrote: > Author: gabor (doc,ports committer) > Date: Tue Feb 3 14:30:59 2009 > New Revision: 188072 > URL: http://svn.freebsd.org/changeset/base/188072 >=20 > Log: > MFC: r187916 > - Rename adding_user(8) to adding_user(7). There's no adding_user uti= lity, > but the man page describes conceptual information about the process= of > adding a user, thus it should belong to section 7. > - Remove HISTORY and BUGS sections because of the aforementioned reas= on. > =20 > PR: docs/130151 > Submitted by: Marian Cerny >=20 > Added: > stable/7/share/man/man7/adding_user.7 > - copied, changed from r188071, stable/7/share/man/man8/adding_user.8 > Deleted: > stable/7/share/man/man8/adding_user.8 The ObsoleteFiles.inc should be updated, then ? --iUV/lbBrmPtUT9dM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkmIV0wACgkQC3+MBN1Mb4gt9gCbBK382BTa7NsPGqN81JBfHDVJ FwkAni2MbiWZ6kEYZ5GcsNMFy7bcwCB+ =Nwzg -----END PGP SIGNATURE----- --iUV/lbBrmPtUT9dM-- From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 16:08:48 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 29974106566C; Tue, 3 Feb 2009 16:08:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0292F8FC1C; Tue, 3 Feb 2009 16:08:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id ACA4946B17; Tue, 3 Feb 2009 11:08:47 -0500 (EST) Date: Tue, 3 Feb 2009 16:08:47 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Diomidis Spinellis In-Reply-To: <49885049.8040505@aueb.gr> Message-ID: References: <200902031307.n13D7Y8l030992@svn.freebsd.org> <49885049.8040505@aueb.gr> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable-7@FreeBSD.ORG, svn-src-stable@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Diomidis Spinellis Subject: Re: svn commit: r188069 - stable/7/bin/cp 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, 03 Feb 2009 16:08:49 -0000 On Tue, 3 Feb 2009, Diomidis Spinellis wrote: > Robert Watson wrote: >> On Tue, 3 Feb 2009, Diomidis Spinellis wrote: >> >>> Author: dds Date: Tue Feb 3 13:07:34 2009 New Revision: 188069 URL: >>> http://svn.freebsd.org/changeset/base/188069 >>> >>> Log: >>> MFC r184342 from head to stable/7 >>> >>> Add fallback when mmap fails on regular files. Some filesystems, >>> like smbnetfs, do not support mmap. >> >> You mean smbfs? > > The original report of the problem > > concerned SMBNetFS - a user-space implementation of SMB > . Ah, OK. Be aware that it's not possible to execve(2) from a file system that doesn't support memory mapping... Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 20:47: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 67A3F1065711; Tue, 3 Feb 2009 20:47:58 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 549278FC0A; Tue, 3 Feb 2009 20:47:58 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13Klwtm041609; Tue, 3 Feb 2009 20:47:58 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13Klwt8041607; Tue, 3 Feb 2009 20:47:58 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200902032047.n13Klwt8041607@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 3 Feb 2009 20:47:58 +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: r188103 - stable/7 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, 03 Feb 2009 20:48:00 -0000 Author: gabor (doc,ports committer) Date: Tue Feb 3 20:47:58 2009 New Revision: 188103 URL: http://svn.freebsd.org/changeset/base/188103 Log: MFC: Reflect adding_user.8 -> adding_user.7 rename Modified: stable/7/ObsoleteFiles.inc Modified: stable/7/ObsoleteFiles.inc ============================================================================== --- stable/7/ObsoleteFiles.inc Tue Feb 3 20:46:05 2009 (r188102) +++ stable/7/ObsoleteFiles.inc Tue Feb 3 20:47:58 2009 (r188103) @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090203: adding_user.8 moved to adding_user.7 +OLD_FILES+=usr/share/man/man8/adding_user.8.gz # 20080407: pkg_sign has been removed OLD_FILES+=usr/sbin/pkg_check OLD_FILES+=usr/sbin/pkg_sign From owner-svn-src-stable-7@FreeBSD.ORG Tue Feb 3 21:01: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 AF701106566B; Tue, 3 Feb 2009 21:01:39 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 640E18FC18; Tue, 3 Feb 2009 21:01:39 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 1284114D7F11; Tue, 3 Feb 2009 21:52:12 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OqFugFxCkaxa; Tue, 3 Feb 2009 21:52:09 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-156-89.catv.broadband.hu [80.98.156.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 55A7614D7F0F; Tue, 3 Feb 2009 21:52:09 +0100 (CET) Message-ID: <4988ADBD.4060502@FreeBSD.org> Date: Tue, 03 Feb 2009 21:49:01 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Kostik Belousov References: <200902031430.n13EUx4e032785@svn.freebsd.org> <20090203144013.GM52415@deviant.kiev.zoral.com.ua> In-Reply-To: <20090203144013.GM52415@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r188072 - in stable/7/share/man: man7 man8 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, 03 Feb 2009 21:01:40 -0000 > The ObsoleteFiles.inc should be updated, then ? > Fixed, thanks for the reminder! -- Gabor Kovesdan EMAIL: gabor@FreeBSD.org WWW: http://www.kovesdan.org From owner-svn-src-stable-7@FreeBSD.ORG Wed Feb 4 15:02:57 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 E83281065753; Wed, 4 Feb 2009 15:02:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB2408FC13; Wed, 4 Feb 2009 15:02:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14F2v66079580; Wed, 4 Feb 2009 15:02:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14F2vsM079579; Wed, 4 Feb 2009 15:02:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200902041502.n14F2vsM079579@svn.freebsd.org> From: Alexander Motin Date: Wed, 4 Feb 2009 15:02: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: r188114 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/sound/pci/hda 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, 04 Feb 2009 15:02:58 -0000 Author: mav Date: Wed Feb 4 15:02:57 2009 New Revision: 188114 URL: http://svn.freebsd.org/changeset/base/188114 Log: MFC rev. 187445, 187721, 187944 Add two more nVidia HDMI codec IDs. Specify analog beep pin widget for several AD codecs. It gives working speaker control for that systems. Fix bug in hint.hdac.X.config parsing. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/sound/pci/hda/hdac.c Modified: stable/7/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/7/sys/dev/sound/pci/hda/hdac.c Wed Feb 4 10:35:27 2009 (r188113) +++ stable/7/sys/dev/sound/pci/hda/hdac.c Wed Feb 4 15:02:57 2009 (r188114) @@ -83,7 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20090113_0125" +#define HDA_DRV_TEST_REV "20090131_0127" SND_DECLARE_FILE("$FreeBSD$"); @@ -761,8 +761,10 @@ static const struct { /* NVIDIA */ #define HDA_CODEC_NVIDIAMCP78 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0002) +#define HDA_CODEC_NVIDIAMCP78_2 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0006) #define HDA_CODEC_NVIDIAMCP7A HDA_CODEC_CONSTRUCT(NVIDIA, 0x0007) #define HDA_CODEC_NVIDIAMCP67 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0067) +#define HDA_CODEC_NVIDIAMCP73 HDA_CODEC_CONSTRUCT(NVIDIA, 0x8001) #define HDA_CODEC_NVIDIAXXXX HDA_CODEC_CONSTRUCT(NVIDIA, 0xffff) /* INTEL */ @@ -905,7 +907,9 @@ static const struct { { HDA_CODEC_ATIRS690, "ATI RS690/780 HDMI" }, { HDA_CODEC_ATIR6XX, "ATI R6xx HDMI" }, { HDA_CODEC_NVIDIAMCP67, "NVidia MCP67 HDMI" }, + { HDA_CODEC_NVIDIAMCP73, "NVidia MCP73 HDMI" }, { HDA_CODEC_NVIDIAMCP78, "NVidia MCP78 HDMI" }, + { HDA_CODEC_NVIDIAMCP78_2, "NVidia MCP78 HDMI" }, { HDA_CODEC_NVIDIAMCP7A, "NVidia MCP7A HDMI" }, { HDA_CODEC_INTELG45_1, "Intel G45 HDMI" }, { HDA_CODEC_INTELG45_2, "Intel G45 HDMI" }, @@ -2581,8 +2585,15 @@ hdac_widget_getcaps(struct hdac_widget * Change beeper pin node type to beeper to help parser. */ *waspin = 0; switch (id) { + case HDA_CODEC_AD1882: + case HDA_CODEC_AD1883: + case HDA_CODEC_AD1984: + case HDA_CODEC_AD1984A: + case HDA_CODEC_AD1984B: + case HDA_CODEC_AD1987: case HDA_CODEC_AD1988: case HDA_CODEC_AD1988B: + case HDA_CODEC_AD1989B: beeper = 26; break; case HDA_CODEC_ALC260: @@ -7095,7 +7106,7 @@ hdac_config_fetch(struct hdac_softc *sc, hdac_quirks_tab[k].key, len - inv) != 0) continue; if (len - inv != strlen(hdac_quirks_tab[k].key)) - break; + continue; HDA_BOOTVERBOSE( printf(" %s%s", (inv != 0) ? "no" : "", hdac_quirks_tab[k].key); From owner-svn-src-stable-7@FreeBSD.ORG Wed Feb 4 17:35:21 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 8D22C1065670; Wed, 4 Feb 2009 17:35:21 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AB918FC08; Wed, 4 Feb 2009 17:35:21 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14HZLFA082817; Wed, 4 Feb 2009 17:35:21 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14HZLDE082816; Wed, 4 Feb 2009 17:35:21 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200902041735.n14HZLDE082816@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 4 Feb 2009 17:35:21 +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: r188116 - in stable/7/sbin/geom: . class/part core misc 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, 04 Feb 2009 17:35:22 -0000 Author: lulf Date: Wed Feb 4 17:35:21 2009 New Revision: 188116 URL: http://svn.freebsd.org/changeset/base/188116 Log: MFC r188017: - Use a separate pointer to the allocated memory for freeing, as strsep may modify the pointer argument passed to it. This triggered an assert in malloc when a geom command being run under the livefs environment. PR: bin/130632 Submitted by: Dimitry Andric Modified: stable/7/sbin/geom/ (props changed) stable/7/sbin/geom/class/part/ (props changed) stable/7/sbin/geom/core/geom.c stable/7/sbin/geom/misc/ (props changed) Modified: stable/7/sbin/geom/core/geom.c ============================================================================== --- stable/7/sbin/geom/core/geom.c Wed Feb 4 17:10:01 2009 (r188115) +++ stable/7/sbin/geom/core/geom.c Wed Feb 4 17:35:21 2009 (r188116) @@ -480,13 +480,13 @@ library_path(void) static void load_library(void) { - char *curpath, path[MAXPATHLEN], *totalpath; + char *curpath, path[MAXPATHLEN], *tofree, *totalpath; uint32_t *lib_version; void *dlh; int ret; ret = 0; - totalpath = strdup(library_path()); + tofree = totalpath = strdup(library_path()); if (totalpath == NULL) err(EXIT_FAILURE, "Not enough memory for library path"); @@ -512,7 +512,7 @@ load_library(void) } break; } - free(totalpath); + free(tofree); /* No library was found, but standard commands can still be used */ if (ret == -1) return; From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 11:03:52 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 1372F106566C; Fri, 6 Feb 2009 11:03:52 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 004228FC1D; Fri, 6 Feb 2009 11:03:52 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16B3pi8059296; Fri, 6 Feb 2009 11:03:51 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16B3pXX059294; Fri, 6 Feb 2009 11:03:51 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061103.n16B3pXX059294@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 11:03: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: r188222 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit 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, 06 Feb 2009 11:03:52 -0000 Author: rwatson Date: Fri Feb 6 11:03:51 2009 New Revision: 188222 URL: http://svn.freebsd.org/changeset/base/188222 Log: Merge r184904 from head to stable/7: The audit queue limit variables are size_t, so use size_t for the audit queue length variables as well, avoiding storing the limit in a larger type than the length. Submitted by: sson Sponsored by: Apple Inc. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit.c stable/7/sys/security/audit/audit_private.h Modified: stable/7/sys/security/audit/audit.c ============================================================================== --- stable/7/sys/security/audit/audit.c Fri Feb 6 10:30:46 2009 (r188221) +++ stable/7/sys/security/audit/audit.c Fri Feb 6 11:03:51 2009 (r188222) @@ -129,8 +129,8 @@ struct mtx audit_mtx; * outstanding in the system. */ struct kaudit_queue audit_q; -int audit_q_len; -int audit_pre_q_len; +size_t audit_q_len; +size_t audit_pre_q_len; /* * Audit queue control settings (minimum free, low/high water marks, etc.) Modified: stable/7/sys/security/audit/audit_private.h ============================================================================== --- stable/7/sys/security/audit/audit_private.h Fri Feb 6 10:30:46 2009 (r188221) +++ stable/7/sys/security/audit/audit_private.h Fri Feb 6 11:03:51 2009 (r188222) @@ -274,8 +274,8 @@ extern struct mtx audit_mtx; extern struct cv audit_watermark_cv; extern struct cv audit_worker_cv; extern struct kaudit_queue audit_q; -extern int audit_q_len; -extern int audit_pre_q_len; +extern size_t audit_q_len; +extern size_t audit_pre_q_len; extern int audit_in_failure; /* From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12:06: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 D804E106573D; Fri, 6 Feb 2009 12:06:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B88238FC1F; Fri, 6 Feb 2009 12:06:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16C6dMj060415; Fri, 6 Feb 2009 12:06:39 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16C6d7D060414; Fri, 6 Feb 2009 12:06:39 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061206.n16C6d7D060414@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:06: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: r188223 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit 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, 06 Feb 2009 12:06:55 -0000 Author: rwatson Date: Fri Feb 6 12:06:39 2009 New Revision: 188223 URL: http://svn.freebsd.org/changeset/base/188223 Log: Merge r184482 from head to stable/7: Protect the event->class lookup database using an rwlock instead of a mutex, as it's rarely changed but frequently accessed read-only from multiple threads, so a potentially significant source of contention. Sponsored by: Apple, Inc. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit_bsm_klib.c Modified: stable/7/sys/security/audit/audit_bsm_klib.c ============================================================================== --- stable/7/sys/security/audit/audit_bsm_klib.c Fri Feb 6 11:03:51 2009 (r188222) +++ stable/7/sys/security/audit/audit_bsm_klib.c Fri Feb 6 12:06:39 2009 (r188223) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2005 Apple Inc. + * Copyright (c) 1999-2008 Apple Inc. * Copyright (c) 2005 Robert N. M. Watson * All rights reserved. * @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,9 +65,15 @@ struct evclass_list { }; static MALLOC_DEFINE(M_AUDITEVCLASS, "audit_evclass", "Audit event class"); -static struct mtx evclass_mtx; +static struct rwlock evclass_lock; static struct evclass_list evclass_hash[EVCLASSMAP_HASH_TABLE_SIZE]; +#define EVCLASS_LOCK_INIT() rw_init(&evclass_lock, "evclass_lock") +#define EVCLASS_RLOCK() rw_rlock(&evclass_lock) +#define EVCLASS_RUNLOCK() rw_runlock(&evclass_lock) +#define EVCLASS_WLOCK() rw_wlock(&evclass_lock) +#define EVCLASS_WUNLOCK() rw_wunlock(&evclass_lock) + /* * Look up the class for an audit event in the class mapping table. */ @@ -77,7 +84,7 @@ au_event_class(au_event_t event) struct evclass_elem *evc; au_class_t class; - mtx_lock(&evclass_mtx); + EVCLASS_RLOCK(); evcl = &evclass_hash[event % EVCLASSMAP_HASH_TABLE_SIZE]; class = 0; LIST_FOREACH(evc, &evcl->head, entry) { @@ -87,7 +94,7 @@ au_event_class(au_event_t event) } } out: - mtx_unlock(&evclass_mtx); + EVCLASS_RUNLOCK(); return (class); } @@ -110,12 +117,12 @@ au_evclassmap_insert(au_event_t event, a */ evc_new = malloc(sizeof(*evc), M_AUDITEVCLASS, M_WAITOK); - mtx_lock(&evclass_mtx); + EVCLASS_WLOCK(); evcl = &evclass_hash[event % EVCLASSMAP_HASH_TABLE_SIZE]; LIST_FOREACH(evc, &evcl->head, entry) { if (evc->event == event) { evc->class = class; - mtx_unlock(&evclass_mtx); + EVCLASS_WUNLOCK(); free(evc_new, M_AUDITEVCLASS); return; } @@ -124,7 +131,7 @@ au_evclassmap_insert(au_event_t event, a evc->event = event; evc->class = class; LIST_INSERT_HEAD(&evcl->head, evc, entry); - mtx_unlock(&evclass_mtx); + EVCLASS_WUNLOCK(); } void @@ -132,7 +139,7 @@ au_evclassmap_init(void) { int i; - mtx_init(&evclass_mtx, "evclass_mtx", NULL, MTX_DEF); + EVCLASS_LOCK_INIT(); for (i = 0; i < EVCLASSMAP_HASH_TABLE_SIZE; i++) LIST_INIT(&evclass_hash[i].head); From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12:10:29 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 5A6111065959; Fri, 6 Feb 2009 12:10:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 329228FC12; Fri, 6 Feb 2009 12:10:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16CATWQ060551; Fri, 6 Feb 2009 12:10:29 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16CAT22060548; Fri, 6 Feb 2009 12:10:29 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061210.n16CAT22060548@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:10:28 +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: r188224 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit 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, 06 Feb 2009 12:10:35 -0000 Author: rwatson Date: Fri Feb 6 12:10:28 2009 New Revision: 188224 URL: http://svn.freebsd.org/changeset/base/188224 Log: Merge r184948 from head to stable/7: When repeatedly accessing a thread credential, cache the credential pointer in a local thread. While this is unlikely to significantly improve performance given modern compiler behavior, it makes the code more readable and reduces diffs to the Mac OS X version of the same code (which stores things in creds in the same way, but where the cred for a thread is reached quite differently). Discussed with: sson Sponsored by: Apple Inc. Obtained from: TrustedBSD Project Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit.c stable/7/sys/security/audit/audit_arg.c stable/7/sys/security/audit/audit_syscalls.c Modified: stable/7/sys/security/audit/audit.c ============================================================================== --- stable/7/sys/security/audit/audit.c Fri Feb 6 12:06:39 2009 (r188223) +++ stable/7/sys/security/audit/audit.c Fri Feb 6 12:10:28 2009 (r188224) @@ -165,6 +165,7 @@ audit_record_ctor(void *mem, int size, v { struct kaudit_record *ar; struct thread *td; + struct ucred *cred; KASSERT(sizeof(*ar) == size, ("audit_record_ctor: wrong size")); @@ -177,15 +178,16 @@ audit_record_ctor(void *mem, int size, v /* * Export the subject credential. */ - cru2x(td->td_ucred, &ar->k_ar.ar_subj_cred); - ar->k_ar.ar_subj_ruid = td->td_ucred->cr_ruid; - ar->k_ar.ar_subj_rgid = td->td_ucred->cr_rgid; - ar->k_ar.ar_subj_egid = td->td_ucred->cr_groups[0]; - ar->k_ar.ar_subj_auid = td->td_ucred->cr_audit.ai_auid; - ar->k_ar.ar_subj_asid = td->td_ucred->cr_audit.ai_asid; + cred = td->td_ucred; + cru2x(cred, &ar->k_ar.ar_subj_cred); + ar->k_ar.ar_subj_ruid = cred->cr_ruid; + ar->k_ar.ar_subj_rgid = cred->cr_rgid; + ar->k_ar.ar_subj_egid = cred->cr_groups[0]; + ar->k_ar.ar_subj_auid = cred->cr_audit.ai_auid; + ar->k_ar.ar_subj_asid = cred->cr_audit.ai_asid; ar->k_ar.ar_subj_pid = td->td_proc->p_pid; - ar->k_ar.ar_subj_amask = td->td_ucred->cr_audit.ai_mask; - ar->k_ar.ar_subj_term_addr = td->td_ucred->cr_audit.ai_termid; + ar->k_ar.ar_subj_amask = cred->cr_audit.ai_mask; + ar->k_ar.ar_subj_term_addr = cred->cr_audit.ai_termid; return (0); } @@ -585,6 +587,7 @@ audit_proc_coredump(struct thread *td, c { struct kaudit_record *ar; struct au_mask *aumask; + struct ucred *cred; au_class_t class; int ret, sorf; char **pathp; @@ -595,11 +598,12 @@ audit_proc_coredump(struct thread *td, c /* * Make sure we are using the correct preselection mask. */ - auid = td->td_ucred->cr_audit.ai_auid; + cred = td->td_ucred; + auid = cred->cr_audit.ai_auid; if (auid == AU_DEFAUDITID) aumask = &audit_nae_mask; else - aumask = &td->td_ucred->cr_audit.ai_mask; + aumask = &cred->cr_audit.ai_mask; /* * It's possible for coredump(9) generation to fail. Make sure that * we handle this case correctly for preselection. @@ -612,6 +616,7 @@ audit_proc_coredump(struct thread *td, c if (au_preselect(AUE_CORE, class, aumask, sorf) == 0 && audit_pipe_preselect(auid, AUE_CORE, class, sorf, 0) == 0) return; + /* * If we are interested in seeing this audit record, allocate it. * Where possible coredump records should contain a pathname and arg32 Modified: stable/7/sys/security/audit/audit_arg.c ============================================================================== --- stable/7/sys/security/audit/audit_arg.c Fri Feb 6 12:06:39 2009 (r188223) +++ stable/7/sys/security/audit/audit_arg.c Fri Feb 6 12:10:28 2009 (r188224) @@ -356,6 +356,7 @@ void audit_arg_process(struct proc *p) { struct kaudit_record *ar; + struct ucred *cred; KASSERT(p != NULL, ("audit_arg_process: p == NULL")); @@ -365,13 +366,14 @@ audit_arg_process(struct proc *p) if (ar == NULL) return; - ar->k_ar.ar_arg_auid = p->p_ucred->cr_audit.ai_auid; - ar->k_ar.ar_arg_euid = p->p_ucred->cr_uid; - ar->k_ar.ar_arg_egid = p->p_ucred->cr_groups[0]; - ar->k_ar.ar_arg_ruid = p->p_ucred->cr_ruid; - ar->k_ar.ar_arg_rgid = p->p_ucred->cr_rgid; - ar->k_ar.ar_arg_asid = p->p_ucred->cr_audit.ai_asid; - ar->k_ar.ar_arg_termid_addr = p->p_ucred->cr_audit.ai_termid; + cred = p->p_ucred; + ar->k_ar.ar_arg_auid = cred->cr_audit.ai_auid; + ar->k_ar.ar_arg_euid = cred->cr_uid; + ar->k_ar.ar_arg_egid = cred->cr_groups[0]; + ar->k_ar.ar_arg_ruid = cred->cr_ruid; + ar->k_ar.ar_arg_rgid = cred->cr_rgid; + ar->k_ar.ar_arg_asid = cred->cr_audit.ai_asid; + ar->k_ar.ar_arg_termid_addr = cred->cr_audit.ai_termid; ar->k_ar.ar_arg_pid = p->p_pid; ARG_SET_VALID(ar, ARG_AUID | ARG_EUID | ARG_EGID | ARG_RUID | ARG_RGID | ARG_ASID | ARG_TERMID_ADDR | ARG_PID | ARG_PROCESS); Modified: stable/7/sys/security/audit/audit_syscalls.c ============================================================================== --- stable/7/sys/security/audit/audit_syscalls.c Fri Feb 6 12:06:39 2009 (r188223) +++ stable/7/sys/security/audit/audit_syscalls.c Fri Feb 6 12:10:28 2009 (r188224) @@ -157,7 +157,7 @@ free_out: int auditon(struct thread *td, struct auditon_args *uap) { - struct ucred *newcred, *oldcred; + struct ucred *cred, *newcred, *oldcred; int error; union auditon_udata udata; struct proc *tp; @@ -321,22 +321,21 @@ auditon(struct thread *td, struct audito PROC_UNLOCK(tp); return (EINVAL); } - if (tp->p_ucred->cr_audit.ai_termid.at_type == AU_IPv6) { + cred = tp->p_ucred; + if (cred->cr_audit.ai_termid.at_type == AU_IPv6) { PROC_UNLOCK(tp); return (EINVAL); } - udata.au_aupinfo.ap_auid = - tp->p_ucred->cr_audit.ai_auid; + udata.au_aupinfo.ap_auid = cred->cr_audit.ai_auid; udata.au_aupinfo.ap_mask.am_success = - tp->p_ucred->cr_audit.ai_mask.am_success; + cred->cr_audit.ai_mask.am_success; udata.au_aupinfo.ap_mask.am_failure = - tp->p_ucred->cr_audit.ai_mask.am_failure; + cred->cr_audit.ai_mask.am_failure; udata.au_aupinfo.ap_termid.machine = - tp->p_ucred->cr_audit.ai_termid.at_addr[0]; + cred->cr_audit.ai_termid.at_addr[0]; udata.au_aupinfo.ap_termid.port = - (dev_t)tp->p_ucred->cr_audit.ai_termid.at_port; - udata.au_aupinfo.ap_asid = - tp->p_ucred->cr_audit.ai_asid; + (dev_t)cred->cr_audit.ai_termid.at_port; + udata.au_aupinfo.ap_asid = cred->cr_audit.ai_asid; PROC_UNLOCK(tp); break; @@ -381,16 +380,14 @@ auditon(struct thread *td, struct audito return (EINVAL); if ((tp = pfind(udata.au_aupinfo_addr.ap_pid)) == NULL) return (EINVAL); - udata.au_aupinfo_addr.ap_auid = - tp->p_ucred->cr_audit.ai_auid; + cred = tp->p_ucred; + udata.au_aupinfo_addr.ap_auid = cred->cr_audit.ai_auid; udata.au_aupinfo_addr.ap_mask.am_success = - tp->p_ucred->cr_audit.ai_mask.am_success; + cred->cr_audit.ai_mask.am_success; udata.au_aupinfo_addr.ap_mask.am_failure = - tp->p_ucred->cr_audit.ai_mask.am_failure; - udata.au_aupinfo_addr.ap_termid = - tp->p_ucred->cr_audit.ai_termid; - udata.au_aupinfo_addr.ap_asid = - tp->p_ucred->cr_audit.ai_asid; + cred->cr_audit.ai_mask.am_failure; + udata.au_aupinfo_addr.ap_termid = cred->cr_audit.ai_termid; + udata.au_aupinfo_addr.ap_asid = cred->cr_audit.ai_asid; PROC_UNLOCK(tp); break; @@ -500,21 +497,23 @@ int getaudit(struct thread *td, struct getaudit_args *uap) { struct auditinfo ai; + struct ucred *cred; int error; - if (jailed(td->td_ucred)) + cred = td->td_ucred; + if (jailed(cred)) return (ENOSYS); error = priv_check(td, PRIV_AUDIT_GETAUDIT); if (error) return (error); - if (td->td_ucred->cr_audit.ai_termid.at_type == AU_IPv6) + if (cred->cr_audit.ai_termid.at_type == AU_IPv6) return (E2BIG); bzero(&ai, sizeof(ai)); - ai.ai_auid = td->td_ucred->cr_audit.ai_auid; - ai.ai_mask = td->td_ucred->cr_audit.ai_mask; - ai.ai_asid = td->td_ucred->cr_audit.ai_asid; - ai.ai_termid.machine = td->td_ucred->cr_audit.ai_termid.at_addr[0]; - ai.ai_termid.port = td->td_ucred->cr_audit.ai_termid.at_port; + ai.ai_auid = cred->cr_audit.ai_auid; + ai.ai_mask = cred->cr_audit.ai_mask; + ai.ai_asid = cred->cr_audit.ai_asid; + ai.ai_termid.machine = cred->cr_audit.ai_termid.at_addr[0]; + ai.ai_termid.port = cred->cr_audit.ai_termid.at_port; return (copyout(&ai, uap->auditinfo, sizeof(ai))); } From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12:14:57 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 C478610657C0; Fri, 6 Feb 2009 12:14:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B08B88FC27; Fri, 6 Feb 2009 12:14:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16CEvYu060691; Fri, 6 Feb 2009 12:14:57 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16CEvjs060690; Fri, 6 Feb 2009 12:14:57 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061214.n16CEvjs060690@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:14: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: r188225 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit 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, 06 Feb 2009 12:14:59 -0000 Author: rwatson Date: Fri Feb 6 12:14:57 2009 New Revision: 188225 URL: http://svn.freebsd.org/changeset/base/188225 Log: Merge r185293 from head to stable/7: Regularize /* FALLTHROUGH */ comments in the BSM event type switch, and add one that was missing. Coverity ID: 3960 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit_bsm.c Modified: stable/7/sys/security/audit/audit_bsm.c ============================================================================== --- stable/7/sys/security/audit/audit_bsm.c Fri Feb 6 12:10:28 2009 (r188224) +++ stable/7/sys/security/audit/audit_bsm.c Fri Feb 6 12:14:57 2009 (r188225) @@ -568,7 +568,7 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(1, "cmd", ar->ar_arg_cmd); kau_write(rec, tok); } - /* fall thru */ + /* FALLTHROUGH */ case AUE_AUDITON_GETCAR: case AUE_AUDITON_GETCLASS: @@ -641,7 +641,8 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(2, "mode", ar->ar_arg_mode); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ + case AUE_ACCESS: case AUE_CHDIR: case AUE_CHROOT: @@ -849,7 +850,8 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(1, "flags", ar->ar_arg_fflags); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ + case AUE_FORK: case AUE_VFORK: if (ARG_IS_VALID(kar, ARG_PID)) { @@ -985,7 +987,7 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_text(ar->ar_arg_text); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ case AUE_UMOUNT: UPATH1_VNODE1_TOKENS; @@ -1034,7 +1036,7 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(3, "mode", ar->ar_arg_mode); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ case AUE_OPEN_R: case AUE_OPEN_RT: @@ -1311,6 +1313,8 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(3, "mode", ar->ar_arg_mode); kau_write(rec, tok); } + /* FALLTHROUGH */ + case AUE_SHMUNLINK: if (ARG_IS_VALID(kar, ARG_TEXT)) { tok = au_to_text(ar->ar_arg_text); @@ -1344,7 +1348,7 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(4, "value", ar->ar_arg_value); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ case AUE_SEMUNLINK: if (ARG_IS_VALID(kar, ARG_TEXT)) { From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12:20: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 04D52106564A; Fri, 6 Feb 2009 12:20:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E610A8FC1C; Fri, 6 Feb 2009 12:20:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16CK8XJ060902; Fri, 6 Feb 2009 12:20:08 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16CK8og060901; Fri, 6 Feb 2009 12:20:08 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061220.n16CK8og060901@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:20:08 +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: r188226 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netipx 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, 06 Feb 2009 12:20:09 -0000 Author: rwatson Date: Fri Feb 6 12:20:08 2009 New Revision: 188226 URL: http://svn.freebsd.org/changeset/base/188226 Log: Merge r185928 from head to stable/7: Add missing "goto set_head" for SO_IPX_CHECKSUM; otherwise we fall through to the SO_HEADERS_ON_OUTPUT case and set that instead. Found with: Coverity Prevent(tm) Coverity ID: 3988 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netipx/ipx_usrreq.c Modified: stable/7/sys/netipx/ipx_usrreq.c ============================================================================== --- stable/7/sys/netipx/ipx_usrreq.c Fri Feb 6 12:14:57 2009 (r188225) +++ stable/7/sys/netipx/ipx_usrreq.c Fri Feb 6 12:20:08 2009 (r188226) @@ -412,6 +412,7 @@ ipx_ctloutput(struct socket *so, struct case SO_IPX_CHECKSUM: mask = IPXP_CHECKSUM; + goto set_head; case SO_HEADERS_ON_OUTPUT: mask = IPXP_RAWOUT; From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12: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 32AB6106566B; Fri, 6 Feb 2009 12:22:01 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 044AA8FC17; Fri, 6 Feb 2009 12:22:01 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16CM0Y6060995; Fri, 6 Feb 2009 12:22:00 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16CM0OH060994; Fri, 6 Feb 2009 12:22:00 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061222.n16CM0OH060994@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:22: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: r188227 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit 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, 06 Feb 2009 12:22:02 -0000 Author: rwatson Date: Fri Feb 6 12:22:00 2009 New Revision: 188227 URL: http://svn.freebsd.org/changeset/base/188227 Log: Merge r184489 from head to stable/7: When we drop an audit record going to and audit pipe because the audit pipe has overflowed, drop the newest, rather than oldest, record. This makes overflow drop behavior consistent with memory allocation failure leading to drop, avoids touching the consumer end of the queue from a producer, and lowers the CPU overhead of dropping a record by dropping before memory allocation and copying. Obtained from: Apple, Inc. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit_pipe.c Modified: stable/7/sys/security/audit/audit_pipe.c ============================================================================== --- stable/7/sys/security/audit/audit_pipe.c Fri Feb 6 12:20:08 2009 (r188226) +++ stable/7/sys/security/audit/audit_pipe.c Fri Feb 6 12:22:00 2009 (r188227) @@ -396,17 +396,22 @@ audit_pipe_preselect(au_id_t auid, au_ev /* * Append individual record to a queue -- allocate queue-local buffer, and - * add to the queue. We try to drop from the head of the queue so that more - * recent events take precedence over older ones, but if allocation fails we - * do drop the new event. + * add to the queue. If the queue is full or we can't allocate memory, drop + * the newest record. */ static void audit_pipe_append(struct audit_pipe *ap, void *record, u_int record_len) { - struct audit_pipe_entry *ape, *ape_remove; + struct audit_pipe_entry *ape; mtx_assert(&audit_pipe_mtx, MA_OWNED); + if (ap->ap_qlen >= ap->ap_qlimit) { + ap->ap_drops++; + audit_pipe_drops++; + return; + } + ape = malloc(sizeof(*ape), M_AUDIT_PIPE_ENTRY, M_NOWAIT | M_ZERO); if (ape == NULL) { ap->ap_drops++; @@ -425,15 +430,6 @@ audit_pipe_append(struct audit_pipe *ap, bcopy(record, ape->ape_record, record_len); ape->ape_record_len = record_len; - if (ap->ap_qlen >= ap->ap_qlimit) { - ape_remove = TAILQ_FIRST(&ap->ap_queue); - TAILQ_REMOVE(&ap->ap_queue, ape_remove, ape_queue); - audit_pipe_entry_free(ape_remove); - ap->ap_qlen--; - ap->ap_drops++; - audit_pipe_drops++; - } - TAILQ_INSERT_TAIL(&ap->ap_queue, ape, ape_queue); ap->ap_inserts++; ap->ap_qlen++; From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12:24:30 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 ACA871065687; Fri, 6 Feb 2009 12:24:30 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 978BF8FC19; Fri, 6 Feb 2009 12:24:30 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16COUtB061111; Fri, 6 Feb 2009 12:24:30 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16COUb5061110; Fri, 6 Feb 2009 12:24:30 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061224.n16COUb5061110@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:24:30 +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: r188228 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit 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, 06 Feb 2009 12:24:32 -0000 Author: rwatson Date: Fri Feb 6 12:24:30 2009 New Revision: 188228 URL: http://svn.freebsd.org/changeset/base/188228 Log: Merge r184488 from head to stable/7: Break out single audit_pipe_mtx into two types of locks: a global rwlock protecting the list of audit pipes, and a per-pipe mutex protecting the queue. Likewise, replace the single global condition variable used to signal delivery of a record to one or more pipes, and add a per-pipe condition variable to avoid spurious wakeups when event subscriptions differ across multiple pipes. This slightly increases the cost of delivering to audit pipes, but should reduce lock contention in the presence of multiple readers as only the per-pipe lock is required to read from a pipe, as well as avoid overheading when different pipes are used in different ways. Sponsored by: Apple, Inc. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/audit/audit_pipe.c Modified: stable/7/sys/security/audit/audit_pipe.c ============================================================================== --- stable/7/sys/security/audit/audit_pipe.c Fri Feb 6 12:22:00 2009 (r188227) +++ stable/7/sys/security/audit/audit_pipe.c Fri Feb 6 12:24:30 2009 (r188228) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2006 Robert N. M. Watson + * Copyright (c) 2008 Apple, Inc. * All rights reserved. * * This software was developed by Robert Watson for the TrustedBSD Project. @@ -41,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -115,6 +117,17 @@ struct audit_pipe { struct selinfo ap_selinfo; struct sigio *ap_sigio; + /* + * Per-pipe mutex protecting most fields in this data structure. + */ + struct mtx ap_lock; + + /* + * Condition variable to signal when data has been delivered to a + * pipe. + */ + struct cv ap_cv; + u_int ap_qlen; u_int ap_qlimit; @@ -144,19 +157,31 @@ struct audit_pipe { TAILQ_ENTRY(audit_pipe) ap_list; }; +#define AUDIT_PIPE_LOCK(ap) mtx_lock(&(ap)->ap_lock) +#define AUDIT_PIPE_LOCK_ASSERT(ap) mtx_assert(&(ap)->ap_lock, MA_OWNED) +#define AUDIT_PIPE_LOCK_DESTROY(ap) mtx_destroy(&(ap)->ap_lock) +#define AUDIT_PIPE_LOCK_INIT(ap) mtx_init(&(ap)->ap_lock, \ + "audit_pipe_lock", NULL, MTX_DEF) +#define AUDIT_PIPE_UNLOCK(ap) mtx_unlock(&(ap)->ap_lock) +#define AUDIT_PIPE_MTX(ap) (&(ap)->ap_lock) + /* - * Global list of audit pipes, mutex to protect it and the pipes. Finer - * grained locking may be desirable at some point. + * Global list of audit pipes, rwlock to protect it. Individual record + * queues on pipes are protected by per-pipe locks; these locks synchronize + * between threads walking the list to deliver to individual pipes and add/ + * remove of pipes, and are mostly acquired for read. */ static TAILQ_HEAD(, audit_pipe) audit_pipe_list; -static struct mtx audit_pipe_mtx; +static struct rwlock audit_pipe_lock; -/* - * This CV is used to wakeup on an audit record write. Eventually, it might - * be per-pipe to avoid unnecessary wakeups when several pipes with different - * preselection masks are present. - */ -static struct cv audit_pipe_cv; +#define AUDIT_PIPE_LIST_LOCK_INIT() rw_init(&audit_pipe_lock, \ + "audit_pipe_list_lock") +#define AUDIT_PIPE_LIST_RLOCK() rw_rlock(&audit_pipe_lock) +#define AUDIT_PIPE_LIST_RUNLOCK() rw_runlock(&audit_pipe_lock) +#define AUDIT_PIPE_LIST_WLOCK() rw_wlock(&audit_pipe_lock) +#define AUDIT_PIPE_LIST_WLOCK_ASSERT() rw_assert(&audit_pipe_lock, \ + RA_WLOCKED) +#define AUDIT_PIPE_LIST_WUNLOCK() rw_wunlock(&audit_pipe_lock) /* * Cloning related variables and constants. @@ -224,7 +249,7 @@ audit_pipe_preselect_find(struct audit_p { struct audit_pipe_preselect *app; - mtx_assert(&audit_pipe_mtx, MA_OWNED); + AUDIT_PIPE_LOCK_ASSERT(ap); TAILQ_FOREACH(app, &ap->ap_preselect_list, app_list) { if (app->app_auid == auid) @@ -243,14 +268,14 @@ audit_pipe_preselect_get(struct audit_pi struct audit_pipe_preselect *app; int error; - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); app = audit_pipe_preselect_find(ap, auid); if (app != NULL) { *maskp = app->app_mask; error = 0; } else error = ENOENT; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); return (error); } @@ -268,7 +293,7 @@ audit_pipe_preselect_set(struct audit_pi * set, and allocate. We will free it if it is unneeded. */ app_new = malloc(sizeof(*app_new), M_AUDIT_PIPE_PRESELECT, M_WAITOK); - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); app = audit_pipe_preselect_find(ap, auid); if (app == NULL) { app = app_new; @@ -277,7 +302,7 @@ audit_pipe_preselect_set(struct audit_pi TAILQ_INSERT_TAIL(&ap->ap_preselect_list, app, app_list); } app->app_mask = mask; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); if (app_new != NULL) free(app_new, M_AUDIT_PIPE_PRESELECT); } @@ -291,14 +316,14 @@ audit_pipe_preselect_delete(struct audit struct audit_pipe_preselect *app; int error; - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); app = audit_pipe_preselect_find(ap, auid); if (app != NULL) { TAILQ_REMOVE(&ap->ap_preselect_list, app, app_list); error = 0; } else error = ENOENT; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); if (app != NULL) free(app, M_AUDIT_PIPE_PRESELECT); return (error); @@ -312,7 +337,7 @@ audit_pipe_preselect_flush_locked(struct { struct audit_pipe_preselect *app; - mtx_assert(&audit_pipe_mtx, MA_OWNED); + AUDIT_PIPE_LOCK_ASSERT(ap); while ((app = TAILQ_FIRST(&ap->ap_preselect_list)) != NULL) { TAILQ_REMOVE(&ap->ap_preselect_list, app, app_list); @@ -324,9 +349,9 @@ static void audit_pipe_preselect_flush(struct audit_pipe *ap) { - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); audit_pipe_preselect_flush_locked(ap); - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); } /*- @@ -345,7 +370,7 @@ audit_pipe_preselect_check(struct audit_ { struct audit_pipe_preselect *app; - mtx_assert(&audit_pipe_mtx, MA_OWNED); + AUDIT_PIPE_LOCK_ASSERT(ap); switch (ap->ap_preselect_mode) { case AUDITPIPE_PRESELECT_MODE_TRAIL: @@ -382,15 +407,18 @@ audit_pipe_preselect(au_id_t auid, au_ev { struct audit_pipe *ap; - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LIST_RLOCK(); TAILQ_FOREACH(ap, &audit_pipe_list, ap_list) { + AUDIT_PIPE_LOCK(ap); if (audit_pipe_preselect_check(ap, auid, event, class, sorf, trail_preselect)) { - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); + AUDIT_PIPE_LIST_RUNLOCK(); return (1); } + AUDIT_PIPE_UNLOCK(ap); } - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_LIST_RUNLOCK(); return (0); } @@ -404,7 +432,7 @@ audit_pipe_append(struct audit_pipe *ap, { struct audit_pipe_entry *ape; - mtx_assert(&audit_pipe_mtx, MA_OWNED); + AUDIT_PIPE_LOCK_ASSERT(ap); if (ap->ap_qlen >= ap->ap_qlimit) { ap->ap_drops++; @@ -437,6 +465,7 @@ audit_pipe_append(struct audit_pipe *ap, KNOTE_LOCKED(&ap->ap_selinfo.si_note, 0); if (ap->ap_flags & AUDIT_PIPE_ASYNC) pgsigio(&ap->ap_sigio, SIGIO, 0); + cv_broadcast(&ap->ap_cv); } /* @@ -450,20 +479,23 @@ audit_pipe_submit(au_id_t auid, au_event struct audit_pipe *ap; /* - * Lockless read to avoid mutex overhead if pipes are not in use. + * Lockless read to avoid lock overhead if pipes are not in use. */ if (TAILQ_FIRST(&audit_pipe_list) == NULL) return; - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LIST_RLOCK(); TAILQ_FOREACH(ap, &audit_pipe_list, ap_list) { + AUDIT_PIPE_LOCK(ap); if (audit_pipe_preselect_check(ap, auid, event, class, sorf, trail_select)) audit_pipe_append(ap, record, record_len); + AUDIT_PIPE_UNLOCK(ap); } + AUDIT_PIPE_LIST_RUNLOCK(); + + /* Unlocked increment. */ audit_pipe_records++; - mtx_unlock(&audit_pipe_mtx); - cv_broadcastpri(&audit_pipe_cv, PSOCK); } /* @@ -480,17 +512,21 @@ audit_pipe_submit_user(void *record, u_i struct audit_pipe *ap; /* - * Lockless read to avoid mutex overhead if pipes are not in use. + * Lockless read to avoid lock overhead if pipes are not in use. */ if (TAILQ_FIRST(&audit_pipe_list) == NULL) return; - mtx_lock(&audit_pipe_mtx); - TAILQ_FOREACH(ap, &audit_pipe_list, ap_list) + AUDIT_PIPE_LIST_RLOCK(); + TAILQ_FOREACH(ap, &audit_pipe_list, ap_list) { + AUDIT_PIPE_LOCK(ap); audit_pipe_append(ap, record, record_len); + AUDIT_PIPE_UNLOCK(ap); + } + AUDIT_PIPE_LIST_RUNLOCK(); + + /* Unlocked increment. */ audit_pipe_records++; - mtx_unlock(&audit_pipe_mtx); - cv_broadcastpri(&audit_pipe_cv, PSOCK); } /* @@ -501,7 +537,7 @@ audit_pipe_pop(struct audit_pipe *ap) { struct audit_pipe_entry *ape; - mtx_assert(&audit_pipe_mtx, MA_OWNED); + AUDIT_PIPE_LOCK_ASSERT(ap); ape = TAILQ_FIRST(&ap->ap_queue); KASSERT((ape == NULL && ap->ap_qlen == 0) || @@ -522,15 +558,17 @@ audit_pipe_alloc(void) { struct audit_pipe *ap; - mtx_assert(&audit_pipe_mtx, MA_OWNED); + AUDIT_PIPE_LIST_WLOCK_ASSERT(); ap = malloc(sizeof(*ap), M_AUDIT_PIPE, M_NOWAIT | M_ZERO); if (ap == NULL) return (NULL); ap->ap_qlimit = AUDIT_PIPE_QLIMIT_DEFAULT; TAILQ_INIT(&ap->ap_queue); - knlist_init(&ap->ap_selinfo.si_note, &audit_pipe_mtx, NULL, NULL, + knlist_init(&ap->ap_selinfo.si_note, AUDIT_PIPE_MTX(ap), NULL, NULL, NULL); + AUDIT_PIPE_LOCK_INIT(ap); + cv_init(&ap->ap_cv, "audit_pipe"); /* * Default flags, naflags, and auid-specific preselection settings to @@ -562,7 +600,7 @@ audit_pipe_flush(struct audit_pipe *ap) { struct audit_pipe_entry *ape; - mtx_assert(&audit_pipe_mtx, MA_OWNED); + AUDIT_PIPE_LOCK_ASSERT(ap); while ((ape = TAILQ_FIRST(&ap->ap_queue)) != NULL) { TAILQ_REMOVE(&ap->ap_queue, ape, ape_queue); @@ -574,18 +612,21 @@ audit_pipe_flush(struct audit_pipe *ap) /* * Free an audit pipe; this means freeing all preselection state and all - * records in the pipe. Assumes mutex is held to prevent any new records - * from being inserted during the free, and that the audit pipe is still on - * the global list. + * records in the pipe. Assumes global write lock and pipe mutex are held to + * prevent any new records from being inserted during the free, and that the + * audit pipe is still on the global list. */ static void audit_pipe_free(struct audit_pipe *ap) { - mtx_assert(&audit_pipe_mtx, MA_OWNED); + AUDIT_PIPE_LIST_WLOCK_ASSERT(); + AUDIT_PIPE_LOCK_ASSERT(ap); audit_pipe_preselect_flush_locked(ap); audit_pipe_flush(ap); + cv_destroy(&ap->ap_cv); + AUDIT_PIPE_LOCK_DESTROY(ap); knlist_destroy(&ap->ap_selinfo.si_note); TAILQ_REMOVE(&audit_pipe_list, ap, ap_list); free(ap, M_AUDIT_PIPE); @@ -631,22 +672,22 @@ audit_pipe_open(struct cdev *dev, int of { struct audit_pipe *ap; - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LIST_WLOCK(); ap = dev->si_drv1; if (ap == NULL) { ap = audit_pipe_alloc(); if (ap == NULL) { - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_LIST_WUNLOCK(); return (ENOMEM); } dev->si_drv1 = ap; } else { KASSERT(ap->ap_open, ("audit_pipe_open: ap && !ap_open")); - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_LIST_WUNLOCK(); return (EBUSY); } - ap->ap_open = 1; - mtx_unlock(&audit_pipe_mtx); + ap->ap_open = 1; /* No lock required yet. */ + AUDIT_PIPE_LIST_WUNLOCK(); fsetown(td->td_proc->p_pid, &ap->ap_sigio); return (0); } @@ -662,12 +703,14 @@ audit_pipe_close(struct cdev *dev, int f ap = dev->si_drv1; KASSERT(ap != NULL, ("audit_pipe_close: ap == NULL")); KASSERT(ap->ap_open, ("audit_pipe_close: !ap_open")); + funsetown(&ap->ap_sigio); - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LIST_WLOCK(); + AUDIT_PIPE_LOCK(ap); ap->ap_open = 0; audit_pipe_free(ap); dev->si_drv1 = NULL; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_LIST_WUNLOCK(); return (0); } @@ -698,33 +741,33 @@ audit_pipe_ioctl(struct cdev *dev, u_lon */ switch (cmd) { case FIONBIO: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); if (*(int *)data) ap->ap_flags |= AUDIT_PIPE_NBIO; else ap->ap_flags &= ~AUDIT_PIPE_NBIO; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; case FIONREAD: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); if (TAILQ_FIRST(&ap->ap_queue) != NULL) *(int *)data = TAILQ_FIRST(&ap->ap_queue)->ape_record_len; else *(int *)data = 0; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; case FIOASYNC: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); if (*(int *)data) ap->ap_flags |= AUDIT_PIPE_ASYNC; else ap->ap_flags &= ~AUDIT_PIPE_ASYNC; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; @@ -768,34 +811,34 @@ audit_pipe_ioctl(struct cdev *dev, u_lon break; case AUDITPIPE_GET_PRESELECT_FLAGS: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); maskp = (au_mask_t *)data; *maskp = ap->ap_preselect_flags; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; case AUDITPIPE_SET_PRESELECT_FLAGS: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); maskp = (au_mask_t *)data; ap->ap_preselect_flags = *maskp; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; case AUDITPIPE_GET_PRESELECT_NAFLAGS: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); maskp = (au_mask_t *)data; *maskp = ap->ap_preselect_naflags; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; case AUDITPIPE_SET_PRESELECT_NAFLAGS: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); maskp = (au_mask_t *)data; ap->ap_preselect_naflags = *maskp; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; @@ -822,9 +865,9 @@ audit_pipe_ioctl(struct cdev *dev, u_lon break; case AUDITPIPE_GET_PRESELECT_MODE: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); *(int *)data = ap->ap_preselect_mode; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; @@ -833,9 +876,9 @@ audit_pipe_ioctl(struct cdev *dev, u_lon switch (mode) { case AUDITPIPE_PRESELECT_MODE_TRAIL: case AUDITPIPE_PRESELECT_MODE_LOCAL: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); ap->ap_preselect_mode = mode; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; @@ -845,9 +888,9 @@ audit_pipe_ioctl(struct cdev *dev, u_lon break; case AUDITPIPE_FLUSH: - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); audit_pipe_flush(ap); - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); error = 0; break; @@ -906,7 +949,8 @@ audit_pipe_read(struct cdev *dev, struct ap = dev->si_drv1; KASSERT(ap != NULL, ("audit_pipe_read: ap == NULL")); - mtx_lock(&audit_pipe_mtx); + + AUDIT_PIPE_LOCK(ap); do { /* * Wait for a record that fits into the read buffer, dropping @@ -916,12 +960,12 @@ audit_pipe_read(struct cdev *dev, struct */ while ((ape = audit_pipe_pop(ap)) == NULL) { if (ap->ap_flags & AUDIT_PIPE_NBIO) { - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); return (EAGAIN); } - error = cv_wait_sig(&audit_pipe_cv, &audit_pipe_mtx); + error = cv_wait_sig(&ap->ap_cv, AUDIT_PIPE_MTX(ap)); if (error) { - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); return (error); } } @@ -931,7 +975,7 @@ audit_pipe_read(struct cdev *dev, struct ap->ap_truncates++; } while (1); ap->ap_reads++; - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); /* * Now read record to user space memory. Even if the read is short, @@ -955,13 +999,14 @@ audit_pipe_poll(struct cdev *dev, int ev revents = 0; ap = dev->si_drv1; KASSERT(ap != NULL, ("audit_pipe_poll: ap == NULL")); + if (events & (POLLIN | POLLRDNORM)) { - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); if (TAILQ_FIRST(&ap->ap_queue) != NULL) revents |= events & (POLLIN | POLLRDNORM); else selrecord(td, &ap->ap_selinfo); - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); } return (revents); } @@ -983,9 +1028,9 @@ audit_pipe_kqfilter(struct cdev *dev, st kn->kn_fop = &audit_pipe_read_filterops; kn->kn_hook = ap; - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); knlist_add(&ap->ap_selinfo.si_note, kn, 1); - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); return (0); } @@ -998,11 +1043,11 @@ audit_pipe_kqread(struct knote *kn, long struct audit_pipe_entry *ape; struct audit_pipe *ap; - mtx_assert(&audit_pipe_mtx, MA_OWNED); - ap = (struct audit_pipe *)kn->kn_hook; KASSERT(ap != NULL, ("audit_pipe_kqread: ap == NULL")); + AUDIT_PIPE_LOCK_ASSERT(ap); + if (ap->ap_qlen != 0) { ape = TAILQ_FIRST(&ap->ap_queue); KASSERT(ape != NULL, ("audit_pipe_kqread: ape == NULL")); @@ -1026,9 +1071,9 @@ audit_pipe_kqdetach(struct knote *kn) ap = (struct audit_pipe *)kn->kn_hook; KASSERT(ap != NULL, ("audit_pipe_kqdetach: ap == NULL")); - mtx_lock(&audit_pipe_mtx); + AUDIT_PIPE_LOCK(ap); knlist_remove(&ap->ap_selinfo.si_note, kn, 1); - mtx_unlock(&audit_pipe_mtx); + AUDIT_PIPE_UNLOCK(ap); } /* @@ -1039,8 +1084,7 @@ audit_pipe_init(void *unused) { TAILQ_INIT(&audit_pipe_list); - mtx_init(&audit_pipe_mtx, "audit_pipe_mtx", NULL, MTX_DEF); - cv_init(&audit_pipe_cv, "audit_pipe_cv"); + AUDIT_PIPE_LIST_LOCK_INIT(); clone_setup(&audit_pipe_clones); audit_pipe_eh_tag = EVENTHANDLER_REGISTER(dev_clone, From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12:27: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 75A40106567E; Fri, 6 Feb 2009 12:27:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F1178FC20; Fri, 6 Feb 2009 12:27:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16CRPZd061221; Fri, 6 Feb 2009 12:27:25 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16CRPQh061220; Fri, 6 Feb 2009 12:27:25 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061227.n16CRPQh061220@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:27:25 +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: r188229 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Fri, 06 Feb 2009 12:27:27 -0000 Author: rwatson Date: Fri Feb 6 12:27:25 2009 New Revision: 188229 URL: http://svn.freebsd.org/changeset/base/188229 Log: Merge r186603 from head to stabl/7: Rename mbcnt to mbcnt_delta in uipc_send() -- unlike other local variables named mbcnt in uipc_usrreq.c, this instance is a delta rather than a cache of sb_mbcnt. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/uipc_usrreq.c Modified: stable/7/sys/kern/uipc_usrreq.c ============================================================================== --- stable/7/sys/kern/uipc_usrreq.c Fri Feb 6 12:24:30 2009 (r188228) +++ stable/7/sys/kern/uipc_usrreq.c Fri Feb 6 12:27:25 2009 (r188229) @@ -751,7 +751,7 @@ uipc_send(struct socket *so, int flags, { struct unpcb *unp, *unp2; struct socket *so2; - u_int mbcnt, sbcc; + u_int mbcnt_delta, sbcc; u_long newhiwat; int error = 0; @@ -881,7 +881,7 @@ uipc_send(struct socket *so, int flags, control = NULL; } else sbappend_locked(&so2->so_rcv, m); - mbcnt = so2->so_rcv.sb_mbcnt - unp2->unp_mbcnt; + mbcnt_delta = so2->so_rcv.sb_mbcnt - unp2->unp_mbcnt; unp2->unp_mbcnt = so2->so_rcv.sb_mbcnt; sbcc = so2->so_rcv.sb_cc; sorwakeup_locked(so2); @@ -890,7 +890,7 @@ uipc_send(struct socket *so, int flags, newhiwat = so->so_snd.sb_hiwat - (sbcc - unp2->unp_cc); (void)chgsbsize(so->so_cred->cr_uidinfo, &so->so_snd.sb_hiwat, newhiwat, RLIM_INFINITY); - so->so_snd.sb_mbmax -= mbcnt; + so->so_snd.sb_mbmax -= mbcnt_delta; SOCKBUF_UNLOCK(&so->so_snd); unp2->unp_cc = sbcc; UNP_PCB_UNLOCK(unp2); From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12:33:40 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 145A61065677; Fri, 6 Feb 2009 12:33:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 017F98FC16; Fri, 6 Feb 2009 12:33:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16CXdBA061423; Fri, 6 Feb 2009 12:33:39 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16CXd1s061422; Fri, 6 Feb 2009 12:33:39 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061233.n16CXd1s061422@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:33: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: r188230 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Fri, 06 Feb 2009 12:33:40 -0000 Author: rwatson Date: Fri Feb 6 12:33:39 2009 New Revision: 188230 URL: http://svn.freebsd.org/changeset/base/188230 Log: Merge r187881 from head to stable/7: If a process is a zombie and we couldn't identify another useful state, print out the state as "zombine" in preference to "unknown" when ^T is pressed. Sponsored by: Google, Inc. (Note that this change appears in tty.c in 7.x vs tty_info.c in 8.x) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/tty.c Modified: stable/7/sys/kern/tty.c ============================================================================== --- stable/7/sys/kern/tty.c Fri Feb 6 12:27:25 2009 (r188229) +++ stable/7/sys/kern/tty.c Fri Feb 6 12:33:39 2009 (r188230) @@ -2608,6 +2608,8 @@ ttyinfo(struct tty *tp) state = "suspended"; else if (TD_AWAITING_INTR(td)) state = "intrwait"; + else if (pick->p_state == PRS_ZOMBIE) + state = "zombie"; else state = "unknown"; pctcpu = (sched_pctcpu(td) * 10000 + FSCALE / 2) >> FSHIFT; From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 12:39: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 06868106566C; Fri, 6 Feb 2009 12:39:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5A4F8FC14; Fri, 6 Feb 2009 12:39:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16CdgRR061594; Fri, 6 Feb 2009 12:39:42 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16CdgsN061589; Fri, 6 Feb 2009 12:39:42 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902061239.n16CdgsN061589@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 12:39:42 +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: r188231 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ffs 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, 06 Feb 2009 12:39:43 -0000 Author: rwatson Date: Fri Feb 6 12:39:42 2009 New Revision: 188231 URL: http://svn.freebsd.org/changeset/base/188231 Log: Merge r187790 from head to stable/7: Following a fair amount of real world experience with ACLs and extended attributes since FreeBSD 5, make the following semantic changes: - Don't update the inode modification time (mtime) when extended attributes (and hence also ACLs) are added, modified, or removed. - Don't update the inode access tie (atime) when extended attributes (and hence also ACLs) are queried. This means that rsync (and related tools) won't improperly think that the data in the file has changed when only the ACL has changed. Note that ffs_reallocblks() has not been changed to not update on an IO_EXT transaction, but currently EAs don't use the cluster write routines so this shouldn't be a problem. If EAs grow support for clustering, then VOP_REALLOCBLKS() will need to grow a flag argument to carry down IO_EXT to UFS. PR: ports/125739 Reported by: Alexander Zagrebin Tested by: pluknet , Greg Byshenk Discussed with: kib, kientzle, timur, Alexander Bokovoy Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ffs/ffs_alloc.c stable/7/sys/ufs/ffs/ffs_balloc.c stable/7/sys/ufs/ffs/ffs_extern.h stable/7/sys/ufs/ffs/ffs_inode.c stable/7/sys/ufs/ffs/ffs_vnops.c Modified: stable/7/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_alloc.c Fri Feb 6 12:33:39 2009 (r188230) +++ stable/7/sys/ufs/ffs/ffs_alloc.c Fri Feb 6 12:39:42 2009 (r188231) @@ -130,10 +130,10 @@ static int ffs_reallocblks_ufs2(struct v * available block is located. */ int -ffs_alloc(ip, lbn, bpref, size, cred, bnp) +ffs_alloc(ip, lbn, bpref, size, flags, cred, bnp) struct inode *ip; ufs2_daddr_t lbn, bpref; - int size; + int size, flags; struct ucred *cred; ufs2_daddr_t *bnp; { @@ -191,7 +191,10 @@ retry: UFS_UNLOCK(ump); } DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + delta); - ip->i_flag |= IN_CHANGE | IN_UPDATE; + if (flags & IO_EXT) + ip->i_flag |= IN_CHANGE; + else + ip->i_flag |= IN_CHANGE | IN_UPDATE; *bnp = bno; return (0); } @@ -227,12 +230,12 @@ nospace: * invoked to get an appropriate block. */ int -ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, cred, bpp) +ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, flags, cred, bpp) struct inode *ip; ufs2_daddr_t lbprev; ufs2_daddr_t bprev; ufs2_daddr_t bpref; - int osize, nsize; + int osize, nsize, flags; struct ucred *cred; struct buf **bpp; { @@ -317,7 +320,10 @@ retry: UFS_UNLOCK(ump); } DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + delta); - ip->i_flag |= IN_CHANGE | IN_UPDATE; + if (flags & IO_EXT) + ip->i_flag |= IN_CHANGE; + else + ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); bp->b_flags |= B_DONE; if ((bp->b_flags & (B_MALLOC | B_VMIO)) != B_VMIO) @@ -392,7 +398,10 @@ retry: UFS_UNLOCK(ump); } DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + delta); - ip->i_flag |= IN_CHANGE | IN_UPDATE; + if (flags & IO_EXT) + ip->i_flag |= IN_CHANGE; + else + ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); bp->b_flags |= B_DONE; if ((bp->b_flags & (B_MALLOC | B_VMIO)) != B_VMIO) Modified: stable/7/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_balloc.c Fri Feb 6 12:33:39 2009 (r188230) +++ stable/7/sys/ufs/ffs/ffs_balloc.c Fri Feb 6 12:39:42 2009 (r188231) @@ -133,7 +133,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_realloccg(ip, nb, dp->di_db[nb], ffs_blkpref_ufs1(ip, lastlbn, (int)nb, - &dp->di_db[0]), osize, (int)fs->fs_bsize, cred, &bp); + &dp->di_db[0]), osize, (int)fs->fs_bsize, flags, + cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -184,7 +185,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_realloccg(ip, lbn, dp->di_db[lbn], ffs_blkpref_ufs1(ip, lbn, (int)lbn, - &dp->di_db[0]), osize, nsize, cred, &bp); + &dp->di_db[0]), osize, nsize, flags, + cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -200,7 +202,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_alloc(ip, lbn, ffs_blkpref_ufs1(ip, lbn, (int)lbn, &dp->di_db[0]), - nsize, cred, &newb); + nsize, flags, cred, &newb); if (error) return (error); bp = getblk(vp, lbn, nsize, 0, 0, 0); @@ -241,7 +243,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - cred, &newb)) != 0) { + flags, cred, &newb)) != 0) { curthread->td_pflags &= saved_inbdflush; return (error); } @@ -291,8 +293,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); if (pref == 0) pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); - if ((error = - ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb)) != 0) { + if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, + flags, cred, &newb)) != 0) { brelse(bp); goto fail; } @@ -346,7 +348,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs1(ip, lbn, indirs[i].in_off, &bap[0]); error = ffs_alloc(ip, - lbn, pref, (int)fs->fs_bsize, cred, &newb); + lbn, pref, (int)fs->fs_bsize, flags, cred, &newb); if (error) { brelse(bp); goto fail; @@ -534,7 +536,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t dp->di_extb[nb], ffs_blkpref_ufs2(ip, lastlbn, (int)nb, &dp->di_extb[0]), osize, - (int)fs->fs_bsize, cred, &bp); + (int)fs->fs_bsize, flags, cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -545,7 +547,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t dp->di_extsize = smalllblktosize(fs, nb + 1); dp->di_extb[nb] = dbtofsb(fs, bp->b_blkno); bp->b_xflags |= BX_ALTDATA; - ip->i_flag |= IN_CHANGE | IN_UPDATE; + ip->i_flag |= IN_CHANGE; if (flags & IO_SYNC) bwrite(bp); else @@ -588,7 +590,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t error = ffs_realloccg(ip, -1 - lbn, dp->di_extb[lbn], ffs_blkpref_ufs2(ip, lbn, (int)lbn, - &dp->di_extb[0]), osize, nsize, cred, &bp); + &dp->di_extb[0]), osize, nsize, flags, + cred, &bp); if (error) return (error); bp->b_xflags |= BX_ALTDATA; @@ -605,7 +608,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_alloc(ip, lbn, ffs_blkpref_ufs2(ip, lbn, (int)lbn, &dp->di_extb[0]), - nsize, cred, &newb); + nsize, flags, cred, &newb); if (error) return (error); bp = getblk(vp, -1 - lbn, nsize, 0, 0, 0); @@ -618,7 +621,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t nsize, 0, bp); } dp->di_extb[lbn] = dbtofsb(fs, bp->b_blkno); - ip->i_flag |= IN_CHANGE | IN_UPDATE; + ip->i_flag |= IN_CHANGE; *bpp = bp; return (0); } @@ -636,7 +639,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t error = ffs_realloccg(ip, nb, dp->di_db[nb], ffs_blkpref_ufs2(ip, lastlbn, (int)nb, &dp->di_db[0]), osize, (int)fs->fs_bsize, - cred, &bp); + flags, cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -688,7 +691,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_realloccg(ip, lbn, dp->di_db[lbn], ffs_blkpref_ufs2(ip, lbn, (int)lbn, - &dp->di_db[0]), osize, nsize, cred, &bp); + &dp->di_db[0]), osize, nsize, flags, + cred, &bp); if (error) return (error); if (DOINGSOFTDEP(vp)) @@ -704,7 +708,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); error = ffs_alloc(ip, lbn, ffs_blkpref_ufs2(ip, lbn, (int)lbn, - &dp->di_db[0]), nsize, cred, &newb); + &dp->di_db[0]), nsize, flags, cred, &newb); if (error) return (error); bp = getblk(vp, lbn, nsize, 0, 0, 0); @@ -745,7 +749,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - cred, &newb)) != 0) { + flags, cred, &newb)) != 0) { curthread->td_pflags &= saved_inbdflush; return (error); } @@ -795,8 +799,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); if (pref == 0) pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); - if ((error = - ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb)) != 0) { + if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, + flags, cred, &newb)) != 0) { brelse(bp); goto fail; } @@ -850,7 +854,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs2(ip, lbn, indirs[i].in_off, &bap[0]); error = ffs_alloc(ip, - lbn, pref, (int)fs->fs_bsize, cred, &newb); + lbn, pref, (int)fs->fs_bsize, flags, cred, &newb); if (error) { brelse(bp); goto fail; Modified: stable/7/sys/ufs/ffs/ffs_extern.h ============================================================================== --- stable/7/sys/ufs/ffs/ffs_extern.h Fri Feb 6 12:33:39 2009 (r188230) +++ stable/7/sys/ufs/ffs/ffs_extern.h Fri Feb 6 12:39:42 2009 (r188231) @@ -48,8 +48,8 @@ struct vnode; struct vop_fsync_args; struct vop_reallocblks_args; -int ffs_alloc(struct inode *, - ufs2_daddr_t, ufs2_daddr_t, int, struct ucred *, ufs2_daddr_t *); +int ffs_alloc(struct inode *, ufs2_daddr_t, ufs2_daddr_t, int, int, + struct ucred *, ufs2_daddr_t *); int ffs_balloc_ufs1(struct vnode *a_vp, off_t a_startoffset, int a_size, struct ucred *a_cred, int a_flags, struct buf **a_bpp); int ffs_balloc_ufs2(struct vnode *a_vp, off_t a_startoffset, int a_size, @@ -72,7 +72,7 @@ void ffs_load_inode(struct buf *, struct int ffs_mountroot(void); int ffs_reallocblks(struct vop_reallocblks_args *); int ffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t, - ufs2_daddr_t, int, int, struct ucred *, struct buf **); + ufs2_daddr_t, int, int, int, struct ucred *, struct buf **); int ffs_sbupdate(struct ufsmount *, int, int); void ffs_setblock(struct fs *, u_char *, ufs1_daddr_t); int ffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t); Modified: stable/7/sys/ufs/ffs/ffs_inode.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_inode.c Fri Feb 6 12:33:39 2009 (r188230) +++ stable/7/sys/ufs/ffs/ffs_inode.c Fri Feb 6 12:39:42 2009 (r188231) @@ -208,7 +208,7 @@ ffs_truncate(vp, length, flags, cred, td oldblks[i] = ip->i_din2->di_extb[i]; ip->i_din2->di_extb[i] = 0; } - ip->i_flag |= IN_CHANGE | IN_UPDATE; + ip->i_flag |= IN_CHANGE; if ((error = ffs_update(vp, 1))) return (error); for (i = 0; i < NXADDR; i++) { Modified: stable/7/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_vnops.c Fri Feb 6 12:33:39 2009 (r188230) +++ stable/7/sys/ufs/ffs/ffs_vnops.c Fri Feb 6 12:39:42 2009 (r188231) @@ -1004,13 +1004,6 @@ ffs_extread(struct vnode *vp, struct uio bqrelse(bp); } } - - if ((error == 0 || uio->uio_resid != orig_resid) && - (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) { - VI_LOCK(vp); - ip->i_flag |= IN_ACCESS; - VI_UNLOCK(vp); - } return (error); } @@ -1116,7 +1109,7 @@ ffs_extwrite(struct vnode *vp, struct ui bdwrite(bp); if (error || xfersize == 0) break; - ip->i_flag |= IN_CHANGE | IN_UPDATE; + ip->i_flag |= IN_CHANGE; } /* * If we successfully wrote any data, and we are not the superuser From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 15:28: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 4F57A1065670; Fri, 6 Feb 2009 15:28: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 3C6C58FC1D; Fri, 6 Feb 2009 15:28:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16FS8oI065037; Fri, 6 Feb 2009 15:28:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16FS8cu065036; Fri, 6 Feb 2009 15:28:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200902061528.n16FS8cu065036@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Feb 2009 15:28:08 +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: r188238 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb net 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, 06 Feb 2009 15:28:10 -0000 Author: jhb Date: Fri Feb 6 15:28:08 2009 New Revision: 188238 URL: http://svn.freebsd.org/changeset/base/188238 Log: MFC: Only start the if_slowtimo timer if it is needed. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/net/if.c Modified: stable/7/sys/net/if.c ============================================================================== --- stable/7/sys/net/if.c Fri Feb 6 15:27:40 2009 (r188237) +++ stable/7/sys/net/if.c Fri Feb 6 15:28:08 2009 (r188238) @@ -84,6 +84,8 @@ #include +static int slowtimo_started; + SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers"); SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-management"); @@ -399,7 +401,13 @@ if_check(void *dummy __unused) } IFNET_RUNLOCK(); splx(s); - if_slowtimo(0); + + /* + * If at least one interface added during boot uses + * if_watchdog then start the timer. + */ + if (slowtimo_started) + if_slowtimo(0); } /* @@ -602,9 +610,17 @@ if_attach(struct ifnet *ifp) /* Announce the interface. */ rt_ifannouncemsg(ifp, IFAN_ARRIVAL); - if (ifp->if_watchdog != NULL) + if (ifp->if_watchdog != NULL) { if_printf(ifp, "WARNING: using obsoleted if_watchdog interface\n"); + + /* + * Note that we need if_slowtimo(). If this happens after + * boot, then call if_slowtimo() directly. + */ + if (atomic_cmpset_int(&slowtimo_started, 0, 1) && !cold) + if_slowtimo(0); + } if (ifp->if_flags & IFF_NEEDSGIANT) if_printf(ifp, "WARNING: using obsoleted IFF_NEEDSGIANT flag\n"); From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 16:05: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 D82B41065677; Fri, 6 Feb 2009 16:05:00 +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 C0D9B8FC1D; Fri, 6 Feb 2009 16:05:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16G50lt065705; Fri, 6 Feb 2009 16:05:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16G50pb065704; Fri, 6 Feb 2009 16:05:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200902061605.n16G50pb065704@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Feb 2009 16:05: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: r188239 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Fri, 06 Feb 2009 16:05:03 -0000 Author: jhb Date: Fri Feb 6 16:05:00 2009 New Revision: 188239 URL: http://svn.freebsd.org/changeset/base/188239 Log: MFC: Push down Giant in the vlnru kproc main loop so that it is only acquired around calls to vlrureclaim() on non-MPSAFE filesystems. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/vfs_subr.c Modified: stable/7/sys/kern/vfs_subr.c ============================================================================== --- stable/7/sys/kern/vfs_subr.c Fri Feb 6 15:28:08 2009 (r188238) +++ stable/7/sys/kern/vfs_subr.c Fri Feb 6 16:05:00 2009 (r188239) @@ -717,15 +717,13 @@ static void vnlru_proc(void) { struct mount *mp, *nmp; - int done; + int done, vfslocked; struct proc *p = vnlruproc; struct thread *td = curthread; EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, p, SHUTDOWN_PRI_FIRST); - mtx_lock(&Giant); - for (;;) { kthread_suspend_check(p); mtx_lock(&vnode_free_list_mtx); @@ -742,19 +740,13 @@ vnlru_proc(void) done = 0; mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { - int vfsunlocked; if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx, td)) { nmp = TAILQ_NEXT(mp, mnt_list); continue; } - if (!VFS_NEEDSGIANT(mp)) { - mtx_unlock(&Giant); - vfsunlocked = 1; - } else - vfsunlocked = 0; + vfslocked = VFS_LOCK_GIANT(mp); done += vlrureclaim(mp); - if (vfsunlocked) - mtx_lock(&Giant); + VFS_UNLOCK_GIANT(vfslocked); mtx_lock(&mountlist_mtx); nmp = TAILQ_NEXT(mp, mnt_list); vfs_unbusy(mp, td); From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 17:19:03 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 2DD8B1065703; Fri, 6 Feb 2009 17:19:03 +0000 (UTC) (envelope-from tabthorpe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AAD58FC26; Fri, 6 Feb 2009 17:19:03 +0000 (UTC) (envelope-from tabthorpe@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16HJ2uw067122; Fri, 6 Feb 2009 17:19:02 GMT (envelope-from tabthorpe@svn.freebsd.org) Received: (from tabthorpe@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16HJ26o067119; Fri, 6 Feb 2009 17:19:02 GMT (envelope-from tabthorpe@svn.freebsd.org) Message-Id: <200902061719.n16HJ26o067119@svn.freebsd.org> From: Thomas Abthorpe Date: Fri, 6 Feb 2009 17:19:02 +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: r188241 - stable/7/share/man/man5 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, 06 Feb 2009 17:19:04 -0000 Author: tabthorpe (ports committer) Date: Fri Feb 6 17:19:02 2009 New Revision: 188241 URL: http://svn.freebsd.org/changeset/base/188241 Log: - MFC the portindex(5) manual page PR: docs/70652 Approved by: trhodes Added: stable/7/share/man/man5/portindex.5 - copied, changed from r187825, head/share/man/man5/portindex.5 Modified: stable/7/share/man/man5/Makefile Modified: stable/7/share/man/man5/Makefile ============================================================================== --- stable/7/share/man/man5/Makefile Fri Feb 6 17:14:07 2009 (r188240) +++ stable/7/share/man/man5/Makefile Fri Feb 6 17:19:02 2009 (r188241) @@ -51,6 +51,7 @@ MAN= acct.5 \ pbm.5 \ periodic.conf.5 \ phones.5 \ + portindex.5 \ portsnap.conf.5 \ procfs.5 \ protocols.5 \ Copied and modified: stable/7/share/man/man5/portindex.5 (from r187825, head/share/man/man5/portindex.5) ============================================================================== --- head/share/man/man5/portindex.5 Wed Jan 28 15:22:44 2009 (r187825, copy source) +++ stable/7/share/man/man5/portindex.5 Fri Feb 6 17:19:02 2009 (r188241) @@ -90,8 +90,8 @@ branch. vim-6.3.15|/usr/ports/editors/vim|/usr/local|Vi "workalike", with many additional features|/usr/ports/editors/vim/pkg-descr|obrien@FreeBSD.org|editors|libiconv-1.9.2_1|libiconv-1.9.2_1|http://www.vim.org/||| .Ed .Sh SEE ALSO -.Xr csup 1 , .Xr build 1 , +.Xr csup 1 , .Xr ports 7 .Sh AUTHORS .An -nosplit From owner-svn-src-stable-7@FreeBSD.ORG Fri Feb 6 23:56:02 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 939621065672; Fri, 6 Feb 2009 23:56:02 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FCCC8FC23; Fri, 6 Feb 2009 23:56:02 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16Nu21a074800; Fri, 6 Feb 2009 23:56:02 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16Nu2PK074799; Fri, 6 Feb 2009 23:56:02 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902062356.n16Nu2PK074799@svn.freebsd.org> From: Robert Watson Date: Fri, 6 Feb 2009 23:56:02 +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: r188253 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Fri, 06 Feb 2009 23:56:03 -0000 Author: rwatson Date: Fri Feb 6 23:56:02 2009 New Revision: 188253 URL: http://svn.freebsd.org/changeset/base/188253 Log: Merge r186684 from head to stable/7: White space and comment tweaks. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/uipc_usrreq.c Modified: stable/7/sys/kern/uipc_usrreq.c ============================================================================== --- stable/7/sys/kern/uipc_usrreq.c Fri Feb 6 22:40:15 2009 (r188252) +++ stable/7/sys/kern/uipc_usrreq.c Fri Feb 6 23:56:02 2009 (r188253) @@ -1204,14 +1204,14 @@ unp_connect(struct socket *so, struct so unp3->unp_addr = (struct sockaddr_un *) sa; sa = NULL; } + /* - * unp_peercred management: - * * The connecter's (client's) credentials are copied from its * process structure at the time of connect() (which is now). */ cru2x(td->td_ucred, &unp3->unp_peercred); unp3->unp_flags |= UNP_HAVEPC; + /* * The receiver's (server's) credentials are copied from the * unp_peercred member of socket on which the former called From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 00:05:10 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 D610E1065677; Sat, 7 Feb 2009 00:05:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1A5F8FC22; Sat, 7 Feb 2009 00:05:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1705AWW075090; Sat, 7 Feb 2009 00:05:10 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1705Abs075088; Sat, 7 Feb 2009 00:05:10 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902070005.n1705Abs075088@svn.freebsd.org> From: Robert Watson Date: Sat, 7 Feb 2009 00:05:10 +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: r188255 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/mac 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, 07 Feb 2009 00:05:11 -0000 Author: rwatson Date: Sat Feb 7 00:05:10 2009 New Revision: 188255 URL: http://svn.freebsd.org/changeset/base/188255 Log: Merge r187667 from head to stable/7: Use __FBSDID() for $FreeBSD$ version strings in .c files. Obtained from: TrustedBSD Project Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/security/mac/mac_audit.c stable/7/sys/security/mac/mac_priv.c Modified: stable/7/sys/security/mac/mac_audit.c ============================================================================== --- stable/7/sys/security/mac/mac_audit.c Sat Feb 7 00:01:10 2009 (r188254) +++ stable/7/sys/security/mac/mac_audit.c Sat Feb 7 00:05:10 2009 (r188255) @@ -31,10 +31,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include Modified: stable/7/sys/security/mac/mac_priv.c ============================================================================== --- stable/7/sys/security/mac/mac_priv.c Sat Feb 7 00:01:10 2009 (r188254) +++ stable/7/sys/security/mac/mac_priv.c Sat Feb 7 00:05:10 2009 (r188255) @@ -25,14 +25,15 @@ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ /* * MAC checks for system privileges. */ +#include "sys/cdefs.h" +__FBSDID("$FreeBSD$"); + #include "opt_mac.h" #include From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 01:43: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 F238C106566B; Sat, 7 Feb 2009 01:43:04 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDBD68FC0C; Sat, 7 Feb 2009 01:43:04 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n171h4Zs077150; Sat, 7 Feb 2009 01:43:04 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n171h4VH077147; Sat, 7 Feb 2009 01:43:04 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902070143.n171h4VH077147@svn.freebsd.org> From: Andrew Thompson Date: Sat, 7 Feb 2009 01:43:04 +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: r188260 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/usb 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, 07 Feb 2009 01:43:05 -0000 Author: thompsa Date: Sat Feb 7 01:43:04 2009 New Revision: 188260 URL: http://svn.freebsd.org/changeset/base/188260 Log: MFC r173522, r176910, r178975 - Add private tx/rx buffer management to support large frame sizes and update the rx code to handle multiple frames in a single usb transfer. AX772 parts (at least) exhibit many input errors when operated with a 2K rx buffer and no errors w/ a 4K rx buffer (it's unclear what the cause of the errors is for 2K so this may just be covering up the real issue). Larger rx buffer sizes show no significant performance improvement for AX772. Bypassing the common buffer management routines also eliminates an extra context switch on every packet which noticeably improves performance (TCP netperf rx goes from 45 Mb/s to 85 MB/s). - Apply le*toh() or htole*() to the variables of which we use the address as the buffer pointer in the call to axe_cmd(). This is needed to make the code work on big-endian machines. - Add support for the Apple USB Ethernet adapter. Work around the "latch in at the first working PHY address hack", that fails for this adapter because it returns 0xffff when reading from lower PHY addresses. Also add more debugging printfs Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/usb/if_axe.c stable/7/sys/dev/usb/if_axereg.h stable/7/sys/dev/usb/usbdevs Modified: stable/7/sys/dev/usb/if_axe.c ============================================================================== --- stable/7/sys/dev/usb/if_axe.c Sat Feb 7 01:15:13 2009 (r188259) +++ stable/7/sys/dev/usb/if_axe.c Sat Feb 7 01:43:04 2009 (r188260) @@ -104,6 +104,21 @@ __FBSDID("$FreeBSD$"); /* "device miibus" required. See GENERIC if you get errors here. */ #include "miibus_if.h" +/* + * AXE_178_MAX_FRAME_BURST + * max frame burst size for Ax88178 and Ax88772 + * 0 2048 bytes + * 1 4096 bytes + * 2 8192 bytes + * 3 16384 bytes + * use the largest your system can handle without usb stalling. + * + * NB: 88772 parts appear to generate lots of input errors with + * a 2K rx buffer and 8K is only slightly faster than 4K on an + * EHCI port on a T42 so change at your own risk. + */ +#define AXE_178_MAX_FRAME_BURST 1 + #include /* @@ -112,6 +127,7 @@ __FBSDID("$FreeBSD$"); const struct axe_type axe_devs[] = { { { USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_UF200}, 0 }, { { USB_VENDOR_ACERCM, USB_PRODUCT_ACERCM_EP1427X2}, 0 }, + { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_ETHERNET}, AX772 }, { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88172}, 0 }, { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88772}, AX772 }, { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88178}, AX178 }, @@ -151,7 +167,6 @@ static void axe_rxeof(usbd_xfer_handle, static void axe_txeof(usbd_xfer_handle, usbd_private_handle, usbd_status); static void axe_tick(void *); static void axe_tick_task(void *); -static void axe_rxstart(struct ifnet *); static void axe_start(struct ifnet *); static int axe_ioctl(struct ifnet *, u_long, caddr_t); static void axe_init(void *); @@ -259,10 +274,10 @@ axe_miibus_readreg(device_t dev, int phy return(-1); } - if (val) + if (val && val != 0xffff) sc->axe_phyaddrs[0] = phy; - return (val); + return (le16toh(val)); } static int @@ -277,6 +292,7 @@ axe_miibus_writereg(device_t dev, int ph AXE_SLEEPLOCKASSERT(sc); AXE_LOCK(sc); axe_cmd(sc, AXE_CMD_MII_OPMODE_SW, 0, 0, NULL); + val = htole32(val); err = axe_cmd(sc, AXE_CMD_MII_WRITE_REG, reg, phy, (void *)&val); axe_cmd(sc, AXE_CMD_MII_OPMODE_HW, 0, 0, NULL); AXE_UNLOCK(sc); @@ -367,6 +383,7 @@ axe_setmulti(struct axe_softc *sc) AXE_LOCK(sc); axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, (void *)&rxmode); + rxmode = le16toh(rxmode); if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { rxmode |= AXE_RXCMD_ALLMULTI; @@ -403,6 +420,7 @@ axe_ax88178_init(struct axe_softc *sc) axe_cmd(sc, AXE_CMD_SROM_WR_ENABLE, 0, 0, NULL); /* XXX magic */ axe_cmd(sc, AXE_CMD_SROM_READ, 0, 0x0017, &eeprom); + eeprom = le16toh(eeprom); axe_cmd(sc, AXE_CMD_SROM_WR_DISABLE, 0, 0, NULL); /* if EEPROM is invalid we have to use to GPIO0 */ @@ -548,7 +566,6 @@ axe_attach(device_t self) } sc->axe_boundary = 64; -#if 0 if (sc->axe_flags & (AX178|AX772)) { if (sc->axe_udev->speed == USB_SPEED_HIGH) { sc->axe_bufsz = AXE_178_MAX_BUFSZ; @@ -556,10 +573,7 @@ axe_attach(device_t self) } else sc->axe_bufsz = AXE_178_MIN_BUFSZ; } else - sc->axe_bufsz = AXE_172_BUFSZ -#else - sc->axe_bufsz = AXE_172_BUFSZ; -#endif + sc->axe_bufsz = AXE_172_BUFSZ; { /* XXX debug */ device_printf(sc->axe_dev, "%s, bufsz %d, boundary %d\n", sc->axe_flags & AX178 ? "AX88178" : @@ -643,9 +657,6 @@ device_printf(sc->axe_dev, "%s, bufsz %d ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; IFQ_SET_READY(&ifp->if_snd); - sc->axe_qdat.ifp = ifp; - sc->axe_qdat.if_rxstart = axe_rxstart; - if (mii_phy_probe(self, &sc->axe_miibus, axe_ifmedia_upd, axe_ifmedia_sts)) { device_printf(sc->axe_dev, "MII without any PHY!\n"); @@ -704,33 +715,97 @@ axe_detach(device_t dev) return(0); } +static int +axe_rx_list_init(struct axe_softc *sc) +{ + struct axe_cdata *cd; + struct axe_chain *c; + int i; + + cd = &sc->axe_cdata; + for (i = 0; i < AXE_RX_LIST_CNT; i++) { + c = &cd->axe_rx_chain[i]; + c->axe_sc = sc; + c->axe_idx = i; + c->axe_mbuf = NULL; + if (c->axe_xfer == NULL) { + c->axe_xfer = usbd_alloc_xfer(sc->axe_udev); + if (c->axe_xfer == NULL) + return (ENOBUFS); + c->axe_buf = usbd_alloc_buffer(c->axe_xfer, + sc->axe_bufsz); + if (c->axe_buf == NULL) { + usbd_free_xfer(c->axe_xfer); + return (ENOBUFS); + } + } + } + + return (0); +} + static void -axe_rxstart(struct ifnet *ifp) +axe_rx_list_free(struct axe_softc *sc) { - struct axe_softc *sc; - struct ue_chain *c; + int i; - sc = ifp->if_softc; - AXE_LOCK(sc); - c = &sc->axe_cdata.ue_rx_chain[sc->axe_cdata.ue_rx_prod]; + for (i = 0; i < AXE_RX_LIST_CNT; i++) { + if (sc->axe_cdata.axe_rx_chain[i].axe_mbuf != NULL) { + m_freem(sc->axe_cdata.axe_rx_chain[i].axe_mbuf); + sc->axe_cdata.axe_rx_chain[i].axe_mbuf = NULL; + } + if (sc->axe_cdata.axe_rx_chain[i].axe_xfer != NULL) { + usbd_free_xfer(sc->axe_cdata.axe_rx_chain[i].axe_xfer); + sc->axe_cdata.axe_rx_chain[i].axe_xfer = NULL; + } + } +} - c->ue_mbuf = usb_ether_newbuf(); - if (c->ue_mbuf == NULL) { - device_printf(sc->axe_dev, "no memory for rx list " - "-- packet dropped!\n"); - ifp->if_ierrors++; - AXE_UNLOCK(sc); - return; +static int +axe_tx_list_init(struct axe_softc *sc) +{ + struct axe_cdata *cd; + struct axe_chain *c; + int i; + + cd = &sc->axe_cdata; + for (i = 0; i < AXE_TX_LIST_CNT; i++) { + c = &cd->axe_tx_chain[i]; + c->axe_sc = sc; + c->axe_idx = i; + c->axe_mbuf = NULL; + if (c->axe_xfer == NULL) { + c->axe_xfer = usbd_alloc_xfer(sc->axe_udev); + if (c->axe_xfer == NULL) + return (ENOBUFS); + c->axe_buf = usbd_alloc_buffer(c->axe_xfer, + sc->axe_bufsz); + if (c->axe_buf == NULL) { + usbd_free_xfer(c->axe_xfer); + return (ENOBUFS); + } + } } - /* Setup new transfer. */ - usbd_setup_xfer(c->ue_xfer, sc->axe_ep[AXE_ENDPT_RX], - c, mtod(c->ue_mbuf, char *), UE_BUFSZ, USBD_SHORT_XFER_OK, - USBD_NO_TIMEOUT, axe_rxeof); - usbd_transfer(c->ue_xfer); - AXE_UNLOCK(sc); + return (0); +} - return; +static void +axe_tx_list_free(struct axe_softc *sc) +{ + int i; + + /* Free TX resources. */ + for (i = 0; i < AXE_TX_LIST_CNT; i++) { + if (sc->axe_cdata.axe_tx_chain[i].axe_mbuf != NULL) { + m_freem(sc->axe_cdata.axe_tx_chain[i].axe_mbuf); + sc->axe_cdata.axe_tx_chain[i].axe_mbuf = NULL; + } + if (sc->axe_cdata.axe_tx_chain[i].axe_xfer != NULL) { + usbd_free_xfer(sc->axe_cdata.axe_tx_chain[i].axe_xfer); + sc->axe_cdata.axe_tx_chain[i].axe_xfer = NULL; + } + } } /* @@ -741,14 +816,15 @@ static void axe_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) { struct axe_softc *sc; - struct ue_chain *c; + struct axe_chain *c = (struct axe_chain *) priv; struct mbuf *m; + u_char *buf; struct ifnet *ifp; - struct axe_sframe_hdr hdr; - int total_len = 0, pktlen; + struct axe_sframe_hdr *hdr; + int total_len = 0; + int pktlen = 0; - c = priv; - sc = c->ue_sc; + sc = c->axe_sc; AXE_LOCK(sc); ifp = sc->axe_ifp; @@ -772,49 +848,61 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_pr usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL); - m = c->ue_mbuf; - /* XXX don't handle multiple packets in one transfer */ - if (sc->axe_flags & (AX178|AX772)) { - if (total_len < sizeof(hdr)) { - ifp->if_ierrors++; - goto done; - } - m_copydata(m, 0, sizeof(hdr), (caddr_t) &hdr); - total_len -= sizeof(hdr); + buf = c->axe_buf; - if ((hdr.len ^ hdr.ilen) != 0xffff) { - ifp->if_ierrors++; - goto done; + do { + if (sc->axe_flags & (AX178|AX772)) { + if (total_len < sizeof(struct axe_sframe_hdr)) { + ifp->if_ierrors++; + goto done; + } + if ((pktlen % 2) != 0) + pktlen++; + buf += pktlen; + + hdr = (struct axe_sframe_hdr *) buf; + total_len -= sizeof(struct axe_sframe_hdr); + if ((hdr->len ^ hdr->ilen) != 0xffff) { + ifp->if_ierrors++; + goto done; + } + pktlen = le16toh(hdr->len); + if (pktlen > total_len) { + ifp->if_ierrors++; + goto done; + } + + buf += sizeof(struct axe_sframe_hdr); + total_len -= pktlen + (pktlen % 2); + } else { + pktlen = total_len; + total_len = 0; } - pktlen = le16toh(hdr.len); - if (pktlen > total_len) { + + if (pktlen < sizeof(struct ether_header)) { ifp->if_ierrors++; goto done; } - m_adj(m, sizeof(hdr)); - } else { - if (total_len < sizeof(struct ether_header)) { + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) { ifp->if_ierrors++; goto done; } - pktlen = total_len; - } - - ifp->if_ipackets++; - m->m_pkthdr.rcvif = (void *)&sc->axe_qdat; - m->m_pkthdr.len = m->m_len = pktlen; - - /* Put the packet on the special USB input queue. */ - usb_ether_input(m); - AXE_UNLOCK(sc); - - return; + m->m_data += ETHER_ALIGN; + memcpy(mtod(m, void *), buf, pktlen); + m->m_pkthdr.len = m->m_len = pktlen; + m->m_pkthdr.rcvif = ifp; + + ifp->if_input(ifp, m); + ifp->if_ipackets++; + } while (total_len > 0); + /* fall thru... */ done: /* Setup new transfer. */ - usbd_setup_xfer(c->ue_xfer, sc->axe_ep[AXE_ENDPT_RX], - c, mtod(c->ue_mbuf, char *), UE_BUFSZ, USBD_SHORT_XFER_OK, + usbd_setup_xfer(xfer, sc->axe_ep[AXE_ENDPT_RX], + c, c->axe_buf, sc->axe_bufsz, USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT, axe_rxeof); - usbd_transfer(c->ue_xfer); + usbd_transfer(xfer); AXE_UNLOCK(sc); return; @@ -829,12 +917,12 @@ static void axe_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) { struct axe_softc *sc; - struct ue_chain *c; + struct axe_chain *c; struct ifnet *ifp; usbd_status err; c = priv; - sc = c->ue_sc; + sc = c->axe_sc; AXE_LOCK(sc); ifp = sc->axe_ifp; @@ -853,12 +941,11 @@ axe_txeof(usbd_xfer_handle xfer, usbd_pr ifp->if_timer = 0; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - usbd_get_xfer_status(c->ue_xfer, NULL, NULL, NULL, &err); + usbd_get_xfer_status(c->axe_xfer, NULL, NULL, NULL, &err); - if (c->ue_mbuf != NULL) { - c->ue_mbuf->m_pkthdr.rcvif = ifp; - usb_tx_done(c->ue_mbuf); - c->ue_mbuf = NULL; + if (c->axe_mbuf != NULL) { + m_freem(c->axe_mbuf); + c->axe_mbuf = NULL; } if (err) @@ -868,6 +955,9 @@ axe_txeof(usbd_xfer_handle xfer, usbd_pr AXE_UNLOCK(sc); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + axe_start(ifp); + return; } @@ -927,12 +1017,12 @@ axe_tick_task(void *xsc) static int axe_encap(struct axe_softc *sc, struct mbuf *m, int idx) { - struct ue_chain *c; + struct axe_chain *c; usbd_status err; struct axe_sframe_hdr hdr; int length; - c = &sc->axe_cdata.ue_tx_chain[idx]; + c = &sc->axe_cdata.axe_tx_chain[idx]; /* * Copy the mbuf data into a contiguous buffer, leaving two @@ -942,29 +1032,29 @@ axe_encap(struct axe_softc *sc, struct m hdr.len = htole16(m->m_pkthdr.len); hdr.ilen = ~hdr.len; - memcpy(c->ue_buf, &hdr, sizeof(hdr)); + memcpy(c->axe_buf, &hdr, sizeof(hdr)); length = sizeof(hdr); - m_copydata(m, 0, m->m_pkthdr.len, c->ue_buf + sizeof(hdr)); + m_copydata(m, 0, m->m_pkthdr.len, c->axe_buf + length); length += m->m_pkthdr.len; if ((length % sc->axe_boundary) == 0) { hdr.len = 0; hdr.ilen = 0xffff; - memcpy(c->ue_buf + length, &hdr, sizeof(hdr)); + memcpy(c->axe_buf + length, &hdr, sizeof(hdr)); length += sizeof(hdr); } } else { - m_copydata(m, 0, m->m_pkthdr.len, c->ue_buf); + m_copydata(m, 0, m->m_pkthdr.len, c->axe_buf); length = m->m_pkthdr.len; } - c->ue_mbuf = m; + c->axe_mbuf = m; - usbd_setup_xfer(c->ue_xfer, sc->axe_ep[AXE_ENDPT_TX], - c, c->ue_buf, length, USBD_FORCE_SHORT_XFER, 10000, axe_txeof); + usbd_setup_xfer(c->axe_xfer, sc->axe_ep[AXE_ENDPT_TX], + c, c->axe_buf, length, USBD_FORCE_SHORT_XFER, 10000, axe_txeof); /* Transmit */ - err = usbd_transfer(c->ue_xfer); + err = usbd_transfer(c->axe_xfer); if (err != USBD_IN_PROGRESS) { /* XXX probably don't want to sleep here */ AXE_SLEEPLOCK(sc); @@ -973,7 +1063,7 @@ axe_encap(struct axe_softc *sc, struct m return(EIO); } - sc->axe_cdata.ue_tx_cnt++; + sc->axe_cdata.axe_tx_cnt++; return(0); } @@ -1032,7 +1122,7 @@ axe_init(void *xsc) { struct axe_softc *sc = xsc; struct ifnet *ifp = sc->axe_ifp; - struct ue_chain *c; + struct axe_chain *c; usbd_status err; int i; int rxmode; @@ -1057,8 +1147,7 @@ axe_init(void *xsc) /* Enable RX logic. */ /* Init TX ring. */ - if (usb_ether_tx_list_init(sc, &sc->axe_cdata, - sc->axe_udev) == ENOBUFS) { + if (axe_tx_list_init(sc) == ENOBUFS) { device_printf(sc->axe_dev, "tx list init failed\n"); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); @@ -1066,8 +1155,7 @@ axe_init(void *xsc) } /* Init RX ring. */ - if (usb_ether_rx_list_init(sc, &sc->axe_cdata, - sc->axe_udev) == ENOBUFS) { + if (axe_rx_list_init(sc) == ENOBUFS) { device_printf(sc->axe_dev, "rx list init failed\n"); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); @@ -1088,7 +1176,7 @@ axe_init(void *xsc) rxmode = AXE_RXCMD_MULTICAST|AXE_RXCMD_ENABLE; if (sc->axe_flags & (AX178|AX772)) { if (sc->axe_bufsz == AXE_178_MAX_BUFSZ) - rxmode |= AXE_178_RXCMD_MFB_16384; + rxmode |= AXE_178_RXCMD_MFB; } else rxmode |= AXE_172_RXCMD_UNICAST; @@ -1126,12 +1214,13 @@ axe_init(void *xsc) } /* Start up the receive pipe. */ - for (i = 0; i < UE_RX_LIST_CNT; i++) { - c = &sc->axe_cdata.ue_rx_chain[i]; - usbd_setup_xfer(c->ue_xfer, sc->axe_ep[AXE_ENDPT_RX], - c, mtod(c->ue_mbuf, char *), UE_BUFSZ, - USBD_SHORT_XFER_OK, USBD_NO_TIMEOUT, axe_rxeof); - usbd_transfer(c->ue_xfer); + for (i = 0; i < AXE_RX_LIST_CNT; i++) { + c = &sc->axe_cdata.axe_rx_chain[i]; + usbd_setup_xfer(c->axe_xfer, sc->axe_ep[AXE_ENDPT_RX], + c, c->axe_buf, sc->axe_bufsz, + USBD_SHORT_XFER_OK | USBD_NO_COPY, + USBD_NO_TIMEOUT, axe_rxeof); + usbd_transfer(c->axe_xfer); } ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -1164,6 +1253,7 @@ axe_ioctl(struct ifnet *ifp, u_long comm AXE_LOCK(sc); axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, (void *)&rxmode); + rxmode = le16toh(rxmode); rxmode |= AXE_RXCMD_PROMISC; axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); @@ -1177,6 +1267,7 @@ axe_ioctl(struct ifnet *ifp, u_long comm AXE_LOCK(sc); axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, (void *)&rxmode); + rxmode = le16toh(rxmode); rxmode &= ~AXE_RXCMD_PROMISC; axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); @@ -1222,7 +1313,7 @@ static void axe_watchdog(struct ifnet *ifp) { struct axe_softc *sc; - struct ue_chain *c; + struct axe_chain *c; usbd_status stat; sc = ifp->if_softc; @@ -1231,9 +1322,9 @@ axe_watchdog(struct ifnet *ifp) ifp->if_oerrors++; device_printf(sc->axe_dev, "watchdog timeout\n"); - c = &sc->axe_cdata.ue_tx_chain[0]; - usbd_get_xfer_status(c->ue_xfer, NULL, NULL, NULL, &stat); - axe_txeof(c->ue_xfer, c, stat); + c = &sc->axe_cdata.axe_tx_chain[0]; + usbd_get_xfer_status(c->axe_xfer, NULL, NULL, NULL, &stat); + axe_txeof(c->axe_xfer, c, stat); AXE_UNLOCK(sc); @@ -1307,9 +1398,9 @@ axe_stop(struct axe_softc *sc) axe_reset(sc); /* Free RX resources. */ - usb_ether_rx_list_free(&sc->axe_cdata); + axe_rx_list_free(sc); /* Free TX resources. */ - usb_ether_tx_list_free(&sc->axe_cdata); + axe_tx_list_free(sc); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); sc->axe_link = 0; Modified: stable/7/sys/dev/usb/if_axereg.h ============================================================================== --- stable/7/sys/dev/usb/if_axereg.h Sat Feb 7 01:15:13 2009 (r188259) +++ stable/7/sys/dev/usb/if_axereg.h Sat Feb 7 01:43:04 2009 (r188260) @@ -129,11 +129,10 @@ #define AXE_RXCMD_MULTICAST 0x0010 #define AXE_178_RXCMD_AP 0x0020 #define AXE_RXCMD_ENABLE 0x0080 -#define AXE_178_RXCMD_MFB 0x0300 /* Max Frame Burst */ -#define AXE_178_RXCMD_MFB_2048 0x0000 -#define AXE_178_RXCMD_MFB_4096 0x0100 -#define AXE_178_RXCMD_MFB_8192 0x0200 -#define AXE_178_RXCMD_MFB_16384 0x0300 +#define AXE_178_RXCMD_MFB_2048 0x0000 /* 2K max frame burst */ +#define AXE_178_RXCMD_MFB_4096 0x0100 /* 4K max frame burst */ +#define AXE_178_RXCMD_MFB_8192 0x0200 /* 8K max frame burst */ +#define AXE_178_RXCMD_MFB_16384 0x0300 /* 16K max frame burst*/ #define AXE_NOPHY 0xE0 #define AXE_INTPHY 0x10 @@ -141,14 +140,45 @@ #define AXE_TIMEOUT 1000 #define AXE_172_BUFSZ 1536 #define AXE_178_MIN_BUFSZ 2048 -#define AXE_178_MAX_BUFSZ 16384 #define AXE_MIN_FRAMELEN 60 #define AXE_RX_FRAMES 1 #define AXE_TX_FRAMES 1 +#if AXE_178_MAX_FRAME_BURST == 0 +#define AXE_178_RXCMD_MFB AXE_178_RXCMD_MFB_2048 +#define AXE_178_MAX_BUFSZ 2048 +#elif AXE_178_MAX_FRAME_BURST == 1 +#define AXE_178_RXCMD_MFB AXE_178_RXCMD_MFB_4096 +#define AXE_178_MAX_BUFSZ 4096 +#elif AXE_178_MAX_FRAME_BURST == 2 +#define AXE_178_RXCMD_MFB AXE_178_RXCMD_MFB_8192 +#define AXE_178_MAX_BUFSZ 8192 +#else +#define AXE_178_RXCMD_MFB AXE_178_RXCMD_MFB_16384 +#define AXE_178_MAX_BUFSZ 16384 +#endif + #define AXE_RX_LIST_CNT 1 #define AXE_TX_LIST_CNT 1 +struct axe_chain { + struct axe_softc *axe_sc; + usbd_xfer_handle axe_xfer; + char *axe_buf; + struct mbuf *axe_mbuf; + int axe_accum; + int axe_idx; +}; + +struct axe_cdata { + struct axe_chain axe_tx_chain[AXE_TX_LIST_CNT]; + struct axe_chain axe_rx_chain[AXE_RX_LIST_CNT]; + int axe_tx_prod; + int axe_tx_cons; + int axe_tx_cnt; + int axe_rx_prod; +}; + #define AXE_CTL_READ 0x01 #define AXE_CTL_WRITE 0x02 @@ -198,7 +228,7 @@ struct axe_softc { int axe_ed[AXE_ENDPT_MAX]; usbd_pipe_handle axe_ep[AXE_ENDPT_MAX]; int axe_if_flags; - struct ue_cdata axe_cdata; + struct axe_cdata axe_cdata; struct callout_handle axe_stat_ch; struct mtx axe_mtx; struct sx axe_sleeplock; @@ -207,7 +237,6 @@ struct axe_softc { unsigned char axe_ipgs[3]; unsigned char axe_phyaddrs[2]; struct timeval axe_rx_notice; - struct usb_qdat axe_qdat; struct usb_task axe_tick_task; int axe_bufsz; int axe_boundary; Modified: stable/7/sys/dev/usb/usbdevs ============================================================================== --- stable/7/sys/dev/usb/usbdevs Sat Feb 7 01:15:13 2009 (r188259) +++ stable/7/sys/dev/usb/usbdevs Sat Feb 7 01:43:04 2009 (r188260) @@ -856,6 +856,7 @@ product APPLE IPODVIDEO 0x1209 iPod Vid product APPLE IPODNANO 0x120a iPod Nano product APPLE IPHONE 0x1290 iPhone product APPLE IPHONE_3G 0x1292 iPhone 3G +product APPLE ETHERNET 0x1402 Ethernet A1277 /* Arkmicro Technologies */ product ARKMICRO ARK3116 0x0232 ARK3116 Serial From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 10:17:30 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 A0212106564A; Sat, 7 Feb 2009 10:17:30 +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 844B08FC1A; Sat, 7 Feb 2009 10:17:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17AHU6B087637; Sat, 7 Feb 2009 10:17:30 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17AHUB9087636; Sat, 7 Feb 2009 10:17:30 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071017.n17AHUB9087636@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 10:17:30 +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: r188275 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Sat, 07 Feb 2009 10:17:31 -0000 Author: bz Date: Sat Feb 7 10:17:29 2009 New Revision: 188275 URL: http://svn.freebsd.org/changeset/base/188275 Log: MFC: r183571: Implement IPv4 source address selection for unbound sockets. This also changes the semantics of selecting the IP for processes within a jail as it now uses the same logic as outside the jail (with additional checks) but no longer is on a mutually exclusive code path. r186086: With the special check for FreeBSD before 8 a destination route via a loopback interface is treated as a valid and reachable thing for IPv4 source address selection, even though nothing of that network is ever directly reachable, but it is more like a blackhole route. With this the source address will be selected and IPsec can grab the packets before we would discard them at a later point, encapsulate them and send them out from a different tunnel endpoint IP. This is needed to not change the expected behaviour on a stable branch. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/in_pcb.c Modified: stable/7/sys/netinet/in_pcb.c ============================================================================== --- stable/7/sys/netinet/in_pcb.c Sat Feb 7 09:57:14 2009 (r188274) +++ stable/7/sys/netinet/in_pcb.c Sat Feb 7 10:17:29 2009 (r188275) @@ -545,6 +545,209 @@ in_pcbconnect(struct inpcb *inp, struct } /* + * Do proper source address selection on an unbound socket in case + * of connect. Take jails into account as well. + */ +static int +in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_addr *laddr, + struct ucred *cred) +{ + struct in_ifaddr *ia; + struct ifaddr *ifa; + struct sockaddr *sa; + struct sockaddr_in *sin; + struct route sro; + int error; + + KASSERT(laddr != NULL, ("%s: null laddr", __func__)); + + error = 0; + ia = NULL; + bzero(&sro, sizeof(sro)); + + sin = (struct sockaddr_in *)&sro.ro_dst; + sin->sin_family = AF_INET; + sin->sin_len = sizeof(struct sockaddr_in); + sin->sin_addr.s_addr = faddr->s_addr; + + /* + * If route is known our src addr is taken from the i/f, + * else punt. + * + * Find out route to destination. + */ + if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0) + in_rtalloc_ign(&sro, RTF_CLONING, inp->inp_inc.inc_fibnum); + + /* + * If we found a route, use the address corresponding to + * the outgoing interface. + * + * Otherwise assume faddr is reachable on a directly connected + * network and try to find a corresponding interface to take + * the source address from. + */ + if (sro.ro_rt == NULL || sro.ro_rt->rt_ifp == NULL) { + struct ifnet *ifp; + + ia = ifatoia(ifa_ifwithdstaddr((struct sockaddr *)sin)); + if (ia == NULL) + ia = ifatoia(ifa_ifwithnet((struct sockaddr *)sin)); + if (ia == NULL) { + error = ENETUNREACH; + goto done; + } + + if (cred == NULL || !jailed(cred)) { + laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + goto done; + } + + ifp = ia->ia_ifp; + ia = NULL; + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + + sa = ifa->ifa_addr; + if (sa->sa_family != AF_INET) + continue; + sin = (struct sockaddr_in *)sa; + if (htonl(prison_getip(cred)) == sin->sin_addr.s_addr) { + ia = (struct in_ifaddr *)ifa; + break; + } + } + if (ia != NULL) { + laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + goto done; + } + + /* 3. As a last resort return the 'default' jail address. */ + laddr->s_addr = htonl(prison_getip(cred)); + goto done; + } + + /* + * If the outgoing interface on the route found is not + * a loopback interface, use the address from that interface. + * In case of jails do those three steps: + * 1. check if the interface address belongs to the jail. If so use it. + * 2. check if we have any address on the outgoing interface + * belonging to this jail. If so use it. + * 3. as a last resort return the 'default' jail address. + */ + if ((sro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0) { + + /* If not jailed, use the default returned. */ + if (cred == NULL || !jailed(cred)) { + ia = (struct in_ifaddr *)sro.ro_rt->rt_ifa; + laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + goto done; + } + + /* Jailed. */ + /* 1. Check if the iface address belongs to the jail. */ + sin = (struct sockaddr_in *)sro.ro_rt->rt_ifa->ifa_addr; + if (htonl(prison_getip(cred)) == sin->sin_addr.s_addr) { + ia = (struct in_ifaddr *)sro.ro_rt->rt_ifa; + laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + goto done; + } + + /* + * 2. Check if we have any address on the outgoing interface + * belonging to this jail. + */ + TAILQ_FOREACH(ifa, &sro.ro_rt->rt_ifp->if_addrhead, ifa_link) { + + sa = ifa->ifa_addr; + if (sa->sa_family != AF_INET) + continue; + sin = (struct sockaddr_in *)sa; + if (htonl(prison_getip(cred)) == sin->sin_addr.s_addr) { + ia = (struct in_ifaddr *)ifa; + break; + } + } + if (ia != NULL) { + laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + goto done; + } + + /* 3. As a last resort return the 'default' jail address. */ + laddr->s_addr = htonl(prison_getip(cred)); + goto done; + } + + /* + * The outgoing interface is marked with 'loopback net', so a route + * to ourselves is here. + * Try to find the interface of the destination address and then + * take the address from there. That interface is not necessarily + * a loopback interface. + * In case of jails, check that it is an address of the jail + * and if we cannot find, fall back to the 'default' jail address. + */ + if ((sro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) { + struct sockaddr_in sain; + + bzero(&sain, sizeof(struct sockaddr_in)); + sain.sin_family = AF_INET; + sain.sin_len = sizeof(struct sockaddr_in); + sain.sin_addr.s_addr = faddr->s_addr; + + ia = ifatoia(ifa_ifwithdstaddr(sintosa(&sain))); + if (ia == NULL) + ia = ifatoia(ifa_ifwithnet(sintosa(&sain))); + + if (cred == NULL || !jailed(cred)) { +#if __FreeBSD_version < 800000 + if (ia == NULL) + ia = (struct in_ifaddr *)sro.ro_rt->rt_ifa; +#endif + if (ia == NULL) { + error = ENETUNREACH; + goto done; + } + laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + goto done; + } + + /* Jailed. */ + if (ia != NULL) { + struct ifnet *ifp; + + ifp = ia->ia_ifp; + ia = NULL; + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + + sa = ifa->ifa_addr; + if (sa->sa_family != AF_INET) + continue; + sin = (struct sockaddr_in *)sa; + if (htonl(prison_getip(cred)) == + sin->sin_addr.s_addr) { + ia = (struct in_ifaddr *)ifa; + break; + } + } + if (ia != NULL) { + laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + goto done; + } + } + + /* 3. As a last resort return the 'default' jail address. */ + laddr->s_addr = htonl(prison_getip(cred)); + goto done; + } + +done: + if (sro.ro_rt != NULL) + RTFREE(sro.ro_rt); + return (error); +} + +/* * Set up for a connect from a socket to the specified address. * On entry, *laddrp and *lportp should contain the current local * address and port for the PCB; these are updated to the values @@ -566,8 +769,6 @@ in_pcbconnect_setup(struct inpcb *inp, s { struct sockaddr_in *sin = (struct sockaddr_in *)nam; struct in_ifaddr *ia; - struct sockaddr_in sa; - struct ucred *socred; struct inpcb *oinp; struct in_addr laddr, faddr; u_short lport, fport; @@ -592,17 +793,7 @@ in_pcbconnect_setup(struct inpcb *inp, s lport = *lportp; faddr = sin->sin_addr; fport = sin->sin_port; - socred = inp->inp_socket->so_cred; - if (laddr.s_addr == INADDR_ANY && jailed(socred)) { - bzero(&sa, sizeof(sa)); - sa.sin_addr.s_addr = htonl(prison_getip(socred)); - sa.sin_len = sizeof(sa); - sa.sin_family = AF_INET; - error = in_pcbbind_setup(inp, (struct sockaddr *)&sa, - &laddr.s_addr, &lport, cred); - if (error) - return (error); - } + if (!TAILQ_EMPTY(&in_ifaddrhead)) { /* * If the destination address is INADDR_ANY, @@ -620,35 +811,10 @@ in_pcbconnect_setup(struct inpcb *inp, s &in_ifaddrhead)->ia_broadaddr)->sin_addr; } if (laddr.s_addr == INADDR_ANY) { - ia = NULL; - /* - * If route is known our src addr is taken from the i/f, - * else punt. - * - * Find out route to destination - */ - if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0) - ia = ip_rtaddr(faddr, inp->inp_inc.inc_fibnum); - /* - * If we found a route, use the address corresponding to - * the outgoing interface. - * - * Otherwise assume faddr is reachable on a directly connected - * network and try to find a corresponding interface to take - * the source address from. - */ - if (ia == NULL) { - bzero(&sa, sizeof(sa)); - sa.sin_addr = faddr; - sa.sin_len = sizeof(sa); - sa.sin_family = AF_INET; + error = in_pcbladdr(inp, &faddr, &laddr, cred); + if (error) + return (error); - ia = ifatoia(ifa_ifwithdstaddr(sintosa(&sa))); - if (ia == NULL) - ia = ifatoia(ifa_ifwithnet(sintosa(&sa))); - if (ia == NULL) - return (ENETUNREACH); - } /* * If the destination address is multicast and an outgoing * interface has been set as a multicast option, use the @@ -667,9 +833,9 @@ in_pcbconnect_setup(struct inpcb *inp, s break; if (ia == NULL) return (EADDRNOTAVAIL); + laddr = ia->ia_addr.sin_addr; } } - laddr = ia->ia_addr.sin_addr; } oinp = in_pcblookup_hash(inp->inp_pcbinfo, faddr, fport, laddr, lport, From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 10:29:08 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 247F5106566C; Sat, 7 Feb 2009 10:29:08 +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 EADED8FC0A; Sat, 7 Feb 2009 10:29:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17AT7ol089157; Sat, 7 Feb 2009 10:29:07 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17AT7SX089156; Sat, 7 Feb 2009 10:29:07 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071029.n17AT7SX089156@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 10:29: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: r188276 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Sat, 07 Feb 2009 10:29:08 -0000 Author: bz Date: Sat Feb 7 10:29:07 2009 New Revision: 188276 URL: http://svn.freebsd.org/changeset/base/188276 Log: MFC: r185404 With the permissions of phk@ change the license on kern_jail.c to a 2 clause BSD license. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_jail.c Modified: stable/7/sys/kern/kern_jail.c ============================================================================== --- stable/7/sys/kern/kern_jail.c Sat Feb 7 10:17:29 2009 (r188275) +++ stable/7/sys/kern/kern_jail.c Sat Feb 7 10:29:07 2009 (r188276) @@ -1,10 +1,26 @@ /*- - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- + * Copyright (c) 1999 Poul-Henning Kamp. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 11:15:53 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 D4068106566B; Sat, 7 Feb 2009 11:15:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0A018FC08; Sat, 7 Feb 2009 11:15:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17BFrD5090263; Sat, 7 Feb 2009 11:15:53 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17BFr5N090260; Sat, 7 Feb 2009 11:15:53 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902071115.n17BFr5N090260@svn.freebsd.org> From: Robert Watson Date: Sat, 7 Feb 2009 11:15: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: r188278 - stable/7/sbin/dumpfs 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, 07 Feb 2009 11:15:54 -0000 Author: rwatson Date: Sat Feb 7 11:15:53 2009 New Revision: 188278 URL: http://svn.freebsd.org/changeset/base/188278 Log: Merge r187814, r187820 from head to stable/7: Add a new flag to dumpfs(8), -f, which causes dumpfs to list all free fragments in the file system by fragment (block) number. This new mode does the necessary arithmetic to generate absolute fragment numbers rather than than the cg-relative numbers printed in the default mode. If -f is passed once, contiguous fragment ranges are collapsed into an X-Y format as free block lists are currently printed in regular dumpfs output, but if specified twice, all block numbers are printed individually, allowing both compact and more script-friendly representation. This proves quite handy when attempting to recover deleted data, as it allows exclusion of non-deleted data from blocks searched. Discussed with: jeff, Richard Clayton Sponsored by: Google, Inc. Print disk offets as %jd rather than %lld; I fixed one before committing but missed the other, which breaks 64-bit builds. Reported by: bf Reviewed by: mckusick Modified: stable/7/sbin/dumpfs/ (props changed) stable/7/sbin/dumpfs/dumpfs.8 stable/7/sbin/dumpfs/dumpfs.c Modified: stable/7/sbin/dumpfs/dumpfs.8 ============================================================================== --- stable/7/sbin/dumpfs/dumpfs.8 Sat Feb 7 11:12:30 2009 (r188277) +++ stable/7/sbin/dumpfs/dumpfs.8 Sat Feb 7 11:15:53 2009 (r188278) @@ -36,15 +36,18 @@ .Nd dump file system information .Sh SYNOPSIS .Nm +.Op Fl f .Op Fl m .Ar filesys | device .Sh DESCRIPTION The .Nm utility prints out the super block and cylinder group information -for the file system or special device specified, unless +for the file system or special device specified, unless the +.Fl f +or .Fl m -is specified. +flag is specified. The listing is very long and detailed. This command is useful mostly for finding out certain file system @@ -52,6 +55,15 @@ information such as the file system bloc free space percentage. .Pp If +.Fl f +is specified, a sorted list of all free fragments and free fragment ranges, +as represented in cylinder group block free lists, is printed. +If the flag is specified twice, contiguous free fragments are not collapsed +into ranges and instead printed in a simple list. +Fragment numbers may be converted to raw byte offsets by multiplying by the +fragment size, which may be useful when recovering deleted data. +.Pp +If .Fl m is specified, a .Xr newfs 8 Modified: stable/7/sbin/dumpfs/dumpfs.c ============================================================================== --- stable/7/sbin/dumpfs/dumpfs.c Sat Feb 7 11:12:30 2009 (r188277) +++ stable/7/sbin/dumpfs/dumpfs.c Sat Feb 7 11:15:53 2009 (r188278) @@ -1,4 +1,10 @@ /* + * Copyright (c) 2009 Robert N. M. Watson + * All rights reserved. + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Copyright (c) 2002 Networks Associates Technology, Inc. * All rights reserved. * @@ -74,8 +80,11 @@ struct uufsd disk; int dumpfs(const char *); int dumpcg(void); +int dumpfreespace(const char *, int); +void dumpfreespacecg(int); int marshal(const char *); void pbits(void *, int); +void pblklist(void *, int, off_t, int); void ufserr(const char *); void usage(void) __dead2; @@ -83,12 +92,15 @@ int main(int argc, char *argv[]) { const char *name; - int ch, domarshal, eval; + int ch, dofreespace, domarshal, eval; - domarshal = eval = 0; + dofreespace = domarshal = eval = 0; - while ((ch = getopt(argc, argv, "m")) != -1) { + while ((ch = getopt(argc, argv, "fm")) != -1) { switch (ch) { + case 'f': + dofreespace++; + break; case 'm': domarshal = 1; break; @@ -102,6 +114,10 @@ main(int argc, char *argv[]) if (argc < 1) usage(); + if (dofreespace && domarshal) + usage(); + if (dofreespace > 2) + usage(); while ((name = *argv++) != NULL) { if (ufs_disk_fillout(&disk, name) == -1) { @@ -109,7 +125,9 @@ main(int argc, char *argv[]) eval |= 1; continue; } - if (domarshal) + if (dofreespace) + eval |= dumpfreespace(name, dofreespace); + else if (domarshal) eval |= marshal(name); else eval |= dumpfs(name); @@ -333,6 +351,30 @@ dumpcg(void) } int +dumpfreespace(const char *name, int fflag) +{ + int i; + + while ((i = cgread(&disk)) != 0) { + if (i == -1) + goto err; + dumpfreespacecg(fflag); + } + return (0); +err: + ufserr(name); + return (1); +} + +void +dumpfreespacecg(int fflag) +{ + + pblklist(cg_blksfree(&acg), afs.fs_fpg, disk.d_lcg * afs.fs_fpg, + fflag); +} + +int marshal(const char *name) { struct fs *fs; @@ -401,6 +443,27 @@ pbits(void *vp, int max) } void +pblklist(void *vp, int max, off_t offset, int fflag) +{ + int i, j; + char *p; + + for (i = 0, p = vp; i < max; i++) { + if (isset(p, i)) { + printf("%jd", (intmax_t)(i + offset)); + if (fflag < 2) { + j = i; + while ((i+1) 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 B0DBF106564A; Sat, 7 Feb 2009 11:27:35 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E0788FC08; Sat, 7 Feb 2009 11:27:35 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17BRZor090655; Sat, 7 Feb 2009 11:27:35 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17BRZf6090653; Sat, 7 Feb 2009 11:27:35 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902071127.n17BRZf6090653@svn.freebsd.org> From: Robert Watson Date: Sat, 7 Feb 2009 11:27:35 +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: r188279 - in stable/7/usr.bin: basename dirname 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, 07 Feb 2009 11:27:36 -0000 Author: rwatson Date: Sat Feb 7 11:27:35 2009 New Revision: 188279 URL: http://svn.freebsd.org/changeset/base/188279 Log: Merge r188006 from head to stable/7: Alow dirname(1) to accept multiple arguments in the same way that basename(1) does. (Two different PRs contained identical patches, both cited below) PR: 121520, 86148 Submitted by: Ighighi Submitted by: Leif Neland Modified: stable/7/usr.bin/basename/ (props changed) stable/7/usr.bin/basename/basename.1 stable/7/usr.bin/dirname/ (props changed) stable/7/usr.bin/dirname/dirname.c Modified: stable/7/usr.bin/basename/basename.1 ============================================================================== --- stable/7/usr.bin/basename/basename.1 Sat Feb 7 11:15:53 2009 (r188278) +++ stable/7/usr.bin/basename/basename.1 Sat Feb 7 11:27:35 2009 (r188279) @@ -52,6 +52,7 @@ .Op Ar ... .Nm dirname .Ar string +.Op Ar ... .Sh DESCRIPTION The .Nm Modified: stable/7/usr.bin/dirname/dirname.c ============================================================================== --- stable/7/usr.bin/dirname/dirname.c Sat Feb 7 11:15:53 2009 (r188278) +++ stable/7/usr.bin/dirname/dirname.c Sat Feb 7 11:27:35 2009 (r188279) @@ -66,12 +66,15 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if (argc != 1) + if (argc < 1) usage(); - if ((p = dirname(*argv)) == NULL) - err(1, "%s", *argv); - (void)printf("%s\n", p); + while (argc--) { + if ((p = dirname(*argv)) == NULL) + err(1, "%s", *argv); + argv++; + (void)printf("%s\n", p); + } exit(0); } @@ -79,6 +82,6 @@ void usage(void) { - (void)fprintf(stderr, "usage: dirname string\n"); + (void)fprintf(stderr, "usage: dirname string [...]\n"); exit(1); } From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 13:19: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 6D7CC106564A; Sat, 7 Feb 2009 13:19:09 +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 570DA8FC08; Sat, 7 Feb 2009 13:19:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17DJ9s9092750; Sat, 7 Feb 2009 13:19:09 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17DJ8Wd092736; Sat, 7 Feb 2009 13:19:08 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071319.n17DJ8Wd092736@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 13:19:08 +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: r188281 - in stable/7: . etc etc/defaults etc/periodic/weekly lib/libc lib/libc/string lib/libc/sys lib/libkvm share/man/man4 sys sys/compat/freebsd32 sys/contrib/pf sys/dev/ath/ath_hal... 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, 07 Feb 2009 13:19:10 -0000 Author: bz Date: Sat Feb 7 13:19:08 2009 New Revision: 188281 URL: http://svn.freebsd.org/changeset/base/188281 Log: MFC: r185435: This enhances the current jail implementation to permit multiple addresses per jail. In addtion to IPv4, IPv6 is supported as well. Due to updated checks it is even possible to have jails without an IP address at all, which basically gives one a chroot with restricted process view, no networking,.. SCTP support was updated and supports IPv6 in jails as well. Cpuset support permits jails to be bound to specific processor sets after creation. Jails can have an unrestricted (no duplicate protection, etc.) name in addition to the hostname. The jail name cannot be changed from within a jail and is considered to be used for management purposes or as audit-token in the future. DDB 'show jails' command was added to aid debugging. Proper compat support permits 32bit jail binaries to be used on 64bit systems to manage jails. Also backward compatibility was preserved where possible: for jail v1 syscalls, as well as with user space management utilities. Both jail as well as prison version were updated for the new features. A gap was intentionally left as the intermediate versions had been used by various patches floating around the last years. Bump __FreeBSD_version for the afore mentioned and in kernel changes. r185441: Unbreak the no-networks (no INET/6) build. r185899: Correctly check the number of prison states to not access anything outside the prison_states array. When checking if there is a name configured for the prison, check the first character to not be '\0' instead of checking if the char array is present, which it always is. Note, that this is different for the *jailname in the syscall. Found with: Coverity Prevent(tm) CID: 4156, 4155 r186085: Make sure that the direct jls invocations prints something reasonable close to and in the same format as it had always. r186606: Make sure that unused j->ip[46] are cleared. r186834: Document the special loopback address behaviour of jails. PR: kern/103464 r186841: Put the devfs ruleset next to devfs enable, add a comment about the suggested ruleset[1]. While here use an IP from the 'test-net' prefix for docs. PR: kern/130102 r187059: Add a short section talking about jails and file systems; mention the mountand jail-aware file systems as well as quota. PR: kern/68192 r187092: Sort .Xr. r187365: s,unmount 8,umount 8, it is unmount(2) which I did not mean. r187669: Update the description of the '-h' option wrt to primary addresses per address family and add a reference to the ip-addresses option. r187670: New sentence starts on a new line. Modified: stable/7/UPDATING stable/7/etc/ (props changed) stable/7/etc/defaults/rc.conf stable/7/etc/periodic/weekly/ (props changed) stable/7/lib/libc/ (props changed) stable/7/lib/libc/string/ffsll.c (props changed) stable/7/lib/libc/string/flsll.c (props changed) stable/7/lib/libc/sys/cpuset_getaffinity.2 stable/7/lib/libc/sys/jail.2 stable/7/lib/libkvm/ (props changed) stable/7/lib/libkvm/kvm_proc.c stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/ddb.4 stable/7/share/man/man4/igb.4 (props changed) stable/7/sys/ (props changed) stable/7/sys/compat/freebsd32/freebsd32.h stable/7/sys/compat/freebsd32/freebsd32_misc.c stable/7/sys/compat/freebsd32/syscalls.master stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_cpuset.c stable/7/sys/kern/kern_exit.c stable/7/sys/kern/kern_fork.c stable/7/sys/kern/kern_jail.c stable/7/sys/kern/uipc_socket.c stable/7/sys/net/if.c stable/7/sys/net/rtsock.c stable/7/sys/netinet/in_pcb.c stable/7/sys/netinet/raw_ip.c stable/7/sys/netinet/sctp_pcb.c stable/7/sys/netinet/sctp_usrreq.c stable/7/sys/netinet/tcp_usrreq.c stable/7/sys/netinet/udp_usrreq.c stable/7/sys/netinet6/in6_pcb.c stable/7/sys/netinet6/in6_src.c stable/7/sys/netinet6/raw_ip6.c stable/7/sys/netinet6/udp6_usrreq.c stable/7/sys/security/mac_bsdextended/mac_bsdextended.c stable/7/sys/sys/cpuset.h stable/7/sys/sys/jail.h stable/7/sys/sys/param.h stable/7/usr.bin/cpuset/ (props changed) stable/7/usr.bin/cpuset/cpuset.1 stable/7/usr.bin/cpuset/cpuset.c stable/7/usr.sbin/jail/ (props changed) stable/7/usr.sbin/jail/Makefile stable/7/usr.sbin/jail/jail.8 stable/7/usr.sbin/jail/jail.c stable/7/usr.sbin/jexec/ (props changed) stable/7/usr.sbin/jexec/Makefile stable/7/usr.sbin/jexec/jexec.8 stable/7/usr.sbin/jexec/jexec.c stable/7/usr.sbin/jls/ (props changed) stable/7/usr.sbin/jls/Makefile stable/7/usr.sbin/jls/jls.8 stable/7/usr.sbin/jls/jls.c Modified: stable/7/UPDATING ============================================================================== --- stable/7/UPDATING Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/UPDATING Sat Feb 7 13:19:08 2009 (r188281) @@ -8,6 +8,12 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20090207: + Multi-IPv4/v6/no-IP jail support was merged to STABLE. + You need to rebuild jls(8) and to use the new features + jail(8), jexec(8) and cpuset(1) with a new kernel. + __FreeBSD_version was bumped to 701103. + 20090119: NTFS has been removed from GENERIC kernel on amd64 to match GENERIC on i386. Should not cause any issues since mount_ntfs(8) Modified: stable/7/etc/defaults/rc.conf ============================================================================== --- stable/7/etc/defaults/rc.conf Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/etc/defaults/rc.conf Sat Feb 7 13:19:08 2009 (r188281) @@ -620,7 +620,7 @@ jail_sysvipc_allow="NO" # Allow SystemV # #jail_example_rootdir="/usr/jail/default" # Jail's root directory #jail_example_hostname="default.domain.com" # Jail's hostname -#jail_example_ip="192.168.0.10" # Jail's IP number +#jail_example_ip="192.0.2.10" # Jail's IP number #jail_example_interface="" # Interface to create the IP alias on #jail_example_fib="0" # routing table for setfib(1) #jail_example_exec_start="/bin/sh /etc/rc" # command to execute in jail for starting @@ -629,10 +629,11 @@ jail_sysvipc_allow="NO" # Allow SystemV # specified using a trailing number #jail_example_exec_stop="/bin/sh /etc/rc.shutdown" # command to execute in jail for stopping #jail_example_devfs_enable="NO" # mount devfs in the jail +#jail_example_devfs_ruleset="ruleset_name" # devfs ruleset to apply to jail - + # usually you want "devfsrules_jail". #jail_example_fdescfs_enable="NO" # mount fdescfs in the jail #jail_example_procfs_enable="NO" # mount procfs in jail #jail_example_mount_enable="NO" # mount/umount jail's fs -#jail_example_devfs_ruleset="ruleset_name" # devfs ruleset to apply to jail #jail_example_fstab="" # fstab(5) for mount/umount #jail_example_flags="-l -U root" # flags for jail(8) Modified: stable/7/lib/libc/sys/cpuset_getaffinity.2 ============================================================================== --- stable/7/lib/libc/sys/cpuset_getaffinity.2 Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/lib/libc/sys/cpuset_getaffinity.2 Sat Feb 7 13:19:08 2009 (r188281) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 29, 2008 +.Dd November 29, 2008 .Dt CPUSET 2 .Os .Sh NAME @@ -46,7 +46,7 @@ and .Fn cpuset_setaffinity allow the manipulation of sets of CPUs available to processes, threads, -interrupts and other resources. +interrupts, jails and other resources. These functions may manipulate sets of CPUs that contain many processes or per-object anonymous masks that effect only a single object. .Pp Modified: stable/7/lib/libc/sys/jail.2 ============================================================================== --- stable/7/lib/libc/sys/jail.2 Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/lib/libc/sys/jail.2 Sat Feb 7 13:19:08 2009 (r188281) @@ -8,7 +8,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 8, 2003 +.Dd January 6, 2009 .Dt JAIL 2 .Os .Sh NAME @@ -32,15 +32,20 @@ The argument is a pointer to a structure .Bd -literal -offset indent struct jail { u_int32_t version; - char *path; - char *hostname; - u_int32_t ip_number; + char *path; + char *hostname; + char *jailname; + unsigned int ip4s; + unsigned int ip6s; + struct in_addr *ip4; + struct in6_addr *ip6; }; .Ed .Pp .Dq Li version defines the version of the API in use. -It should be set to zero at this time. +.Dv JAIL_API_VERSION +is defined for the current version. .Pp The .Dq Li path @@ -54,8 +59,24 @@ This can be changed from the inside of the prison. .Pp The -.Dq Li ip_number -can be set to the IP number assigned to the prison. +.Dq Li jailname +pointer is an optional name that can be assigned to the jail +for example for managment purposes. +.Pp +The +.Dq Li ip4s +and +.Dq Li ip6s +give the numbers of IPv4 and IPv6 addresses that will be passed +via their respective pointers. +.Pp +The +.Dq Li ip4 +and +.Dq Li ip6 +pointers can be set to an arrays of IPv4 and IPv6 addresses to be assigned to +the prison, or NULL if none. +IPv4 addresses must be in network byte order. .Pp The .Fn jail_attach @@ -97,6 +118,12 @@ or, if present, the per-jail .Pp All IP activity will be forced to happen to/from the IP number specified, which should be an alias on one of the network interfaces. +All connections to/from the loopback address +.Pf ( Li 127.0.0.1 +for IPv4, +.Li ::1 +for IPv6) will be changed to be to/from the primary address +of the jail for the given address family. .Pp It is possible to identify a process as jailed by examining .Dq Li /proc//status : Modified: stable/7/lib/libkvm/kvm_proc.c ============================================================================== --- stable/7/lib/libkvm/kvm_proc.c Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/lib/libkvm/kvm_proc.c Sat Feb 7 13:19:08 2009 (r188281) @@ -54,10 +54,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _WANT_PRISON /* make jail.h give us 'struct prison' */ -#include +#include #include #include +#define _WANT_PRISON /* make jail.h give us 'struct prison' */ +#include #include #include #include Modified: stable/7/share/man/man4/ddb.4 ============================================================================== --- stable/7/share/man/man4/ddb.4 Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/share/man/man4/ddb.4 Sat Feb 7 13:19:08 2009 (r188281) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 26, 2007 +.Dd November 29, 2008 .Dt DDB 4 .Os .Sh NAME @@ -539,6 +539,16 @@ If the .Ar addr is given, displays details about the given GEOM object (class, geom, provider or consumer). +.\" +.Pp +.It Ic show Cm jails +Show the list of +.Xr jail 8 +instances. +In addition to what +.Xr jls 8 +shows, also list kernel internal details. +.\" .Pp .It Ic show Cm map Ns Oo Li / Ns Cm f Oc Ar addr Prints the VM map at Modified: stable/7/sys/compat/freebsd32/freebsd32.h ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32.h Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/sys/compat/freebsd32/freebsd32.h Sat Feb 7 13:19:08 2009 (r188281) @@ -153,6 +153,24 @@ struct stat32 { unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); }; +struct jail32_v0 { + u_int32_t version; + uint32_t path; + uint32_t hostname; + u_int32_t ip_number; +}; + +struct jail32 { + uint32_t version; + uint32_t path; + uint32_t hostname; + uint32_t jailname; + uint32_t ip4s; + uint32_t ip6s; + uint32_t ip4; + uint32_t ip6; +}; + struct sigaction32 { u_int32_t sa_u; int sa_flags; Modified: stable/7/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_misc.c Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/sys/compat/freebsd32/freebsd32_misc.c Sat Feb 7 13:19:08 2009 (r188281) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1983,6 +1984,66 @@ done2: } int +freebsd32_jail(struct thread *td, struct freebsd32_jail_args *uap) +{ + uint32_t version; + int error; + struct jail j; + + error = copyin(uap->jail, &version, sizeof(uint32_t)); + if (error) + return (error); + switch (version) { + case 0: + { + /* FreeBSD single IPv4 jails. */ + struct jail32_v0 j32_v0; + + bzero(&j, sizeof(struct jail)); + error = copyin(uap->jail, &j32_v0, sizeof(struct jail32_v0)); + if (error) + return (error); + CP(j32_v0, j, version); + PTRIN_CP(j32_v0, j, path); + PTRIN_CP(j32_v0, j, hostname); + j.ip4s = j32_v0.ip_number; + break; + } + + case 1: + /* + * Version 1 was used by multi-IPv4 jail implementations + * that never made it into the official kernel. + */ + return (EINVAL); + + case 2: /* JAIL_API_VERSION */ + { + /* FreeBSD multi-IPv4/IPv6,noIP jails. */ + struct jail32 j32; + + error = copyin(uap->jail, &j32, sizeof(struct jail32)); + if (error) + return (error); + CP(j32, j, version); + PTRIN_CP(j32, j, path); + PTRIN_CP(j32, j, hostname); + PTRIN_CP(j32, j, jailname); + CP(j32, j, ip4s); + CP(j32, j, ip6s); + PTRIN_CP(j32, j, ip4); + PTRIN_CP(j32, j, ip6); + break; + } + + default: + /* Sci-Fi jails are not supported, sorry. */ + return (EINVAL); + } + return (kern_jail(td, &j)); +} + +int freebsd32_sigaction(struct thread *td, struct freebsd32_sigaction_args *uap) { struct sigaction32 s32; Modified: stable/7/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/7/sys/compat/freebsd32/syscalls.master Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/sys/compat/freebsd32/syscalls.master Sat Feb 7 13:19:08 2009 (r188281) @@ -587,7 +587,7 @@ off_t *sbytes, int flags); } 337 AUE_NULL NOPROTO { int kldsym(int fileid, int cmd, \ void *data); } -338 AUE_JAIL NOPROTO { int jail(struct jail *jail); } +338 AUE_JAIL STD { int freebsd32_jail(struct jail32 *jail); } 339 AUE_NULL UNIMPL pioctl 340 AUE_SIGPROCMASK NOPROTO { int sigprocmask(int how, \ const sigset_t *set, sigset_t *oset); } Modified: stable/7/sys/kern/kern_cpuset.c ============================================================================== --- stable/7/sys/kern/kern_cpuset.c Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/sys/kern/kern_cpuset.c Sat Feb 7 13:19:08 2009 (r188281) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* Must come after sys/proc.h */ #include @@ -208,7 +209,7 @@ cpuset_rel_complete(struct cpuset *set) * Find a set based on an id. Returns it with a ref. */ static struct cpuset * -cpuset_lookup(cpusetid_t setid) +cpuset_lookup(cpusetid_t setid, struct thread *td) { struct cpuset *set; @@ -221,6 +222,28 @@ cpuset_lookup(cpusetid_t setid) if (set) cpuset_ref(set); mtx_unlock_spin(&cpuset_lock); + + KASSERT(td != NULL, ("[%s:%d] td is NULL", __func__, __LINE__)); + if (set != NULL && jailed(td->td_ucred)) { + struct cpuset *rset, *jset; + struct prison *pr; + + rset = cpuset_refroot(set); + + pr = td->td_ucred->cr_prison; + mtx_lock(&pr->pr_mtx); + cpuset_ref(pr->pr_cpuset); + jset = pr->pr_cpuset; + mtx_unlock(&pr->pr_mtx); + + if (jset->cs_id != rset->cs_id) { + cpuset_rel(set); + set = NULL; + } + cpuset_rel(jset); + cpuset_rel(rset); + } + return (set); } @@ -414,12 +437,38 @@ cpuset_which(cpuwhich_t which, id_t id, set = cpuset_refbase(curthread->td_cpuset); thread_unlock(curthread); } else - set = cpuset_lookup(id); + set = cpuset_lookup(id, curthread); if (set) { *setp = set; return (0); } return (ESRCH); + case CPU_WHICH_JAIL: + { + /* Find `set' for prison with given id. */ + struct prison *pr; + + sx_slock(&allprison_lock); + pr = prison_find(id); + sx_sunlock(&allprison_lock); + if (pr == NULL) + return (ESRCH); + if (jailed(curthread->td_ucred)) { + if (curthread->td_ucred->cr_prison == pr) { + cpuset_ref(pr->pr_cpuset); + set = pr->pr_cpuset; + } + } else { + cpuset_ref(pr->pr_cpuset); + set = pr->pr_cpuset; + } + mtx_unlock(&pr->pr_mtx); + if (set) { + *setp = set; + return (0); + } + return (ESRCH); + } default: return (EINVAL); } @@ -668,6 +717,59 @@ 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. + * + * In case of no error, returns the set in *setp locked with a reference. + */ +int +cpuset_create_root(struct thread *td, struct cpuset **setp) +{ + struct cpuset *root; + struct cpuset *set; + int error; + + KASSERT(td != NULL, ("[%s:%d] invalid td", __func__, __LINE__)); + KASSERT(setp != NULL, ("[%s:%d] invalid setp", __func__, __LINE__)); + + thread_lock(td); + root = cpuset_refroot(td->td_cpuset); + thread_unlock(td); + + error = cpuset_create(setp, td->td_cpuset, &root->cs_mask); + cpuset_rel(root); + if (error) + return (error); + + KASSERT(*setp != NULL, ("[%s:%d] cpuset_create returned invalid data", + __func__, __LINE__)); + + /* Mark the set as root. */ + set = *setp; + set->cs_flags |= CPU_SET_ROOT; + + return (0); +} + +int +cpuset_setproc_update_set(struct proc *p, struct cpuset *set) +{ + int error; + + KASSERT(p != NULL, ("[%s:%d] invalid proc", __func__, __LINE__)); + KASSERT(set != NULL, ("[%s:%d] invalid set", __func__, __LINE__)); + + cpuset_ref(set); + error = cpuset_setproc(p->p_pid, set, NULL); + if (error) + return (error); + cpuset_rel(set); + return (0); +} + +/* * This is called once the final set of system cpus is known. Modifies * the root set and all children and mark the root readonly. */ @@ -732,7 +834,7 @@ cpuset_setid(struct thread *td, struct c */ if (uap->which != CPU_WHICH_PID) return (EINVAL); - set = cpuset_lookup(uap->setid); + set = cpuset_lookup(uap->setid, td); if (set == NULL) return (ESRCH); error = cpuset_setproc(uap->id, set, NULL); @@ -771,6 +873,7 @@ cpuset_getid(struct thread *td, struct c PROC_UNLOCK(p); break; case CPU_WHICH_CPUSET: + case CPU_WHICH_JAIL: break; } switch (uap->level) { @@ -831,6 +934,7 @@ cpuset_getaffinity(struct thread *td, st thread_unlock(ttd); break; case CPU_WHICH_CPUSET: + case CPU_WHICH_JAIL: break; } if (uap->level == CPU_LEVEL_ROOT) @@ -857,6 +961,7 @@ cpuset_getaffinity(struct thread *td, st PROC_SUNLOCK(p); break; case CPU_WHICH_CPUSET: + case CPU_WHICH_JAIL: CPU_COPY(&set->cs_mask, mask); break; } @@ -934,6 +1039,7 @@ cpuset_setaffinity(struct thread *td, st PROC_UNLOCK(p); break; case CPU_WHICH_CPUSET: + case CPU_WHICH_JAIL: break; } if (uap->level == CPU_LEVEL_ROOT) @@ -953,7 +1059,8 @@ cpuset_setaffinity(struct thread *td, st error = cpuset_setproc(uap->id, NULL, mask); break; case CPU_WHICH_CPUSET: - error = cpuset_which(CPU_WHICH_CPUSET, uap->id, &p, + case CPU_WHICH_JAIL: + error = cpuset_which(uap->which, uap->id, &p, &ttd, &set); if (error == 0) { error = cpuset_modify(set, mask); Modified: stable/7/sys/kern/kern_exit.c ============================================================================== --- stable/7/sys/kern/kern_exit.c Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/sys/kern/kern_exit.c Sat Feb 7 13:19:08 2009 (r188281) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -461,6 +462,10 @@ retry: p->p_xstat = rv; p->p_xthread = td; + /* In case we are jailed tell the prison that we are gone. */ + if (jailed(p->p_ucred)) + prison_proc_free(p->p_ucred->cr_prison); + #ifdef KDTRACE_HOOKS /* * Tell the DTrace fasttrap provider about the exit if it Modified: stable/7/sys/kern/kern_fork.c ============================================================================== --- stable/7/sys/kern/kern_fork.c Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/sys/kern/kern_fork.c Sat Feb 7 13:19:08 2009 (r188281) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -442,6 +443,11 @@ again: __rangeof(struct proc, p_startzero, p_endzero)); p2->p_ucred = crhold(td->td_ucred); + + /* In case we are jailed tell the prison that we exist. */ + if (jailed(p2->p_ucred)) + prison_proc_hold(p2->p_ucred->cr_prison); + PROC_UNLOCK(p2); /* Modified: stable/7/sys/kern/kern_jail.c ============================================================================== --- stable/7/sys/kern/kern_jail.c Sat Feb 7 11:40:47 2009 (r188280) +++ stable/7/sys/kern/kern_jail.c Sat Feb 7 13:19:08 2009 (r188281) @@ -1,5 +1,7 @@ /*- - * Copyright (c) 1999 Poul-Henning Kamp. All rights reserved. + * Copyright (c) 1999 Poul-Henning Kamp. + * Copyright (c) 2008 Bjoern A. Zeeb. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +28,9 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ddb.h" +#include "opt_inet.h" +#include "opt_inet6.h" #include "opt_mac.h" #include @@ -51,6 +56,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef DDB +#include +#ifdef INET6 +#include +#endif /* INET6 */ +#endif /* DDB */ #include @@ -67,7 +78,7 @@ SYSCTL_INT(_security_jail, OID_AUTO, set int jail_socket_unixiproute_only = 1; SYSCTL_INT(_security_jail, OID_AUTO, socket_unixiproute_only, CTLFLAG_RW, &jail_socket_unixiproute_only, 0, - "Processes in jail are limited to creating UNIX/IPv4/route sockets only"); + "Processes in jail are limited to creating UNIX/IP/route sockets only"); int jail_sysvipc_allowed = 0; SYSCTL_INT(_security_jail, OID_AUTO, sysvipc_allowed, CTLFLAG_RW, @@ -94,6 +105,11 @@ SYSCTL_INT(_security_jail, OID_AUTO, mou &jail_mount_allowed, 0, "Processes in jail can mount/unmount jail-friendly file systems"); +int jail_max_af_ips = 255; +SYSCTL_INT(_security_jail, OID_AUTO, jail_max_af_ips, CTLFLAG_RW, + &jail_max_af_ips, 0, + "Number of IP addresses a jail may have at most per address family"); + /* allprison, lastprid, and prisoncount are protected by allprison_lock. */ struct prisonlist allprison; struct sx allprison_lock; @@ -119,6 +135,12 @@ struct prison_service { static void init_prison(void *); static void prison_complete(void *context, int pending); static int sysctl_jail_list(SYSCTL_HANDLER_ARGS); +#ifdef INET +static int _prison_check_ip4(struct prison *, struct in_addr *); +#endif +#ifdef INET6 +static int _prison_check_ip6(struct prison *, struct in6_addr *); +#endif static void init_prison(void *data __unused) @@ -130,6 +152,278 @@ init_prison(void *data __unused) SYSINIT(prison, SI_SUB_INTRINSIC, SI_ORDER_ANY, init_prison, NULL); +#ifdef INET +static int +qcmp_v4(const void *ip1, const void *ip2) +{ + in_addr_t iaa, iab; + + /* + * We need to compare in HBO here to get the list sorted as expected + * by the result of the code. Sorting NBO addresses gives you + * interesting results. If you do not understand, do not try. + */ + iaa = ntohl(((const struct in_addr *)ip1)->s_addr); + iab = ntohl(((const struct in_addr *)ip2)->s_addr); + + /* + * Do not simply return the difference of the two numbers, the int is + * not wide enough. + */ + if (iaa > iab) + return (1); + else if (iaa < iab) + return (-1); + else + return (0); +} +#endif + +#ifdef INET6 +static int +qcmp_v6(const void *ip1, const void *ip2) +{ + const struct in6_addr *ia6a, *ia6b; + int i, rc; + + ia6a = (const struct in6_addr *)ip1; + ia6b = (const struct in6_addr *)ip2; + + rc = 0; + for (i=0; rc == 0 && i < sizeof(struct in6_addr); i++) { + if (ia6a->s6_addr[i] > ia6b->s6_addr[i]) + rc = 1; + else if (ia6a->s6_addr[i] < ia6b->s6_addr[i]) + rc = -1; + } + return (rc); +} +#endif + +#if defined(INET) || defined(INET6) +static int +prison_check_conflicting_ips(struct prison *p) +{ + struct prison *pr; + int i; + + sx_assert(&allprison_lock, SX_LOCKED); + + if (p->pr_ip4s == 0 && p->pr_ip6s == 0) + return (0); + + LIST_FOREACH(pr, &allprison, pr_list) { + /* + * Skip 'dying' prisons to avoid problems when + * restarting multi-IP jails. + */ + if (pr->pr_state == PRISON_STATE_DYING) + continue; + + /* + * We permit conflicting IPs if there is no + * more than 1 IP on eeach jail. + * In case there is one duplicate on a jail with + * more than one IP stop checking and return error. + */ +#ifdef INET + if ((p->pr_ip4s >= 1 && pr->pr_ip4s > 1) || + (p->pr_ip4s > 1 && pr->pr_ip4s >= 1)) { + for (i = 0; i < p->pr_ip4s; i++) { + if (_prison_check_ip4(pr, &p->pr_ip4[i])) + return (EINVAL); + } + } +#endif +#ifdef INET6 + if ((p->pr_ip6s >= 1 && pr->pr_ip6s > 1) || + (p->pr_ip6s > 1 && pr->pr_ip6s >= 1)) { + for (i = 0; i < p->pr_ip6s; i++) { + if (_prison_check_ip6(pr, &p->pr_ip6[i])) + return (EINVAL); + } + } +#endif + } + + return (0); +} + +static int +jail_copyin_ips(struct jail *j) +{ +#ifdef INET + struct in_addr *ip4; +#endif +#ifdef INET6 + struct in6_addr *ip6; +#endif + int error, i; + + /* + * Copy in addresses, check for duplicate addresses and do some + * simple 0 and broadcast checks. If users give other bogus addresses + * it is their problem. + * + * IP addresses are all sorted but ip[0] to preserve the primary IP + * address as given from userland. This special IP is used for + * unbound outgoing connections as well for "loopback" traffic. + */ +#ifdef INET + ip4 = NULL; +#endif +#ifdef INET6 + ip6 = NULL; +#endif +#ifdef INET + if (j->ip4s > 0) { + ip4 = (struct in_addr *)malloc(j->ip4s * sizeof(struct in_addr), + M_PRISON, M_WAITOK | M_ZERO); + error = copyin(j->ip4, ip4, j->ip4s * sizeof(struct in_addr)); + if (error) + goto e_free_ip; + /* Sort all but the first IPv4 address. */ + if (j->ip4s > 1) + qsort((ip4 + 1), j->ip4s - 1, + sizeof(struct in_addr), qcmp_v4); + + /* + * We do not have to care about byte order for these checks + * so we will do them in NBO. + */ + for (i=0; iip4s; i++) { + if (ip4[i].s_addr == htonl(INADDR_ANY) || + ip4[i].s_addr == htonl(INADDR_BROADCAST)) { + error = EINVAL; + goto e_free_ip; + } + if ((i+1) < j->ip4s && + (ip4[0].s_addr == ip4[i+1].s_addr || + ip4[i].s_addr == ip4[i+1].s_addr)) { + error = EINVAL; + goto e_free_ip; + } + } + + j->ip4 = ip4; + } else + j->ip4 = NULL; +#endif +#ifdef INET6 + if (j->ip6s > 0) { + ip6 = (struct in6_addr *)malloc(j->ip6s * sizeof(struct in6_addr), + M_PRISON, M_WAITOK | M_ZERO); + error = copyin(j->ip6, ip6, j->ip6s * sizeof(struct in6_addr)); + if (error) + goto e_free_ip; + /* Sort all but the first IPv6 address. */ + if (j->ip6s > 1) + qsort((ip6 + 1), j->ip6s - 1, + sizeof(struct in6_addr), qcmp_v6); + for (i=0; iip6s; i++) { + if (IN6_IS_ADDR_UNSPECIFIED(&ip6[i])) { + error = EINVAL; + goto e_free_ip; + } + if ((i+1) < j->ip6s && + (IN6_ARE_ADDR_EQUAL(&ip6[0], &ip6[i+1]) || + IN6_ARE_ADDR_EQUAL(&ip6[i], &ip6[i+1]))) { + error = EINVAL; + goto e_free_ip; + } + } + + j->ip6 = ip6; + } else + j->ip6 = NULL; +#endif + return (0); + +e_free_ip: +#ifdef INET6 + free(ip6, M_PRISON); +#endif +#ifdef INET + free(ip4, M_PRISON); +#endif + return (error); +} +#endif /* INET || INET6 */ + +static int +jail_handle_ips(struct jail *j) +{ +#if defined(INET) || defined(INET6) + int error; +#endif + + /* + * Finish conversion for older versions, copyin and setup IPs. + */ + switch (j->version) { + case 0: + { +#ifdef INET + /* FreeBSD single IPv4 jails. */ + struct in_addr *ip4; + + if (j->ip4s == INADDR_ANY || j->ip4s == INADDR_BROADCAST) + return (EINVAL); + ip4 = (struct in_addr *)malloc(sizeof(struct in_addr), + M_PRISON, M_WAITOK | M_ZERO); + + /* + * Jail version 0 still used HBO for the IPv4 address. + */ + ip4->s_addr = htonl(j->ip4s); + j->ip4s = 1; + j->ip4 = ip4; + break; +#else + return (EINVAL); +#endif + } + + case 1: + /* + * Version 1 was used by multi-IPv4 jail implementations + * that never made it into the official kernel. + * We should never hit this here; jail() should catch it. + */ + return (EINVAL); + + case 2: /* JAIL_API_VERSION */ + /* FreeBSD multi-IPv4/IPv6,noIP jails. */ +#if defined(INET) || defined(INET6) +#ifdef INET + if (j->ip4s > jail_max_af_ips) + return (EINVAL); +#else + if (j->ip4s != 0) + return (EINVAL); +#endif +#ifdef INET6 + if (j->ip6s > jail_max_af_ips) + return (EINVAL); +#else + if (j->ip6s != 0) + return (EINVAL); +#endif + error = jail_copyin_ips(j); + if (error) + return (error); +#endif + break; + + default: + /* Sci-Fi jails are not supported, sorry. */ + return (EINVAL); + } + + return (0); +} + + /* * struct jail_args { * struct jail *jail; @@ -138,23 +432,73 @@ SYSINIT(prison, SI_SUB_INTRINSIC, SI_ORD int jail(struct thread *td, struct jail_args *uap) { + uint32_t version; + int error; + struct jail j; + + error = copyin(uap->jail, &version, sizeof(uint32_t)); + if (error) + return (error); + + switch (version) { + case 0: + /* FreeBSD single IPv4 jails. */ + { + struct jail_v0 j0; + + bzero(&j, sizeof(struct jail)); + error = copyin(uap->jail, &j0, sizeof(struct jail_v0)); + if (error) + return (error); + j.version = j0.version; + j.path = j0.path; + j.hostname = j0.hostname; + j.ip4s = j0.ip_number; + break; + } + + case 1: + /* + * Version 1 was used by multi-IPv4 jail implementations + * that never made it into the official kernel. + */ + return (EINVAL); + + case 2: /* JAIL_API_VERSION */ + /* FreeBSD multi-IPv4/IPv6,noIP jails. */ + error = copyin(uap->jail, &j, sizeof(struct jail)); + if (error) + return (error); + break; + + default: + /* Sci-Fi jails are not supported, sorry. */ + return (EINVAL); + } + return (kern_jail(td, &j)); +} + +int +kern_jail(struct thread *td, struct jail *j) +{ struct nameidata nd; struct prison *pr, *tpr; struct prison_service *psrv; - struct jail j; struct jail_attach_args jaa; int vfslocked, error, tryprid; - error = copyin(uap->jail, &j, sizeof(j)); + KASSERT(j != NULL, ("%s: j is NULL", __func__)); + + /* Handle addresses - convert old structs, copyin, check IPs. */ + error = jail_handle_ips(j); if (error) return (error); - if (j.version != 0) - return (EINVAL); - MALLOC(pr, struct prison *, sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); + /* Allocate struct prison and fill it with life. */ + pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF); pr->pr_ref = 1; - error = copyinstr(j.path, &pr->pr_path, sizeof(pr->pr_path), 0); + error = copyinstr(j->path, &pr->pr_path, sizeof(pr->pr_path), NULL); if (error) goto e_killmtx; NDINIT(&nd, LOOKUP, MPSAFE | FOLLOW | LOCKLEAF, UIO_SYSSPACE, @@ -167,10 +511,25 @@ jail(struct thread *td, struct jail_args VOP_UNLOCK(nd.ni_vp, 0, td); NDFREE(&nd, NDF_ONLY_PNBUF); VFS_UNLOCK_GIANT(vfslocked); - error = copyinstr(j.hostname, &pr->pr_host, sizeof(pr->pr_host), 0); + error = copyinstr(j->hostname, &pr->pr_host, sizeof(pr->pr_host), NULL); if (error) goto e_dropvnref; - pr->pr_ip = j.ip_number; + if (j->jailname != NULL) { + error = copyinstr(j->jailname, &pr->pr_name, + sizeof(pr->pr_name), NULL); + if (error) + goto e_dropvnref; + } + if (j->ip4s > 0) { + pr->pr_ip4 = j->ip4; + pr->pr_ip4s = j->ip4s; + } +#ifdef INET6 + if (j->ip6s > 0) { + pr->pr_ip6 = j->ip6; + pr->pr_ip6s = j->ip6s; + } +#endif pr->pr_linux = NULL; pr->pr_securelevel = securelevel; if (prison_service_slots == 0) @@ -180,8 +539,29 @@ jail(struct thread *td, struct jail_args M_PRISON, M_ZERO | M_WAITOK); } - /* Determine next pr_id and add prison to allprison list. */ + /* + * Pre-set prison state to ALIVE upon cration. This is needed so we + * can later attach the process to it, etc (avoiding another extra + * state for ther process of creation, complicating things). *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 13:27: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 EB5ED1065680; Sat, 7 Feb 2009 13:27:01 +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 CFC028FC08; Sat, 7 Feb 2009 13:27:01 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17DR19H092925; Sat, 7 Feb 2009 13:27:01 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17DR1jJ092921; Sat, 7 Feb 2009 13:27:01 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071327.n17DR1jJ092921@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 13:27: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: r188282 - stable/7/sys/compat/freebsd32 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, 07 Feb 2009 13:27:02 -0000 Author: bz Date: Sat Feb 7 13:27:01 2009 New Revision: 188282 URL: http://svn.freebsd.org/changeset/base/188282 Log: Regen after jail support was merged in r188281 (--record-only MFC of r185436). Modified: stable/7/sys/compat/freebsd32/freebsd32_proto.h stable/7/sys/compat/freebsd32/freebsd32_syscall.h stable/7/sys/compat/freebsd32/freebsd32_syscalls.c stable/7/sys/compat/freebsd32/freebsd32_sysent.c Modified: stable/7/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_proto.h Sat Feb 7 13:19:08 2009 (r188281) +++ stable/7/sys/compat/freebsd32/freebsd32_proto.h Sat Feb 7 13:27:01 2009 (r188282) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 187559 2009-01-21 18:52:33Z jhb + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 188281 2009-02-07 13:19:08Z bz */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -274,6 +274,9 @@ struct freebsd32_olio_listio_args { char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char sig_l_[PADL_(struct osigevent32 *)]; struct osigevent32 * sig; char sig_r_[PADR_(struct osigevent32 *)]; }; +struct freebsd32_jail_args { + char jail_l_[PADL_(struct jail32 *)]; struct jail32 * jail; char jail_r_[PADR_(struct jail32 *)]; +}; struct freebsd32_sigtimedwait_args { char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)]; char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)]; @@ -469,6 +472,7 @@ int freebsd32_aio_error(struct thread *, int freebsd32_oaio_read(struct thread *, struct freebsd32_oaio_read_args *); int freebsd32_oaio_write(struct thread *, struct freebsd32_oaio_write_args *); int freebsd32_olio_listio(struct thread *, struct freebsd32_olio_listio_args *); +int freebsd32_jail(struct thread *, struct freebsd32_jail_args *); int freebsd32_sigtimedwait(struct thread *, struct freebsd32_sigtimedwait_args *); int freebsd32_sigwaitinfo(struct thread *, struct freebsd32_sigwaitinfo_args *); int freebsd32_aio_waitcomplete(struct thread *, struct freebsd32_aio_waitcomplete_args *); @@ -691,6 +695,7 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_oaio_read AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_oaio_write AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_olio_listio AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_jail AUE_JAIL #define FREEBSD32_SYS_AUE_freebsd32_sigtimedwait AUE_SIGWAIT #define FREEBSD32_SYS_AUE_freebsd32_sigwaitinfo AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_waitcomplete AUE_NULL Modified: stable/7/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_syscall.h Sat Feb 7 13:19:08 2009 (r188281) +++ stable/7/sys/compat/freebsd32/freebsd32_syscall.h Sat Feb 7 13:27:01 2009 (r188282) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 187559 2009-01-21 18:52:33Z jhb + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 188281 2009-02-07 13:19:08Z bz */ #define FREEBSD32_SYS_syscall 0 @@ -264,7 +264,7 @@ #define FREEBSD32_SYS_utrace 335 #define FREEBSD32_SYS_freebsd4_freebsd32_sendfile 336 #define FREEBSD32_SYS_kldsym 337 -#define FREEBSD32_SYS_jail 338 +#define FREEBSD32_SYS_freebsd32_jail 338 #define FREEBSD32_SYS_sigprocmask 340 #define FREEBSD32_SYS_sigsuspend 341 #define FREEBSD32_SYS_freebsd4_freebsd32_sigaction 342 Modified: stable/7/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_syscalls.c Sat Feb 7 13:19:08 2009 (r188281) +++ stable/7/sys/compat/freebsd32/freebsd32_syscalls.c Sat Feb 7 13:27:01 2009 (r188282) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 187559 2009-01-21 18:52:33Z jhb + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 188281 2009-02-07 13:19:08Z bz */ const char *freebsd32_syscallnames[] = { @@ -345,7 +345,7 @@ const char *freebsd32_syscallnames[] = { "utrace", /* 335 = utrace */ "compat4.freebsd32_sendfile", /* 336 = old freebsd32_sendfile */ "kldsym", /* 337 = kldsym */ - "jail", /* 338 = jail */ + "freebsd32_jail", /* 338 = freebsd32_jail */ "#339", /* 339 = pioctl */ "sigprocmask", /* 340 = sigprocmask */ "sigsuspend", /* 341 = sigsuspend */ Modified: stable/7/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_sysent.c Sat Feb 7 13:19:08 2009 (r188281) +++ stable/7/sys/compat/freebsd32/freebsd32_sysent.c Sat Feb 7 13:27:01 2009 (r188282) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 187559 2009-01-21 18:52:33Z jhb + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 188281 2009-02-07 13:19:08Z bz */ #include "opt_compat.h" @@ -376,7 +376,7 @@ struct sysent freebsd32_sysent[] = { { AS(utrace_args), (sy_call_t *)utrace, AUE_NULL, NULL, 0, 0 }, /* 335 = utrace */ { compat4(AS(freebsd4_freebsd32_sendfile_args),freebsd32_sendfile), AUE_SENDFILE, NULL, 0, 0 }, /* 336 = old freebsd32_sendfile */ { AS(kldsym_args), (sy_call_t *)kldsym, AUE_NULL, NULL, 0, 0 }, /* 337 = kldsym */ - { AS(jail_args), (sy_call_t *)jail, AUE_JAIL, NULL, 0, 0 }, /* 338 = jail */ + { AS(freebsd32_jail_args), (sy_call_t *)freebsd32_jail, AUE_JAIL, NULL, 0, 0 }, /* 338 = freebsd32_jail */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 339 = pioctl */ { AS(sigprocmask_args), (sy_call_t *)sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0 }, /* 340 = sigprocmask */ { AS(sigsuspend_args), (sy_call_t *)sigsuspend, AUE_SIGSUSPEND, NULL, 0, 0 }, /* 341 = sigsuspend */ From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 13:32:49 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 EC321106566B; Sat, 7 Feb 2009 13:32:49 +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 BFBDD8FC0A; Sat, 7 Feb 2009 13:32:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17DWn1n093081; Sat, 7 Feb 2009 13:32:49 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17DWnSd093080; Sat, 7 Feb 2009 13:32:49 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071332.n17DWnSd093080@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 13:32:49 +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: r188283 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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, 07 Feb 2009 13:32:50 -0000 Author: bz Date: Sat Feb 7 13:32:49 2009 New Revision: 188283 URL: http://svn.freebsd.org/changeset/base/188283 Log: Record that r85436 was merged with r188282. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 13:46: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 1C7EC106567E; Sat, 7 Feb 2009 13:46:54 +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 4D4148FC23; Sat, 7 Feb 2009 13:46:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17DkpsN093464; Sat, 7 Feb 2009 13:46:51 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17DkpI6093463; Sat, 7 Feb 2009 13:46:51 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071346.n17DkpI6093463@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 13:46: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: r188284 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb net 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, 07 Feb 2009 13:46:56 -0000 Author: bz Date: Sat Feb 7 13:46:51 2009 New Revision: 188284 URL: http://svn.freebsd.org/changeset/base/188284 Log: MFC: r186956 Take the cred from curthread rather than curproc as curproc would need locking but the credential from curthread (usually) never changes. r186980 Restrict arp, ndp and theoretically the FIB listing (if not read with libkvm) to the addresses of a prison, when inside a jail. While touching RTM_GET in route_output(), consistently use curthread credentials rather than the creds from the socket there. r186986 Rather than using the cred from curthread, take it from the thread referenced in the sysctl req argument. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/net/rtsock.c Modified: stable/7/sys/net/rtsock.c ============================================================================== --- stable/7/sys/net/rtsock.c Sat Feb 7 13:32:49 2009 (r188283) +++ stable/7/sys/net/rtsock.c Sat Feb 7 13:46:51 2009 (r188284) @@ -585,6 +585,12 @@ route_output(struct mbuf *m, struct sock case RTM_GET: report: RT_LOCK_ASSERT(rt); + if (jailed(curthread->td_ucred) && + ((rt->rt_flags & RTF_HOST) == 0 || + !prison_if(curthread->td_ucred, rt_key(rt)))) { + RT_UNLOCK(rt); + senderr(ESRCH); + } info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_info[RTAX_NETMASK] = rt_mask(rt); @@ -594,10 +600,10 @@ route_output(struct mbuf *m, struct sock if (ifp) { info.rti_info[RTAX_IFP] = ifp->if_addr->ifa_addr; - if (jailed(so->so_cred)) { + if (jailed(curthread->td_ucred)) { error = rtm_get_jailed( &info, ifp, rt, &saun, - so->so_cred); + curthread->td_ucred); if (error != 0) { RT_UNLOCK(rt); senderr(ESRCH); @@ -1224,6 +1230,10 @@ sysctl_dumpentry(struct radix_node *rn, if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg)) return 0; + if (jailed(w->w_req->td->td_ucred) && + ((rt->rt_flags & RTF_HOST) == 0 || + !prison_if(w->w_req->td->td_ucred, rt_key(rt)))) + return (0); bzero((caddr_t)&info, sizeof(info)); info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; @@ -1283,8 +1293,8 @@ sysctl_iflist(int af, struct walkarg *w) while ((ifa = TAILQ_NEXT(ifa, ifa_link)) != NULL) { if (af && af != ifa->ifa_addr->sa_family) continue; - if (jailed(curthread->td_ucred) && - !prison_if(curthread->td_ucred, ifa->ifa_addr)) + if (jailed(w->w_req->td->td_ucred) && + !prison_if(w->w_req->td->td_ucred, ifa->ifa_addr)) continue; info.rti_info[RTAX_IFA] = ifa->ifa_addr; info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask; @@ -1311,7 +1321,7 @@ done: return (error); } -int +static int sysctl_ifmalist(int af, struct walkarg *w) { struct ifnet *ifp; @@ -1331,8 +1341,8 @@ sysctl_ifmalist(int af, struct walkarg * TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (af && af != ifma->ifma_addr->sa_family) continue; - if (jailed(curproc->p_ucred) && - !prison_if(curproc->p_ucred, ifma->ifma_addr)) + if (jailed(w->w_req->td->td_ucred) && + !prison_if(w->w_req->td->td_ucred, ifma->ifma_addr)) continue; info.rti_info[RTAX_IFA] = ifma->ifma_addr; info.rti_info[RTAX_GATEWAY] = @@ -1397,7 +1407,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) } else /* dump only one table */ i = lim = af; for (error = 0; error == 0 && i <= lim; i++) - if ((rnh = rt_tables[curthread->td_proc->p_fibnum][i]) != NULL) { + if ((rnh = rt_tables[req->td->td_proc->p_fibnum][i]) != NULL) { RADIX_NODE_HEAD_LOCK(rnh); error = rnh->rnh_walktree(rnh, sysctl_dumpentry, &w); From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 13:51: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 A61A91065670; Sat, 7 Feb 2009 13:51: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 789AB8FC0C; Sat, 7 Feb 2009 13:51:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17DpG1l093598; Sat, 7 Feb 2009 13:51:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17DpGV1093596; Sat, 7 Feb 2009 13:51:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071351.n17DpGV1093596@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 13:51: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: r188285 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netinet 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: Sat, 07 Feb 2009 13:51:17 -0000 Author: bz Date: Sat Feb 7 13:51:15 2009 New Revision: 188285 URL: http://svn.freebsd.org/changeset/base/188285 Log: MFC: r186948 Make SIOCGIFADDR and related, as well as SIOCGIFADDR_IN6 and related jail-aware. Up to now we returned the first address of the interface for SIOCGIFADDR w/o an ifr_addr in the query. This caused problems for programs querying for an address but running inside a jail, as the address returned usually did not belong to the jail. Like for v6, if there was an ifr_addr given on v4, you could probe for more addresses on the interfaces that you were not allowed to see from inside a jail. Return an error (EADDRNOTAVAIL) in that case now unless the address is on the given interface and valid for the jail. PR: kern/114325 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/in.c stable/7/sys/netinet6/in6.c Modified: stable/7/sys/netinet/in.c ============================================================================== --- stable/7/sys/netinet/in.c Sat Feb 7 13:46:51 2009 (r188284) +++ stable/7/sys/netinet/in.c Sat Feb 7 13:51:15 2009 (r188285) @@ -41,7 +41,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -252,13 +254,19 @@ in_control(struct socket *so, u_long cmd LIST_FOREACH(iap, INADDR_HASH(dst.s_addr), ia_hash) if (iap->ia_ifp == ifp && iap->ia_addr.sin_addr.s_addr == dst.s_addr) { - ia = iap; + if (td == NULL || prison_check_ip4( + td->td_ucred, &dst)) + ia = iap; break; } if (ia == NULL) TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); if (iap->ia_addr.sin_family == AF_INET) { + if (td != NULL && + !prison_check_ip4(td->td_ucred, + &iap->ia_addr.sin_addr)) + continue; ia = iap; break; } Modified: stable/7/sys/netinet6/in6.c ============================================================================== --- stable/7/sys/netinet6/in6.c Sat Feb 7 13:46:51 2009 (r188284) +++ stable/7/sys/netinet6/in6.c Sat Feb 7 13:51:15 2009 (r188285) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -468,6 +469,9 @@ in6_control(struct socket *so, u_long cm error = in6_setscope(&sa6->sin6_addr, ifp, NULL); if (error != 0) return (error); + if (td != NULL && !prison_check_ip6(td->td_ucred, + &sa6->sin6_addr)) + return (EADDRNOTAVAIL); ia = in6ifa_ifpwithaddr(ifp, &sa6->sin6_addr); } else ia = NULL; From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 13:55:13 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 441C1106564A; Sat, 7 Feb 2009 13:55:13 +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 304118FC12; Sat, 7 Feb 2009 13:55:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17DtDJP093761; Sat, 7 Feb 2009 13:55:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17DtCQD093755; Sat, 7 Feb 2009 13:55:12 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071355.n17DtCQD093755@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 13:55:12 +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: r188286 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern net netinet netinet6 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: Sat, 07 Feb 2009 13:55:14 -0000 Author: bz Date: Sat Feb 7 13:55:12 2009 New Revision: 188286 URL: http://svn.freebsd.org/changeset/base/188286 Log: MFC: r187684 For consistency with prison_{local,remote,check}_ipN rename prison_getipN to prison_get_ipN. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_jail.c stable/7/sys/net/rtsock.c stable/7/sys/netinet/in_pcb.c stable/7/sys/netinet/raw_ip.c stable/7/sys/netinet6/raw_ip6.c stable/7/sys/sys/jail.h Modified: stable/7/sys/kern/kern_jail.c ============================================================================== --- stable/7/sys/kern/kern_jail.c Sat Feb 7 13:51:15 2009 (r188285) +++ stable/7/sys/kern/kern_jail.c Sat Feb 7 13:55:12 2009 (r188286) @@ -846,7 +846,7 @@ prison_proc_free(struct prison *pr) * Returns 0 on success, 1 on error. Address returned in NBO. */ int -prison_getip4(struct ucred *cred, struct in_addr *ia) +prison_get_ip4(struct ucred *cred, struct in_addr *ia) { KASSERT(cred != NULL, ("%s: cred is NULL", __func__)); @@ -992,7 +992,7 @@ prison_check_ip4(struct ucred *cred, str * Returns 0 on success, 1 on error. */ int -prison_getip6(struct ucred *cred, struct in6_addr *ia6) +prison_get_ip6(struct ucred *cred, struct in6_addr *ia6) { KASSERT(cred != NULL, ("%s: cred is NULL", __func__)); Modified: stable/7/sys/net/rtsock.c ============================================================================== --- stable/7/sys/net/rtsock.c Sat Feb 7 13:51:15 2009 (r188285) +++ stable/7/sys/net/rtsock.c Sat Feb 7 13:55:12 2009 (r188286) @@ -368,7 +368,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * 3. As a last resort return the 'default' * jail address. */ - if (prison_getip4(cred, &ia) != 0) + if (prison_get_ip4(cred, &ia) != 0) return (ESRCH); } bzero(&saun->sin, sizeof(struct sockaddr_in)); @@ -420,7 +420,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * 3. As a last resort return the 'default' * jail address. */ - if (prison_getip6(cred, &ia6) != 0) + if (prison_get_ip6(cred, &ia6) != 0) return (ESRCH); } bzero(&saun->sin6, sizeof(struct sockaddr_in6)); Modified: stable/7/sys/netinet/in_pcb.c ============================================================================== --- stable/7/sys/netinet/in_pcb.c Sat Feb 7 13:51:15 2009 (r188285) +++ stable/7/sys/netinet/in_pcb.c Sat Feb 7 13:55:12 2009 (r188286) @@ -617,7 +617,7 @@ in_pcbladdr(struct inpcb *inp, struct in } /* 3. As a last resort return the 'default' jail address. */ - if (prison_getip4(cred, laddr) != 0) + if (prison_get_ip4(cred, laddr) != 0) error = EADDRNOTAVAIL; goto done; } @@ -670,7 +670,7 @@ in_pcbladdr(struct inpcb *inp, struct in } /* 3. As a last resort return the 'default' jail address. */ - if (prison_getip4(cred, laddr) != 0) + if (prison_get_ip4(cred, laddr) != 0) error = EADDRNOTAVAIL; goto done; } @@ -733,7 +733,7 @@ in_pcbladdr(struct inpcb *inp, struct in } /* 3. As a last resort return the 'default' jail address. */ - if (prison_getip4(cred, laddr) != 0) + if (prison_get_ip4(cred, laddr) != 0) error = EADDRNOTAVAIL; goto done; } @@ -801,7 +801,7 @@ in_pcbconnect_setup(struct inpcb *inp, s */ if (faddr.s_addr == INADDR_ANY) { if (cred != NULL && jailed(cred)) { - if (prison_getip4(cred, &jailia) != 0) + if (prison_get_ip4(cred, &jailia) != 0) return (EADDRNOTAVAIL); faddr.s_addr = jailia.s_addr; } else { Modified: stable/7/sys/netinet/raw_ip.c ============================================================================== --- stable/7/sys/netinet/raw_ip.c Sat Feb 7 13:51:15 2009 (r188285) +++ stable/7/sys/netinet/raw_ip.c Sat Feb 7 13:55:12 2009 (r188286) @@ -359,7 +359,7 @@ rip_output(struct mbuf *m, struct socket ip->ip_p = inp->inp_ip_p; ip->ip_len = m->m_pkthdr.len; if (jailed(inp->inp_cred)) { - if (prison_getip4(inp->inp_cred, &ip->ip_src)) { + if (prison_get_ip4(inp->inp_cred, &ip->ip_src) != 0) { INP_RUNLOCK(inp); m_freem(m); return (EPERM); Modified: stable/7/sys/netinet6/raw_ip6.c ============================================================================== --- stable/7/sys/netinet6/raw_ip6.c Sat Feb 7 13:51:15 2009 (r188285) +++ stable/7/sys/netinet6/raw_ip6.c Sat Feb 7 13:55:12 2009 (r188286) @@ -398,7 +398,7 @@ rip6_output(m, va_alist) goto bad; } if (jailed(in6p->inp_cred)) - if (prison_getip6(in6p->inp_cred, in6a) != 0) { + if (prison_get_ip6(in6p->inp_cred, in6a) != 0) { error = EPERM; goto bad; } Modified: stable/7/sys/sys/jail.h ============================================================================== --- stable/7/sys/sys/jail.h Sat Feb 7 13:51:15 2009 (r188285) +++ stable/7/sys/sys/jail.h Sat Feb 7 13:55:12 2009 (r188286) @@ -178,12 +178,12 @@ void prison_hold(struct prison *pr); void prison_hold_locked(struct prison *pr); void prison_proc_hold(struct prison *); void prison_proc_free(struct prison *); -int prison_getip4(struct ucred *cred, struct in_addr *ia); +int prison_get_ip4(struct ucred *cred, struct in_addr *ia); int prison_local_ip4(struct ucred *cred, struct in_addr *ia); int prison_remote_ip4(struct ucred *cred, struct in_addr *ia); int prison_check_ip4(struct ucred *cred, struct in_addr *ia); #ifdef INET6 -int prison_getip6(struct ucred *, struct in6_addr *); +int prison_get_ip6(struct ucred *, struct in6_addr *); int prison_local_ip6(struct ucred *, struct in6_addr *, int); int prison_remote_ip6(struct ucred *, struct in6_addr *); int prison_check_ip6(struct ucred *, struct in6_addr *); From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 14:04:35 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 7690E106564A; Sat, 7 Feb 2009 14:04:35 +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 626F88FC0C; Sat, 7 Feb 2009 14:04:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17E4ZUH094021; Sat, 7 Feb 2009 14:04:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17E4ZHo094018; Sat, 7 Feb 2009 14:04:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071404.n17E4ZHo094018@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 14:04:35 +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: r188287 - in stable/7: etc etc/defaults etc/periodic/weekly etc/rc.d share/man/man5 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, 07 Feb 2009 14:04:36 -0000 Author: bz Date: Sat Feb 7 14:04:35 2009 New Revision: 188287 URL: http://svn.freebsd.org/changeset/base/188287 Log: MFC: r187708 Update jail startup script for multi-IPv4/v6/no-IP jails. Note: this is only really necessary because of the ifconfig logic to add/remove the jail IPs upon start/stop. Consensus among simon and I is that the logic should really be factored out from the startup script and put into a proper management solution. - We now support starting of no-IP jails. - Implement jail__ip options to support both address familes with regard to ifconfig logic. - Implement _multi support suffix to the jail__ip option to configure additional addresses to avoid overlong, unreadbale jail__ip lines with lots of addresses. Modified: stable/7/etc/ (props changed) stable/7/etc/defaults/rc.conf stable/7/etc/periodic/weekly/ (props changed) stable/7/etc/rc.d/jail stable/7/share/man/man5/ (props changed) stable/7/share/man/man5/rc.conf.5 Modified: stable/7/etc/defaults/rc.conf ============================================================================== --- stable/7/etc/defaults/rc.conf Sat Feb 7 13:55:12 2009 (r188286) +++ stable/7/etc/defaults/rc.conf Sat Feb 7 14:04:35 2009 (r188287) @@ -615,14 +615,16 @@ jail_sysvipc_allow="NO" # Allow SystemV # each jail, specified in jail_list, with the following variables. # NOTES: # - replace 'example' with the jail's name. -# - except rootdir, hostname and ip, all of the following variables may be made -# global jail variables if you don't specify a jail name (ie. jail_interface). +# - except rootdir, hostname, ip and the _multi addresses, +# all of the following variables may be made global jail variables +# if you don't specify a jail name (ie. jail_interface, jail_devfs_ruleset). # #jail_example_rootdir="/usr/jail/default" # Jail's root directory #jail_example_hostname="default.domain.com" # Jail's hostname -#jail_example_ip="192.0.2.10" # Jail's IP number -#jail_example_interface="" # Interface to create the IP alias on -#jail_example_fib="0" # routing table for setfib(1) +#jail_example_interface="" # Jail's interface variable to create IP aliases on +#jail_example_fib="0" # Routing table for setfib(1) +#jail_example_ip="192.0.2.10,2001:db8::17" # Jail's primary IPv4 and IPv6 address +#jail_example_ip_multi0="2001:db8::10" # and another IPv6 address #jail_example_exec_start="/bin/sh /etc/rc" # command to execute in jail for starting #jail_example_exec_afterstart0="/bin/sh command" # command to execute after the one for # starting the jail. More than one can be Modified: stable/7/etc/rc.d/jail ============================================================================== --- stable/7/etc/rc.d/jail Sat Feb 7 13:55:12 2009 (r188286) +++ stable/7/etc/rc.d/jail Sat Feb 7 14:04:35 2009 (r188287) @@ -93,6 +93,7 @@ init_variables() debug "$_j mount enable: $_mount" debug "$_j hostname: $_hostname" debug "$_j ip: $_ip" + jail_show_addresses ${_j} debug "$_j interface: $_interface" debug "$_j fib: $_fib" debug "$_j root: $_rootdir" @@ -126,10 +127,6 @@ init_variables() if [ -z "${_rootdir}" ]; then err 3 "$name: No root directory has been defined for ${_j}" fi - if [ -z "${_ip}" ]; then - err 3 "$name: No IP address has been defined for ${_j}" - fi - } # set_sysctl rc_knob mib msg @@ -275,6 +272,208 @@ jail_mount_fstab() mount -a -F "${_fstab}" } +# jail_show_addresses jail +# Debug print the input for the given _multi aliases +# for a jail for init_variables(). +# +jail_show_addresses() +{ + local _j _type alias + _j="$1" + alias=0 + + if [ -z "${_j}" ]; then + warn "jail_show_addresses: you must specify a jail" + return + fi + + while : ; do + eval _addr=\"\$jail_${_j}_ip_multi${alias}\" + if [ -n "${_addr}" ]; then + debug "${_j} ip_multi${alias}: $_addr" + alias=$((${alias} + 1)) + else + break + fi + done +} + +# jail_extract_address argument +# The second argument is the string from one of the _ip +# or the _multi variables. In case of a comma separated list +# only one argument must be passed in at a time. +# The function alters the _type, _iface, _addr and _mask variables. +# +jail_extract_address() +{ + local _i + _i=$1 + + if [ -z "${_i}" ]; then + warn "jail_extract_address: called without input" + return + fi + + # Check if we have an interface prefix given and split into + # iFace and rest. + case "${_i}" in + *\|*) # ifN|.. prefix there + _iface=${_i%%|*} + _r=${_i##*|} + ;; + *) _iface="" + _r=${_i} + ;; + esac + + # In case the IP has no interface given, check if we have a global one. + _iface=${_iface:-${_interface}} + + # Set address, cut off any prefix/netmask/prefixlen. + _addr=${_r} + _addr=${_addr%%[/ ]*} + + # Theoretically we can return here if interface is not set, + # as we only care about the _mask if we call ifconfig. + # This is not done because we may want to santize IP addresses + # based on _type later, and optionally change the type as well. + + # Extract the prefix/netmask/prefixlen part by cutting off the address. + _mask=${_r} + _mask=`expr "${_mask}" : "${_addr}\(.*\)"` + + # Identify type {inet,inet6}. + case "${_addr}" in + *\.*\.*\.*) _type="inet" ;; + *:*) _type="inet6" ;; + *) warn "jail_extract_address: type not identified" + ;; + esac + + # Handle the special /netmask instead of /prefix or + # "netmask xxx" case for legacy IP. + # We do NOT support shortend class-full netmasks. + if [ "${_type}" = "inet" ]; then + case "${_mask}" in + /*\.*\.*\.*) _mask=" netmask ${_mask#/}" ;; + *) ;; + esac + + # In case _mask is still not set use /32. + _mask=${_mask:-/32} + + elif [ "${_type}" = "inet6" ]; then + # In case _maske is not set for IPv6, use /128. + _mask=${_mask:-/128} + fi +} + +# jail_handle_ips_option {add,del} input +# Handle a single argument imput which can be a comma separated +# list of addresses (theoretically with an option interface and +# prefix/netmask/prefixlen). +# +jail_handle_ips_option() +{ + local _x _action _type _i + _action=$1 + _x=$2 + + if [ -z "${_x}" ]; then + # No IP given. This can happen for the primary address + # of each address family. + return + fi + + # Loop, in case we find a comma separated list, we need to handle + # each argument on its own. + while [ ${#_x} -gt 0 ]; do + case "${_x}" in + *,*) # Extract the first argument and strip it off the list. + _i=`expr "${_x}" : '^\([^,]*\)'` + _x=`expr "${_x}" : "^[^,]*,\(.*\)"` + ;; + *) _i=${_x} + _x="" + ;; + esac + + _type="" + _iface="" + _addr="" + _mask="" + jail_extract_address "${_i}" + + # make sure we got an address. + case "${_addr}" in + "") continue ;; + *) ;; + esac + + # Append address to list of addresses for the jail command. + case "${_addrl}" in + "") _addrl="${_addr}" ;; + *) _addrl="${_addrl},${_addr}" ;; + esac + + # Configure interface alias if requested by a given interface + # and if we could correctly parse everything. + case "${_iface}" in + "") continue ;; + esac + case "${_type}" in + inet) ;; + inet6) ;; + *) warn "Could not determine address family. Not going" \ + "to ${_action} address '${_addr}' for ${_jail}." + continue + ;; + esac + case "${_action}" in + add) ifconfig ${_iface} ${_type} ${_addr}${_mask} alias + ;; + del) # When removing the IP, ignore the _mask. + ifconfig ${_iface} ${_type} ${_addr} -alias + ;; + esac + done +} + +# jail_ips {add,del} +# Extract the comma separated list of addresses and return them +# for the jail command. +# Handle more than one address via the _multi option as well. +# If an interface is given also add/remove an alias for the +# address with an optional netmask. +# +jail_ips() +{ + local _action + _action=$1 + + case "${_action}" in + add) ;; + del) ;; + *) warn "jail_ips: invalid action '${_action}'" + return + ;; + esac + + # Handle addresses. + jail_handle_ips_option ${_action} "${_ip}" + # Handle jail_xxx_ip_multi + alias=0 + while : ; do + eval _x=\"\$jail_${_jail}_ip_multi${alias}\" + case "${_x}" in + "") break ;; + *) jail_handle_ips_option ${_action} "${_x}" + alias=$((${alias} + 1)) + ;; + esac + done +} + jail_start() { echo -n 'Configuring jails:' @@ -296,9 +495,8 @@ jail_start() echo -n " [${_hostname} already running (/var/run/jail_${_jail}.id exists)]" continue; fi - if [ -n "${_interface}" ]; then - ifconfig ${_interface} alias ${_ip} netmask 255.255.255.255 - fi + _addrl="" + jail_ips "add" if [ -n "${_fib}" ]; then _setfib="setfib -F '${_fib}'" else @@ -358,7 +556,7 @@ jail_start() fi _tmp_jail=${_tmp_dir}/jail.$$ eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \ - ${_ip} ${_exec_start} > ${_tmp_jail} 2>&1 + \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 if [ "$?" -eq 0 ] ; then _jail_id=$(head -1 ${_tmp_jail}) @@ -379,9 +577,7 @@ jail_start() echo ${_jail_id} > /var/run/jail_${_jail}.id else jail_umount_fs - if [ -n "${_interface}" ]; then - ifconfig ${_interface} -alias ${_ip} - fi + jail_ips "del" echo " cannot start jail \"${_jail}\": " tail +2 ${_tmp_jail} fi @@ -410,9 +606,7 @@ jail_stop() jail_umount_fs echo -n " $_hostname" fi - if [ -n "${_interface}" ]; then - ifconfig ${_interface} -alias ${_ip} - fi + jail_ips "del" rm /var/run/jail_${_jail}.id else echo " cannot stop jail ${_jail}. No jail id in /var/run" Modified: stable/7/share/man/man5/rc.conf.5 ============================================================================== --- stable/7/share/man/man5/rc.conf.5 Sat Feb 7 13:55:12 2009 (r188286) +++ stable/7/share/man/man5/rc.conf.5 Sat Feb 7 14:04:35 2009 (r188287) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 9, 2009 +.Dd January 25, 2009 .Dt RC.CONF 5 .Os .Sh NAME @@ -3398,8 +3398,38 @@ Set to the fully qualified domain name ( .It Va jail_ Ns Ao Ar jname Ac Ns Va _ip .Pq Vt str Unset by default. -Set to the IP address assigned to jail -.Va jname . +Set to the (primary) IPv4 and/or IPv6 address(es) assigned to the jail. +The argument can be a sole address or a comma separated list of addresses. +Additionally each address can be prefixed by the name of an interface +followed by a pipe to overwrite +.Va jail_ Ns Ao Ar jname Ac Ns Va _interface +or +.Va jail_interface +and/or suffixed by a netmask, prefixlen or prefix. +In case no netmask, prefixlen or prefix is given, +.Sq /32 +will be used for IPv4 and +.Sq /128 +will be used for an IPv6 address. +If no address is given for the jail then the jail will be started with +no networking support. +.It Va jail_ Ns Ao Ar jname Ac Ns Va _ip_multi Ns Aq Ar n +.Pq Vt str +Unset by default. +Set additional IPv4 and/or IPv6 address(es) assigned to the jail. +The sequence starts with +.Dq Li _multi0 +and the numbers have to be strictly ascending. +These entries follow the same syntax as their primary +.Va jail_ Ns Ao Ar jname Ac Ns Va _ip +entry. +The order of the entries can be important as the first address for +each address family found will be the primary address of the jail. +See +.Va ip-addresses +option in +.Xr jail 8 +for more details. .It Va jail_ Ns Ao Ar jname Ac Ns Va _flags .Pq Vt str Set to From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 14:55:29 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 A7C4C1065672; Sat, 7 Feb 2009 14:55:29 +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 7AED58FC13; Sat, 7 Feb 2009 14:55:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17EtT5R096116; Sat, 7 Feb 2009 14:55:29 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17EtTpX096114; Sat, 7 Feb 2009 14:55:29 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071455.n17EtTpX096114@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 14:55:29 +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: r188288 - in stable/7: share/mk sys sys/conf sys/contrib/pf sys/dev/cxgb 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, 07 Feb 2009 14:55:30 -0000 Author: bz Date: Sat Feb 7 14:55:29 2009 New Revision: 188288 URL: http://svn.freebsd.org/changeset/base/188288 Log: MFC: r186854 Using KMODOWN/KMODGRP rather than hard coding root/wheel for installing the kernel allows one, like with modules, to override the default user/group and install as non-su to a temporary directory to test, create images or seed a tftp dir. r186894 Document that we started using KMODOWN/KMODGRP for the kernel as well and no longer only for modules. Modified: stable/7/share/mk/ (props changed) stable/7/share/mk/bsd.own.mk stable/7/sys/ (props changed) stable/7/sys/conf/kern.post.mk stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/share/mk/bsd.own.mk ============================================================================== --- stable/7/share/mk/bsd.own.mk Sat Feb 7 14:04:35 2009 (r188287) +++ stable/7/share/mk/bsd.own.mk Sat Feb 7 14:55:29 2009 (r188288) @@ -44,9 +44,9 @@ # KMODDIR Base path for loadable kernel modules # (see kld(4)). [/boot/kernel] # -# KMODOWN KLD owner. [${BINOWN}] +# KMODOWN Kernel and KLD owner. [${BINOWN}] # -# KMODGRP KLD group. [${BINGRP}] +# KMODGRP Kernel and KLD group. [${BINGRP}] # # KMODMODE KLD mode. [${BINMODE}] # Modified: stable/7/sys/conf/kern.post.mk ============================================================================== --- stable/7/sys/conf/kern.post.mk Sat Feb 7 14:04:35 2009 (r188287) +++ stable/7/sys/conf/kern.post.mk Sat Feb 7 14:55:29 2009 (r188288) @@ -223,21 +223,21 @@ kernel-install: fi .endif mkdir -p ${DESTDIR}${KODIR} - ${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR} + ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} ${DESTDIR}${KODIR} .if defined(DEBUG) && !defined(INSTALL_NODEBUG) - ${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO}.symbols ${DESTDIR}${KODIR} + ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR} .endif .if defined(KERNEL_EXTRA_INSTALL) - ${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_EXTRA_INSTALL} ${DESTDIR}${KODIR} + ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_EXTRA_INSTALL} ${DESTDIR}${KODIR} .endif kernel-reinstall: @-chflags -R noschg ${DESTDIR}${KODIR} - ${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR} + ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} ${DESTDIR}${KODIR} .if defined(DEBUG) && !defined(INSTALL_NODEBUG) - ${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO}.symbols ${DESTDIR}${KODIR} + ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR} .endif config.o env.o hints.o vers.o vnode_if.o: From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 15:21:11 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 BFF5D1065673; Sat, 7 Feb 2009 15:21:11 +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 AE88F8FC1F; Sat, 7 Feb 2009 15:21:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17FLB4S096825; Sat, 7 Feb 2009 15:21:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17FLBAe096824; Sat, 7 Feb 2009 15:21:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071521.n17FLBAe096824@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 15:21:11 +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: r188289 - stable/7 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, 07 Feb 2009 15:21:12 -0000 Author: bz Date: Sat Feb 7 15:21:11 2009 New Revision: 188289 URL: http://svn.freebsd.org/changeset/base/188289 Log: MFC: r186519 Permit digits in the kernel config file names for `make universe'. This catches a few more kernel config for various architectures and permits having local configs named like NOINET6. Modified: stable/7/Makefile (contents, props changed) Modified: stable/7/Makefile ============================================================================== --- stable/7/Makefile Sat Feb 7 14:55:29 2009 (r188288) +++ stable/7/Makefile Sat Feb 7 15:21:11 2009 (r188289) @@ -279,7 +279,7 @@ universe_prologue: @echo "--------------------------------------------------------------" .for target in ${TARGETS} KERNCONFS!= cd ${.CURDIR}/sys/${target}/conf && \ - find [A-Z]*[A-Z] -type f -maxdepth 0 \ + find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \ ! -name DEFAULTS ! -name LINT KERNCONFS:= ${KERNCONFS:S/^NOTES$/LINT/} universe: universe_${target} From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 15:31: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 562941065674; Sat, 7 Feb 2009 15:31:24 +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 29F798FC08; Sat, 7 Feb 2009 15:31:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17FVOxp097039; Sat, 7 Feb 2009 15:31:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17FVOod097038; Sat, 7 Feb 2009 15:31:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902071531.n17FVOod097038@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 15:31: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: r188290 - stable/7/share/man/man5 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, 07 Feb 2009 15:31:25 -0000 Author: bz Date: Sat Feb 7 15:31:23 2009 New Revision: 188290 URL: http://svn.freebsd.org/changeset/base/188290 Log: MFC: r187668 Change IP addresses/prefixes to be from "Test-Net" (IPv4 documentation prefix 192.0.2.0/24) rather than from private-use networks. Modified: stable/7/share/man/man5/ (props changed) stable/7/share/man/man5/rc.conf.5 Modified: stable/7/share/man/man5/rc.conf.5 ============================================================================== --- stable/7/share/man/man5/rc.conf.5 Sat Feb 7 15:21:11 2009 (r188289) +++ stable/7/share/man/man5/rc.conf.5 Sat Feb 7 15:31:23 2009 (r188290) @@ -1085,9 +1085,9 @@ One can configure more than one IPv4 add variable. One or more IP addresses must be provided in Classless Inter-Domain Routing (CIDR) address notation, whose last byte can be a range like -192.168.0.5-23/24. -In this case the address 192.168.0.5 will be configured with the -netmask /24 and the addresses 192.168.0.6 to 192.168.0.23 with +192.0.2.5-23/24. +In this case the address 192.0.2.5 will be configured with the +netmask /24 and the addresses 192.0.2.6 to 192.0.2.23 with the non-conflicting netmask /32 as explained in the .Xr ifconfig 8 alias section. @@ -1095,7 +1095,7 @@ With the interface in question being .Li ed0 , an example could look like: .Bd -literal -ipv4_addrs_ed0="192.168.0.1/24 192.168.1.1-5/28" +ipv4_addrs_ed0="192.0.2.129/27 192.0.2.1-5/28" .Ed .Pp It is also possible to add IP alias entries using @@ -1205,7 +1205,7 @@ variable. It is also possible to rename interface by doing: .Bd -literal ifconfig_ed0_name="net0" -ifconfig_net0="inet 10.0.0.1 netmask 0xffff0000" +ifconfig_net0="inet 192.0.2.1 netmask 0xffffff00" .Ed .It Va ipv6_network_interfaces .Pq Vt str @@ -3281,7 +3281,7 @@ Assuming that the jail in question was n you would have the following dependent variables: .Bd -literal jail_vjail_hostname="jail.example.com" -jail_vjail_ip="192.168.1.100" +jail_vjail_ip="192.0.2.100" jail_vjail_rootdir="/var/jails/vjail/root" .Ed .Pp From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 15:51:21 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 94BB7106564A; Sat, 7 Feb 2009 15:51:21 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8369B8FC0C; Sat, 7 Feb 2009 15:51:21 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17FpLw7097442; Sat, 7 Feb 2009 15:51:21 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17FpLZQ097441; Sat, 7 Feb 2009 15:51:21 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200902071551.n17FpLZQ097441@svn.freebsd.org> From: Alan Cox Date: Sat, 7 Feb 2009 15:51:21 +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: r188291 - stable/7 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, 07 Feb 2009 15:51:22 -0000 Author: alc Date: Sat Feb 7 15:51:21 2009 New Revision: 188291 URL: http://svn.freebsd.org/changeset/base/188291 Log: Recent changes to the kernel increasing the size of the kernel and kmem maps on amd64 machines should trigger ZFS users to reevaluate their manual tuning of the kmem map. Modified: stable/7/UPDATING Modified: stable/7/UPDATING ============================================================================== --- stable/7/UPDATING Sat Feb 7 15:31:23 2009 (r188290) +++ stable/7/UPDATING Sat Feb 7 15:51:21 2009 (r188291) @@ -9,6 +9,13 @@ Items affecting the ports and packages s portupgrade. 20090207: + ZFS users on amd64 machines with 4GB or more of RAM should + reevaluate their need for setting vm.kmem_size_max and + vm.kmem_size manually. In fact, after recent changes to the + kernel, the default value of vm.kmem_size is larger than the + suggested manual setting in most ZFS/FreeBSD tuning guides. + +20090207: Multi-IPv4/v6/no-IP jail support was merged to STABLE. You need to rebuild jls(8) and to use the new features jail(8), jexec(8) and cpuset(1) with a new kernel. From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 7 21:07: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 0B6DC106566B; Sat, 7 Feb 2009 21:07:59 +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 ECF538FC16; Sat, 7 Feb 2009 21:07:58 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17L7wAf003500; Sat, 7 Feb 2009 21:07:58 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17L7w2N003499; Sat, 7 Feb 2009 21:07:58 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200902072107.n17L7w2N003499@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Feb 2009 21:07:58 +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: r188296 - 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: Sat, 07 Feb 2009 21:07:59 -0000 Author: bz Date: Sat Feb 7 21:07:58 2009 New Revision: 188296 URL: http://svn.freebsd.org/changeset/base/188296 Log: "MFC": sys/conf/kern.pre.mk r180012 (out of the larger commit) Without including bsd.own.mk KMODOWN/KMODGRP are not defined which after r188288 broke installkernel. Reported by: kib, Herbert J. Skuhra Reviewed by: kib Pointy hat to: bz Modified: stable/7/sys/conf/kern.pre.mk Modified: stable/7/sys/conf/kern.pre.mk ============================================================================== --- stable/7/sys/conf/kern.pre.mk Sat Feb 7 19:34:44 2009 (r188295) +++ stable/7/sys/conf/kern.pre.mk Sat Feb 7 21:07:58 2009 (r188296) @@ -3,10 +3,7 @@ # Part of a unified Makefile for building kernels. This part contains all # of the definitions that need to be before %BEFORE_DEPEND. -SRCCONF?= /etc/src.conf -.if exists(${SRCCONF}) -.include "${SRCCONF}" -.endif +.include # Can be overridden by makeoptions or /etc/make.conf KERNEL_KO?= kernel